This is an archive of the discontinued LLVM Phabricator instance.

lld/AMDGPU: Fix asserts if no object files are involved in link
ClosedPublic

Authored by arsenm on Apr 8 2022, 10:29 AM.

Details

Reviewers
MaskRay
t-tye
Group Reviewers
lld
Restricted Project
Summary

Fixes issue 47690. The reproduction steps produced a shared object
from clang directly, and then fed the shared object back into
lld. With no regular object files, this assert was hit. I'm not sure
if we need to or should be looking for equivalent fields in shared
objects.

Diff Detail

Event Timeline

arsenm created this revision.Apr 8 2022, 10:29 AM
Herald added a project: Restricted Project. · View Herald Transcript
arsenm requested review of this revision.Apr 8 2022, 10:29 AM
MaskRay added a comment.EditedApr 8 2022, 10:41 AM

See D71101 for a similar change. Can you move the test to amdgpu-elf-flags*.s? Newer tests use ## for non-RUN non-CHECK comments to make them stand out (and potentially help future FileCheck feature to detect disabled RUN/CHECK lines due to typo)

MaskRay added inline comments.Apr 8 2022, 10:43 AM
lld/test/ELF/amdgpu-no-object-files-linked.s
10 ↗(On Diff #421577)

Use llvm-readobj -h to test flags even if it is 0.

arsenm updated this revision to Diff 421591.Apr 8 2022, 11:02 AM

Merge tests

MaskRay accepted this revision.Apr 8 2022, 11:13 AM

LGTM with some nits

lld/test/ELF/amdgpu-elf-flags.s
5

Nit: for FileCheck options -- is more common

11

Align the values like:

# FIRSTLINK:      Flags [
# FIRSTLINK-NEXT:   EF_AMDGPU_MACH_AMDGCN_GFX803 (0x2A)
# FIRSTLINK-NEXT: ]
15

ditto

This revision is now accepted and ready to land.Apr 8 2022, 11:13 AM
arsenm added inline comments.Apr 8 2022, 11:15 AM
lld/test/ELF/amdgpu-elf-flags.s
5

I don't think so. I'd guess across llvm about 10% use -- for check-prefix

MaskRay added inline comments.Apr 8 2022, 11:24 AM
lld/test/ELF/amdgpu-elf-flags.s
5
% rg 'FileCheck.* -check' -l | wc -l
7261
% rg 'FileCheck.* --check' -l | wc -l
12039

In lld the ratio is even larger. Not needed to change now.