public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Roland McGrath <roland@redhat.com>, Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix tst-array* on x86_64
Date: Tue, 10 Dec 2002 05:52:00 -0000	[thread overview]
Message-ID: <20021210145250.M1310@sunsite.ms.mff.cuni.cz> (raw)

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

             reply	other threads:[~2002-12-10 13:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-10  5:52 Jakub Jelinek [this message]
2002-12-10  9:43 ` H. J. Lu
2002-12-10 10:06   ` Jakub Jelinek
2002-12-10 10:47 ` Ulrich Drepper
2002-12-10 15:25   ` Roland McGrath
2002-12-10 15:44     ` H. J. Lu
2002-12-10 16:35       ` Roland McGrath
2002-12-10 16:56         ` H. J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021210145250.M1310@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).