News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

LLVM lld-link

Started by fearless, August 02, 2019, 04:32:41 AM

Previous topic - Next topic

fearless

I downloaded the LLVM binaries and source to have a look at the linker: lld-link.exe.

Seems to work mostly out of the box. Only thing i had to change was to remove a /RELEASE option. From looking at the license as far as I can see, it would be fine to redistribute lld-link.exe. So could add it as a linker to accompany an Asm x64 SDK, either UASM or MASM.

I couldn't get the cmake files to build the visual studio solution for the LLD - only managed the LLVM part. Some issue with LLVMSupport.cmake not being detected, even though I had specified the appropriate include, source and other folders. Perhaps someone else will get further with this. The size of the binary is large (approx 40+mb for the v8 llvm, 64MB for the v9 llvm snapshot), so I was hoping to look at the visual studio project and build it as a minimal release at least, or take out debugging info or other stuff that might be in it by default, to reduce the size of the binary.

Anyhow, could be worth looking at as a potential additional to an SDK

KradMoonRa

Hi, the llvm release build has the same thing has build a cross compiler tool, must for windows can use shared build, but some linux cross libs dons't likes shared thing, so most of modules are static linked, for coexistent cross compiler capability's.

fix for Z3 lib cmake mudule in llvm\cmake\modules\FindZ3.cmake

Changed this:

# If the dynamic check fails, we might be cross compiling: if that's the case,
# check the version in the headers, otherwise, fail with a message
if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND
                              Z3_INCLUDE_DIR AND
                              EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
  # TODO: print message warning that we couldn't find a compatible lib?


To this:

# If the dynamic check fails, we might be cross compiling: if that's the case,
# check the version in the headers, otherwise, fail with a message
if(NOT Z3_VERSION_STRING AND (Z3_INCLUDE_DIR AND
                              EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
  # TODO: print message warning that we couldn't find a compatible lib?


Before using cmake gui we need to directly apply LLVM build config with command.
In a empty build dir: example D:\llvm_msvc_build. Open command prompt and do:

cmake -G "Visual Studio 16 2019" -A x64 -T host=x64 D:/Repos/llvm/llvm -D PYTHON_HOME=C:/Python37 -D LLVM_ENABLE_PROJECTS=llvm;clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;lld;lldb;openmp;parallel-libs;polly;debuginfo-tests

Attached my trending secrets, for try and fail for optimal LLVM build release on windows with cmake & MVSC. Obviously tried to build LLVM with LLVM and most off the modules fails compiling.

All the path's folder's etc. Change-it to your things.

Use cmake gui to config the remaining modules before open compiler solution.

Try one off the build targets for minimal release.

TIP: Can use the depends to check for lld-link dependencies.
http://www.dependencywalker.com/

Good luck....
The uasmlib

fearless

Thanks.

I managed to go back and look over my cmake-gui settings, and redid them to include the llvm-lld and a build option for that as well, that I missed earlier.

Only managed to compile it down to 33.6mb, and haven't found a way of just building it with the COFF linker only, which I think would bring it down to a lot smaller size. Doesn't appear to have any defines that will include/exclude the ELF/WASM/MACHO/GNU linkers that I can see.

I had previously downloaded the z3 binary release from github and put it into a z3 folder and pointed the cmake options to the correct include and lib