Commit graph

575 commits

Author SHA1 Message Date
Dimitry Andric 0bf31f1fdc Update version numbers, and regenerate config headers for llvm, clang,
lld and lldb.  Update ObsoleteFiles.inc and OptionalObsoleteFiles.inc.
2019-01-20 18:34:30 +00:00
Dimitry Andric 176fdeee33 Update clang, llvm, lld, lldb, compiler-rt and libc++ version number to
7.0.1 release r349250.  There were no functional changes since the 7.0.1
rc3 import.

PR:		230240, 230355
Relnotes:	yes
MFC after:	2 months
X-MFC-With:	r341825
2018-12-15 14:08:41 +00:00
Dimitry Andric 0b9890fcbf Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r348686 (effectively 7.0.1 rc3), resolve conflicts, and bump version
numbers.

PR:		230240, 230355
2018-12-09 11:36:04 +00:00
Dimitry Andric 9b5cb2f639 Merge ^/head r340235 through r340367. 2018-11-12 16:41:41 +00:00
Ed Maste 961eb44346 libllvm: Move SampleProfWriter to SRCS_MIN
It is required by llvm-profdata, now built by default under the
LLVM_COV knob.  The additional complexity that would come from avoiding
building it if CLANG_EXTRAS and LLVM_COV are both disabled is not worth
the small savings in build time.

Sponsored by:	The FreeBSD Foundation
2018-11-09 19:51:26 +00:00
Dimitry Andric f46f6c14b4 Update LLVM_VERSION_PATCH define in llvm-config.h. 2018-11-04 17:56:09 +00:00
Dimitry Andric 689486003b Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r346007 (effectively 7.0.1 rc2), resolve conflicts, and bump version
numbers.

PR:		230240, 230355
2018-11-04 15:46:30 +00:00
Dimitry Andric c6879c6c14 Merge ^/head r339015 through r339669. 2018-10-23 21:09:37 +00:00
Glen Barber 91e8ea7f5c Comment -DNDEBUG in head after r339436 when head was switched
from 12.0-ALPHA10 to 13.0-CURRENT.  This edit was a mistake,
and should have been applied to stable/12 upon branching, not
head.

Reported by:	jbeich, dim
Sponsored by:	The FreeBSD Foundation
2018-10-21 15:54:38 +00:00
Ed Maste b0bffd128c Bump LLD_REVISION_STRING for 13-CURRENT 2018-10-20 17:42:38 +00:00
Glen Barber b958317950 - Update head to 13.0-CURRENT.
- Bump MACHINE_TRIPLE, TARGET_TRIPLE, FBSD_MAJOR, FBSD_CC_VER,
  FREEBSD_CC_VERSION, OS_VERSION.
- Update comment in UPDATING regarding debugging options.
- Remove debug.witness.trace=0 from installation media.
- Bump __FreeBSD_version.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-10-19 00:37:47 +00:00
Ed Maste b371a9f082 lld: set sh_link and sh_info for .rela.plt sections
ELF spec says that for SHT_REL and SHT_RELA sh_link should reference the
associated string table and sh_info should reference the "section to
which the relocation applies."  ELF Tool Chain's elfcopy / strip use
this (in part) to control whether or not the relocation entry is copied
to the output.

LLVM PR 37538 https://bugs.llvm.org/show_bug.cgi?id=37538

Approved by:	re (kib)
Obtained from:	llvm r344226 (backported for 6.0)
2018-10-11 13:19:17 +00:00
Ed Maste ea28e71e86 clang: allow ifunc resolvers to accept arguments
Previously Clang required ifunc resolution functions to take no
arguments, presumably because GCC documented ifunc resolvers as taking
no arguments.  However, GCC accepts resolvers accepting arguments, and
our rtld passes CPU ID information (cpuid, hwcap, etc.) to ifunc
resolvers.  Just remove the check from the in-tree compiler for our in-
tree compiler; a different (per-OS) approach may be required upstream.

Reported by:	mjg
Approved by:	re (rgrimes)
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2018-09-29 20:01:23 +00:00
Dimitry Andric 38fb40102a Merge llvm, clang, lld, lldb, compiler-rt and libc++ 7.0.0 release
r342383, and bump version numbers.

PR:		230240, 230355
2018-09-17 19:04:15 +00:00
Dimitry Andric c826f0db60 Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r341916, resolve conflicts, and bump version numbers.

PR:		230240, 230355
2018-09-11 18:50:40 +00:00
Dimitry Andric 8ba00cf9b7 Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r340910, resolve conflicts, and bump version numbers.

PR:		230240, 230355
2018-08-29 20:53:24 +00:00
Dimitry Andric 7726714dff Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r339999, resolve conflicts, and bump version numbers.

