Commit Graph

8587 Commits

Author SHA1 Message Date
Dimitry Andric
04677a42a3 Merge commit e8316372b from llvm git (by Louis Dionne):
[libc++] Add `__truncating_cast` for safely casting float types to
  integers

  This is needed anytime we need to clamp an arbitrary floating point
  value to an integer type.

  Thanks to Eric Fiselier for the patch.

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

  llvm-svn: 370891

Merge commit b92deded8 from llvm git (by Louis Dionne):

  [libc++] Move __clamp_to_integral to <cmath>, and harden against
  min()/max() macros

  llvm-svn: 370900

Merge commit 0ec6a4882 from llvm git (by Louis Dionne):

  [libc++] Fix potential OOB in poisson_distribution

  See details in the original Chromium bug report:
      https://bugs.chromium.org/p/chromium/issues/detail?id=994957

Together, these fix a security issue in libc++'s implementation of
std::poisson_distribution, which can be exploited to read data which is
out of bounds.

Note there are no programs in the FreeBSD base system that use
std::poisson_distribution, so this is only a possible issue for ports
and external programs which have been built against libc++.  Therefore,
I am bumping __FreeBSD_version for the benefit of our port maintainers.

Requested by:	emaste
Security:	potential OOB read
MFC after:	3 days
2019-11-07 18:26:01 +00:00
Phil Shafer
67322d1642 Import libxo-1.3.1:
- handle argv[0] without '/'
- add test case for argv[0] without '/'
2019-11-07 18:06:44 +00:00
Dimitry Andric
699c9e3a49 Merge commit 8e34dd941 from llvm git (by Sanjay Patel):
[x86] avoid crashing when splitting AVX stores with non-simple type
  (PR43916)

  The store splitting transform was assuming a simple type (MVT), but
  that's not necessarily the case as shown in the test.

This should fix 'Assertion failed: (isSimple() && "Expected a
SimpleValueType!")' when building the security/openssl111 port targeting
a CPU that supports AVX, but not AVX2, such as sandybridge.

PR:		241747
MFC after:	1 month
X-MFC-With:	r353358
2019-11-07 06:59:09 +00:00
Li-Wen Hsu
00d8365d92 Revert r354238 as the issue has been fixed in r354418
PR:		241562
Sponsored by:	The FreeBSD Foundation
2019-11-07 04:04:06 +00:00
Phil Shafer
76afb20c58 Import libxo-1.3.0:
- move from "oxtradoc" to RST/Sphinx documentation
- new "csv" encoder, which allows path and leaf lists
- address warnings from PVS-Stdio tool
- add "xolint" detected errors to the documentation
2019-11-07 03:57:04 +00:00
Conrad Meyer
be8018d788 clang: Enable unwind tables on !amd64
There doesn't seem to be much sense in defaulting "on" unwind tables on
amd64 and not on other arches.  It causes surprising differences between
platforms, such as the PR below.

Prior to this change, FreeBSD inherited the default implementation of the
method from the Gnu.h Generic_Elf => Generic_GCC parent class, which
returned true only for amd64 targets.  Override that and opt on always,
similar to, e.g., NetBSD.

PR:		241562
Reported by:	lwhsu
Reviewed by:	dim
Discussed with:	emaste
MFC after:	I'm not going to, but you should feel free
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D22252
2019-11-06 23:44:38 +00:00
Ed Maste
9999fa1cd0 blacklistd.conf.5: pluralization correction
Submitted by:	bcr in review D22259
MFC with:	r354399
2019-11-06 17:01:35 +00:00
Ed Maste
e3a90f49ad blacklist: update to NetBSD snapshot on 20191106
Cursory review:	cem
MFC after:	3 months
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22259
2019-11-06 16:21:35 +00:00
Conrad Meyer
c8b5e3de39 Fix llvm-libunwind userspace build on ARM
GCC's libgcc exports a few ARM-specific symbols for ARM EABI, AEABI, or
EHABI or whatever it's called.  Export the same ones from LLVM-libunwind's
libgcc_s, on ARM.  As part of this, convert libgcc_s from a direct
Version.map to one constructed from component Symbol.map files.  This allows
the ARM-specific Symbol.map to be included only on ARM.

Fix ARM-only oddities in struct name/aliases in LLVM-libunwind to match
non-ARM definitions and ARM-specific expectations in libcxxrt /
libcompiler_rt.

No functional change intended for non-ARM architectures.

This commit does not actually flip the switch for ARM defaults from libgcc
to llvm-libunwind, but makes it possible (to compile, anyway).
2019-11-05 03:20:40 +00:00
Dimitry Andric
2320977679 Merge commit 97e362607 from llvm git (by Nemanja Ivanovic):
[PowerPC] Do not emit HW loop if the body contains calls to
  lrint/lround

  These two intrinsics are lowered to calls so should prevent the
  formation of CTR loops. In a subsequent patch, we will handle all
  currently known intrinsics and prevent the formation of HW loops if
  any unknown intrinsics are encountered.

  Differential revision: https://reviews.llvm.org/D68841

This should fix an "invalid CRT loop" assertion when building the
www/node port for powerpc64.

Requested by:	Alfredo Dal'Ava Júnior <alfredo.junior@eldorado.org.br>
MFC after:	1 month
X-MFC-With:	r353358
2019-11-04 19:38:07 +00:00
Cy Schubert
f1b328b32f MFV r354257:
Update sqlite3-3.29.0 (3290000) --> sqlite3-3.30.1 (3300100)

