Fix for PR32577.
Global variables may have !associated metadata, which includes a reference to another global, and needs remapping.
Details
- Reviewers
pcc • rafael dexonsmith aprantl
Diff Detail
- Repository
- rL LLVM
Event Timeline
LGTM
We were probably getting lucky with other metadata attachments for globals (e.g. !dbg), presumably these would need to be mapped as well if a global reference was reachable from DIGlobalVariable (I was under the impression that this was still possible with templates in some cases, but maybe this has been fixed -- @dexonsmith?).
This LGTM too.
I'm not sure if globals are still reachable via !dbg, but it certainly used to be possible. Adrian, do you know the current state?
I'm not sure if globals are still reachable via !dbg, but it certainly used to be possible. Adrian, do you know the current state?
I'm not sure I understand your question:
Global variables can either be described as !dbg attachments to globals:
@a = global i32, !dbg !0 !0 = !DIGlobalVariableExpression(var: DIGlobalVariable(name: "a"...))
or via a DICompileUnit:
!0 = DICompileUnit(..., globals: !{!1}) !1 = !DIGlobalVariableExpression(var: DIGlobalVariable(name: "my_const", expr: DIExpression(DW_OP_constu, 23)))
LLVM globals cannot be referenced from metadata any more if that is what you meant.