[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ld: once multiple symbol definitions are allowed, both definitions e
Re: ld: once multiple symbol definitions are allowed, both definitions end up in the executable
Tue, 17 Jan 2017 15:56:05 +0100
Thanks a lot for the answer: it put me on the right track. The '-ffunction-sections' option works OK on toy examples though GNU linker crashed when I tried the following on real-life object files compiled with -ffunction-sections and -fdata-sections options enabled:
for i in $object_files_original
objcopy --weaken $i # weaken symbols for linker not to complain about multiple definitions
ld.bfd -r --gc-sections -u external_symbol1... $object_files_with_replacement_fucntions $object_files_original -o combined.o
ld.bfd: BFD (GNU Binutils) 2.27 assertion fail elflink.c:8380
<repeated 6 times more>
Any clues how to debug it?
Also I have not tried COMDAT magic: looks like there are no any external tweaks to put function to COMDAT sections but g++ decides on its own what should be go to COMDAT sections.