MFC after:	1 month
2019-11-03 01:25:46 +00:00
Leandro Lupori
9d8d120983 [PPC64] Fix GDB sigtramp detection
Current implementation of ppcfbsd_pc_in_sigtramp() seems to take only 32-bit
PowerPC in account, as on 64-bit PowerPC most kernel instruction addresses will
be wrongly reported as in sigtramp.

This change adds proper sigtramp detection for PPC64.

Reviewed by:	jhibbits
Differential Revision:	https://reviews.freebsd.org/D22199
2019-11-01 11:28:43 +00:00
Li-Wen Hsu
c1903b634c Temporarily skip lib.libexecinfo.backtrace_test.backtrace_fmt_basic on i386
PR:		241562
Sponsored by:	The FreeBSD Foundation
2019-11-01 09:16:58 +00:00
Conrad Meyer
dd4c0b5a6c libexecinfo test: Don't strip installed test
It turns out that a test of backtrace symbol resolution and formatting
requires symbols.  Another option mightt be building with -rdynamic instead,
but this works for now.

Re-enabled skipped CI test, as it should now pass.

PR:		241562
Submitted by:	lwhsu
Reported by:	lwhsu
X-MFC-With:	r354126, r354135, r354144
2019-10-29 18:24:36 +00:00
Dimitry Andric
f1eeb689ab Pull in r373338 from upstream llvm trunk (by Simon Pilgrim):
Revert rL349624 : Let TableGen write output only if it changed,
  instead of doing so in cmake, attempt 2

  Differential Revision: https://reviews.llvm.org/D55842
  -----------------
  As discussed on PR43385 this is causing Visual Studio msbuilds to
  perpetually rebuild all tablegen generated files

Pull in r373664 from upstream llvm trunk (by Nico Weber):

  Reland r349624: Let TableGen write output only if it changed, instead
  of doing so in cmake

  Move the write-if-changed logic behind a flag and don't pass it with
  the MSVC generator. msbuild doesn't have a restat optimization, so
  not doing write-if-change there doesn't have a cost, and it should
  fix whatever causes PR43385.

This should fix the scenario where an incremental build from before
r353358 (the clang 9.0.0 upgrade) to r353358 or later fails to update
the timestamp of the generated lib/clang/headers/arm_fp16.h header.

After such a build, installing world from read-only source and object
directories would attempt to generate the header again, leading to
"clang-tblgen: error opening arm_fp16.h.d:Read-only file system".

Reported by:	avg, np
PR:		241402
MFC after:	1 month
X-MFC-With:	r353358
2019-10-29 16:51:12 +00:00
Li-Wen Hsu
24f584f149 Temporarily disable failing case in CI:
- lib.libexecinfo.backtrace_test.backtrace_fmt_basic

PR:		241562
Sponsored by:	The FreeBSD Foundation
2019-10-29 04:28:24 +00:00
Conrad Meyer
f5ef5f675d Remove bogus requirement from libexecinfo test
The bogus requirement was causing CI infrastructure (which does not mount
procfs) to skip the test.  Procfs has not been needed by libexecinfo on
FreeBSD (nor NetBSD) for years.  Both now use a sysctl to obtain the path to
the current process image.

X-MFC-With:	r354126
2019-10-28 17:12:45 +00:00
Conrad Meyer
499fe48de8 Sync up with NetBSD libexecinfo changes 2014-2019
Drop portions that are unlit or redundant with llvm-libunwind: builtin.c,
unwind.h, and unwind_arm_ehabi_stub.c.

This code should now work with -fPIE binaries, should we choose to build any
that way.

When backtrace() array is full, signal an error so the underlying
Itanium-style C++ exception handling library (llvm-libunwind) knows to stop
tracing instead of continuing.  (It should stop on its own when it finishes
unwinding, so this is mostly an extra seatbelt against an infinite loop bug
in the unwinder.)
2019-10-26 06:59:59 +00:00
Dimitry Andric
1927000d52 Pull in r372186 from upstream llvm trunk (by Eli Friedman):
[ARM] VFPv2 only supports 16 D registers.

  r361845 changed the way we handle "D16" vs. "D32" targets; there used
  to be a negative "d16" which removed instructions from the
  instruction set, and now there's a "d32" feature which adds
  instructions to the instruction set.  This is good, but there was an
  oversight in the implementation: the behavior of VFPv2 was changed.
  In particular, the "vfp2" feature was changed to imply "d32". This is
  wrong: VFPv2 only supports 16 D registers.

  In practice, this means if you specify -mfpu=vfpv2, the compiler will
  generate illegal instructions.

  This patch gets rid of "vfp2d16" and "vfp2d16sp", and fixes "vfp2"
  and "vfp2sp" so they don't imply "d32".

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

Pull in r372187 from upstream clang trunk (by Eli Friedman):

  [ARM] Update clang for removal of vfp2d16 and vfp2d16sp

  Matching fix for https://reviews.llvm.org/D67375 (r372186).

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

This should fix clang generating invalid opcodes for floating point
operations on armv6.

Requested by:	mmel
MFC after:	3 days
2019-10-25 21:00:49 +00:00
Brooks Davis
166793cc5b binutils: Fix bugs found by -Wpointer-compare
The MIPS bug was introduced by upstream commit 7403cb630, which failed
to account for the additional indirection introduced and also dropped
one of the checks; change it to the standard "NULL-or-empty" check as
used elsewhere in BFD, which is also what upstream now has.