PR:		230240,230355
2018-08-18 12:11:17 +00:00
Dimitry Andric 3beb5372da Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r339355, resolve conflicts, and bump version numbers.
2018-08-11 16:40:03 +00:00
Dimitry Andric f9c0a51283 Merge ^/head r337286 through r337585. 2018-08-10 21:02:28 +00:00
Dimitry Andric 89edb881e6 Add optional LLVM BPF target support
BPF (eBPF) is an independent instruction set architecture which is
introduced in Linux a few years ago. Originally, eBPF execute
environment was only inside Linux kernel. However, recent years there
are some user space implementation (https://github.com/iovisor/ubpf,
https://doc.dpdk.org/guides/prog_guide/bpf_lib.html) and kernel space
implementation for FreeBSD is going on
(https://github.com/YutaroHayakawa/generic-ebpf).

The BPF target support can be enabled using WITH_LLVM_TARGET_BPF, as it
is not built by default.

Submitted by:	Yutaro Hayakawa <yhayakawa3720@gmail.com>
Reviewed by:	dim, bdrewery
Differential Revision: https://reviews.freebsd.org/D16033
2018-08-09 21:28:31 +00:00
Dimitry Andric 2d31b1b89c The JSON support needs one more file in libllvm, again for llvm-tblgen. 2018-08-04 14:24:23 +00:00
Dimitry Andric d25b9f8f42 Add one more file to libllvm, needed for llvm-tblgen. 2018-08-04 14:16:34 +00:00
Dimitry Andric 84ba35dc8d Bump clang and lld upstream revision numbers. 2018-08-04 13:39:44 +00:00
Dimitry Andric 99be4f2a04 Update build glue for upstream r338536 import. 2018-08-02 19:32:32 +00:00
Dimitry Andric 0fecf00141 Bump revisions to r338536, and also bump lld version again. 2018-08-02 18:09:18 +00:00
Dimitry Andric 532d894041 Update build glue to make WITH_LLDB work. 2018-08-02 16:08:16 +00:00
Dimitry Andric 67b158f6ad Update build blue to make WITH_CLANG_EXTRAS and WITH_CLANG_FULL work. 2018-08-01 20:46:06 +00:00
Dimitry Andric 9f6e9a9f35 Make the minimal clang executable build. 2018-07-31 21:07:20 +00:00
Ed Maste 837f338599 bump lld version number after r336972 arm(v7) VFP tag support
Reported by:	kevans
Sponsored by:	The FreeBSD Foundation
2018-07-31 21:06:28 +00:00
Dimitry Andric 611d080e06 Update clang intrinsics headers. 2018-07-31 21:06:13 +00:00
Ed Maste 499e3cf250 Remove presumed editor dropping from r336988 2018-07-31 19:35:34 +00:00
Dimitry Andric d1efe5165c Remove SRCS for files that have been deleted upstream. 2018-07-31 18:32:57 +00:00
Dimitry Andric 25194b54ad Make llvm-tblgen and clang-tblgen build. 2018-07-31 18:25:33 +00:00
Dimitry Andric 6dfa117f67 Update llvm/clang version numbers in various files. 2018-07-31 18:13:44 +00:00
Ed Maste e92a42059b llvm: remove __FreeBSD_version conditionals
All supported FreeBSD build host versions have backtrace.h, so we can
just eliminate that test.  For futimes() we can test the compiler's
built-in __FreeBSD__ major version rather than relying on including
osreldate.h.  This should reduce the frequency with which Clang gets
rebuilt when building world.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
2018-07-25 00:06:18 +00:00
Dimitry Andric 55458465af More follow-up to r335799 (llvm/clang 6.0.1 update), where I forgot to
update mtree files, ObsoleteFiles and a number of other paths.  Sorry
about all the breakage.

Pointy hat to:	me
MFC after:	2 weeks
X-MFC-With:	r335799
2018-06-30 15:03:22 +00:00
Dimitry Andric fbfca78ed2 Follow-up to r335799 (llvm/clang 6.0.1 update), by regenerating various
headers with new version information defines.

MFC after:	2 weeks
X-MFC-With:	r335799
2018-06-30 10:04:44 +00:00
Dimitry Andric 6ccc06f6cb Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.1 release (upstream r335540).

Relnotes:	yes
MFC after:	2 weeks
2018-06-29 17:51:35 +00:00
Bryan Drewery caf90252d5 Revert r335449 and add needed MK_LLD_BOOTSTRAP check for SRCS_MIW.
This effectively reverts r335449 and changes the previous MK_LLD_IS_LD
to a MK_LLD_BOOTSTRAP check.  If !TOOLS_PREFIX then these sources are
always built for llvm-objdump, lld, and llvm-cov.  When TOOLS_PREFIX
is set then they are only needed if lld is being bootstrapped.

Reported by:	dim
Pointyhat to:	bdrewery
Sponsored by:	Dell EMC
2018-06-22 17:58:56 +00:00
Dimitry Andric cbafd2630b Add support for selectively enabling LLVM targets
This makes it possible, through src.conf(5) settings, to select which
LLVM targets you want to build during buildworld.  The current list is:

* (WITH|WITHOUT)_LLVM_TARGET_AARCH64
* (WITH|WITHOUT)_LLVM_TARGET_ARM
* (WITH|WITHOUT)_LLVM_TARGET_MIPS
* (WITH|WITHOUT)_LLVM_TARGET_POWERPC
* (WITH|WITHOUT)_LLVM_TARGET_SPARC
* (WITH|WITHOUT)_LLVM_TARGET_X86

To not influence anything right now, all of these are on by default, in
situations where clang is enabled.

Selectively turning a few targets off manually should work.  Turning on
only one target should work too, even if that target does not correspond
to the build architecture.  (In that case, LLVM_NATIVE_ARCH will not be
defined, and you can only use the resulting clang executable for
cross-compiling.)

I performed a few measurements on one of the FreeBSD.org reference
machines, building clang from scratch, with all targets enabled, and
with only the x86 target enabled.  The latter was ~12% faster in real
time (on a 32-core box), and ~14% faster in user time.  For a full
buildworld the difference will probably be less pronounced, though.

Reviewed by:	bdrewery
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D11077
2018-06-22 15:00:00 +00:00
Bryan Drewery a883ed8c1d Fix sources needed for lld.
lld always needs these DWARF sources, as well as other default and extra
tools. XDL seems to be the best fit list.

Remove MK_LLD_IS_LD check from SRCS_MIW which is now reduced to just a
few files for llvm-objdump.

Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D15915
2018-06-20 16:10:10 +00:00
Bryan Drewery 781872781e Rework WITHOUT_LLD/TOOLCHAIN fix from r327892 for cross-tools.
MK_LLD is for the installed lld while MK_LLD_BOOTSTRAP is for the build
tool.  For WITH_SYSTEM_LINKER it is necesarry to separate the logic of
these two.  When building libllvm TOOLS_PREFIX will be defined and
MK_LLD_BOOTSTRAP should be checked instead.

Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D15837
2018-06-20 16:10:07 +00:00
Ed Maste 19703503ba lld: Omit PT_NOTE for SHT_NOTE without SHF_ALLOC
A non-alloc note section should not have a PT_NOTE program header.

Found while linking ghc (Haskell compiler) with lld on FreeBSD.  Haskell
emits a .debug-ghc-link-info note section (as the name suggests, it
contains link info) as a SHT_NOTE section without SHF_ALLOC set.

For this case ld.bfd does not emit a PT_NOTE segment for
.debug-ghc-link-info.  lld previously emitted a PT_NOTE with p_vaddr = 0
and FreeBSD's rtld segfaulted when trying to parse a note at address 0.

LLVM PR:	https://llvm.org/pr37361
LLVM review:	https://reviews.llvm.org/D46623

PR:		226872
Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
2018-05-09 11:17:01 +00:00
Dimitry Andric 0556cfadc2 Recommit r332501, with an additional upstream fix for "Cannot lower
EFLAGS copy that lives out of a basic block!" errors on i386.

Pull in r325446 from upstream clang trunk (by me):

  [X86] Add 'sahf' CPU feature to frontend

  Summary:
  Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the
  `+sahf` feature for the backend, for bug 36028 (Incorrect use of
  pushf/popf enables/disables interrupts on amd64 kernels).  This was
  originally submitted in bug 36037 by Jonathan Looney
  <jonlooney@gmail.com>.

  As described there, GCC also uses `-msahf` for this feature, and the
  backend already recognizes the `+sahf` feature. All that is needed is
  to teach clang to pass this on to the backend.

  The mapping of feature support onto CPUs may not be complete; rather,
  it was chosen to match LLVM's idea of which CPUs support this feature
  (see lib/Target/X86/X86.td).

  I also updated the affected test case (CodeGen/attr-target-x86.c) to
  match the emitted output.

  Reviewers: craig.topper, coby, efriedma, rsmith

  Reviewed By: craig.topper

  Subscribers: emaste, cfe-commits

  Differential Revision: https://reviews.llvm.org/D43394

Pull in r328944 from upstream llvm trunk (by Chandler Carruth):

  [x86] Expose more of the condition conversion routines in the public
  API for X86's instruction information. I've now got a second patch
  under review that needs these same APIs. This bit is nicely
  orthogonal and obvious, so landing it. NFC.

Pull in r329414 from upstream llvm trunk (by Craig Topper):

  [X86] Merge itineraries for CLC, CMC, and STC.

  These are very simple flag setting instructions that appear to only
  be a single uop. They're unlikely to need this separation.

Pull in r329657 from upstream llvm trunk (by Chandler Carruth):

  [x86] Introduce a pass to begin more systematically fixing PR36028
  and similar issues.

  The key idea is to lower COPY nodes populating EFLAGS by scanning the
  uses of EFLAGS and introducing dedicated code to preserve the
  necessary state in a GPR. In the vast majority of cases, these uses
  are cmovCC and jCC instructions. For such cases, we can very easily
  save and restore the necessary information by simply inserting a
  setCC into a GPR where the original flags are live, and then testing
  that GPR directly to feed the cmov or conditional branch.

  However, things are a bit more tricky if arithmetic is using the
  flags.  This patch handles the vast majority of cases that seem to
  come up in practice: adc, adcx, adox, rcl, and rcr; all without
  taking advantage of partially preserved EFLAGS as LLVM doesn't
  currently model that at all.

  There are a large number of operations that techinaclly observe
  EFLAGS currently but shouldn't in this case -- they typically are
  using DF.  Currently, they will not be handled by this approach.
  However, I have never seen this issue come up in practice. It is
  already pretty rare to have these patterns come up in practical code
  with LLVM. I had to resort to writing MIR tests to cover most of the
  logic in this pass already.  I suspect even with its current amount
  of coverage of arithmetic users of EFLAGS it will be a significant
  improvement over the current use of pushf/popf. It will also produce
  substantially faster code in most of the common patterns.

  This patch also removes all of the old lowering for EFLAGS copies,
  and the hack that forced us to use a frame pointer when EFLAGS copies
  were found anywhere in a function so that the dynamic stack
  adjustment wasn't a problem. None of this is needed as we now lower
  all of these copies directly in MI and without require stack
  adjustments.

  Lots of thanks to Reid who came up with several aspects of this
  approach, and Craig who helped me work out a couple of things
  tripping me up while working on this.

  Differential Revision: https://reviews.llvm.org/D45146

Pull in r329673 from upstream llvm trunk (by Chandler Carruth):

  [x86] Model the direction flag (DF) separately from the rest of
  EFLAGS.

  This cleans up a number of operations that only claimed te use EFLAGS
  due to using DF. But no instructions which we think of us setting
  EFLAGS actually modify DF (other than things like popf) and so this
  needlessly creates uses of EFLAGS that aren't really there.

  In fact, DF is so restrictive it is pretty easy to model. Only STD,
  CLD, and the whole-flags writes (WRFLAGS and POPF) need to model
  this.

  I've also somewhat cleaned up some of the flag management instruction
  definitions to be in the correct .td file.

  Adding this extra register also uncovered a failure to use the
  correct datatype to hold X86 registers, and I've corrected that as
  necessary here.

  Differential Revision: https://reviews.llvm.org/D45154

Pull in r330264 from upstream llvm trunk (by Chandler Carruth):

  [x86] Fix PR37100 by teaching the EFLAGS copy lowering to rewrite
  uses across basic blocks in the limited cases where it is very
  straight forward to do so.

  This will also be useful for other places where we do some limited
  EFLAGS propagation across CFG edges and need to handle copy rewrites
  afterward. I think this is rapidly approaching the maximum we can and
  should be doing here. Everything else begins to require either heroic
  analysis to prove how to do PHI insertion manually, or somehow
  managing arbitrary PHI-ing of EFLAGS with general PHI insertion.
  Neither of these seem at all promising so if those cases come up,
  we'll almost certainly need to rewrite the parts of LLVM that produce
  those patterns.

  We do now require dominator trees in order to reliably diagnose
  patterns that would require PHI nodes. This is a bit unfortunate but
  it seems better than the completely mysterious crash we would get
  otherwise.

  Differential Revision: https://reviews.llvm.org/D45673

Together, these should ensure clang does not use pushf/popf sequences to
save and restore flags, avoiding problems with unrelated flags (such as
the interrupt flag) being restored unexpectedly.

Requested by:	jtl
PR:		225330
MFC after:	1 week
2018-04-20 18:20:55 +00:00
Ed Maste 0873080489 lld: use correct number of digits in __FreeBSD_version-style ID
__FreeBSD_version-style IDs should have 5 digits following the major.
2018-04-20 00:59:53 +00:00
Ed Maste 12881601e5 lld: add a __FreeBSD_version-style identifier to version
This will faciliate a WITH_SYSTEM_LINKER option.

Reviewed by:	dim
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D15110
2018-04-17 16:21:23 +00:00
Dimitry Andric 6ec30ab86a Revert r332501 for now, as it can cause build failures on i386.
Reported upstream as <https://bugs.llvm.org/show_bug.cgi?id=37133>.

Reported by:	emaste, ci.freebsd.org
PR:		225330
2018-04-14 14:57:32 +00:00
Dimitry Andric 0ae629bdd6 Pull in r325446 from upstream clang trunk (by me):
[X86] Add 'sahf' CPU feature to frontend

  Summary:
  Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the
  `+sahf` feature for the backend, for bug 36028 (Incorrect use of
  pushf/popf enables/disables interrupts on amd64 kernels).  This was
  originally submitted in bug 36037 by Jonathan Looney
  <jonlooney@gmail.com>.

  As described there, GCC also uses `-msahf` for this feature, and the
  backend already recognizes the `+sahf` feature. All that is needed is
  to teach clang to pass this on to the backend.

  The mapping of feature support onto CPUs may not be complete; rather,
  it was chosen to match LLVM's idea of which CPUs support this feature
  (see lib/Target/X86/X86.td).

  I also updated the affected test case (CodeGen/attr-target-x86.c) to
  match the emitted output.

  Reviewers: craig.topper, coby, efriedma, rsmith

  Reviewed By: craig.topper

  Subscribers: emaste, cfe-commits

  Differential Revision: https://reviews.llvm.org/D43394

Pull in r328944 from upstream llvm trunk (by Chandler Carruth):

  [x86] Expose more of the condition conversion routines in the public
  API for X86's instruction information. I've now got a second patch
  under review that needs these same APIs. This bit is nicely
  orthogonal and obvious, so landing it. NFC.

Pull in r329414 from upstream llvm trunk (by Craig Topper):

  [X86] Merge itineraries for CLC, CMC, and STC.

  These are very simple flag setting instructions that appear to only
  be a single uop. They're unlikely to need this separation.

Pull in r329657 from upstream llvm trunk (by Chandler Carruth):

  [x86] Introduce a pass to begin more systematically fixing PR36028
  and similar issues.

  The key idea is to lower COPY nodes populating EFLAGS by scanning the
  uses of EFLAGS and introducing dedicated code to preserve the
  necessary state in a GPR. In the vast majority of cases, these uses
  are cmovCC and jCC instructions. For such cases, we can very easily
  save and restore the necessary information by simply inserting a
  setCC into a GPR where the original flags are live, and then testing
  that GPR directly to feed the cmov or conditional branch.

  However, things are a bit more tricky if arithmetic is using the
  flags.  This patch handles the vast majority of cases that seem to
  come up in practice: adc, adcx, adox, rcl, and rcr; all without
  taking advantage of partially preserved EFLAGS as LLVM doesn't
  currently model that at all.

  There are a large number of operations that techinaclly observe
  EFLAGS currently but shouldn't in this case -- they typically are
  using DF.  Currently, they will not be handled by this approach.
  However, I have never seen this issue come up in practice. It is
  already pretty rare to have these patterns come up in practical code
  with LLVM. I had to resort to writing MIR tests to cover most of the
  logic in this pass already.  I suspect even with its current amount
  of coverage of arithmetic users of EFLAGS it will be a significant
  improvement over the current use of pushf/popf. It will also produce
  substantially faster code in most of the common patterns.

  This patch also removes all of the old lowering for EFLAGS copies,
  and the hack that forced us to use a frame pointer when EFLAGS copies
  were found anywhere in a function so that the dynamic stack
  adjustment wasn't a problem. None of this is needed as we now lower
  all of these copies directly in MI and without require stack
  adjustments.

  Lots of thanks to Reid who came up with several aspects of this
  approach, and Craig who helped me work out a couple of things
  tripping me up while working on this.

  Differential Revision: https://reviews.llvm.org/D45146

Pull in r329673 from upstream llvm trunk (by Chandler Carruth):

  [x86] Model the direction flag (DF) separately from the rest of
  EFLAGS.

  This cleans up a number of operations that only claimed te use EFLAGS
  due to using DF. But no instructions which we think of us setting
  EFLAGS actually modify DF (other than things like popf) and so this
  needlessly creates uses of EFLAGS that aren't really there.

  In fact, DF is so restrictive it is pretty easy to model. Only STD,
  CLD, and the whole-flags writes (WRFLAGS and POPF) need to model
  this.

  I've also somewhat cleaned up some of the flag management instruction
  definitions to be in the correct .td file.

  Adding this extra register also uncovered a failure to use the
  correct datatype to hold X86 registers, and I've corrected that as
  necessary here.

  Differential Revision: https://reviews.llvm.org/D45154

Together, these should ensure clang does not use pushf/popf sequences to
save and restore flags, avoiding problems with unrelated flags (such as
the interrupt flag) being restored unexpectedly.

Requested by:	jtl
PR:		225330
MFC after:	1 week
2018-04-14 12:07:05 +00:00
Dimitry Andric c5a4cd4f85 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 release (upstream r326565).

Release notes for llvm, clang and lld will be available here soon:
<http://releases.llvm.org/6.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/6.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/6.0.0/tools/lld/docs/ReleaseNotes.html>

Relnotes:	yes
MFC after:	3 months
X-MFC-With:	r327952
PR:		224669
2018-03-04 17:06:37 +00:00
Dimitry Andric 4f8786afe3 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r325932).  This corresponds to 6.0.0 rc3.

MFC after:	3 months
X-MFC-With:	r327952
PR:		224669
2018-02-25 13:20:32 +00:00
Dimitry Andric 954b921d66 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r325330).

