Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
signal and dyld
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

signal and dyld



Hi,

I have an app, built with Xcode, which includes iostream and attempts to
register a signal handler. This combination appears to prevent launching
on 10.2.x, and I'm trying to find a workaround.

I'm using Xcode 1.5, gcc 3.3, with MACOSX_DEPLOYMENT_TARGET set to 10.2
and dead-stripping turned on.

With this combination, iostream ends up leaving several references to
wchar_t functions (e.g., towupper) in the final binary. Even though I
never call these functions, enabling dead-stripping does not remove
them.


When I include a call to signal() to install my handler, I halt with:

 #0   0x8fe01220 in halt
 #1   0x8fe10654 in link_in_need_modules
 #2   0x8fe129c4 in _dyld_bind_fully_image_containing_address
 #3   0x900052b4 in _dyld_bind_fully_image_containing_address
 #4   0x9000520c in sigaction__
 #5   0x9000f220 in signal__
 #6   0x00008b30 in main

I also get some undefined references to the console:

    undefined reference to _towupper expected to be defined in
                                    /usr/lib/libSystem.B.dylib

If I remove the call to signal(), the app launches normally and no
warnings about undefined references are emitted.


The problem is presumably this "bind fully" step, where these unresolved
symbols are looked up and not found.

sigaction__ takes a flag indicating if it should perform this step or
not (for my purposes, it would be ideal if it didn't; the signal handler
I'm trying to install will always be there), but I can't see a public
API to install a handler that allows control over this.

The closest option seems to be _sigvec_nobind, but as this seems to be a
private API I'd rather not use it unless I have to.


If I have to assume that dead-stripping isn't going to remove
everything, is there a solution to this that would allow an app which
references (but never calls) missing functions to install a signal
handler?

Either some way to install a signal handler which doesn't fully bind the
image, or some way to link the app that will cause this binding step to
accept that they're missing in the same way they're accepted when the
app is bound when launched without a signal handler?


dair
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.