about summary refs log tree commit diff
path: root/pkgs/build-support/bintools-wrapper
diff options
context:
space:
mode:
authorBoey Maun Suang <account-at-github@boeyms.info>2022-12-26 23:16:17 +1100
committerBoey Maun Suang <account-at-github@boeyms.info>2023-01-07 18:32:12 +1100
commit82b88d2db629a06443a6d7befb8518dbb785d183 (patch)
treed044a70eb6327142cf0227c0ff273fbdfbc50c6a /pkgs/build-support/bintools-wrapper
parent006a1d0a45d45273588bf85ef127e1140d506ac5 (diff)
bintoolsDualAs: Add package
For reasons explained in the commit contents, in order to build the
native gnat package for x86_64-darwin, the native gnatboot package for
x86_64-darwin must have access to both the Clang integrated assembler
and the cctools GNU assembler for that platform.  This commit creates a
package with both of those assemblers that x86_64-darwin gnatboot can
then be wrapped with.
Diffstat (limited to 'pkgs/build-support/bintools-wrapper')
-rw-r--r--pkgs/build-support/bintools-wrapper/default.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix
index 121b50fe0f523..bc7c8fbd46ac1 100644
--- a/pkgs/build-support/bintools-wrapper/default.nix
+++ b/pkgs/build-support/bintools-wrapper/default.nix
@@ -28,6 +28,7 @@
 , buildPackages ? {}
 , targetPackages ? {}
 , useMacosReexportHack ? false
+, wrapGas ? false
 
 # Darwin code signing support utilities
 , postLinkSignHook ? null, signingUtils ? null
@@ -165,6 +166,18 @@ stdenv.mkDerivation {
       wrap ld-solaris ${./ld-solaris-wrapper.sh}
     '')
 
+    # If we are asked to wrap `gas` and this bintools has it,
+    # then symlink it (`as` will be symlinked next).
+    # This is mainly for the wrapped gnatboot on x86-64 Darwin,
+    # as it must have both the GNU assembler from cctools (installed as `gas`)
+    # and the Clang integrated assembler (installed as `as`).
+    # See pkgs/os-specific/darwin/binutils/default.nix for details.
+    + lib.optionalString wrapGas ''
+      if [ -e $ldPath/${targetPrefix}gas ]; then
+        ln -s $ldPath/${targetPrefix}gas $out/bin/${targetPrefix}gas
+      fi
+    ''
+
     # Create symlinks for rest of the binaries.
     + ''
       for binary in objdump objcopy size strings as ar nm gprof dwp c++filt addr2line \