------- Comment #2 from pinskia at gcc dot gnu dot org 2007-08-31 01:36 ------- (gdb) p/x sect->common.flags & ~0x100000 $4 = 0x200000 (gdb) p/x flags $5 = 0x200200
Note 0x100000 is SECTION_DECLARED which is masked out in the check. #define SECTION_WRITE 0x00200 /* data is writable */ Writable comes from: #2 0x08748aaa in default_named_section_asm_out_constructor (symbol=0xb7de9270, priority=65535) at /home/apinski/src/gcc-fsf/work/gcc/gcc/varasm.c:1525 1525 sec = get_section (".ctors", SECTION_WRITE, NULL); So this is an internal issue, right? Here is a testcase without using -fprofile-generate/-fprofile-arch: void (*const __CTOR_LIST__[1]) (void) __attribute__ ((section(".ctors"))) = { (void (*) (void)) -1 }; void __libc_global_ctors (void) { run_hooks (__CTOR_LIST__); } static void f(void) __attribute__((constructor)); static void f(void) { __builtin_printf("Hi.\n"); } -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2007-08-31 01:36:01 date| | Target Milestone|--- |4.1.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33216