This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.16-ports-merge-272-g5f30cfe


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, master has been updated
       via  5f30cfec00f64edfc0ad932bf7065de13966b69d (commit)
      from  0786794f3a9d03040284c7d59d820de6f41e901c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5f30cfec00f64edfc0ad932bf7065de13966b69d

commit 5f30cfec00f64edfc0ad932bf7065de13966b69d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Sep 2 05:22:24 2012 -0700

    Use the first element of GOT for ld.so addresses
    
    	[BZ #14538]
    	* sysdeps/x86_64/dl-machine.h (elf_machine_dynamic): Use the
    	first element of the GOT.
    	(elf_machine_load_address): Return the difference between
    	the runtime address of _DYNAMIC and elf_machine_dynamic ().

diff --git a/ChangeLog b/ChangeLog
index ad8f23e..c130d9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,16 @@
+2012-09-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #14538]
+	* sysdeps/x86_64/dl-machine.h (elf_machine_dynamic): Use the
+	first element of the GOT.
+	(elf_machine_load_address): Return the difference between
+	the runtime address of _DYNAMIC and elf_machine_dynamic ().
+
 2012-09-01  Allan McRae  <allan@archlinux.org>
 
-        [BZ #13412]
-        * configure.in (AWK): Require gawk version 3.0 or later.
-        * configure: Regenerated.
+	[BZ #13412]
+	* configure.in (AWK): Require gawk version 3.0 or later.
+	* configure: Regenerated.
 
 2012-09-01  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/NEWS b/NEWS
index c10e993..e0dcdf4 100644
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,7 @@ Version 2.17
   3479, 5400, 6778, 6808, 9685, 11607, 13412, 13717, 13696, 13939, 14042,
   14090, 14166, 14150, 14151, 14154, 14157, 14166, 14173, 14195, 14252,
   14283, 14298, 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349,
-  14459, 14476, 14505, 14516, 14519, 14532
+  14459, 14476, 14505, 14516, 14519, 14532, 14538
 
 * Support for STT_GNU_IFUNC symbols added for s390 and s390x.
   Optimized versions of memcpy, memset, and memcmp added for System z10 and
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 9c27ecf..d2654aa 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -41,13 +41,9 @@ elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
 static inline ElfW(Addr) __attribute__ ((unused))
 elf_machine_dynamic (void)
 {
-  ElfW(Addr) addr;
-
-  /* This works because we have our GOT address available in the small PIC
-     model.  */
-  addr = (ElfW(Addr)) &_DYNAMIC;
-
-  return addr;
+  /* This produces an IP-relative reloc which is resolved at link time. */
+  extern const ElfW(Addr) _GLOBAL_OFFSET_TABLE_[] attribute_hidden;
+  return _GLOBAL_OFFSET_TABLE_[0];
 }
 
 
@@ -55,31 +51,11 @@ elf_machine_dynamic (void)
 static inline ElfW(Addr) __attribute__ ((unused))
 elf_machine_load_address (void)
 {
-  ElfW(Addr) addr;
-
-  /* The easy way is just the same as on x86:
-       leaq _dl_start, %0
-       leaq _dl_start(%%rip), %1
-       subq %0, %1
-     but this does not work with binutils since we then have
-     a R_X86_64_32S relocation in a shared lib.
-
-     Instead we store the address of _dl_start in the data section
-     and compare it with the current value that we can get via
-     an RIP relative addressing mode.  Note that this is the address
-     of _dl_start before any relocation performed at runtime.  In case
-     the binary is prelinked the resulting "address" is actually a
-     load offset which is zero if the binary was loaded at the address
-     it is prelinked for.  */
-
-  asm ("lea _dl_start(%%rip), %0\n\t"
-       "sub 1f(%%rip), %0\n\t"
-       ".section\t.data.rel.ro\n"
-       "1:\t" ASM_ADDR " _dl_start\n\t"
-       ".previous\n\t"
-       : "=r" (addr) : : "cc");
-
-  return addr;
+  /* Compute the difference between the runtime address of _DYNAMIC as seen
+     by an IP-relative reference, and the link-time address found in the
+     special unrelocated first GOT entry.  */
+  extern ElfW(Dyn) _DYNAMIC[] attribute_hidden;
+  return (ElfW(Addr)) &_DYNAMIC - elf_machine_dynamic ();
 }
 
 /* Set up the loaded object described by L so its unrelocated PLT

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |   14 +++++++++++---
 NEWS                        |    2 +-
 sysdeps/x86_64/dl-machine.h |   40 ++++++++--------------------------------
 3 files changed, 20 insertions(+), 36 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]