Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in staticly linked executable upgrading a protocol before main #114

Open
minusbat opened this issue Jun 28, 2019 · 3 comments
Open

Comments

@minusbat
Copy link

Just revisiting this - as am trying to get static stuff working using 1.9 ABI with the library that is supposed to support both. Haven't investigated very far yet, but am reporting the issue in case it's obvious to someone who knows the code.

Running a staticky linked executable which has a Protocol in another file. I see this:

Reading symbols from objtest...
(gdb) run
Starting program: /usr/home/pete/pfkit-build/src/pfkit/objtest

Program received signal SIGSEGV, Segmentation fault.
0x0000000000352247 in objc_upgrade_protocol_gsv1 (p=0x63c2c8 <objc_protocol>)
at /home/pete/libobjc2/legacy.c:438
438 n->instance_methods = upgrade_protocol_method_list_gcc(p->instance_methods);
(gdb) bt
#0 0x0000000000352247 in objc_upgrade_protocol_gsv1 (
p=0x63c2c8 <objc_protocol>) at /home/pete/libobjc2/legacy.c:438
#1 0x00000000003480b0 in init_protocols (
protocols=0x63d520 <objc_protocol_list>)
at /home/pete/libobjc2/protocol.c:234
#2 0x0000000000347d8d in objc_init_protocols (
protocols=0x63d520 <objc_protocol_list>)
at /home/pete/libobjc2/protocol.c:258
#3 0x00000000003478e1 in load_category (cat=0x8006bf040,
class=0x63f6c0 <._OBJC_CLASS___ObjC_Protocol_Holder_Ugly_Hack>)
at /home/pete/libobjc2/category_loader.c:37
#4 0x0000000000347638 in try_load_category (cat=0x8006bf040)
at /home/pete/libobjc2/category_loader.c:59
#5 0x0000000000347775 in objc_load_buffered_categories ()
at /home/pete/libobjc2/category_loader.c:87
#6 0x0000000000346309 in __objc_load (init=0x63faa8 <objc_init>)
at /home/pete/libobjc2/loader.c:281
#7 0x00000000003537cd in objcv2_load_function ()
#8 0x000000000033a1c9 in handle_static_init (argc=1, argv=0x7fffffffea50,
env=0x7fffffffea60) at /usr/src/lib/csu/common/ignore_init.c:127
#9 0x000000000033a0e2 in _start (ap=, cleanup=)
at /usr/src/lib/csu/amd64/crt1.c:75
(gdb)

@davidchisnall
Copy link
Member

I don't have any objections to supporting static linking, but without CI it's probably going to end up broken. If you can send a pull request that enables a statically linked configuration for the tests, I'll happily fix issues that it raises and use it to prevent regressions.

@minusbat
Copy link
Author

I'll try - you asked for this over in the full request which fixes this I think, and it's a fair point. However it hugely raises the bar for the amount of time I have to find to work on this before I can submit a pull request, and I need to go understand how to add static versions of the tests as well as fixing the issue. So far haven't managed to find the time.... will try though, I promise! :-)

@minusbat
Copy link
Author

Actually, the pull request was for the ABI versions stuff, I remember wrongly, but its still the same, I need to make the static tests work I know, which I haven't had time to do yet.

[ sorry if this sounds like a bit of a excuse, but I suddenly became a single parent of two small kids in the spring, and that's wiped out most of my free time. ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants