public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix ldconfig on 64-bit arches
@ 2002-08-29  3:29 Jakub Jelinek
  2002-08-29  3:36 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2002-08-29  3:29 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix ldconfig on 64-bit arches
  2002-08-29  3:29 [PATCH] Fix ldconfig on 64-bit arches Jakub Jelinek
@ 2002-08-29  3:36 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2002-08-29  3:36 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Roland McGrath, Glibc hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jakub Jelinek wrote:

> 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.

Looks good, I've applied it.  Thanks,

- -- 
- ---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9bfku2ijCOnn/RHQRAooBAKCttDcTRkawT0V17m4O5jIdhbrvygCgznyI
gKF6PlsW1ahMNbfBVN1YzR4=
=mm1K
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-08-29 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-29  3:29 [PATCH] Fix ldconfig on 64-bit arches Jakub Jelinek
2002-08-29  3:36 ` Ulrich Drepper

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).