Commit Graph

815 Commits

Author SHA1 Message Date
Pedro F. Giffuni
3a17f73727 Bring some rough support for FreeBSD S/390 to the GNU toolchain.
This is no-op and only for reference: the S/390 port seems to be elusive
in the BSDs so it is convenient to keep some trace from past efforts.
It is likely newer attempts will focus on a newer toolchain using clang
instead.

Obtained from:	Perforce depot/projects/s390
2017-05-23 16:38:10 +00:00
Michal Meloun
19600bd917 Fix _Unwind_Backtrace symbol version for ARM.
In real GNU libgcc, _Unwind_Backtrace is published with GCC_3.3 version
for all architectures but ARM. For ARM it's publishes with GCC_4.3.0
version.
This exception is not implement in your version of libggc, thus we
export _Unwind_Backtrace with bad version. To maintain backward
compatibility, publish _Unwind_Backtrace twice, once as compatible
symbol with GCC_3.3 version, and once as default symbol with
GCC_4.3.0 version.

While I'm in, fix typo in GCC_4.2.0 to GCC_4.3.0 inheritance declaration.

MFC after:	2 weeks
2017-05-09 12:14:00 +00:00
Justin Hibbits
a860c16ab7 Default powerpcspe processor target to 8540
This prevents internal compiler errors when -mcpu is omitted.
2017-04-14 03:20:34 +00:00
Ed Maste
5be48d84be add octeon+ as an alias for octeon in GCC & binutils
In r208737 jmallett@ added support for the "mips64r2" architecture
and "octeon" CPU, and the saa/saad instructions.

Upstream binutils also added the "octeon+" CPU, and the saa/saad
instructions are only available in octeon+, not octeon.  Since our
base system tool chain already accepts saa/saad with -march=octeon,
just allow octeon+ as an alias.

This allows the use of octeon+ in kernel config files, for use with both
external tool chain and in-tree GCC/binutils.

PR:		216516
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2017-01-27 21:31:32 +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
Pedro F. Giffuni
1ca1e01360 MFV r302423:
Bring older verbatim version of cpuid.h

This file is used regularly in FreeBSD builds but we usually use the
similar file provided by clang.

By providing the older file introduced in GCC 4.3, we hope to mimic
better what is provided by an external toolchain.

Obtained from:	GCC-4_3-branch (SVN rev. 129548, pre GPLv3)
2016-08-30 21:51:53 +00:00
Pedro F. Giffuni
66a5fa5d99 libcpp: Complete the __COUNTER__ support with upstream implementation.
We brought an original __COUNTER__ implementation in r228474, however, it
was missing documentation and it had a different behaviour for precompiled
headers with respect to the upstream version. Since the upstream version
is under the same license as GCC4.2, bring the missing pieces to reduce
differences against upstream.

Optained from:	GCC pre-4.3 (rev. 125041 ; GPLv2)
2016-08-30 19:39:33 +00:00
Ed Maste
ea3dc21b32 rename ARM's libunwind.S to to avoid conflict with llvm libunwind
llvm libunwind includes a libunwind.cpp, but on ARM libunwind.S is found
first in .PATH. Rename the latter one, since it is not going to be
updated again.

Reviewed by:	andrew
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7162
2016-07-27 16:34:19 +00:00
Glen Barber
aa5755d30d Add freebsd12 to contrib/gcc/config.gcc.
Submitted by:	bdrewery
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2016-07-08 01:56:52 +00:00
Conrad Meyer
2844d30cc5 gcc42: Fix minor C99 parse bug
DR #289[0] came down and gcc4.2.1 was on the wrong side of history.
Partially revert GCC r42574 (just remove the error) to rectify the parse
bug to match Clang and other compliant C99 compilers.

An example declaration gcc tripped on before this fix:

  void foobar(int [static 1]);

An example declaration gcc did not trip on before this fix:

  void foobar(int name[static 1]);

Bump __FreeBSD_cc_version.

