forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

linking with calloc

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
cheriff
Regular


Joined: 23 Jun 2004
Posts: 262
Location: Sydney.au

PostPosted: Sat Mar 05, 2005 4:24 pm    Post subject: linking with calloc Reply with quote

I just was playing around a bit with some IOP code that needed calloc (using the iop Makefile that ahz.irx used).
So I added to the top of imports.1st:
Code:
alloc_IMPORTS_start
I_alloc
I_calloc
I_malloc
I_free
alloc_IMPORTS_end

and #include <alloc.h> in irx_imports.x

this died with an error:
Quote:
tmp/cc791Krm.s:332: Error: expected comma after symbol-name


after manually compiling build-imports.c to a .s file, line 332 is:
Code:
.comm   .section   .text


seems my iop toolchain doesn't like the .comm directive?? If i remove that and manually compile the 'fixed' .s to a .o the make process completes as normal.

SO. My question to you, it what is this .comm mean, and is it important? If so, why does it cause errors, and if not, why is it being emitted in the first place? I looked around a little, but I cant find where these lines of code come from....
Thanks!
- cheriff
_________________
Damn, I need a decent signature!
Back to top
View user's profile Send private message
protomank



Joined: 18 Dec 2008
Posts: 64
Location: Porto Alegre, RS, Brazil

PostPosted: Fri Oct 30, 2009 8:43 am    Post subject: Reply with quote

I am having this exact same error when trying to compile ps2sdk in ps2toolchain/build/ps2sdk/iop/debug/iop_sbusdbg:

root@satellite:/arquivos/programas/devel/ps2/ps2toolchain/build/ps2sdk/iop/debug/iop_sbusdbg# make
echo "#include \"irx_imports.h\"" > src/build-imports.c
cat src/imports.lst >> src/build-imports.c
iop-gcc -miop -O2 -G0 -I/arquivos/programas/devel/ps2/ps2toolchain/build/ps2sdk//iop/include -I/arquivos/programas/devel/ps2/ps2toolchain/build/ps2sdk//iop/kernel/include/ -I/arquivos/programas/devel/ps2/ps2toolchain/build/ps2sdk//common/include -I/arquivos/programas/devel/ps2/ps2toolchain/build/ps2sdk//iop/debug/iopdebug/include/ -I/arquivos/programas/devel/ps2/ps2toolchain/build/ps2sdk//common/sbus/include -I./include -I./src -Wall -fno-builtin-printf -DIRX_NAME=iop_sbusdbg -c src/build-imports.c -o obj/imports.o
/tmp/cc80l5eh.s: Assembler messages:
/tmp/cc80l5eh.s:295: Erro: expected comma after symbol-name
/tmp/cc80l5eh.s:295: Aviso: rest of line ignored; first ignored character is `.'
make: ** [iop_sbusdbg.irx] Erro 1


Anyone knows a fix?
Back to top
View user's profile Send private message Visit poster's website
ragnarok2040



Joined: 09 Aug 2006
Posts: 230

PostPosted: Sat Oct 31, 2009 4:41 am    Post subject: Reply with quote

It's because the imports.lst has I_iop_dbg_get_reg_frames listed as an imported symbol which isn't prepared as an imported symbol in "iopdebug.h" using DECLARE_IMPORT. Instead the name is treated as a variable definition with no type which wrecks the import table.
Code:
static struct irx_import_table _imp_iopdebug __attribute__((section(".text\n\t#"), unused))= { magic: 0x41e00000, version: ((((1) & 0xff) << 8) + ((1) & 0xff)), name: "iopdebug", };
__asm__ (".section\t.text\n\t" ".globl\t""iop_dbg_set_handler""\n\t""iop_dbg_set_handler"":\n\t" ".word 0x3e00008\n\t" ".word ""0x24000000|8");
I_iop_dbg_get_reg_frames
__asm__ (".section\t.text\n\t.word\t0, 0");
which produces
Code:
   .comm   .section   .text
   .word   0, 0,4,4

The END_IMPORT_TABLE macro is inserted within the variable's definition, though.

Here's what it kind of should come out as. I left the symbol name blank, but the .comm directive's attributes are name,size,alignment. A single integer is 4 bytes with a 4 byte alignment.
Code:
   .comm 4,4
   .section   .text
   .word   0, 0
The last two statements are inserted by END_IMPORT_TABLE.


I'm not sure why cheriff had his original problem, though. Perhaps a whitespace problem or something specific with his code.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group