MFC after:	3 months
X-MFC-With:	r327952
PR:		224669
2018-02-16 20:45:32 +00:00
Ed Maste 1b49115a40 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
Dimitry Andric 68a574863d Bump clang's __FreeBSD_cc_version, to cope with r328816, which removed
-Wno-error=tautological-constant-compare again (this flag is now out of
-Wextra after upstream https://reviews.llvm.org/rL322901).  Otherwise
the MK_SYSTEM_COMPILER logic will not build a cross-tools compiler.

Reported by:	jpaetzel, tuexen, Stefan Hagen
2018-02-04 20:33:47 +00:00
Dimitry Andric 07577dfe2e Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r324090).

This introduces retpoline support, with the -mretpoline flag.  The
upstream initial commit message (r323155 by Chandler Carruth) contains
quite a bit of explanation.  Quoting:

  Introduce the "retpoline" x86 mitigation technique for variant #2 of
  the speculative execution vulnerabilities disclosed today,
  specifically identified by CVE-2017-5715, "Branch Target Injection",
  and is one of the two halves to Spectre.

  Summary:
  First, we need to explain the core of the vulnerability. Note that
  this is a very incomplete description, please see the Project Zero
  blog post for details:
  https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html

  The basis for branch target injection is to direct speculative
  execution of the processor to some "gadget" of executable code by
  poisoning the prediction of indirect branches with the address of
  that gadget. The gadget in turn contains an operation that provides a
  side channel for reading data. Most commonly, this will look like a
  load of secret data followed by a branch on the loaded value and then
  a load of some predictable cache line. The attacker then uses timing
  of the processors cache to determine which direction the branch took
  *in the speculative execution*, and in turn what one bit of the
  loaded value was. Due to the nature of these timing side channels and
  the branch predictor on Intel processors, this allows an attacker to
  leak data only accessible to a privileged domain (like the kernel)
  back into an unprivileged domain.

  The goal is simple: avoid generating code which contains an indirect
  branch that could have its prediction poisoned by an attacker. In
  many cases, the compiler can simply use directed conditional branches
  and a small search tree. LLVM already has support for lowering
  switches in this way and the first step of this patch is to disable
  jump-table lowering of switches and introduce a pass to rewrite
  explicit indirectbr sequences into a switch over integers.

  However, there is no fully general alternative to indirect calls. We
  introduce a new construct we call a "retpoline" to implement indirect
  calls in a non-speculatable way. It can be thought of loosely as a
  trampoline for indirect calls which uses the RET instruction on x86.
  Further, we arrange for a specific call->ret sequence which ensures
  the processor predicts the return to go to a controlled, known
  location. The retpoline then "smashes" the return address pushed onto
  the stack by the call with the desired target of the original
  indirect call. The result is a predicted return to the next
  instruction after a call (which can be used to trap speculative
  execution within an infinite loop) and an actual indirect branch to
  an arbitrary address.

  On 64-bit x86 ABIs, this is especially easily done in the compiler by
  using a guaranteed scratch register to pass the target into this
  device.  For 32-bit ABIs there isn't a guaranteed scratch register
  and so several different retpoline variants are introduced to use a
  scratch register if one is available in the calling convention and to
  otherwise use direct stack push/pop sequences to pass the target
  address.

  This "retpoline" mitigation is fully described in the following blog
  post: https://support.google.com/faqs/answer/7625886

  We also support a target feature that disables emission of the
  retpoline thunk by the compiler to allow for custom thunks if users
  want them.  These are particularly useful in environments like
  kernels that routinely do hot-patching on boot and want to hot-patch
  their thunk to different code sequences. They can write this custom
  thunk and use `-mretpoline-external-thunk` *in addition* to
  `-mretpoline`. In this case, on x86-64 thu thunk names must be:
  ```
    __llvm_external_retpoline_r11
  ```
  or on 32-bit:
  ```
    __llvm_external_retpoline_eax
    __llvm_external_retpoline_ecx
    __llvm_external_retpoline_edx
    __llvm_external_retpoline_push
  ```
  And the target of the retpoline is passed in the named register, or in
  the case of the `push` suffix on the top of the stack via a `pushl`
  instruction.

  There is one other important source of indirect branches in x86 ELF
  binaries: the PLT. These patches also include support for LLD to
  generate PLT entries that perform a retpoline-style indirection.

  The only other indirect branches remaining that we are aware of are
  from precompiled runtimes (such as crt0.o and similar). The ones we
  have found are not really attackable, and so we have not focused on
  them here, but eventually these runtimes should also be replicated for
  retpoline-ed configurations for completeness.

  For kernels or other freestanding or fully static executables, the
  compiler switch `-mretpoline` is sufficient to fully mitigate this
  particular attack. For dynamic executables, you must compile *all*
  libraries with `-mretpoline` and additionally link the dynamic
  executable and all shared libraries with LLD and pass `-z
  retpolineplt` (or use similar functionality from some other linker).
  We strongly recommend also using `-z now` as non-lazy binding allows
  the retpoline-mitigated PLT to be substantially smaller.

  When manually apply similar transformations to `-mretpoline` to the
  Linux kernel we observed very small performance hits to applications
  running typic al workloads, and relatively minor hits (approximately
  2%) even for extremely syscall-heavy applications. This is largely
  due to the small number of indirect branches that occur in
  performance sensitive paths of the kernel.

  When using these patches on statically linked applications,
  especially C++ applications, you should expect to see a much more
  dramatic performance hit. For microbenchmarks that are switch,
  indirect-, or virtual-call heavy we have seen overheads ranging from
  10% to 50%.

  However, real-world workloads exhibit substantially lower performance
  impact. Notably, techniques such as PGO and ThinLTO dramatically
  reduce the impact of hot indirect calls (by speculatively promoting
  them to direct calls) and allow optimized search trees to be used to
  lower switches. If you need to deploy these techniques in C++
  applications, we *strongly* recommend that you ensure all hot call
  targets are statically linked (avoiding PLT indirection) and use both
  PGO and ThinLTO. Well tuned servers using all of these techniques saw
  5% - 10% overhead from the use of retpoline.

  We will add detailed documentation covering these components in
  subsequent patches, but wanted to make the core functionality
  available as soon as possible. Happy for more code review, but we'd
  really like to get these patches landed and backported ASAP for
  obvious reasons. We're planning to backport this to both 6.0 and 5.0
  release streams and get a 5.0 release with just this cherry picked
  ASAP for distros and vendors.

  This patch is the work of a number of people over the past month:
  Eric, Reid, Rui, and myself. I'm mailing it out as a single commit
  due to the time sensitive nature of landing this and the need to
  backport it. Huge thanks to everyone who helped out here, and
  everyone at Intel who helped out in discussions about how to craft
  this. Also, credit goes to Paul Turner (at Google, but not an LLVM
  contributor) for much of the underlying retpoline design.

  Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer

  Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits

  Differential Revision: https://reviews.llvm.org/D41723

