I need to define a specific symbol name for a function in the resulting object file. example:
test.cpp:
int test();
int test() { //do something return 0; }
I compiled the file using: gcc -c -fno-rtti -fno-builtin -fno-exceptions -nostdinc++ test.cpp -o test.o
(Yes, I want to create a freestanding application!)
The symbol name for the test() function in the resulting test.o file is "_Z4testv":
readelf -s test.o
Symbol table '.symtab' contains 8 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 FILE LOCAL DEFAULT ABS test.cpp 2: 00000000 0 SECTION LOCAL DEFAULT 1 3: 00000000 0 SECTION LOCAL DEFAULT 2 4: 00000000 0 SECTION LOCAL DEFAULT 3 5: 00000000 0 SECTION LOCAL DEFAULT 4 6: 00000000 0 SECTION LOCAL DEFAULT 5 7: 00000000 10 FUNC GLOBAL DEFAULT 1 _Z4testv
So here comes my question. How can I define the symbol name for the test() function for example to _test?
Bye Martin Stecklum