[0]: http://www.open-std.org/JTC1/SC22/WG14/www/docs/dr_289.htm

Reported by:	allanjude
Sponsored by:	EMC / Isilon Storage Division
2016-05-27 03:40:52 +00:00
Pedro F. Giffuni
0d1bd3bc60 GCC: Add support for named initializers for anonymous structs/unions.
Missing hunk from r300301.

Reported by:	Ed Schouten
Obtained from:	OpenBSD (CVS rev. 1.2)
2016-05-20 18:01:53 +00:00
Pedro F. Giffuni
b7505e07e5 GCC: Add support for named initializers for anonymous structs/unions.
This is a C11 feature that is starting to get used in places such as Mesa.
This implementation takes a different approach to upstream and is
therefore not covered by GPLv3.

Obtained from:	OpenBSD (CVS rev. 1.2)
MFC after:	3 weeks
2016-05-20 14:36:49 +00:00
Ruslan Bukin
a3e762571c Add a minimal gcc config for RISC-V.
This is required to build csu.

Reviewed by:	andrew
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D5039
2016-01-23 15:33:11 +00:00
Andreas Tobler
77a561088f Silence a boring warning. 2015-12-22 21:26:50 +00:00
Pedro F. Giffuni
5668d203ed Revert r289150:
Correct handling of enum attributes with g++

It is causing issues on some platforms.

Reported by:	sbruno (through adrian)
2015-10-12 02:05:25 +00:00
Pedro F. Giffuni
e277c15f54 Correct handling of enum attributes with g++
From OpenBSD's commit log:

This was responsible for memory corruption with recent versions
of Mesa where c and c++ code share a header with a packed enum type.

Reference:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39219

Obtained from:	OpenBSD (CVS rev. 1.2)
MFC after:	1 week
2015-10-11 19:58:57 +00:00
Konstantin Belousov
96cdb0ab9d Annotate arm userspace assembler sources stating their tolerance to
the non-executable stack.

Reviewed by:	andrew
Sponsored by:	The FreeBSD Foundation
2015-09-29 16:09:58 +00:00
Pedro F. Giffuni
bc38441579 GCC: Add a new option "-fstack-protector-strong"
This includes additional functions to be protected: those that
have local array definitions, or have references to local frame
addresses. This is a new option in GCC-4.9 that was relicensed
by Han Shen from Google under GPLv2 for OpenBSD.

Obtained from:	OpenBSD (2014-01-14)
MFC after:	2 weeks
2015-07-30 14:31:09 +00:00
Adrian Chadd
872b4ed5ea Fix compilation of this macro under gcc-4.9 for MIPS32.
Some point after gcc-4.2 the MIPS inline assembly restrictions changed -
=h (hi register) disappeared from the list of restrictions and can no
longer be used.

So, until someone requires an assembly version of this function,
just use a non-assembly version and let the compiler sort it out.

Suggested by:	kan
2015-06-18 13:40:08 +00:00
Andrew Turner
b35f8350c2 Use a spelling of .thumb clang understands. 2015-05-31 07:28:34 +00:00
Sean Bruno
76da95eba4 Update intree gdb/kgdb to handle 2 dwarf types:
DW_OP_GNU_uninit
DW_OP_piece

This squashes the warnings about type 0x93 not known in kgdb when opening a kernel crash dump.

Upstream refs:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=87808bd699575a850139a1f916512ab7a47fd496
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=42be36b328ae784ae6981da7c7cab95b67ed7737
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=23572ecadc89af384c1804ad7692f32c55fbfc80

Differential Revision:	https://reviews.freebsd.org/D2534
Reviewed by:	emaste, jhb, davide
2015-05-17 15:49:38 +00:00
Ed Maste
640cba97d8 unwind-d2 build workaround for arm64
The __builtin_init_dwarf_reg_size_table function is unimplemented in
clang 3.6 for AArch64. Comment it out for now and replace it with
a message and abort.

Tracked in upstream LLVM PR 22997
https://llvm.org/bugs/show_bug.cgi?id=22997

