EXC_BAD_ACCESS on iOS simulator at app launch

I compiled clang, llvm and swift static libraries for iOS.

I created default single-page view ios swift project, added
frontend_main.cpp and an objective c wrapper with a single method that
calls frontend_main. I added the bridge header and when run on iOS
simulator i got EXC_BAD_ACCESS.

I have not even called any methods of the libraries yet.

The control never reached the AppDelegate.

below is the* backtrace*:

* thread #1: tid = 0xc25cb, 0x0d1ffddb
libsystem_pthread.dylib`_pthread_rwlock_check_init + 11, queue =
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)

  * frame #0: 0x0d1ffddb libsystem_pthread.dylib`_pthread_rwlock_check_init
+ 11

    frame #1: 0x0d1ffaf0 libsystem_pthread.dylib`_pthread_rwlock_lock + 25

    frame #2: 0x0d204fcc
libsystem_pthread.dylib`pthread_rwlock_wrlock$UNIX2003 + 23

    frame #3: 0x1210ef13
libLLVMContainer.dylib`llvm::sys::RWMutexImpl::writer_acquire() + 19

    frame #4: 0x12069b12
libLLVMContainer.dylib`llvm::PassRegistry::addRegistrationListener(llvm::PassRegistrationListener*)
+ 34

    frame #5: 0x1206567e
libLLVMContainer.dylib`llvm::PassNameParser::PassNameParser() + 78

    frame #6: 0x1205cad3
libLLVMContainer.dylib`_GLOBAL__sub_I_LegacyPassManager.cpp + 1299

    frame #7: 0x0991b20f

    frame #8: 0x0991b368

    frame #9: 0x09916a01

    frame #10: 0x09916994

    frame #11: 0x09916994

    frame #12: 0x09916994

    frame #13: 0x09916994

    frame #14: 0x09916994

    frame #15: 0x09916994

    frame #16: 0x09916994

    frame #17: 0x09916994

    frame #18: 0x09915d54

    frame #19: 0x09915de3

    frame #20: 0x0990bc50

    frame #21: 0x0990f2c7

    frame #22: 0x0990b1f9

    frame #23: 0x8fe61118 dyld`dyld::useSimulatorDyld(int, macho_header
const*, char const*, int, char const**, char const**, char const**,
unsigned long*) + 1053

    frame #24: 0x8fe601f2 dyld`dyld::_main(macho_header const*, unsigned
long, int, char const**, char const**, char const**, unsigned long*) + 202

    frame #25: 0x8fe5c232 dyld`dyldbootstrap::start(macho_header const*,
int, char const**, long, macho_header const*, unsigned long*) + 428

    frame #26: 0x8fe5c047 dyld`_dyld_start + 71

(lldb)

Does anyone have any idea what gone wrong.

Thanks

Ramakrishna