MFC after:	3 months
X-MFC-With:	r327952
PR:		224669
2018-02-02 22:28:12 +00:00
Dimitry Andric 842d113b5c Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r323948).

MFC after:	3 months
X-MFC-With:	r327952
PR:		224669
2018-02-01 21:41:15 +00:00
Dimitry Andric 042b1c2ef5 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r323338).

MFC after:	3 months
X-MFC-With:	r327952
PR:		224669
2018-01-24 22:35:00 +00:00
Dimitry Andric d23c4359df Pull in r322623 from upstream llvm trunk (by Andrew V. Tischenko):
Allow usage of X86-prefixes as separate instrs.
  Differential Revision: https://reviews.llvm.org/D42102

This should fix parse errors when x86 prefixes (such as 'lock' and
'rep') are followed by various non-mnemonic tokens, e.g. comments, .byte
directives and labels.

PR:		224669,225054
2018-01-17 17:11:55 +00:00
Dimitry Andric 62bd626920 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
Dimitry Andric 30785c0e2b Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_60 r321788,
update build glue and version numbers.
2018-01-06 23:44:14 +00:00
Dimitry Andric fe4fed2e4d Merge llvm, clang, lld, lldb, compiler-rt and libc++ trunk r321545,
update build glue and version numbers, add new intrinsics headers, and
update OptionalObsoleteFiles.inc.
2017-12-29 00:56:15 +00:00
Dimitry Andric bbd32193a0 Add one more file to libllvm's SRCS_MIN, since this one is required for
MK_SHARED_TOOLCHAIN=yes.
2017-12-29 00:21:50 +00:00
Dimitry Andric 2757ff7e2f Update clang, lld and llvm version numbers for r321414, and update build
glue.
2017-12-24 12:32:55 +00:00
Dimitry Andric 77b0be52d7 Next step in updating llvm/clang build glue: make lldb build. 2017-12-22 19:10:19 +00:00
Dimitry Andric 7bfc2d0f8e Next step in updating llvm/clang build glue: make lld build. 2017-12-22 16:27:29 +00:00
Dimitry Andric 44389c28aa Sort source file lists under lib/clang. 2017-12-22 13:35:26 +00:00
Dimitry Andric 3cd201a12f Next step in updating llvm/clang build glue: make the optional llvm and
clang tools build.
2017-12-22 13:28:10 +00:00
Dimitry Andric 69f53b9734 Next step in updating llvm/clang build glue: make llvm-objdump build. 2017-12-22 11:41:18 +00:00
Dimitry Andric ea68f99b08 Next step in updating llvm/clang build glue: make the full clang
executable build.
2017-12-22 10:04:40 +00:00
Dimitry Andric 36cb3905c9 First step in updating llvm/clang build glue: make only the clang
executable build.
2017-12-21 21:24:52 +00:00
Dimitry Andric bed303d199 Bump FREEBSD_CC_VERSION. 2017-12-20 20:27:23 +00:00
Dimitry Andric cd8e0f1f24 Add new clang intrinsics headers, and update version number. 2017-12-20 20:27:09 +00:00
Dimitry Andric 02d2ad99ac Update generated config headers, and version numbers. 2017-12-20 20:25:35 +00:00
Dimitry Andric 5bf0d7ad74 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
5.0.1 release (upstream r320880).

Relnotes:	yes
MFC after:	2 weeks
2017-12-16 18:06:30 +00:00
Dimitry Andric d4419f6fa8 Upgrade our copies of clang, llvm, lldb and libc++ to r319231 from the
upstream release_50 branch.  This corresponds to 5.0.1 rc2.

MFC after:	2 weeks
2017-12-03 12:14:34 +00:00
Bryan Drewery ddf95e2ae8 Tell bsd.dep.mk which depend files to dinclude.
This allows the _SKIP_DEPEND optimization to work, avoiding reading
the files when not needed.  It also fixes META_MODE incorrectly
reading these files when not needed.

Sponsored by:	Dell EMC Isilon
2017-11-10 20:09:15 +00:00
Bryan Drewery 59696d216c Prefix {TARGET,BUILD}_TRIPLE with LLVM_ to avoid Makefile.inc1 collision.
The Makefile.inc1 TARGET_TRIPLE is for specifying which -target is used
during the build of world.

MFC after:	2 weeks
Reviewed by:	dim, imp
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12792
2017-10-25 21:45:55 +00:00
Warner Losh 0b972ac92e Support armv7 builds for userland
Make armv7 as a new MACHINE_ARCH.

Copy all the places we do armv6 and add armv7 as basically an
alias. clang appears to generate code for armv7 by default. armv7 hard
float isn't supported by the the in-tree gcc, so it hasn't been
updated to have a new default.

Support armv7 as a new valid MACHINE_ARCH (and by extension
TARGET_ARCH).

Add armv7 to the universe build.

Differential Revision: https://reviews.freebsd.org/D12010
2017-10-05 23:01:33 +00:00
Dimitry Andric c891abb2ae Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
5.0.0 release (upstream r312559).

Release notes for llvm, clang and lld will be available here soon:
<http://releases.llvm.org/5.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/5.0.0/tools/lld/docs/ReleaseNotes.html>

Relnotes:	yes
MFC after:	1 month
X-MFC-with:	r321369
2017-09-06 21:21:13 +00:00
Dimitry Andric 3ea909cc76 Upgrade our copies of clang, llvm, lldb and compiler-rt to r312293 from
the upstream release_50 branch.  This corresponds to 5.0.0 rc4.

As of this version, the cad/stepcode port should now compile in a more
reasonable time on i386 (see bug 221836 for more information).

PR:		221836
MFC after:	2 months
X-MFC-with:	r321369
2017-09-01 18:53:36 +00:00
Dimitry Andric 0fa4377182 Upgrade our copies of clang, llvm, lldb and compiler-rt to r311606 from
the upstream release_50 branch.

As of this version, lib/msun's trig test should also work correctly
again (see bug 220989 for more information).

PR:		220989
MFC after:	2 months
X-MFC-with:	r321369
2017-08-24 20:19:27 +00:00
John Baldwin de6feefdb7 Improve the coverage of debug symbols for MK_DEBUG_FILES.
- Include debug symbols in static libraries.  This permits binaries
  to include debug symbols for functions obtained from static libraries.
- Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be
  overridden by setting DEBUG_FILES_CFLAGS.  Use this to limit the debug
  information for llvm libraries and binaries.

Reviewed by:	emaste
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D12025
2017-08-23 23:30:25 +00:00
Dimitry Andric 0554abf0e0 Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the
upstream release_50 branch.

MFC after:	2 months
X-MFC-with:	r321369
2017-08-21 07:03:02 +00:00
Dimitry Andric 9dc417c32b Upgrade our copies of clang, llvm and libc++ to r310316 from the
upstream release_50 branch.

MFC after:	2 months
X-MFC-with:	r321369
2017-08-09 17:32:39 +00:00
Dimitry Andric 37cd60a321 Upgrade our copies of clang, llvm, lld and lldb to r309439 from the
upstream release_50 branch.  This is just after upstream's 5.0.0-rc1.

MFC after:	2 months
X-MFC-with:	r321369
2017-07-30 18:01:34 +00:00
Bryan Drewery cd2831005b Move llvm Options.inc hack from r321433 for NO_CLEAN to lib/clang/libllvm.
The files are only ever generated to .OBJDIR, not to WORLDTMP (as a
sysroot) and are only ever included from a compilation.  So using
a beforebuild target here removes the file before the compilation
tries to include it.

