This commit is contained in:
parent
d98911cc8f
commit
64a80f6090
2 changed files with 8 additions and 8 deletions
|
@ -1,13 +1,13 @@
|
||||||
package build
|
package build
|
||||||
|
|
||||||
// cacheLineSize is the smallest unit of data that can be transferred between the RAM and the CPU cache.
|
|
||||||
const cacheLineSize = 64
|
|
||||||
|
|
||||||
// FileAlign returns the file alignment.
|
// FileAlign returns the file alignment.
|
||||||
func (build *Build) FileAlign() int {
|
func (build *Build) FileAlign() int {
|
||||||
if build.OS == Linux {
|
switch build.OS {
|
||||||
return cacheLineSize
|
case Linux:
|
||||||
|
return 0x40
|
||||||
|
case Windows:
|
||||||
|
return 0x200
|
||||||
|
default:
|
||||||
|
return build.MemoryAlign()
|
||||||
}
|
}
|
||||||
|
|
||||||
return build.MemoryAlign()
|
|
||||||
}
|
}
|
|
@ -27,7 +27,7 @@ func Write(writer io.WriteSeeker, b *build.Build, codeBytes []byte, dataBytes []
|
||||||
subSystem := IMAGE_SUBSYSTEM_WINDOWS_CUI
|
subSystem := IMAGE_SUBSYSTEM_WINDOWS_CUI
|
||||||
arch := Arch(b.Arch)
|
arch := Arch(b.Arch)
|
||||||
|
|
||||||
importsData, dllData, dllImports, dllDataStart := importLibraries(libs, imports.FileOffset)
|
importsData, dllData, dllImports, dllDataStart := importLibraries(libs, imports.MemoryOffset)
|
||||||
buffer := bytes.Buffer{}
|
buffer := bytes.Buffer{}
|
||||||
binary.Write(&buffer, binary.LittleEndian, &importsData)
|
binary.Write(&buffer, binary.LittleEndian, &importsData)
|
||||||
binary.Write(&buffer, binary.LittleEndian, &dllData)
|
binary.Write(&buffer, binary.LittleEndian, &dllData)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue