Look closer at the lines you've just quoted:
if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \
           $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then

See the $CFLAGS for the first GCC call? It's missing for the second.

So you get that actually executed:
+ gcc -Wa,--fatal-warnings -m64 -Wall -fexceptions -c conftest1.s
+ gcc conftest2.c conftest1.o

The first succeeds, creates a 64 bit object. The second fails, because it tries to link a 64 bit object in 32 bit mode (the default).

Add a $CFLAGS, it'll work better. Report upstream too.

Laurent

On 13/03/2015 17:16, Riccardo Mottola wrote:
Hi,

the other thread reached a too deep reply level and got a bit out of
topic :) The summary is: the toolchain supports unwind section type
returns no even if it should return yes. This makes solaris-x86-64 fail.
The test is executed only if target is X86_64, this is why we weren't
seeing the test in the 32bit build.

The full test check in configure.ac is:
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

it links with $CC a small piece with assembler and tries to see if there
are warnings.

I created the two files manually, I tried:
gcc -Wa,--fatal-warnings -m64 -c conftest1.s

and got no error. (without -m64, I would get an unrecognized section type)

then I do:
cc -m64 conftest2.c conftest1.o


and get no errors, so the test should pass.

What's wrong?

Riccardo


Reply via email to