Improved segment load
This commit is contained in:
parent
cf52919edc
commit
985fa5ae14
@ -52,8 +52,9 @@ func (m *MachO) Write(writer io.Writer) {
|
||||
InitProt: 0,
|
||||
})
|
||||
|
||||
codeStart := 32 + m.Header.SizeCommands
|
||||
codeEnd := uint64(codeStart) + uint64(len(m.Code))
|
||||
codeStart := uint64(32 + m.Header.SizeCommands)
|
||||
codeLength := uint64(len(m.Code))
|
||||
codeEnd := codeStart + codeLength
|
||||
dataPadding := elf.Padding(codeEnd, 4096)
|
||||
dataStart := codeEnd + dataPadding
|
||||
|
||||
@ -61,13 +62,13 @@ func (m *MachO) Write(writer io.Writer) {
|
||||
LoadCommand: LcSegment64,
|
||||
Length: 0x48,
|
||||
Name: [16]byte{'_', '_', 'T', 'E', 'X', 'T'},
|
||||
Address: config.BaseAddress,
|
||||
SizeInMemory: codeEnd,
|
||||
Address: config.BaseAddress + codeStart,
|
||||
SizeInMemory: codeLength,
|
||||
Offset: 0,
|
||||
SizeInFile: codeEnd,
|
||||
SizeInFile: codeLength,
|
||||
NumSections: 0,
|
||||
Flag: 0,
|
||||
MaxProt: ProtReadable | ProtWritable | ProtExecutable,
|
||||
MaxProt: ProtReadable | ProtExecutable,
|
||||
InitProt: ProtReadable | ProtExecutable,
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user