Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Dynamic linking: undefined references when linking libLTO.so #36564

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR37591
Status NEW
Importance P normal
Reported by Brian Vandenberg (phantall@gmail.com)
Reported on 2018-05-25 13:43:25 -0700
Last modified on 2018-05-25 13:48:44 -0700
Version 6.0
Hardware Sun Solaris
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
I'm building on Solaris 10 / sparcv9, though I suspect this isn't solaris or
sparc specific.

I built with the following:

    cmake ../src/llvm \
    -DCMAKE_C_COMPILER=gcc-7.2.0 \
    -DCMAKE_CXX_COMPILER=g++-7.2.0 \
    -DGCC_INSTALL_PREFIX=$(dirname $(dirname $(which gcc-7.2.0))) \
    -DBUILD_SHARED_LIBS=ON \
    -DLINK_LLVM_DYLIB=ON \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo

    make -j32

I'll explain why I built using those options in a separate comment.

When linking libLTO.so it fails with undefined references to the following:

    LLVMDisasmDispose
    LLVMCreateDisasmCPU
    LLVMCreateDisasm
    LLVMDisasmInstruction
    LLVMSetDisasmOptions

If I remove those entries from tools/lto/lto.exports then it links fine.
Quuxplusone commented 6 years ago
I built with

    BUILD_SHARED_LIBS=ON
    LINK_LLVM_DYLIB=ON

... because there are issues with global object initialization on
sparc/solaris.  Without those options clang-tblgen and llvm-tbglen both crash
while executing global constructors for command-line argument parsing.