mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 14:50:05 +00:00
Remove NO_CTORS_DTORS_SECTIONS macro
This was originally added to support binutils older than version 2.22: <https://sourceware.org/ml/libc-alpha/2010-12/msg00051.html> Since 2.22 is older than the minimum required binutils version for building glibc, we no longer need this. (The changes do not impact the statically linked startup code.)
This commit is contained in:
parent
7b5bfe7783
commit
ce12fc7113
@ -690,8 +690,7 @@ $(common-objpfx)linkobj/libc.so: link-libc-deps = # empty
|
|||||||
|
|
||||||
# Use our own special initializer and finalizer files for the libc.so
|
# Use our own special initializer and finalizer files for the libc.so
|
||||||
# libraries.
|
# libraries.
|
||||||
$(common-objpfx)libc.so: $(elf-objpfx)soinit.os \
|
$(common-objpfx)libc.so: $(common-objpfx)libc_pic.os$(libc_pic_clean) \
|
||||||
$(common-objpfx)libc_pic.os$(libc_pic_clean) \
|
|
||||||
$(elf-objpfx)sofini.os \
|
$(elf-objpfx)sofini.os \
|
||||||
$(elf-objpfx)interp.os \
|
$(elf-objpfx)interp.os \
|
||||||
$(elf-objpfx)ld.so \
|
$(elf-objpfx)ld.so \
|
||||||
@ -699,8 +698,7 @@ $(common-objpfx)libc.so: $(elf-objpfx)soinit.os \
|
|||||||
$(build-shlib)
|
$(build-shlib)
|
||||||
$(call after-link,$@)
|
$(call after-link,$@)
|
||||||
|
|
||||||
$(common-objpfx)linkobj/libc.so: $(elf-objpfx)soinit.os \
|
$(common-objpfx)linkobj/libc.so: $(common-objpfx)linkobj/libc_pic.a \
|
||||||
$(common-objpfx)linkobj/libc_pic.a \
|
|
||||||
$(elf-objpfx)sofini.os \
|
$(elf-objpfx)sofini.os \
|
||||||
$(elf-objpfx)interp.os \
|
$(elf-objpfx)interp.os \
|
||||||
$(elf-objpfx)ld.so \
|
$(elf-objpfx)ld.so \
|
||||||
|
@ -157,9 +157,6 @@
|
|||||||
/* Define if multi-arch DSOs should be generated. */
|
/* Define if multi-arch DSOs should be generated. */
|
||||||
#undef USE_MULTIARCH
|
#undef USE_MULTIARCH
|
||||||
|
|
||||||
/* Define if `.ctors' and `.dtors' sections shouldn't be used. */
|
|
||||||
#undef NO_CTORS_DTORS_SECTIONS
|
|
||||||
|
|
||||||
/* Define if obsolete RPC code should be made available for user-level code
|
/* Define if obsolete RPC code should be made available for user-level code
|
||||||
to link against. */
|
to link against. */
|
||||||
#undef LINK_OBSOLETE_RPC
|
#undef LINK_OBSOLETE_RPC
|
||||||
|
53
configure
vendored
53
configure
vendored
@ -5753,59 +5753,6 @@ if test $libc_cv_have_sdata_section = yes; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use .ctors/.dtors header and trailer" >&5
|
|
||||||
$as_echo_n "checking whether to use .ctors/.dtors header and trailer... " >&6; }
|
|
||||||
if ${libc_cv_ctors_header+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
libc_cv_ctors_header=yes
|
|
||||||
cat > conftest.c <<EOF
|
|
||||||
int _start (void) { return 0; }
|
|
||||||
int __start (void) { return 0; }
|
|
||||||
|
|
||||||
__attribute__ ((constructor)) void ctor (void) { asm (""); }
|
|
||||||
__attribute__ ((destructor)) void dtor (void) { asm (""); }
|
|
||||||
|
|
||||||
EOF
|
|
||||||
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
|
|
||||||
conftest.c -static -nostartfiles -nostdlib
|
|
||||||
1>&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 :
|
|
||||||
if $READELF -WS conftest$ac_exeext | $AWK '
|
|
||||||
{ gsub(/\[ */, "[") }
|
|
||||||
$2 == ".ctors" || $2 == ".dtors" {
|
|
||||||
size = strtonum("0x" $6)
|
|
||||||
align = strtonum("0x" $NF)
|
|
||||||
seen[$2] = 1
|
|
||||||
stub[$2] = size == align * 2
|
|
||||||
}
|
|
||||||
END {
|
|
||||||
ctors_ok = !seen[".ctors"] || stub[".ctors"]
|
|
||||||
dtors_ok = !seen[".dtors"] || stub[".dtors"]
|
|
||||||
exit ((ctors_ok && dtors_ok) ? 0 : 1)
|
|
||||||
}
|
|
||||||
'; then :
|
|
||||||
libc_cv_ctors_header=no
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
as_fn_error $? "missing __attribute__ ((constructor)) support??" "$LINENO" 5
|
|
||||||
|
|
||||||
fi
|
|
||||||
rm -f conftest*
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ctors_header" >&5
|
|
||||||
$as_echo "$libc_cv_ctors_header" >&6; }
|
|
||||||
if test $libc_cv_ctors_header = no; then
|
|
||||||
$as_echo "#define NO_CTORS_DTORS_SECTIONS 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libunwind-support in compiler" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libunwind-support in compiler" >&5
|
||||||
$as_echo_n "checking for libunwind-support in compiler... " >&6; }
|
$as_echo_n "checking for libunwind-support in compiler... " >&6; }
|
||||||
if ${libc_cv_cc_with_libunwind+:} false; then :
|
if ${libc_cv_cc_with_libunwind+:} false; then :
|
||||||
|
30
configure.ac
30
configure.ac
@ -1251,36 +1251,6 @@ if test $libc_cv_have_sdata_section = yes; then
|
|||||||
AC_DEFINE(HAVE_SDATA_SECTION)
|
AC_DEFINE(HAVE_SDATA_SECTION)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
|
|
||||||
libc_cv_ctors_header, [dnl
|
|
||||||
libc_cv_ctors_header=yes
|
|
||||||
LIBC_TRY_LINK_STATIC([
|
|
||||||
__attribute__ ((constructor)) void ctor (void) { asm (""); }
|
|
||||||
__attribute__ ((destructor)) void dtor (void) { asm (""); }
|
|
||||||
],
|
|
||||||
[dnl
|
|
||||||
AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
|
|
||||||
{ gsub(/\@<:@ */, "@<:@") }
|
|
||||||
$2 == ".ctors" || $2 == ".dtors" {
|
|
||||||
size = strtonum("0x" $6)
|
|
||||||
align = strtonum("0x" $NF)
|
|
||||||
seen@<:@$2@:>@ = 1
|
|
||||||
stub@<:@$2@:>@ = size == align * 2
|
|
||||||
}
|
|
||||||
END {
|
|
||||||
ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
|
|
||||||
dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
|
|
||||||
exit ((ctors_ok && dtors_ok) ? 0 : 1)
|
|
||||||
}
|
|
||||||
'], [libc_cv_ctors_header=no])
|
|
||||||
], [dnl
|
|
||||||
AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
if test $libc_cv_ctors_header = no; then
|
|
||||||
AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(for libunwind-support in compiler,
|
AC_CACHE_CHECK(for libunwind-support in compiler,
|
||||||
libc_cv_cc_with_libunwind, [
|
libc_cv_cc_with_libunwind, [
|
||||||
cat > conftest.c <<EOF
|
cat > conftest.c <<EOF
|
||||||
|
@ -73,10 +73,6 @@ _init_first (int argc, char **argv, char **envp)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
__init_misc (argc, argv, envp);
|
__init_misc (argc, argv, envp);
|
||||||
|
|
||||||
#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
|
|
||||||
__libc_global_ctors ();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is defined here so that if this file ever gets into
|
/* This function is defined here so that if this file ever gets into
|
||||||
|
@ -98,7 +98,7 @@ ld-map = $(common-objpfx)ld.map
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (yes,$(build-shared))
|
ifeq (yes,$(build-shared))
|
||||||
extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
|
extra-objs = $(all-rtld-routines:%=%.os) sofini.os interp.os
|
||||||
generated += librtld.os dl-allobjs.os ld.so ldd
|
generated += librtld.os dl-allobjs.os ld.so ldd
|
||||||
install-others = $(inst_rtlddir)/$(rtld-installed-name)
|
install-others = $(inst_rtlddir)/$(rtld-installed-name)
|
||||||
install-bin-script = ldd
|
install-bin-script = ldd
|
||||||
|
12
elf/sofini.c
12
elf/sofini.c
@ -1,15 +1,3 @@
|
|||||||
/* Finalizer module for ELF shared C library. This provides terminating
|
|
||||||
null pointer words in the `.ctors' and `.dtors' sections. */
|
|
||||||
|
|
||||||
#ifndef NO_CTORS_DTORS_SECTIONS
|
|
||||||
static void (*const __CTOR_END__[1]) (void)
|
|
||||||
__attribute__ ((used, section (".ctors")))
|
|
||||||
= { 0 };
|
|
||||||
static void (*const __DTOR_END__[1]) (void)
|
|
||||||
__attribute__ ((used, section (".dtors")))
|
|
||||||
= { 0 };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
|
/* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
|
||||||
this would be the 'length' field in a real FDE. */
|
this would be the 'length' field in a real FDE. */
|
||||||
|
|
||||||
|
43
elf/soinit.c
43
elf/soinit.c
@ -1,43 +0,0 @@
|
|||||||
/* Initializer module for building the ELF shared C library. This file and
|
|
||||||
sofini.c do the work normally done by crtbeginS.o and crtendS.o, to wrap
|
|
||||||
the `.ctors' and `.dtors' sections so the lists are terminated, and
|
|
||||||
calling those lists of functions. */
|
|
||||||
|
|
||||||
#ifndef NO_CTORS_DTORS_SECTIONS
|
|
||||||
# include <stdlib.h>
|
|
||||||
|
|
||||||
static void (*const __CTOR_LIST__[1]) (void)
|
|
||||||
__attribute__ ((used, section (".ctors")))
|
|
||||||
= { (void (*) (void)) -1 };
|
|
||||||
static void (*const __DTOR_LIST__[1]) (void)
|
|
||||||
__attribute__ ((used, section (".dtors")))
|
|
||||||
= { (void (*) (void)) -1 };
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
run_hooks (void (*const list[]) (void))
|
|
||||||
{
|
|
||||||
while (*++list)
|
|
||||||
(**list) ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function will be called from _init_first in init-first.c. */
|
|
||||||
void
|
|
||||||
__libc_global_ctors (void)
|
|
||||||
{
|
|
||||||
/* Call constructor functions. */
|
|
||||||
run_hooks (__CTOR_LIST__);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* This function becomes the DT_FINI termination function
|
|
||||||
for the C library. */
|
|
||||||
void
|
|
||||||
__libc_fini (void)
|
|
||||||
{
|
|
||||||
/* Call destructor functions. */
|
|
||||||
run_hooks (__DTOR_LIST__);
|
|
||||||
}
|
|
||||||
|
|
||||||
void (*_fini_ptr) (void) __attribute__ ((section (".fini_array")))
|
|
||||||
= &__libc_fini;
|
|
||||||
#endif
|
|
@ -24,9 +24,6 @@
|
|||||||
/* Initialize the `__libc_enable_secure' flag. */
|
/* Initialize the `__libc_enable_secure' flag. */
|
||||||
extern void __libc_init_secure (void);
|
extern void __libc_init_secure (void);
|
||||||
|
|
||||||
/* This function will be called from _init_first in init-first.c. */
|
|
||||||
extern void __libc_global_ctors (void);
|
|
||||||
|
|
||||||
/* Discover the tick frequency of the machine if something goes wrong,
|
/* Discover the tick frequency of the machine if something goes wrong,
|
||||||
we return 0, an impossible hertz. */
|
we return 0, an impossible hertz. */
|
||||||
extern int __profile_frequency (void);
|
extern int __profile_frequency (void);
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
extern void __mach_init (void);
|
extern void __mach_init (void);
|
||||||
extern void __init_misc (int, char **, char **);
|
extern void __init_misc (int, char **, char **);
|
||||||
extern void __libc_global_ctors (void);
|
|
||||||
|
|
||||||
unsigned long int __hurd_threadvar_stack_offset;
|
unsigned long int __hurd_threadvar_stack_offset;
|
||||||
unsigned long int __hurd_threadvar_stack_mask;
|
unsigned long int __hurd_threadvar_stack_mask;
|
||||||
@ -83,10 +82,6 @@ posixland_init (int argc, char **argv, char **envp)
|
|||||||
_dl_non_dynamic_init ();
|
_dl_non_dynamic_init ();
|
||||||
#endif
|
#endif
|
||||||
__init_misc (argc, argv, envp);
|
__init_misc (argc, argv, envp);
|
||||||
|
|
||||||
#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
|
|
||||||
__libc_global_ctors ();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user