Page MenuHomePhabricator

[lld-link] Ignore undefined symbols in .addrsig table
AbandonedPublic

Authored by zequanwu on Apr 21 2021, 9:17 AM.

Details

Reviewers
rnk
Summary

Undefined symbols in .addrsig table just mark symbols as addrsig to avoid icf, and not required to be resolved. We could just ignore them.

Diff Detail

Unit TestsFailed

TimeTest
270 msx64 debian > lld.COFF::lto-comdat.ll
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llvm-as -o /mnt/disks/ssd0/agent/llvm-project/build/tools/lld/test/COFF/Output/comdat-main.lto.obj /mnt/disks/ssd0/agent/llvm-project/lld/test/COFF/lto-comdat.ll
30 msx64 debian > lld.COFF::lto-cpu-string.ll
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llvm-as /mnt/disks/ssd0/agent/llvm-project/lld/test/COFF/lto-cpu-string.ll -o /mnt/disks/ssd0/agent/llvm-project/build/tools/lld/test/COFF/Output/lto-cpu-string.ll.tmp.obj
50 msx64 debian > lld.COFF::lto-icf.ll
Script: -- : 'RUN: at line 5'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llvm-as /mnt/disks/ssd0/agent/llvm-project/lld/test/COFF/lto-icf.ll -o /mnt/disks/ssd0/agent/llvm-project/build/tools/lld/test/COFF/Output/lto-icf.ll.tmp.bc
80 msx64 debian > lld.COFF::lto-lazy-reference.ll
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llc -mtriple=i686-pc-windows-msvc -filetype=obj -o /mnt/disks/ssd0/agent/llvm-project/build/tools/lld/test/COFF/Output/lto-lazy-reference-quadruple.obj /mnt/disks/ssd0/agent/llvm-project/lld/test/COFF/Inputs/lto-lazy-reference-quadruple.ll
30 msx64 debian > lld.COFF::lto-new-symbol.ll
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llvm-as -o /mnt/disks/ssd0/agent/llvm-project/build/tools/lld/test/COFF/Output/lto-new-symbol.ll.tmp.obj /mnt/disks/ssd0/agent/llvm-project/lld/test/COFF/lto-new-symbol.ll
View Full Test Results (18 Failed)

Event Timeline

zequanwu requested review of this revision.Apr 21 2021, 9:17 AM
zequanwu created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2021, 9:17 AM

This is not correct. A symbol marked by .addrsig_sym can be referenced via normal means. With this patch, the diagnostic may change from error: undefined symbol: bar to error: relocation against symbol in discarded section: bar

zequanwu abandoned this revision.Apr 21 2021, 1:13 PM

This is not correct. A symbol marked by .addrsig_sym can be referenced via normal means. With this patch, the diagnostic may change from error: undefined symbol: bar to error: relocation against symbol in discarded section: bar

Thanks for pointing it out. I put a new patch here: D100994

rnk added a comment.Apr 21 2021, 1:14 PM

I'm guessing ELF doesn't solve the same problem this way. Does LLVM MC make these .addrsig_sym references weak if there are no other references? That would solve the issue.