Submitted by:	James Clarke <jrtc27@jrtc27.com>
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21911
2019-10-24 22:34:48 +00:00
Dimitry Andric
653fac7d1a Bump clang's default target CPU for the i386 architecture (aka "x86") to
i686, as per the discussion on the freebsd-arch mailing list.  Earlier
in r352030, I had already bumped it to i586, to work around missing
atomic 64 bit functions for the i386 architecture.

Relnotes:	yes
2019-10-23 16:57:11 +00:00
Ed Maste
6dc32306e9 blacklistd: remove reference to NetBSD npfctl
Xr pfctl instead.

PR:		221069
Submitted by:	"fml"
MFC after:	3 days
2019-10-22 18:30:51 +00:00
Brooks Davis
d803a9d0e5 Update tcsh to git revision 83c5be0 bringing in a number of bug fixes.
Reported by:	sobomax
MFC after:	3 days
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22099
2019-10-21 21:21:34 +00:00
Dimitry Andric
263323711d Pull in r374154 from upstream clang trunk (by Simon Atanasyan):
[mips] Set default float ABI to "soft" on FreeBSD

  Initial patch by Kyle Evans.

  Fix PR43596

Requested by:	kevans
MFC after:	1 month
X-MFC-With:	r353358
2019-10-18 20:05:27 +00:00
Dimitry Andric
1b0cd7b6b4 Pull in r372651 from upstream lld trunk (by Simon Atanasyan):
[mips] Support elf32btsmipn32_fbsd / elf32ltsmipn32_fbsd emulations

  Patch by Kyle Evans.

Requested by:	kevans
MFC after:	1 month
X-MFC-With:	r353358
2019-10-18 20:02:46 +00:00
John Baldwin
f7f6b03a13 Use __FreeBSD_version to determine if gets() has been removed.
GCC compilers set __FreeBSD__ statically to a build-time determined
targeted version (which in ports always matches the build host's
version).  This means that when building any version (12 or 13, etc.)
of riscv or some other architecture via GCC on a 12.x host,
__FreeBSD__ will always be set to 12.  As a result, __FreeBSD__ cannot
be used to reliably detect the target FreeBSD version being built.
Instead, __FreeBSD_version from either <sys/param.h> (in the kernel)
or <osreldate.h> (in userland) should be used.

This changes the gets() test in libc++ to use __FreeBSD_version from
<osreldate.h>.

Reported by:	jenkins (riscv64 and amd64-gcc)
Reviewed by:	dim, imp
Differential Revision:	https://reviews.freebsd.org/D22034
2019-10-15 18:16:10 +00:00
Dimitry Andric
390ceeb437 Pull in r374444 from upstream lldb trunk (by me):
Fix process launch failure on FreeBSD after r365761

  Summary:
  After rLLDB365761, and with `LLVM_ENABLE_ABI_BREAKING_CHECKS`
  enabled, launching any process on FreeBSD crashes lldb with:

  ```
  Expected<T> must be checked before access or destruction.
  Expected<T> value was in success state. (Note: Expected<T> values in
  success mode must still be checked prior to being destroyed).
  ```

  This is because `m_operation_thread` and `m_monitor_thread` were
  wrapped in `llvm::Expected<>`, but this requires the objects to be
  correctly initialized before accessing them.

  To fix the crashes, use `llvm::Optional<>` for the members (as
  indicated by labath), and use local variables to store the return
  values of `LaunchThread` and `StartMonitoringChildProcess`.  Then,
  only assign to the member variables after checking if the return
  values indicated success.

  Reviewers: devnexen, emaste, MaskRay, mgorny

  Reviewed By: devnexen

  Subscribers: jfb, labath, krytarowski, lldb-commits

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

PR:		241137
MFC after:	1 month
X-MFC-With:	r353358
2019-10-10 20:33:55 +00:00
Dimitry Andric
6cc0992fb5 Revert r353363 in preparation for applying upstream fix:
Put in a band-aid fix for lldb 9 exiting with "Expected<T> must be
checked before access or destruction" when launching executables, while
we sort this out with upstream.

PR:		241137
MFC after:	1 month
X-MFC-With:	r353358
2019-10-10 20:30:54 +00:00
Ruslan Bukin
e047b568fb Remove a stale file left after merging.
Sponsored by:	DARPA, AFRL
2019-10-10 13:44:12 +00:00
Ruslan Bukin
fc5020859f Update ARM CoreSight trace decoder library.
Its latest version merged from:
^/vendor/opencsd/a1961c91b02a92f3c6ed8b145c636ac4c5565aca

Sponsored by:	DARPA, AFRL
2019-10-10 13:30:13 +00:00
Ruslan Bukin
85f87cf491 Update Intel Processor Trace decoder library.
Its latest version merged from:
^/vendor/processor-trace/892e12c5a27bda5806d1e63269986bb4171b5a8b

Sponsored by:	DARPA, AFRL
2019-10-10 12:46:34 +00:00
Dimitry Andric
a930ecddaa Put in a band-aid fix for lldb 9 exiting with "Expected<T> must be
checked before access or destruction" when launching executables, while
we sort this out with upstream.

