fix(nanodump): make host-tool build work on macOS#145
Closed
slimwang wants to merge 1 commit into
Closed
Conversation
On macOS, gcc is Apple clang which does not support static linking (no crt0.o/static libc) or the obsolete -s linker flag, so building the host helper tools (bin2c, restore_signature) failed with "library 'crt0.o' not found". Stripping restore_signature with the mingw strip also failed since it is a native Mach-O binary, not PE. Detect the host OS and drop -static -s on Darwin, and use the host strip instead of the mingw strip for the native helper tool. Linux behavior is unchanged.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building
Creds-BOFon macOS fails in the nanodump Makefile:and then:
The cross-compiled BOF artifacts (mingw
.o/.exe/.dll) build fine. The failures are only in the host-compiled helper tools (bin2c,restore_signature):gccis Apple clang, which does not support-static(there is nocrt0.o/ static libc) nor the obsolete-slinker flag.restore_signatureis then stripped with the mingw strip, which only understands Windows PE — not the native Mach-O binary.Fix
Detect the host OS in
Creds-BOF/nanodump/Makefile:-static -sfrom the hostgccinvocations on Darwin.strip(not the mingw strip) for the nativerestore_signaturehelper.Linux behavior is unchanged (
-static -sand mingw strip are kept).