Skip to content

Commit

Permalink
patching binutils for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Mar 4, 2024
1 parent 4548c01 commit 4cefe35
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
filter:
name: Select Build Host
name: Select Build Targets
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.result }}
Expand Down
7 changes: 7 additions & 0 deletions package/binutils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
set(BINUTILS_VERSION 2.38)

if (APPLE OR BSD)
list(APPEND BINUTILS_PATCHES "${CMAKE_CURRENT_SOURCE_DIR}/fix-build.macos.patch")
endif ()

list(TRANSFORM BINUTILS_PATCHES PREPEND "COMMAND;patch;-p1;<;" OUTPUT_VARIABLE BINUTILS_PATCH_COMMANDS)

set(SYSROOT "${CMAKE_STAGING_PREFIX}/${GNU_TARGET_NAME}/sysroot")

ExternalProject_Add(binutils DEPENDS sysroot
INSTALL_DIR "${CMAKE_STAGING_PREFIX}"
URL "${GNU_MIRROR}/binutils/binutils-${BINUTILS_VERSION}.tar.bz2"
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
PATCH_COMMAND ${BINUTILS_PATCH_COMMANDS}
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --sysconfdir=<INSTALL_DIR>/etc --disable-multilib
--disable-werror --target=${GNU_TARGET_NAME} --disable-shared --enable-static --with-sysroot=${SYSROOT}
--enable-poison-system-directories --without-debuginfod --enable-plugins --enable-lto --disable-sim
Expand Down
15 changes: 15 additions & 0 deletions package/binutils/fix-build.macos.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/gold/gold-threads.cc b/gold/gold-threads.cc
--- a/gold/gold-threads.cc (date 1642853649000)
+++ b/gold/gold-threads.cc (date 1709531784143)
@@ -285,8 +285,9 @@
{
public:
Once_initialize()
- : once_(PTHREAD_ONCE_INIT)
- { }
+ {
+ this->once_ = PTHREAD_ONCE_INIT;
+ }

// Return a pointer to the pthread_once_t variable.
pthread_once_t*

0 comments on commit 4cefe35

Please sign in to comment.