This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho][nfc] Test that we don't emit undef symbol errors for dead code
ClosedPublic

Authored by int3 on Oct 25 2021, 1:26 PM.

Details

Summary

This is what ld64 does too, so we have parity here (though I think ld64
still removes dead code more effectively than we do...)

Diff Detail

Event Timeline

int3 created this revision.Oct 25 2021, 1:26 PM
Herald added a project: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Oct 25 2021, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2021, 1:26 PM
thakis accepted this revision.Oct 25 2021, 1:38 PM
thakis added a subscriber: thakis.

lg

This revision is now accepted and ready to land.Oct 25 2021, 1:38 PM
thakis added inline comments.Oct 25 2021, 1:43 PM
lld/test/MachO/treat-undef-sym.s
61

(maybe add a new undef symbol and a new _dead symbol in addition to the current one? testing having undefs ref'd by live code seems useful too.)

int3 marked an inline comment as done.Oct 25 2021, 4:05 PM
int3 added inline comments.
lld/test/MachO/treat-undef-sym.s
61

good idea :)

This revision was automatically updated to reflect the committed changes.
int3 marked an inline comment as done.
dyung added a subscriber: dyung.EditedOct 25 2021, 6:44 PM

The PS4 linux build bot is still failing after that fix:
https://lab.llvm.org/buildbot/#/builders/139/builds/12148

Command Output (stderr):
--
split-file: error: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/lld/test/MachO/treat-undef-sym.s: No such file or directory
--
oontvoo added a comment.EditedOct 25 2021, 6:52 PM

The PS4 linux build bot is still failing after that fix:
https://lab.llvm.org/buildbot/#/builders/139/builds/12148

Command Output (stderr):
--
split-file: error: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/lld/test/MachO/treat-undef-sym.s: No such file or directory
--

Oh, I think int3 should have rm %t and not %s!
should be fixed with https://github.com/llvm/llvm-project/commit/46ef187dccd3be85d0490cf3e5dc73607a4a2ef2 now

dyung added a comment.Oct 25 2021, 7:00 PM

The PS4 linux build bot is still failing after that fix:
https://lab.llvm.org/buildbot/#/builders/139/builds/12148

Command Output (stderr):
--
split-file: error: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/lld/test/MachO/treat-undef-sym.s: No such file or directory
--

Oh, I think int3 should have rm %t and not %s!
should be fixed with https://github.com/llvm/llvm-project/commit/46ef187dccd3be85d0490cf3e5dc73607a4a2ef2 now

Still failing I'm afraid :(

https://lab.llvm.org/buildbot/#/builders/139/builds/12149

Command Output (stderr):
--
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/lld/test/MachO/treat-undef-sym.s:40:10: error: ERROR: expected string not found in input
# ERROR: error: undefined symbol: _bar
         ^
<stdin>:1:1: note: scanning from here
ld64.lld: error: cannot open /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/lld/test/MachO/Output/treat-undef-sym.s.tmp/dead.o: No such file or directory
^
<stdin>:1:11: note: possible intended match here
ld64.lld: error: cannot open /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/lld/test/MachO/Output/treat-undef-sym.s.tmp/dead.o: No such file or directory
          ^
Input file: <stdin>
Check file: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/lld/test/MachO/treat-undef-sym.s
-dump-input=help explains the following input dump.
Input was:
<<<<<<
            1: ld64.lld: error: cannot open /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/lld/test/MachO/Output/treat-undef-sym.s.tmp/dead.o: No such file or directory 
check:40'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:40'1               ?                                                                                                                                                                            possible intended match
>>>>>>
--

Still failing I'm afraid :(

How abt now? (I've tested it locally - Linux and OSX)
(after rG46ef187dccd3be85d0490cf3e5dc73607a4a2ef2)