This flag instructs dyld to mark the segment read-only after fixups have
been performed.
I'm not sure why this flag is needed, as on macOS 13 beta at least,
__DATA_CONST is read-only even without this flag, but ld64 sets it as
well.
Differential D133010
[lld-macho] Set the SG_READ_ONLY flag on __DATA_CONST BertalanD on Aug 31 2022, 3:53 AM. Authored by
Details
This flag instructs dyld to mark the segment read-only after fixups have I'm not sure why this flag is needed, as on macOS 13 beta at least,
Diff Detail
Event TimelineComment Actions lgtm
Comment Actions lg
|
ld64 checks this:
I think we only end up with dataConst segments if config->dataConst (the first check) (…or if users use that segment name explicitly, but then they kind of ask for this treatment, so that seems fine).
We don't implement neither -dylinker nor -add_split_seg_info / -not_for_dyld_shared_cache (not sure why the positive and negative forms of that have different names…), and it's unlikely we'll add them (seems they're only needed for the linker used to link the OS), so we don't really have to worry about the second part. But maybe this could grow a comment around the lines of "If we ever implement shared cache output support, don't set this for shared cache dylibs".
(Or not. As-is is fine too, up to you.)