This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, hjl/secondary, created. glibc-2.16-ports-merge-130-g78153d0
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 6 Aug 2012 20:03:57 -0000
- Subject: GNU C Library master sources branch, hjl/secondary, created. glibc-2.16-ports-merge-130-g78153d0
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/secondary has been created
at 78153d0eab3f4cf91e20a4d2b4d702b2f0433e27 (commit)
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=78153d0eab3f4cf91e20a4d2b4d702b2f0433e27
commit 78153d0eab3f4cf91e20a4d2b4d702b2f0433e27
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Jul 4 07:55:52 2012 -0700
Add 3 STB_SECONDARY tests
diff --git a/ChangeLog.second b/ChangeLog.second
index 03cc8e6..26970fd 100644
--- a/ChangeLog.second
+++ b/ChangeLog.second
@@ -1,5 +1,24 @@
2012-06-30 H.J. Lu <hongjiu.lu@intel.com>
+ * 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/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.
+
* config.make.in (have-secondary): New macro.
* configure.in: Check if STB_SECONDARY is supported by as/ld.
* configure: Regenerated.
diff --git a/elf/Makefile b/elf/Makefile
index b999376..4beb416 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -261,6 +261,11 @@ modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
endif
endif
+ifeq (yes,$(have-secondary))
+tests += tst-secondary1 tst-secondary2 tst-secondary3
+modules-names += tst-secondarymod tst-secondary1mod tst-secondary2mod \
+ tst-secondary3mod
+endif
include ../Rules
@@ -1103,6 +1108,17 @@ $(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
$(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
$(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
+LDFLAGS-tst-secondarymod.so = -Wl,-z,secondary
+
+$(objpfx)tst-secondary1: $(objpfx)tst-secondarymod.so \
+ $(objpfx)tst-secondary1mod.so
+
+$(objpfx)tst-secondary2: $(objpfx)tst-secondarymod.so \
+ $(objpfx)tst-secondary2mod.so
+
+$(objpfx)tst-secondary3: $(objpfx)tst-secondarymod.so \
+ $(objpfx)tst-secondary3mod.so
+
$(objpfx)tst-unique1: $(libdl)
$(objpfx)tst-unique1.out: $(objpfx)tst-unique1mod1.so \
$(objpfx)tst-unique1mod2.so
diff --git a/elf/tst-secondary.h b/elf/tst-secondary.h
new file mode 100644
index 0000000..0487e25
--- /dev/null
+++ b/elf/tst-secondary.h
@@ -0,0 +1,3 @@
+#define GLOBAL 1
+#define WEAK 2
+#define SECONDARY 3
diff --git a/elf/tst-secondary1.c b/elf/tst-secondary1.c
new file mode 100644
index 0000000..f4d6edd
--- /dev/null
+++ b/elf/tst-secondary1.c
@@ -0,0 +1,13 @@
+/* Verify that secdonary function is called. */
+
+#include "tst-secondary.h"
+
+extern int bar (void);
+extern void foo (void);
+
+int
+main (void)
+{
+ foo ();
+ return bar () != SECONDARY;
+}
diff --git a/elf/tst-secondary1mod.c b/elf/tst-secondary1mod.c
new file mode 100644
index 0000000..cd0130c
--- /dev/null
+++ b/elf/tst-secondary1mod.c
@@ -0,0 +1,4 @@
+void
+foo (void)
+{
+}
diff --git a/elf/tst-secondary2.c b/elf/tst-secondary2.c
new file mode 100644
index 0000000..3f221cb
--- /dev/null
+++ b/elf/tst-secondary2.c
@@ -0,0 +1,13 @@
+/* Verify that global function is called. */
+
+#include "tst-secondary.h"
+
+extern int bar (void);
+extern void foo (void);
+
+int
+main (void)
+{
+ foo ();
+ return bar () != GLOBAL;
+}
diff --git a/elf/tst-secondary2mod.c b/elf/tst-secondary2mod.c
new file mode 100644
index 0000000..f9407a9
--- /dev/null
+++ b/elf/tst-secondary2mod.c
@@ -0,0 +1,12 @@
+#include "tst-secondary.h"
+
+int
+bar (void)
+{
+ return GLOBAL;
+}
+
+void
+foo (void)
+{
+}
diff --git a/elf/tst-secondary3.c b/elf/tst-secondary3.c
new file mode 100644
index 0000000..b55baea
--- /dev/null
+++ b/elf/tst-secondary3.c
@@ -0,0 +1,13 @@
+/* Verify that weak function is called. */
+
+#include "tst-secondary.h"
+
+extern int bar (void);
+extern void foo (void);
+
+int
+main (void)
+{
+ foo ();
+ return bar () != WEAK;
+}
diff --git a/elf/tst-secondary3mod.c b/elf/tst-secondary3mod.c
new file mode 100644
index 0000000..edfb25b
--- /dev/null
+++ b/elf/tst-secondary3mod.c
@@ -0,0 +1,13 @@
+#include "tst-secondary.h"
+
+int
+__attribute__ ((weak))
+bar (void)
+{
+ return WEAK;
+}
+
+void
+foo (void)
+{
+}
diff --git a/elf/tst-secondarymod.c b/elf/tst-secondarymod.c
new file mode 100644
index 0000000..5363e99
--- /dev/null
+++ b/elf/tst-secondarymod.c
@@ -0,0 +1,9 @@
+#include "tst-secondary.h"
+
+asm (".secondary bar");
+
+int
+bar (void)
+{
+ return SECONDARY;
+}
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0728f9d66a7280fd162c12adb9062b4a5445bf53
commit 0728f9d66a7280fd162c12adb9062b4a5445bf53
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Jul 18 09:47:42 2012 -0700
Check if STB_SECONDARY is supported by as/ld
diff --git a/ChangeLog.second b/ChangeLog.second
index ad3eba0..03cc8e6 100644
--- a/ChangeLog.second
+++ b/ChangeLog.second
@@ -1,5 +1,9 @@
2012-06-30 H.J. Lu <hongjiu.lu@intel.com>
+ * config.make.in (have-secondary): New macro.
+ * configure.in: Check if STB_SECONDARY is supported by as/ld.
+ * configure: Regenerated.
+
* 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.
diff --git a/config.make.in b/config.make.in
index 65410ab..78a7c33 100644
--- a/config.make.in
+++ b/config.make.in
@@ -58,6 +58,7 @@ have-cpp-asm-debuginfo = @libc_cv_cpp_asm_debuginfo@
have-forced-unwind = @libc_cv_forced_unwind@
have-fpie = @libc_cv_fpie@
have-mfma4 = @libc_cv_cc_fma4@
+have-secondary = @libc_cv_z_secondary@
have-as-vis3 = @libc_cv_sparc_as_vis3@
gnu89-inline-CFLAGS = @gnu89_inline@
have-ssp = @libc_cv_ssp@
diff --git a/configure b/configure
index facb6a5..cf15e63 100755
--- a/configure
+++ b/configure
@@ -607,6 +607,7 @@ have_libaudit
LIBGD
libc_cv_cc_submachine
exceptions
+libc_cv_z_secondary
gnu89_inline
libc_cv_ssp
fno_unit_at_a_time
@@ -6728,6 +6729,64 @@ elif test $libc_cv_asm_weakext_directive = yes; then
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler .secondary directive" >&5
+$as_echo_n "checking for assembler .secondary directive... " >&6; }
+if ${libc_cv_asm_secondary_directive+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat > conftest.s <<EOF
+${libc_cv_dot_text}
+.globl foo
+foo:
+.secondary foo
+.secondary bar; bar = foo
+EOF
+if { ac_try='${CC-cc} $ASFLAGS -c conftest.s 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
+ libc_cv_asm_secondary_directive=yes
+else
+ libc_cv_asm_secondary_directive=no
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_secondary_directive" >&5
+$as_echo "$libc_cv_asm_secondary_directive" >&6; }
+if test $libc_cv_asm_secondary_directive = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z secondary" >&5
+$as_echo_n "checking for -z secondary... " >&6; }
+if ${libc_cv_z_secondary+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat > conftest.c <<EOF
+int _start (void) { return 42; }
+EOF
+ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+ -fPIC -shared -o conftest.so conftest.c
+ -Wl,-z,secondary -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
+ libc_cv_z_secondary=yes
+ else
+ libc_cv_z_secondary=no
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_secondary" >&5
+$as_echo "$libc_cv_z_secondary" >&6; }
+else
+ libc_cv_z_secondary=no
+fi
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CFI directives are supported" >&5
$as_echo_n "checking whether CFI directives are supported... " >&6; }
if ${libc_cv_asm_cfi_directives+:} false; then :
diff --git a/configure.in b/configure.in
index 1219b9f..5648929 100644
--- a/configure.in
+++ b/configure.in
@@ -1775,6 +1775,43 @@ elif test $libc_cv_asm_weakext_directive = yes; then
AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
fi
+AC_CACHE_CHECK(for assembler .secondary directive,
+ libc_cv_asm_secondary_directive,
+ [dnl
+cat > conftest.s <<EOF
+${libc_cv_dot_text}
+.globl foo
+foo:
+.secondary foo
+.secondary bar; bar = foo
+EOF
+if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
+ libc_cv_asm_secondary_directive=yes
+else
+ libc_cv_asm_secondary_directive=no
+fi
+rm -f conftest*])
+if test $libc_cv_asm_secondary_directive = yes; then
+ AC_CACHE_CHECK(for -z secondary,
+ libc_cv_z_secondary, [dnl
+cat > conftest.c <<EOF
+int _start (void) { return 42; }
+EOF
+ if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+ -fPIC -shared -o conftest.so conftest.c
+ -Wl,-z,secondary -nostdlib
+ 1>&AS_MESSAGE_LOG_FD])
+ then
+ libc_cv_z_secondary=yes
+ else
+ libc_cv_z_secondary=no
+ fi
+ rm -f conftest*])
+else
+ libc_cv_z_secondary=no
+fi
+AC_SUBST(libc_cv_z_secondary)
+
AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
case $machine in
sparc/sparc64*) cfi_offset=2047;;
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=16a52e9edbdc1bcb06a86217a3f07e8ad03db0b9
commit 16a52e9edbdc1bcb06a86217a3f07e8ad03db0b9
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sat Jun 30 12:53:04 2012 -0700
Add STB_SECONDARY support
diff --git a/ChangeLog.second b/ChangeLog.second
new file mode 100644
index 0000000..ad3eba0
--- /dev/null
+++ b/ChangeLog.second
@@ -0,0 +1,7 @@
+2012-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
diff --git a/elf/dl-addr.c b/elf/dl-addr.c
index 498faf1..dc2aca3 100644
--- a/elf/dl-addr.c
+++ b/elf/dl-addr.c
@@ -87,7 +87,8 @@ determine_info (const ElfW(Addr) addr, struct link_map *match, Dl_info *info,
for (; (void *) symtab < (void *) symtabend; ++symtab)
if ((ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL
- || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK)
+ || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK
+ || ELFW(ST_BIND) (symtab->st_info) == STB_SECONDARY)
&& ELFW(ST_TYPE) (symtab->st_info) != STT_TLS
&& (symtab->st_shndx != SHN_UNDEF
|| symtab->st_value != 0)
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index a2a699b..877eb76 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -285,10 +285,15 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
found_it:
switch (__builtin_expect (ELFW(ST_BIND) (sym->st_info), STB_GLOBAL))
{
+ case STB_SECONDARY:
+ /* Secondary definition. Use this value if we don't find
+ another. */
+ goto dynamic_weak;
case STB_WEAK:
/* Weak definition. Use this value if we don't find another. */
if (__builtin_expect (GLRO(dl_dynamic_weak), 0))
{
+dynamic_weak:
if (! result->s)
{
result->s = sym;
@@ -768,7 +773,9 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
if (__builtin_expect (current_value.s == NULL, 0))
{
- if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
+ if ((*ref == NULL
+ || (ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK
+ && ELFW(ST_BIND) ((*ref)->st_info) != STB_SECONDARY))
&& skip_map == NULL
&& !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
{
diff --git a/elf/elf.h b/elf/elf.h
index 71cfdb8..1b19e31 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -444,7 +444,8 @@ typedef struct
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* Weak symbol */
-#define STB_NUM 3 /* Number of defined types. */
+#define STB_SECONDARY 3 /* Secondary symbol */
+#define STB_NUM 4 /* Number of defined types. */
#define STB_LOOS 10 /* Start of OS-specific */
#define STB_GNU_UNIQUE 10 /* Unique symbol. */
#define STB_HIOS 12 /* End of OS-specific */
diff --git a/elf/sprof.c b/elf/sprof.c
index 2097d31..2325180 100644
--- a/elf/sprof.c
+++ b/elf/sprof.c
@@ -1078,7 +1078,8 @@ read_symbols (struct shobj *shobj)
newsym->name = &shobj->strtab[sym->st_name];
newsym->addr = sym->st_value;
newsym->size = sym->st_size;
- newsym->weak = ELFW(ST_BIND) (sym->st_info) == STB_WEAK;
+ newsym->weak = (ELFW(ST_BIND) (sym->st_info) == STB_SECONDARY
+ || ELFW(ST_BIND) (sym->st_info) == STB_WEAK);
newsym->hidden = (ELFW(ST_VISIBILITY) (sym->st_other)
!= STV_DEFAULT);
newsym->ticks = 0;
@@ -1136,7 +1137,8 @@ read_symbols (struct shobj *shobj)
newsym->name = &strtab[symtab->st_name];
newsym->addr = symtab->st_value;
newsym->size = symtab->st_size;
- newsym->weak = ELFW(ST_BIND) (symtab->st_info) == STB_WEAK;
+ newsym->weak = (ELFW(ST_BIND) (symtab->st_info) == STB_SECONDARY
+ || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK);
newsym->hidden = (ELFW(ST_VISIBILITY) (symtab->st_other)
!= STV_DEFAULT);
newsym->ticks = 0;
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources