[LLVMdev] [lld] Linker cannot handle sections with non-unique names

Simon Atanasyan simon at atanasyan.com
Sat Apr 18 04:52:56 PDT 2015


Hi,

FYI

LLD cannot handle ELF sections with non-unique names. An object file
with such sections can be generated by the Clang since r234143. I am
not sure that Clang works absolutely correct but bfd linker works
fine.

Right now I do not have a time to investigate this problem. If nobody
take, I will try to solve it later.

Here is the reproduction script for x86_64 host:

$ cat test.cc
template <class T>
void foo(T) {}

int main() {
  foo(0);
  foo(1.0);
}

$ clang++ -c test.cc -fno-unique-section-names
$ lld -flavor gnu -target x86_64 --hash-style=both --build-id \
  --eh-frame-hdr -m elf_x86_64 \
  -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out \
  <bunch of regular linker arguments here>
$ ./a.out
Illegal instruction

$ clang++ -c test.cc -funique-section-names
$ lld -flavor gnu -target x86_64 --hash-style=both --build-id \
  --eh-frame-hdr -m elf_x86_64 \
  -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out \
  <bunch of regular linker arguments here>
$ ./a.out

-- 
Simon Atanasyan



More information about the llvm-dev mailing list