Skip to content

Commit

Permalink
fix compilation issues on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
liberize committed Sep 25, 2024
1 parent 82eae58 commit 174e001
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,14 @@ docker run --rm -v $PWD:/workspace liberize/ssc:latest -s test.sh test
</details>

<details>
<summary>For macOS without Homebrew</summary>
<summary>For macOS</summary>
<p>

* Xcode command line tools

</p>
</details>

<details>
<summary>For macOS with Homebrew</summary>
<p>

* gcc, perl, binutils

</p>
</details>

<details>
<summary>For Android Termux</summary>
<p>
Expand Down
17 changes: 16 additions & 1 deletion src/untraceable.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,22 @@ FORCE_INLINE void check_debugger() {
}
}

#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#elif defined(__APPLE__)
#include <sys/sysctl.h>

FORCE_INLINE void check_debugger() {
struct kinfo_proc info;
info.kp_proc.p_flag = 0;
size_t size = sizeof(info);
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
if (sysctl(mib, 4, &info, &size, nullptr, 0) == 0 &&
(info.kp_proc.p_flag & P_TRACED) != 0) {
//perror(OBF("debugger present!"));
exit(1);
}
}

#elif defined(__linux__) || defined(__FreeBSD__)
#include <sys/wait.h>
#include <sys/ptrace.h>
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion ssc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ if [ "$PTHREAD" = 1 -a "$STATIC" = 1 ]; then
fi

if [ -n "$EMBED_FILE" -o -n "$USE_RC4" ]; then
if [ "$SYSTEM" != Cygwin ]; then
if [ "$SYSTEM" != Cygwin -a "$SYSTEM" != Mac ]; then
LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
fi
fi
Expand Down

0 comments on commit 174e001

Please sign in to comment.