Issue 64626
Summary LLDB relies on linker --apply-dynamic-relocs to print globals on x86-64
Labels lldb
Assignees
Reporter mysterymath
    LLDB's test suite includes a number of cases where a global string constant is printed, e.g.:
https://github.com/llvm/llvm-project/blob/06adac8c4e26376fb54d87dede3ebce46783010a/lldb/test/API/commands/target/basic/globals.c#L4
https://github.com/llvm/llvm-project/blob/06adac8c4e26376fb54d87dede3ebce46783010a/lldb/test/API/commands/target/basic/TestTargetCommand.py#L170

When building for Debian x86-64 using LLD, these instead print as nullptr. These have RELA dynamic relocations, and the addend is stored in the relocation, while the data section is all zeroes. LLD has a flag, `--apply-dynamic-relocs`, to redundantly store the addend in the data section as well, but it disables it by default, since it's considered to be a legacy behavior. ld and gold, by contrast, both default to this flag being true. Accordingly, the test suite as-is fails for each of these cases when built with LLD in its default configuration.

Seems like LLDB shouldn't depend on this behavior if possible; it should be able to read the value out of the dynamic relocations. 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to