This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: [RX] : Wrong alignment of falign-labels=n
- From: Chung-Ju Wu <jasonwucj at gmail dot com>
- To: Sandeep Kumar Singh <Sandeep dot Singh2 at kpit dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>, nick clifton <nickc at redhat dot com>
- Date: Mon, 9 Jun 2014 13:58:23 +0800
- Subject: Re: [RX] : Wrong alignment of falign-labels=n
- Authentication-results: sourceware.org; auth=none
- References: <2fef495141fd4ef594b4b8d414314f83 at HKXPR03MB166 dot apcprd03 dot prod dot outlook dot com>
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