🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41572

alignment > 2^15 ???

#41572
From: Thipor Kong
Date: Tue, 12 Mar 1996 00:00
63 lines
3265 bytes
Hi!

The powerpc architecture requires page tables to be aligned to at least 2^16.
So I would like to write something like this:

|    typedef struct ppc_pt	ppc_pteg[8];
|    ppc_pteg   page_table[1<<10] __attribute__ ((aligned (1<<16))) = {
|	    ... page table entry groups follow ...
|    };

This fails with a message like

    align.c:1: warning: alignment of `test_array' is greater than maximum object file alignment

which is generated in source varasm.c:1622 ff.:

|   #ifndef MAX_OFILE_ALIGNMENT
|   #define MAX_OFILE_ALIGNMENT BIGGEST_ALIGNMENT
|   #endif
|     if (align > MAX_OFILE_ALIGNMENT)
|	{
|  	  warning_with_decl (decl,
|	      "alignment of `%s' is greater than maximum object file alignment");
|	  align = MAX_OFILE_ALIGNMENT;
|	}

The interesting thing is that my configuration defines MAX_OFILE_ALIGNMENT
to (32768*8) (I've verified this with the -dM option), which is definitely
four times larger then (1<<16)!

Problem two is, that GNU as from GNU bintutils-2.6 has it's maximum
alignment hardcoded in source read.c to 2^15 (in several places).

Two problems to questions:

Where comes the strange GNU cc behavoir from?  How can I force
it to align data to more than 2^15?

What's the reason for hardcoding the maximum alignment into GNU as?
Can I change this to a larger value without running into problems?

Thanks for any help!
Thipor

>--------------------------------------------------------------------------<
druid tkong 49 (/tmp): cat align.c 
int test_array[10] __attribute__ ((aligned (2*32768))) = { 0 };
druid tkong 50 (/tmp): ppc-gcc -v -S align.c
Reading specs from /opt/ppc-tools/lib/gcc-lib/powerpc-eabi/cygnus-2.7.2-960126/specs
gcc version cygnus-2.7.2-960126
 /opt/ppc-tools/lib/gcc-lib/powerpc-eabi/cygnus-2.7.2-960126/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=7 -DPPC -D__embedded__ -D__PPC__ -D__embedded__ -D__PPC -Asystem(embedded) -Acpu(powerpc) -Amachine(powerpc) -D__CHAR_UNSIGNED__ -D_CALL_SYSV -D_BIG_ENDIAN -Amachine(bigendian) -D_ARCH_PPC align.c /usr/tmp/cca12738.i
GNU CPP version cygnus-2.7.2-960126 (PowerPC Embedded)
#include "..." search starts here:
#include <...> search starts here:
 /opt/ppc-tools/lib/gcc-lib/powerpc-eabi/cygnus-2.7.2-960126/include
 /opt/ppc-tools/lib/gcc-lib/powerpc-eabi/cygnus-2.7.2-960126/../../../../powerpc-eabi/include
End of search list.
 /opt/ppc-tools/lib/gcc-lib/powerpc-eabi/cygnus-2.7.2-960126/cc1 /usr/tmp/cca12738.i -quiet -dumpbase align.c -version -o align.s
GNU C version cygnus-2.7.2-960126 (PowerPC Embedded) compiled by GNU C version 2.7.2.
align.c:1: warning: alignment of `test_array' is greater than maximum object file alignment
-- 
�... das kommt immer darauf an, auf welcher Seite des Mikroskops
man sich befindet.� -- Dr. Murnau in `Kafka'
Technical Details
Message-ID: <4i3mg0$8a3@news.cs.tu-berlin.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 11318c,4337908be3c25aaa,start
X-Google-Attributes: gid11318c,public
From: supergau@cs.tu-berlin.de (Thipor Kong)
Subject: alignment > 2^15 ???
Date: 1996/03/12
Message-ID: <4i3mg0$8a3@news.cs.tu-berlin.de>
X-Deja-AN: 142374549
organization: Technical University of Berlin, Germany
content-type: text/plain; charset=iso-8859-1
mime-version: 1.0
newsgroups: gnu.gcc.help