Commit Graph

180 Commits

Author SHA1 Message Date
Ruslan Bukin
888c8381ad Enable 'C'-compressed ISA extension.
This was disabled recently due to lack of support in KDB disassembler
and DTrace FBT provider. Support for 'C'-extension to both of these was
added, so we can now enable 'C'-extension.

This reduces size of the kernel important for low-end embedded devices,
and saves cache footprint for high perfomance machines.

Approved by:	re (kib)
Sponsored by:	DARPA, AFRL
2018-09-03 14:43:16 +00:00
Ruslan Bukin
8e8fbf193d Disable 'C'-compressed ISA extension.
It works excellent, but KDB disassembler and DTrace FBT provider for
RISC-V do lack support for it. They currently handle 4-byte instructions
only, while C-compressed ISA extension introduces 2-byte instructions
freely mixing them together.

So disable it for now.

Reviewed by:	markj@
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D16436
2018-07-25 16:07:35 +00:00
Warner Losh
ff9452772d Remove kernel support for armeb
Remove all the big-endian arm architectures (ixp425 and ixp435)
support in the kernel and associated drivers.

Differential Revision:  https://reviews.freebsd.org/D16257
2018-07-17 23:23:45 +00:00
Ruslan Bukin
8cd6c09e7e Fix build: ignore a GCC 7.2.0 warning which says that third argument of
memset(3) should contain the number of elements multiplied by the element
size.

Sponsored by:	DARPA, AFRL
2018-06-04 16:20:22 +00:00
Matt Macy
e5ae3af78b disable set but not used on code that can't be changed 2018-05-19 04:46:34 +00:00
Matt Macy
cccc969bc7 Silence non-actionable warnings in vendor code
We can't modify vendor code so there's no signal in warnings from it.
Similarly -Waddress-of-packed-member is not useful on networking code
as access to packed structures is fundamental to its operation.
2018-05-19 00:04:01 +00:00
Matt Macy
df66feb8da % WITHOUT_FORMAT_EXTENSIONS= XCC=/usr/local/bin/gcc8 make -j96 buildkernel KERNCONF=GENERIC-NODEBUG -s >& log
% grep "inlining failed" log | wc
     234    3570   36065
Consensus on those polled is that inlining failure warnings are not useful

Approved by:	sbruno
2018-05-04 19:31:28 +00:00
Matt Macy
d39c265800 fix gcc8 compile
Approved by:	sbruno
2018-05-04 18:25:07 +00:00
Ruslan Bukin
e31b69ec73 Add ld emulation types for hard-float mipses.
Sponsored by:	DARPA, AFRL
2018-04-12 15:12:40 +00:00
Conrad Meyer
0a646b9715 Implement NO_WCAST_QUAL for gcc4.2 architectures 2018-03-12 05:41:27 +00:00
Ed Maste
e9093b66d5 Add kernel retpoline option for amd64
Retpoline is a compiler-based mitigation for CVE-2017-5715, also known
as Spectre V2, that protects against speculative execution branch target
injection attacks.

In this commit it is disabled by default, but will be changed in a
followup commit.

Reviewed by:	bdrewery (previous version)
MFC after:	3 days
Security:	CVE-2017-5715
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D14242
2018-02-28 14:57:45 +00:00
Nathan Whitehorn
5d85170026 Automatically use the ELFv2 ABI on powerpc64 if supported by the compiler.
This has the same effects on DDB working as -mcall=aixdesc, but also is
supported by clang and marginally improves kernel performance.

MFC after:	2 weeks
2017-11-25 21:44:23 +00:00
Warner Losh
1cbb58886a Remove build system support for lint.
Differential Revision: https://reviews.freebsd.org/D13124
2017-11-17 18:16:46 +00:00
John Baldwin
d8371cb18e Remove CPU_HAVEFPU.
Instead, use a runtime decision to handle COP1 traps.  If floating point
support is present in the current CPU, enable saving of the floating point
state.  If support is not present, fail with SIGILL.

Reviewed by:	imp, br
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D12707
2017-10-18 17:23:16 +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
Ryan Libby
4e51f184e6 gcc builds: reenable -Wstrict-overflow for kern.mk
Reviewed by:	emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12284
2017-09-14 03:42:41 +00:00
Ruslan Bukin
af19cc59ca Support for v1.10 (latest) of RISC-V privilege specification.
New version is not compatible on supervisor mode with v1.9.1
(previous version).

Highlights:
    o BBL (Berkeley Boot Loader) provides no initial page tables
      anymore allowing us to choose VM, to build page tables manually
      and enable MMU in S-mode.
    o SBI interface changed.
    o GENERIC kernel.
      FDT is now chosen standard for RISC-V hardware description.
      DTB is now provided by Spike (golden model simulator). This
      allows us to introduce GENERIC kernel. However, description
      for console and timer devices is not provided in DTB, so move
      these devices temporary to nexus bus.
    o Supervisor can't access userspace by default. Solution is to
      set SUM (permit Supervisor User Memory access) bit in sstatus
      register.
    o Compressed extension is now turned on by default.
    o External GCC 7.1 compiler used.
    o _gp renamed to __global_pointer$
    o Compiler -march= string is now in use allowing us to choose
      required extensions (compressed, FPU, atomic, etc).

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11800
2017-08-10 14:18:09 +00:00
John Baldwin
fd46810af6 Fix the linker emulation setting for riscv.
Reported by:	lwhsu
MFC after:	1 week
Sponsored by:	DARPA / AFRL
2017-04-05 18:59:58 +00:00
John Baldwin
dc653882d4 Always pass the linker emulation via -m when linking modules and kernels.
Previously the linker emulation was only passed when building binary
objects for firmware modules.  This change always passes the desired
output format for kernel modules and kernels rather than requiring the
toolchain's default output format to match the desired output format.
This in turn permits use of external toolchains whose default output
format does not match the desired output format.

Reviewed by:	imp, emaste
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D10085
2017-04-05 03:05:04 +00:00
John Baldwin
dd3c43299e Use correct linker emulation name for armeb.
MFC after:	1 week
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D10085
2017-04-05 02:52:49 +00:00
Dimitry Andric
71fe94fdb1 Merge ^/head r312968 through r313054. 2017-02-01 21:21:01 +00:00
Justin Hibbits
d9dbd70bca Update CFLAGS for clang compatibility
* Clang/llvm does not (yet) support -m(no-)spe, so make it gcc-only
* Clang now supports -msoft-float, and does not appear to recognize
  "-disable-ppc-float-in-variadic", which appears to have been a crutch until
  soft-float was implemented.  It's now implemented for both 32- and 64-bit.
* Clang/llvm use a 'medium' code model by default for powerpc64, supporting up
  to 4GB TOC, and does not support the '-mminimal-toc' option.  Given both of
  these, make -mminimal-toc gcc-only.

MFC after:	2 weeks
2017-01-31 01:55:29 +00:00
Dimitry Andric
8177b8375e For kernel builds, make the -Waddress-of-packed-member warning non-fatal.
The warning is informative, but often there is no real alignment problem.
2017-01-08 18:14:28 +00:00
Alexander Kabaev
f369aff32d Support mips[*]hf variants in config files
Recognize new MACHINE_ARCH names now as we have added hardfloat support.
Switch JZ4780 to mipselhf and remove all uses of TARGET_ARCH in kernel
.mk files.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D8989
2016-12-30 00:34:52 +00:00
Ruslan Bukin
5bca221511 Add full softfloat and hardfloat support for MIPS.
This adds new target architectures for hardfloat:
mipselhf mipshf mips64elhf mips64hf.

Tested in QEMU only.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8376
2016-10-31 15:33:58 +00:00
Justin Hibbits
dc9b124d66 Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU.  The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive.  Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement.  setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).

Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.

Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.

Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used.  However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.

Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI.  Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.

Reviewed By:	bdrewery, imp
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
Andrew Turner
cbc6e751ac Set INLINE_LIMIT in the aarch64 case for gcc.
Submitted by:	andreast
MFC after:	1 week
2016-10-09 21:47:20 +00:00
Ed Maste
1dd50172b0 Always pass -m to ld for converting binary files to kernel ELF objects
This is in preparation for linking with LLVM's lld, which does not have
a compiled-in default output emulation. lld requires that it is
specified via the -m option, or obtained from the object file(s) being
linked.

This will also allow all build targets to share a common linker binary.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7837
2016-09-20 17:07:14 +00:00
Dimitry Andric
1c7c2b26e8 For kernel builds, instead of suppressing certain clang warnings, make
them non-fatal, so there is some incentive to fix them eventually.
2016-09-04 17:55:22 +00:00
Ruslan Bukin
9346408d90 Normalise the CWARNFLAGS inter-word spacing: remove all leading
and trailing space, and convert multiple consecutive spaces to
single space.

This helps to keep build output looking good.
2016-07-28 17:18:02 +00:00
Ruslan Bukin
96c072fcb0 o Add warn flags required to build modules with GCC 6.1;
o Sort GCC 4.8 warn flags.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-07-28 13:15:23 +00:00
Ruslan Bukin
8500b15f9f Fix style. 2016-07-24 18:04:12 +00:00
Ruslan Bukin
c4dc5cdb7b Add GCC 6.1 warn flags for kernel as well.
Sponsored by:	DARPA, AFRL
2016-07-22 16:15:35 +00:00
Enji Cooper
88f0575156 Revert r302403
lang/gcc{48,49,5} lacks -fformat-extensions support (causing build errors, which
is what prompted r302403 to be committed). devel/amd64-gcc on the other hand
(which is used by Jenkins), has the support.

This fixes the Jenkins failure emails due to excessive warnings being produced
with "make buildkernel".

