This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFA:] fix bug in configure header-probing for stack protector support in target C library
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 1 Jun 2012 01:38:22 +0200
- Subject: [RFA:] fix bug in configure header-probing for stack protector support in target C library
This patch fixes target-header-probing for cross-builds that
aren't using sysroot (just --target and --prefix), as in the
difference for crisv32-axis-linux-gnu with an eglibc-2.15-based
port:
--- cllog.prev Thu May 31 22:00:10 2012
+++ cllog Thu May 31 22:00:09 2012
@@ -1276,7 +1276,7 @@ checking linker --as-needed support... y
checking linker --build-id support... yes
checking linker *_sol2 emulation support... no
checking linker --sysroot support... yes
-checking __stack_chk_fail in target C library... no
+checking __stack_chk_fail in target C library... yes
checking sys/sdt.h in the target C library... no
checking dl_iterate_phdr in target C library... unknown
Using ggc-page for garbage collection.
Without this patch, the non-existing directory
target_header_dir=NONE/crisv32-axis-linux-gnu/sys-include is
probed due to exec_prefix=NONE, duh. There's code setting a
separate variable test_exec_prefix that is then used to handle
this kind of testing for sysroot configures, but it is inside
code only executed if --with-sysroot is used. There's no reason
for it being there as it's not depending on the processing done
there or on sysroot settings. So let's move it to before the
with-sysroot stuff and use it when setting target_header_dir.
Tested configuring for crisv32-axis-linux-gnu and building past
this part (build completes successfully with the expected
observable change as per the use in gcc.c); no difference for
--with-sysroot.
Ok to commit?
gcc:
Fix configure test for "stack protector support in target C library".
* configure.ac (test_prefix, test_exec_prefix): Move setting from
inside sysroot handling to before and outside it.
* configure: Regenerate.
--- gcc.prev/gcc/configure.ac 2012-05-25 14:28:50.000000000 +0200
+++ gcc/gcc/configure.ac 2012-05-31 21:20:07.000000000 +0200
@@ -747,6 +747,17 @@ AC_ARG_WITH(build-sysroot,
[SYSROOT_CFLAGS_FOR_TARGET=])
AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
+if test "x$prefix" = xNONE; then
+ test_prefix=/usr/local
+else
+ test_prefix=$prefix
+fi
+if test "x$exec_prefix" = xNONE; then
+ test_exec_prefix=$test_prefix
+else
+ test_exec_prefix=$exec_prefix
+fi
+
AC_ARG_WITH(sysroot,
[AS_HELP_STRING([[--with-sysroot[=DIR]]],
[search for usr/lib, usr/include, et al, within DIR])],
@@ -759,16 +770,6 @@ AC_ARG_WITH(sysroot,
TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
- if test "x$prefix" = xNONE; then
- test_prefix=/usr/local
- else
- test_prefix=$prefix
- fi
- if test "x$exec_prefix" = xNONE; then
- test_exec_prefix=$test_prefix
- else
- test_exec_prefix=$exec_prefix
- fi
case ${TARGET_SYSTEM_ROOT} in
"${test_prefix}"|"${test_prefix}/"*|\
"${test_exec_prefix}"|"${test_exec_prefix}/"*|\
@@ -4528,11 +4529,11 @@ if test x$host != x$target || test "x$TA
if test "x$with_headers" != x; then
target_header_dir=$with_headers
elif test "x$with_sysroot" = x; then
- target_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
+ target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
elif test "x$with_build_sysroot" != "x"; then
target_header_dir="${with_build_sysroot}${native_system_header_dir}"
elif test "x$with_sysroot" = xyes; then
- target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
+ target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
else
target_header_dir="${with_sysroot}${native_system_header_dir}"
fi
brgds, H-P