[LLVMbugs] [Bug 14119] New: [Objective-C] Unrecognized selector when using categories in static libraries
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Oct 18 05:49:27 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=14119
Bug #: 14119
Summary: [Objective-C] Unrecognized selector when using
categories in static libraries
Product: clang
Version: trunk
Platform: PC
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: badea at adobe.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 9380
--> http://llvm.org/bugs/attachment.cgi?id=9380
Small setup to reproduce the bug.
Symbols added through the use of Objective-C categories inside static libraries
are not properly linked. This only happens on 64-bit builds.
Steps to reproduce:
1. Compile an objective-c source containing ONLY category methods.
2. Link the object file into a static library.
3. Link an executable/dylib against the static library.
What should happen:
The final binary should contain the category methods from the static library.
What actually happens:
Category methods from the static library are not linked in the final binary.
Running the executable yields unrecognized selector errors.
Possible workarounds:
A possible fix for this is to use force-load when linking the static library.
Another fix is to include a dummy class implementation in the source file
containing the category.
Tested with:
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Apple clang version 1.7 (tags/Apple/clang-77) (based on LLVM 2.9svn)
clang svn trunk
Note: on older clang versions -force_load does not fix the problem either.
Also happens in gcc: i686-apple-darwin10-gcc-4.2.1
I've attached a small test project that reproduces the bug.
Build with: "make";
USE_CHUCKNORRIS=1 make; -> this will include a dummy class inside the category
source file, fixing the bug.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list