jtool -rC on LC_RPATH fails

Used for discussing the various tools in the book as well as encouraging members to share tools

jtool -rC on LC_RPATH fails

Postby jonios » Mon May 07, 2018 4:28 pm

With an x86_64 mach-o binary generated from swiftc, 'jtool -rC #' fails, where # is the LC_RPATH load command.
Code: Select all
$ swiftc x.c -o x
$ jtool -l x

LC 17: LC_RPATH                 /Applications/Xcode-9.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx

$ jtool --inplace -rC 17 x
Removing Load Command #17
Removed 1886404911 bytes

$ jtool -l x

LC 17: LC_RPATH                 /Applications/Xcode-9.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx

The number of bytes it says its removing is clearly nonsensical. I am able to remove other load commands (such as LC_FUNCTION_STARTS), but others fail as well (LC_LOAD_DYLINKER).

Code: Select all
$ jtool --version
This is jtool v1.0 (Amsterdam) - with code signing support for keychain identities (on MacOS only), compiled on Apr 14 2018 22:22:37
jonios
 
Posts: 3
Joined: Tue May 01, 2018 10:11 pm

Re: jtool -rC on LC_RPATH fails

Postby morpheus » Wed May 09, 2018 2:27 pm

That's a bug. I think it ends up removing only the last load command; will be addressed in upcoming fix.
morpheus
Site Admin
 
Posts: 660
Joined: Thu Apr 11, 2013 6:24 pm


Return to Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron