This is the mail archive of the gcc-bugs@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]

[Bug c++/32458] New: __attribute((section(".myname"))) is not working as expected in G++ but works ni GCC


I used the simple program provided in the gcc help pages.
i am using gcc-4.2.0 cross compiler for ARM (I think the problem
should persist in native compilers as well)

------------a.c--------
#include <stdio.h>
int main(void) {
static int  a __attribute__ ((section (".offsets"))) = 0;
static int myname __attribute__ ((section (".offsets"))) =  0 ;
//static char stack[10000] __attribute__ ((section (".stack"))) =
{ 0 };
static int init_data __attribute__ ((section (".prems"))) = 0;

        printf("Hellow world %d\n", 0);
        return 0;
}

---------------------------

---------------a.cc----------------
#include <stdio.h>
int main(void) {
static int  a __attribute__ ((section (".offsets"))) = 0;
static int myname __attribute__ ((section (".offsets"))) =  0 ;
//static char stack[10000] __attribute__ ((section (".stack"))) =
{ 0 };
static int init_data __attribute__ ((section (".prems"))) = 0;

        printf("Hellow world %d\n", 0);
        return 0;
}

-------------------------------------

The files 'a.c' and 'a.cc' are the same except that the 'a.cc' is
treated as c++ file.
in a.o created from 'a.c' has the sections. but the a.o created from
'a.cc' doesn't have

command used:
arm-none-linux-gnueabi-gcc -c a.c

arm-none-linux-gnueabi-gcc -c a.cc

Please let me know if I am wrong here, or let me know if there is a
workaround to make the 'a.cc' to have the sections compiled in.

/Prem


-- 
           Summary: __attribute((section(".myname"))) is not working as
                    expected in G++ but works ni GCC
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: prem dot mallappa at gmail dot com
 GCC build triplet: x86_64-pc-linux
  GCC host triplet: x86_64-pc-linux
GCC target triplet: x86_64-pc-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32458


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