public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] AArch64 have elf_machine_dynamic() find _DYNAMIC via _GLOBAL_OFFSET_TABLE_
@ 2013-06-28 10:39 Marcus Shawcroft
  0 siblings, 0 replies; only message in thread
From: Marcus Shawcroft @ 2013-06-28 10:39 UTC (permalink / raw)
  To: libc-ports

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

Hi,

This patch fixes the AArch64 implementation of elf_machine_dynamic() to find
_DYNAMIC via _GLOBAL_OFFSET_TABLE_ as discussed here:

http://sourceware.org/ml/libc-ports/2013-06/msg00057.html

The corresponding change in ld required to correctly build ld.so was
committed to binutils here:

http://sourceware.org/ml/binutils/2013-06/msg00248.html

/Marcus

2013-06-28  Marcus Shawcroft  <marcus.shawcroft@linaro.org>

* sysdeps/aarch64/dl-machine.h (elf_machine_dynamic): De-reference
_GLOBAL_OFFSET_TABLE_.

[-- Attachment #2: fix-elf_machine_dynamic.diff --]
[-- Type: application/octet-stream, Size: 581 bytes --]

diff --git a/ports/sysdeps/aarch64/dl-machine.h b/ports/sysdeps/aarch64/dl-machine.h
index c91b0c4..01125ee 100644
--- a/ports/sysdeps/aarch64/dl-machine.h
+++ b/ports/sysdeps/aarch64/dl-machine.h
@@ -36,8 +36,8 @@ elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
 static inline ElfW(Addr) __attribute__ ((unused))
 elf_machine_dynamic (void)
 {
-  ElfW(Addr) addr = (ElfW(Addr)) &_DYNAMIC;
-  return addr;
+  extern const ElfW(Addr) _GLOBAL_OFFSET_TABLE_[] attribute_hidden;
+  return _GLOBAL_OFFSET_TABLE_[0];
 }
 
 /* Return the run-time load address of the shared object.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-28 10:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28 10:39 [COMMITTED] AArch64 have elf_machine_dynamic() find _DYNAMIC via _GLOBAL_OFFSET_TABLE_ Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).