MFC after:	2 months
X-MFC-With:	r321369
2017-07-24 23:32:24 +00:00
Dimitry Andric 0cc9e150fb Add a few more object files to liblldb, which should solve errors when
linking the lldb executable in some cases.  In particular, when the
-ffunction-sections -fdata-sections options are turned off, or
ineffective.

Reported by:	Shawn Webb, Mark Millard
MFC after:	2 months
X-MFC-With:	r308421
2017-07-24 16:33:06 +00:00
Dimitry Andric b40b48b876 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and update
build glue.
2017-07-19 19:41:41 +00:00
Dimitry Andric c439438675 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r307894, and update
build glue.
2017-07-13 21:58:45 +00:00
Dimitry Andric a580b01494 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306956, and update
build glue.
2017-07-02 11:41:15 +00:00
Dimitry Andric edd7eaddc8 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306325, and update
build glue.
2017-06-27 06:40:39 +00:00
Dimitry Andric 4198293b25 Merge ^/head r319801 through r320041. 2017-06-17 00:14:54 +00:00
Dimitry Andric 24d58133b7 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305575, and update
build glue.
2017-06-17 00:09:34 +00:00
Dimitry Andric 5c4e2ac498 Revert r319796 for now, it can cause undefined references when linking
in some circumstances.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
2017-06-13 21:01:06 +00:00
Dimitry Andric db17bf38c5 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305145, and update
build glue.
2017-06-10 19:17:14 +00:00
Dimitry Andric 834210fa5d Remove a few unneeded files from libllvm, libclang and liblldb.
MFC after:	3 days
2017-06-10 18:52:13 +00:00
Dimitry Andric 6d97bb297c Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304659, and update
build glue.
2017-06-03 18:18:34 +00:00
Dimitry Andric 4224465e82 Merge ^/head r319251 through r319479. 2017-06-01 22:59:41 +00:00
Dimitry Andric f9448bf33f Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304460, and update
build glue.
2017-06-01 22:47:02 +00:00
Dimitry Andric 38d6a62a21 For arm targets, place ABI at the end of the target triple
For some reason, we have been inserting the ABI specification into the
middle of the target triple, when building LLVM, like so:

    armv6-gnueabi-freebsd12.0

This is the wrong way around.  LLVM even auto-canonicalizes it to:

    armv6--freebsd12.0-gnueabi

Let's do this the right way in llvm.build.mk instead.  While here,
define a proper VENDOR macro which can be overridden easily.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D10846
2017-06-01 21:05:56 +00:00
Dimitry Andric 89cb50c933 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304222, and update
build glue.
2017-05-30 19:24:09 +00:00
Dimitry Andric 0623065970 Add one more file to libllvm. 2017-05-29 22:25:56 +00:00
Dimitry Andric 302affcb04 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304149, and update
build glue.
2017-05-29 22:09:23 +00:00
Dimitry Andric 2a1b82cf19 Missed a few additional files in libllvm, for llvm-objdump and llvm-pdbdump. 2017-05-27 11:25:21 +00:00
Dimitry Andric d8866befb8 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303571, and update
build glue.
2017-05-22 21:17:44 +00:00
Dimitry Andric 3d54deb33c Following upstream trunk, enable the new global instruction selection
(GlobalISel), cleanup some defines, and adjust the libllvm Makefile for
this.
2017-05-22 19:06:39 +00:00
Dimitry Andric 60ff8e32a5 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303291, and update
build glue.
2017-05-18 18:33:33 +00:00
Dimitry Andric 5517e702c0 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303197, and update
build glue.
2017-05-16 21:50:29 +00:00
Dimitry Andric 68e1931846 Add new LWP intrinsics header, and an option to install internal clang
headers which have the same name as our system headers, and might
conflict with them.  (It is a work in progress to make these fully
compatible.)
2017-05-09 20:07:34 +00:00
Dimitry Andric 0f5676f432 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r302418, and update
build glue.
2017-05-08 19:20:55 +00:00
Dimitry Andric 7d9e99b671 Regenerate llvm's config.h file. 2017-05-05 20:45:55 +00:00
Dimitry Andric b174acef4c Some more files in libllvm moved around. These only apply for WITH_CLANG_EXTRAS. 2017-05-04 21:04:38 +00:00
Dimitry Andric f37b6182a5 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r302069, and update
build glue (preliminary, not all option combinations work yet).
2017-05-03 21:54:55 +00:00
Dimitry Andric 51690af2a4 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r301441, and update
build glue.
2017-04-26 22:33:09 +00:00
Dimitry Andric b33474c89f Strip out a few objects from libclang, liblldb and lldb, which are not
referenced due to the selection of tools that we build, and our compile
time options.
2017-04-21 21:06:11 +00:00
Dimitry Andric 482a8244bf Update some more build glue. All llvm extras, lld and lldb should link now. 2017-04-21 15:59:58 +00:00
Dimitry Andric 6bc11b1414 Merge llvm, clang, lld and lldb trunk r300890, and update build glue. 2017-04-20 21:48:54 +00:00
Dimitry Andric 554491ffbd Merge ^/head r316992 through r317215. 2017-04-20 21:04:21 +00:00
Dimitry Andric bcfe4c376c Add function and data sections when building llvm, clang, lld and lldb,
and allow the linker to garbage collect them.  This shaves off up to a
few MB from the final executables.

MFC after:	3 days
2017-04-20 21:00:09 +00:00
Dimitry Andric c83fca58fa Turn off llvm/clang's ENABLE_BACKTRACES setting, since it never worked
properly anyway.  (Upstream has reorganized this somewhat in the mean
time, but for proper backtraces we would need llvm-symbolizer in base.)

MFC after:	3 days
2017-04-20 21:00:04 +00:00
Dimitry Andric 7c1fda1cab Update objects in liblldb for the MK_LLDB=yes case. 2017-04-18 21:21:31 +00:00
Dimitry Andric 28ae63f991 For lldb, delete the custom Xcode-only Host/Config.h, and provide a
pre-generated version in lib/clang/include/lldb/Host instead, similar to
what we do for clang, llvm and lld.
2017-04-18 20:31:02 +00:00
Dimitry Andric 050e2df194 Add new objects to lib/clang/lib{llvm,clang} and usr.bin/clang for the
MK_CLANG_EXTRAS=yes case.
2017-04-18 17:39:20 +00:00
Dimitry Andric 3762ddd95f Add some new objects to libclang for the MK_CLANG_FULL=yes case. 2017-04-17 20:14:32 +00:00
Dimitry Andric f849be8ae8 Add preliminary UPDATING and ObsoleteFiles.inc entries. Also add one
new intrinsics header.
2017-04-17 12:42:58 +00:00
Dimitry Andric 5897d2f01b Initial update of clang/llvm build glue, for building just a minimal
clang executable.
2017-04-17 11:21:42 +00:00
Dimitry Andric 817a00731b Update clang, llvm, lld, lldb, compiler-rt and libc++ to 4.0.0 release.
We were already very close to the last release candidate, so this is a
pretty minor update.

Relnotes:	yes
MFC after:	1 month
X-MFC-With:	r314564
2017-03-10 19:02:41 +00:00
Dimitry Andric 2e477b5e5e Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r296509, and update build glue.
2017-02-28 21:18:23 +00:00
Dimitry Andric bc93f188f6 Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r296202, and update build glue.
2017-02-25 15:00:57 +00:00
Dimitry Andric 5d19388204 Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r296002, and update build glue.
2017-02-23 19:25:29 +00:00
Dimitry Andric 2bcad0d8d6 Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r295380, and update build glue.
2017-02-17 20:07:35 +00:00
Dimitry Andric 5ca5951e31 Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r294803, and update build glue.
2017-02-11 13:58:05 +00:00
Dimitry Andric 899ca3d65f Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r294123, and update build glue.
2017-02-05 19:57:41 +00:00
Dimitry Andric 077e1117dc Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r293807, and update build glue.
2017-02-01 21:57:07 +00:00
Dimitry Andric 98221d2e7e Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r293443, and update build glue.
2017-01-29 21:56:47 +00:00
Ed Maste f2d1e1a7ba Add -mlong-calls also to LLVM's STATIC_CFLAGS on ARM
-mlong-calls was set only in STATIC_CXXFLAGS, but there are some .c
source files in LLVM which also need -mlong-calls.

Unfortunately this is not sufficient to fix linking lldb on ARM,
because LLVM-generated calls to __aeabi_read_tp do not honour the
-mlong-calls flag.  See LLVM PR31769 for details.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9348
2017-01-27 21:26:23 +00:00
Ed Maste ca4fe588bb Additional LD_AS_LLD -> LD_IS_LLD missed in r312894/r312895 2017-01-27 21:14:42 +00:00
Ed Maste 737872e978 Also apply WITH_LLD_AS_LD to build tools
Previously WITH_LLD_AS_LD installed LLD as /usr/bin/ld in the target
system, but still used the GNU BFD ld to link the binaries in that
target. LLD 4.0.0 can link the FreeBSD/amd64 world and kernel so use
LLD as the build-time linker as well when the knob is set.