Submitted by:	andrew
2015-03-31 13:37:32 +00:00
Andrew Turner
305d71de6e Also define DWARF_FRAME_REGISTERS. This is used to size arrays, without
this exceptions could write over the stack.

Sponsored by:	The FreeBSD Foundation
2015-03-26 18:25:53 +00:00
Andrew Turner
6dd9f5b375 Adda minimal gcc config. This is just enough to build the bits of csu we
get from gcc, and libgcc_eh.

Sponsored by:	The FreeBSD Foundation
2015-03-24 14:22:58 +00:00
Andrew Turner
573a66c3dc FreeBSD expects _Unwind_GetGR, _Unwind_SetGR, and _Unwind_SetIP to be
symbols and not macros. Make this so. This fixes a few ports that try to
link against these functions but fail as they previously didn't exist.
2015-02-01 09:50:33 +00:00
Ian Lepore
040610408e Allow -march=armv7a on the gcc command line, for compatibility with clang.
This will result in __ARM_ARCH_7A__ being defined during the compile.

When compiling with gcc, it will still only generate armv6 opcodes itself,
but should pass the arch to gas so that inline asm can use v7 opcodes.
2014-12-21 23:45:13 +00:00
Dimitry Andric
b42a6953a1 Pull in r174303 from upstream gcc trunk (by Jason Merrill):
PR c++/48211
  * name-lookup.h (cp_class_binding): Make base a pointer.
  * name-lookup.c (new_class_binding): Adjust.
  (poplevel_class): Adjust.

This fixes a potential segfault when compiling gold, a part of the
devel/binutils port, with gcc.  See also the upstream bug report:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48211

Thanks to Jason Merrill, Tom Callaway and Red Hat legal for approving
the use of this patch under the GNU GPL, version 2 or later.

MFC after:	1 week
2014-12-04 17:26:04 +00:00
Andrew Turner
f9867ad74d Use the floating-point instruction on ARMv7 as the clang 3.5 integrated
assembler doesn't allow these two instructions to use co-processor 11.

MFC after:	1 Week
Sponsored by:	ABT Systems Ltd
2014-12-01 21:13:47 +00:00
Andrew Turner
b4ce9f7856 There is no need to use FUNC_END with aeabi_ldiv0 or aeabi_idiv0 as they
are aliases.

Sponsored by:	ABT Systems Ltd
2014-11-30 17:29:49 +00:00
Dimitry Andric
74346cb90d Supplement r259111 by also using correct casts in gcc's emmintrin.h for
the first argument of the following builtin function:

* __builtin_ia32_psrlqi128() takes __v2di instead of __v4si

This should fix the following errors when building the graphics/webp
port with base gcc:

lossless_sse2.c:403: error: incompatible type for argument 1 of '__builtin_ia32_psrlqi128'
lossless_sse2.c:404: error: incompatible type for argument 1 of '__builtin_ia32_psrlqi128'

Reported by:	Jos Chrispijn <ports@webrz.net>
MFC after:	3 days
2014-08-13 16:42:44 +00:00
Ian Lepore
fc6840cc02 Add FreeBSD to the list of environments that needs to handle R_ARM_TARGET2
relocations in unwind data as pc-relative indirect references.

MFC after:	1 week
2014-07-22 20:49:58 +00:00
Gavin Atkinson
ad3afeea16 With the move away from GNATS, point end users to a better web page
detailing how to report bugs.

Hat:		bugmeister
MFC after:	3 days
2014-06-14 18:45:40 +00:00
Pedro F. Giffuni
cd85ba9385 gcc: fix strict alignment.
From the OpenBSD log:

x86-64 ABI requires arrays greater than 16 bytes to be aligned to
16byte boundary.  However, GCC 16-byte aligns arrays of >=16 BITS,
not BYTES.

This diff improves bug detectability for code which has local arrays
of [16 .. 127] bits:  in those cases SSP will now detect even 1-byte
overflows.

