Skip to content

Commit

Permalink
fix: remove --private flag from ipsw dsc tbd cmd #530
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Aug 8, 2024
1 parent 01dc77a commit b276a7d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 29 deletions.
5 changes: 1 addition & 4 deletions cmd/ipsw/cmd/dyld/dyld_tbd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ import (
func init() {
DyldCmd.AddCommand(TbdCmd)
TbdCmd.Flags().BoolP("generic", "g", false, "Generate for ALL targets")
TbdCmd.Flags().BoolP("private", "p", false, "Add private symbols")
TbdCmd.Flags().StringP("output", "o", "", "Directory to extract the dylibs (default: CWD)")
TbdCmd.MarkFlagDirname("output")
viper.BindPFlag("dyld.tbd.generic", TbdCmd.Flags().Lookup("generic"))
viper.BindPFlag("dyld.tbd.private", TbdCmd.Flags().Lookup("private"))
viper.BindPFlag("dyld.tbd.output", TbdCmd.Flags().Lookup("output"))
}

Expand All @@ -68,7 +66,6 @@ var TbdCmd = &cobra.Command{

// flags
generic := viper.GetBool("dyld.tbd.generic")
private := viper.GetBool("dyld.tbd.private")
output := viper.GetString("dyld.tbd.output")

if generic {
Expand All @@ -83,7 +80,7 @@ var TbdCmd = &cobra.Command{
}
defer f.Close()

outTBD, err := dsc.GetTBD(f, args[1], private, generic)
outTBD, err := dsc.GetTBD(f, args[1], generic)
if err != nil {
return fmt.Errorf("failed to generate .tbd file for %s: %v", args[1], err)
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ require (
github.com/vbauerster/mpb/v8 v8.7.5
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8
golang.org/x/crypto v0.26.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
golang.org/x/net v0.28.0
golang.org/x/oauth2 v0.22.0
golang.org/x/sync v0.8.0
Expand Down Expand Up @@ -190,5 +190,5 @@ require (
modernc.org/libc v1.57.0 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.31.1 // indirect
modernc.org/sqlite v1.32.0 // indirect
)
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,17 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -593,8 +593,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -674,8 +674,8 @@ modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
modernc.org/sqlite v1.31.1 h1:XVU0VyzxrYHlBhIs1DiEgSl0ZtdnPtbLVy8hSkzxGrs=
modernc.org/sqlite v1.31.1/go.mod h1:UqoylwmTb9F+IqXERT8bW9zzOWN8qwAIcLdzeBZs4hA=
modernc.org/sqlite v1.32.0 h1:6BM4uGza7bWypsw4fdLRsLxut6bHe4c58VeqjRgST8s=
modernc.org/sqlite v1.32.0/go.mod h1:UqoylwmTb9F+IqXERT8bW9zzOWN8qwAIcLdzeBZs4hA=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
Expand Down
6 changes: 3 additions & 3 deletions internal/commands/dsc/dsc.go
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ func OpenFromIPSW(ipswPath, pemDB string, driverKit, all bool) (*mount.Context,
return ctx, fs, nil
}

func GetTBD(f *dyld.File, dylib string, private, generic bool) (string, error) {
func GetTBD(f *dyld.File, dylib string, generic bool) (string, error) {
image, err := f.Image(dylib)
if err != nil {
return "", fmt.Errorf("image not in DSC: %v", err)
Expand All @@ -820,7 +820,7 @@ func GetTBD(f *dyld.File, dylib string, private, generic bool) (string, error) {
}
}

t, err := tbd.NewTBD(image, reexports, private, generic)
t, err := tbd.NewTBD(image, reexports, generic)
if err != nil {
return "", fmt.Errorf("failed to create tbd file for %s: %v", dylib, err)
}
Expand All @@ -836,7 +836,7 @@ func GetTBD(f *dyld.File, dylib string, private, generic bool) (string, error) {
if err != nil {
return "", fmt.Errorf("image not in DSC: %v", err)
}
t, err := tbd.NewTBD(image, nil, private, generic)
t, err := tbd.NewTBD(image, nil, generic)
if err != nil {
return "", fmt.Errorf("failed to create tbd file for %s: %v", dylib, err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/macho/objc.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ func (o *ObjC) XCFramework() error {
reexports = append(reexports, rexp.(*macho.ReExportDylib).Name)
}
}
t, err := tbd.NewTBD(image, reexports, false, false)
t, err := tbd.NewTBD(image, reexports, false)
if err != nil {
return fmt.Errorf("failed to create tbd: %w", err)
}
Expand Down
12 changes: 1 addition & 11 deletions pkg/tbd/tbd.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type TBD struct {
}

// NewTBD creates a new tbd object
func NewTBD(image *dyld.CacheImage, reexports []string, private, generic bool) (*TBD, error) {
func NewTBD(image *dyld.CacheImage, reexports []string, generic bool) (*TBD, error) {
var targets []string
var currentVersion string
var syms []string
Expand Down Expand Up @@ -138,16 +138,6 @@ func NewTBD(image *dyld.CacheImage, reexports []string, private, generic bool) (
}
}

// get private symbols
if private {
if err := image.ParseLocalSymbols(false); err != nil {
return nil, err
}
for _, sym := range image.LocalSymbols {
syms = append(syms, sym.Name)
}
}

// get objc classes and ivars
if m.HasObjC() {
classes, err := m.GetObjCClasses()
Expand Down

0 comments on commit b276a7d

Please sign in to comment.