[LLVMdev] r102300 breaks Obj-C codegen on Darwin x86

Jean-Daniel Dupas devlists at shadowlab.org
Mon Apr 26 04:01:22 PDT 2010


I managed to build a reduced test case:

================== foo.m ==================

#include <Foundation/Foundation.h>

@interface BaseNode : NSObject <NSCoding, NSCopying> { }

@end

@implementation BaseNode

@end

int main(int argc, char **argv) {
	return 0;
}

==========================================

# clang -o foo -arch i386 -framework Foundation foo.m
foo.m:8:1: warning: incomplete implementation
@implementation BaseNode
^
1 warning generated.
# ./foo
Segmentation fault

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x6e697970

#0  0x913d3348 in _objc_search_builtins ()
#1  0x913d313e in __sel_registerName ()
#2  0x913d6269 in map_method_descs ()
#3  0x913d4094 in _read_images ()
#4  0x913e9933 in map_images_nolock ()
#5  0x913d30d9 in map_images ()
#6  0x8fe03ecc in __dyld__ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE ()
#7  0x8fe04359 in __dyld__ZN4dyld36registerImageStateBatchChangeHandlerE17dyld_image_statesPFPKcS0_jPK15dyld_image_infoE ()
#8  0x958d3892 in dyld_register_image_state_change_handler ()
#9  0x913d306d in _objc_init ()
#10 0x8fe0ed6d in __dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE ()
#11 0x8fe0d31e in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj ()
#12 0x8fe0d2c2 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj ()
#13 0x8fe0d2c2 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj ()
#14 0x8fe0d3d1 in __dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextE ()
#15 0x8fe024a9 in __dyld__ZN4dyld24initializeMainExecutableEv ()
#16 0x8fe07950 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#17 0x8fe018b1 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl ()
#18 0x8fe01057 in __dyld__dyld_start ()


Le 26 avr. 2010 à 10:13, Jean-Daniel Dupas a écrit :

> After commit 102300, any obj-c software compiled with clang crashes at launch time with the following stack trace.
> Reverting this specific commit fix the issue.
> 
> ------------------------------------------------------------------------------------------------
> Date/Time:       2010-04-26 10:07:01.630 +0200
> OS Version:      Mac OS X 10.6.3 (10D573)
> Report Version:  6
> 
> Interval Since Last Report:          333376 sec
> Crashes Since Last Report:           5
> Per-App Crashes Since Last Report:   1
> Anonymous UUID:                      C67EBC9D-4A73-4DA7-B067-E5006618C178
> 
> Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x0000000074696e55
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   libobjc.A.dylib               	0x913d3348 _objc_search_builtins + 299
> 1   libobjc.A.dylib               	0x913d313e __sel_registerName + 44
> 2   libobjc.A.dylib               	0x913d6269 map_method_descs + 47
> 3   libobjc.A.dylib               	0x913d4094 _read_images + 2116
> 4   libobjc.A.dylib               	0x913e9933 map_images_nolock + 1545
> 5   libobjc.A.dylib               	0x913d30d9 map_images + 72
> 6   dyld                          	0x8fe03ecc dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) + 698
> 7   dyld                          	0x8fe04359 dyld::registerImageStateBatchChangeHandler(dyld_image_states, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) + 452
> 8   libSystem.B.dylib             	0x958d3892 dyld_register_image_state_change_handler + 98
> 9   libobjc.A.dylib               	0x913d306d _objc_init + 77
> 10  dyld                          	0x8fe0ed6d ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 235
> 11  dyld                          	0x8fe0d31e ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 246
> 12  dyld                          	0x8fe0d2c2 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 154
> 13  dyld                          	0x8fe0d2c2 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 154
> 14  dyld                          	0x8fe0d2c2 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 154
> 15  dyld                          	0x8fe0d3d1 ImageLoader::runInitializers(ImageLoader::LinkContext const&) + 61
> 16  dyld                          	0x8fe024a9 dyld::initializeMainExecutable() + 134
> 17  dyld                          	0x8fe07950 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**) + 4189
> 18  dyld                          	0x8fe018b1 dyldbootstrap::start(macho_header const*, int, char const**, long) + 779
> 19  dyld                          	0x8fe01057 _dyld_start + 39
> 
> 
> 
> -- Jean-Daniel
> 
> 
> 
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-- Jean-Daniel




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100426/034c71f7/attachment.html>


More information about the llvm-dev mailing list