clean code
This commit is contained in:
parent
4ee62a2d93
commit
4016abf40d
@ -122,18 +122,6 @@ func (action *saveImports) saveToInfo(mf *MachoFile) error {
|
||||
SegmentIndex: symbol.Segment(),
|
||||
Offset: uint32(offset),
|
||||
})
|
||||
|
||||
// fmt.Printf("{\"%s\", \"%s\", 0x%x, 0x%x, 0x%x},\n",
|
||||
// symbol.Name(), symbol.Dylib(), symbol.Segment(), offset)
|
||||
|
||||
// symbols = append(symbols,
|
||||
// &protomodel.MachoInfo_BindSymbol{
|
||||
// Name: symbol.Name(),
|
||||
// Libname: symbol.Dylib(),
|
||||
// Libhash: dylib_hash,
|
||||
// Segment: symbol.Segment(),
|
||||
// Offset: offset,
|
||||
// })
|
||||
}
|
||||
mf.Info().Symbols = &protomodel.MachoInfo_AllImportedSymbols{
|
||||
Libs: libs,
|
||||
|
@ -264,14 +264,14 @@ func bcell2header(bfile string, header string) {
|
||||
}
|
||||
fmt.Fprintf(w, "};\n")
|
||||
|
||||
fmt.Fprintf(w, "__attribute__((section(\"__DATA,.bshield_lib\")))\n")
|
||||
fmt.Fprintf(w, "__attribute__((section(\"__DATA,bshield\")))\n")
|
||||
fmt.Fprintf(w, "char libs[] =\n")
|
||||
for _, lib := range info.Symbols.Libs {
|
||||
fmt.Fprintf(w, " \"%s\\0\"\n", lib)
|
||||
}
|
||||
fmt.Fprintf(w, ";\n")
|
||||
|
||||
fmt.Fprintf(w, "__attribute__((section(\"__DATA,.bshield_sym\")))\n")
|
||||
fmt.Fprintf(w, "__attribute__((section(\"__DATA,bshield\")))\n")
|
||||
fmt.Fprintf(w, "char symbols[] =\n")
|
||||
for _, symbol := range info.Symbols.Symbols {
|
||||
fmt.Fprintf(w, " \"%s\\0\"\n", symbol)
|
||||
@ -280,10 +280,10 @@ func bcell2header(bfile string, header string) {
|
||||
|
||||
fmt.Fprintf(w, "// very compact symbol table,\n")
|
||||
fmt.Fprintf(w, "// [lib idx/*4 bytes*/, nsymbol/*4 byte*/]\n")
|
||||
fmt.Fprintf(w, "// repeate nsymbol times [name offset/*3 bytes*/, segment idx/**/, offset /*4 btyes*/]\n")
|
||||
fmt.Fprintf(w, "// repeat nsymbol times [name offset/*3 bytes*/, segment idx/**/, offset /*4 btyes*/]\n")
|
||||
fmt.Fprintf(w, "// name offset is 3 bytes because we don't think we should have a table size > 2^(3 * 8)\n")
|
||||
|
||||
fmt.Fprintf(w, "__attribute__((section(\"__DATA,.bshield_code\")))\n")
|
||||
fmt.Fprintf(w, "__attribute__((section(\"__DATA,bshield\")))\n")
|
||||
fmt.Fprintf(w, "uint32_t encoded_table[] = {\n")
|
||||
n_instructions := 0
|
||||
for i, table := range info.Symbols.Tables {
|
||||
|
@ -135,6 +135,16 @@ func (lcmd *LoadCmd) Cmdname() string {
|
||||
return "LC_DATA_IN_CODE"
|
||||
case LC_SYMTAB:
|
||||
return "LC_SYMTAB"
|
||||
case LC_BUILD_VERSION:
|
||||
return "LC_BUILD_VERSION"
|
||||
case LC_UUID:
|
||||
return "LC_UUID"
|
||||
case LC_SOURCE_VERSION:
|
||||
return "LC_SOURCE_VERSION"
|
||||
case LC_DYLD_CHAINED_FIXUPS:
|
||||
return "LC_DYLD_CHAINED_FIXUPS"
|
||||
case LC_DYLD_EXPORTS_TRIE:
|
||||
return "LC_DYLD_EXPORTS_TRIE"
|
||||
default:
|
||||
// TODO: Update
|
||||
return fmt.Sprintf("LC_DONT_KNOW_0x%x", lcmd.Cmd())
|
||||
|
Loading…
Reference in New Issue
Block a user