diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 48 |
1 files changed, 36 insertions, 12 deletions
@@ -689,6 +689,7 @@ stage1_languages host_libs_picflag PICFLAG host_shared +gcc_host_pie host_pie extra_linker_plugin_flags extra_linker_plugin_configure_flags @@ -8649,23 +8650,31 @@ fi -# Enable --enable-host-pie. -# Checked early to determine whether jit is an 'all' language +# Handle --enable-host-pie +# If host PIE executables are the default (or must be forced on) for some host, +# we must pass that configuration to the gcc directory. +gcc_host_pie= # Check whether --enable-host-pie was given. if test "${enable_host_pie+set}" = set; then : enableval=$enable_host_pie; host_pie=$enableval case $host in - x86_64-*-darwin* | aarch64-*-darwin*) + *-*-darwin2*) if test x$host_pie != xyes ; then - # PIC is the default, and actually cannot be switched off. - echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2 + # for Darwin20+ this is required. + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: PIE executables are required for the configured host, host-pie setting ignored." >&5 +$as_echo "$as_me: WARNING: PIE executables are required for the configured host, host-pie setting ignored." >&2;} host_pie=yes + gcc_host_pie=--enable-host-pie fi ;; *) ;; esac else case $host in - *-*-darwin2*) host_pie=yes ;; + *-*-darwin2*) + # Default to PIE (mandatory for aarch64). + host_pie=yes + gcc_host_pie=--enable-host-pie + ;; *) host_pie=no ;; esac fi @@ -8673,6 +8682,7 @@ fi + # Enable --enable-host-shared. # Checked early to determine whether jit is an 'all' language # Check whether --enable-host-shared was given. @@ -8682,21 +8692,24 @@ if test "${enable_host_shared+set}" = set; then : x86_64-*-darwin* | aarch64-*-darwin*) if test x$host_shared != xyes ; then # PIC is the default, and actually cannot be switched off. - echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: PIC code is required for the configured host; host-shared setting ignored." >&5 +$as_echo "$as_me: WARNING: PIC code is required for the configured host; host-shared setting ignored." >&2;} host_shared=yes fi ;; *-*-darwin*) - if test x$host_pie == xyes ; then - echo configure.ac: warning: PIC code is required for PIE executables. 1>&2 + if test x$host_pie = xyes -a x$host_shared != xyes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: PIC code is required for PIE host executables host-shared setting ignored." >&5 +$as_echo "$as_me: WARNING: PIC code is required for PIE host executables host-shared setting ignored." >&2;} host_shared=yes fi ;; *) ;; esac else case $host in + # 64B x86_64 and Aarch64 Darwin default to PIC. x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;; - # Darwin needs PIC objects to link PIE executables. - *-*-darwin*) host_shared=host_pie ;; + # 32B and powerpc64 Darwin must use PIC to link PIE exes. + *-*-darwin*) host_shared=$host_pie ;; *) host_shared=no;; esac fi @@ -8705,7 +8718,18 @@ fi if test x$host_shared = xyes; then - PICFLAG=-fPIC + case $host in + *-*-darwin*) + # Since host shared is the default for 64b Darwin, and also enabled for + # host_pie, ensure that we present the PIE flag when host_pie is active. + if test x$host_pie = xyes; then + PICFLAG=-fPIE + fi + ;; + *) + PICFLAG=-fPIC + ;; + esac elif test x$host_pie = xyes; then PICFLAG=-fPIE else |