[llvm-dev] [LLD] Linking static library does not resolve symbols as gold/ld

Rafael Avila de Espindola via llvm-dev llvm-dev at lists.llvm.org
Mon May 15 13:31:34 PDT 2017


Rui Ueyama via llvm-dev <llvm-dev at lists.llvm.org> writes:

> I'll continue investigating.

I reduced this to just

-----------------------------------
.globl  _start
_start:
 callq foo

        .section        .text.bar,"axG", at progbits,abc,comdat
        .section        .text.foo,"axG", at progbits,xyz,comdat
        .global foo
foo:
        mov $60, %rax
        mov $0, %rdi
        syscall
-----------------------------------

The original .o contains

  [ 1] .group            GROUP           0000000000000000 000040 000008 04     10   6  4
  [ 2] .group            GROUP           0000000000000000 000048 000008 04     10   7  4

     6: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT    1 abc
     7: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT    2 xyz

I.E, the sh_info points to the symbols where the names are to be
found. But the .o produced by gold has:

  [ 1] abc               GROUP           0000000000000000 000040 000008 04      9   1  4
  [ 2] xyz               GROUP           0000000000000000 000048 000008 04      9   2  4

     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    2

I.E, the sh_info points to the sections themselves.

I will report the relevant bugs.

Cheers,
Rafael


More information about the llvm-dev mailing list