Discussed with: lwhsu
Reported by: Jenkins (FreeBSD_HEAD_amd64_gcc job)
Sponsored by: EMC / Isilon Storage Division
2016-07-08 16:29:45 +00:00
Enji Cooper
d6b483b209 Do not use -fformat-extensions with non-base versions of gcc
Ports versions of gcc do not have -fformat-extensions support.

This unbreaks compiling the kernel/modules with non-base gcc (4.8,
5.0, etc) if MK_FORMAT_EXTENSIONS=yes (the default).

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7150
Reviewed by: bdrewery
Sponsored by: EMC / Isilon Storage Division
2016-07-07 22:44:23 +00:00
Bryan Drewery
1270146286 We only support GCC 4.8 for these flags.
- 4.7 introduced maybe-uninitialized
- 4.8 introduced aggressive-loop-optimizations

Sponsored by:	EMC / Isilon Storage Division
2016-03-13 19:17:48 +00:00
Bryan Drewery
4e47b95cc9 Remove more references to targets we've never had.
Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:35 +00:00
Ruslan Bukin
2a9aa1a646 Use medany (Medium/Anywhere) GCC code model for RISC-V.
This will allow us to use bigger relocations and all
the 64-bit VA space.
2016-02-18 14:38:37 +00:00
Ruslan Bukin
28029b68c0 Welcome the RISC-V 64-bit kernel.
This is the final step required allowing to compile and to run RISC-V
kernel and userland from HEAD.

RISC-V is a completely open ISA that is freely available to academia
and industry.

Thanks to all the people involved! Special thanks to Andrew Turner,
David Chisnall, Ed Maste, Konstantin Belousov, John Baldwin and
Arun Thomas for their help.
Thanks to Robert Watson for organizing this project.

This project sponsored by UK Higher Education Innovation Fund (HEIF5) and
DARPA CTSRD project at the University of Cambridge Computer Laboratory.

FreeBSD/RISC-V project home: https://wiki.freebsd.org/riscv

Reviewed by:	andrew, emaste, kib
Relnotes:	Yes
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D4982
2016-01-29 15:12:31 +00:00
Warner Losh
23df2d677f Revert this change. It broke the trampoline build. Until I'm sure
nothing else is broken, I'm reverting.
2015-12-21 20:36:01 +00:00
Warner Losh
01c616982b Move some MIPS specific flags to be more congruent with other
architectures.
2015-12-19 19:20:48 +00:00
Konstantin Belousov
8598392cd1 Build changes that allow the modules on arm64.
- Move the required kernel compiler flags from Makefile.arm64 to kern.mk.
- Build arm64 modules as PIC; non-PIC relocations in .o for shared object
  output cannot be handled.
- Do not try to install aarch64 symlink.
- A hack for arm64 to avoid ld -r stage.  See the comment for the explanation.
  Some functionality is lost, like ctf handling, but hopefully will be
  restored after newer linker is available.

Reviewed by:	andrew, emaste
Tested by:	andrew (on real hardware)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3796
2015-10-08 17:42:08 +00:00
Dimitry Andric
45587483d8 For kernel builds, make the -Wshift-negative-value non-fatal for now. 2015-08-17 21:07:21 +00:00
Warner Losh
2e8457e701 Only include CWARNFLAGS once to reduce command line size from ~1400
characters to "only" ~900 for kernel builds.
2015-04-28 23:54:55 +00:00
Dimitry Andric
ca65be80fd Merge ^/head r279313 through r279595. 2015-03-04 19:47:33 +00:00
Nathan Whitehorn
e52a2dc83c Use appropriate alternative to -msoft-float for clang-built PowerPC kernels. 2015-02-27 20:32:50 +00:00
Dimitry Andric
714e3c812d Merge ^/head r278756 through r278915. 2015-02-17 19:53:41 +00:00
Gleb Smirnoff
cc4a90c445 Globally enable -fms-extensions when building kernel with gcc, and remove
this option from all modules that enable it theirselves.
  In C mode -fms-extensions option enables anonymous structs and unions,
allowing us to use this C11 feature in kernel. Of course, clang supports
it without any extra options.

Reviewed by:	dim
2015-02-17 19:27:14 +00:00
Dimitry Andric
bd9cc051b3 Merging ^/head r278224 through r278297. 2015-02-05 22:34:29 +00:00
Peter Wemm
5d6adf256f Add -fwrapv to CFLAGS for the kernel. This essentially un-reverts r259045.
The C standard undefines behavior when signed integers overflow. The
compiler toolchain has become more adept at detecting this and taking
advantage of faster undefined behavior.  At the current time this has the
unfortunate effect of the clock stopping after 24 days of uptime.

clang makes no distinction between -fwrapv and -fno-strict-overflow.  gcc
does treat them differently but -fwrapv is mature in gcc and is the
behavior are actually expecting.

Obtained from:	kib
2015-02-05 01:36:53 +00:00