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,
|
InitProt: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
codeStart := 32 + m.Header.SizeCommands
|
codeStart := uint64(32 + m.Header.SizeCommands)
|
||||||
codeEnd := uint64(codeStart) + uint64(len(m.Code))
|
codeLength := uint64(len(m.Code))
|
||||||
|
codeEnd := codeStart + codeLength
|
||||||
dataPadding := elf.Padding(codeEnd, 4096)
|
dataPadding := elf.Padding(codeEnd, 4096)
|
||||||
dataStart := codeEnd + dataPadding
|
dataStart := codeEnd + dataPadding
|
||||||
|
|
||||||
@ -61,13 +62,13 @@ func (m *MachO) Write(writer io.Writer) {
|
|||||||
LoadCommand: LcSegment64,
|
LoadCommand: LcSegment64,
|
||||||
Length: 0x48,
|
Length: 0x48,
|
||||||
Name: [16]byte{'_', '_', 'T', 'E', 'X', 'T'},
|
Name: [16]byte{'_', '_', 'T', 'E', 'X', 'T'},
|
||||||
Address: config.BaseAddress,
|
Address: config.BaseAddress + codeStart,
|
||||||
SizeInMemory: codeEnd,
|
SizeInMemory: codeLength,
|
||||||
Offset: 0,
|
Offset: 0,
|
||||||
SizeInFile: codeEnd,
|
SizeInFile: codeLength,
|
||||||
NumSections: 0,
|
NumSections: 0,
|
||||||
Flag: 0,
|
Flag: 0,
|
||||||
MaxProt: ProtReadable | ProtWritable | ProtExecutable,
|
MaxProt: ProtReadable | ProtExecutable,
|
||||||
InitProt: ProtReadable | ProtExecutable,
|
InitProt: ProtReadable | ProtExecutable,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user