dnl #
AC_DEFUN([gcc_GAS_FLAGS],
[AC_CACHE_CHECK([assembler flags], gcc_cv_as_flags,
-[ case "$target" in
- i[[34567]]86-*-linux*)
+[ case "$target:$gas_flag" in
+ *-*-solaris2*:no)
dnl Override the default, which may be incompatible.
- gcc_cv_as_flags=--32
- ;;
- x86_64-*-linux-gnux32)
- dnl Override the default, which may be incompatible.
- gcc_cv_as_flags=--x32
+ case "$target" in
+ i?86-*-* | sparc-*-*)
+ gcc_cv_as_flags=-m32
+ ;;
+ x86_64-*-* | sparcv9-*-* | sparc64-*-*)
+ gcc_cv_as_flags=-m64
+ ;;
+ esac
+ as_32_opt=-m32
+ as_64_opt=-m64
;;
- x86_64-*-linux*)
+ i?86-*-*:yes | x86_64-*-*:yes )
dnl Override the default, which may be incompatible.
- gcc_cv_as_flags=--64
+ case "$target" in
+ i?86-*-*)
+ gcc_cv_as_flags=--32
+ ;;
+ x86_64-*-linux-gnux32*)
+ gcc_cv_as_flags=--x32
+ ;;
+ x86_64-*-linux*)
+ gcc_cv_as_flags=--64
+ ;;
+ esac
+ as_32_opt=--32
+ as_64_opt=--64
;;
- powerpc*-*-darwin*)
+ powerpc*-*-darwin*:*)
dnl Always pass -arch ppc to assembler.
gcc_cv_as_flags="-arch ppc"
;;
- amdgcn*)
+ amdgcn*:*)
dnl Currently, only the llvm-mc assembler is supported.
dnl Add flags to ensure an amdgcn ELF file is written.
gcc_cv_as_flags="--filetype=obj -triple=amdgcn--amdhsa"
;;
- *)
+ *:*)
gcc_cv_as_flags=" "
;;
esac])
if ${gcc_cv_as_flags+:} false; then :
$as_echo_n "(cached) " >&6
else
- case "$target" in
- i[34567]86-*-linux*)
- gcc_cv_as_flags=--32
- ;;
- x86_64-*-linux-gnux32)
- gcc_cv_as_flags=--x32
+ case "$target:$gas_flag" in
+ *-*-solaris2*:no)
+ case "$target" in
+ i?86-*-* | sparc-*-*)
+ gcc_cv_as_flags=-m32
+ ;;
+ x86_64-*-* | sparcv9-*-* | sparc64-*-*)
+ gcc_cv_as_flags=-m64
+ ;;
+ esac
+ as_32_opt=-m32
+ as_64_opt=-m64
;;
- x86_64-*-linux*)
- gcc_cv_as_flags=--64
+ i?86-*-*:yes | x86_64-*-*:yes )
+ case "$target" in
+ i?86-*-*)
+ gcc_cv_as_flags=--32
+ ;;
+ x86_64-*-linux-gnux32*)
+ gcc_cv_as_flags=--x32
+ ;;
+ x86_64-*-linux*)
+ gcc_cv_as_flags=--64
+ ;;
+ esac
+ as_32_opt=--32
+ as_64_opt=--64
;;
- powerpc*-*-darwin*)
+ powerpc*-*-darwin*:*)
gcc_cv_as_flags="-arch ppc"
;;
- amdgcn*)
+ amdgcn*:*)
gcc_cv_as_flags="--filetype=obj -triple=amdgcn--amdhsa"
;;
- *)
+ *:*)
gcc_cv_as_flags=" "
;;
esac
# No objdump, err on the side of caution.
gcc_cv_as_cfi_directive=no
else
- if test x$gas = xyes; then
- as_32_opt="--32"
- as_64_opt="--64"
- else
- as_32_opt="-m32"
- as_64_opt="-m64"
- fi
case "$target" in
sparc*-*-solaris2.*)
# On Solaris/SPARC, .eh_frame sections should always be read-write.
.word foo(tlsldm)
.word foo(tlsldo)'
;;
- i[34567]86-*-* | x86_64-*-*)
- case "$target" in
- i[34567]86-*-solaris2.* | x86_64-*-solaris2.*)
- on_solaris=yes
- ;;
- *)
- on_solaris=no
- ;;
- esac
- if test x$on_solaris = xyes && test x$gas_flag = xno; then
- conftest_s='
- .section .tdata,"awt",@progbits'
- tls_section_flag=t
+ i?86-*-* | x86_64-*-*)
+ case "$target:$gas_flag" in
+ i?86-*-solaris2*:no | x86_64-*-solaris2*:no)
+ tls_section_flag=t
$as_echo "#define TLS_SECTION_ASM_FLAG 't'" >>confdefs.h
- else
- conftest_s='
- .section ".tdata","awT",@progbits'
- tls_section_flag=T
- fi
+ ;;
+ *:*)
+ tls_section_flag=T
+ ;;
+ esac
+ conftest_s='
+ .section .tdata,"aw'$tls_section_flag'",@progbits'
case "$target" in
- i[34567]86-*-*)
- if test x$on_solaris = xyes; then
- case $gas_flag in
- yes) tls_as_opt="$tls_as_opt --32" ;;
- esac
- fi
+ i?86-*-*)
+ tls_as_opt="$tls_as_opt $as_32_opt"
conftest_s="$conftest_s
foo: .long 25
.text
leal foo@ntpoff(%ecx), %eax"
;;
x86_64-*-*)
- if test x$on_solaris = xyes; then
- case $gas_flag in
- yes) tls_as_opt="$tls_as_opt --64" ;;
- no) tls_as_opt="$tls_as_opt -xarch=amd64" ;;
- esac
- fi
+ tls_as_opt="$as_64_opt"
conftest_s="$conftest_s
foo: .long 25
.text
leaq foo@dtpoff(%rax), %rdx
movq foo@gottpoff(%rip), %rax
movq \$foo@tpoff, %rax"
- ;;
+ ;;
esac
;;
ia64-*-*)
.long foo@TPOFF'
;;
sparc*-*-*)
- case "$target" in
- sparc*-sun-solaris2.*)
- on_solaris=yes
+ case "$target:$gas_flag" in
+ sparc*-sun-solaris2.*:no)
+ conftest_s='
+ .section ".tdata",#alloc,#write,#tls'
;;
- *)
- on_solaris=no
+ *:*)
+ conftest_s='
+ .section ".tdata","awT",@progbits'
;;
esac
- if test x$on_solaris = xyes && test x$gas_flag = xno; then
- conftest_s='
- .section ".tdata",#alloc,#write,#tls'
- else
- conftest_s='
- .section ".tdata","awT",@progbits'
- tls_as_opt="-32"
- fi
+ tls_as_opt=$as_32_opt
conftest_s="$conftest_s
foo: .long 25
.text
# Enforce 32-bit output with gas and gld.
- if test x$gas = xyes; then
- as_ix86_gas_32_opt="--32"
- fi
if test x$gnu_ld = xyes; then
case $target in
*-*-solaris2*) ld_ix86_gld_32_opt="-melf_i386_sol2" ;;
gcc_cv_as_ix86_tlsgdplt=no
if test x"$gcc_cv_as" != x; then
$as_echo 'call tls_gd@tlsgdplt' > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gas_32_opt -o conftest.o conftest.s >&5'
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_32_opt -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
gcc_cv_as_ix86_tlsldmplt=no
if test x"$gcc_cv_as" != x; then
$as_echo "$conftest_s" > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gas_32_opt -o conftest.o conftest.s >&5'
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_32_opt -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
gcc_cv_as_ix86_tlsldm=no
if test x"$gcc_cv_as" != x; then
$as_echo "$conftest_s" > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gas_32_opt -o conftest.o conftest.s >&5'
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_32_opt -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
gcc_cv_as_ix86_got32x=no
if test x"$gcc_cv_as" != x; then
$as_echo "$conftest_s" > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gas_32_opt -o conftest.o conftest.s >&5'
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_32_opt -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
*) ld_ix86_gld_64_opt="-melf_x86_64" ;;
esac
fi
- # Enforce 64-bit output with gas and gld.
- if test x$gas = xyes; then
- as_ix86_gas_64_opt="--64"
- fi
conftest_s='
.text
.globl _start
gcc_cv_as_x86_64_code_6_gottpoff=no
if test x"$gcc_cv_as" != x; then
$as_echo "$conftest_s" > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gas_64_opt -o conftest.o conftest.s >&5'
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_64_opt -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
nop
.data
.long .L0@GOTOFF' > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gas_32_opt -o conftest.o conftest.s >&5'
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_32_opt -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
gcc_cv_as_ix86_tls_get_addr_via_got=no
if test x"$gcc_cv_as" != x; then
$as_echo "$conftest_s" > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gas_32_opt -o conftest.o conftest.s >&5'
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_32_opt -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
ptr:
.quad a_glob
EOF
- if $gcc_cv_as --64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
+ if $gcc_cv_as $as_64_opt -o conftest1.o conftest1.s > /dev/null 2>&1 \
&& $gcc_cv_ld -shared -melf_x86_64 -o conftest1.so conftest1.o > /dev/null 2>&1 \
- && $gcc_cv_as --64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
+ && $gcc_cv_as $as_64_opt -o conftest2.o conftest2.s > /dev/null 2>&1 \
&& $gcc_cv_ld -pie -melf_x86_64 -o conftest conftest2.o conftest1.so > /dev/null 2>&1; then
gcc_cv_ld_pie_copyreloc=yes
fi
# No objdump, err on the side of caution.
gcc_cv_as_cfi_directive=no
else
- if test x$gas = xyes; then
- as_32_opt="--32"
- as_64_opt="--64"
- else
- as_32_opt="-m32"
- as_64_opt="-m64"
- fi
case "$target" in
sparc*-*-solaris2.*)
# On Solaris/SPARC, .eh_frame sections should always be read-write.
.word foo(tlsldm)
.word foo(tlsldo)'
;;
- i[34567]86-*-* | x86_64-*-*)
- case "$target" in
- i[34567]86-*-solaris2.* | x86_64-*-solaris2.*)
- on_solaris=yes
- ;;
- *)
- on_solaris=no
- ;;
- esac
- if test x$on_solaris = xyes && test x$gas_flag = xno; then
- conftest_s='
- .section .tdata,"awt",@progbits'
- tls_section_flag=t
+ i?86-*-* | x86_64-*-*)
+ case "$target:$gas_flag" in
+ i?86-*-solaris2*:no | x86_64-*-solaris2*:no)
+ tls_section_flag=t
changequote([,])dnl
- AC_DEFINE(TLS_SECTION_ASM_FLAG, 't',
+ AC_DEFINE(TLS_SECTION_ASM_FLAG, 't',
[Define to the flag used to mark TLS sections if the default (`T') doesn't work.])
changequote(,)dnl
- else
- conftest_s='
- .section ".tdata","awT",@progbits'
- tls_section_flag=T
- fi
+ ;;
+ *:*)
+ tls_section_flag=T
+ ;;
+ esac
+ conftest_s='
+ .section .tdata,"aw'$tls_section_flag'",@progbits'
case "$target" in
- i[34567]86-*-*)
- if test x$on_solaris = xyes; then
- case $gas_flag in
- yes) tls_as_opt="$tls_as_opt --32" ;;
- esac
- fi
+ i?86-*-*)
+ tls_as_opt="$tls_as_opt $as_32_opt"
conftest_s="$conftest_s
foo: .long 25
.text
leal foo@ntpoff(%ecx), %eax"
;;
x86_64-*-*)
- if test x$on_solaris = xyes; then
- case $gas_flag in
- yes) tls_as_opt="$tls_as_opt --64" ;;
- no) tls_as_opt="$tls_as_opt -xarch=amd64" ;;
- esac
- fi
+ tls_as_opt="$as_64_opt"
conftest_s="$conftest_s
foo: .long 25
.text
leaq foo@dtpoff(%rax), %rdx
movq foo@gottpoff(%rip), %rax
movq \$foo@tpoff, %rax"
- ;;
+ ;;
esac
;;
ia64-*-*)
.long foo@TPOFF'
;;
sparc*-*-*)
- case "$target" in
- sparc*-sun-solaris2.*)
- on_solaris=yes
+ case "$target:$gas_flag" in
+ sparc*-sun-solaris2.*:no)
+ conftest_s='
+ .section ".tdata",#alloc,#write,#tls'
;;
- *)
- on_solaris=no
+ *:*)
+ conftest_s='
+ .section ".tdata","awT",@progbits'
;;
esac
- if test x$on_solaris = xyes && test x$gas_flag = xno; then
- conftest_s='
- .section ".tdata",#alloc,#write,#tls'
- else
- conftest_s='
- .section ".tdata","awT",@progbits'
- tls_as_opt="-32"
- fi
+ tls_as_opt=$as_32_opt
conftest_s="$conftest_s
foo: .long 25
.text
[Define if your assembler supports the 'ud2' mnemonic.])])
# Enforce 32-bit output with gas and gld.
- if test x$gas = xyes; then
- as_ix86_gas_32_opt="--32"
- fi
if test x$gnu_ld = xyes; then
case $target in
*-*-solaris2*) ld_ix86_gld_32_opt="-melf_i386_sol2" ;;
gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc],
gcc_cv_as_ix86_tlsgdplt,
- [$as_ix86_gas_32_opt],
+ [$as_32_opt],
[call tls_gd@tlsgdplt],
[if test x$gcc_cv_ld != x \
&& $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o -G > /dev/null 2>&1; then
gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc],
gcc_cv_as_ix86_tlsldmplt,
- [$as_ix86_gas_32_opt],
+ [$as_32_opt],
[$conftest_s],
[if test x$gcc_cv_ld != x \
&& $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o -G > /dev/null 2>&1; then
value:'
gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM reloc],
gcc_cv_as_ix86_tlsldm,
- [$as_ix86_gas_32_opt],
+ [$as_32_opt],
[$conftest_s],
[if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
&& $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o $ld_tls_libs -lc > /dev/null 2>&1; then
jmp *_start@GOT'
gcc_GAS_CHECK_FEATURE([R_386_GOT32X reloc],
gcc_cv_as_ix86_got32x,
- [$as_ix86_gas_32_opt],
+ [$as_32_opt],
[$conftest_s],
[if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
&& test x$gcc_cv_readelf != x \
*) ld_ix86_gld_64_opt="-melf_x86_64" ;;
esac
fi
- # Enforce 64-bit output with gas and gld.
- if test x$gas = xyes; then
- as_ix86_gas_64_opt="--64"
- fi
conftest_s='
.text
.globl _start
.quad 0'
gcc_GAS_CHECK_FEATURE([R_X86_64_CODE_6_GOTTPOFF reloc],
gcc_cv_as_x86_64_code_6_gottpoff,
- [$as_ix86_gas_64_opt],
+ [$as_64_opt],
[$conftest_s],
[if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \
&& test x$gcc_cv_readelf != x \
gcc_GAS_CHECK_FEATURE([GOTOFF in data],
gcc_cv_as_ix86_gotoff_in_data,
- [$as_ix86_gas_32_opt],
+ [$as_32_opt],
[ .text
.L0:
nop
.byte 0'
gcc_GAS_CHECK_FEATURE([calling ___tls_get_addr via GOT],
gcc_cv_as_ix86_tls_get_addr_via_got,
- [$as_ix86_gas_32_opt],
+ [$as_32_opt],
[$conftest_s],
[if test x$gcc_cv_ld != x \
&& $gcc_cv_ld $ld_ix86_gld_32_opt -o conftest conftest.o > /dev/null 2>&1; then
ptr:
.quad a_glob
EOF
- if $gcc_cv_as --64 -o conftest1.o conftest1.s > /dev/null 2>&1 \
+ if $gcc_cv_as $as_64_opt -o conftest1.o conftest1.s > /dev/null 2>&1 \
&& $gcc_cv_ld -shared -melf_x86_64 -o conftest1.so conftest1.o > /dev/null 2>&1 \
- && $gcc_cv_as --64 -o conftest2.o conftest2.s > /dev/null 2>&1 \
+ && $gcc_cv_as $as_64_opt -o conftest2.o conftest2.s > /dev/null 2>&1 \
&& $gcc_cv_ld -pie -melf_x86_64 -o conftest conftest2.o conftest1.so > /dev/null 2>&1; then
gcc_cv_ld_pie_copyreloc=yes
fi