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]
Other format: [Raw text]

[PATCH] Fix ldconfig on 64-bit arches


Hi!

ldconfig assumed loadaddr can be only 32-bit, while e.g. with prelinked
libs on Alpha it is usually 0x000002001XXXXXXX.
Furthermore, I don't see the point of masking off lower 12 bits of
p_vaddr/p_offset for computation. If anything it could be p_align - 1,
but then anyway, if a library is incorrectly linked (ie. to receive
ELF load command address/offset not properly aligned
error from dynamic linker), the dynamic strings will be way more likely
at the broken location then some other one we arbitrarily guess.

2002-08-29  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/generic/readelflib.c (process_elf_file): Make loadaddr
	ElfW(Addr).  Don't mask upper 32-bits and lower 12 bits off from
	p_vaddr/p_offset when computing loadaddr.

--- libc/sysdeps/generic/readelflib.c.jj	2002-08-29 12:21:26.000000000 +0200
+++ libc/sysdeps/generic/readelflib.c	2002-08-29 12:21:26.000000000 +0200
@@ -46,7 +46,7 @@ process_elf_file (const char *file_name,
 {
   int i;
   unsigned int j;
-  int loadaddr;
+  ElfW(Addr) loadaddr;
   unsigned int dynamic_addr;
   size_t dynamic_size;
   char *program_interpreter;
@@ -101,8 +101,7 @@ process_elf_file (const char *file_name,
 	{
 	case PT_LOAD:
 	  if (loadaddr == -1)
-	    loadaddr = (segment->p_vaddr & 0xfffff000)
-	      - (segment->p_offset & 0xfffff000);
+	    loadaddr = segment->p_vaddr - segment_p_offset;
 	  break;
 
 	case PT_DYNAMIC:

	Jakub


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