shyguyhex
Level: 16
   

Posts: 30/45
EXP: 16647 For next: 3609
Since: 01-04-14
Since last post: 6.9 years Last activity: 6.4 years
|
| Posted on 09-21-14 03:21:02 PM (last edited by shyguyhex at 09-21-14 03:51:51 PM) |
Link | Quote
| |
So I have two tables of structs that I would like to add into my project at link time.
I made the object files using objcopy:
objcopy -I binary -O elf32-i386 -B i386 asm_functions.bin objects\asm_functions.bin.o
objcopy -I binary -O elf32-i386 -B i386 asm_operations.bin objects\asm_operations.bin.o
Then I linked them with gcc:
gcc -w res\b64.res objects\asm_functions.bin.o objects\asm_operations.bin.o b64si.c -o b64si.exe
These are the symbols I'm suppose to use, but gcc tells me that they are undefined when I try to use them:
_binary_asm_operations_bin_start
_binary_asm_functions_bin_start
extern const int _binary_asm_operations_bin_start[];
extern const int _binary_asm_functions_bin_start[];
I know that these are the right symbols because I checked the object files with a hex editor; I checked the final exe as well, and my table and the symbols were in there. So I'm confused as to why the symbols aren't defined. Any help would be appreciated.
(win7 32bit) ____________________ Web R4300i Assembler
Guide to SM64 Behavior Scripts
GS Code Formatter for Nemu's silly Cheats.ini |
shyguyhex
Level: 16
   

Posts: 31/45
EXP: 16647 For next: 3609
Since: 01-04-14
Since last post: 6.9 years Last activity: 6.4 years
|
|
|
andlabs
Member
Level: 38
   

Posts: 214/309
EXP: 361453 For next: 8994
Since: 03-19-10
From: United States
Since last post: 1.1 years Last activity: 138 days
|
|
| Late but what happens if you get rid of the leading underscore? |
Joe
Common spammer 🍬
Level: 111
   

Posts: 3157/3392
EXP: 14501080 For next: 367280
Since: 08-02-07
From: Pororoca
Since last post: 12 days Last activity: 7 hours
|
|
Originally posted by andlabs leading underscore
This is the problem. The MinGW version of gcc adds an underscore to all symbols when it generates assembly code.
The correct fix is to remove the underscores in the C code. ____________________ ふにゃあ。 |
shyguyhex
Level: 16
   

Posts: 32/45
EXP: 16647 For next: 3609
Since: 01-04-14
Since last post: 6.9 years Last activity: 6.4 years
|
| Posted on 09-22-14 01:13:57 AM (last edited by shyguyhex at 09-22-14 01:24:42 AM) |
Link | Quote
| |
|