Reported by:	jbeich
PR:		241137
MFC after:	1 month
X-MFC-With:	r353358
2019-10-09 19:51:41 +00:00
Dimitry Andric
9122aeeaa6 Merge ^/head r353316 through r353350. 2019-10-09 16:40:22 +00:00
Brooks Davis
f189761366 Fix various -Wpointer-compare warnings
This warning (comparing a pointer against a zero character literal
rather than NULL) has existed since GCC 7.1.0, and was recently added to
Clang trunk.

Almost all of these are harmless, except for fwcontrol's str2node, which
needs to both guard against dereferencing a NULL pointer (though in
practice it appears none of the callers will ever pass one in), as well
as ensure it doesn't parse the empty string as node 0 due to strtol's
awkward interface.

Submitted by:	James Clarke <jtrc27@jrtc27.com>
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21914
2019-10-08 21:14:09 +00:00
Brooks Davis
cc698b4900 Update tcsh to 6.21.00.
This is a bugfix release with no new features.  A number of these fixes
were previously merged into our tree.

Sponsored by:	DARPA, AFRL
2019-10-08 20:59:31 +00:00
Dimitry Andric
8b3bc70a2b Merge ^/head r352764 through r353315. 2019-10-08 18:17:02 +00:00
Dimitry Andric
02a0b45ff6 Pull in r357528 from upstream llvm trunk (by Craig Topper):
[X86] Check MI.isConvertibleTo3Addr() before calling
  convertToThreeAddress in X86FixupLEAs.

  X86FixupLEAs just assumes convertToThreeAddress will return nullptr
  for any instruction that isn't convertible.

  But the code in convertToThreeAddress for X86 assumes that any
  instruction coming in has at least 2 operands and that the second one
  is a register. But those properties aren't guaranteed of all
  instructions. We should check the instruction property first.

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

  [X86] Don't convert 8 or 16 bit ADDs to LEAs on Atom in FixupLEAPass.

  We use the functions that convert to three address to do the
  conversion, but changing an 8 or 16 bit will cause it to create a
  virtual register. This can't be done after register allocation where
  this pass runs.

  I've switched the pass completely to a white list of instructions
  that can be converted to LEA instead of a blacklist that was
  incorrect. This will avoid surprises if we enhance the three address
  conversion function to include additional instructions in the future.

  Fixes PR42565.

This should fix assertions/segfaults when compiling certain ports with
CPUTYPE=atom.

PR:		240928
MFC after:	3 days
2019-09-30 19:24:21 +00:00
Mark Johnston
052ad61b7e Capsicumize nm(1).
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21107
2019-09-30 17:27:59 +00:00
Mark Johnston
8d3d724796 nm: Adjust argc and argv in get_opt().
This refactoring makes it slightly easier to capsicumize nm(1).

Discussed with:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-09-30 17:26:42 +00:00
Mark Johnston
65bc027257 Capsicumize c++filt(1).
Reviewed by:	emaste
Discussed with:	oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21106
2019-09-30 16:10:42 +00:00
Aleksandr Rybalko
164e7901a0 Initialize baseaddr to suppres warning.
Pointy hat to:	ray
2019-09-29 23:47:23 +00:00
Aleksandr Rybalko
0705bb9de5 ections into expected offset in binary format.
Calculate binary file offset using address field, bacause software know only offset to known data, not where to load segment.
With that patch, kernel .data section can have any alignment/offset - kernel boor fine.

PR:		235391
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	D21827
2019-09-29 22:34:01 +00:00
Jilles Tjoelker
4f77551258 Adjust tests after page fault changes in r352807
Commit r352807 fixed various signal numbers and codes from page faults;
adjust the tests so they expect the fixes to be present.

PR:		211924
2019-09-29 15:17:58 +00:00
Ed Maste
cdb42801d0 compiler-rt: correct RISC-V struct_kernel_stat64_sz
The value of struct_kernel_stat64_sz introduced by review D5021 for
RISC-V was incorrect.

Also add a __riscv_xlen == 64 conditional as the 32-bit ABI is not yet
finalized.

Submitted by:	Luís Marques
Differential Revision:	https://reviews.freebsd.org/D21684
2019-09-27 13:14:36 +00:00
Cy Schubert
a97e8d2fe4 Implement the dynamic add (-A) and removal (-R) of ippool pools
from the command line. Prior to this the functionality was mostly there
however since the pool type (-t) was not recognized by the -A and -R
command options -- not recognized by getopt(). Additionally the code to
implement the dynamic add and removal of pools didn't work.

When dynamically adding (-A) a pool a type (-t) to specify if the pool
is a tree or hash pool must  be specified. When dynamically removing (-R)
a pool, omitting -t will cause a search-and-destroy which will remove
both types of pools matching the name given (-m).

PR:		218433
MFC after:	1 week
2019-09-27 00:29:12 +00:00
Cy Schubert
e7257e1499 The no resolve (OPT_NORESOLVE) does nothing. Additionally, it (-R)
conflicts with the command option of the same name (also -R).
Remove the superfluous and confusing non-global non-command -R option.

PR:		218433
MFC after:	1 week
2019-09-27 00:29:09 +00:00
Cy Schubert
80aa6435f0 Sync with source:
Only a role of "ipf" is currentlysupported as the other documented
(and undocumented) roles are #ifdef'd out.

The plan is to complete ippool(8) as it is even in its current state
a powerful feature/tool.

