This is the mail archive of the gcc-bugs@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]

[Bug target/39323] New: MAX_OFILE_ALIGNMENT in elfos.h is too big


struct tree_decl_common has

unsigned int align : 24;

And the maximum alignment we support is 1 << 23 bits (1 << 20 bytes). However,
config/elfos.h has

/* The biggest alignment supported by ELF in bits. 32-bit ELF 
   supports section alignment up to (0x80000000 * 8), while 
   64-bit ELF supports (0x8000000000000000 * 8). If this macro 
   is not defined, the default is the largest alignment supported 
   by 32-bit ELF and representable on a 32-bit host. Use this
   macro to limit the alignment which can be specified using
   the `__attribute__ ((aligned (N)))' construct.  */
#ifndef MAX_OFILE_ALIGNMENT
#define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8)
#endif

If we ask for alignment greater than 1 << 20 bytes, we won't
get any warnings:

[hjl@gnu-17 gcc]$  cat x.c    
int foo __attribute__ ((aligned(1 << 21))) =  20;
int bar __attribute__ ((aligned(1 << 20))) =  20;
[hjl@gnu-17 gcc]$ ./xgcc -B./ -S x.i 
[hjl@gnu-17 gcc]$ cat x.s
        .file   "x.i"
.globl foo
        .data
        .type   foo, @object
        .size   foo, 4
foo:
        .long   20
.globl bar
        .align 1048576
        .type   bar, @object
        .size   bar, 4
bar:
        .long   20


-- 
           Summary: MAX_OFILE_ALIGNMENT in elfos.h is too big
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39323


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