After clone swift llvm and swift-clang project inside llvm/tools, I compile llvm successfully as normal procedure with cmake as it is explained on https://llvm.org/.
I have generated a compiler plugin for xcode based on the clang result of compilation and everything works fine, but when we generate an archive on normal application it crashes with the error: "ld: loaded libLTO doesn't support -bitcode_hide_symbols", I could avoid this error changing the lto binary with the one present on my system, in this way I was able to generate a successful archive until I tried to export the binary where organizer throws the following error: "Failed to verify bitcode in Demo.app/Demo:
error: Clang option verification failed for bitcode 1 (unrecognized arguments: -fembed-bitcode=all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -faligned-alloc-unavailable -target-cpu generic -target-feature +soft-float-abi -target-linker-version 351.8 -dwarf-column-info -dwarf-ext-refs -fmodule-format=obj -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -coverage-notes-file /Users/XXXX/Library/Developer/Xcode/DerivedData/swift-fivsvzgrprwjnibeebrzwlcxsnnu/Build/Intermediates.noindex/ArchiveIntermediates/Demo/IntermediateBuildFilesPath/swift.build/Release-iphoneos/Demo.build/Objects-normal/armv7/main.gcno -resource-dir /Users/XXXX/workspace/swift-mirror/build/llvm-swift/Release/lib/clang/5.0.2 -std=gnu++11 -fdebug-compilation-dir /Users/XXXX/workspace/demo/workspace/xcode -ferror-limit 19 -fmacro-backtrace-limit 0 -fmessage-length 0 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 1 -fallow-half-arguments-and-returns -fblocks -fmodules -fimplicit-module-maps -fmodules-cache-path=/Users/XXXX/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-timestamp=1538750472000000000 -fmodules-validate-once-per-build-session -fobjc-runtime=ios-9.3.0 -fencode-extended-block-signature -fsjlj-exceptions -fpascal-strings -fmax-type-align=16 -fno-common -fdiagnostics-show-option -fdiagnostics-show-note-include-stack -vectorize-loops -vectorize-slp)"