PR:		218433
MFC after:	1 month
2019-09-27 00:29:06 +00:00
Cy Schubert
a263199455 Fix a typo.
MFC after:	3 days
2019-09-27 00:29:03 +00:00
Dimitry Andric
668ee10168 Merge ^/head r352587 through r352763. 2019-09-26 18:25:54 +00:00
Dimitry Andric
6b3555c38e Enable OpenMP for powerpc64
Summary: When powerpc64 switches to LLVM, use this patch to enable
OpenMP as well. OpenMP on PPC is only for 64-bits, so don't make a
32-bit libomp. A change to openmp files is necesssary (under review on
https://reviews.llvm.org/D67190), because it determines ELF format
version based on endianness, which is incorrect.

Reviewed by:	alfredo.junior_eldorado.org.br, #manpages
Differential Revision: https://reviews.freebsd.org/D21532
2019-09-26 18:24:04 +00:00
Cy Schubert
4fcb870612 Teach the ippool parser about address families. This is a precursor
to implementing IPv6 support within ippool which requires reworking
radix_ipf.c.

MFC after:	1 month
2019-09-26 03:09:45 +00:00
Martin Matuska
f057565e0d MFV r352731:
Sync libarchive with vendor.

Relevant vendor changes:
  Issue #1237: Fix integer overflow in archive_read_support_filter_lz4.c
  PR #1249: Correct some typographical and grammatical errors.
  PR #1250: Minor corrections to the formatting of manual pages

MFC after:	1 week
2019-09-26 01:50:20 +00:00
Martin Matuska
a297901e6c Update vendor/libarchive/dist to git 2f3033ca23f8c21160506c3c7ac8a0df0d3fde42
Relevant vendor changes:
  Issue #1237: Fix integer overflow in archive_read_support_filter_lz4.c
  PR #1249: Correct some typographical and grammatical errors.
  PR #1250: Minor corrections to the formatting of manual pages
2019-09-26 01:42:09 +00:00
Kyle Evans
38325e2ab8 bsdgrep(1): various fixes of empty pattern/exit code/-c behavior
When an empty pattern is encountered in the pattern list, I had previously
broken bsdgrep to count that as a "match all" and ignore any other patterns
in the list. This commit rectifies that mistake, among others:

- The -v flag semantics were not quite right; lines matched should have been
  counted differently based on whether the -v flag was set or not. procline
  now definitively returns whether it's matched or not, and interpreting
  that result has been kicked up a level.
- Empty patterns with the -x flag was broken similarly to empty patterns
  with the -w flag. The former is a whole-line match and should be more
  strict, only matching blank lines. No -x and no -w will will match the
  empty string at the beginning of each line.
- The exit code with -L was broken, w.r.t. modern grep. Modern grap will
  exit(0) if any file that didn't match was output, so our interpretation
  was simply backwards. The new interpretation makes sense to me.

Tests updated and added to try and catch some of this.

This misbehavior was found by autoconf while fixing ports found in PR 229925
expecting either a more sane or a more GNU-like sed.

MFC after:	1 week
2019-09-25 17:14:43 +00:00
Dimitry Andric
8b1412a144 Pull in r372606 from upstream llvm trunk (by Sanjay Patel):
[x86] fix assert with horizontal math + broadcast of vector (PR43402)

  https://bugs.llvm.org/show_bug.cgi?id=43402

This should fix 'Assertion failed: ((HOp.getValueType() == MVT::v2f64 ||
HOp.getValueType() == MVT::v4f64) && HOp.getValueType() == VT &&
"Unexpected type for h-op"), function foldShuffleOfHorizOp, file
contrib/llvm/lib/Target/X86/X86ISelLowering.cpp, line 33661' when
building the devel/llvm90 port with CPUTYPE=haswell.

PR:		240759
2019-09-23 17:05:46 +00:00
Dimitry Andric
6d3bb28257 Pull in r372513 from upstream lld trunk (by Simon Atanasyan):
[mips] Deduce MIPS specific ELF header flags from `emulation`

  In case of linking binary blobs which do not have any ELF headers, we
  can deduce MIPS ABI ELF header flags from an `emulation` option.

  Patch by Kyle Evans.

Requested by:	kevans :)
2019-09-22 17:31:27 +00:00
Dimitry Andric
f05b9584fa Merge ^/head r352537 through r352586. 2019-09-21 21:02:57 +00:00
Dimitry Andric
8a4b4f9f2b Pull in r371557 from upstream clang trunk (by Richard Smith):
When evaluating a __builtin_constant_p conditional, always enter
  constant-folding mode regardless of the original evaluation mode.

  In order for this to be correct, we need to track whether we're
  checking for a potential constant expression or checking for
  undefined behavior separately from the evaluation mode enum, since we
  don't want to clobber those states when entering constant-folding
  mode.

This should fix "ld: error: undefined symbol: ix86_isa_flags" (and many
other symbol names) during the initial stages of the lang/gcc* ports.

The issue was that without optimization, the __builtin_constant_p()
expressions generated in gencondmd.c would emit references to global
variables that were undefined, such as ix86_isa_flags.

PR:		240629
2019-09-21 21:01:38 +00:00
Cy Schubert
20674acb70 Follow up on r352304 which disabled default mlockall() at startup.
Unfortunately though the original tarball supports this in ./configure
(for Linux), to fully support disabling of mlockall() by default requires
a little extra help otherwise the following is logged in syslog:

	Cannot set RLIMIT_MEMLOCK: Operation not permitted

