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]

[PATCH] Fix missing definition for Linker alignment limit


This is fix for AVR target which does not have explicit definition for MAX_OFILE_ALIGNMENT.

So it defaults to value of BIGGEST_ALIGNMENT = 8 bits (1 byte).

So any alignment attempt will produce warning :

debugstuff.c:4: warning: alignment of 'Foo' is greater than maximum object file alignment. Using 1

Note alignment is forced to 1 (byte)

Simple testcase:

   typedef int aligned_int __attribute__ ((aligned (2)));
   struct  { char c;aligned_int a,b;} xa = {1,2};

The attached patch corrects this by defining a more appropriate linker alignment limit.

Tested on full testsuite. There were 32 less failures and no regressions

# of expected passes        43485
# of unexpected failures    564
# of unexpected successes    3
# of expected failures        92
# of unresolved testcases    172
# of untested testcases        67
# of unsupported tests        1466

xgcc version 4.4.0 20080511

-------------------------------------------------------------------------------------

2008-05-11 Andy Hutchinson <hutchinsonandy@aim.com>

* config/avr/avr.h (MAX_OFILE_ALIGNMENT_: Define.


Can you approve for gcc head.








Index: gcc/config/avr/avr.h
===================================================================
--- gcc/config/avr/avr.h    (revision 135174)
+++ gcc/config/avr/avr.h    (working copy)
@@ -147,6 +147,9 @@
 /* No data type wants to be aligned rounder than this.  */
 #define BIGGEST_ALIGNMENT 8
 
+/* Maximum alignment permitted by linker */
+#define MAX_OFILE_ALIGNMENT (32768 * 8)
+
 #define TARGET_VTABLE_ENTRY_ALIGN 8
 
 #define STRICT_ALIGNMENT 0

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