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]

Re: [RX] : Wrong alignment of falign-labels=n


2014-06-07 15:21 GMT+08:00 Sandeep Kumar Singh <Sandeep.Singh2@kpit.com>:
> Hi,
>
> I need some help,
>
> The GNURX toolchain align wrong labels with option falign-labels=n, where n
> is number of bytes. As per GCC manual, the GNU RX toolchain should align as
> given below, The relationship between -falign-labels and expected .balign
> output supposed to be:
> -falign-labels=4 --> .balign 4
> -falign-labels=8 --> .balign 8
> -falign-labels=16 --> .balign 16
>
> However, listed pseudo code was the like (without any optimization):
> -falign-labels=1 --> .balign 2
> -falign-labels=4 --> .balign 16
> -falign-labels=8 --> .balign 256
> -falign-labels=16 --> .balign 65536
>

In gcc/config/rx/rx.h, it uses align_labels to implement LABEL_ALIGN(x):

#define LABEL_ALIGN(x)   (align_labels ? align_labels :
rx_align_for_label (x, 3))

Refer to GCC Internal "17.21.10 Assembler Commands for Alignment",
the alignment is the value with log base 2.  Therefore,
  align_labels = 1  -->  alignment 2^1 = 2
  align_labels = 4  -->  alignment 2^4 = 16
  align_labels = 8  -->  alignment 2^8 = 256
  align_labels = 16  -->  alignment 2^16 = 65536

I think that is why you got those results.
You can try to use align_labels_log to see if it generates
the alignment results that you expect.

But I am not sure if the change is correct to rx port,
so I include rx maintainer, Nick Clifton, in the CC list,
to see if he has any comment for your question.


Best regards,
jasonwucj


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