[LLVMbugs] [Bug 22100] New: ld crashes on non-symbolic relocation for cstring entry (r225048 breaks ObjC on AArch64).

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 5 16:38:09 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22100

            Bug ID: 22100
           Summary: ld crashes on non-symbolic relocation for cstring
                    entry (r225048 breaks ObjC on AArch64).
           Product: libraries
           Version: trunk
          Hardware: Other
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: lhames at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13634
  --> http://llvm.org/bugs/attachment.cgi?id=13634&action=edit
Reduced test case.

r225048 broke ObjC on AArch64 - ld doesn't know how to handle relocations to
cstring entries without labels and crashes with an assertion:

0  0x10ca67571  __assert_rtn + 144
1  0x10ca79251 
mach_o::relocatable::PointerToCStringSection<arm64>::targetCString(mach_o::relocatable::Atom<arm64>
const*, ld::IndirectBindingTable const&) const + 297
2  0x10ca78dcc 
mach_o::relocatable::PointerToCStringSection<arm64>::contentHash(mach_o::relocatable::Atom<arm64>
const*, ld::IndirectBindingTable const&) const + 58
3  0x10ca75f6e 
mach_o::relocatable::Atom<arm64>::contentHash(ld::IndirectBindingTable const&)
const + 42
4  0x10caac11e 
std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<ld::Atom
const*, unsigned int>, void*>*>
std::__1::__hash_table<std::__1::__hash_value_type<ld::Atom const*, unsigned
int>, std::__1::__unordered_map_hasher<ld::Atom const*,
std::__1::__hash_value_type<ld::Atom const*, unsigned int>,
ld::tool::SymbolTable::ReferencesHashFuncs, true>,
std::__1::__unordered_map_equal<ld::Atom const*,
std::__1::__hash_value_type<ld::Atom const*, unsigned int>,
ld::tool::SymbolTable::ReferencesHashFuncs, true>,
std::__1::allocator<std::__1::__hash_value_type<ld::Atom const*, unsigned int>
> >::find<ld::Atom const*>(ld::Atom const* const&) + 36
5  0x10caab235  ld::tool::SymbolTable::findSlotForReferences(ld::Atom const*,
ld::Atom const**) + 117
6  0x10caab141  ld::tool::SymbolTable::addByReferences(ld::Atom const&) + 25
7  0x10caab31b  ld::tool::SymbolTable::add(ld::Atom const&, bool) + 61
8  0x10cab0371  ld::tool::Resolver::doAtom(ld::Atom const&) + 893
9  0x10ca7a92c 
mach_o::relocatable::File<arm64>::forEachAtom(ld::File::AtomHandler&) const +
54
10  0x10caa7b8f 
ld::tool::InputFiles::forEachInitialAtom(ld::File::AtomHandler&, ld::Internal&)
+ 471
11  0x10cab2a72  ld::tool::Resolver::resolve() + 48
12  0x10ca680e0  main + 682
ld: Assertion failed: (atom->fixupCount() == 1), function targetCString, file
src/ld/parsers/macho_relocatable_file.cpp, line 5707.

To reproduce run:

llvm-mc -arch arm64 -assemble -filetype=obj -o testcase.o testcase.s

ld -dynamic -arch arm64 -iphoneos_version_min 7.0.0 \
   -syslibroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk
\
   -o testcase testcase.o

With r225048 applied you'll see the crash. With r225048 backed out you'll just
see: 'ld: dynamic main executables must link with libSystem.dylib for
architecture arm64'.

Unfortunately I think this means we can't keep r225048 for the time being:
There are too many linkers with this issue out in the wild. I'm going to revert
on trunk momentarily.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150106/6efe6e85/attachment.html>


More information about the llvm-bugs mailing list