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 

ld crashes while linking libcairo

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



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Oct 08, 2005 8:19 am    Post subject: ld crashes while linking libcairo Reply with quote

I've started to port the graphics lib cairo to PSP, but the linker crashs and I don't know how to fix it. This is the current version:

http://www.frank-buss.de/tmp/cairo.zip

To compile it:

Code:

cd cairo
cd pixman/src/
make -f Makefile.psp
cd ../../src
make -f Makefile.psp
cd ../sample
make


Then I get this crash:

Code:

...
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
make: *** [cairotest.elf] Error 1

$ less ld.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=0046E76B
eax=00000000 ebx=004C5F20 ecx=004BD062 edx=006A92D0 esi=006A5FA8 edi=006E6168
ebp=0022E828 esp=0022E7D0 program=C:\cygwin\usr\local\pspdev\psp\bin\ld.exe, pid 1240, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
0022E828  0046E76B  (004C5F20, 006E6168, 00000001, 00000000)
0022E888  0046E9D8  (004C5F20, 006AEF78, 00000000, 00000000)
0022E928  0046F2D0  (006DB478, 004C5F20, 006FD3E0, 006FBF68)
0022EB38  00433333  (006DB478, 004C5F20, 006CF0AA, 00000000)
0022ED48  00432B7D  (006BBE28, 004C5F20, 0022ED78, 00416BEA)
0022ED88  00409624  (0022EDA0, 00000000, 0022EDB8, 00421794)
0022EDB8  0040A02D  (00409BE0, 00000000, 00693328, 00693328)
0022EE68  0040F345  (00693368, 0049B4EC, 0049B4D2, 00411359)
0022EF18  004119C5  (00000021, 611556B0, 00690090, 7C929AF0)
0022EFD8  61004DD2  (0022EFF0, 77E500E8, 0022EFD8, 77E50000)
0022FF88  6100594F  (00000000, 00000000, 00000000, 00000000)
End of stack trace
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sat Oct 08, 2005 1:45 pm    Post subject: Reply with quote

Do you get the same crash under Linux?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sat Oct 08, 2005 5:30 pm    Post subject: Reply with quote

It does for me. After following his instructions and having the build fail, you can reproduce it with just main.o and libcairo:
Code:

neurosis:~/tmp/cairo/sample$ gdb `which psp-ld`
GNU gdb 6.3-debian
(gdb) set args -L../src main.o -lcairo
(gdb) r
Starting program: /usr/local/pspdev/bin/psp-ld -L../src main.o -lcairo

Program received signal SIGSEGV, Segmentation fault.
_bfd_mips_elf_hide_symbol (info=0x8103980, entry=0x815e650, force_local=1) at ../../bfd/elfxx-mips.c:8373
8373    ../../bfd/elfxx-mips.c: No such file or directory.
        in ../../bfd/elfxx-mips.c
(gdb) bt
#0  _bfd_mips_elf_hide_symbol (info=0x8103980, entry=0x815e650, force_local=1) at ../../bfd/elfxx-mips.c:8373
#1  0x0808b748 in mips_elf_record_global_got_symbol (h=0x815e650, abfd=0x812fd80, info=0x8103980, g=0x0, tls_flag=0 '\0')
    at ../../bfd/elfxx-mips.c:2635
#2  0x0808befe in _bfd_mips_elf_check_relocs (abfd=0x812fd80, info=0x8103980, sec=0x816e04c, relocs=0x8173a44)
    at ../../bfd/elfxx-mips.c:6151
#3  0x080a5153 in bfd_elf_link_add_symbols (abfd=0x812f798, info=0x8103980) at ../../bfd/elflink.c:4382
#4  0x080a35a4 in elf_link_add_archive_symbols (abfd=0x812f798, info=0x8103980) at ../../bfd/elflink.c:4650
#5  0x080a3bcb in bfd_elf_link_add_symbols (abfd=Variable "abfd" is not available.
) at ../../bfd/elflink.c:4706
#6  0x0805111e in load_symbols (entry=0x811976c, place=0xbfdc55c4) at ../../ld/ldlang.c:1869
#7  0x080575bf in open_input_bfds (s=0x811976c, force=0) at ../../ld/ldlang.c:2279
#8  0x08057788 in lang_process () at ../../ld/ldlang.c:4743
#9  0x08059bec in main (argc=4, argv=0xbfdc5794) at ../../ld/ldmain.c:458
(gdb)

Sorry, no time to look into it further at the moment.
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Oct 08, 2005 6:30 pm    Post subject: Reply with quote

mrbrown wrote:
Do you get the same crash under Linux?


Yes. As jimparis wrote, the crash is in binutils-psp/bfd/elfxx-mips.c:

Code:

void
_bfd_mips_elf_hide_symbol (struct bfd_link_info *info,
                           struct elf_link_hash_entry *entry,
                           bfd_boolean force_local)
{
  bfd *dynobj;
  asection *got;
  struct mips_got_info *g;
  struct mips_elf_link_hash_entry *h;

  h = (struct mips_elf_link_hash_entry *) entry;
  if (h->forced_local)
    return;
  h->forced_local = force_local;

  dynobj = elf_hash_table (info)->dynobj;
  if (dynobj != NULL && force_local && h->root.type != STT_TLS)
    {
      got = mips_elf_got_section (dynobj, FALSE);
      g = mips_elf_section_data (got)->u.got_info;   --- crash line
...


"got" is 0. Maybe you know better how to debug it, because you added it to SVN :-)
Back to top
View user's profile Send private message
chinaet



Joined: 08 May 2005
Posts: 7

PostPosted: Sun Oct 09, 2005 4:14 am    Post subject: Reply with quote

[DELETED]

Last edited by chinaet on Tue Oct 11, 2005 1:06 am; edited 1 time in total
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Oct 10, 2005 4:14 am    Post subject: Reply with quote

chinaet wrote:
I am SUCCESS to build the sources in MAC OSX.no any crash.


So the example is working, too? I didn't know that I'm so good that there are no missing external references and the like :-) Which version of the PSPSDK toolchain did you use?

Please add a loop around the drawing function (perhaps 100 times) and measure how long it needs to execute it, to check if it is worth to invest some more time in it.
Back to top
View user's profile Send private message
chinaet



Joined: 08 May 2005
Posts: 7

PostPosted: Tue Oct 11, 2005 1:05 am    Post subject: Reply with quote

Sorry for my mistake.
I am JUST successful to compile the pixman and cairo library.
but got a error to compile the samples
Code:

collect2: ld terminated with signal 10 [Bus error]


In linux box, the error messages is signal 11.

i try binutil 2.16.1 (with psp-patch) , but i got same error message.
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Wed Nov 02, 2005 12:52 am    Post subject: Reply with quote

I've added a check for NULL to the linker, now it says "undefined reference to `cairo_ft_scaled_font_backend'" instead of crashings and I can continue to port Cairo.
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 -> PSP 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