[cfe-dev] clang and -integrated-as

Jean-Daniel Dupas devlists at shadowlab.org
Sat Apr 17 16:08:14 PDT 2010


Le 17 avr. 2010 à 21:49, Jean-Daniel Dupas a écrit :

> 
> Le 17 avr. 2010 à 21:08, Jean-Daniel Dupas a écrit :
> 
>> 
>> Le 17 avr. 2010 à 20:29, Chris Lattner a écrit :
>> 
>>> 
>>> On Apr 17, 2010, at 5:18 AM, Jean-Daniel Dupas wrote:
>>> 
>>>> Hello,
>>>> 
>>>> After the post about LLVM-MC, I tried to play with the "-integrated-as" flag. 
>>>> Unfortunately, it does not works for a simple case which is an obj-c file with a class and a category to extend this class (on i386).
>>> 
>>> It was a known issue, we just didn't get around to addressing it.  Fixed in r101660, thanks for nudging us!
>> 
>> Thanks for the quick fix :-)
> 
> Unfortunately, it does not works as expected. It uncovers an other blocking bug :-(
> The assembler generates an undefined symbol instead of generating an absolute symbol for classes, and so, in my test project, it now fails at linking time.
> 
> =================
> @interface Foo { void *isa; }
> @end
> @implementation Foo
> @end
> =================
> 
> % clang -arch i386 -c test.m 
> % nm -m test.o
> 00000000 (absolute) external .objc_class_name_Foo
> 
> % clang -arch i386 -c test.m -integrated-as
> % nm -m test.o 
>          (undefined) external .objc_class_name_Foo

Look like this is due to the FIXME at line 198 in MCMachOSteamer.cpp ( FIXME: Set associated section. ).
This functions does not mark the symbol as absolute (by setting its section to absolute pseudo section), and so it is interpreted as undefined symbol by the MachOWriter.
Unfortunately, I don't known assembly and object generation enough to fix this.


-- Jean-Daniel








More information about the cfe-dev mailing list