format go code
This commit is contained in:
parent
b8d8343835
commit
2eede8f9b2
@ -18,4 +18,3 @@ func (action *removeExports) withFat(ff *FatFile) error {
|
||||
func NewRemoveExportsAction() *removeExports {
|
||||
return &removeExports{}
|
||||
}
|
||||
|
||||
|
@ -20,4 +20,3 @@ func (action *removeImports) withFat(ff *FatFile) error {
|
||||
func NewRemoveImportsAction() *removeImports {
|
||||
return &removeImports{}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ func (action *saveImports) withMacho(mf *MachoFile) error {
|
||||
}
|
||||
|
||||
fmt.Printf("{\"%s\", \"%s\", 0x%x, 0x%x, 0x%x},\n",
|
||||
symbol.Name(), symbol.Dylib(), dylib_hash, symbol.Segment(), offset);
|
||||
symbol.Name(), symbol.Dylib(), dylib_hash, symbol.Segment(), offset)
|
||||
|
||||
symbols = append(symbols,
|
||||
&protomodel.MachoInfo_BindSymbol{
|
||||
@ -56,7 +56,7 @@ func (action *saveImports) withMacho(mf *MachoFile) error {
|
||||
|
||||
}
|
||||
fmt.Println("};")
|
||||
fmt.Printf("uint32_t nimports = %d;\n", len(symbols));
|
||||
fmt.Printf("uint32_t nimports = %d;\n", len(symbols))
|
||||
mf.Info().Symbols = symbols
|
||||
return nil
|
||||
}
|
||||
@ -68,4 +68,3 @@ func (action *saveImports) withFat(ff *FatFile) error {
|
||||
func NewSaveImportsAction() *saveImports {
|
||||
return &saveImports{}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ func (mc *MachoContext) CollectBindSymbolsModern() []*ImportSymbol {
|
||||
// until buf is freed, all pointers are valid
|
||||
// remember to copy before moving out
|
||||
header := (*C.uchar)(unsafe.Pointer(&buf[0]))
|
||||
imports_table := C.GetImportsTable(header);
|
||||
imports_table := C.GetImportsTable(header)
|
||||
|
||||
// for i := 0; i < int(imports_table.size); i++ {
|
||||
// s := C.GetImportsAt(&imports_table, C.int(i))
|
||||
@ -108,7 +108,7 @@ func (mc *MachoContext) CollectBindSymbolsModern() []*ImportSymbol {
|
||||
status := int(C.GetSegmentFixAt(header, C.uint(segment_i), fix_ptr))
|
||||
segment_i += 1
|
||||
if status == 2 {
|
||||
break;
|
||||
break
|
||||
}
|
||||
if status == 3 {
|
||||
continue
|
||||
|
@ -1,11 +1,11 @@
|
||||
package macho
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"time"
|
||||
"bytes"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
@ -412,7 +412,7 @@ func (mc *MachoContext) ReworkForObjc() {
|
||||
last := sections[len(sections)-1]
|
||||
data_end = int(last.Offset()) + int(last.Size())
|
||||
|
||||
if (last.Offset() == 0) {
|
||||
if last.Offset() == 0 {
|
||||
before_last := sections[len(sections)-2]
|
||||
data_end += int(before_last.Offset()) + int(before_last.Size())
|
||||
}
|
||||
@ -529,7 +529,6 @@ func (mc *MachoContext) ReworkForObjc() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func (mc *MachoContext) RemoveSymbolTable() {
|
||||
// try to remove symtab and dysymtab
|
||||
mc.removeSymtabCommand()
|
||||
|
@ -248,12 +248,14 @@ func (mc *MachoContext) Parse(r *bufio.Reader) error {
|
||||
lcmd.Deserialize(mc, command_buf)
|
||||
mc.commands = append(mc.commands, lcmd)
|
||||
mc.symtab = lcmd
|
||||
break
|
||||
|
||||
case LC_DYSYMTAB:
|
||||
lcmd := new(DySymtab)
|
||||
lcmd.Deserialize(mc, command_buf)
|
||||
mc.commands = append(mc.commands, lcmd)
|
||||
mc.dysymtab = lcmd
|
||||
break
|
||||
|
||||
default:
|
||||
lcmd := new(LoadCmd)
|
||||
|
Loading…
Reference in New Issue
Block a user