This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
About the gcc Warning: setting incorrect section attributes for .note
- From: "XU SHENG" <Sheng dot Xu at alcatel-lucent dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 22 May 2008 09:53:18 +0800
- Subject: About the gcc Warning: setting incorrect section attributes for .note
Hi community,
I want to add a note section in a ELF formatted file to
indentify some private information. So I declare a private variable in a
single c file use attribute like this:
int priv_dat __attribute__ ((section(".note"))) = MAGIC;
while compile it using gcc 3.4.3, the compiler output following
warnings:
/tmp/cc7Q0lRs.s: Assembler messages:
/tmp/cc7Q0lRs.s:11: Warning: setting incorrect section
attributes for .note
It's clear to me that only section marked attribute with the
startup of ".note" can be compiled to section with type SHT_NOTE in ELF
file. Then only problem is assembler in gcc assumed ".note" section as
"aw" (allocate/write) as default property, but actually, the .note
section can be only marked with "a" (note section is readonly). If I
modify the temporary .s export by gcc assembler by delete "w" property,
the warning is disappeared.
I wonder if any processes can be done for remove this warning?
Because gcc variable attribute can not set detail section property.
Thanks.
Best Regards
Edison Xu