This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [PATCH] mips: Allow larger values for __aligned__


"Carlos O'Donell" <carlos@codesourcery.com> writes:

> On mips __attribute__((__aligned__(val))) for values of val greater than
> 32kb does not work. This patch changes the default value for
> MAX_OFILE_ALIGNMENT. We set the value of MAX_OFILE_ALIGNMENT to the
> largest page size allowed by the mips PageMask register.

It doesn't make sense to change this unconditionally in mips.h.
MAX_OFILE_ALIGNMENT, as the name suggests, is supposed to be the
maximum alignment supported by the object file format.  Not all object
file formats are alike.

I think the question here is why MAX_OFILE_ALIGNMENT is defined to be
32768 * 8 in config/elfos.h.  ELF supports section alignment up to
0x80000000 * 8 (actually 64-bit ELF supports alignment up to
0x8000000000000000 * 8).  It appears that the value in elfos.h was
moved there from svr4.h, and the value in svr4.h was added here:

Sun Jan  7 16:56:56 1996  Michael Meissner  <meissner@wombat.gnu.ai.mit.edu>

	* {svr4,mips/elf{,64}}.h (MAX_OFILE_ALIGNMENT):  Define as 32768*8.

I suspect the right patch is going to be putting something like this
in elfos.h:

#ifdef HOST_BITS_PER_WIDEST_INT >= 64
#define MAX_OFILE_ALIGNMENT (((unsigned HOST_WIDEST_INT) 1 << 31) * 8)
#else
#define MAX_OFILE_ALIGNMENT (((unsigned HOST_WIDEST_INT) 1 << 28) * 8)
#endif

with appropriate comments of course.  I think that would be both
correct and would solve your particular problem.

(If we had some way of saying that we were using 64-bit ELF, then of
course we could make it even larger.)

Ian


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