git: ae60fcd40fc6 - stable/13 - Convert libllvm, libclang and liblldb into private shared libraries
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 May 2025 20:32:56 UTC
The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ae60fcd40fc6e46d239104464f61a6ae30d14e5b commit ae60fcd40fc6e46d239104464f61a6ae30d14e5b Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2025-04-25 17:56:39 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2025-05-09 17:16:15 +0000 Convert libllvm, libclang and liblldb into private shared libraries This allows clang, lld, lldb, and other llvm tools to be linked against these shared libraries, which makes them smaller and avoids duplication. Since these are not quite the same as the shared libraries shipped by the upstream llvm build system, and we do not want to expose the ABI to external programs such as ports, make them private libraries. Note that during the cross-tools stage they are still built as static libraries, so the cross compiler and linker are static binaries, as they have always been. This also requires a depend-cleanup.sh kludge which will be added in a follow-up commit, to ensure binaries are rebuilt against the shared libraries in case of incremental builds. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D49967 (cherry picked from commit 2e47f35be5dc61945afdbd1a70e8fd505c032c94) --- lib/clang/libclang/Makefile | 83 ++++++++++++----- lib/clang/liblldb/Makefile | 23 ++++- lib/clang/libllvm/Makefile | 152 +++++++++++++++++-------------- tools/build/mk/OptionalObsoleteFiles.inc | 10 ++ usr.bin/clang/Makefile.inc | 2 + usr.bin/clang/clang.prog.mk | 12 ++- usr.bin/clang/lld/Makefile | 12 ++- usr.bin/clang/lldb-server/Makefile | 7 +- usr.bin/clang/lldb/Makefile | 7 +- usr.bin/clang/llvm.prog.mk | 8 +- 10 files changed, 211 insertions(+), 105 deletions(-) diff --git a/lib/clang/libclang/Makefile b/lib/clang/libclang/Makefile index 14c3778d514a..5e20b37c1183 100644 --- a/lib/clang/libclang/Makefile +++ b/lib/clang/libclang/Makefile @@ -2,7 +2,22 @@ .include <bsd.init.mk> .include "../clang.pre.mk" +.if defined(TOOLS_PREFIX) +# Build static library during cross-tools stage LIB= clang +INTERNALLIB= +.else +PACKAGE= clang +SHLIB_CXX= clang +SHLIB_MAJOR= 19 +PRIVATELIB= +.if ${MACHINE} == "powerpc" +# Work around "relocation R_PPC_GOT16 out of range" errors +PICFLAG= -fPIC +.endif +.endif + +SHARED_CXXFLAGS+= -UPIC # To avoid compile errors CFLAGS+= -I${.OBJDIR} CFLAGS+= -I${OBJTOP}/lib/clang/libllvm @@ -71,7 +86,7 @@ SRCS_MIN+= AST/CommentParser.cpp SRCS_MIN+= AST/CommentSema.cpp SRCS_MIN+= AST/ComparisonCategories.cpp SRCS_MIN+= AST/ComputeDependence.cpp -SRCS_FUL+= AST/DataCollection.cpp +SRCS_MIN+= AST/DataCollection.cpp SRCS_MIN+= AST/Decl.cpp SRCS_MIN+= AST/DeclBase.cpp SRCS_MIN+= AST/DeclCXX.cpp @@ -159,7 +174,9 @@ SRCS_MIN+= AST/VTableBuilder.cpp SRCS_MIN+= ASTMatchers/ASTMatchFinder.cpp SRCS_MIN+= ASTMatchers/ASTMatchersInternal.cpp SRCS_MIN+= ASTMatchers/Dynamic/Diagnostics.cpp +SRCS_MIN+= ASTMatchers/Dynamic/Marshallers.cpp SRCS_MIN+= ASTMatchers/Dynamic/Registry.cpp +SRCS_MIN+= ASTMatchers/Dynamic/VariantValue.cpp SRCS_MIN+= Analysis/AnalysisDeclContext.cpp SRCS_MIN+= Analysis/BodyFarm.cpp SRCS_MIN+= Analysis/CFG.cpp @@ -425,27 +442,27 @@ SRCS_MIN+= ExtractAPI/DeclarationFragments.cpp SRCS_MIN+= ExtractAPI/ExtractAPIConsumer.cpp SRCS_MIN+= ExtractAPI/Serialization/SymbolGraphSerializer.cpp SRCS_MIN+= ExtractAPI/TypedefUnderlyingTypeResolver.cpp -SRCS_EXT+= Format/AffectedRangeManager.cpp -SRCS_EXT+= Format/BreakableToken.cpp -SRCS_EXT+= Format/ContinuationIndenter.cpp -SRCS_EXT+= Format/DefinitionBlockSeparator.cpp -SRCS_EXT+= Format/Format.cpp -SRCS_EXT+= Format/FormatToken.cpp -SRCS_EXT+= Format/FormatTokenLexer.cpp -SRCS_EXT+= Format/IntegerLiteralSeparatorFixer.cpp -SRCS_EXT+= Format/MacroCallReconstructor.cpp -SRCS_EXT+= Format/MacroExpander.cpp +SRCS_MIN+= Format/AffectedRangeManager.cpp +SRCS_MIN+= Format/BreakableToken.cpp +SRCS_MIN+= Format/ContinuationIndenter.cpp +SRCS_MIN+= Format/DefinitionBlockSeparator.cpp +SRCS_MIN+= Format/Format.cpp +SRCS_MIN+= Format/FormatToken.cpp +SRCS_MIN+= Format/FormatTokenLexer.cpp +SRCS_MIN+= Format/IntegerLiteralSeparatorFixer.cpp +SRCS_MIN+= Format/MacroCallReconstructor.cpp +SRCS_MIN+= Format/MacroExpander.cpp SRCS_EXT+= Format/MatchFilePath.cpp -SRCS_EXT+= Format/NamespaceEndCommentsFixer.cpp -SRCS_EXT+= Format/ObjCPropertyAttributeOrderFixer.cpp -SRCS_EXT+= Format/QualifierAlignmentFixer.cpp -SRCS_EXT+= Format/SortJavaScriptImports.cpp -SRCS_EXT+= Format/TokenAnalyzer.cpp -SRCS_EXT+= Format/TokenAnnotator.cpp -SRCS_EXT+= Format/UnwrappedLineFormatter.cpp -SRCS_EXT+= Format/UnwrappedLineParser.cpp -SRCS_EXT+= Format/UsingDeclarationsSorter.cpp -SRCS_EXT+= Format/WhitespaceManager.cpp +SRCS_MIN+= Format/NamespaceEndCommentsFixer.cpp +SRCS_MIN+= Format/ObjCPropertyAttributeOrderFixer.cpp +SRCS_MIN+= Format/QualifierAlignmentFixer.cpp +SRCS_MIN+= Format/SortJavaScriptImports.cpp +SRCS_MIN+= Format/TokenAnalyzer.cpp +SRCS_MIN+= Format/TokenAnnotator.cpp +SRCS_MIN+= Format/UnwrappedLineFormatter.cpp +SRCS_MIN+= Format/UnwrappedLineParser.cpp +SRCS_MIN+= Format/UsingDeclarationsSorter.cpp +SRCS_MIN+= Format/WhitespaceManager.cpp SRCS_MIN+= Frontend/ASTConsumers.cpp SRCS_MIN+= Frontend/ASTMerge.cpp SRCS_MIN+= Frontend/ASTUnit.cpp @@ -825,9 +842,12 @@ SRCS_MIN+= Tooling/ArgumentsAdjusters.cpp SRCS_MIN+= Tooling/CommonOptionsParser.cpp SRCS_MIN+= Tooling/CompilationDatabase.cpp SRCS_MIN+= Tooling/Core/Replacement.cpp +SRCS_MIN+= Tooling/ExpandResponseFilesCompilationDatabase.cpp SRCS_MIN+= Tooling/FileMatchTrie.cpp -SRCS_EXT+= Tooling/Inclusions/HeaderIncludes.cpp -SRCS_EXT+= Tooling/Inclusions/IncludeStyle.cpp +SRCS_MIN+= Tooling/GuessTargetAndModeCompilationDatabase.cpp +SRCS_MIN+= Tooling/Inclusions/HeaderIncludes.cpp +SRCS_MIN+= Tooling/Inclusions/IncludeStyle.cpp +SRCS_MIN+= Tooling/InterpolatingCompilationDatabase.cpp SRCS_MIN+= Tooling/JSONCompilationDatabase.cpp SRCS_MIN+= Tooling/Refactoring.cpp SRCS_MIN+= Tooling/RefactoringCallbacks.cpp @@ -845,6 +865,21 @@ SRCS_ALL+= ${SRCS_LDB} .endif SRCS+= ${SRCS_ALL:O} +LIBDEPS+= llvm + +.if defined(TOOLS_PREFIX) +LIBPRIV= +LIBEXT= a +.else +LIBPRIV= private +LIBEXT= so +.endif + +.for lib in ${LIBDEPS} +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +.endfor + clang/AST/AbstractBasicReader.inc: \ ${CLANG_SRCS}/include/clang/AST/PropertiesBase.td ${CLANG_TBLGEN} -gen-clang-basic-reader \ @@ -1300,6 +1335,4 @@ CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} .include "../clang.build.mk" -INTERNALLIB= - .include <bsd.lib.mk> diff --git a/lib/clang/liblldb/Makefile b/lib/clang/liblldb/Makefile index 48966d7cccf5..408ebc440686 100644 --- a/lib/clang/liblldb/Makefile +++ b/lib/clang/liblldb/Makefile @@ -2,7 +2,13 @@ .include <bsd.init.mk> .include "../lldb.pre.mk" -LIB= lldb +PACKAGE= lldb +SHLIB_CXX= lldb +SHLIB_MAJOR= 19 +PRIVATELIB= + +SHARED_CXXFLAGS+= -UPIC # To avoid compile errors + SRCDIR= lldb/source CFLAGS+= -I${LLDB_SRCS}/include @@ -745,6 +751,19 @@ SRCS+= Utility/VMRange.cpp SRCS+= Utility/XcodeSDK.cpp SRCS+= Version/Version.cpp +LIBDEPS+= clang +LIBDEPS+= llvm + +LIBPRIV= private +LIBEXT= so + +.for lib in ${LIBDEPS} +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +.endfor + +LIBADD+= kvm + LLDB_TBLGEN?= lldb-tblgen CommandOptions.inc: ${LLDB_SRCS}/source/Commands/Options.td @@ -780,8 +799,6 @@ CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} .include "../clang.build.mk" -INTERNALLIB= - # Building lldb's bindings requires swig, but we do not want to include it in # the FreeBSD base system (as a build tool) because it has non-trivial # dependencies. As a workaround we commit the generated file. Requires the diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index 14122e117021..cb16d39961ae 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -2,8 +2,22 @@ .include <bsd.init.mk> .include "../llvm.pre.mk" +.if defined(TOOLS_PREFIX) +# Build static library during cross-tools stage LIB= llvm INTERNALLIB= +.else +PACKAGE= clang +SHLIB_CXX= llvm +SHLIB_MAJOR= 19 +PRIVATELIB= +.if ${MACHINE} == "powerpc" +# Work around "relocation R_PPC_GOT16 out of range" errors +PICFLAG= -fPIC +.endif +.endif + +SHARED_CXXFLAGS+= -UPIC # To avoid compile errors CFLAGS+= -I${.OBJDIR} CFLAGS+= -I${SRCTOP}/sys/contrib/zstd/lib @@ -509,24 +523,24 @@ SRCS_EXT+= DWP/DWP.cpp SRCS_EXT+= DWP/DWPError.cpp SRCS_MIW+= DebugInfo/BTF/BTFContext.cpp SRCS_MIW+= DebugInfo/BTF/BTFParser.cpp -SRCS_EXT+= DebugInfo/CodeView/AppendingTypeTableBuilder.cpp +SRCS_MIN+= DebugInfo/CodeView/AppendingTypeTableBuilder.cpp SRCS_MIN+= DebugInfo/CodeView/CVSymbolVisitor.cpp SRCS_MIN+= DebugInfo/CodeView/CVTypeVisitor.cpp SRCS_MIN+= DebugInfo/CodeView/CodeViewError.cpp SRCS_MIN+= DebugInfo/CodeView/CodeViewRecordIO.cpp SRCS_MIN+= DebugInfo/CodeView/ContinuationRecordBuilder.cpp SRCS_MIN+= DebugInfo/CodeView/DebugChecksumsSubsection.cpp -SRCS_EXT+= DebugInfo/CodeView/DebugCrossExSubsection.cpp -SRCS_EXT+= DebugInfo/CodeView/DebugCrossImpSubsection.cpp +SRCS_MIN+= DebugInfo/CodeView/DebugCrossExSubsection.cpp +SRCS_MIN+= DebugInfo/CodeView/DebugCrossImpSubsection.cpp SRCS_MIN+= DebugInfo/CodeView/DebugFrameDataSubsection.cpp SRCS_MIN+= DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp SRCS_MIN+= DebugInfo/CodeView/DebugLinesSubsection.cpp SRCS_MIN+= DebugInfo/CodeView/DebugStringTableSubsection.cpp -SRCS_MIW+= DebugInfo/CodeView/DebugSubsection.cpp -SRCS_EXT+= DebugInfo/CodeView/DebugSubsectionRecord.cpp -SRCS_EXT+= DebugInfo/CodeView/DebugSubsectionVisitor.cpp -SRCS_EXT+= DebugInfo/CodeView/DebugSymbolRVASubsection.cpp -SRCS_EXT+= DebugInfo/CodeView/DebugSymbolsSubsection.cpp +SRCS_MIN+= DebugInfo/CodeView/DebugSubsection.cpp +SRCS_MIN+= DebugInfo/CodeView/DebugSubsectionRecord.cpp +SRCS_MIN+= DebugInfo/CodeView/DebugSubsectionVisitor.cpp +SRCS_MIN+= DebugInfo/CodeView/DebugSymbolRVASubsection.cpp +SRCS_MIN+= DebugInfo/CodeView/DebugSymbolsSubsection.cpp SRCS_MIN+= DebugInfo/CodeView/EnumTables.cpp SRCS_MIN+= DebugInfo/CodeView/Formatters.cpp SRCS_MIN+= DebugInfo/CodeView/GlobalTypeTableBuilder.cpp @@ -540,7 +554,7 @@ SRCS_EXT+= DebugInfo/CodeView/StringsAndChecksums.cpp SRCS_MIN+= DebugInfo/CodeView/SymbolDumper.cpp SRCS_MIN+= DebugInfo/CodeView/SymbolRecordHelpers.cpp SRCS_MIN+= DebugInfo/CodeView/SymbolRecordMapping.cpp -SRCS_EXT+= DebugInfo/CodeView/SymbolSerializer.cpp +SRCS_MIN+= DebugInfo/CodeView/SymbolSerializer.cpp SRCS_MIN+= DebugInfo/CodeView/TypeDumpVisitor.cpp SRCS_MIN+= DebugInfo/CodeView/TypeHashing.cpp SRCS_MIN+= DebugInfo/CodeView/TypeIndex.cpp @@ -549,37 +563,37 @@ SRCS_EXT+= DebugInfo/CodeView/TypeRecordHelpers.cpp SRCS_MIN+= DebugInfo/CodeView/TypeRecordMapping.cpp SRCS_MIN+= DebugInfo/CodeView/TypeStreamMerger.cpp SRCS_MIN+= DebugInfo/CodeView/TypeTableCollection.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFAddressRange.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFCompileUnit.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFContext.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDataExtractor.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAddr.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugAranges.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugFrame.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLine.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugLoc.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugMacro.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugPubTable.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugRangeList.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDebugRnglists.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFDie.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFAddressRange.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFCompileUnit.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFContext.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDataExtractor.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugAddr.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugArangeSet.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugAranges.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugFrame.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugInfoEntry.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugLine.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugLoc.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugMacro.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugPubTable.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugRangeList.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDebugRnglists.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFDie.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFExpression.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFFormValue.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFGdbIndex.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFListTable.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFTypePrinter.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFTypeUnit.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFUnit.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFUnitIndex.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFVerifier.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFFormValue.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFGdbIndex.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFListTable.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFTypePrinter.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFTypeUnit.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFUnit.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFUnitIndex.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFVerifier.cpp SRCS_MIN+= DebugInfo/MSF/MSFBuilder.cpp SRCS_MIN+= DebugInfo/MSF/MSFCommon.cpp -SRCS_EXT+= DebugInfo/MSF/MSFError.cpp +SRCS_MIN+= DebugInfo/MSF/MSFError.cpp SRCS_MIN+= DebugInfo/MSF/MappedBlockStream.cpp SRCS_EXT+= DebugInfo/PDB/GenericError.cpp SRCS_EXT+= DebugInfo/PDB/IPDBSourceFile.cpp @@ -867,7 +881,7 @@ SRCS_MIN+= LTO/LTO.cpp SRCS_MIN+= LTO/LTOBackend.cpp SRCS_EXL+= LTO/LTOCodeGenerator.cpp SRCS_EXL+= LTO/LTOModule.cpp -SRCS_EXL+= LTO/SummaryBasedOptimizations.cpp +SRCS_MIN+= LTO/SummaryBasedOptimizations.cpp SRCS_EXL+= LTO/ThinLTOCodeGenerator.cpp SRCS_MIN+= LTO/UpdateCompilerUsed.cpp SRCS_MIN+= Linker/IRMover.cpp @@ -892,7 +906,7 @@ SRCS_MIN+= MC/MCContext.cpp SRCS_MIN+= MC/MCDXContainerStreamer.cpp SRCS_MIN+= MC/MCDXContainerWriter.cpp SRCS_XDL+= MC/MCDisassembler/Disassembler.cpp -SRCS_XDW+= MC/MCDisassembler/MCDisassembler.cpp +SRCS_MIN+= MC/MCDisassembler/MCDisassembler.cpp SRCS_XDW+= MC/MCDisassembler/MCExternalSymbolizer.cpp SRCS_MIN+= MC/MCDisassembler/MCRelocationInfo.cpp SRCS_XDW+= MC/MCDisassembler/MCSymbolizer.cpp @@ -1006,9 +1020,9 @@ SRCS_MIW+= ObjCopy/wasm/WasmWriter.cpp SRCS_MIN+= Object/Archive.cpp SRCS_MIN+= Object/ArchiveWriter.cpp SRCS_MIN+= Object/Binary.cpp -SRCS_MIW+= Object/BuildID.cpp +SRCS_MIN+= Object/BuildID.cpp SRCS_MIN+= Object/COFFImportFile.cpp -SRCS_MIW+= Object/COFFModuleDefinition.cpp +SRCS_MIN+= Object/COFFModuleDefinition.cpp SRCS_MIN+= Object/COFFObjectFile.cpp SRCS_MIN+= Object/Decompressor.cpp SRCS_MIN+= Object/ELF.cpp @@ -1018,31 +1032,34 @@ SRCS_MIW+= Object/FaultMapParser.cpp SRCS_MIN+= Object/IRObjectFile.cpp SRCS_MIN+= Object/IRSymtab.cpp SRCS_MIN+= Object/MachOObjectFile.cpp -SRCS_MIW+= Object/MachOUniversal.cpp +SRCS_MIN+= Object/MachOUniversal.cpp SRCS_MIW+= Object/MachOUniversalWriter.cpp -SRCS_MIW+= Object/Minidump.cpp +SRCS_MIN+= Object/Minidump.cpp SRCS_MIN+= Object/ModuleSymbolTable.cpp SRCS_EXT+= Object/Object.cpp SRCS_MIN+= Object/ObjectFile.cpp -SRCS_MIW+= Object/OffloadBinary.cpp +SRCS_MIN+= Object/OffloadBinary.cpp SRCS_MIN+= Object/RecordStreamer.cpp -SRCS_MIW+= Object/RelocationResolver.cpp +SRCS_MIN+= Object/RelocationResolver.cpp SRCS_MIW+= Object/SymbolSize.cpp SRCS_MIN+= Object/SymbolicFile.cpp -SRCS_MIW+= Object/TapiFile.cpp -SRCS_MIW+= Object/TapiUniversal.cpp +SRCS_MIN+= Object/TapiFile.cpp +SRCS_MIN+= Object/TapiUniversal.cpp SRCS_MIN+= Object/WasmObjectFile.cpp SRCS_MIW+= Object/WindowsMachineFlag.cpp SRCS_MIN+= Object/WindowsResource.cpp SRCS_MIN+= Object/XCOFFObjectFile.cpp SRCS_MIN+= ObjectYAML/COFFYAML.cpp -SRCS_EXT+= ObjectYAML/CodeViewYAMLDebugSections.cpp -SRCS_EXT+= ObjectYAML/CodeViewYAMLSymbols.cpp -SRCS_EXT+= ObjectYAML/CodeViewYAMLTypes.cpp +SRCS_MIN+= ObjectYAML/CodeViewYAMLDebugSections.cpp +SRCS_MIN+= ObjectYAML/CodeViewYAMLSymbols.cpp +SRCS_MIN+= ObjectYAML/CodeViewYAMLTypeHashing.cpp +SRCS_MIN+= ObjectYAML/CodeViewYAMLTypes.cpp +SRCS_MIN+= ObjectYAML/DWARFEmitter.cpp SRCS_MIN+= ObjectYAML/DWARFYAML.cpp +SRCS_MIN+= ObjectYAML/ELFEmitter.cpp SRCS_MIN+= ObjectYAML/ELFYAML.cpp SRCS_MIN+= ObjectYAML/MachOYAML.cpp -SRCS_EXT+= ObjectYAML/YAML.cpp +SRCS_MIN+= ObjectYAML/YAML.cpp SRCS_MIN+= Option/Arg.cpp SRCS_MIN+= Option/ArgList.cpp SRCS_MIN+= Option/OptTable.cpp @@ -1135,7 +1152,7 @@ SRCS_MIN+= Support/ErrorHandling.cpp SRCS_MIN+= Support/ExponentialBackoff.cpp SRCS_MIN+= Support/ExtensibleRTTI.cpp SRCS_MIN+= Support/FileCollector.cpp -SRCS_MIW+= Support/FileOutputBuffer.cpp +SRCS_MIN+= Support/FileOutputBuffer.cpp SRCS_MIN+= Support/FileUtilities.cpp SRCS_MIN+= Support/FloatingPointMode.cpp SRCS_MIN+= Support/FoldingSet.cpp @@ -1161,7 +1178,7 @@ SRCS_MIW+= Support/MSP430Attributes.cpp SRCS_MIN+= Support/ManagedStatic.cpp SRCS_MIN+= Support/MathExtras.cpp SRCS_MIN+= Support/MemAlloc.cpp -SRCS_MIW+= Support/Memory.cpp +SRCS_MIN+= Support/Memory.cpp SRCS_MIN+= Support/MemoryBuffer.cpp SRCS_MIN+= Support/MemoryBufferRef.cpp SRCS_MIN+= Support/NativeFormatting.cpp @@ -1200,7 +1217,7 @@ SRCS_MIN+= Support/SuffixTree.cpp SRCS_MIN+= Support/SuffixTreeNode.cpp SRCS_EXT+= Support/SystemUtils.cpp SRCS_LLD+= Support/TarWriter.cpp -SRCS_MIW+= Support/ThreadPool.cpp +SRCS_MIN+= Support/ThreadPool.cpp SRCS_MIN+= Support/Threading.cpp SRCS_MIN+= Support/TimeProfiler.cpp SRCS_MIN+= Support/Timer.cpp @@ -1695,21 +1712,22 @@ SRCS_MIN+= TargetParser/SubtargetFeature.cpp SRCS_MIN+= TargetParser/TargetParser.cpp SRCS_MIN+= TargetParser/Triple.cpp SRCS_MIN+= TargetParser/X86TargetParser.cpp -SRCS_MIW+= TextAPI/Architecture.cpp -SRCS_MIW+= TextAPI/ArchitectureSet.cpp +SRCS_MIN+= TextAPI/Architecture.cpp +SRCS_MIN+= TextAPI/ArchitectureSet.cpp SRCS_MIW+= TextAPI/BinaryReader/DylibReader.cpp -SRCS_MIW+= TextAPI/InterfaceFile.cpp -SRCS_MIW+= TextAPI/PackedVersion.cpp -SRCS_MIW+= TextAPI/Platform.cpp +SRCS_MIN+= TextAPI/InterfaceFile.cpp +SRCS_MIN+= TextAPI/PackedVersion.cpp +SRCS_MIN+= TextAPI/Platform.cpp SRCS_MIW+= TextAPI/RecordVisitor.cpp -SRCS_MIW+= TextAPI/Symbol.cpp -SRCS_MIW+= TextAPI/SymbolSet.cpp -SRCS_MIW+= TextAPI/Target.cpp -SRCS_MIW+= TextAPI/TextAPIError.cpp -SRCS_MIW+= TextAPI/TextStub.cpp -SRCS_MIW+= TextAPI/TextStubCommon.cpp -SRCS_MIW+= TextAPI/TextStubV5.cpp -SRCS_MIW+= TextAPI/Utils.cpp +SRCS_MIW+= TextAPI/RecordsSlice.cpp +SRCS_MIN+= TextAPI/Symbol.cpp +SRCS_MIN+= TextAPI/SymbolSet.cpp +SRCS_MIN+= TextAPI/Target.cpp +SRCS_MIN+= TextAPI/TextAPIError.cpp +SRCS_MIN+= TextAPI/TextStub.cpp +SRCS_MIN+= TextAPI/TextStubCommon.cpp +SRCS_MIN+= TextAPI/TextStubV5.cpp +SRCS_MIN+= TextAPI/Utils.cpp SRCS_MIN+= ToolDrivers/llvm-dlltool/DlltoolDriver.cpp SRCS_MIW+= ToolDrivers/llvm-lib/LibDriver.cpp SRCS_MIN+= Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index a9436af31b77..5675d92197df 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -1161,6 +1161,15 @@ OLD_FILES+=usr/share/man/man8/zfsloader.8.gz OLD_FILES+=usr/share/man/man8/zpool.8.gz .endif +.if ${MK_CLANG} == no && ${MK_CLANG_FORMAT} == no && ${MK_LLDB} == no +OLD_LIBS+=usr/lib/libprivateclang.so.19 +.endif + +.if ${MK_CLANG_EXTRAS} == no && ${MK_CLANG} == no && ${MK_LLDB} == no && \ + ${MK_LLD} == no && ${MK_LLVM_BINUTILS} == no && ${MK_LLVM_COV} == no +OLD_LIBS+=usr/lib/libprivatellvm.so.19 +.endif + .if ${MK_CLANG} == no && ${MK_LLVM_BINUTILS} == no OLD_FILES+=usr/bin/llvm-addr2line OLD_FILES+=usr/bin/llvm-ar @@ -4329,6 +4338,7 @@ OLD_FILES+=usr/bin/ld.lld .if ${MK_LLDB} == no OLD_FILES+=usr/bin/lldb OLD_FILES+=usr/bin/lldb-server +OLD_LIBS+=usr/lib/libprivatelldb.so.19 OLD_FILES+=usr/share/man/man1/lldb-server.1.gz OLD_FILES+=usr/share/man/man1/lldb.1.gz .endif diff --git a/usr.bin/clang/Makefile.inc b/usr.bin/clang/Makefile.inc index 8f6b098de2d4..d5c9658b1d90 100644 --- a/usr.bin/clang/Makefile.inc +++ b/usr.bin/clang/Makefile.inc @@ -1,7 +1,9 @@ .include <src.opts.mk> +.if defined(TOOLS_PREFIX) MK_PIE:= no # Explicit libXXX.a references +.endif .if ${MK_LLVM_FULL_DEBUGINFO} == "no" .if ${COMPILER_TYPE} == "clang" diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk index cf48f02359e9..36c601bcbe36 100644 --- a/usr.bin/clang/clang.prog.mk +++ b/usr.bin/clang/clang.prog.mk @@ -18,9 +18,17 @@ LIBADD+= z LIBADD+= zstd .endif +.if defined(TOOLS_PREFIX) +LIBPRIV= +LIBEXT= a +.else +LIBPRIV= private +LIBEXT= so +.endif + .for lib in ${LIBDEPS} -DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a -LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} .endfor PACKAGE= clang diff --git a/usr.bin/clang/lld/Makefile b/usr.bin/clang/lld/Makefile index 08d9cf6f550c..f87677c2b384 100644 --- a/usr.bin/clang/lld/Makefile +++ b/usr.bin/clang/lld/Makefile @@ -86,9 +86,17 @@ SRCS+= tools/lld/lld.cpp LIBDEPS+= llvm +.if defined(TOOLS_PREFIX) +LIBPRIV= +LIBEXT= a +.else +LIBPRIV= private +LIBEXT= so +.endif + .for lib in ${LIBDEPS} -DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a -LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} .endfor INCFILE= Options.inc diff --git a/usr.bin/clang/lldb-server/Makefile b/usr.bin/clang/lldb-server/Makefile index a02c5c606566..1a5c96b65806 100644 --- a/usr.bin/clang/lldb-server/Makefile +++ b/usr.bin/clang/lldb-server/Makefile @@ -23,9 +23,12 @@ LIBDEPS+= lldb LIBDEPS+= clang LIBDEPS+= llvm +LIBPRIV= private +LIBEXT= so + .for lib in ${LIBDEPS} -DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a -LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} .endfor INCFILE= LLGSOptions.inc diff --git a/usr.bin/clang/lldb/Makefile b/usr.bin/clang/lldb/Makefile index efbd150efe4f..0e9a9ebef7e8 100644 --- a/usr.bin/clang/lldb/Makefile +++ b/usr.bin/clang/lldb/Makefile @@ -16,9 +16,12 @@ LIBDEPS+= lldb LIBDEPS+= clang LIBDEPS+= llvm +LIBPRIV= private +LIBEXT= so + .for lib in ${LIBDEPS} -DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a -LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} .endfor INCFILE= Options.inc diff --git a/usr.bin/clang/llvm.prog.mk b/usr.bin/clang/llvm.prog.mk index 2660ee22d82a..8c898b4087fb 100644 --- a/usr.bin/clang/llvm.prog.mk +++ b/usr.bin/clang/llvm.prog.mk @@ -10,15 +10,19 @@ CFLAGS+= -I${OBJTOP}/lib/clang/libllvm (${PROG_CXX} == "clang-tblgen" || ${PROG_CXX} == "lldb-tblgen" || \ ${PROG_CXX} == "llvm-min-tblgen" || ${PROG_CXX} == "llvm-tblgen") LIBDEPS+= llvmminimal +LIBPRIV= +LIBEXT= a .else LIBDEPS+= llvm +LIBPRIV= private +LIBEXT= so LIBADD+= z LIBADD+= zstd .endif .for lib in ${LIBDEPS} -DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a -LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${lib}.a +DPADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} +LDADD+= ${OBJTOP}/lib/clang/lib${lib}/lib${LIBPRIV}${lib}.${LIBEXT} .endfor PACKAGE= clang