Page MenuHomePhabricator

[lld-macho] Don't merge cstrings across different sections
Changes PlannedPublic

Authored by int3 on Oct 23 2021, 3:11 PM.

Details

Reviewers
gkm
Group Reviewers
Restricted Project
Summary

I realized that ld64 merges word literals across sections, but
does not do the same for cstring literals. This diff brings us up to
parity + adds a test for the behavior around word literals as well.

Diff Detail

Event Timeline

int3 created this revision.Oct 23 2021, 3:11 PM
Herald added a project: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Oct 23 2021, 3:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 23 2021, 3:11 PM
int3 updated this revision to Diff 381766.Oct 23 2021, 4:51 PM

cleanup

Does supporting it cause problems?

int3 added a comment.Oct 24 2021, 11:42 AM

I don't know. I'm trying to debug a "unrecognized selector" crash in one of my programs right now, and so I've been looking at discrepancies between the ObjC-related data in LLD vs ld64's outputs. I saw that the __objc_methname and other similar strings in ld64's output remained in their original sections, whereas we were merging them all into __cstring. I don't think this diff fixes the original crash, but I figured having fewer discrepancies between the two binaries would be a good thing regardless.

However, if you would prefer we not land this until there's a demonstrated need, I'm with that too.

int3 planned changes to this revision.Nov 10 2021, 10:54 AM

Turns out D112500: [lld-macho] Put GOT into `__DATA` segment where appropriate fixed the "unrecognized selector" crash, so I guess I don't need this any more, at least for now