Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: parisc-linux@lists.parisc-linux.org
Cc: bcollins@debian.org, randolph@tausq.org, libc-alpha@sources.redhat.com
Subject: [parisc-linux] Fix for hppa-linux ld.so with newer binutils
Date: Sat, 20 Oct 2001 17:09:07 +0930	[thread overview]
Message-ID: <20011020170907.G1037@bubble.sa.bigpond.net.au> (raw)

Newer binutils don't initialise .got entries for global syms, so the
scheme used by sysdeps/hppa/dl-machine.h:elf_machine_dynamic to find
the address of .dynamic no longer works.

ChangeLog
	* sysdeps/hppa/dl-machine.h (elf_machine_dynamic):  Make it a
	const function.  Do not use &_DYNAMIC as .got entries for global
	syms are no longer initialised.  Instead they rely on the reloc,
	which hasn't yet been applied.
	(elf_machine_load_address): Make it const.  Call
	elf_machine_dynamic as that function is called fropm rtld anyway.

-- 
Alan Modra
 
Index: sysdeps/hppa/dl-machine.h
===================================================================
RCS file: /home/cvs/parisc/glibc/sysdeps/hppa/dl-machine.h,v
retrieving revision 1.41
diff -u -p -r1.41 dl-machine.h
--- dl-machine.h	2001/06/08 00:19:01	1.41
+++ dl-machine.h	2001/10/20 07:20:27
@@ -76,42 +76,40 @@ elf_machine_matches_host (const Elf32_Eh
 
 /* Return the link-time address of _DYNAMIC.  */
 static inline Elf32_Addr
+elf_machine_dynamic (void) __attribute__ ((const));
+
+static inline Elf32_Addr
 elf_machine_dynamic (void)
 {
   Elf32_Addr dynamic;
 
-#if 0
-  /* Use this method if GOT address not yet set up.  */
   asm (
 "	b,l	1f,%0\n"
 "	depi	0,31,2,%0\n"
 "1:	addil	L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8),%0\n"
 "	ldw	R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%%r1),%0\n"
       : "=r" (dynamic) : : "r1");
-#else
-  /* This works because we already have our GOT address available.  */
-  dynamic = (Elf32_Addr) &_DYNAMIC;
-#endif
 
   return dynamic;
 }
 
 /* Return the run-time load address of the shared object.  */
 static inline Elf32_Addr
+elf_machine_load_address (void) __attribute__ ((const));
+
+static inline Elf32_Addr
 elf_machine_load_address (void)
 {
-  Elf32_Addr dynamic, dynamic_linkaddress;
+  Elf32_Addr dynamic;
 
   asm (
 "	b,l	1f,%0\n"
 "	depi	0,31,2,%0\n"
 "1:	addil	L'_DYNAMIC - ($PIC_pcrel$0 - 8),%0\n"
-"	ldo	R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%%r1),%1\n"
-"	addil	L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%0\n"
-"	ldw	R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%%r1),%0\n"
-   : "=r" (dynamic_linkaddress), "=r" (dynamic) : : "r1");
+"	ldo	R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%%r1),%0\n"
+   : "=r" (dynamic) : : "r1");
 
-  return dynamic - dynamic_linkaddress;
+  return dynamic - elf_machine_dynamic ();
 }
 
 /* Fixup a PLT entry to bounce directly to the function at VALUE.  */

             reply	other threads:[~2001-10-20  7:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-20  7:39 Alan Modra [this message]
2001-10-20 13:54 ` [parisc-linux] Re: Fix for hppa-linux ld.so with newer binutils Ben Collins
2001-10-20 14:34   ` Alan Modra
2001-10-20 15:01     ` Ben Collins
2001-10-24 23:51       ` Ben Collins
2001-10-25  0:56         ` Randolph Chung
2001-10-25  1:12           ` Ben Collins
2001-10-25 15:07         ` Matthew Wilcox
2001-10-25 15:50           ` Ben Collins
2001-10-22  3:44     ` Alan Modra
2001-10-20 18:01 ` [parisc-linux] " Carlos O'Donell Jr.
2001-10-21 11:20   ` Alan Modra
2001-10-22 14:05 ` [parisc-linux] " Alan Modra
2001-10-22 16:04   ` Carlos O'Donell Jr.
2001-10-22 16:11     ` Alan Modra
2001-10-23  1:31   ` Ben Collins
2001-10-23  1:59     ` Randolph Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011020170907.G1037@bubble.sa.bigpond.net.au \
    --to=amodra@bigpond.net.au \
    --cc=bcollins@debian.org \
    --cc=libc-alpha@sources.redhat.com \
    --cc=parisc-linux@lists.parisc-linux.org \
    --cc=randolph@tausq.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox