Commit Graph

3430 Commits

Author SHA1 Message Date
Kyle Evans
7cc42f6d25 Do a sweep and remove most WARNS=6 settings
Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.
2020-10-01 01:10:51 +00:00
Kyle Evans
fe815331bb build: provide a default WARNS for all in-tree builds
The current default is provided in various Makefile.inc in some top-level
directories and covers a good portion of the tree, but doesn't cover parts
of the build a little deeper (e.g. libcasper).

Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that
variable is defined. This lets us relatively cleanly provide a default WARNS
no matter where you're building in the src tree without breaking things
outside of the tree.

Crunchgen has been updated as a bootstrap tool to work on this change
because it needs r365605 at a minimum to succeed. The cleanup necessary to
successfully walk over this change on WITHOUT_CLEAN builds has been added.

There is a supplemental project to this to list all of the warnings that are
encountered when the environment has WARNS=6 NO_WERROR=yes:
https://warns.kevans.dev -- this project will hopefully eventually go away
in favor of CI doing a much better job than it.

Reviewed by:	emaste, brooks, ngie (all earlier version)
Reviewed by:	emaste, arichardson (depend-cleanup.sh change)
Differential Revision:	https://reviews.freebsd.org/D26455
2020-09-18 17:17:46 +00:00
Ed Maste
90b9aa475e Remove now-unused GNU as build infrastructure 2020-06-07 13:53:23 +00:00
Ed Maste
74e8d41e0a Retire BINUTILS and BINUTILS_BOOTSTRAP options
As of r361857 all BINUTILS options are disabled by default - ports
have been changed to depend on binutils if they require GNU as, and
all base system assembly files have been switched to use Clang's
integrated assembler.

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2020-06-07 00:07:21 +00:00
Ed Maste
0ad202f312 Remove GNU objcopy and objdump build infrastructure
We haven't used the GNU versions of these tools for some time.
2020-06-06 02:45:57 +00:00
Ed Maste
af097a7d50 binutils: build as with BINUTILS || BINUTILS_BOOTSTRAP
Previously we descended into as only if MK_BINUTILS was true, including
during the bootstrap tool phase.  BINUTILS is now disabled by default on
all archs, and we failed to build it during amd64 bootstrap.

Descend into as if either BINUTILS or BINUTILS_BOOTSTRAP is enabled.

This is not quite correct: we should either have the test also depend on
BOOTSTRAPPING, or set BINUTILS to the value of BINUTILS_BOOTSTRAP during
the bootstrap phase.  However, this simple change fixes the build and
has been tested, and binutils will be removed completely in the near
future.
2020-05-30 19:16:33 +00:00
Ed Maste
80b7615484 binutils: disconnect objdump from the build
The in-tree binutils is old and will not be updated.  It does not support
all archs supported by FreeBSD, and for the archs it does support not all
CPU features are supported.

Other tools have migrated to copyfree alternatives.  Although llvm-objdump
is nearly a drop-in replacement for GNU objdump it is missing a few options
and has some differences in output format.  For now just remove GNU objdump;
ports and developers can use a contemporary, maintained version from ports
or packages.  We can revisit installing llvm-objdump as objdump in the
future.

PR:		212319 [exp-run]
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7338
2020-05-06 18:38:40 +00:00
Kyle Evans
879ce458f4 userland build: replace -fno-common with ${CFCOMMONFLAG}
This change allows any downstream or otherwise consumer to easily override
the new -fno-common default on a temporary basis without having to hack into
src.sys.mk, and also makes it a bit easier to search for these specific
cases where -fno-common must be overridden with -fcommon or else the build
will fail.

The gdb build, the only program requiring -fcommon on head/, is switched
over as an example usage. It will need it on all branches, so this does not
harm future mergability.

MFC after:	3 days
2020-04-10 14:01:07 +00:00
Ed Maste
a52b0bb1d2 drop GDB_LIBEXEC option (now always true)
In-tree gdb is essentially obsolete.  We kept it for sparc64 (because
gdb in ports lacked sparc64 support) and as a fallback for crashinfo.
gdb was installed to /libexec on all archs other than sparc64, where the
WITHOUT_GDB_LIBEXEC option was default, with gdb installed to /usr/bin.
With sparc64's retirement WITH_GDB_LIBEXEC became the default for all
architectures, but it was still possible to set it off and install gdb
into /usr/bin.

As the next step in gdb's retirement, remove the option and install gdb
only into /libexec as the crashinfo fallback. We expect users to install
the gdb port or package for debugging. The in-tree gdb lacks support for
a number of supported architectures and does not support contemporary
DWARF debug info.

Reviewed by:	jhb (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24227
2020-03-30 20:05:09 +00:00
Kyle Evans
6f00f42ab6 gdb: compile with -fcommon explicitly
As described in the comment, gdb relies on some of the linker magic that
happens with -fcommon. I suspect the life expectancy of gdb-in-base is low
enough that this isn't worth spending much time addressing, especially given
the vintage. Hit it with the -fcommon hammer so that it continues to just
work.

MFC after:	3 days
2020-03-29 23:59:14 +00:00
Ed Maste
93e59da238 remove binutils ld leftovers 2020-03-27 19:17:45 +00:00
Brandon Bergren
ded22b4527 Now that there are no remaining users of ld.bfd, remove the ld subdir. 2020-03-27 01:12:11 +00:00
Brandon Bergren
a04ec978b3 [PowerPC] Switch powerpc and powerpcspe to lld
Now that LLD 10 is out, and required patches have landed, we are now ready
to finally switch away from the ancient in-tree ld.bfd.

Special thanks to Fangrui Song for many hours of work on getting the
32-bit powerpc lld ready for prime-time.

Reviewed by:	emaste (earlier revision), jhibbits
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D24111
2020-03-27 01:00:03 +00:00
Ed Maste
134b378392 retire in-tree GPL dtc devicetree compiler
Now that we no longer have GCC 4.2.1 in the tree and can assume FreeBSD
is being built with a C++11 compiler available, we can use BSDL dtc
unconditionally and retire the GPL dtc.

GPL dtc now has FreeBSD CI support via Cirrus-CI to help ensure it
continues to build/work on FreeBSD and is available in the ports tree
if needed.

The copy of (copyfree licensed) libfdt that we actually use is in
sys/contrib/libfdt so the extra copy under contrib/dtc/libfdt can be
removed along with the rest of the GPL dtc.

Reviewed by:	kevans, ian, imp, manu, theraven
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23192
2020-02-29 17:10:54 +00:00
Ed Maste
57f804675e remove GCC 4.2.1 build infrastructure
As described in Warner's email message[1] to the FreeBSD-arch mailing
list we have reached GCC 4.2.1's retirement date.  At this time all
supported architectures either use in-tree Clang, or rely on external
toolchain (i.e., a contemporary GCC version from ports).

GCC 4.2.1 was released July 18, 2007 and was imported into FreeBSD later
that year, in r171825.  GCC has served us well, but version 4.2.1 is
obsolete and not used by default on any architecture in FreeBSD.  It
does not support modern C and does not support arm64 or RISC-V.

Thanks to everyone responsible for maintaining, updating, and testing
GCC in the FreeBSD base system over the years.

So long, and thanks for all the fish.

[1] https://lists.freebsd.org/pipermail/freebsd-arch/2020-January/019823.html

PR:		228919
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23124
2020-02-29 03:25:51 +00:00
Ed Maste
7793be9752 limit building GNU assembler (as) to x86
GNU as 2.17.50 is currently required by amd64 and i386 for at least one
file that cannot be assembled by Clang's integrated assembler (IAS).
Other supported CPU architectures either use Clang IAS for all assembly
files, or rely on external toolchain.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23180
2020-01-19 19:16:32 +00:00
Ed Maste
1e1c6bb49f limit ld.bfd to powerpc
All archs except powerpc either use lld or require external toolchain.
powerpc still needs binutils ld to link 32-bit binaries.

Reviewed by:	jhibbits
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23107
2020-01-14 17:56:54 +00:00
Dimitry Andric
0b57cec536 Move all sources from the llvm project into contrib/llvm-project.
This uses the new layout of the upstream repository, which was recently
migrated to GitHub, and converted into a "monorepo".  That is, most of
the earlier separate sub-projects with their own branches and tags were
consolidated into one top-level directory, and are now branched and
tagged together.

Updating the vendor area to match this layout is next.
2019-12-20 19:53:05 +00:00
Baptiste Daroussin
905ce443f6 Get the readline header from the installed header instead of the from the source
location.
2019-09-12 15:50:14 +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
Ed Maste
7959685201 as: add deprecation notice to the man page
In the future FreeBSD will ship without GNU binutils 2.17.50.  Add a
note advising users who require GNU as to install the binutils port
or package.

Note that on armv7, arm64, amd64, i386 we currently ship only two
binutils tools (as and objdump).  A deprecation notice was added to
objdump's man page some time ago.

PR:		233611
Discussed with:	jhb
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2019-08-01 19:01:27 +00:00
Ed Maste
840dff46ae objdump: be explicit that GNU objdump that will be removed
We may install llvm-objdump as objdump (see review D18307) or just
provide no /usr/bin/objdump, but either way GNU objdump won't be
installed in the future.

MFC after:	3 days
2019-08-01 14:42:41 +00:00
Ed Maste
8e28ac6b96 objdump: move deprecation notice to indended spot in the man page
r335217 added a deprecation notice to the source file for the objdump
man page, and r335219 added it to the rendered objdump.1, but in the
wrong spot.

MFC after:	3 days
2019-08-01 14:39:26 +00:00
Justin Hibbits
e861dab451 powerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)
Summary:
Toolchain follow-up to r349350.  LLVM patches will be submitted upstream for
9.0 as well.

The bsd.cpu.mk change is required because GNU ld assumes BSS-PLT if it
cannot determine for certain that it needs Secure-PLT, and some binaries do
not compile in such a way to make it know to use Secure-PLT.

Reviewed By: nwhitehorn, bdragon, pfg
Differential Revision: https://reviews.freebsd.org/D20598
2019-06-25 02:35:22 +00:00
Leandro Lupori
8fcd12f526 [PPC] Enable build/install of ld.bfd on base
When using LLVM+clang+lld on PowerPC64, ld.bfd is also needed,
to link 32-bit binaries correctly, as lld support for 32-bit is
still minimal.

This change enables it to be built and installed when lld is used.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D20259
2019-05-20 16:00:32 +00:00
Ed Maste
14bffecf74 Fix gdb/kgdb build under WITH_PIE
Explicitly specified bare .a libraries need ${PIE_SUFFIX}.

Reported by:	David E. Cross, on twitter
Sponsored by:	The FreeBSD Foundation
2019-04-01 19:19:51 +00:00
Ed Maste
07c9bf2a44 Apply WITH_PIE changes to other binutils components
Followon to r345489, explicitly specified bare .a libraries need
${PIE_SUFFIX} (although these still built).

MFC with:	r345489
2019-03-25 01:18:26 +00:00
Ed Maste
bce37ebc34 Fix GNU objdump build under WITH_PIE
Explicitly specified bare .a libraries need ${PIE_SUFFIX}.

Reported by:	David E. Cross, on twitter
2019-03-25 01:06:29 +00:00
John Baldwin
e91609a771 Divorce MK_GDB from MK_BINUTILS.
This permits legacy GDB to still be built and installed if
WITHOUT_BINUTILS is set (e.g. if base/binutils is installed).

Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D19480
2019-03-06 20:13:02 +00:00
Pedro F. Giffuni
aa52c719ea grep(1) outputs NOT-matched lines with multi-byte characters
PR	113343
MFC after:	2 months
2019-01-10 02:59:19 +00:00
Alex Richardson
985b8e2b12 Avoid bsd.files.mk duplicate rule warning for bfd ldscripts
Without this change I get lots of
warning: duplicate script for target "_FILESINS_ldscripts/elf64btsmip_fbsd.xw" ignored
message for every tree walk.

Reviewed By:	imp, emaste
Differential Revision: https://reviews.freebsd.org/D18783
2019-01-09 11:13:05 +00:00
Ed Maste
eda7d3bec4 Do not install GNU ld if lld is /usr/bin/ld
GNU binutils ld.bfd 2.17.50 does not support ifuncs and produces broken
binaries when ifuncs are in use.  When LLD_IS_LD is default we have an
ifunc-capable system linker and can just avoid installing ld.bfd.

Reported by:	theraven
Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18340
2018-11-26 17:07:35 +00:00
Baptiste Daroussin
6794a0c94c Bring back the WARNS level to what it used to be to please gcc arches at least 2018-10-20 21:33:34 +00:00
Baptiste Daroussin
f4f33ea0c7 Update libdialog to 1.3-20180621 2018-10-20 20:49:46 +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
Brooks Davis
397358d9ac Disable sbrk() use in GNU tools.
We're studing the possibility of deprecating sbrk().  To make it easier
we're removing unnecessicary uses in the base system.  None of these
tools require sbrk(), but they agressively prefer it for no good reason.

Reviewed by:    andrew
Approved by:	re (kib)
Sponsored by:	DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D16141
2018-09-21 17:44:05 +00:00
Andrew Turner
ae1dac06a2 Teach binutils that arm64 is a 64bit architecture. This is needed to cross
build from arm64 to other architectures that use binutils.

Sponsored by:	ABT Systems Ltd
2018-07-06 11:50:59 +00:00
Bryan Drewery
96a0acc4ce Don't use CCACHE for linking.
MFC after:	2 weeks
Sponsored by:	Dell EMC
2018-06-27 19:29:15 +00:00
John Baldwin
104f6a2dcd Fix GCC 4.2.1 to honor --sysroot for includes.
- Change the C++ directory entries to honor --sysroot if it is set.
- Don't define CROSS_INCLUDE_DIR for the cross compiler.  Instead, set
  TARGET_SYSTEM_ROOT to point to WORLDTMP and always define
  STANDARD_INCLUDE_DIR.
- Change STANDARD_INCLUDE_DIR and the C++ include directories to just
  start with "/usr" always.  The compiler will prepend the sysroot when
  doing cross-builds.  GCC_INCLUDE_DIR (which contains headers that ship
  with the compiler such as intrinsincs rather than OS-supplied headers)
  remains hardcoded to look in TOOLS_PREFIX.

