Page MenuHomePhabricator

[llvm-shlib] Do not use version script when building with MinGW
ClosedPublic

Authored by pirama on Mon, Jun 24, 3:53 PM.

Details

Summary

The MinGW driver for lld does not support the --version-script option.
For GNU ld, it's a no-op since LLVM.dll exports all symbols.

Diff Detail

Repository
rL LLVM

Event Timeline

pirama created this revision.Mon, Jun 24, 3:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptMon, Jun 24, 3:53 PM

I'd suggest skipping the lld condition, the version script adds no value here.

For ELF, version scripts do two things, select what symbols to export using glob pattetns, and set symbol versions on them.

As COFF doesn't have symbol versions, all it does on mingw with GNU ld, is filtering symbols, to export *. So it adds no value there.

(I don't remember if cmake even knows the linker is lld in my mingw setups.)

I'd suggest skipping the lld condition, the version script adds no value here.

For ELF, version scripts do two things, select what symbols to export using glob pattetns, and set symbol versions on them.

As COFF doesn't have symbol versions, all it does on mingw with GNU ld, is filtering symbols, to export *. So it adds no value there.

I thought so - that -version-script is not needed for Windows but wanted to leave it just in case GNU ld did something with it. I'll skip this option altogether for MinGW unless someone suggests otherwise.

(I don't remember if cmake even knows the linker is lld in my mingw setups.)

It does know - LINKER_IS_LLD_LINK is set at the top of llvm/cmake/modules/HandleLLVMOptions.cmake.

pirama updated this revision to Diff 206486.Tue, Jun 25, 10:59 AM

Skip version script for all MinGW builds, not just when using lld.

pirama retitled this revision from [llvm-shlib] Do not use version script when building with MinGW and LLD to [llvm-shlib] Do not use version script when building with MinGW.Tue, Jun 25, 11:00 AM
pirama edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Tue, Jun 25, 11:31 AM
This revision was automatically updated to reflect the committed changes.