Tim Northover via llvm-dev
2017-May-03 16:17 UTC
[llvm-dev] clang assembler keeps .Linfo_string symbols?
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. Tim.
Rafael Avila de Espindola via llvm-dev
2017-May-03 17:12 UTC
[llvm-dev] clang assembler keeps .Linfo_string symbols?
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
Michael Johnson via llvm-dev
2017-May-03 17:16 UTC
[llvm-dev] clang assembler keeps .Linfo_string symbols?
That was probably my fault - not sure of the niceties of the list. Also not sure I understand why the integrated assembler behaves differently. I guess gold is never used with object files produced this way? Regards Michael> 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 >