public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4826] Darwin, rpaths: Add --with-darwin-extra-rpath. Date: Sun, 22 Oct 2023 18:30:43 +0000 (GMT) [thread overview] Message-ID: <20231022183043.D1AC3385842C@sourceware.org> (raw) https://gcc.gnu.org/g:8fe73ef2785837dbebee7c56d5f30211571b2773 commit r14-4826-g8fe73ef2785837dbebee7c56d5f30211571b2773 Author: Iain Sandoe <iain@sandoe.co.uk> Date: Sat May 28 10:16:27 2022 +0100 Darwin, rpaths: Add --with-darwin-extra-rpath. This is provided to allow distributions to add a single additional runpath to allow for cases where the installed GCC library directories are then symlinked to a common dirctory outside of any of the GCC installations. For example: /opt/distro/lib: libgfortran.dylib -> /opt/distro/lib/gcc-11.3/lib/libgfortran.dylib So that libraries which are designed to be found in the runpath we would then add --with-darwin-add-rpath=/opt/distro/lib to the configure line. This patch makes the configuration a little more forgiving of using --disable-darwin-at-rpath (although for platform versions >= 10.11 this will result in misconfigured target libraries). gcc/ChangeLog: * configure.ac: Add --with-darwin-extra-rpath option. * config/darwin.h: Handle DARWIN_EXTRA_RPATH. * config.in: Regenerate. * configure: Regenerate. Diff: --- gcc/config.in | 13 +++++++++++++ gcc/config/darwin.h | 14 ++++++++++++++ gcc/configure | 28 ++++++++++++++++++++++++++-- gcc/configure.ac | 13 +++++++++++++ 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/gcc/config.in b/gcc/config.in index 98ddddf88a0f..03faee1c6ac1 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -49,6 +49,19 @@ #endif +/* Specify a runpath directory, additional to those provided by the compiler + */ +#ifndef USED_FOR_TARGET +#undef DARWIN_ADD_RPATH +#endif + + +/* Should add an extra runpath directory */ +#ifndef USED_FOR_TARGET +#undef DARWIN_DO_EXTRA_RPATH +#endif + + /* Define to enable the use of a default assembler. */ #ifndef USED_FOR_TARGET #undef DEFAULT_ASSEMBLER diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index ae7d5c65d15a..b43c8ce97a8c 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -321,6 +321,19 @@ extern GTY(()) int darwin_ms_struct; %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) " #endif +/* We might elect to add a path even when this compiler does not use embedded + run paths, so that we can use libraries from an alternate compiler that is + using embedded runpaths. */ +#if DARWIN_DO_EXTRA_RPATH +# define DARWIN_EXTRA_RPATH \ +"%{!r:%{!nostdlib:%{!nodefaultrpaths:\ + %:version-compare(>= 10.5 mmacosx-version-min= -rpath) \ + %:version-compare(>= 10.5 mmacosx-version-min= " DARWIN_ADD_RPATH ") \ + }}}" +#else +# define DARWIN_EXTRA_RPATH "" +#endif + #define SUBSUBTARGET_OVERRIDE_OPTIONS \ do { \ darwin_override_options (); \ @@ -415,6 +428,7 @@ extern GTY(()) int darwin_ms_struct; DARWIN_NOPIE_SPEC \ DARWIN_RDYNAMIC \ DARWIN_NOCOMPACT_UNWIND \ + DARWIN_EXTRA_RPATH \ DARWIN_RPATH_LINK \ "}}}}}}} %<pie %<no-pie %<rdynamic %<X %<rpath %<nodefaultrpaths " diff --git a/gcc/configure b/gcc/configure index 13085f39f0eb..77f33ee4df6f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -1012,6 +1012,7 @@ with_pic enable_fast_install enable_libtool_lock enable_darwin_at_rpath +with_darwin_extra_rpath enable_ld enable_gold with_plugin_ld @@ -1873,6 +1874,9 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-darwin-extra-rpath=[ARG] + Specify a runpath directory, additional to those + provided by the compiler --with-plugin-ld=[ARG] specify the plugin linker --with-glibc-version=M.N assume GCC used with glibc version M.N or later @@ -19976,7 +19980,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19979 "configure" +#line 19983 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -20082,7 +20086,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 20085 "configure" +#line 20089 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -23410,6 +23414,26 @@ else ENABLE_DARWIN_AT_RPATH_FALSE= fi +DARWIN_DO_EXTRA_RPATH=0 + +# Check whether --with-darwin-extra-rpath was given. +if test "${with_darwin_extra_rpath+set}" = set; then : + withval=$with_darwin_extra_rpath; if test x"$withval" != x; then + DARWIN_ADD_RPATH="$withval" + DARWIN_DO_EXTRA_RPATH=1 + fi +fi + + +cat >>confdefs.h <<_ACEOF +#define DARWIN_DO_EXTRA_RPATH $DARWIN_DO_EXTRA_RPATH +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define DARWIN_ADD_RPATH "$DARWIN_ADD_RPATH" +_ACEOF + # Identify the assembler which will work hand-in-glove with the newly # built GCC, so that we can examine its features. This is the assembler diff --git a/gcc/configure.ac b/gcc/configure.ac index 0ac589a64ae9..10982cdfc099 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2633,6 +2633,19 @@ AC_SUBST(objdir) AC_SUBST(enable_fast_install) AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes]) +DARWIN_DO_EXTRA_RPATH=0 +AC_ARG_WITH(darwin-extra-rpath, +[AS_HELP_STRING( + [[--with-darwin-extra-rpath=[ARG]]], + [Specify a runpath directory, additional to those provided by the compiler])], +[if test x"$withval" != x; then + DARWIN_ADD_RPATH="$withval" + DARWIN_DO_EXTRA_RPATH=1 + fi]) +AC_DEFINE_UNQUOTED(DARWIN_DO_EXTRA_RPATH, $DARWIN_DO_EXTRA_RPATH, + [Should add an extra runpath directory]) +AC_DEFINE_UNQUOTED(DARWIN_ADD_RPATH, "$DARWIN_ADD_RPATH", + [Specify a runpath directory, additional to those provided by the compiler]) # Identify the assembler which will work hand-in-glove with the newly # built GCC, so that we can examine its features. This is the assembler
reply other threads:[~2023-10-22 18:30 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231022183043.D1AC3385842C@sourceware.org \ --to=iains@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).