public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* About the gcc  Warning: setting incorrect section attributes for   .note
@ 2008-05-22  1:53 XU SHENG
  2008-05-22  7:04 ` Adam Nemet
  0 siblings, 1 reply; 3+ messages in thread
From: XU SHENG @ 2008-05-22  1:53 UTC (permalink / raw)
  To: gcc

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 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: About the gcc  Warning: setting incorrect section attributes for   .note
  2008-05-22  1:53 About the gcc Warning: setting incorrect section attributes for .note XU SHENG
@ 2008-05-22  7:04 ` Adam Nemet
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Nemet @ 2008-05-22  7:04 UTC (permalink / raw)
  To: XU SHENG; +Cc: gcc

"XU SHENG" <Sheng.Xu@alcatel-lucent.com> writes:
> 	int priv_dat  __attribute__ ((section(".note"))) = MAGIC;
>
...
>
> 	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.

Did you try making priv_dat const?

Adam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: About the gcc  Warning: setting incorrect section attributes   for   .note
       [not found] <87tzgqu8fy.fsf@localhost.localdomain.i-did-not-set--mail-host- address--so-tickle-me>
@ 2008-05-22  7:07 ` XU SHENG
  0 siblings, 0 replies; 3+ messages in thread
From: XU SHENG @ 2008-05-22  7:07 UTC (permalink / raw)
  To: Adam Nemet; +Cc: gcc

Hi Adam,
	It's OK. Thanks. 



Best Regards,
Edison

-----Original Message-----
From: Adam Nemet [mailto:anemet@caviumnetworks.com] 
Sent: 2008年5月22日 15:03
To: XU SHENG
Cc: gcc@gcc.gnu.org
Subject: Re: About the gcc Warning: setting incorrect section attributes for .note

"XU SHENG" <Sheng.Xu@alcatel-lucent.com> writes:
> 	int priv_dat  __attribute__ ((section(".note"))) = MAGIC;
>
...
>
> 	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.

Did you try making priv_dat const?

Adam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-22  7:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22  1:53 About the gcc Warning: setting incorrect section attributes for .note XU SHENG
2008-05-22  7:04 ` Adam Nemet
     [not found] <87tzgqu8fy.fsf@localhost.localdomain.i-did-not-set--mail-host- address--so-tickle-me>
2008-05-22  7:07 ` XU SHENG

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).