Reviewed by:	dim
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9226
2017-01-25 21:05:48 +00:00
Dimitry Andric f8496407cb Merge llvm, clang, compiler-rt, libc++, lld and lldb release_40 branch
r292951, and update build glue.
2017-01-24 19:56:22 +00:00
Dimitry Andric 94c53d4054 Merge llvm, clang, lld and lldb release_40 branch 292732, and update
build glue.
2017-01-22 18:02:44 +00:00
Dimitry Andric 2714e44c8b Fix some erroneous minimization in libclang. 2017-01-15 12:58:14 +00:00
Dimitry Andric f1a29dd344 Merge llvm, clang, lld and lldb release_40 branch r292009. Also update
build glue.
2017-01-14 22:12:13 +00:00
Dimitry Andric 24e2fe98d0 Merge llvm, clang, lld and lldb trunk r291476. 2017-01-09 22:32:19 +00:00
Dimitry Andric 1ae4f0f64b Add one more dependency for lld. 2017-01-07 15:18:49 +00:00
Dimitry Andric d413188a99 Update clang and lld Version.inc files. 2017-01-06 20:25:08 +00:00
Dimitry Andric 53fe1d28fa Adjust version numbers for the clang library directory. 2017-01-05 18:32:18 +00:00
Dimitry Andric 5bd5e06ad1 Update clang and lld Version.inc files. 2017-01-04 22:32:17 +00:00
Dimitry Andric 7eea447163 Cleanup commented entries in libllvm Makefile. 2017-01-04 21:57:56 +00:00
Dimitry Andric 85aabebe69 Bump FREEBSD_CC_VERSION to force bootstrap compiler build. 2017-01-04 20:42:37 +00:00
Dimitry Andric 629e066c03 Update lldb Makefile, and disable some functionality for Windows and
Darwin.
2017-01-04 19:53:04 +00:00
Dimitry Andric 0fc5d23818 Update lld Version.inc and libllvm/Makefile to match. 2017-01-04 18:54:20 +00:00
Dimitry Andric 09bfd04318 Initial updates to llvm/clang build glue. 2017-01-03 20:28:09 +00:00
Dimitry Andric 30d4828e63 Reapply 310775, now it also builds correctly if lldb is disabled:
Move llvm-objdump from CLANG_EXTRAS to installed by default

We currently install three tools from binutils 2.17.50: as, ld, and
objdump. Work is underway to migrate to a permissively-licensed
tool-chain, with one goal being the retirement of binutils 2.17.50.

LLVM's llvm-objdump is intended to be compatible with GNU objdump
although it is currently missing some options and may have formatting
differences. Enable it by default for testing and further investigation.
It may later be changed to install as /usr/bin/objdump, it becomes a
fully viable replacement.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D8879
2016-12-30 18:00:31 +00:00
Dimitry Andric a222710ce2 Revert r310775 for now, until we can figure out why it does not seem to
work properly when cross-building.  Sorry for the breakage.
2016-12-29 21:57:16 +00:00
Dimitry Andric 1357722508 Move llvm-objdump from CLANG_EXTRAS to installed by default
We currently install three tools from binutils 2.17.50: as, ld, and
objdump. Work is underway to migrate to a permissively-licensed
tool-chain, with one goal being the retirement of binutils 2.17.50.

LLVM's llvm-objdump is intended to be compatible with GNU objdump
although it is currently missing some options and may have formatting
differences. Enable it by default for testing and further investigation.
It may later be changed to install as /usr/bin/objdump, it becomes a
fully viable replacement.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D8879
2016-12-29 13:27:04 +00:00
Dimitry Andric d246bac328 Merge llvm, clang, lld, lldb, compiler-rt and libc++ 3.9.1 release
r289601.
2016-12-16 18:30:53 +00:00
Dimitry Andric 7a83c005f5 Update llvm, clang, lld, lldb, compiler-rt and libc++ to release_39
branch r288847.
2016-12-10 15:30:39 +00:00
Dimitry Andric 1bde3b7066 Merge ^/head r309519 through r309757. 2016-12-09 20:57:43 +00:00
Dimitry Andric c130a785e4 During the bootstrap phase, when building the minimal llvm library on
PowerPC, add lib/Support/Atomic.cpp.  This is needed because upstream
llvm revision r271821 disabled the use of std::call_once, which causes
some fallback functions from Atomic.cpp to be used instead.

Reported by:	Mark Millard
PR:		214902
X-MFC-With:	309124
2016-12-06 20:44:40 +00:00
Dimitry Andric 5042637be1 Update build glue for clang 3.9.1 r288513. 2016-12-02 19:40:00 +00:00
Dimitry Andric d6d16831c5 Merge ^/head r309170 through r309212. 2016-11-27 14:27:51 +00:00
Dimitry Andric 5b41a5b675 Update build glue for llvm/clang 3.9.1. 2016-11-26 01:13:53 +00:00
Dimitry Andric d52fad0e5d Bump FREEBSD_CC_VERSION again for r309147 and 309149. 2016-11-25 18:12:57 +00:00
Dimitry Andric d590c67486 In preparation for merging back to head, bump __FreeBSD_version,
FREEBSD_CC_VERSION and set date in ObsoleteFiles.inc.
2016-11-24 21:12:43 +00:00
Dimitry Andric 084b3adb03 Some further micro-optimizations for the libllvm and lldb build. 2016-09-04 16:54:55 +00:00
Dimitry Andric d1c8d4428b Update clang to the final 3.9.0 release. There were no more code changes
since the last release candidate.
2016-09-02 19:20:27 +00:00
Bryan Drewery dc3af96dec Use a proper comment.
Submitted by:	emaste
2016-09-01 21:02:02 +00:00
Bryan Drewery 03165addb5 DIRDEPS_BUILD: Connect the new clang build.
Sponsored by:	EMC / Isilon Storage Division
2016-09-01 20:38:59 +00:00
Ed Maste 75bc38b916 Add WITH_/WITHOUT_LLD knobs to enable the lld linker
Use this to control inclusion of the libllvm functionality required
by lld. Enable by default on arm64 and amd64, the two platforms where
lld is most usable for testing.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7713
2016-08-31 21:18:38 +00:00
Ed Maste 901be6ecd7 Add Version.inc to set lld's version information
We might want to generate this file at build time, but for now just
provide a static copy as done with other version files.

Sponsored by:	The FreeBSD Foundation
2016-08-30 21:06:19 +00:00
Dimitry Andric 68629f0dce Update llvm to release_39 branch r279689. 2016-08-27 11:51:08 +00:00
Dimitry Andric 01d8757d3d Centralize where LLVM_SRCS, CLANG_SRCS and LLDB_SRCS are defined. 2016-08-27 10:00:33 +00:00
Dimitry Andric e1cd768299 Use SRCTOP and OBJTOP throughout the llvm/clang/lldb build. 2016-08-27 09:29:39 +00:00
Dimitry Andric 4cbc970cde Add forgotten {llvm,clang}.pre.mk files. 2016-08-26 22:56:23 +00:00
Dimitry Andric 986e05bc2a Completely revamp the way llvm, clang and lldb are built.
* Bootstrap llvm-tblgen and clang-tblgen with a minimal llvm static
  library, that has no other dependencies.
* Roll up all separate llvm libraries into one big static libllvm.
* Similar for all separate clang and lldb static libraries.
* For all these libraries, generate their .inc files only once.
* Link all llvm tools (including extra) against the big libllvm.
* Link clang and clang-format against the big libllvm and libclang.
* Link lldb against the big libllvm, libclang and liblldb.

N.B.: This is work in progress, some details may still be missing.

It also heavily depends on bsd.*.mk's support for SRCS and DPSRCS with
relative pathnames, which apparently does not always work as expected.
For building llvm, clang and lldb though, it seems to work just fine.

The main idea behind this restructuring is maintainability and build
peformance.  The previous large number of very small libraries, each
with their own generated files and dependencies was slow to traverse
and hard to understand.

Possible future improvements:
* Only build certain targets, e.g. for most regular users having just
  one target will be fine.  This will shave off some build time.
* Building the big llvm, clang and lldb libraries as shared (private)
  libraries.
* Adding other components from the LLVM project, such as lld.
2016-08-26 22:44:22 +00:00
Dimitry Andric e9c25f2108 Move some more files under MK_CLANG_FULL. 2016-08-25 21:29:16 +00:00
Dimitry Andric a579b914e4 Update clang version information for r279477. 2016-08-24 17:45:11 +00:00
Dimitry Andric fe73cb29ea Update generated llvm DataTypes.h header. 2016-08-23 19:57:37 +00:00
Dimitry Andric d6c3ea5ef1 Add new intrinsics headers for 3.9.0. 2016-08-20 19:33:07 +00:00
Dimitry Andric 65e1b13807 Merge ^/head r304236 through r304536. 2016-08-20 18:52:03 +00:00
Dimitry Andric 9228435a16 Update build glue for lldb. Also comment out parts of the
initialization and termination code which reference plugins and
components that we don't use.
2016-08-20 18:45:25 +00:00
Dimitry Andric 6ca8079c85 Pull in r265122 from upstream llvm trunk (by James Molloy):
Fix for pr24346: arm asm label calculation error in sub

  Some ARM instructions encode 32-bit immediates as a 8-bit integer
  (0-255) and a 4-bit rotation (0-30, even) in its least significant 12
  bits. The original fixup, FK_Data_4, patches the instruction by the
  value bit-to-bit, regardless of the encoding. For example, assuming
  the label L1 and L2 are 0x0 and 0x104 respectively, the following
  instruction:

    add r0, r0, #(L2 - L1) ; expects 0x104, i.e., 260

  would be assembled to the following, which adds 1 to r0, instead of
  260:

    e2800104 add r0, r0, #4, 2 ; equivalently 1

  The new fixup kind fixup_arm_mod_imm takes care of the encoding:

    e2800f41 add r0, r0, #260

  Patch by Ting-Yuan Huang!

This fixes label calculation for ARM assembly, and is needed to enable
ARM assembly sources for OpenSSL.

