[PATCH] D36466: [ELF] - Do not omit common symbols when -Map is given.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 02:10:20 PDT 2017


>> +template <class ELFT> static std::vector<Defined *> getSymbols() {
>> +  std::vector<Defined *> V;
>> +  for (ObjFile<ELFT> *File : ObjFile<ELFT>::Instances) {
>> +    for (SymbolBody *B : File->getSymbols()) {
>> +      if (auto *DR = dyn_cast<DefinedRegular>(B)) {
>>          if (DR->getFile() == File && !DR->isSection() && DR->Section &&
>>              DR->Section->Live)
>>            V.push_back(DR);
>> +      } else if (auto *DC = dyn_cast<DefinedCommon>(B)) {
>> +        if (InX::Common)
>
>When is InX::Common missing?
>
>LGTM with the if removed if appropriated.
>
>Cheers,
>Rafael

This happens with --no-define-common or -r,
I'll update the diff with testcase to demostrate.

And so with this flags we do not print common symbols atm.
That looks consistent with ld.bfd behavior which output is below:
1) with --no-define-common:
.bss            0x0000000000601000        0x0
 *(.dynbss)
 *(.bss .bss.* .gnu.linkonce.b.*)
 *(COMMON)
 COMMON         0x0000000000601000        0x0 foo.o
 COMMON         0x0000000000601000        0x0 bar.o
                0x0000000000601000                . = ALIGN ((. != 0x0)?0x8:0x1)

2) without --no-define-common:
.bss            0x00000000006000b8        0x8
 *(.dynbss)
 *(.bss .bss.* .gnu.linkonce.b.*)
 *(COMMON)
 COMMON         0x00000000006000b8        0x4 foo.o
                0x00000000006000b8                foo
 COMMON         0x00000000006000bc        0x4 bar.o
                0x00000000006000bc                bar
                0x00000000006000c0                . = ALIGN ((. != 0x0)?0x8:0x1)

Should we do something to print these in case of -r/--no-define-common ?

Best regards,
George | Developer | Access Softek, Inc


More information about the llvm-commits mailing list