[PATCH] D59553: [LLD][ELF][DebugInfo] llvm-symbolizer shows incorrect source line info if --gc-sections used

ben via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 28 10:07:24 PDT 2019


bd1976llvm added a comment.

Apologies that I didn't check the information on the original bug. The GDB behaviour does look reasonable, thanks.



================
Comment at: lld/ELF/InputSection.cpp:834
       Target->relocateOne(BufLoc, Type, SignExtend64<Bits>(Sym.getVA(Addend)));
+    else
+      // If relocation points to the deleted section (-Wl,--gc-sections),
----------------
jhenderson wrote:
> avl wrote:
> > grimar wrote:
> > > jhenderson wrote:
> > > > This will patch any non-alloc section that is relocated, not just .debug* sections. I think it should be scoped to those kinds of sections only, as it could break the behaviour for other unknown sections that people may have.
> > > Hmmm... I do not agree here. I think if the user's section assumes that linker resolves the relocation to a removed section as a zero, that does not seem the correct assumption to me. I doubt we should care that we switched the behavior here (or at least we probably want to know about such cases before explicitly supporting them, I think).
> > In some previous version of the patch there was a check for Name.startswith(".debug") which I was asked to remove because "checking the symbol name is very hacky". Would it be OK to return it here ? Or probably solution similar to https://reviews.llvm.org/D54747 would be OK ? (create a flag Debug, set it Debug = Name.startswith(".debug"), and check it here)
> I don't feel strongly about it, so if there's opposition, what is here is probably fine, I think.
Checking the section name (not symbol name) is not *hacky* in this case. Section names that start with the prefix ".debug" are reserved "for the system". Checking that the section name starts with the prefix ".debug" is the correct ELF way to determine if it is a debug information section. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59553/new/

https://reviews.llvm.org/D59553





More information about the llvm-commits mailing list