MFC after:	2 weeks
X-MFC with:	r352304
2019-09-19 20:16:51 +00:00
Dimitry Andric
7dfde55afd Pull in r371066 from upstream clang trunk (by Justin Hibbits):
Add -m(no)-spe to clang

  Summary:
  r337347 added support for the Signal Processing Engine (SPE) to LLVM.
  This follows that up with the clang side.

  This adds -mspe and -mno-spe, to match GCC.

  Subscribers: nemanjai, kbarton, cfe-commits

  Differential Revision: https://reviews.llvm.org/D49754
2019-09-19 19:42:59 +00:00
Dimitry Andric
2ee8a62f0f Partially undo r351659, which unconditionally removed gets(3) from libc++.
Instead, pull in r371324 from upstream libc++ trunk (by me):

  Remove ::gets for FreeBSD 13 and later

  Summary:

  In https://svnweb.freebsd.org/changeset/base/351659 @emaste removed
  gets() from FreeBSD 13's libc, and our copies of libc++ and
  libstdc++.  In that change, the declarations were simply deleted, but
  I would like to propose this conditional test instead.

  Reviewers: EricWF, mclow.lists, emaste

  Reviewed By: mclow.lists

  Subscribers: krytarowski, christof, ldionne, emaste, libcxx-commits

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

This makes these changes more MFCable.
2019-09-19 19:39:34 +00:00
Dimitry Andric
0f80acb965 Merge ^/head r352436 through r352536. 2019-09-19 19:26:12 +00:00
Dimitry Andric
7fc776a827 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmp
release 9.0.0 r372316, and update version numbers.
2019-09-19 19:25:01 +00:00
Konstantin Belousov
0edc114ac0 realloc(x, 0) should not return NULL.
See http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400.
Upstream jemalloc issue is opened by emaste at
https://github.com/jemalloc/jemalloc/issues/1629.

Reviewed by:	emaste
PR:	240456
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
DIfferential revision:	https://reviews.freebsd.org/D21632
2019-09-17 18:36:29 +00:00
Li-Wen Hsu
7b2f790200 Temporarily skip flakey test case lib.libc.sys.stat_test.stat_socket
PR:		240621
Sponsored by:	The FreeBSD Foundation
2019-09-17 14:08:09 +00:00
Dimitry Andric
c0f37bf652 Fix arm and aarch64 builds of libedit after r352275
On arm and arm64, where chars are unsigned by default, buildworld dies
with:

--- terminal.o ---
/usr/src/contrib/libedit/terminal.c:569:41: error: comparison of
integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
'unsigned int') [-Werror,-Wsign-compare]
                                     el->el_cursor.v][where & 0370] !=
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/src/contrib/libedit/terminal.c:659:28: error: comparison of
integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
'unsigned int') [-Werror,-Wsign-compare]
                                     [el->el_cursor.h] == MB_FILL_CHAR)
                                     ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~

Fix this by making MB_FILL_CHAR a wint_t, so no casting is needed.

Note that in https://reviews.freebsd.org/D21584 this was also proposed
by Yuichiro Naito <naito.yuichiro_gmail.com>.

Reviewed by:	bapt
Subscribers:	naito.yuichiro_gmail.com, ml_vishwin.info
MFC after:	3 weeks
X-MFC-With:	r352275
Differential Revision: https://reviews.freebsd.org/D21657
2019-09-14 21:49:42 +00:00
Dimitry Andric
c950e61287 Work around gcc's inability to compile an incomplete type in googletest,
leading to hundreds of lines of fairly unreadable error messages.

I don't think we particularly care about the specific source file gcc
dies on, and the many layers of macros and sub-types in googletest make
it very hard to diagnose whether this is a bug in googletest, gcc, clang
or libc++.
2019-09-14 19:19:38 +00:00
Dimitry Andric
ceb19815c7 Revert commit from upstream llvm trunk (by Hans Wennborg):
Re-commit r357452 (take 3): "SimplifyCFG
  SinkCommonCodeFromPredecessors: Also sink function calls without used
  results (PR41259)"

  Third time's the charm.

  This was reverted in r363220 due to being suspected of an internal
  benchmark regression and a test failure, none of which turned out to
  be caused by this.

As reported in https://bugs.llvm.org/show_bug.cgi?id=43269, this causes
UNREACHABLE errors when compiling if_malo_pci.c for arm and aarch64.
2019-09-14 10:55:33 +00:00
Dimitry Andric
c0035c9efc Apply tentative fix for libedit build error on arm. 2019-09-14 10:51:18 +00:00
Dimitry Andric
61c1328eb0 Merge ^/head r352105 through r352307. 2019-09-13 21:15:01 +00:00
Dimitry Andric
7b01d357a2 Include <stdint.h> in unwind-arm.h, since it uses uint32_t and uint64_t
in various declarations.

Otherwise, depending on how unwind-arm.h is included from other source
files, the compiler may complain that uint32_t and uint64_t are unknown
types.

