This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

[PATCH] Fix alpha elf_machine_load_address


Hi!

Alpha elf_machine_load_address computes l_map_start value (= Elf64_Ehdr
address), not l_addr. This means ld.so's first PT_LOAD segment p_vaddr must
be zero as elf_machine_load_address is put into _dl_rtld_map.l_addr.
Here is a patch which fixes it.
If you have better ideas how to compute it, please tell me.

2001-09-19  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/alpha/dl-machine.h (elf_machine_load_address): Compute the
	difference between base address and first PT_LOAD's virtual address,
	not the base address.

--- libc/sysdeps/alpha/dl-machine.h.jj	Mon Sep  3 08:55:51 2001
+++ libc/sysdeps/alpha/dl-machine.h	Wed Sep 19 11:21:20 2001
@@ -70,16 +70,20 @@ elf_machine_load_address (void)
   Elf64_Addr dot;
   long int zero_disp;
 
-  asm("br %0, 1f\n\t"
-      ".weak __load_address_undefined\n\t"
-      "br $0, __load_address_undefined\n"
-      "1:"
+  asm("br %0, 1f\n"
+      "0:\n\t"
+      "br $0, 2f\n"
+      "1:\n\t"
+      ".data\n"
+      "2:\n\t"
+      ".quad 0b\n\t"
+      ".previous"
       : "=r"(dot));
 
   zero_disp = *(int *)dot;
   zero_disp = (zero_disp << 43) >> 41;
 
-  return dot + 4 + zero_disp;
+  return dot - *(Elf64_Addr *)(dot + 4 + zero_disp);
 }
 
 /* Set up the loaded object described by L so its unrelocated PLT

	Jakub


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