From f10bae9a102a00ec97a38d009013c5aa616c847f Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 30 Jun 2012 12:53:04 -0700 Subject: Add STB_SECONDARY support to ld.so Enable STB_SECONDARY if it is supported by binutils. Add 3 STB_SECONDARY tests. * config.h.in: Add HAVE_ASM_SECONDARY_DIRECTIVE. * config.make.in (have-secondary): New macro. * configure.in: Check if STB_SECONDARY is supported by as/ld. Define HAVE_ASM_SECONDARY_DIRECTIVE and set have-secondary to yes if the .secondary assembly directive works. * configure: Regenerated. * elf/Makefile (tests): Add tst-secondary1 tst-secondary2 tst-secondary3 if STB_SECONDARY is supported by as/ld. (modules-names): Add tst-secondarymod tst-secondary1mod tst-secondary2mod tst-secondary3mod if STB_SECONDARY is supported by as/ld. (LDFLAGS-tst-secondarymod.so): New macro. ($(objpfx)tst-secondary1): New rule. ($(objpfx)tst-secondary2): Likewise. ($(objpfx)tst-secondary3): Likewise. * elf/dl-addr.c (determine_info): Also check STB_SECONDARY. * elf/dl-lookup.c (do_lookup_x): Handle STB_SECONDARY. (_dl_lookup_symbol_x): Likewise. * elf/sprof.c (read_symbols): Likewise. * elf/elf.h (STB_SECONDARY): New. (STB_NUM): Updated. * elf/tst-secondary.h: New file. * elf/tst-secondary1.c: Likewise. * elf/tst-secondary1mod.c: Likewise. * elf/tst-secondary2.c: Likewise. * elf/tst-secondary2mod.c: Likewise. * elf/tst-secondary3.c: Likewise. * elf/tst-secondary3mod.c: Likewise. * elf/tst-secondarymod.c: Likewise. --- configure.ac | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index d89aaf0cdf..bf600914a5 100644 --- a/configure.ac +++ b/configure.ac @@ -1577,8 +1577,10 @@ foo: EOF if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then libc_cv_asm_weak_directive=yes + libc_cv_asm_weak=.weak else libc_cv_asm_weak_directive=no + libc_cv_asm_weak= fi rm -f conftest*]) @@ -1597,6 +1599,7 @@ baz: EOF if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then libc_cv_asm_weakext_directive=yes + libc_cv_asm_weak=.weakext else libc_cv_asm_weakext_directive=no fi @@ -1610,6 +1613,53 @@ elif test $libc_cv_asm_weakext_directive = yes; then AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE) fi +AC_CACHE_CHECK(for .secondary assembler directive, + libc_cv_asm_secondary_directive, [dnl +cat > conftest.s <> conftest.s <&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then + if $READELF -s conftest.o | fgrep _sym | fgrep SECOND > /dev/null; then + libc_cv_asm_secondary_directive=yes + else + libc_cv_asm_secondary_directive=no + fi +else + libc_cv_asm_secondary_directive=no +fi +rm -f conftest*]) +if test $libc_cv_asm_secondary_directive = yes; then + AC_DEFINE(HAVE_ASM_SECONDARY_DIRECTIVE) + AC_CACHE_CHECK(for secondary symbol in shared library, + libc_cv_ld_secondary, [dnl +cat > conftest.c <&AS_MESSAGE_LOG_FD]) + then + if $READELF -s conftest.so | fgrep foo | fgrep SECOND > /dev/null; then + libc_cv_ld_secondary=yes + else + libc_cv_ld_secondary=no + fi + else + libc_cv_ld_secondary=no + fi + rm -f conftest*]) +else + libc_cv_ld_secondary=no +fi +AC_SUBST(libc_cv_ld_secondary) + AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl cat > conftest.c <<\EOF _start () {} -- cgit v1.2.1