Obtained from:	OpenBSD (CVS rev 1.4)
MFC after:	1 week
2014-05-02 16:15:34 +00:00
Pedro F. Giffuni
8fb9488054 gcc: define __block when block support is enabled
This mimics the behaviour in clang and lets us build cleanly
the libdispatch port on platforms where the base gcc is still
the default compiler.

Bump __FreeBSD_version for ports.

Tested by:	theraven
MFC after:	3 days
2014-04-04 15:49:23 +00:00
Dimitry Andric
f5e6413717 Similar to r211505 for x86, remove unneeded casts in inline assembly for
sparc64 from contrib/gcc/longlong.h, which are considered "heinous" GNU
extensions by clang.
2014-02-20 23:08:01 +00:00
Dimitry Andric
f785676f2a Upgrade our copy of llvm/clang to 3.4 release. This version supports
all of the features in the current working draft of the upcoming C++
standard, provisionally named C++1y.

The code generator's performance is greatly increased, and the loop
auto-vectorizer is now enabled at -Os and -O2 in addition to -O3.  The
PowerPC backend has made several major improvements to code generation
quality and compile time, and the X86, SPARC, ARM32, Aarch64 and SystemZ
backends have all seen major feature work.

Release notes for llvm and clang can be found here:
<http://llvm.org/releases/3.4/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.4/tools/clang/docs/ReleaseNotes.html>

MFC after:	1 month
2014-02-16 19:44:07 +00:00
Pedro F. Giffuni
321c39ba84 gcc: Add support for -Wmissing-prototypes in C++
Support for warnings about missing prototypes in C++ was added by Apple
GCC (Radar 6261539).  Most of the code crept into r260311 so it felt
natural to make use of it.

Obtained from:	Apple GCC - 5646
MFC after:	5 days
2014-01-26 02:36:06 +00:00
Pedro F. Giffuni
3cb44b3f65 gcc: Drop useless objc change from r260311.
Among some of the objc changes from Apple that crept into r260311,
Radar 5355344 is incomplete and is not used since we don't carry
ObjC in the base system.

The dead code seems to have caused issues in some Tinderboxes so
get rid of it altogether.

Reported by:	luigi
MFC after:	9 days
2014-01-17 21:21:28 +00:00
Andrew Turner
0b55a5a4af Fix gcc with EABI on big-endian ARM by setting the endian correctly.
Without this gcc would generate byte loads for a little-endian core.

MFC after:	1 week
2014-01-12 15:35:03 +00:00
Pedro F. Giffuni
02f1bd6b8d Fix optimization bug.
GCC-PR rtl-optimization/34628
	* combine.c (try_combine): Stop and undo after the first combination
	if an autoincrement side-effect on the first insn has effectively
	been lost.

The issue was detected in OpenBSD but their fix was not very good. Huge
thanks to the upstream author, Eric Botcazou, for permitting the use of
this patch under GPLv2.

MFC after:	5 days
2014-01-06 00:52:39 +00:00
Pedro F. Giffuni
ab07951c0c gcc: backport some fixes from llvm-gcc
llvm-gcc backported some patches from gcc trunk:

http://gcc.gnu.org/ml/gcc-cvs/2007-05/msg00662.html
http://gcc.gnu.org/ml/gcc-cvs/2007-07/msg00019.html
http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00240.html
http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00493.html

The first two were always GPL2. The last two were
added after the GPL3 transition, but were written
by aaw@google.com and Rafael Espíndola got permission
to relicense them under the GPL2 for inclusion in
llvm-gcc.

This fixes GCC-PR c++/31749

Obtained from:	llvm-gcc (rev. 75463; GPLv2)
MFC after:	2 weeks
2014-01-05 20:33:44 +00:00
Pedro F. Giffuni
5bfc7db451 gcc: Add support for Apple's Block extension
Block objects [1] are a C-level syntactic and runtime feature. They
are similar to standard C functions, but in addition to executable
code they may also contain variable bindings to automatic (stack)
or managed (heap) memory. A block can therefore maintain a set of
state (data) that it can use to impact behavior when executed.

