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]

Re: GLOBAL constructor symbol names for static vars are bogus!


> Date: Mon, 23 Mar 1998 13:50:45 -0500 (EST)
> From: "Brad M. Garcia" <bgarcia@fore.com>
> To: Mike Stump <mrs@wrs.com>

> On Fri, 20 Mar 1998, Mike Stump wrote:

> > munch from VxWorks is wrong.  Sed the output of munch to use asm ("bla
> > bla") on the decls, and it should work. 

> Can you give a small example?  I don't know much about inline asm.

nm t.o | munch | sed 's/void \([a-zA-Z.$_0-9]*\)()/void \1() asm("\1")/; s/ \([a-zA-Z0-9_$.]\)/ @\1/g; : foo; /@/{s/@\./_dots_@/g; s/@\([a-zA-Z0-9_$.]\)/\1@/g; s/@\([^a-zA-Z0-9_$.]\)/\1/g; s/@$//; b foo; }'

of:

void __foo1 () asm("__ct_real.function");

void runctors() {
  __foo1 ();
}

class A {
public:
  A () { }
} a;

gives:

...
void _GLOBAL__dots_I_dots_runctors__Fv() asm("_GLOBAL_.I.runctors__Fv");
...
    _GLOBAL__dots_I_dots_runctors__Fv,
...

and this can then be compiled in the normal fashion.

> > Or you can add a real decl to the file.

> What do you mean by this?

If you add void __dummy5() { } to the file, at the top, the problem
will also go away.


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