Question about leading underscore of a symbols

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question about leading underscore of a symbols

7,988 Views
Luk
Contributor I
Hi all.
Please, help me with my trouble.
I am use CodeWarrior E68k V3.2.
In my project I must use some object files generated by m68k-gcc.
The problem is that CodeWarrior C compiler adds leading underscores to all symbols.
M68k-gcc doesn't add leading underscores.
I have no possibility to change object files generated by gcc.
How can I tell to CodeWarrior C compiler to doesn't add leading underscores to all symbols?

Thank you!
Labels (1)
0 Kudos
7 Replies

944 Views
CrasyCat
Specialist III
Hello
 
This is a CodeWarrior internal notation and you cannot remove the leading _ from the internal symbol names.
 
Anyway why do you want to remove the _?  It should not matter how the compiler is encoding symbol names internally.
 
Be aware that we are using a different ABI than Gcc, so you will not be able to link CodeWarrior binaries with Gcc binaries...
 
CrasyCat
0 Kudos

944 Views
Luk
Contributor I
CrasyCat!

Of course, it does not matter for me how the compiler is encoding symbol names internally.

But a problems occurs then I try to use some external libraries which are compiled by gcc.

Example: Then I use something like this:
extern int some_variable;

and this 'some_variable' locates in an external gcc's library, CodeWarrior trying to found '_some_variable' symbol, not just 'some_variable'.
And linking cannot be successfully done...
0 Kudos

944 Views
CrasyCat
Specialist III

Hello

As stated in my last message we are not using the same ABI as gcc, so it is not possible to link gcc binary code with CodeWarrior binary code.

This will not work anyway.

CrasyCat

0 Kudos

944 Views
Luk
Contributor I
CrasyCat, thank you.

Can you tell me, where can I find a description of differences between the GCC ABI and CodeWarrior ABI?

Thank you again.
0 Kudos

944 Views
rocco
Senior Contributor II
Ok, I'll bite:

What's an ABI?
0 Kudos

944 Views
J2MEJediMaster
Specialist I
ABI = Application Binary Interface. The ABI defines the run-time environment for the code executing on the processor. These can be registers which store critical values that are used to maintain the execution environment. More importantly, the ABI describes how arguments are passed from the calling code (caller) to a called function (callee). Some ABIs, on processors that have lots of registers, might pass the arguments to the callee in registers. Others might pass the arguments on the stack, while still others might copy the arguments to a chunk of memory called a "frame" that's referenced by a pointer register. In addition, the value returned by the called function to the caller might appear on the stack, or in a specific register.

Needless to say, if the ABI that the tools use doesn't precisely match the ABI that the libraries use, values are going to wind up in the wrong registers or in the wrong locations on the stack and the program instantly dies a horrible death.

---Tom
0 Kudos

943 Views
rocco
Senior Contributor II
Thanks, Tom.

Now I understand CrasyCat's statement that the libraries can't be mixed. I guess I've been doing too much assembler lately. :8)
0 Kudos