MFC after:	3 days
2019-09-13 21:00:19 +00:00
Bryan Drewery
62a4b30239 mtree -O: Fix not descending on hash collisions
MFC after:	2 weeks
Obtained from:	NetBSD (nakayama)
2019-09-12 20:46:46 +00:00
Bryan Drewery
09c9ed3b05 mtree -c: Fix username logic when getlogin(3) fails.
Obtained from:	NetBSD (Credit to Sascha Wildner with DragonFlyBSD)
MFC after:	2 weeks
2019-09-12 18:51:59 +00:00
Bryan Drewery
4f4b548b1d mtree: Fix -f -f not considering type changes.
This only lists the changed type and not other attributes so that it
matches the behavior of -C as done in r66747 for fmtree. The NetBSD
-ff implementation was copied from fmtree.

Reviewed by:	imp
MFC after:	2 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D21623
2019-09-12 18:44:48 +00:00
Baptiste Daroussin
d3a4d55866 Remove usesless readline compat includes which will reinclude readline.h
itself.

This simplifies the upcoming update to newer libedit.
2019-09-12 08:54:48 +00:00
Philip Paeps
798c0c0b01 Import tzdata 2019c
Changes: https://github.com/eggert/tz/blob/2019c/NEWS

MFC after:	3 days
2019-09-12 00:19:16 +00:00
Li-Wen Hsu
dfcf2d87dd Only skip problematic test in CI env.
PR:		237450
Sponsored by:	The FreeBSD Foundation
2019-09-11 18:40:05 +00:00
Baptiste Daroussin
96c81c97e4 Readd _el_fn_sh_complete for backward compatibility
This function is not needed anymore, it allows old sh binary to continue
to run and avoid breaking backward compatibility.
Note that is now just calls the regular _el_fn_complete which does a proper
job at quoting.

Discussed with:	jilles
2019-09-11 07:03:17 +00:00
Baptiste Daroussin
d0ef721ed3 Import libedit 2019-09-10
Compared to current version in base:
- great improvements on the Unicode support
- full support for filename completion including quoting
  which means we do not need anymore our custom addition)
- Improved readline compatiblity

Upgrading libedit has been a pain in the past, because somehow we never
managed to properly cleanup the tree in lib/libedit and each merge has always
been very painful. After years of fighting give up and refresh a merge from
scrarch properly in contrib.

Note that the switch to this version will be done in another commit.
2019-09-10 14:30:10 +00:00
Dimitry Andric
f993ed2fbd Merge ^/head r351732 through r352104. 2019-09-09 19:58:46 +00:00
Ed Maste
057a14dafb compiler-rt: use 64-bit time_t for all FreeBSD archs except i386
Obtained from:	LLVM r370756
2019-09-09 18:33:15 +00:00
Ed Maste
af3c40982c compiler-rt: use more __sanitizer_time_t on FreeBSD
A few structs were using long for time_t members.

Obtained from:	LLVM r370755
2019-09-09 18:32:29 +00:00
Dimitry Andric
c0e18e70bd Target i586 by default on the i386 architecture, since after upstream's
change https://reviews.llvm.org/rL356631 ("[X86] Add CMPXCHG8B feature
flag. Set it for all CPUs except i386/i486 including 'generic'. Disable
use of CMPXCHG8B when this flag isn't set"), clang now correctly emits
calls to __atomic_load_8, __atomic_store_8, etc. when targeting i486,
and this means we can no longer link most modern programs, because we do
not have a libatomic, nor support for atomic functions in libc.  See
also PR 230888, 220822, 233725, 234976, and more probably duplicates.

Note that in practice, clang has been incorrectly generating cmpxchg8b
instructions for years now, when targeting i486.  So de facto nothing
really changes by doing this.
2019-09-08 10:31:34 +00:00
Dimitry Andric
e2d4fd9739 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmp
release_90 branch r371301, and update version numbers.
2019-09-07 12:31:36 +00:00
Dimitry Andric
617ea2e6c8 Pull in r370426 from upstream llvm trunk (by Fāng-ruì Sòng):
[PPC32] Emit R_PPC_GOT_TPREL16 instead R_PPC_GOT_TPREL16_LO

  Unlike ppc64, which has ADDISgotTprelHA+LDgotTprelL pairs, ppc32 just
  uses LDgotTprelL32, so it does not make lots of sense to use _LO
  without a paired _HA.

  Emit R_PPC_GOT_TPREL16 instead R_PPC_GOT_TPREL16_LO to match GCC, and
  get better linker relocation check. Note, R_PPC_GOT_TPREL16_{HA,LO}
  don't have good linker support:

  (a) lld does not support R_PPC_GOT_TPREL16_{HA,LO}.
  (b) Top of tree ld.bfd does not support R_PPC_GOT_REL16_HA
      Initial-Exec -> Local-Exec relaxation:

    // a.o
    addis 3, 3, tsd_tls@got@tprel@ha
    lwz 3, tsd_tls@got@tprel@l(3)
    add 3, 3, tsd_tls@tls
    // b.o
    .section .tdata,"awT"; .globl tsd_tls; tsd_tls:

    // ld/ld-new a.o b.o
    internal error, aborting at ../../bfd/elf32-ppc.c:7952 in
    ppc_elf_relocate_section

  Reviewed By: adalava

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

This allows use of LLD for linking 32-bit static binaries on
FreeBSD/powerpc.

