This is an archive of the discontinued LLVM Phabricator instance.

[GNU ObjC] Unconditionally emit section markers.
Needs ReviewPublic

Authored by theraven on Aug 15 2023, 4:09 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

In the GNUstep v2 ABI (on ELF), we rely on the linker-inserted section
start and stop markers. These only exist when binary has something in
the relevant sections. To ensure that they exist, compilation units
that omit one of the components emit an empty object into the section
that it's not putting anything in. These empty objects are COMDATs and
are merged in the final version.

Unfortunately, there is a corner case where the entry exists in the code
emitted by the front end but is then elided during optimisation. We
already unconditionally emitted an empty selector to avoid this case for
message sends but it was still a problem for constant strings.

This change unconditionally emits these placeholders for everything.
This results in very slightly larger .o files but ensures that any
future optimisation that elides more things will not prevent compilation
and so reduces fragility.

Fixes #47536

Diff Detail

Event Timeline

theraven created this revision.Aug 15 2023, 4:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2023, 4:09 AM
theraven requested review of this revision.Aug 15 2023, 4:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2023, 4:09 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
theraven updated this revision to Diff 550295.Aug 15 2023, 5:59 AM

Update test.