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: Problem for using __attribute__((section(".text")))


Hi,

On Thu, Sep 9, 2010 at 9:52 PM, Heyu Zhu <zhu.heyu@gmail.com> wrote:
> Hi everyone,
>
> File boot.c is like below:
>
> ? ? ? ? ?int val[] __attribute__ ((section(".text"))) = {1, 2, 3, 4, 5 ,6};
> ? ? ? ? ?int getval(int i) {
> ? ? ? ? ? ? ? return val[i];
> ? ? ? ? ?}
>
> Then i compile it use gcc-4.2.4 and binutils2.20
>
> ? ? ? ?arm-elf-gcc boot.c -c -o boot.o
>
> It gives a warning:
>
> ? /tmp/ccIlHjum.s: Assembler message:
> ? /tmp/ccIlHjum.s:4: Warning: ignoring changed section attributes for .text
>
> What's wrong? ?What should i do to remove the warning?
>
AFAIR, "__attribute__ ((section(".text")))" will make gcc emits
`,"aw",@progbits' after the '.text' to alter the section attributes.
If you use: "__attribute__ ((section(".text#")))" (notice the extra
'#') this suffix will be commented in the assembly and the warning
will disappear.

 - Arnaud


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