Bug 39817 - objc_msg_sendv crashes on AMD64
Summary: objc_msg_sendv crashes on AMD64
Status: RESOLVED DUPLICATE of bug 36610
Alias: None
Product: gcc
Classification: Unclassified
Component: libobjc (show other bugs)
Version: 4.3.2
: P3 blocker
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2009-04-19 15:40 UTC by js-gcc
Modified: 2009-04-19 15:52 UTC (History)
7 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description js-gcc 2009-04-19 15:40:20 UTC
On AMD64, using objc_msg_sendv leads to a segfault. This is because libobjc uses __builtin_return in objc_msg_sendv, which is broken on AMD64. I'm not sure whether I should create another bug that it's broken on AMD64 or if I should just report it as a bug in libobjc.

The workaround would be to use libffi in objc_msg_sendv.

This bug renders libobjc pretty useless on AMD64, because forwarding is used a lot in objc and each time you forward something, it just crashes. This is the reason why I chose blocker as severity, it makes libobjc completely useless on AMD64. And I'm pretty sure this affects other architectures as well.

The backtrace is:
#0  0x0000000000600c30 in _OBJC_SELECTOR_TABLE ()
#1  0x0000000000000000 in ?? ()

If you change objc_msg_sendv to not use __builtin_return but instead return for example NULL, it works (though of course the return value is wrong).

I really recommend getting this fixed for the next 4.3 release. Objc support is unusable as it is on AMD64 atm.

I'm confused that none of the GNustep guys reported this before, but I remember that they're using libffi somewhere, so most likely they'll use it here as well.
Comment 1 Andrew Pinski 2009-04-19 15:52:19 UTC
>I really recommend getting this fixed for the next 4.3 release.
Considering this has always been broken since the first release of libobjc which supported a target that passed via registers (aka have always been broken since the first release :) ), this is not going to be fixed until at least 4.5 now since 4.3 and 4.4 are both in regression only mode (aka release mode).

*** This bug has been marked as a duplicate of 36610 ***