Jeffrey Yasskin
2010-May-04 00:07 UTC
[LLVMdev] Is the option --enable-shared discontinued in 2.7?
On Thu, Apr 29, 2010 at 6:31 PM, Jeffrey Yasskin <jyasskin at google.com> wrote:> On Wed, Apr 28, 2010 at 10:48 AM, Yuri <yuri at tsoft.com> wrote: >> Jeffrey Yasskin wrote: >>> >>> We currently use two different techniques to get whole libraries >>> included into the .so. On Linux (gnu ld and gold), we pass >>> --whole-archive, while on OSX we pass -all_load. Which ld does FreeBSD >>> use? If you can rearrange tools/llvm-shlib/Makefile until it works for >>> you and send us a patch, we can probably get it working for llvm-2.8. >>> >> >> >> ld on FreeBSD is from binutils. It takes --whole-archive option. > > Would you try the patch at > http://codereview.appspot.com/download/issue968046_1.diff? It should > make the BSDs fall into the same path as Linux, and since you use gnu > ld, that should work for you.Ping?
Jeffrey Yasskin wrote:>> Would you try the patch at >> http://codereview.appspot.com/download/issue968046_1.diff? It should >> make the BSDs fall into the same path as Linux, and since you use gnu >> ld, that should work for you. >> > > Ping? >Sorry for the delay. Here is what I am getting after applying the patch: gmake[2]: Leaving directory `/tmp/llvm-build/2.7/llvm-objects/lib/CodeGen' gmake[1]: Leaving directory `/tmp/llvm-build/2.7/llvm-objects/lib' gmake[1]: Entering directory `/tmp/llvm-build/2.7/llvm-objects/tools/llvm-shlib' llvm[1]: Linking Release Shared Library LLVM-2.7.so /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0x135): In function `(anonymous namespace)::ARMAsmParser::ParseDirective(llvm::AsmToken)': : undefined reference to `__assert' /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0x3e3): In function `(anonymous namespace)::ARMAsmParser::ParseDirective(llvm::AsmToken)': : undefined reference to `__assert' /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0x5d8): In function `(anonymous namespace)::ARMAsmParser::ParseDirective(llvm::AsmToken)': : undefined reference to `__assert' /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0xd10): In function `(anonymous namespace)::ARMAsmParser::MatchRegisterName(llvm::StringRef const&)': : undefined reference to `memcmp' /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0xd45): In function `(anonymous namespace)::ARMAsmParser::MatchRegisterName(llvm::StringRef const&)': : undefined reference to `memcmp' /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0xd6d): In function `(anonymous namespace)::ARMAsmParser::MatchRegisterName(llvm::StringRef const&)': : undefined reference to `memcmp' /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0xdd5): In function `(anonymous namespace)::ARMAsmParser::MaybeParseRegister((anonymous namespace)::ARMOperand&, bool)': : undefined reference to `__assert' Linking command line was: /usr/local/gcc/4.5.0/bin/g++ -I/tmp/llvm-build/2.7/llvm-objects/include -I/tmp/llvm-build/2.7/llvm-objects/tools/llvm-shlib -I/tmp/llvm-build/2.7/llvm/include -I/tmp/llvm-build/2.7/llvm/tools/llvm-shlib -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O2 -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -O2 -Wl,-R -Wl,/tmp/llvm-build/2.7/llvm-objects/Release/lib -L/tmp/llvm-build/2.7/llvm-objects/Release/lib -L/tmp/llvm-build/2.7/llvm-objects/Release/lib -shared -o /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVM-2.7.so -Wl,--whole-archive -lLLVMARMAsmParser -lLLVMARMAsmPrinter -lLLVMARMCodeGen -lLLVMARMInfo -lLLVMAlphaAsmPrinter -lLLVMAlphaCodeGen -lLLVMAlphaInfo -lLLVMAnalysis -lLLVMArchive -lLLVMAsmParser -lLLVMAsmPrinter -lLLVMBitReader -lLLVMBitWriter -lLLVMBlackfinAsmPrinter -lLLVMBlackfinCodeGen -lLLVMBlackfinInfo -lLLVMCBackend -lLLVMCBackendInfo -lLLVMCellSPUAsmPrinter -lLLVMCellSPUCodeGen -lLLVMCellSPUInfo -lLLVMCodeGen -lLLVMCore -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMExecutionEngine -lLLVMInstCombine -lLLVMInstrumentation -lLLVMInterpreter -lLLVMJIT -lLLVMLinker -lLLVMMBlazeAsmPrinter -lLLVMMBlazeCodeGen -lLLVMMBlazeInfo -lLLVMMC -lLLVMMCParser -lLLVMMSIL -lLLVMMSILInfo -lLLVMMSP430AsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Info -lLLVMMipsAsmPrinter -lLLVMMipsCodeGen -lLLVMMipsInfo -lLLVMPIC16AsmPrinter -lLLVMPIC16CodeGen -lLLVMPIC16Info -lLLVMPowerPCAsmPrinter -lLLVMPowerPCCodeGen -lLLVMPowerPCInfo -lLLVMScalarOpts -lLLVMSelectionDAG -lLLVMSparcAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcInfo -lLLVMSupport -lLLVMSystem -lLLVMSystemZAsmPrinter -lLLVMSystemZCodeGen -lLLVMSystemZInfo -lLLVMTarget -lLLVMTransformUtils -lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMX86Disassembler -lLLVMX86Info -lLLVMXCoreAsmPrinter -lLLVMXCoreCodeGen -lLLVMXCoreInfo -lLLVMipa -lLLVMipo -lLLVMpic16passes -Wl,--no-whole-archive -Wl,--no-undefined -lpthread -lm Adding -lc in the end fixes the errors and produces the full size libLLVM-2.7.so. Yuri
Yuri
2010-May-05 17:08 UTC
[LLVMdev] Is the option --enable-shared discontinued in 2.7? (FreeBSD)
Jeffrey Yasskin wrote:>> Would you try the patch at >> http://codereview.appspot.com/download/issue968046_1.diff? It should >> make the BSDs fall into the same path as Linux, and since you use gnu >> ld, that should work for you. >> > > Ping? >I also noticed that during the build in llvm-gcc-4.2-objects on sparc machine there is also a step: llvm[1]: Linking Release Shared Library LLVM-2.7.so Linking command is the similar (or same) as in llvm-objects. It fails just like the same command in llvm-objects. And adding -lc in the end saves it. I guess this is a bug in the Makefile because libLLVM-2.7.so already exists and --enable-llvm= is specified to configure. Not sure why this didn't fail the same way on i386. Yuri
Jeffrey Yasskin
2010-May-05 20:52 UTC
[LLVMdev] Is the option --enable-shared discontinued in 2.7?
On Tue, May 4, 2010 at 5:31 PM, Yuri <yuri at tsoft.com> wrote:> Jeffrey Yasskin wrote: >>> >>> Would you try the patch at >>> http://codereview.appspot.com/download/issue968046_1.diff? It should >>> make the BSDs fall into the same path as Linux, and since you use gnu >>> ld, that should work for you. >>> >> >> Ping? >> > > > Sorry for the delay. > > Here is what I am getting after applying the patch: > gmake[2]: Leaving directory `/tmp/llvm-build/2.7/llvm-objects/lib/CodeGen' > gmake[1]: Leaving directory `/tmp/llvm-build/2.7/llvm-objects/lib' > gmake[1]: Entering directory > `/tmp/llvm-build/2.7/llvm-objects/tools/llvm-shlib' > llvm[1]: Linking Release Shared Library LLVM-2.7.so > /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0x135): > In function `(anonymous > namespace)::ARMAsmParser::ParseDirective(llvm::AsmToken)': > : undefined reference to `__assert' > /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0x3e3): > In function `(anonymous > namespace)::ARMAsmParser::ParseDirective(llvm::AsmToken)': > : undefined reference to `__assert' > /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0x5d8): > In function `(anonymous > namespace)::ARMAsmParser::ParseDirective(llvm::AsmToken)': > : undefined reference to `__assert' > /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0xd10): > In function `(anonymous > namespace)::ARMAsmParser::MatchRegisterName(llvm::StringRef const&)': > : undefined reference to `memcmp' > /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0xd45): > In function `(anonymous > namespace)::ARMAsmParser::MatchRegisterName(llvm::StringRef const&)': > : undefined reference to `memcmp' > /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0xd6d): > In function `(anonymous > namespace)::ARMAsmParser::MatchRegisterName(llvm::StringRef const&)': > : undefined reference to `memcmp' > /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVMARMAsmParser.a(ARMAsmParser.o)(.text+0xdd5): > In function `(anonymous > namespace)::ARMAsmParser::MaybeParseRegister((anonymous > namespace)::ARMOperand&, bool)': > : undefined reference to `__assert' > > Linking command line was: > /usr/local/gcc/4.5.0/bin/g++ -I/tmp/llvm-build/2.7/llvm-objects/include > -I/tmp/llvm-build/2.7/llvm-objects/tools/llvm-shlib > -I/tmp/llvm-build/2.7/llvm/include > -I/tmp/llvm-build/2.7/llvm/tools/llvm-shlib -D_DEBUG -D_GNU_SOURCE > -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O2 -fno-exceptions > -fno-rtti -fPIC -Woverloaded-virtual -pedantic -Wno-long-long -Wall -W > -Wno-unused-parameter -Wwrite-strings -O2 -Wl,-R > -Wl,/tmp/llvm-build/2.7/llvm-objects/Release/lib > -L/tmp/llvm-build/2.7/llvm-objects/Release/lib > -L/tmp/llvm-build/2.7/llvm-objects/Release/lib -shared -o > /tmp/llvm-build/2.7/llvm-objects/Release/lib/libLLVM-2.7.so > -Wl,--whole-archive -lLLVMARMAsmParser -lLLVMARMAsmPrinter -lLLVMARMCodeGen > -lLLVMARMInfo -lLLVMAlphaAsmPrinter -lLLVMAlphaCodeGen -lLLVMAlphaInfo > -lLLVMAnalysis -lLLVMArchive -lLLVMAsmParser -lLLVMAsmPrinter > -lLLVMBitReader -lLLVMBitWriter -lLLVMBlackfinAsmPrinter > -lLLVMBlackfinCodeGen -lLLVMBlackfinInfo -lLLVMCBackend -lLLVMCBackendInfo > -lLLVMCellSPUAsmPrinter -lLLVMCellSPUCodeGen -lLLVMCellSPUInfo -lLLVMCodeGen > -lLLVMCore -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMExecutionEngine > -lLLVMInstCombine -lLLVMInstrumentation -lLLVMInterpreter -lLLVMJIT > -lLLVMLinker -lLLVMMBlazeAsmPrinter -lLLVMMBlazeCodeGen -lLLVMMBlazeInfo > -lLLVMMC -lLLVMMCParser -lLLVMMSIL -lLLVMMSILInfo -lLLVMMSP430AsmPrinter > -lLLVMMSP430CodeGen -lLLVMMSP430Info -lLLVMMipsAsmPrinter -lLLVMMipsCodeGen > -lLLVMMipsInfo -lLLVMPIC16AsmPrinter -lLLVMPIC16CodeGen -lLLVMPIC16Info > -lLLVMPowerPCAsmPrinter -lLLVMPowerPCCodeGen -lLLVMPowerPCInfo > -lLLVMScalarOpts -lLLVMSelectionDAG -lLLVMSparcAsmPrinter -lLLVMSparcCodeGen > -lLLVMSparcInfo -lLLVMSupport -lLLVMSystem -lLLVMSystemZAsmPrinter > -lLLVMSystemZCodeGen -lLLVMSystemZInfo -lLLVMTarget -lLLVMTransformUtils > -lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen > -lLLVMX86Disassembler -lLLVMX86Info -lLLVMXCoreAsmPrinter -lLLVMXCoreCodeGen > -lLLVMXCoreInfo -lLLVMipa -lLLVMipo -lLLVMpic16passes -Wl,--no-whole-archive > -Wl,--no-undefined -lpthread -lm > > Adding -lc in the end fixes the errors and produces the full size > libLLVM-2.7.so.That's odd. On Linux, g++ adds -lc to the end of the link line itself. It must be adding -lstdc++ for you too, or you'd have more missing symbols. If you run that command with "-v", it'll show you the actual link line, but given your errors it does seem like -lc is missing. I don't think it'll hurt anyone else to add that, so I'll try it. I assume builds without --enable-shared do work for you? If so, I wonder why g++ would omit -lc for shared links but not executable links? Jeffrey
Maybe Matching Threads
- [LLVMdev] Is the option --enable-shared discontinued in 2.7?
- [LLVMdev] Is the option --enable-shared discontinued in 2.7?
- [LLVMdev] MC: Object file specific parsing
- [LLVMdev] Warning in LLVM
- [LLVMdev] Implementing the ldr pseudo instruction in ARM integrated assembler