Open Bug 925093 Opened 11 years ago Updated 2 years ago

use dlopen, dlsym, and dlclose on OS X instead of old, deprecated functions (NSAddImage etc.)

Categories

(Core :: XPCOM, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: jaas, Unassigned)

Details

Attachments

(1 file)

xpcom/glue/standalone/nsXPCOMGlue.cpp:130:31 [-Wdeprecated-declarations] 'NSAddImage' is deprecated: first deprecated in OS X 10.5
xpcom/glue/standalone/nsXPCOMGlue.cpp:138:9 [-Wdeprecated-declarations] 'NSLinkEditError' is deprecated: first deprecated in OS X 10.5
xpcom/glue/standalone/nsXPCOMGlue.cpp:156:15 [-Wdeprecated-declarations] 'NSLookupSymbolInImage' is deprecated: first deprecated in OS X 10.5
xpcom/glue/standalone/nsXPCOMGlue.cpp:160:13 [-Wdeprecated-declarations] 'NSIsSymbolNameDefined' is deprecated: first deprecated in OS X 10.4
xpcom/glue/standalone/nsXPCOMGlue.cpp:161:19 [-Wdeprecated-declarations] 'NSLookupAndBindSymbol' is deprecated: first deprecated in OS X 10.4
xpcom/glue/standalone/nsXPCOMGlue.cpp:166:24 [-Wdeprecated-declarations] 'NSAddressOfSymbol' is deprecated: first deprecated in OS X 10.5
Assignee: smichaud → joshmoz
Attached patch Fix v1.0Splinter Review
OS X didn't support functions like dlopen, dlsym, and dlclose before OS X 10.3. In 10.3 they were added in a compat mode, in 10.4 they were rewritten to be a native part of dyld.

Now we can just use them, same as Linux, and stop using the old deprecated functions.
Attachment #817652 - Flags: review?(benjamin)
Summary: stop using deprecated OS X symbol/binary functions in nsXPCOMGlue.cpp → use dlopen, dlsym, and dlclose on OS X instead of old, deprecated functions
Try failed on 10.7:

https://tbpl.mozilla.org/?tree=Try&rev=7aea0c552457

No "__ptr_t" type available. I think I just need to ifdef out that code on OS X rather than define __ptr_t, testing a patch now.
Discussion with josh today on IRC: one of the weird things about mac was install names. The NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME flag was necessary so that things that load XPCOM from "strange" locations (not Firefox.app/Contents/MacOS) pick up dependent libraries correctly: we load each dependent library explicitly (from dependentlibs.list) and then we assume that dependencies like @executable_path/libxpcom.dylib will resolve even when binary_path is wrong.

Note that there is a bunch of historical context which may no longer apply: we could switch from using @executable_path to @loader_path, which might make most of this problem go away: bug 578692/bug578751. It's also possible that dlopen now applies the FILENAME_BY_INSTALLNAME logic by default (I'm certain that it didn't in MacOS 10.3).

Unfortauntely I don't think any of this is currently covered by automated testing, although the webapprt stuff is the best place to look.
Attachment #817652 - Flags: review?(benjamin)
Assignee: joshmoz → nobody
Summary: use dlopen, dlsym, and dlclose on OS X instead of old, deprecated functions → use dlopen, dlsym, and dlclose on OS X instead of old, deprecated functions (NSAddImage etc.)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: