LLVMgold.so in windows LLVM builds

I am trying to build LLVMgold.so on windows.
I came across this piece of code which includes “gold” source directory in
tools/CMakeLists.txt

if( LLVM_ENABLE_PIC )
# TODO: support other systems:
if( (CMAKE_SYSTEM_NAME STREQUAL "Linux")
OR (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") )
add_llvm_tool_subdirectory(gold)
else()
ignore_llvm_tool_subdirectory(gold)
endif()
else()
ignore_llvm_tool_subdirectory(gold)
endif()

This basically says, I cannot build LLVMgold.so on windows.
Any specific reasons for why this is the case?

--Sumanth G

Hi,

I am trying to build LLVMgold.so on windows.
I came across this piece of code which includes “gold” source directory in
tools/CMakeLists.txt

It seems to date from the original gold import in 2011, so it's
probably just from being careful.

Disabling the check is worth a try, though I think even the binutils
Windows linkers use something other than Linux's ELF. Theoretically,
it has a reasonable chance of working anyway, but you never know
whether we've smuggled something platform-specific in there.

Remember to also specify LLVM_BINUTILS_INCDIR! Took me ages to work
out why gold suddenly stopped being built last time.

Cheers.

Tim.

I tried building it on windows with some CMake changes.
But unfortunatelym my clang crashes when it tries to access the LLVMgold
(not able to open it).

I have CCed Rafeal and Nakamura who might know why gold plugin in not
supported on Windows platforms.

--Sumanth G

Resending with fixed email addresses…

Gold is elf only but BFD ld supports the same plugins these days.

I have no idea if the plugin infrastructure works on windows or not, but it could be made to work since all it needs is to find a single symbol in the plugin.

Cheers,
Rafael

CCed Ian Lance Taylor

Why is clang loading LLVMgold.dll? I thought it's supposed to be loaded
by gold.

I framed the words badly here.

I don't think gold even produces COFF. Are you trying to produce ELF on
Windows?

Yes, I am trying to produce ELF on Windows.

Gold is elf only but BFD ld supports the same plugins these days.

I have no idea if the plugin infrastructure works on windows or not, but
it could be made to work since all it needs is to find a single symbol in
the plugin.

My sources are outdated. I will update and give a try.
Rafael, May I know what is the symbol ? Do I need to modify the symbol
name for windows ?

I was able to build LLVMgold.dll on windows.
I was to able to compile and link a simple hello world program on windows.
To clarify, the executable was generated to run on linux.
However, I am seeing a run time crash.
Note: My windows sysroot has gold linker as the default linker. I compile
the executable for arm (cortex-a9)

--Sumanth G