Commit Graph

223 Commits

Author SHA1 Message Date
dim
e9d5da2647 Update build glue for a build of clang plus lldb (enabled via MK_LLDB). 2019-08-26 21:00:14 +00:00
dim
006dcf6159 Add lldb-tblgen tool. 2019-08-26 20:57:45 +00:00
dim
a55b60f01d Update build glue for a build of clang plus lld (enabled via MK_LLD). 2019-08-24 22:07:38 +00:00
dim
3778091671 Update build glue for a build of clang plus the extra tools (enabled via
MK_CLANG_EXTRAS).
2019-08-24 19:21:11 +00:00
dim
1d195d9a3a Update build glue for a minimal build of the clang executable. 2019-08-23 22:17:36 +00:00
emaste
01b5874679 build llvm-ar and llvm-nm with Clang (promote out of CLANG_EXTRAS)
To facilitate experimentation with LTO we require an ar that supports
LLVM IR, and to a lesser degree also an nm.  As a first step always
install llvm-ar and llvm-nm.

Sponsored by:	The FreeBSD Foundation
2019-06-04 13:00:49 +00:00
kevans
0a5977d317 llvm-symbolizer: Move out of CLANG_EXTRAS, into CLANG
ASAN reports become a lot more useful with llvm-symbolizer in $PATH, and the
build is not much more time-consuming. The added benefit is that the
resulting reports will actually include symbol information; without, thread
trace information includes a bunch of addresses that immediately resolve to
an inline function in
^/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common.h and take a
little more effort to examine.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20484
2019-06-02 04:04:21 +00:00
dim
c2da3525dc Merge ^/head r344178 through r344512. 2019-02-25 11:59:29 +00:00
emaste
33a9dab77f Add WITH_PIE knob to build Position Independent Executables
Building binaries as PIE allows the executable itself to be loaded at a
random address when ASLR is enabled (not just its shared libraries).

With this change PIE objects have a .pieo extension and INTERNALLIB
libraries libXXX_pie.a.

MK_PIE is disabled for some kerberos5 tools, Clang, and Subversion, as
they explicitly reference .a libraries in their Makefiles.  These can
be addressed on an individual basis later.  MK_PIE is also disabled for
rtld-elf because it is already position-independent using bespoke
Makefile rules.

Currently only dynamically linked binaries will be built as PIE.

Discussed with:	dim
Reviewed by:	kib
MFC after:	1 month
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18423
2019-02-15 22:22:38 +00:00
dim
4aff0f42d5 Remove customizations in #includes of Options.inc, and adjust lld
Makefile to generate the file in the right place.
2019-01-22 18:04:40 +00:00
dim
5a0b6c1b01 Update lldb build glue to make MK_LLDB=yes work. 2019-01-22 18:03:45 +00:00
dim
e5deb31009 Update lld build glue to make MK_LLD=yes work. 2019-01-21 20:23:18 +00:00
dim
d25b4345c8 Update llvm and clang build glue to make MK_CLANG_EXTRAS=yes and
MK_CLANG_FULL=yes work.
2019-01-21 19:39:35 +00:00
dim
46df0db512 Update libllvmminimal and llvm-tblgen Makefiles, so llvm-tblgen and
clang-tblgen can build.
2019-01-20 18:53:32 +00:00
dim
07b9c9ba27 Merge ^/head r340918 through r341763. 2018-12-09 11:39:45 +00:00
emaste
6fe0619e63 llvm-objdump.1: remove more unintentional options
Some options come from static constructors in LLVM libraries and are
automatically added to llvm's usage output.  They're not really supposed
to be llvm-objdump options.

Reported by:	Fangrui Song in LLVM review D54864
Sponsored by:	The FreeBSD Foundation
2018-11-27 13:52:51 +00:00
emaste
7e0203a8d2 llvm-objdump.1: fix igor / mandoc -Tlint warnings
Accidentally omitted from r340972.
2018-11-26 15:12:58 +00:00
emaste
8488c0b282 llvm-objdump.1: remove invalid options
Some options appear in llvm-objdump's usage information as a side effect
of its option parsing implementation and are not actually llvm-objdump
options.  Reported in LLVM review https://reviews.llvm.org/D54864.

Reported by:	Fangrui Song
Sponsored by:	The FreeBSD Foundation
2018-11-26 14:45:58 +00:00
emaste
b4343b7d10 llvm-objdump: initial man page
Based on llvm-objdump's online documentation and usage information.
This serves as a starting point; additional detail and cleanup still
required.

Also being submitted upstream in LLVM review D54864.  I expect to use
this bespoke copy while we have LLVM 6.0 or 7.0 in FreeBSD; when we
update to LLVM 8.0 it should be upstream and we will switch to it.

PR:		233437
Reviewed by:	bcr (man formatting)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18309
2018-11-26 14:34:30 +00:00
dim
0838f433ff Merge ^/head r340235 through r340367. 2018-11-12 16:41:41 +00:00
emaste
9ee3eadfc8 Move llvm-profdata build into MK_LLVM_COV block
llvm-profdata is used with llvm-cov for code coverage (although llvm-cov
can also operate independently in a gcov-compatible mode).
Although llvm-profdata can be used independently of llvm-cov it makes
sense to group these under one option.

Also handle these in OptionalObsoleteFiles.inc while here.

Sponsored by:	The FreeBSD Foundation
2018-11-09 18:35:09 +00:00
emaste
d4894c17be llvm-cov: also install as gcov (if GNU gcov is disabled)
llvm-cov provides a gcov-compatible interface when invoked as gcov.

Reviewed by:	dim, markj
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17923
2018-11-09 17:43:19 +00:00
emaste
b60a07595c lld: add -z interpose support
-z interpose sets the DF_1_INTERPOSE flag, marking the object as an
interposer.

