This is an archive of the discontinued LLVM Phabricator instance.

[llvm-profgen] Fix shared-lib builds
AbandonedPublic

Authored by nridge on Nov 22 2020, 4:55 PM.

Details

Reviewers
wlei

Diff Detail

Event Timeline

nridge created this revision.Nov 22 2020, 4:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2020, 4:55 PM
nridge requested review of this revision.Nov 22 2020, 4:55 PM
nridge added a reviewer: wlei.Nov 22 2020, 4:56 PM

Without this change, a shared-libraries build of LLVM fails for me with the error:

[1/126] Linking CXX executable bin/llvm-profgen
FAILED: bin/llvm-profgen 
: && /usr/bin/clang++-10 -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fuse-ld=gold     -Wl,-O3 -Wl,--gc-sections tools/llvm-profgen/CMakeFiles/llvm-profgen.dir/llvm-profgen.cpp.o tools/llvm-profgen/CMakeFiles/llvm-profgen.dir/PerfReader.cpp.o tools/llvm-profgen/CMakeFiles/llvm-profgen.dir/ProfiledBinary.cpp.o -o bin/llvm-profgen  -Wl,-rpath,"\$ORIGIN/../lib"  lib/libLLVMX86Desc.so.12git  lib/libLLVMX86Disassembler.so.12git  lib/libLLVMMCDisassembler.so.12git  lib/libLLVMSymbolize.so.12git  -lpthread  lib/libLLVMObject.so.12git  lib/libLLVMCore.so.12git  lib/libLLVMMC.so.12git  lib/libLLVMSupport.so.12git  -Wl,-rpath-link,llvm/prod-build/lib && :
tools/llvm-profgen/CMakeFiles/llvm-profgen.dir/llvm-profgen.cpp.o:llvm-profgen.cpp:function main: error: undefined reference to 'LLVMInitializeX86TargetInfo'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
wlei accepted this revision.Nov 22 2020, 5:06 PM
wlei added a subscriber: hoy.

Hi @nridge, Thanks for helping fix this, LGTM!

cc: @hoy

This revision is now accepted and ready to land.Nov 22 2020, 5:06 PM
wlei added a comment.Nov 22 2020, 5:26 PM

@nridge, did you try rebase to apply this https://github.com/llvm/llvm-project/commit/dcc06597b1d61d35c7246d3ab2d7a807134aaa45 ?
If AllTargetsInfos includes X86Info, then we no need this change, thanks.

nridge abandoned this revision.Nov 22 2020, 5:34 PM

You're right, the change to add AllTargetsInfos already fixed this. I will abandon this patch.