This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFA:] Fix gcc/configure.in incorrect checks for in-tree GAS and GLD features
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Jun 2003 09:56:14 +0200
- Subject: [RFA:] Fix gcc/configure.in incorrect checks for in-tree GAS and GLD features
I haven't built an in-tree binutils toolchain for my
cris-axis-linux-gnu-gcc tests for a long time, but when I needed it,
I saw that features were misdiagnosed, unexpectedly pessimized.
Since all common features should be assumed a-ok for an in-tree
build, that was a bit surprising.
The reason for misdiagnosing the GAS CRIS port is that it is a
multi-object-format port (the i386 and mips port can do that too,
but seem to require --enable-targets=... for that to happen).
Insufficient grepping caused it to not be properly recognized as
ELF. The in-tree ELF recognition was also needlessly redone
all-over.
Somewhat similar for GLD, the default CRIS linker emulation name
doesn't *start* with "elf". There's a default emulation called
criself. There's also one called crislinux (that perhaps should be
default for cris-axis-linux-gnu).
Lots of other affected targets have GNU/Linux or ELF emulation names
that don't start with "elf", for example shlelf32_linux. Yeah, BSD
people and others presumably want to follow-up. (BTW, those
test-lines I touched are hideous. Not that this helped much but
presumably a tiny bit without making things worse.)
Checked by configuring an in-tree cris-axis-linux-gnu and for basic
sanity a native i686-pc-linux-gnu (system tools; no changes). To
test that this change didn't trivially break the just-ELF ports, I
also configured m32r-elf. Since its default linker emulation is
called m32relf, it now got positive results for the GCC "linker
read-only and read-write section mixing" test ("read-write" instead
of "unknown") and the "PT_GNU_EH_FRAME" test.
Ok to commit?
* configure.in (in_tree_gas): Find out here whether GAS is ELF,
set in_tree_gas_is_elf accordingly.
(in_tree_ld): Find out whether LD emulation is ELF, set
in_tree_ld_is_elf accordingly.
(gcc_cv_as_subsections, gcc_cv_as_hidden, gcc_cv_as_leb128)
(gcc_cv_as_eh_frame, gcc_cv_as_shf_merge)
(gcc_cv_as_dwarf2_debug_line, gcc_cv_as_gdwarf2_flag)
(gcc_cv_as_gstabs_flag): Use $in_tree_gas_is_elf instead of
grepping gas/Makefile.
(gcc_cv_ld_ro_rw_mix, gcc_cv_ld_eh_frame_hdr, gcc_cv_ld_pie): Use
$in_tree_ld_is_elf instead of grepping ld/Makefile.
* configure: Regenerate.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.685
diff -p -c -r1.685 configure.in
*** configure.in 12 Jun 2003 07:09:55 -0000 1.685
--- configure.in 12 Jun 2003 07:12:23 -0000
*************** elif test -f $gcc_cv_as_gas_srcdir/confi
*** 1494,1499 ****
--- 1494,1506 ----
_gcc_COMPUTE_GAS_VERSION
rm -f as$host_exeext
$symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
+ in_tree_gas_is_elf=no
+ if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
+ || (grep 'obj_format = multi' ../gas/Makefile \
+ && grep 'extra_objects =.* obj-elf' ../gas/Makefile) > /dev/null
+ then
+ in_tree_gas_is_elf=yes
+ fi
fi
if test "x$gcc_cv_as" = x; then
*************** elif test -f $gcc_cv_ld_gld_srcdir/confi
*** 1589,1594 ****
--- 1596,1606 ----
&& test -f ../ld/Makefile; then
# Single tree build which includes ld.
in_tree_ld=yes
+ in_tree_ld_is_elf=no
+ if (grep 'EMUL = .*elf' ../ld/Makefile \
+ || grep 'EMUL = .*linux' ../ld/Makefile) > /dev/null; then
+ in_tree_ld_is_elf=yes
+ fi
for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in $gcc_cv_ld_gld_srcdir/Makefile.in
do
changequote(,)dnl
*************** AC_MSG_CHECKING(assembler subsection sup
*** 1761,1769 ****
gcc_cv_as_subsections=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
! if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
! gcc_cv_as_subsections="working .subsection -1"
! fi
])
elif test x$gcc_cv_as != x; then
# Check if we have .subsection
--- 1773,1780 ----
gcc_cv_as_subsections=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,9,0,[
! test $in_tree_gas_is_elf = yes \
! && gcc_cv_as_subsections="working .subsection -1"
])
elif test x$gcc_cv_as != x; then
# Check if we have .subsection
*************** AC_MSG_CHECKING(assembler hidden support
*** 1820,1828 ****
gcc_cv_as_hidden=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,12,1,[
! if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
! gcc_cv_as_hidden="yes"
! fi
])
elif test x$gcc_cv_as != x; then
# Check if we have .hidden
--- 1831,1837 ----
gcc_cv_as_hidden=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,12,1,[
! test $in_tree_gas_is_elf = yes && gcc_cv_as_hidden="yes"
])
elif test x$gcc_cv_as != x; then
# Check if we have .hidden
*************** AC_MSG_CHECKING(assembler leb128 support
*** 1891,1899 ****
gcc_cv_as_leb128=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
! if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
! gcc_cv_as_leb128="yes"
! fi
])
elif test x$gcc_cv_as != x; then
# Check if we have .[us]leb128, and support symbol arithmetic with it.
--- 1900,1906 ----
gcc_cv_as_leb128=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
! test $in_tree_gas_is_elf = yes && gcc_cv_as_leb128="yes"
])
elif test x$gcc_cv_as != x; then
# Check if we have .[us]leb128, and support symbol arithmetic with it.
*************** AC_MSG_CHECKING(assembler eh_frame optim
*** 1937,1945 ****
gcc_cv_as_eh_frame=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
! if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
! gcc_cv_as_eh_frame="yes"
! fi
])
elif test x$gcc_cv_as != x; then
# Check if this is GAS.
--- 1944,1950 ----
gcc_cv_as_eh_frame=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
! test $in_tree_gas_is_elf = yes && gcc_cv_as_eh_frame="yes"
])
elif test x$gcc_cv_as != x; then
# Check if this is GAS.
*************** AC_MSG_CHECKING(assembler section mergin
*** 2017,2025 ****
gcc_cv_as_shf_merge=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
! if grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
! gcc_cv_as_shf_merge=yes
! fi
])
elif test x$gcc_cv_as != x; then
# Check if we support SHF_MERGE sections
--- 2022,2028 ----
gcc_cv_as_shf_merge=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,12,0,[
! test $in_tree_gas_is_elf = yes && gcc_cv_as_shf_merge="yes"
])
elif test x$gcc_cv_as != x; then
# Check if we support SHF_MERGE sections
*************** case "$target" in
*** 2495,2504 ****
esac
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
! if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
! && test x"$insn" != x ; then
! gcc_cv_as_dwarf2_debug_line="yes"
! fi
])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo ' .file 1 "conftest.s"' > conftest.s
--- 2498,2505 ----
esac
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
! test $in_tree_gas_is_elf = yes && test x"$insn" != x \
! && gcc_cv_as_dwarf2_debug_line="yes"
])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo ' .file 1 "conftest.s"' > conftest.s
*************** AC_MSG_CHECKING(assembler --gdwarf2 supp
*** 2533,2542 ****
gcc_cv_as_gdwarf2_flag=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
! if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
! && test x"$insn" != x ; then
! gcc_cv_as_gdwarf2_flag="yes"
! fi
])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo '' > conftest.s
--- 2534,2541 ----
gcc_cv_as_gdwarf2_flag=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
! test $in_tree_gas_is_elf = yes && test x"$insn" != x \
! && gcc_cv_as_gdwarf2_flag="yes"
])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo '' > conftest.s
*************** AC_MSG_CHECKING(assembler --gstabs suppo
*** 2557,2566 ****
gcc_cv_as_gstabs_flag=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
! if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
! && test x"$insn" != x ; then
! gcc_cv_as_gstabs_flag="yes"
! fi
])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo '' > conftest.s
--- 2556,2563 ----
gcc_cv_as_gstabs_flag=no
if test $in_tree_gas = yes ; then
gcc_GAS_VERSION_GTE_IFELSE(2,11,0,[
! test $in_tree_gas_is_elf = yes && test x"$insn" != x \
! && gcc_cv_as_gstabs_flag="yes"
])
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
echo '' > conftest.s
*************** AC_MSG_RESULT($gcc_cv_as_gstabs_flag)
*** 2579,2585 ****
AC_MSG_CHECKING(linker read-only and read-write section mixing)
gcc_cv_ld_ro_rw_mix=unknown
if test $in_tree_ld = yes ; then
! if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
gcc_cv_ld_ro_rw_mix=read-write
fi
elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
--- 2576,2583 ----
AC_MSG_CHECKING(linker read-only and read-write section mixing)
gcc_cv_ld_ro_rw_mix=unknown
if test $in_tree_ld = yes ; then
! if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 \
! && test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_ro_rw_mix=read-write
fi
elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
*************** AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix)
*** 2617,2623 ****
AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
gcc_cv_ld_eh_frame_hdr=no
if test $in_tree_ld = yes ; then
! if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
gcc_cv_ld_eh_frame_hdr=yes
fi
elif test x$gcc_cv_ld != x; then
--- 2615,2622 ----
AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support)
gcc_cv_ld_eh_frame_hdr=no
if test $in_tree_ld = yes ; then
! if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 \
! && test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_eh_frame_hdr=yes
fi
elif test x$gcc_cv_ld != x; then
*************** AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
*** 2635,2641 ****
AC_MSG_CHECKING(linker position independent executable support)
gcc_cv_ld_pie=no
if test $in_tree_ld = yes ; then
! if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then
gcc_cv_ld_pie=yes
fi
elif test x$gcc_cv_ld != x; then
--- 2634,2641 ----
AC_MSG_CHECKING(linker position independent executable support)
gcc_cv_ld_pie=no
if test $in_tree_ld = yes ; then
! if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 15 -o "$gcc_cv_gld_major_version" -gt 2 \
! && test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_pie=yes
fi
elif test x$gcc_cv_ld != x; then
brgds, H-P