Reviewed by:	bdrewery (older version)
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D15127
2018-06-27 18:14:33 +00:00
John Baldwin
7cdb6a8305 Don't hardcode the TOOLS_PREFIX for the startfiles directories.
GCC 4.2 prefixes these directories with --sysroot meaning that during
buildworld they have a double sysroot.

Reviewed by:	bdrewery
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D14780
2018-06-27 18:11:47 +00:00
Bryan Drewery
d74021d65b Rework how the ld link is handled in WORLDTMP from r322811.
LLD_BOOTSTRAP (build) is independent of LLD_IS_LD (installed) so they
should not be based on each other.

This is related to upcoming WITH_SYSTEM_LINKER work.

Reviewed by:	emaste
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D15836
2018-06-20 16:10:02 +00:00
Ed Maste
2f9cfbc6f3 objdump.1: manually apply r229046 to the rendered man page 2018-06-15 17:16:27 +00:00
Baptiste Daroussin
612c330d85 Use a script wrapper for <compress>grep
Import the wrapper script from zstdgrep (written by wiz@netbsd.org)

Modify it to support more than just zstd (adding support for gzip,
lzma, xz and bzip2)

Write a simple manpage dedicated for it.

Only use that new wrapper both for gnu grep and bsd grep

Next step will be removing code related to compression format from bsdgrep

Reviewed by:	kevans
Approved by:	kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D15193
2018-04-25 13:23:58 +00:00
Konstantin Belousov
d86c1f0dc1 i386 4/4G split.
The change makes the user and kernel address spaces on i386
independent, giving each almost the full 4G of usable virtual addresses
except for one PDE at top used for trampoline and per-CPU trampoline
stacks, and system structures that must be always mapped, namely IDT,
GDT, common TSS and LDT, and process-private TSS and LDT if allocated.

By using 1:1 mapping for the kernel text and data, it appeared
possible to eliminate assembler part of the locore.S which bootstraps
initial page table and KPTmap.  The code is rewritten in C and moved
into the pmap_cold(). The comment in vmparam.h explains the KVA
layout.

There is no PCID mechanism available in protected mode, so each
kernel/user switch forth and back completely flushes the TLB, except
for the trampoline PTD region. The TLB invalidations for userspace
becomes trivial, because IPI handlers switch page tables. On the other
hand, context switches no longer need to reload %cr3.

copyout(9) was rewritten to use vm_fault_quick_hold().  An issue for
new copyout(9) is compatibility with wiring user buffers around sysctl
handlers. This explains two kind of locks for copyout ptes and
accounting of the vslock() calls.  The vm_fault_quick_hold() AKA slow
path, is only tried after the 'fast path' failed, which temporary
changes mapping to the userspace and copies the data to/from small
per-cpu buffer in the trampoline.  If a page fault occurs during the
copy, it is short-circuit by exception.s to not even reach C code.

The change was motivated by the need to implement the Meltdown
mitigation, but instead of KPTI the full split is done.  The i386
architecture already shows the sizing problems, in particular, it is
impossible to link clang and lld with debugging.  I expect that the
issues due to the virtual address space limits would only exaggerate
and the split gives more liveness to the platform.

Tested by: pho
Discussed with:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
Differential revision:	https://reviews.freebsd.org/D14633
2018-04-13 20:30:49 +00:00
John Baldwin
bd29e684d0 Use the trapframe unwinder for "fast_syscall_common".
MFC after:	3 days
2018-03-09 22:58:05 +00:00
Ed Maste
337981bd89 When lld is ld, install bfd's man page as ld.bfd.1
When WITH_LLD_IS_LD is set, lld's man page is installed as ld.1.gz, as
was GNU BFD's man page prior to this change.

Reported by:	Tobias Kortkamp
Sponsored by:	The FreeBSD Foundation
2018-03-04 01:37:49 +00:00
Baptiste Daroussin
15c36a23a1 Switch to use libedit instead of readline 2018-02-06 12:12:44 +00:00
Baptiste Daroussin
a273973175 Remove gdbtui, it was already not installed on every arches
only installed on arm and sparc64.
It is the only bits that keeps us having libreadline in base
The rest of gdb can be switched to libedit and will be in another
commit
2018-02-06 11:54:20 +00:00
John Baldwin
09707a19f0 Recognize mchk_calltrap as a trapframe generator.
Should have been included in r328157.
2018-01-19 01:36:25 +00:00
Bryan Drewery
7cd84b5641 build-tools: De-special-case the gcc tools build.
It merely wanted to use 'all' rather than 'build-tools' so just
add a build-tools target to the Makefile.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-31 19:02:05 +00:00