Requested by:	jkim
MFC after:	3 days
2016-08-20 14:04:51 +00:00
Dimitry Andric 7fff4413af Update build glue for clang and the llvm/clang extras. 2016-08-19 17:55:34 +00:00
Dimitry Andric 910b36f73f Pull in r262772 from upstream clang trunk (by Simon Pilgrim):
[X86] AMD Bobcat CPU (btver1) doesn't support XSAVE

  btver1 is a SSSE3/SSE4a only CPU - it doesn't have AVX and doesn't
  support XSAVE.

  Differential Revision: http://reviews.llvm.org/D17682

Pull in r262782 from upstream llvm trunk (by Simon Pilgrim):

  [X86] AMD Bobcat CPU (btver1) doesn't support XSAVE

  btver1 is a SSSE3/SSE4a only CPU - it doesn't have AVX and doesn't
  support XSAVE.

  Differential Revision: http://reviews.llvm.org/D17683

This ensures clang does not emit AVX instructions for CPUTYPE=btver1.

Reported by:	Michel Depeige <demik+freebsd@lostwave.net>
PR:		211864
MFC after:	3 days
2016-08-17 21:57:11 +00:00
Glen Barber a33ae599bb Bump FREEBSD_CC_VERSION in lib/clang/freebsd_cc_version.h
Submitted by:	bdrewery
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-08 01:47:01 +00:00
Glen Barber ae940db11f Reflect head is now 12.0-CURRENT.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-08 00:12:29 +00:00
Bryan Drewery bc2abcfdef Add clang-format under WITH_CLANG_EXTRAS.
Reviewed by:	dim
Approved by:	re (gjb)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D6856
2016-06-17 16:46:58 +00:00
Dimitry Andric c371433e4a For clang, move the definition of FREEBSD_CC_VERSION into its own header
file, lib/clang/freebsd_cc_version.h, instead of reusing Version.inc.
The header is only included from one .cpp file in the clang tree.

This minimizes the number of .cpp files that need to be rebuilt if the
version is bumped.

Discussed with:	bdrewery
2016-06-03 16:17:36 +00:00
Dimitry Andric b5e99283f4 Pull in r271548 from upstream llvm trunk (by me):
Only attempt to detect AVG if SSE2 is available

  Summary:
  In PR29973 Sanjay Patel reported an assertion failure when a certain
  loop was optimized, for a target without SSE2 support.  It turned out
  this was because of the AVG pattern detection introduced in rL253952.

  Prevent the assertion failure by bailing out early in
  `detectAVGPattern()`, if the target does not support SSE2.

  Also add a minimized test case.

  Reviewers: congh, eli.friedman, spatel

  Subscribers: emaste, llvm-commits

  Differential Revision: http://reviews.llvm.org/D20905

This should fix assertion failures ("Requires at least SSE2!") when
building the games/0ad port with CPUTYPE=pentium3.

Reported by:	madpilot
2016-06-02 19:54:38 +00:00
Dimitry Andric 22dfc4860f Bump __FreeBSD_cc_version after r300974. 2016-05-30 06:44:10 +00:00
Bryan Drewery 06a6cbdf5f Add FREEBSD_CC_VERSION which will be used to define __FreeBSD_cc_version.
The WITH_SYSTEM_COMPILER build option will rely on this value to determine what
__FreeBSD_cc_version the source tree will produce.  This value will be compared
against the /usr/bin/cc value to determine if a new compiler is needed.

Start with 1100002 which is 1 more than than the value we've had since
3.8.0 to ensure that all changes since then are present.

Reviewed by:	dim
Sponsored by:	EMC / Isilon Storage Division
2016-05-21 01:32:20 +00:00
Warner Losh 2c0e9e2a09 Make armv6 hard float abi by default. Kill armv6hf.
Allow CPUTYPE=soft to build the current soft-float abi libraries.
Add UPDATING entry to announce this.

Approved by: re@ (gjb)
2016-05-18 06:01:18 +00:00
Ed Maste c43c22982e Limit Options.inc generation to desired targets
As mentioned in the Makefile there's an "atrocious" hack to generate a
different version of Options.inc.h, depending on the library being
built.

Remove the catch-all else case and limit it to specific libraries, so
that we don't accidentally use the Options.inc.h from clangdriver if a
future libary also uses Options.inc.h.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6209
2016-05-05 21:20:09 +00:00
Bryan Drewery 59f6130d2a Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally.
Sponsored by:	EMC / Isilon Storage Division
2016-03-26 03:46:12 +00:00
Bryan Drewery 6a5ac7dc11 Use the new bmake .dinclude feature to make these safe.
At least FAST_DEPEND won't even run 'make depend', so the code was
potentially broken with FAST_DEPEND anyhow.  The .dinclude directive
will ignore missing files rather than make them be fatal.

Sponsored by:	EMC / Isilon Storage Division
2016-03-11 04:17:39 +00:00
Bryan Drewery f51eac06ce DIRDEPS_BUILD: Update clang dependencies after r296417.
Sponsored by:	EMC / Isilon Storage Division
2016-03-08 21:26:44 +00:00
Dimitry Andric 1b9b7a135c Update llvm and clang to 3.8.0 release. 2016-03-03 22:50:52 +00:00
Dimitry Andric 09a17a1e45 Update llvm and clang to release_38 branch r261684. 2016-02-24 22:07:56 +00:00
Dimitry Andric 14e9c9161c Merge ^/head r295902 through r296006. 2016-02-24 21:38:51 +00:00
Bryan Drewery bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Bryan Drewery b9cd412e7b FAST_DEPEND: Always run depend via beforebuild which removes many hacks.
This will generate dependencies rather than depending on the previous behavior
of depending on the guessed OBJS: *.h dependecies or a user running
'make depend'.

Experimentation showed that depending only on headers was not enough and
prone to .ORDER errors.  Downstream users may also have added
dependencies into beforedepend or afterdepend targets.  The safest way to
ensure dependencies are generated before build is to run 'make depend'
beforehand rather than just depending on DPSRCS+SRCS.

Note that the OBJS_DEPEND_GUESS mechanism (a.k.a .if !exists(.depend) then
foo.o: *.h) is still useful as it improves incremental builds with missing
.depend.* files and allows 'make foo.o' to usually work, while this
'beforebuild: depend' ensures that the build will always find all dependencies.
The 'make foo.o' case has no means of a 'beforebuild' hook.

This also removes several hacks in the DIRDEPS_BUILD:
- NO_INSTALL_INCLUDES is no longer needed as it mostly was to work around
  .ORDER problems with building the needed headers early.
- DIRDEPS_BUILD: It is no longer necesarry to track "local dependencies" in
  Makefile.depend.

  These were only in Makefile.depend for 'clean builds' since nothing would
  generate the files due to skipping 'make depend' and early dependency
  bugs that have been fixed, such as adding headers into SRCS for the
  OBJS_DEPEND_GUESS mechanism.  Normally if a .depend file does not exist then
  a dependency is added by bsd.lib.mk/bsd.prog.mk from OBJS: *.h.  However,
  meta.autodep.mk creates a .depend file from created meta files and inserts
  that into Makefile.depend.  It also only tracks *.[ch] files though which can
  miss some dependencies that are hooked into 'make depend'.  This .depend
  that is created then breaks incremental builds due to the !exists(.depend)
  checks for OBJS_DEPEND_GUESS.  The goal was to skip 'make depend' yet it only
  really works the first time.  After that files are not generated as expected,
  which r288966 tried to address but was using buildfiles: rather than
  beforebuild: and was reverted in r291725.  As noted previously,
  depending only on headers in beforebuild: would create .ORDER errors
  in some cases.

  meta.autodep.mk is still used to generate Makefile.depend though via:
    gendirdeps: Makefile.depend
    .END: gendirdeps

  This commit allows removing all of the "local dependencies" in
  Makefile.depend which cuts down on churn and removes some of the
  arch-dependent Makefile.depend files.

  The "local dependencies" were also problematic for bootstrapping.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:19:18 +00:00
Dimitry Andric ce479d84f4 Update llvm and clang to release_38 branch r261369. 2016-02-21 16:23:44 +00:00
Dimitry Andric 9893f787ec Merge ^/head r295601 through r295844. 2016-02-21 13:49:26 +00:00
Bryan Drewery 6b128c1707 DIRDEPS_BUILD: Hookup CLANG_EXTRAS.
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 23:11:09 +00:00
Dimitry Andric a8bcc4d878 Update llvm, clang and lldb to release_38 branch r260756. 2016-02-13 15:58:51 +00:00
Dimitry Andric 21cf1fd41c Update llvm, clang and lldb to release_38 branch r258968. 2016-01-27 22:48:52 +00:00
Dimitry Andric 30d1696c64 Undo r294499 for now (which disabled -mlong-calls), so arm builds can
succeed again.
2016-01-23 14:17:21 +00:00
Dimitry Andric 8c24ff90c4 Update llvm and clang to release_38 branch r258549. 2016-01-22 21:50:08 +00:00
Dimitry Andric d9b9dae1a9 Merge ^/head r294169 through r294598. 2016-01-22 20:41:56 +00:00
Andrew Turner 9beacb6f22 Disable -mlong-calls for the clang libraries for now, it increases the
size of the clang binary for people with a crt1.o from before r293832.
2016-01-21 12:59:54 +00:00
Dimitry Andric 42d8074a70 Update llvm/clang build glue. 2016-01-16 17:49:29 +00:00
Dimitry Andric 7f38eb34e2 Merge ^/head r293850 through r294089. 2016-01-15 17:55:00 +00:00
Andrew Turner c455b92483 Set -mlong-calls where needed to get a static clang and lldb 3.8.0
linking. These are too large for a branch instruction to branch from an
earlier point in the code to somewhere later.

