For clarity, the radar that I filed over which Apple has inflicted this
pain on us was...
------------------------------------------------------------------------------
Problem ID: 7920267 possible linker bug exposed by LTO
28-Apr-2010 07:18 PM Jack Howarth:
The FSF gcc developers are implementing their Link Time Optimization support
for darwin and it appears to have exposed a possible assembler or linker bug
when compiling the aermod benchmark. The failure can be reproduced with the
attached test case which executes...
as -arch x86_64 -force_cpusubtype_ALL -o aermod.o aermod.s
/usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.6.3
-weak_reference_mismatches non-weak -o aermod -lcrt1.10.5.o -L./ aermod.o
-lgfortran -lgcc_s.10.5 -lgcc_ext.10.5 -no_compact_unwind -lSystem -v
I have provided a bad_link shell script which automatically executes these
commands that produce the linker error...
@(#)PROGRAM:ld PROJECT:ld64-97.2
Library search paths:
./
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
ld: in aermod.o, in section __TEXT,__text reloc 17: local relocation for
address 0x000FB35C in section __text does not target section __00000B26
29-Apr-2010 09:35 AM Jack Howarth:
When the assembly files are modified by hand, it has been found that
if the normal output of -flto in FSF gcc is changed from...
LTO sections (the __GNU_LTO stuff)
.text / .data / etc. (all non-LTO sections)
LTO __section_names section
...to a re-ordered .s file of...
.text / .data / etc. (all non-LTO sections)
LTO sections (the __GNU_LTO stuff)
LTO __section_names section
...the linker error disappears. Is this the approach that we need
to take to avoid this issue?
----------------------------------------------------------------------
Apple never responded to this radar with either an analysis or a notification
of a proposed bug fix.
Jack