Committed upstream as LLVM r342239.

PR:		230604
Reported by:	jbeich
Reviewed by:	markj
Approved by:	re (kib)
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17172
2018-09-14 15:15:16 +00:00
markj
401e64920a Add an lld option to emit PC-relative relocations for ifunc calls.
The current kernel ifunc implementation creates a PLT entry for each
ifunc definition.  ifunc calls therefore consist of a call to the
PLT entry followed by an indirect jump.  The jump target is written
during boot when the kernel linker resolves R_[*]_IRELATIVE relocations.
This implementation is defined by requirements for userland code, where
text relocations are avoided.  This requirement is not present for the
kernel, so the implementation has avoidable overhead (namely, an extra
indirect jump per call).

Address this for now by adding a special option to the static linker
to inhibit PLT creation for ifuncs.  Instead, relocations to ifunc call
sites are passed through to the output file, so the kernel linker can
enumerate such call sites and apply PC-relative relocations directly
to the text section.  Thus the overhead of an ifunc call becomes exactly
the same as that of an ordinary function call.  This option is only for
use by the kernel and will not work for regular programs.

The final form of this optimization is up for debate; for now, this
change is simple and static enough to be acceptable as an interim
solution.

Reviewed by:	emaste
Discussed with:	arichardson, dim
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D16748
2018-08-23 14:58:19 +00:00
emaste
56684e5305 lld: use now-upstream ld.lld.1 2018-08-02 20:31:54 +00:00
dim
3b99b63c48 Regenerate clang.1. 2018-08-02 19:19:53 +00:00
dim
6e89d93d6a Update llvm tool manpages, and llvm-mca.1. 2018-08-02 19:11:56 +00:00
dim
7ce555a0d9 Update build glue to make WITH_LLD work. 2018-08-02 06:26:51 +00:00
dim
8d520fd045 Update build blue to make WITH_CLANG_EXTRAS and WITH_CLANG_FULL work. 2018-08-01 20:46:06 +00:00
dim
1b47e21cea Make the minimal clang executable build. 2018-07-31 21:07:20 +00:00
dim
3710871d90 Remove SRCS for files that have been deleted upstream. 2018-07-31 18:32:57 +00:00
dim
95d6f64433 Make llvm-tblgen and clang-tblgen build. 2018-07-31 18:25:33 +00:00
bdrewery
b557130a94 Rework how the ld link is handled in WORLDTMP from r322811.
LLD_BOOTSTRAP (build) is independent of LLD_IS_LD (installed) so they
should not be based on each other.

This is related to upcoming WITH_SYSTEM_LINKER work.

Reviewed by:	emaste
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D15836
2018-06-20 16:10:02 +00:00
dim
4b91ca5ee1 Regenerate clang man page after upstream change to document the possible
values for the -std= option.

Noticed by:	Steve Kargl
Obtained from:	https://reviews.llvm.org/rL329827
MFC after:	3 days
2018-04-11 18:39:47 +00:00
emaste
b93a9fbc91 Promote llvm-cov to a standalone option
Introduce WITH_/WITHOUT_LLVM_COV to match GCC's WITH_/WITHOUT_GCOV.
It is intended to provide a superset of the interface and functionality
of gcov.

It is enabled by default when building Clang, similarly to gcov and GCC.

This change moves one file in libllvm to be compiled unconditionally.
Previously it was included only when WITH_CLANG_EXTRAS was set, but the
complexity of a new special case for (CLANG_EXTRAS | LLVM_COV) is not
worth avoiding a tiny increase in build time.

Reviewed by:	dim, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D142645
2018-02-10 00:22:35 +00:00
emaste
346e102df0 ld.lld.1: explain long options may use one or two dashes 2018-02-08 00:09:17 +00:00
emaste
b3f3d10dc5 Update ld.lld.1 based on the version committed upstream 2018-02-07 23:58:00 +00:00
emaste
a2b20ce02f ld.lld.1: miscellaneous style improvements
Submitted by:	wblock in review D13813
2018-02-02 21:52:00 +00:00
dim
5473ed2089 Build llvm-extract with -lz, and add a few objects to liblldb, both of
which turn out to be needed when you don't use -ffunction-sections.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
2018-01-13 13:53:05 +00:00
dim
b64d96a23d Merge ^/head r327624 through r327885. 2018-01-12 18:23:35 +00:00
emaste
124746b920 lld: introduce basic man page
Upstream lld has no man page. Introduce a basic one for FreeBSD based on
ld.lld --help, with a brief introduction and additional detail for some
options.

We'll continue refining this in FreeBSD, and then submit it upstream once
the first round of edits are complete.

Submitted by:	krion, Arshan Khanifar, emaste, bjk
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13813
2018-01-10 16:01:25 +00:00
dim
d70df7c872 Regenerate clang manpage. 2017-12-24 13:06:37 +00:00
dim
6bab44f391 Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
dim
47fdbb772b Minimize library dependencies for some llvm tools. 2017-12-24 12:42:30 +00:00
dim
ef75509313 Add new llvm-objcopy utility, enabled when MK_CLANG_EXTRAS=yes. 2017-12-24 12:36:31 +00:00
dim
2bcccfe68a Update clang, lld and llvm version numbers for r321414, and update build
glue.
2017-12-24 12:32:55 +00:00
dim
d062dc1876 Next step in updating llvm/clang build glue: make lld build. 2017-12-22 16:27:29 +00:00
dim
196fc344f1 Next step in updating llvm/clang build glue: make the optional llvm and
clang tools build.
2017-12-22 13:28:10 +00:00
dim
ce14442b6c First step in updating llvm/clang build glue: make only the clang
executable build.
2017-12-21 21:24:52 +00:00
bdrewery
a598c4b809 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00