#144687 - bpoint - Mon Nov 05, 2007 7:40 pm
Thanks to wintermute and tepples, I was able to solve the problem with dead code not being eliminated, but now I am faced with five remaining "undefined reference" errors during linking:
I wouldn't expect anyone to know these functions, as they're ones internal to our engine. The problem is, I'm clearly linking in the libraries necessary (CFArchive is in libDebug-CFArchive.a, and CFFont is in libDebug-CFFont.a), so I don't understand why I'm getting any link errors at all.
Examining the output .map file shows that the libraries are indeed being used (there is a LOAD tag within the .stack section for that library), and strangely, there seems to be interwork code generated for these missing functions. For example, CFFont::drawAlignedText shows up in the .map file with:
But I'm not seeing any of the missing functions within the "Archive member included because of file (symbol)" section -- which I can only guess means that they're not being included for some reason.
I was originally using devkitARM r20, but noticed r21 was recently released, so I upgraded, but unfortunately it didn't help.
I should also mention that the dead code stripping is probably unrelated to this. I was getting a lot (more than 100) of these undefined references before I enabled the dead code strip compiler options, but I figured that they were irrelevant since the ewram size was already being exceeded. Unfortunately, these five seem to still remain.
Any suggestions? I'm willing to post my .map file or Makefile if it would help narrow down the problem...
Code: |
36>------ Build started: Project: sandbox, Configuration: Debug GBA ------
36>Performing Makefile project actions 36>arm-eabi-g++ -mthumb -mthumb-interwork -Wl,-Map,sandbox.elf.map -Wl,-gc-sections -specs=gba_mb.specs sandbox.o -L/c/CF/lib/gba -lDebug-CFADT -lDebug-CFAlgebra -lDebug-CFAnimation -lDebug-CFArchive -lDebug-CFAudio -lDebug-CFBitStream -lDebug-CFCamera -lDebug-CFCompress -lDebug-CFEncrypt -lDebug-CFFile -lDebug-CFFont -lDebug-CFGUI -lDebug-CFGeometry -lDebug-CFGfx -lDebug-CFHash -lDebug-CFHierarchy -lDebug-CFIniFile -lDebug-CFInput -lDebug-CFKeitaiComm -lDebug-CFLibc -lDebug-CFLog -lDebug-CFMath -lDebug-CFMem -lDebug-CFModel -lDebug-CFMusic -lDebug-CFOS -lDebug-CFPrim -lDebug-CFProcedural -lDebug-CFResource -lDebug-CFSerialPort -lDebug-CFSound -lDebug-CFTerrain -lDebug-CFTexture -lDebug-CFUtils -lDebug-CFWorld -o sandbox.elf 36>c:/CF/lib/gba\libDebug-CFFile.a(disk.o): In function `__static_initialization_and_destruction_0': 36>c:/CF/src/base/CFFile/build/gba/Debug/../../../disk.cpp:28: undefined reference to `CFArchive::CFArchive()' 36>c:/CF/lib/gba\libDebug-CFFile.a(disk.o): In function `__tcf_0': 36>c:/CF/src/base/CFFile/build/gba/Debug/../../../disk.cpp:28: undefined reference to `CFArchive::~CFArchive()' 36>c:/CF/lib/gba\libDebug-CFGUI.a(window.o): In function `CFGUIWindow::drawWindowFrame(CFGfx::Device*)': 36>c:/CF/src/gfx/CFGUI/build/gba/Debug/../../../window.cpp:185: undefined reference to `CFFontGetFont(unsigned int)' 36>c:/CF/src/gfx/CFGUI/build/gba/Debug/../../../window.cpp:186: undefined reference to `CFFont::setColor(CFcolor<unsigned char> const*)' 36>c:/CF/src/gfx/CFGUI/build/gba/Debug/../../../window.cpp:189: undefined reference to `CFFont::drawAlignedText(CFGfx::Device*, fxps16, fxps16, fxps16, CFFontAlignment, char const*, bool)' 36>collect2: ld returned 1 exit status 36>make[1]: *** [sandbox.elf] Error 1 36>make: *** [debug] Error 2 36>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions" |
I wouldn't expect anyone to know these functions, as they're ones internal to our engine. The problem is, I'm clearly linking in the libraries necessary (CFArchive is in libDebug-CFArchive.a, and CFFont is in libDebug-CFFont.a), so I don't understand why I'm getting any link errors at all.
Examining the output .map file shows that the libraries are indeed being used (there is a LOAD tag within the .stack section for that library), and strangely, there seems to be interwork code generated for these missing functions. For example, CFFont::drawAlignedText shows up in the .map file with:
Code: |
0x0201b7e8 ___ZN6CFFont15drawAlignedTextEPN5CFGfx6DeviceE6fxps16S3_S3_15CFFontAlignmentPKcb_from_thumb
0x0201b7ec ___ZN6CFFont15drawAlignedTextEPN5CFGfx6DeviceE6fxps16S3_S3_15CFFontAlignmentPKcb_change_to_arm |
But I'm not seeing any of the missing functions within the "Archive member included because of file (symbol)" section -- which I can only guess means that they're not being included for some reason.
I was originally using devkitARM r20, but noticed r21 was recently released, so I upgraded, but unfortunately it didn't help.
I should also mention that the dead code stripping is probably unrelated to this. I was getting a lot (more than 100) of these undefined references before I enabled the dead code strip compiler options, but I figured that they were irrelevant since the ewram size was already being exceeded. Unfortunately, these five seem to still remain.
Any suggestions? I'm willing to post my .map file or Makefile if it would help narrow down the problem...