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

Ability to disable 32-byte alignment of bss/data symbols with size > 32 bytes


Hi - I have the following test program:

struct
{
    int arr[10];
} mycomm ;

int arr_bss[10] ;
int arr_data[10] = {1} ;

Compiling it with '-S' using gcc 4.3.2 under Linux (x86) shows that
each of the three symbols gets aligned on a 32 *BYTE* boundary.
    ...
    .comm    mycomm,40,32
    .comm    arr_bss,40,32
    .align 32
    .type    arr_data, @object
    .size    arr_data, 40


If I pass "-Os", the alignments drop to 4 bytes (as expected);
"__attribute__ ((aligned(4))" also works.  However, I'd very much like
a way to control this behavior globally without getting everything
else that "-Os" comes with.  A "-f" switch perhaps?  I was able to
find http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30004, which appears
to have relaxed the alignment under "-Os" specifically.

For what it's worth, GCC 4.3.2 on Solaris 10 (sparc) emits 4-byte
alignment.  Also, sun's studio 12 compiler on Linux (x86) does the
same.

Thanks in advance.


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