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 tst-array* on x86_64


Hi!

This is actually the same crap as I had to work around in test-string.h,
ie. x86_64 aligns preinit_array etc. to 16 bytes because they are >=
16 bytes, yet its actual size is 24 bytes.
  /* x86-64 ABI requires arrays greater than 16 bytes to be aligned
     to 16byte boundary.  */
Linker script of course doesn't expect .init_array/.fini_array/.preinit_array
sections to be more than word aligned and thus the labels around them
are on wrong positions.

2002-12-10  Jakub Jelinek  <jakub@redhat.com>

	* elf/tst-array1.c (preinit_array, init_array, fini_array):
	Explicitely align the array to sizeof (void *).
	* elf/tst-array2dep.c (init_array, fini_array): Likewise.

--- libc/elf/tst-array1.c.jj	2002-11-07 23:28:04.000000000 +0100
+++ libc/elf/tst-array1.c	2002-12-10 16:01:54.000000000 +0100
@@ -35,7 +35,7 @@ preinit_2 (void)
 }
 
 void (*const preinit_array []) (void)
-     __attribute__ ((section (".preinit_array"))) =
+     __attribute__ ((section (".preinit_array"), aligned (sizeof (void *)))) =
 {
   &preinit_0,
   &preinit_1,
@@ -60,7 +60,8 @@ init_2 (void)
   write (STDOUT_FILENO, "init array 2\n", 13);
 }
 
-void (*const init_array []) (void) __attribute__ ((section (".init_array"))) =
+void (*const init_array []) (void)
+     __attribute__ ((section (".init_array"), aligned (sizeof (void *)))) =
 {
   &init_0,
   &init_1,
@@ -85,7 +86,8 @@ fini_2 (void)
   write (STDOUT_FILENO, "fini array 2\n", 13);
 }
 
-void (*const fini_array []) (void) __attribute__ ((section (".fini_array"))) =
+void (*const fini_array []) (void)
+     __attribute__ ((section (".fini_array"), aligned (sizeof (void *)))) =
 {
   &fini_0,
   &fini_1,
--- libc/elf/tst-array2dep.c.jj	2002-11-07 23:28:04.000000000 +0100
+++ libc/elf/tst-array2dep.c	2002-12-10 16:02:34.000000000 +0100
@@ -34,7 +34,8 @@ init_2 (void)
   write (STDOUT_FILENO, "DSO init array 2\n", 17);
 }
 
-void (*const init_array []) (void) __attribute__ ((section (".init_array"))) =
+void (*const init_array []) (void)
+     __attribute__ ((section (".init_array"), aligned (sizeof (void *)))) =
 {
   &init_0,
   &init_1,
@@ -59,7 +60,8 @@ fini_2 (void)
   write (STDOUT_FILENO, "DSO fini array 2\n", 17);
 }
 
-void (*const fini_array []) (void) __attribute__ ((section (".fini_array"))) =
+void (*const fini_array []) (void)
+     __attribute__ ((section (".fini_array"), aligned (sizeof (void *)))) =
 {
   &fini_0,
   &fini_1,

	Jakub


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