This will also allow these to be build with Thumb-2 when we get this
infrastructure.

Reviewed by:	dim
Differential Revision:	https://reviews.freebsd.org/D4855
2016-01-14 19:00:13 +00:00
Dimitry Andric 444ed5c5eb Update llvm, clang and lldb to trunk r257626, and update build glue. 2016-01-14 17:42:46 +00:00
Dimitry Andric fdd1590a42 As submitted upstream in a review, avoid using undefined behavior in
llvm's LinkAllPasses.h.  This caused some of the calls not to be
emitted, if the optimization level was -O2 or higher.

Conversely, if you used -O1 or lower, calls to e.g.  RunningOnValgrind()
would be emitted, leading to link failures, because we did not include
Valgrind.cpp into libllvmsupport.  Therefore, add it unconditionally.

Noticed by:	ian
2016-01-08 17:32:42 +00:00
Dimitry Andric 76ba5332fe Update llvm library dependencies. 2016-01-06 21:27:12 +00:00
Dimitry Andric db3ae65e86 Update llvm/clang svn revision. 2016-01-06 21:26:57 +00:00
Dimitry Andric f3304b8db5 Add new pkuintrin.h intrinsics header. 2016-01-06 21:26:31 +00:00
Ed Maste 0a97e59728 Update build infrastructure for LLDB 3.8 2016-01-04 00:02:58 +00:00
Ed Maste 1b08e3c074 Build Valgrind.cpp for LLDB, not only CLANG_EXTRAS
It's required as of LLDB 3.8.
2016-01-03 23:36:11 +00:00
Dimitry Andric ffa548ae3e Next part of updating llvm/clang build glue: getting the
WITH_CLANG_EXTRAS tools built.
2015-12-31 17:37:35 +00:00
Dimitry Andric 34cdd77646 First part of updating llvm/clang build glue: getting llvm-tblgen,
clang-tblgen and clang itself built.
2015-12-31 14:39:45 +00:00
Dimitry Andric 802df53c82 Update various build glue files for the new llvm/clang version number. 2015-12-30 18:52:29 +00:00
Dimitry Andric 250e909a40 Update clang's Version.inc file, and regenerate various generated
configuration headers (these used to be generated by autoconf, but
upstream has deprecated autoconf in favor of CMake).
2015-12-30 18:23:01 +00:00
Dimitry Andric 9a4b31181f Upgrade our copies of clang and llvm to 3.7.1 release. This is a
bugfix-only release, with no new features.

Please note that from 3.5.0 onwards, clang and llvm require C++11
support to build; see UPDATING for more information.
2015-12-25 21:39:45 +00:00
Bryan Drewery b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Bryan Drewery 3bed45ab81 META MODE: Rework [bootstrapped] tools PATH support.
- Support more of the toolchain from TOOLSDIR.
- This also improves 'make bootstrap-tools' to pass, for example,
  AS=/usr/bin/as to Makefile.inc1, which will tell cross-tools to use
  external toolchain support and avoid building things we won't be using
  in the build.
- Always set the PATH to contain the staged TOOLSDIR directories when
  not building the bootstrap targets.

  The previous version was only setting this at MAKE.LEVEL==0 and if the
  TOOLSDIR existed.  Both of these prevented using staged tools that were
  built during the build though as DIRDEPS with .host dependencies, such
  as the fix for needing usr.bin/localedef.host in r291311.
  This is not a common tool so we must build and use it during the build,
  and need to be prepared to change PATH as soon as it appears.

  This should also fix the issue of host dependencies disappearing from
  Makefile.depend and then reappearing due to the start of the fresh build not
  having the directory yet, resulting in the tools that were built not actually
  being used.
- Only use LEGACY_TOOLS while building in Makefile.inc1.  After r291317
  and r291546 there is no need to add LEGACY_TOOLS into the PATH for
  the pseudo/targets/toolchain build.
- Because the pseudo/targets/toolchain will now build its own
  [clang-]tblgen, the special logic in clang.build.mk is no longer needed.
- LEGACY_TOOLS is no longer used outside of targets/pseudo/bootstrap-tools
  so is no longer passed into the environment in its build.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:19:02 +00:00
Bryan Drewery 0383be9bae META MODE: Fix rebuilding of lib/clang/include after clang-tblgen.host is
staged.

None of usr.bin/clang/clang-tblgen or its dependencies need
lib/clang/include, so there is no cyclic dependency here to worry about.
The issue came about because of workarounds to dependencies on clang
being optional.

Without this, the clang-tblgen called during the build would change
after it was staged for the host.  This would cause lib/clang/include to
rebuild due to changed build commands.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:18:59 +00:00
Bryan Drewery e58834bc29 Only DIRDEPS_BUILD should trigger this logic.
Missed in r290816.

Sponsored by:	EMC / Isilon Storage Division
2015-11-30 22:53:41 +00:00
Bryan Drewery 0314b7e24d libllvmmirparser and libllvmlibdriver are only used in usr.bin/clang/llc and
usr.bin/clang/llvm-ar, respectively, when MK_CLANG_EXTRAS is yes.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-30 19:16:58 +00:00
Bryan Drewery 277fbb92d5 Remove redundant DPSRCS which were already in SRCS.
DPSRCS already contains all of SRCS.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 20:38:07 +00:00
Dimitry Andric e9ae01703c Switch the default OpenMP runtime for clang to libomp (from the LLVM
project), as libgomp is not supported anyway.  You can use the
devel/llvm-devel port to install a recent copy of the OpenMP runtime.
2015-10-18 17:18:19 +00:00
Bryan Drewery 28a425750a Conditionalize the META_MODE tool handling on MK_META_MODE.
It was not being used outside of META_MODE but this should make it more clear
that it is only for META_MODE.

Sponsored by:	EMC / Isilon Storage Division
2015-10-17 15:50:52 +00:00
Craig Rodrigues 4c92141bda Use -fpermissive if compiling with GCC.
Works around GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67888
when compiling Module.cpp
2015-10-08 00:48:29 +00:00
Dimitry Andric 9a2f5539ec For llvm/clang libraries, skip including tablegen-produced .d files when
the target is "make depend".  This works around errors during
incremental make depend of some clang libraries, for example "don't know
how to make contrib/llvm/include/llvm/IR/IntrinsicsR600.td".

Reported by:	emaste
2015-10-06 19:49:53 +00:00
Dimitry Andric 65dcb5bcb1 Merge ^/head r288197 through r288456. 2015-10-01 19:02:45 +00:00
Bryan Drewery 54c7d75a06 META_MODE: Remove DEP_RELDIR from Makefile.depend files.
This has not been needed since r284171 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:26:08 +00:00
Bryan Drewery 660d1f65bb Add missing CLEANFILES.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-09-24 23:15:24 +00:00
Dimitry Andric b1fa820d8b Don't install Intrin.h, as this is an intrinsics header for Windows. 2015-09-20 21:39:55 +00:00
Dimitry Andric 999971f7f7 Minimize the number of files compiled for clang only (e.g. when neither
WITH_CLANG_EXTRAS nor WITH_LLDB is in effect).
2015-09-06 22:02:13 +00:00
Dimitry Andric b6c25e0ef3 Update llvm, clang and lldb to 3.7.0 release. 2015-09-06 19:58:48 +00:00
Dimitry Andric b91a7dfcc6 Update lldb to upstream trunk r242221. 2015-09-06 15:21:47 +00:00
Dimitry Andric 875ed54817 Update llvm/clang to r242221. 2015-08-12 18:31:11 +00:00
Dimitry Andric 3dac3a9bad Update llvm/clang to r241361. 2015-07-05 22:34:42 +00:00
Ed Maste 1c3bbb013d Update LLDB snapshot to upstream r241361
Notable upstream commits (upstream revision in parens):

- Add a JSON producer to LLDB (228636)
- Don't crash on bad DWARF expression (228729)
- Add support of DWARFv3 DW_OP_form_tls_address (231342)
- Assembly profiler for MIPS64 (232619)
- Handle FreeBSD/arm64 core files (233273)
- Read/Write register for MIPS64 (233685)
- Rework LLDB system initialization (233758)
- SysV ABI for aarch64 (236098)
- MIPS software single stepping (236696)
- FreeBSD/arm live debugging support (237303)
- Assembly profiler for mips32 (237420)
- Parse function name from DWARF DW_AT_abstract_origin (238307)
- Improve LLDB prompt handling (238313)
- Add real time signals support to FreeBSDSignals (238316)
- Fix race in IOHandlerProcessSTDIO (238423)
- MIPS64 Branch instruction emulation for SW single stepping (238820)
- Improve OSType initialization in elf object file's arch_spec (239148)
- Emulation of MIPS64 floating-point branch instructions (239996)
- ABI Plugin for MIPS32 (239997)
- ABI Plugin for MIPS64 (240123)
- MIPS32 branch emulation and single stepping (240373)
- Improve instruction emulation based stack unwinding on ARM (240533)
- Add branch emulation to aarch64 instruction emulator (240769)
2015-07-04 01:02:43 +00:00
Dimitry Andric cc38b6408e Update llvm/clang build glue. 2015-06-23 18:46:29 +00:00
Dimitry Andric 76aeda8ad4 Merge ^/head r284188 through r284643. 2015-06-20 19:34:50 +00:00
Simon J. Gerraty 2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Dimitry Andric 97bc6c731e Update Makefiles and other build glue for llvm/clang 3.7.0, as of trunk
r239412.
2015-06-10 19:12:52 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00