WebAssembly / lld

Staging repository for upstreaming WebAssembly support into lld
Other
10 stars 10 forks source link

Current LLD won't build #13

Closed sheetrock2908374 closed 6 years ago

sheetrock2908374 commented 7 years ago

I have a .wasm object file that I built from C++ using clang, et all. I want a linker that can partially link with a full list of missing symbols, etc. The wasm-link doesn't work for me because of inability to deal with memory blocks as well as globals. So I tried to use this linker and had bad results, not even getting past the build stage.

Using the procedure defined in http://llvm.org/docs/GettingStarted.html, I svn-checked out llvm in "llvm/" and clang in "llvm/tools/clang". Then, I git cloned this lld repo to "llvm/tools/lld". Then I created llvm/../build, changed to the build directory and invoked cmake as

"cmake -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DLLVM_TARGETS_TO_BUILD= -G "Unix Makefiles" ../llvm" and then invoked "make -j8" in the build directory. This failed to build with the following error (I reinvoked "make" without -j8 to get coherent output):

Building CXX object tools/lld/lib/ReaderWriter/MachO/CMakeFiles/lldMachO.dir/MachONormalizedFileBinaryWriter.cpp.o /home/sb094h/carrieriq/wabt-tools/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp: In member function ‘llvm::Error lld::mach_o::normalized::MachOFileLayout::writeBinary(llvm::StringRef)’: /home/sb094h/carrieriq/wabt-tools/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp:1527:37: error: conversion from ‘llvm::Expected<std::unique_ptr >’ to non-scalar type ‘llvm::ErrorOr<std::unique_ptr >’ requested llvm::FileOutputBuffer::create(path, size(), flags); ^ tools/lld/lib/ReaderWriter/MachO/CMakeFiles/lldMachO.dir/build.make:302: recipe for target 'tools/lld/lib/ReaderWriter/MachO/CMakeFiles/lldMachO.dir/MachONormalizedFileBinaryWriter.cpp.o' failed make[2]: [tools/lld/lib/ReaderWriter/MachO/CMakeFiles/lldMachO.dir/MachONormalizedFileBinaryWriter.cpp.o] Error 1 CMakeFiles/Makefile2:52145: recipe for target 'tools/lld/lib/ReaderWriter/MachO/CMakeFiles/lldMachO.dir/all' failed make[1]: [tools/lld/lib/ReaderWriter/MachO/CMakeFiles/lldMachO.dir/all] Error 2 Makefile:149: recipe for target 'all' failed make: *** [all] Error 2

I downloaded and checked out the vanilla lld from the clang website referenced above and compared it with this lld repo and found many differences.

Is this an old version of lld? Is it possible to do what I want to do (which is a simple link)? Did I do everything right in the procedures I followed above? Thanks in advance.

sheetrock2908374 commented 6 years ago

builds now.. thanks for all your work. Closing this now.