[llvm] r211500 - Stop producing func.eh symbols on Darwin.

Steven Wu stevenwu at apple.com
Thu Jul 17 14:23:41 PDT 2014


Hi Rafael

I don’t know if you are expecting this, but this commit breaks the old x86_64 OS X systems (10.5 and below) which need __eh_frame. It will failed to compile any programs for old OS X (with “-mmacosx-version-min” flag). I attached two simple test cases which give slightly different error messages:

$ clang -arch x86_64 -Os -mmacosx-version-min=10.4 test_case.c -o test.o
ld: sectionForAddress(0xFFFFFFFFFF91969F) address not in any section file '/var/folders/cg/pyj86ks15y74w3hkwhm_zltm0000gp/T/test_case-cd1eb6.o' for architecture x86_64
clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation)
$ clang -arch x86_64 -Os -mmacosx-version-min=10.4 test_case2.c -o test
ld: symbol index out of range file '/var/folders/cg/pyj86ks15y74w3hkwhm_zltm0000gp/T/test_case2-9a07c6.o' for architecture x86_64
clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation)

The reason of the failure is that the OS X linker cannot recognize the generated relocations in __eh_frame. The current clang will create relocation section looks like:
Relocation information (__TEXT,__eh_frame) 4 entries
address  pcrel length extern type    scattered symbolnum/value
00000048 False quad   False  SUB     False     2 (__TEXT,__eh_frame)
00000048 False quad   True   UNSIGND False     _main
00000020 False quad   False  SUB     False     2 (__TEXT,__eh_frame)
00000020 False quad   True   UNSIGND False     _foo
But the linker is expecting either a pair of SUB/UNSIGNED relocations in eh_frame (for old systems) or no relocations (for new systems). A fix might just be remove all the relocations in eh_frame. I CCed Nick in this thread, so Nick correct me if I am wrong.

Thanks

Steven


> Author: rafael
> Date: Mon Jun 23 10:13:23 2014
> New Revision: 211500
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=211500&view=rev
> Log:
> Stop producing func.eh symbols on Darwin.
> 
> According Nick Kledzik (http://llvm.org/bugs/show_bug.cgi?id=19430#c2):
> "... mach-o no longer needs names in the __eh_frame section (and has not for
> years)."
> 
> Iain Sandoe confirms it is also unnecessary for their old darwin support.
> 
> Removed:
>     llvm/trunk/test/MC/MachO/eh-symbols.s
> Modified:
>     llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
>     llvm/trunk/lib/MC/MCDwarf.cpp
>     llvm/trunk/lib/MC/MCObjectFileInfo.cpp
>     llvm/trunk/test/MC/MachO/eh-frame-reloc.s
> 
> Modified: llvm/trunk/include/llvm/MC/MCObjectFileInfo.h

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/bc9f36c5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_case.c
Type: application/octet-stream
Size: 62 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/bc9f36c5/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/bc9f36c5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_case2.c
Type: application/octet-stream
Size: 29 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/bc9f36c5/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140717/bc9f36c5/attachment-0002.html>


More information about the llvm-commits mailing list