From: robert Date: Tue, 23 Nov 2021 10:30:08 +0000 (+0000) Subject: add llvm-ar(1) to the build with its two dependencies libLLVMDlltoolDriver X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d5a92f23e1972e4151f062ce9d745e39cb9fd3d0;p=openbsd add llvm-ar(1) to the build with its two dependencies libLLVMDlltoolDriver and libLLVMLibDriver; switch LLD_ARCHs to llvm-ar(1) by skipping the installation of binutils' ar(1) and linking llvm-ar(1) to ar(1) tested on amd64, i386, arm64 and mips64 ok patrick@, kettenis@ --- diff --git a/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper b/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper index 611a2169862..486aa67d24a 100644 --- a/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper +++ b/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.23 2021/06/21 14:20:20 deraadt Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.24 2021/11/23 10:30:08 robert Exp $ .include @@ -29,7 +29,7 @@ MAN= binutils/doc/addr2line.1 binutils/doc/objcopy.1 \ SUBDIRS+= binutils CONF_SUBDIRS+= binutils INST_SUBDIRS+= binutils -MAN+= binutils/doc/ar.1 binutils/doc/ranlib.1 \ +MAN+= binutils/doc/ranlib.1 \ binutils/doc/strings.1 binutils/doc/strip.1 .if (${TARGET_ARCH} != "aarch64" && ${TARGET_ARCH} != "powerpc64" && \ @@ -38,6 +38,12 @@ SUBDIRS+= ld gas CONF_SUBDIRS+= ld gas INST_SUBDIRS+= ld gas MAN+= gas/doc/as.1 ld/ld.bfd.1 +.if ${AR_VERSION:L} == "binutils" +MAN+= binutils/doc/ar.1 +.else +# skip installing ar(1) which is am__EXEEXT_7 +SKIP_AR= am__EXEEXT_7= +.endif .if ${LINKER_VERSION:L} == "bfd" maninstall: cd ${DESTDIR}${MANDIR}1 && rm -f ld.1 && ln ld.bfd.1 ld.1 @@ -131,6 +137,7 @@ install: maninstall INSTALL_PROGRAM='${INSTALL} -c ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}' \ INSTALL_DATA='${INSTALL} -c -o ${DOCOWN} -g ${DOCGRP} -m ${NONBINMODE}' \ INSTALL_INFO_HOST_MODULES='${INSTALL_INFO_HOST_MODULES}' \ + ${SKIP_AR} \ $t .endfor .if ${LINKER_VERSION:L} == "bfd" diff --git a/gnu/usr.bin/clang/Makefile b/gnu/usr.bin/clang/Makefile index 74cf9f8b0d8..c69612b61d6 100644 --- a/gnu/usr.bin/clang/Makefile +++ b/gnu/usr.bin/clang/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.15 2021/08/02 08:50:51 patrick Exp $ +# $OpenBSD: Makefile,v 1.16 2021/11/23 10:30:08 robert Exp $ .include @@ -21,6 +21,8 @@ SUBDIR+=include/llvm/${arch} .endfor SUBDIR+=libLLVM +SUBDIR+=libLLVMDlltoolDriver +SUBDIR+=libLLVMLibDriver SUBDIR+=llvm-config SUBDIR+=clang-tblgen @@ -100,6 +102,7 @@ SUBDIR+=lldb SUBDIR+=lldb-server SUBDIR+=include/llvm-objcopy +SUBDIR+=llvm-ar SUBDIR+=llvm-objcopy SUBDIR+=llvm-objdump diff --git a/gnu/usr.bin/clang/libLLVMDlltoolDriver/Makefile b/gnu/usr.bin/clang/libLLVMDlltoolDriver/Makefile new file mode 100644 index 00000000000..7b19a30ab73 --- /dev/null +++ b/gnu/usr.bin/clang/libLLVMDlltoolDriver/Makefile @@ -0,0 +1,21 @@ +# $OpenBSD: Makefile,v 1.1 2021/11/23 10:30:08 robert Exp $ + +LIB= LLVMDlltoolDriver +NOPROFILE= + +SRCS+= DlltoolDriver.cpp + +DlltoolDriver.o: Options.inc +Options.inc: Options.td + ${.OBJDIR}/../llvm-tblgen/llvm-tblgen -gen-opt-parser-defs \ + -I ${LLVM_SRCS}/include \ + -o ${.TARGET} ${.ALLSRC} + +.PATH: ${.CURDIR}/../../../llvm/llvm/lib/ToolDrivers/llvm-dlltool + +CLEANFILES+= Options.inc + +install: + # Nothing here so far ... + +.include diff --git a/gnu/usr.bin/clang/libLLVMLibDriver/Makefile b/gnu/usr.bin/clang/libLLVMLibDriver/Makefile new file mode 100644 index 00000000000..e96f6fd127a --- /dev/null +++ b/gnu/usr.bin/clang/libLLVMLibDriver/Makefile @@ -0,0 +1,21 @@ +# $OpenBSD: Makefile,v 1.1 2021/11/23 10:30:08 robert Exp $ + +LIB= LLVMLibDriver +NOPROFILE= + +SRCS+= LibDriver.cpp + +LibDriver.o: Options.inc +Options.inc: Options.td + ${.OBJDIR}/../llvm-tblgen/llvm-tblgen -gen-opt-parser-defs \ + -I ${LLVM_SRCS}/include \ + -o ${.TARGET} ${.ALLSRC} + +.PATH: ${.CURDIR}/../../../llvm/llvm/lib/ToolDrivers/llvm-lib + +CLEANFILES+= Options.inc + +install: + @# Nothing here so far ... + +.include diff --git a/gnu/usr.bin/clang/llvm-ar/Makefile b/gnu/usr.bin/clang/llvm-ar/Makefile new file mode 100644 index 00000000000..8c4e1eb64a9 --- /dev/null +++ b/gnu/usr.bin/clang/llvm-ar/Makefile @@ -0,0 +1,23 @@ +# $OpenBSD: Makefile,v 1.1 2021/11/23 10:30:08 robert Exp $ + +PROG= llvm-ar +BINDIR= /usr/bin + +.include + +SRCS= llvm-ar.cpp + +.if ${AR_VERSION:L} == "llvm" +LINKS= ${BINDIR}/${PROG} ${BINDIR}/ar + +maninstall: + cd ${DESTDIR}${MANDIR}1 && rm -f ar.1 && ln llvm-ar.1 ar.1 +.endif + +.PATH: ${.CURDIR}/../../../llvm/llvm/tools/llvm-ar + +LLVM_LIBDEPS= LLVM LLVMDlltoolDriver LLVMLibDriver + +LDADD+= -L ${.OBJDIR}/../libLLVM -lLLVM + +.include diff --git a/gnu/usr.bin/clang/llvm-ar/llvm-ar.1 b/gnu/usr.bin/clang/llvm-ar/llvm-ar.1 new file mode 100644 index 00000000000..27ee3c0685c --- /dev/null +++ b/gnu/usr.bin/clang/llvm-ar/llvm-ar.1 @@ -0,0 +1,419 @@ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "LLVM-AR" "1" "2021-11-18" "11" "LLVM" +.SH NAME +llvm-ar \- LLVM archiver +.SH SYNOPSIS +.sp +\fBllvm\-ar\fP [\-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive [files...] +.SH DESCRIPTION +.sp +The \fBllvm\-ar\fP command is similar to the common Unix utility, +\fBar\fP\&. It archives several files, such as objects and LLVM bitcode +files into a single archive library that can be linked into a program. However, +the archive can contain any kind of file. By default, \fBllvm\-ar\fP +generates a symbol table that makes linking faster because only the symbol +table needs to be consulted, not each individual file member of the archive. +.sp +The \fBllvm\-ar\fP command can be used to \fIread\fP archive files in SVR4, +GNU, BSD and Darwin format, and \fIwrite\fP in the GNU, BSD, and Darwin style +archive files. If an SVR4 format archive is used with the \fI\%r\fP +(replace), \fI\%d\fP (delete), \fI\%m\fP (move) or \fI\%q\fP +(quick update) operations, the archive will be reconstructed in the format +defined by \fI\%\-\-format\fP\&. +.sp +Here\(aqs where \fBllvm\-ar\fP departs from previous \fBar\fP +implementations: +.sp +\fIThe following option is not supported\fP +.INDENT 0.0 +.INDENT 3.5 +[f] \- truncate inserted filenames +.UNINDENT +.UNINDENT +.sp +\fIThe following options are ignored for compatibility\fP +.INDENT 0.0 +.INDENT 3.5 +\-\-plugin= \- load a plugin which adds support for other file formats +.sp +[l] \- ignored in \fBar\fP +.UNINDENT +.UNINDENT +.sp +\fISymbol Table\fP +.INDENT 0.0 +.INDENT 3.5 +Since \fBllvm\-ar\fP supports bitcode files, the symbol table it creates +includes both native and bitcode symbols. +.UNINDENT +.UNINDENT +.sp +\fIDeterministic Archives\fP +.INDENT 0.0 +.INDENT 3.5 +By default, \fBllvm\-ar\fP always uses zero for timestamps and UIDs/GIDs +to write archives in a deterministic mode. This is equivalent to the +\fI\%D\fP modifier being enabled by default. If you wish to maintain +compatibility with other \fBar\fP implementations, you can pass the +\fI\%U\fP modifier to write actual timestamps and UIDs/GIDs. +.UNINDENT +.UNINDENT +.sp +\fIWindows Paths\fP +.INDENT 0.0 +.INDENT 3.5 +When on Windows \fBllvm\-ar\fP treats the names of archived \fIfiles\fP in the same +case sensitive manner as the operating system. When on a non\-Windows machine +\fBllvm\-ar\fP does not consider character case. +.UNINDENT +.UNINDENT +.SH OPTIONS +.sp +\fBllvm\-ar\fP operations are compatible with other \fBar\fP +implementations. However, there are a few modifiers (\fI\%L\fP) that are not +found in other \fBar\fP implementations. The options for +\fBllvm\-ar\fP specify a single basic Operation to perform on the archive, +a variety of Modifiers for that Operation, the name of the archive file, and an +optional list of file names. If the \fIfiles\fP option is not specified, it +generally means either "none" or "all" members, depending on the operation. The +Options, Operations and Modifiers are explained in the sections below. +.sp +The minimal set of options is at least one operator and the name of the +archive. +.SS Operations +.INDENT 0.0 +.TP +.B d [NT] +Delete files from the \fBarchive\fP\&. The \fI\%N\fP and \fI\%T\fP modifiers +apply to this operation. The \fIfiles\fP options specify which members should be +removed from the archive. It is not an error if a specified file does not +appear in the archive. If no \fIfiles\fP are specified, the archive is not +modified. +.UNINDENT +.INDENT 0.0 +.TP +.B m [abi] +Move files from one location in the \fBarchive\fP to another. The \fI\%a\fP, +\fI\%b\fP, and \fI\%i\fP modifiers apply to this operation. The \fIfiles\fP +will all be moved to the location given by the modifiers. If no modifiers are +used, the files will be moved to the end of the archive. If no \fIfiles\fP are +specified, the archive is not modified. +.UNINDENT +.INDENT 0.0 +.TP +.B p [v] +Print \fIfiles\fP to the standard output stream. If no \fIfiles\fP are specified, the +entire \fBarchive\fP is printed. With the \fI\%v\fP modifier, +\fBllvm\-ar\fP also prints out the name of the file being output. Printing +binary files is ill\-advised as they might confuse your terminal settings. The +\fI\%p\fP operation never modifies the archive. +.UNINDENT +.INDENT 0.0 +.TP +.B q [LT] +Quickly append files to the end of the \fBarchive\fP without removing +duplicates. If no \fIfiles\fP are specified, the archive is not modified. The +behavior when appending one archive to another depends upon whether the +\fI\%L\fP and \fI\%T\fP modifiers are used: +.INDENT 7.0 +.IP \(bu 2 +Appending a regular archive to a regular archive will append the archive +file. If the \fI\%L\fP modifier is specified the members will be appended +instead. +.IP \(bu 2 +Appending a regular archive to a thin archive requires the \fI\%T\fP +modifier and will append the archive file. The \fI\%L\fP modifier is not +supported. +.IP \(bu 2 +Appending a thin archive to a regular archive will append the archive file. +If the \fI\%L\fP modifier is specified the members will be appended +instead. +.IP \(bu 2 +Appending a thin archive to a thin archive will always quick append its +members. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B r [abTu] +Replace existing \fIfiles\fP or insert them at the end of the \fBarchive\fP if +they do not exist. The \fI\%a\fP, \fI\%b\fP, \fI\%T\fP and \fI\%u\fP +modifiers apply to this operation. If no \fIfiles\fP are specified, the archive +is not modified. +.UNINDENT +.sp +t[v] +\&.. option:: t [vO] +.INDENT 0.0 +.INDENT 3.5 +Print the table of contents. Without any modifiers, this operation just prints +the names of the members to the standard output stream. With the \fI\%v\fP +modifier, \fBllvm\-ar\fP also prints out the file type (B=bitcode, +S=symbol table, blank=regular file), the permission mode, the owner and group, +are ignored when extracting \fIfiles\fP and set to placeholder values when adding +size, and the date. With the \fI\%O\fP modifier, display member offsets. If +any \fIfiles\fP are specified, the listing is only for those files. If no \fIfiles\fP +are specified, the table of contents for the whole archive is printed. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B V +A synonym for the \fI\%\-\-version\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B x [oP] +Extract \fBarchive\fP members back to files. The \fI\%o\fP modifier applies +to this operation. This operation retrieves the indicated \fIfiles\fP from the +archive and writes them back to the operating system\(aqs file system. If no +\fIfiles\fP are specified, the entire archive is extracted. +.UNINDENT +.SS Modifiers (operation specific) +.sp +The modifiers below are specific to certain operations. See the Operations +section to determine which modifiers are applicable to which operations. +.INDENT 0.0 +.TP +.B a +When inserting or moving member files, this option specifies the destination +of the new files as being after the \fIrelpos\fP member. If \fIrelpos\fP is not found, +the files are placed at the end of the \fBarchive\fP\&. \fIrelpos\fP cannot be +consumed without either \fI\%a\fP, \fI\%b\fP or \fI\%i\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B b +When inserting or moving member files, this option specifies the destination +of the new files as being before the \fIrelpos\fP member. If \fIrelpos\fP is not +found, the files are placed at the end of the \fBarchive\fP\&. \fIrelpos\fP cannot +be consumed without either \fI\%a\fP, \fI\%b\fP or \fI\%i\fP\&. This +modifier is identical to the \fI\%i\fP modifier. +.UNINDENT +.INDENT 0.0 +.TP +.B i +A synonym for the \fI\%b\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B L +When quick appending an \fBarchive\fP, instead quick append its members. This +is a feature for \fBllvm\-ar\fP that is not found in gnu\-ar. +.UNINDENT +.INDENT 0.0 +.TP +.B N +When extracting or deleting a member that shares its name with another member, +the \fIcount\fP parameter allows you to supply a positive whole number that +selects the instance of the given name, with "1" indicating the first +instance. If \fI\%N\fP is not specified the first member of that name will +be selected. If \fIcount\fP is not supplied, the operation fails.*count* cannot be +.UNINDENT +.INDENT 0.0 +.TP +.B o +When extracting files, use the modification times of any \fIfiles\fP as they +appear in the \fBarchive\fP\&. By default \fIfiles\fP extracted from the archive +use the time of extraction. +.UNINDENT +.INDENT 0.0 +.TP +.B O +Display member offsets inside the archive. +.UNINDENT +.INDENT 0.0 +.TP +.B T +When creating or modifying an archive, this option specifies that the +\fBarchive\fP will be thin. By default, archives are not created as thin +archives and when modifying a thin archive, it will be converted to a regular +archive. +.UNINDENT +.INDENT 0.0 +.TP +.B v +When printing \fIfiles\fP or the \fBarchive\fP table of contents, this modifier +instructs \fBllvm\-ar\fP to include additional information in the output. +.UNINDENT +.SS Modifiers (generic) +.sp +The modifiers below may be applied to any operation. +.INDENT 0.0 +.TP +.B c +For the \fI\%r\fP (replace)and \fI\%q\fP (quick update) operations, +\fBllvm\-ar\fP will always create the archive if it doesn\(aqt exist. +Normally, \fBllvm\-ar\fP will print a warning message indicating that the +\fBarchive\fP is being created. Using this modifier turns off +that warning. +.UNINDENT +.INDENT 0.0 +.TP +.B D +Use zero for timestamps and UIDs/GIDs. This is set by default. +.UNINDENT +.INDENT 0.0 +.TP +.B P +Use full paths when matching member names rather than just the file name. +This can be useful when manipulating an \fBarchive\fP generated by another +archiver, as some allow paths as member names. This is the default behavior +for thin archives. +.UNINDENT +.INDENT 0.0 +.TP +.B s +This modifier requests that an archive index (or symbol table) be added to the +\fBarchive\fP, as if using ranlib. The symbol table will contain all the +externally visible functions and global variables defined by all the bitcode +files in the archive. By default \fBllvm\-ar\fP generates symbol tables in +archives. This can also be used as an operation. +.UNINDENT +.INDENT 0.0 +.TP +.B S +This modifier is the opposite of the \fI\%s\fP modifier. It instructs +\fBllvm\-ar\fP to not build the symbol table. If both \fI\%s\fP and +\fI\%S\fP are used, the last modifier to occur in the options will prevail. +.UNINDENT +.INDENT 0.0 +.TP +.B u +Only update \fBarchive\fP members with \fIfiles\fP that have more recent +timestamps. +.UNINDENT +.INDENT 0.0 +.TP +.B U +Use actual timestamps and UIDs/GIDs. +.UNINDENT +.SS Other +.INDENT 0.0 +.TP +.B \-\-format= +This option allows for default, gnu, darwin or bsd \fB\fP to be selected. +When creating an \fBarchive\fP, \fB\fP will default to that of the host +machine. +.UNINDENT +.INDENT 0.0 +.TP +.B \-h, \-\-help +Print a summary of command\-line options and their meanings. +.UNINDENT +.INDENT 0.0 +.TP +.B \-M +This option allows for MRI scripts to be read through the standard input +stream. No other options are compatible with this option. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-ar\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B @ +Read command\-line options and commands from response file \fB\fP\&. +.UNINDENT +.SH MRI SCRIPTS +.sp +\fBllvm\-ar\fP understands a subset of the MRI scripting interface commonly +supported by archivers following in the ar tradition. An MRI script contains a +sequence of commands to be executed by the archiver. The \fI\%\-M\fP option +allows for an MRI script to be passed to \fBllvm\-ar\fP through the +standard input stream. +.sp +Note that \fBllvm\-ar\fP has known limitations regarding the use of MRI +scripts: +.INDENT 0.0 +.IP \(bu 2 +Each script can only create one archive. +.IP \(bu 2 +Existing archives can not be modified. +.UNINDENT +.SS MRI Script Commands +.sp +Each command begins with the command\(aqs name and must appear on its own line. +Some commands have arguments, which must be separated from the name by +whitespace. An MRI script should begin with either a \fI\%CREATE\fP or +\fI\%CREATETHIN\fP command and will typically end with a \fI\%SAVE\fP +command. Any text after either \(aq*\(aq or \(aq;\(aq is treated as a comment. +.INDENT 0.0 +.TP +.B CREATE archive +Begin creation of a regular archive with the specified name. Subsequent +commands act upon this \fBarchive\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B CREATETHIN archive +Begin creation of a thin archive with the specified name. Subsequent +commands act upon this \fBarchive\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B ADDLIB archive +Append the contents of \fBarchive\fP to the current archive. +.UNINDENT +.INDENT 0.0 +.TP +.B ADDMOD +Append \fB\fP to the current archive. +.UNINDENT +.INDENT 0.0 +.TP +.B DELETE +Delete the member of the current archive whose file name, excluding directory +components, matches \fB\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B SAVE +Write the current archive to the path specified in the previous +\fI\%CREATE\fP/\fI\%CREATETHIN\fP command. +.UNINDENT +.INDENT 0.0 +.TP +.B END +Ends the MRI script (optional). +.UNINDENT +.SH EXIT STATUS +.sp +If \fBllvm\-ar\fP succeeds, it will exit with 0. Otherwise, if an error occurs, it +will exit with a non\-zero value. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2021, LLVM Project +.\" Generated by docutils manpage writer. +. diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 2406339b569..a23500e7e03 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.own.mk,v 1.211 2021/08/21 03:00:02 gkoehler Exp $ +# $OpenBSD: bsd.own.mk,v 1.212 2021/11/23 10:30:08 robert Exp $ # $NetBSD: bsd.own.mk,v 1.24 1996/04/13 02:08:09 thorpej Exp $ # Host-specific overrides @@ -51,8 +51,10 @@ BUILD_CLANG?=no .if !empty(LLD_ARCH:M${_arch}) LINKER_VERSION?=lld +AR_VERSION?=llvm .else LINKER_VERSION?=bfd +AR_VERSION?=binutils .endif .if !empty(STATICPIE_ARCH:M${_arch})