Submitted by:	Alfredo Dal'Ava Júnior <alfredo.junior@eldorado.org.br>
2019-09-07 12:23:57 +00:00
Dimitry Andric
211f2e5c6b Pull in r371111 from upstream llvm trunk (by Eli Friedman):
[IfConversion] Fix diamond conversion with unanalyzable branches.

  The code was incorrectly counting the number of identical
  instructions, and therefore tried to predicate an instruction which
  should not have been predicated.  This could have various effects: a
  compiler crash, an assembler failure, a miscompile, or just
  generating an extra, unnecessary instruction.

  Instead of depending on TargetInstrInfo::removeBranch, which only
  works on analyzable branches, just remove all branch instructions.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and
  https://bugs.llvm.org/show_bug.cgi?id=41121 .

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

This should fix "Unable to predicate BX killed renamable $r0" errors
when building the lang/spidermonkey170 and lang/spidermonkey38 ports for
armv7 and armv6.

PR:		236567
MFC after:	3 days
2019-09-06 16:06:37 +00:00
Dimitry Andric
fec2a7b242 Catch up our non-upstreamed riscv parts in libunwind:
* DEFINE_LIBUNWIND_PRIVATE_FUNCTION changed into
  DEFINE_LIBUNWIND_FUNCTION
* unw_getcontext changed into __unw_getcontext
2019-09-05 18:47:58 +00:00
Dimitry Andric
24ea14660b Pull in r369828 from upstream lld trunk (by Fāng-ruì Sòng):
[ELF] Align the first section of a PT_LOAD even if its type is
  SHT_NOBITS

  Reported at https://reviews.llvm.org/D64930#1642223

  If the only section of a PT_LOAD is a SHT_NOBITS section (e.g. .bss),
  we may not align its sh_offset. p_offset of the PT_LOAD will be set
  to sh_offset, and we will get p_offset!=p_vaddr (mod p_align).  If
  such executable is mapped by the Linux kernel, it will segfault.

  After D64906, this may happen the non-linker script case.

  The linker script case has had this issue for a long time.  This was
  fixed by rL321657 (but the test linkerscript/nobits-offset.s failed
  to test a SHT_NOBITS section), but broken by rL345154.

  Reviewed By: peter.smith

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

Pull in r371013 from upstream lld trunk (by Rui Ueyama):

  Align output segments correctly

  Previously, segments were aligned according to their first section's
  alignment requirements. That was not correct, but segments are also
  aligned to a page boundary, and a page boundary is usually much
  larger than a section alignment requirement, so no one noticed this
  bug before.

  Now, lld has --nmagic option which sets maxPageSize to 1 to
  effectively disable page alignment, which reveals the issue.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=43212

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

Together, these should ensure gpboot.out gets a correctly aligned offset
for its .rodata section, and fix "layout constraint violation" errors
from objcopy.
2019-09-05 17:53:41 +00:00
Dimitry Andric
c5c3ba6b43 Merge ^/head r351317 through r351731. 2019-09-03 05:58:43 +00:00
Dimitry Andric
6a82ac86f0 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmp
release_90 branch r370514, and update version numbers.
2019-09-02 17:55:39 +00:00
Dimitry Andric
22f75ae738 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb, and openmp
release_90 branch r369369, and update version numbers.
2019-09-02 17:32:57 +00:00
Ed Maste
aebac09b6f lldb: shorten thread names to make logs easier to follow
lldb prepends the thread name to log entries, and the existing thread
name for the FreeBSD ProcessMonitor thread was longer than the kernel's
supported thread name length, and so was truncated.  This made logs hard
to read, as the truncated thread name ran into the log message.  Shorten
"lldb.process.freebsd.operation" to just "freebsd.op" so that logs are
more readable.

(Upstreaming to lldb still to be done).
2019-09-01 16:50:34 +00:00
Ed Maste
da15a90df6 libstdc++: remove gets
Removed from libc in r351659
2019-09-01 16:41:24 +00:00
Ed Maste
7381dcc9ee libc: remove gets
gets is unsafe and shouldn't be used (for many years now).  Leave it in
the existing symbol version so anything that previously linked aginst it
still runs, but do not allow new software to link against it.

(The compatability/legacy implementation must not be static so that
the symbol and in particular the compat sym gets@FBSD_1.0 make it
into libc.)

PR:		222796 (exp-run)
Reported by:	Paul Vixie
Reviewed by:	allanjude, cy, eadler, gnn, jhb, kib, ngie (some earlier)
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12298
2019-09-01 16:12:05 +00:00
Dimitry Andric
302310d928 Update libunwind custom frame register and deregister functions for
FreeBSD: use the new doubly underscored names for unw_add_dynamic_fde
and unw_remove_dynamic_fde.

NOTE: this should be upstreamed...
2019-08-29 18:53:00 +00:00
Hiroki Sato
76d46bbb0e MFV r351553:
Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions
specified in the command-line option from working.

This patch has been accepted by the upstream.

Reviewed by and discussed with:	gshapiro
2019-08-27 20:11:45 +00:00
Dimitry Andric
5c1533a86d Disable UniversalMachO support in lldb's SystemInitializerFull.cpp,
since we do not need it.
2019-08-26 20:56:16 +00:00
Dimitry Andric
1f1d86b2b3 Update FREEBSD-Xlist for lldb. 2019-08-25 20:36:52 +00:00
Dimitry Andric
1771245355 Merge missed sources for lldb-specific TableGen tool. 2019-08-25 20:36:02 +00:00
Dimitry Andric
cbcf53de47 Merge openmp trunk r366426, resolve conflicts, and add FREEBSD-Xlist. 2019-08-22 20:26:20 +00:00