This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14911] static const symbols lost when referred in asm
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Apr 2004 17:20:50 -0000
- Subject: [Bug c/14911] static const symbols lost when referred in asm
- References: <20040410182243.14911.monge@sns.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-22 17:20 -------
Just to let you know that I hear that mplayer has not accepted a patch to fix this yet, here is a way to
use the attribute for both 3.4.0 and above and 2.95.3:
#define ATTRIBUTE_USED
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >=4)
#undef ATTRIBUTE_USED
#define ATTRIBUTE_USED __attribute__((used))
#endif
static const int hello ATTRIBUTE_USED = 56;
int main()
{
asm(
"mov hello, %eax\n"
);
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14911