NO

Author Topic: Imported-only symbols problem  (Read 2235 times)

sapero

  • Guest
Imported-only symbols problem
« on: December 03, 2009, 02:41:41 AM »
When an external symbol...
Code: [Select]
if (!symbol->SectionNumber && (symbol->StorageClass == IMAGE_SYM_CLASS_EXTERNAL))... is not referenced in any relocation, the linker still tries to find a module X with this symbol and appends it to the final binary, although no symbol from X is directly referenced. Example (masm)
Code: [Select]
; start
segment .text
extern _blah ; has no references
global _main
_main: ret
; end
Same bug has MS linker. I have a set of OOP compilers where such dummy symbols are imported, and this makes impossible to link such module with link or polink. But I have recently created a plugin which loads all object files before the linker loads them, and changes
Code: [Select]
symbol->SectionNumber = IMAGE_SYM_ABSOLUTE;
symbol->StorageClass = IMAGE_SYM_CLASS_STATIC;
for all imported only symbols, so this is no more problem for me.