This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug in unwind check for 64bit


Hi,

the configure check for unwind

if test x$TARGET = xX86_64; then
    AC_CACHE_CHECK([toolchain supports unwind section type],
        libffi_cv_as_x86_64_unwind_section_type, [
        cat  > conftest1.s << EOF
.text
.globl foo
foo:
jmp bar
.section .eh_frame,"a",@unwind
bar:
EOF

        cat > conftest2.c  << EOF
extern void foo();
int main(){foo();}
EOF

        libffi_cv_as_x86_64_unwind_section_type=no
# we ensure that we can compile _and_ link an assembly file containing an @unwind section # since the compiler can support it and not the linker (ie old binutils) if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \
           $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then
            libffi_cv_as_x86_64_unwind_section_type=yes
        fi
        ])
    if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then
        AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1,
[Define if your assembler supports unwind section type.])
    fi
fi


is broken, it returns negative even if the option is supported. This makes 64bit build on x86 fail (e.g. on solaris 10 in 64 bit). The problem is that in the linking stage the CFLAGS are not passed, thus the first CC line generates a 64 bit object, but then linking is attempted in 32bit, which fails. $CFLAGS are needed there too.

The small attached patch fixed this problem, it comes from opencsw, and I am giving it back to upstream.

Thank you,

Riccardo
--- configure.ac.orig	Sun Mar 15 21:45:29 2015
+++ configure.ac	Sun Mar 15 21:59:45 2015
@@ -490,7 +490,7 @@
 	# we ensure that we can compile _and_ link an assembly file containing an @unwind section
 	# since the compiler can support it and not the linker (ie old binutils)
 	if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \
-           $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then
+           $CC $CFLAGS conftest2.c conftest1.o > /dev/null 2>&1 ; then
 	    libffi_cv_as_x86_64_unwind_section_type=yes
 	fi
 	])

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]