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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: don't assume reloc_addr passed to elf_machine_rel* is aligned


On Jun  9, 2003, Alexandre Oliva <aoliva@redhat.com> wrote:

> On Jun  4, 2003, Roland McGrath <roland@redhat.com> wrote:
>> There's no reason to leave the /* Elf32_Addr */ comments, and they sure
>> look funny.  In the generic decls (dynamic-link.h), it warrants a comment
>> about the whole issue and why it matters to use the proper pointer type.

> Ok, here's a revised patch.  Ok to install?

> How about the other patch I posted last week, for the mips64-specific
> chunk of the top-level configure?

Since I haven't got any feedback on any of these patches, and
mips-linux doesn't build because it assumes the presence of one of the
patches that is pending, here's a mips-specific patch that should have
the same effect, without burdening the global write maintainers with
reviewing the simple yet long and boring patch I'd posted before.
Andreas, ok to install this one, and revert as soon as the patch that
obsoletes it is accepted (modified or not)?

Index: ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* sysdeps/mips/dl-machine.h (elf_machine_rel): Adjust prototype.
	Drop alignment assumptions from reloc_addr.
	(elf_machine_rel_relative): Adjust prototype.

Index: sysdeps/mips/dl-machine.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/mips/dl-machine.h,v
retrieving revision 1.68
diff -u -p -r1.68 dl-machine.h
--- sysdeps/mips/dl-machine.h 22 Mar 2003 12:50:46 -0000 1.68
+++ sysdeps/mips/dl-machine.h 24 Jun 2003 18:50:51 -0000
@@ -534,12 +534,12 @@ static inline void
 #endif
 elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
 		 const ElfW(Sym) *sym, const struct r_found_version *version,
-		 /* We use void* because the location to be relocated
-		    is not required to be properly aligned for a
-		    ELFW(Addr).  */
-		 void /* ElfW(Addr) */ *const reloc_addr)
+		 ElfW(Addr) *const reloc_addr_)
 {
   const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
+  void *const reloc_addr
+    /* Make sure we don't assume any alignment from reloc_addr_.  */
+    = ({ void *copy; asm ("" : "=r" (copy) : "0" (reloc_addr_)); copy; });
 
 #if !defined RTLD_BOOTSTRAP && !defined SHARED
   /* This is defined in rtld.c, but nowhere in the static libc.a;
@@ -640,7 +640,7 @@ elf_machine_rel (struct link_map *map, c
 
 static inline void
 elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
-			  void /* ElfW(Addr) */ *const reloc_addr)
+			  ElfW(Addr) *const reloc_addr)
 {
   /* XXX Nothing to do.  There is no relative relocation, right?  */
 }
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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