This port is based on Apple's GCC 5646 with some bugfixes from
Apple GCC 5666.3. It has some small differences with the support
in clang, which remains the recommended compiler.

Perhaps the most notable difference is that in GCC that __block
is not actually a keyword, but a macro. There will be workaround
for this issue in a near future. Other issues can be consulted in
the clang documentation [2]

For better compatiblity with Apple's GCC and llvm-gcc some related
fixes and features from Apple have been included. Support for the
non-standard nested functions in GCC is now off by default.

No effort was made to update the ObjC support since FreeBSD doesn't
carry ObjC in the base system, but some of the code crept in and
was more difficult to remove than to adjust.

Reference:
[1]
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html
[2]
http://clang.llvm.org/compatibility.html#block-variable-initialization

Obtained from:	Apple GCC 4.2
MFC after:	3 weeks
2014-01-05 00:43:28 +00:00
Pedro F. Giffuni
e1b3bb5380 libcpp: misc fixes from Apple's GCC.
Fixes some bugs detected by Apple:
#error with unmatched quotes
pragma mark

Obtained from:	Apple GCC 4.2 - 5553
MFC after:	1 week
2014-01-05 00:32:38 +00:00
Pedro F. Giffuni
d096f2f5a8 Revert r260073; small diff reduction wrt gcc43 and Apple GCC.
Unfortunately this causes ICE on powerpc and sparc64.

Reducing these differences against upstream is not important
anymore so hopefully I have finished breaking the compiler
occasionally.
2014-01-02 13:53:53 +00:00
Pedro F. Giffuni
1b9906c757 gcc: Fix issue with "unavailable" attribute.
While here, point where we dropped the support for objc from r260014.

MFC after:	3 weeks
2013-12-30 20:24:05 +00:00
Pedro F. Giffuni
fdcd8bc639 gcc: small diff reduction wrt gcc43 and Apple GCC.
Obtained from:	gcc 4.3 (rev. 121464, 122528, 124106; GPLv2)
MFC after:	3 weeks
2013-12-30 02:52:43 +00:00
Pedro F. Giffuni
2d278bb89e gcc: Add support for label attributes and "unavailable" attribute.
Apple GCC has extensions to support for both label attributes and
an "unavailable" attribute. These are critical for objc but are
also useful in regular C/C++.

Apparently at least the label attributes might have found their way to
upstream GCC but the code doesn't seem available on the GPLv2 tree so
we are taking the code directly from Apple. To make this clearer we
are preserving the annoying "APPLE LOCAL" tags and the ChangeLogs
when they are available.

Obtained from:	Apple GCC 4.2 - 5531
MFC after:	3 weeks
2013-12-28 20:30:31 +00:00
Pedro F. Giffuni
4707030025 gcc: merge small upstream change.
Backport from mainline:
2007-04-24  Hui-May Chang <hm.chang@apple.com>

* reload1.c (merge_assigned_reloads) : Do not merge a RELOAD_OTHER
instruction with a RELOAD_FOR_OPERAND_ADDRESS instruction.

Obtained from:	gcc 4.3 (rev. r124115: GPLv2)
MFC after:	1 week
2013-12-27 15:15:49 +00:00
Pedro F. Giffuni
99dee3f5ae gcc: Implement -Wmost for compatibility with clang.
This is equivalent to -Wall -Wno-parentheses.

Obtained from:	Apple GCC 4.2 - 5531
MFC after:	1 week
2013-12-26 18:09:16 +00:00
Pedro F. Giffuni
8adb8fac02 gcc: small enhancements for the arm support.
Very small updates: fixes GCC-PR target/31152

Tested by building the cross-compiler.

Obtained from:	gcc 4.3 (rev. r118461, 125973: GPLv2)
MFC after:	2 weeks
2013-12-25 16:01:48 +00:00