commit:     4b52e188057a6b59d3e48983f351bf44ae080081
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 27 13:29:28 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Nov 27 13:38:59 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=4b52e188

sys-devel/binutils-config-5.1-r3: revbump for libsysroot support

Big Sur (11.0) needs libsysroot support from the linker, so allow
activating it.

Package-Manager: Portage-3.0.8-prefix, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 ...-config-5.1-r2.ebuild => binutils-config-5.1-r3.ebuild} | 10 +++++++++-
 sys-devel/binutils-config/files/ldwrapper.c                | 14 ++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/sys-devel/binutils-config/binutils-config-5.1-r2.ebuild 
b/sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
similarity index 84%
rename from sys-devel/binutils-config/binutils-config-5.1-r2.ebuild
rename to sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
index d104bf4fb7..fd26184271 100644
--- a/sys-devel/binutils-config/binutils-config-5.1-r2.ebuild
+++ b/sys-devel/binutils-config/binutils-config-5.1-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -39,6 +39,13 @@ src_configure() {
 
 src_compile() {
        use prefix-guest || return
+       local extraargs=( )
+       if [[ ${CHOST} == *-darwin* && ${CHOST##*-darwin} -ge 20 ]] ; then
+               # macOS Big Sur has an empty /usr/lib, so the linker really has
+               # to look into the SDK, for which it needs to be told where it
+               # is (symlinked right into our EPREFIX root as MacOSX.sdk)
+               extraargs+=( -DDARWIN_LD_SYSLIBROOT=1 )
+       fi
        local args=(
                $(tc-getCC)
                ${CPPFLAGS}
@@ -46,6 +53,7 @@ src_compile() {
                -o ldwrapper ${PN}-ldwrapper-${WRAPPER_REV}.c
                -DEPREFIX=\"${EPREFIX}\"
                -DCHOST=\"${CHOST}\"
+               "${extraargs[@]}"
                ${LDFLAGS}
        )
        echo ${args[*]}

diff --git a/sys-devel/binutils-config/files/ldwrapper.c 
b/sys-devel/binutils-config/files/ldwrapper.c
index 216747da5c..75575f31f6 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -20,8 +20,9 @@
  * ldwrapper: Prefix helper to inject -L and -R flags to the invocation
  * of ld.
  *
- * On Darwin it adds -search_path_first to make sure the given paths are
- * searched before the default search path.
+ * On Darwin it adds -search_paths_first to make sure the given paths are
+ * searched before the default search path, and sets -syslibroot
+ * starting from Big Sur 11.0.
  * On AIX it ensures -bsvr4 is the last argument.
  * The wrapper will inject -L entries for:
  *   - EPREFIX/usr/CHOST/lib/gcc (when gcc)
@@ -339,6 +340,11 @@ main(int argc, char *argv[])
 
                        /* add the 2 prefix paths (-L) and -search_paths_first 
*/
                        newargc += 2 + 1;
+
+#ifdef DARWIN_LD_SYSLIBROOT
+                       /* add -syslibroot <path> */
+                       newargc += 2;
+#endif
                } else {
                        /* add the 4 paths we want (-L + -R) */
                        newargc += 8;
@@ -380,6 +386,10 @@ main(int argc, char *argv[])
 
        if (!is_cross && is_darwin) {
                /* inject this first to make the intention clear */
+#ifdef DARWIN_LD_SYSLIBROOT
+               newargv[j++] = "-syslibroot";
+               newargv[j++] = EPREFIX "/MacOSX.sdk"
+#endif
                newargv[j++] = "-search_paths_first";
        }
 

Reply via email to