[PATCH] D55309: ThinLTO: Do not import debug info for imported global constants

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 5 11:16:50 PST 2018


tejohnson added a comment.

In D55309#1320490 <https://reviews.llvm.org/D55309#1320490>, @dblaikie wrote:

> From what I'm seeing, I would imagine this may regress debug info quality a bit. In the narrow example given, the DWARF still ends up with a description of 'foo', but without any location/value - though this is the same as if 'foo' was in the same translation unit (looks like LLVM fails to track the removing of the global and replacing everything with a constant - I believe the debug info metadata supports describing such a situation, but it isn't being used here - with or without this new change). SO that's not a regression.
>
> But my concern would be if the global variable was in a different static library - then the user could have the variable imported, internalized, the debug info dropped there (with the patch I'm proposing), but then the original object in that static library may never be linked in (since its symbol is no longer needed) - so the resulting program has no DWARF that describes the variable.


That can't happen. The ThinLink only sees object files out of static libraries that the linker decided to include in the final link (again, this is all driven off of linker info).

> I'd like to test this situation, if it's possible - does ThinLTO implement static library-style semantics? Yep, I was able to test that - didn't seem to be a problem. I guess maybe the linker looked at the object dependencies pre-optimization, rather than post-optimization, so the backend foo.o was still linked in, by the looks of it. I guess that makes sense.
> 
> So yeah, maybe there is no debug info loss here?




Repository:
  rL LLVM

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

https://reviews.llvm.org/D55309





More information about the llvm-commits mailing list