Christian Stewart
Christian Stewart

Reputation: 15519

Customizing/overriding symbol names at compile time

I'm interested in overriding compiler symbol names, generally automatically generated using mangled strings like this:

modules::ModuleAPI::ModuleAPI() becomes _ZN7modules9ModuleAPIC2Ev

I know there's an alias attribute:

void name1() __attribute__((alias ("name2")));

I'd prefer to do the same, except instead of aliasing, overriding it altogether.

Is this possible?

Upvotes: 3

Views: 265

Answers (1)

melpomene
melpomene

Reputation: 85767

Yes, gcc supports this with the __asm__ keyword:

void name1() __asm__("name2");

Upvotes: 5

Related Questions