Support init priority on Solaris
libgcc: * config/ia64/crtbegin.S: Check HAVE_INITFINI_ARRAY_SUPPORT value. * config/ia64/crtend.S: Likewise. gcc: * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Allow for differences in assembler syntax. Support Solaris ld. Define HAVE_INITFINI_ARRAY_SUPPORT as 0/1. * config/sol2.h (SUPPORTS_INIT_PRIORITY): Define to HAVE_INITFINI_ARRAY_SUPPORT. * config/initfini-array.h: Check HAVE_INITFINI_ARRAY_SUPPORT value. * configure.ac (gcc_cv_as_sparc_nobits): Remove. * config/sparc/sparc.c (sparc_solaris_elf_asm_named_section): Don't check HAVE_AS_SPARC_NOBITS. Heed SECTION_NOTYPE. * configure: Regenerate. * config.in: Regenerate. From-SVN: r230013
This commit is contained in:
parent
e1c78addb3
commit
e6b6bf09dd
11 changed files with 187 additions and 103 deletions
|
@ -1,3 +1,23 @@
|
|||
2015-11-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Allow for differences in
|
||||
assembler syntax.
|
||||
Support Solaris ld.
|
||||
Define HAVE_INITFINI_ARRAY_SUPPORT as 0/1.
|
||||
|
||||
* config/sol2.h (SUPPORTS_INIT_PRIORITY): Define to
|
||||
HAVE_INITFINI_ARRAY_SUPPORT.
|
||||
* config/initfini-array.h: Check HAVE_INITFINI_ARRAY_SUPPORT
|
||||
value.
|
||||
|
||||
* configure.ac (gcc_cv_as_sparc_nobits): Remove.
|
||||
* config/sparc/sparc.c (sparc_solaris_elf_asm_named_section):
|
||||
Don't check HAVE_AS_SPARC_NOBITS.
|
||||
Heed SECTION_NOTYPE.
|
||||
|
||||
* configure: Regenerate.
|
||||
* config.in: Regenerate.
|
||||
|
||||
2015-11-09 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
PR middle-end/68253
|
||||
|
|
|
@ -309,43 +309,96 @@ int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
|
|||
gcc_cv_initfini_array=yes
|
||||
fi
|
||||
elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
|
||||
cat > conftest.s <<\EOF
|
||||
.section .dtors,"a",%progbits
|
||||
case $target:$gas in
|
||||
*:yes)
|
||||
sh_flags='"a"'
|
||||
sh_type='%progbits'
|
||||
;;
|
||||
i?86-*-solaris2*:no | x86_64-*-solaris2*:no)
|
||||
sh_flags='"a"'
|
||||
sh_type='@progbits'
|
||||
;;
|
||||
sparc*-*-solaris2*:no)
|
||||
sh_flags='#alloc'
|
||||
sh_type='#progbits'
|
||||
sh_quote='"'
|
||||
;;
|
||||
esac
|
||||
case "$target:$gnu_ld" in
|
||||
*:yes)
|
||||
cat > conftest.s <<EOF
|
||||
.section .dtors,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'A', 'A', 'A', 'A'
|
||||
.section .ctors,"a",%progbits
|
||||
.section .ctors,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'B', 'B', 'B', 'B'
|
||||
.section .fini_array.65530,"a",%progbits
|
||||
.section .fini_array.65530,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'C', 'C', 'C', 'C'
|
||||
.section .init_array.65530,"a",%progbits
|
||||
.section .init_array.65530,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'D', 'D', 'D', 'D'
|
||||
.section .dtors.64528,"a",%progbits
|
||||
.section .dtors.64528,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'E', 'E', 'E', 'E'
|
||||
.section .ctors.64528,"a",%progbits
|
||||
.section .ctors.64528,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'F', 'F', 'F', 'F'
|
||||
.section .fini_array.01005,"a",%progbits
|
||||
.section .fini_array.01005,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'G', 'G', 'G', 'G'
|
||||
.section .init_array.01005,"a",%progbits
|
||||
.section .init_array.01005,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'H', 'H', 'H', 'H'
|
||||
.text
|
||||
.globl _start
|
||||
_start:
|
||||
EOF
|
||||
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
|
||||
&& $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .init_array conftest \
|
||||
| grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .fini_array conftest \
|
||||
| grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
|
||||
gcc_cv_initfini_array=yes
|
||||
fi
|
||||
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
|
||||
&& $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .init_array conftest \
|
||||
| grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .fini_array conftest \
|
||||
| grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
|
||||
gcc_cv_initfini_array=yes
|
||||
fi
|
||||
;;
|
||||
*-*-solaris2*:no)
|
||||
# When Solaris ld added constructor priority support, it was
|
||||
# decided to only handle .init_array.N/.fini_array.N since
|
||||
# there was no need for backwards compatibility with
|
||||
# .ctors.N/.dtors.N. .ctors/.dtors remain as separate
|
||||
# sections with correct execution order resp. to
|
||||
# .init_array/.fini_array, while gld merges them into
|
||||
# .init_array/.fini_array.
|
||||
cat > conftest.s <<EOF
|
||||
.section $sh_quote.fini_array.65530$sh_quote,$sh_flags,$sh_type
|
||||
.align 4
|
||||
.byte 'C', 'C', 'C', 'C'
|
||||
.section $sh_quote.init_array.65530$sh_quote,$sh_flags,$sh_type
|
||||
.align 4
|
||||
.byte 'D', 'D', 'D', 'D'
|
||||
.section $sh_quote.fini_array.01005$sh_quote,$sh_flags,$sh_type
|
||||
.align 4
|
||||
.byte 'G', 'G', 'G', 'G'
|
||||
.section $sh_quote.init_array.01005$sh_quote,$sh_flags,$sh_type
|
||||
.align 4
|
||||
.byte 'H', 'H', 'H', 'H'
|
||||
.text
|
||||
.globl _start
|
||||
_start:
|
||||
EOF
|
||||
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
|
||||
&& $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .init_array conftest \
|
||||
| grep HHHHDDDD > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .fini_array conftest \
|
||||
| grep GGGGCCCC > /dev/null 2>&1; then
|
||||
gcc_cv_initfini_array=yes
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
changequote(,)dnl
|
||||
rm -f conftest conftest.*
|
||||
changequote([,])dnl
|
||||
|
@ -375,10 +428,10 @@ changequote([,])dnl
|
|||
fi])
|
||||
enable_initfini_array=$gcc_cv_initfini_array
|
||||
])
|
||||
if test $enable_initfini_array = yes; then
|
||||
AC_DEFINE(HAVE_INITFINI_ARRAY_SUPPORT, 1,
|
||||
[Define .init_array/.fini_array sections are available and working.])
|
||||
fi])
|
||||
AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY_SUPPORT,
|
||||
[`if test $enable_initfini_array = yes; then echo 1; else echo 0; fi`],
|
||||
[Define 0/1 if .init_array/.fini_array sections are available and working.])
|
||||
])
|
||||
|
||||
dnl # _gcc_COMPUTE_GAS_VERSION
|
||||
dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
|
||||
|
|
|
@ -598,12 +598,6 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* Define to 1 if your assembler supports #nobits, 0 otherwise. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef HAVE_AS_SPARC_NOBITS
|
||||
#endif
|
||||
|
||||
|
||||
/* Define if your assembler and linker support unaligned PC relative relocs.
|
||||
*/
|
||||
#ifndef USED_FOR_TARGET
|
||||
|
@ -1329,7 +1323,8 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* Define .init_array/.fini_array sections are available and working. */
|
||||
/* Define 0/1 if .init_array/.fini_array sections are available and working.
|
||||
*/
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef HAVE_INITFINI_ARRAY_SUPPORT
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_INITFINI_ARRAY_SUPPORT
|
||||
#if HAVE_INITFINI_ARRAY_SUPPORT
|
||||
|
||||
#define USE_INITFINI_ARRAY
|
||||
|
||||
|
|
|
@ -398,11 +398,9 @@ along with GCC; see the file COPYING3. If not see
|
|||
#define NO_DBX_BNSYM_ENSYM 1
|
||||
#endif
|
||||
|
||||
#ifndef USE_GLD
|
||||
/* The Solaris linker doesn't understand constructor priorities. */
|
||||
/* Enable constructor priorities if the configured linker supports it. */
|
||||
#undef SUPPORTS_INIT_PRIORITY
|
||||
#define SUPPORTS_INIT_PRIORITY 0
|
||||
#endif
|
||||
#define SUPPORTS_INIT_PRIORITY HAVE_INITFINI_ARRAY_SUPPORT
|
||||
|
||||
/* Solaris has an implementation of __enable_execute_stack. */
|
||||
#define HAVE_ENABLE_EXECUTE_STACK
|
||||
|
|
|
@ -9868,14 +9868,12 @@ sparc_solaris_elf_asm_named_section (const char *name, unsigned int flags,
|
|||
if (flags & SECTION_CODE)
|
||||
fputs (",#execinstr", asm_out_file);
|
||||
|
||||
/* Sun as only supports #nobits/#progbits since Solaris 10. */
|
||||
if (HAVE_AS_SPARC_NOBITS)
|
||||
{
|
||||
if (flags & SECTION_BSS)
|
||||
fputs (",#nobits", asm_out_file);
|
||||
else
|
||||
fputs (",#progbits", asm_out_file);
|
||||
}
|
||||
if (flags & SECTION_NOTYPE)
|
||||
;
|
||||
else if (flags & SECTION_BSS)
|
||||
fputs (",#nobits", asm_out_file);
|
||||
else
|
||||
fputs (",#progbits", asm_out_file);
|
||||
|
||||
fputc ('\n', asm_out_file);
|
||||
}
|
||||
|
|
127
gcc/configure
vendored
127
gcc/configure
vendored
|
@ -22930,43 +22930,96 @@ fi
|
|||
gcc_cv_initfini_array=yes
|
||||
fi
|
||||
elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
|
||||
cat > conftest.s <<\EOF
|
||||
.section .dtors,"a",%progbits
|
||||
case $target:$gas in
|
||||
*:yes)
|
||||
sh_flags='"a"'
|
||||
sh_type='%progbits'
|
||||
;;
|
||||
i?86-*-solaris2*:no | x86_64-*-solaris2*:no)
|
||||
sh_flags='"a"'
|
||||
sh_type='@progbits'
|
||||
;;
|
||||
sparc*-*-solaris2*:no)
|
||||
sh_flags='#alloc'
|
||||
sh_type='#progbits'
|
||||
sh_quote='"'
|
||||
;;
|
||||
esac
|
||||
case "$target:$gnu_ld" in
|
||||
*:yes)
|
||||
cat > conftest.s <<EOF
|
||||
.section .dtors,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'A', 'A', 'A', 'A'
|
||||
.section .ctors,"a",%progbits
|
||||
.section .ctors,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'B', 'B', 'B', 'B'
|
||||
.section .fini_array.65530,"a",%progbits
|
||||
.section .fini_array.65530,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'C', 'C', 'C', 'C'
|
||||
.section .init_array.65530,"a",%progbits
|
||||
.section .init_array.65530,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'D', 'D', 'D', 'D'
|
||||
.section .dtors.64528,"a",%progbits
|
||||
.section .dtors.64528,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'E', 'E', 'E', 'E'
|
||||
.section .ctors.64528,"a",%progbits
|
||||
.section .ctors.64528,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'F', 'F', 'F', 'F'
|
||||
.section .fini_array.01005,"a",%progbits
|
||||
.section .fini_array.01005,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'G', 'G', 'G', 'G'
|
||||
.section .init_array.01005,"a",%progbits
|
||||
.section .init_array.01005,$sh_flags,$sh_type
|
||||
.balign 4
|
||||
.byte 'H', 'H', 'H', 'H'
|
||||
.text
|
||||
.globl _start
|
||||
_start:
|
||||
EOF
|
||||
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
|
||||
&& $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .init_array conftest \
|
||||
| grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .fini_array conftest \
|
||||
| grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
|
||||
gcc_cv_initfini_array=yes
|
||||
fi
|
||||
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
|
||||
&& $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .init_array conftest \
|
||||
| grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .fini_array conftest \
|
||||
| grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
|
||||
gcc_cv_initfini_array=yes
|
||||
fi
|
||||
;;
|
||||
*-*-solaris2*:no)
|
||||
# When Solaris ld added constructor priority support, it was
|
||||
# decided to only handle .init_array.N/.fini_array.N since
|
||||
# there was no need for backwards compatibility with
|
||||
# .ctors.N/.dtors.N. .ctors/.dtors remain as separate
|
||||
# sections with correct execution order resp. to
|
||||
# .init_array/.fini_array, while gld merges them into
|
||||
# .init_array/.fini_array.
|
||||
cat > conftest.s <<EOF
|
||||
.section $sh_quote.fini_array.65530$sh_quote,$sh_flags,$sh_type
|
||||
.align 4
|
||||
.byte 'C', 'C', 'C', 'C'
|
||||
.section $sh_quote.init_array.65530$sh_quote,$sh_flags,$sh_type
|
||||
.align 4
|
||||
.byte 'D', 'D', 'D', 'D'
|
||||
.section $sh_quote.fini_array.01005$sh_quote,$sh_flags,$sh_type
|
||||
.align 4
|
||||
.byte 'G', 'G', 'G', 'G'
|
||||
.section $sh_quote.init_array.01005$sh_quote,$sh_flags,$sh_type
|
||||
.align 4
|
||||
.byte 'H', 'H', 'H', 'H'
|
||||
.text
|
||||
.globl _start
|
||||
_start:
|
||||
EOF
|
||||
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
|
||||
&& $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .init_array conftest \
|
||||
| grep HHHHDDDD > /dev/null 2>&1 \
|
||||
&& $gcc_cv_objdump -s -j .fini_array conftest \
|
||||
| grep GGGGCCCC > /dev/null 2>&1; then
|
||||
gcc_cv_initfini_array=yes
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
rm -f conftest conftest.*
|
||||
fi
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
|
@ -23009,11 +23062,12 @@ $as_echo "$gcc_cv_initfini_array" >&6; }
|
|||
|
||||
fi
|
||||
|
||||
if test $enable_initfini_array = yes; then
|
||||
|
||||
$as_echo "#define HAVE_INITFINI_ARRAY_SUPPORT 1" >>confdefs.h
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_INITFINI_ARRAY_SUPPORT `if test $enable_initfini_array = yes; then echo 1; else echo 0; fi`
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
# Check if we have .[us]leb128, and support symbol arithmetic with it.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .sleb128 and .uleb128" >&5
|
||||
|
@ -24667,39 +24721,6 @@ $as_echo "#define HAVE_AS_REGISTER_PSEUDO_OP 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for #nobits" >&5
|
||||
$as_echo_n "checking assembler for #nobits... " >&6; }
|
||||
if test "${gcc_cv_as_sparc_nobits+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
gcc_cv_as_sparc_nobits=no
|
||||
if test x$gcc_cv_as != x; then
|
||||
$as_echo '.section "nobits",#alloc,#write,#nobits
|
||||
.section "progbits",#alloc,#write,#progbits' > conftest.s
|
||||
if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
|
||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; }
|
||||
then
|
||||
gcc_cv_as_sparc_nobits=yes
|
||||
else
|
||||
echo "configure: failed program was" >&5
|
||||
cat conftest.s >&5
|
||||
fi
|
||||
rm -f conftest.o conftest.s
|
||||
fi
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_sparc_nobits" >&5
|
||||
$as_echo "$gcc_cv_as_sparc_nobits" >&6; }
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_AS_SPARC_NOBITS `if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`
|
||||
_ACEOF
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -relax option" >&5
|
||||
$as_echo_n "checking assembler for -relax option... " >&6; }
|
||||
if test "${gcc_cv_as_sparc_relax+set}" = set; then :
|
||||
|
|
|
@ -3754,13 +3754,6 @@ AS_HELP_STRING([--disable-fix-cortex-a53-843419],
|
|||
[AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
|
||||
[Define if your assembler supports .register.])])
|
||||
|
||||
gcc_GAS_CHECK_FEATURE([@%:@nobits], gcc_cv_as_sparc_nobits,,,
|
||||
[.section "nobits",#alloc,#write,#nobits
|
||||
.section "progbits",#alloc,#write,#progbits])
|
||||
AC_DEFINE_UNQUOTED(HAVE_AS_SPARC_NOBITS,
|
||||
[`if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`],
|
||||
[Define to 1 if your assembler supports #nobits, 0 otherwise.])
|
||||
|
||||
gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
|
||||
[-relax], [.text],,
|
||||
[AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2015-11-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* config/ia64/crtbegin.S: Check HAVE_INITFINI_ARRAY_SUPPORT
|
||||
value.
|
||||
* config/ia64/crtend.S: Likewise.
|
||||
|
||||
2015-11-07 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
|
||||
|
||||
* config/visium/lib2funcs.c (__set_trampoline_parity): Use
|
||||
|
|
|
@ -61,7 +61,7 @@ __dso_handle:
|
|||
.hidden __dso_handle
|
||||
|
||||
|
||||
#ifdef HAVE_INITFINI_ARRAY_SUPPORT
|
||||
#if HAVE_INITFINI_ARRAY_SUPPORT
|
||||
|
||||
.section .fini_array, "a"
|
||||
data8 @fptr(__do_global_dtors_aux)
|
||||
|
|
|
@ -39,7 +39,7 @@ __DTOR_END__:
|
|||
__JCR_END__:
|
||||
data8 0
|
||||
|
||||
#ifdef HAVE_INITFINI_ARRAY_SUPPORT
|
||||
#if HAVE_INITFINI_ARRAY_SUPPORT
|
||||
.global __do_global_ctors_aux
|
||||
.hidden __do_global_ctors_aux
|
||||
#else /* !HAVE_INITFINI_ARRAY_SUPPORT */
|
||||
|
|
Loading…
Add table
Reference in a new issue