This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR other/16820 (struct-layout-1 failures on non-ELF systems)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 2 Aug 2004 02:12:38 -0400
- Subject: [PATCH] Fix PR other/16820 (struct-layout-1 failures on non-ELF systems)
- References: <20040731193855.GB8296@devserv.devel.redhat.com> <200408012208.i71M8Vsf018336@hiauly1.hia.nrc.ca>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sun, Aug 01, 2004 at 06:08:30PM -0400, John David Anglin wrote:
> > Of course, failing all of them is too much.
> > You can build the tests with -DDBG and it will tell you in
> > gcc/testsuite/gcc.log what exact tests failed.
>
> # ./tmpdir-gcc-dg-struct-layout-1-t001-01
> fail 49.1
> fail 81.1
> fail 101.1
> fail 113.1
> fail 114.1
> fail 125.1
> fail 171.1
> fail 231.1
> fail 262.1
> ABORT instruction (core dumped)
>
> Ok, I see what's wrong. These all involve 16-byte alignment. This
> exceeds the alignment specified by TARGET_ASM_FILE_START for the
> subspaces $DATA$ and $BSS$. BIGGEST_ALIGNMENT is 64 bits for this
> target, so technically no data object is supposed to need an alignment
> larger than this. Thus, the test is trying to align data to a higher
> alignment than currently supported by the target.
On HPUX which needs 16 byte alignment for atomic instructions?
Anyway, I think at least all ELF targets should support 16-byte alignment,
so the following patch would work (if there are other binary formats which
support 16 byte alignment they could be added too):
2004-08-02 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/compat/struct-layout-1.h (atal16, atal16pa, atpaal16): Use
16 byte alignment only on ELF targets.
--- gcc/testsuite/gcc.dg/compat/struct-layout-1.h.jj 2004-07-30 09:17:06.000000000 +0200
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1.h 2004-08-02 08:09:38.108675894 +0200
@@ -89,17 +89,29 @@ extern int fn5 (void), fn6 (void), fn7 (
#define atal2 __attribute__((aligned (2)))
#define atal4 __attribute__((aligned (4)))
#define atal8 __attribute__((aligned (8)))
+#ifdef __ELF__
#define atal16 __attribute__((aligned (16)))
+#else
+#define atal16 atal8
+#endif
#define atal1pa __attribute__((aligned (1), packed))
#define atal2pa __attribute__((aligned (2), packed))
#define atal4pa __attribute__((aligned (4), packed))
#define atal8pa __attribute__((aligned (8), packed))
+#ifdef __ELF__
#define atal16pa __attribute__((aligned (16), packed))
+#else
+#define atal16pa atal8pa
+#endif
#define atpaal1 __attribute__((packed, aligned (1)))
#define atpaal2 __attribute__((packed, aligned (2)))
#define atpaal4 __attribute__((packed, aligned (4)))
#define atpaal8 __attribute__((packed, aligned (8)))
+#ifdef __ELF__
#define atpaal16 __attribute__((packed, aligned (16)))
+#else
+#define atpaal16 atpaal8
+#endif
#define atQI __attribute__((mode (QI)))
#define atHI __attribute__((mode (HI)))
Jakub