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

DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT


Hello,

the target macro DATA_ALIGNMENT is supposed to be able to override the
alignment used for global data variables.  We are using this on s390x
to make sure all data objects are at least 2-byte aligned.  This is not
an optimization, but essential for correctness, as we cannot load the
address of a label that is not 2-byte aligned.

Unfortunately, DATA_ALIGNMENT is simply ignored when outputting a
variable that has the DECL_USER_ALIGNMENT flag set.  While this does
not usually occur with C code unless using source code like

  char x __attribute__ ((__aligned__(1)));

this flag is apparently much more frequently set by the Ada frontend.
In fact, this is currently causing bootstrap errors for Ada on s390x
because an elaboration check flag variable is not correctly aligned.


My question is now, why is DATA_ALIGNMENT ignored in such cases?
Is this a bug or a feature?  If the latter, what other options does
a backend have to absolutely enforce a minimum alignment for global
variables?


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich dot Weigand at de dot ibm dot com


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