[llvm-dev] clang assembler keeps .Linfo_string symbols?

Rafael Avila de Espindola via llvm-dev llvm-dev at lists.llvm.org
Wed May 3 10:12:46 PDT 2017


Tim Northover <t.p.northover at gmail.com> writes:

> On 3 May 2017 at 08:01, Rafael Avila de Espindola via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> Can you provide a .s file that shows the difference?
>
> I managed to reproduce it by compiling 'char *var = "whatever";' in
> debug mode (so clang -target arm-none-eabi tmp.c -g"). Direct compile
> leaves no assembler-local strings, but for some reason going via -S
> does. I've not investigated further I'm afraid.

Sorry, had somehow replied off list:

   This reduces to

           .section        .debug_str,"MS",%progbits,1
   .Linfo_string8:
           .long   .Linfo_string8

   the difference comes from ELFObjectWriter::shouldRelocateWithSymbol. In
   particular

       // It looks like gold has a bug (http://sourceware.org/PR16794) and can
       // only handle section relocations to mergeable sections if using RELA.
       if (!hasRelocationAddend())
         return true;

   If I remove that we produce a relocation with the section, as does
   gas. The gold bug has not been fixed :-(

   Cheers,
   Rafael



More information about the llvm-dev mailing list