[all-commits] [llvm/llvm-project] 995539: [LLD] [COFF] Don't add pseudo relocs for dangling ...
Martin Storsjö via All-commits
all-commits at lists.llvm.org
Tue Apr 16 14:42:08 PDT 2024
Branch: refs/heads/release/18.x
Home: https://github.com/llvm/llvm-project
Commit: 995539ce05ba27f5ed1115c13bbe9a32a035f709
https://github.com/llvm/llvm-project/commit/995539ce05ba27f5ed1115c13bbe9a32a035f709
Author: Martin Storsjö <martin at martin.st>
Date: 2024-04-16 (Tue, 16 Apr 2024)
Changed paths:
M lld/COFF/Chunks.cpp
A lld/test/COFF/autoimport-gc.s
Log Message:
-----------
[LLD] [COFF] Don't add pseudo relocs for dangling references (#88487)
When doing GC, we normally won't have dangling references, because such
a reference would keep the other section alive, keeping it from being
eliminated.
However, references within DWARF sections are ignored for the purposes
of GC (because otherwise, they would essentially keep everything alive,
defeating the point of the GC), see
c579a5b1d92a9bc2046d00ee2d427832e0f5ddec for more context.
Therefore, dangling relocations against discarded symbols are ignored
within DWARF sections (see maybeReportRelocationToDiscarded in
Chunks.cpp). Consequently, we also shouldn't create any pseudo
relocations for these cases, as we run into a null pointer dereference
when trying to generate the pseudo relocation info for it.
This fixes the downstream bug
https://github.com/mstorsjo/llvm-mingw/issues/418, fixing crashes on
combinations with -ffunction-sections, -fdata-sections,
-Wl,--gc-sections and debug info.
(cherry picked from commit 9c970d5ecd6a85188cd2b0a941fcd4d60063ef81)
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list