Added segment flags for the read-only segment in Mach-O
All checks were successful
/ test (push) Successful in 19s

This commit is contained in:
Eduard Urbach 2025-07-10 15:25:33 +02:00
parent c7375c2ca0
commit 7fe9efae21
Signed by: ed
GPG key ID: 49226B848C78F6C8
4 changed files with 11 additions and 4 deletions

View file

@ -71,7 +71,7 @@ func Write(writer io.WriteSeeker, b *build.Build, codeBytes []byte, dataBytes []
Size: uint64(len(code.Bytes)),
Offset: uint32(code.FileOffset),
Align: 6,
Flags: FlagPureInstructions,
Flags: SectionPureInstructions,
},
DataSegment: Segment64{
LoadCommand: LcSegment64,
@ -82,7 +82,7 @@ func Write(writer io.WriteSeeker, b *build.Build, codeBytes []byte, dataBytes []
Offset: uint64(data.FileOffset),
SizeInFile: uint64(len(data.Bytes)),
NumSections: 0,
Flag: 0,
Flag: SegmentReadOnly,
MaxProt: ProtReadable,
InitProt: ProtReadable,
},

View file

@ -3,5 +3,5 @@ package macho
type SectionFlags uint32
const (
FlagPureInstructions SectionFlags = 0x80000000
SectionPureInstructions SectionFlags = 0x80000000
)

View file

@ -14,5 +14,5 @@ type Segment64 struct {
MaxProt Prot
InitProt Prot
NumSections uint32
Flag uint32
Flag SegmentFlags
}

View file

@ -0,0 +1,7 @@
package macho
type SegmentFlags uint32
const (
SegmentReadOnly SegmentFlags = 0x10
)