Commit Graph

783 Commits

Author SHA1 Message Date
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
Pedro F. Giffuni
29c20022de gcc: Add ability to generate DWARF pubtypes section if
DEBUG_PUBTYPES_SECTION is defined.

Obtained from:	gcc 4.3 (rev. 118826; GPLv2)

MFC after:	2 weeks
2013-12-24 20:42:48 +00:00
Pedro F. Giffuni
860701960d gcc: warnings from -Wformat-security
Minor mismatch in r259666.

Obtained from:	Apple GCC 4.2 - 5646 (Radar 5764921)
MFC after:	1 week
2013-12-21 19:53:51 +00:00
Pedro F. Giffuni
5c3c610835 gcc: clean some warnings from -Wformat-security
Obtained from:	Apple GCC 4.2 - 5646 (Radar 5764921)
MFC after:	1 week
2013-12-20 20:57:13 +00:00
Pedro F. Giffuni
b078889a6b Revert r259619:
Fixes GCC libstdc++/29286

The fix seems to work for amd64 but causes segfaults on powerpc.
At this time gcc is much more important on powerpc than on amd64.

Reported by:	andreast
2013-12-20 18:16:02 +00:00
Pedro F. Giffuni
cc1a345c65 gcc: revert Rvalue references.
They are very useful but at this time I prefer not to figure out
some  minor conflicts with the bigger Apple's blocks support
patch that is being worked on for current.
2013-12-20 18:09:34 +00:00
Pedro F. Giffuni
a5fd0716f8 gcc: merge upstream fix and new feature.
Fix for PR c++/29928

Add support for Rvalue references as described here:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html

Obtained from:	gcc 4.3 (rev. 124724, 125211; GPLv2)
MFC after:	2 weeks
2013-12-20 16:01:02 +00:00
Pedro F. Giffuni
62f78f3261 gcc: more diff reductions against Apple GCC.
Mostly cosmetical changes to aid further merges.

Obtained from:	gcc 4.3 (rev. 120611, 124839; GPLv2)
MFC after:	1 week
2013-12-20 14:56:52 +00:00
Pedro F. Giffuni
915b4b42ae gcc: backport upstream fix for issue with C++'s placement new
Fixes GCC libstdc++/29286

Obtained from:	gcc 4.3 (rev. 125603, 125653; GPLv2)
MFC after:	2 weeks
2013-12-19 18:27:32 +00:00
Pedro F. Giffuni
505ca70a65 gcc: add Apple compatible -Wnewline-eof
Fix document: "Apple compatible" suits better the origin.

MFC after:	1 week
2013-12-18 15:27:48 +00:00
Pedro F. Giffuni
cfbe5d01ee gcc: add Apple compatible -Wnewline-eof
GCC 4.2 and previous have always warned about
"No newline at end of file".

Upstream GCC removed the warning completely but
Apple made it an optional warning. Adopt it for
compatibility with older GCC and clang.

While here, add comment to complement r258712.

Obtained from:	Apple Inc. (Apple GCC 4.2 - 5531)
MFC after:	1 week
2013-12-18 14:53:36 +00:00
Pedro F. Giffuni
9596cafea0 gcc: point to our address for bug reports.
As recommended by the FSF in gcc/version.c :

"If you distribute a modified version of GCC, please change
this to refer to a document giving instructions for reporting
bugs to you, not us."

MFC after:	2 weeks
2013-12-18 00:10:30 +00:00
Pedro F. Giffuni
2dcaa2963d gcc: small merges from upstream
Solves GCC issues:
PR middle-end/32602
PR middle-end/32603

Updates the to documentation and processing
improvement.

Obtained from:	gcc 4.3 (rev. 119427, 126278, 126422; GPLv2)
MFC after:	2 weeks
2013-12-17 23:31:51 +00:00
Pedro F. Giffuni
5244c21dd0 gcc: fix ICE in rs600 when using -fno-trapping-math.
Solve build issue with previous change.

Obtained from:	gcc 4.3 (rev. 120902; GPLv2)
MFC after:	2 weeks
2013-12-17 21:39:40 +00:00
Pedro F. Giffuni
08fd2c8bd7 gcc: fix ICE in rs600 when using -fno-trapping-math.
Solves GCC-PR target/30485

Obtained from:	gcc 4.3 (rev. 120902; GPLv2)
MFC after:	2 weeks
2013-12-17 20:53:22 +00:00
Dimitry Andric
8b3d3bafec Use correct casts in gcc's emmintrin.h for the first arguments of the
following builtin functions:

* __builtin_ia32_pslldi128() takes __v4si instead of __v8hi
* __builtin_ia32_psllqi128() takes __v2di instead of __v8hi
* __builtin_ia32_psradi128() takes __v4si instead of __v8hi

This should fix the following errors when building the LINT kernel with
gcc:

sys/crypto/aesni/aesni_wrap.c:191: error: incompatible type for argument 1 of
'__builtin_ia32_psradi128'
sys/crypto/aesni/aesni_wrap.c:195: error: incompatible type for argument 1 of
'__builtin_ia32_pslldi128'

MFC after:	3 days
2013-12-08 23:24:32 +00:00
Pedro F. Giffuni
5dab84a07c gcc: new fvisibility-ms-compat option
Obtained from:	gcc 4.3 (rev. 126088; GPLv2)
MFC after:	3 weeks
2013-12-08 03:02:44 +00:00
Pedro F. Giffuni
36543c3739 gcc: Include types in error message for build_binary_op.
Mostly cosmetic change, again to reduce differences with Apple's gcc.

Obtained from:	gcc 4.3 (rev. 125239; GPLv2)
MFC after:	3 weeks
2013-12-06 02:19:58 +00:00
Pedro F. Giffuni
1aa997ff6a gcc: Add -flax-vector-conversions
Obtained from:	gcc 4.3 (rev. 120572, 120688; GPLv2)
2013-12-05 21:22:51 +00:00
Pedro F. Giffuni
0a56d1d88d gcc: On rs6000 update sp_offset depending only on size.
This fixes a nasty bug introduced in r258651.

Reported and tested by:	Justin Hibbits
Obtained from:		gcc pre-4.3 (rev. 125116; GPLv2)
MFC after:		2 weeks
2013-12-04 21:17:39 +00:00
Pedro F. Giffuni
6d94bd07cc libiberty: upstream updates.
There is a new ChangeLog.gcc43 file but most notable:

* floatformat.c (get_field): Fix segfault with little-endian word
  order on 64-bit hosts.
  (put_field): Likewise.
  (min): Move definition.

gcc/cp/ChangeLog
2007-05-04  Geoffrey Keating  <geoffk@apple.com>

  PR 31775
  * mangle.c (write_mangled_name): Mangle static variable names.
  (write_unqualified_name): Use local-source-name for
  namespace-scope static variables.
(Completes FreeBSD's r258017 )

Obtained from:	gcc 4.3 (rev. 118552, 120097, 20698, 120702,
			 121364, 122972, 126588; GPLv2)
MFC after:	2 weeks
2013-12-01 22:08:19 +00:00
Pedro F. Giffuni
5b1674597f gcc: upstream alignment cleanups.
This solves GCC/32617 and contributes to reduce differences with
Apple's gcc42.

Complete some references in the ChangeLog while here.

Obtained from:	gcc 4.3 (rev. 126529, 126588; GPLv2)
MFC after:	3 weeks
2013-11-29 18:46:02 +00:00
Pedro F. Giffuni
9a252f0990 gcc: Make use of TREE_OVERFLOW_P.
While it was brought in r258179 only to fix a build issue,
bringing the rest of the change has the advantage of fixing
GCC/19978.

Obtained from:	gcc 4.3 (rev. 120505; GPLv2)
MFC after:	1 week
2013-11-29 05:00:07 +00:00
Pedro F. Giffuni
346d5f0202 Forced commit to note that r258652 is actually:
gcc: Move conditions before an assert.

It is a bit cleaner to check the conditions before calling the assertion.
It also preserves the style from the rest of the code.
This is just a cosmetical change to match better what both Apple's gcc42
and Android's gcc-4.2.1 do.
2013-11-26 15:18:40 +00:00
Pedro F. Giffuni
db8e31dfdd gcc: Altivec register adjustments from Apple.
Obtained from:	gcc pre-4.3 (rev. 124763; GPLv2)
MFC after:	3 weeks
2013-11-26 14:58:37 +00:00
Pedro F. Giffuni
7b0d23ce5a gcc: Altivec register adjustments from Apple.
Obtained from:	gcc pre-4.3 (rev. 124763; GPLv2)
MFC after:	3 weeks
2013-11-26 14:52:29 +00:00
Pedro F. Giffuni
81e5b01765 gcc: Bring updates from Google's enhanced gcc-4.2.1.
Google released and enhanced version of gcc-4.2.1 plus their local
patches for Android[1].

The patches are owned by Google and the license hasn't been changed
from  the original GPLv2. We are only bringing a subset of the
available patches that may be helpful in FreeBSD. Changes specific
to android are not included.

From the README.google file[1].

Patches applied to google_vendor_src_branch/gcc/gcc-4.2.1:

gcc/Makefile.in
gcc/c-common.c
gcc/c-common.h
gcc/c-opts.c
gcc/c-typeck.c
gcc/cp/typeck.c
gcc/doc/invoke.texi
gcc/flags.h
gcc/opts.c
gcc/tree-flow.h
gcc/tree-ssa-alias-warnings.c
gcc/tree-ssa-alias.c

 Backport of -Wstrict-aliasing from mainline.
  Silvius Rus <rus@google.com>

gcc/coverage.c:
  Patch coverage_checksum_string for PR 25351.
  Seongbae Park <spark@google.com>
  Not yet submitted to FSF.

gcc/c-opts.c
gcc/c-ppoutput.c
gcc/c.opt
gcc/doc/cppopts.texi
libcpp/Makefile.in
libcpp/directives-only.c
libcpp/directives.c
libcpp/files.c
libcpp/include/cpplib.h
libcpp/init.c
libcpp/internal.h
libcpp/macro.c
  Support for -fdirectives-only.
  Ollie Wild <aaw@google.com>.
  Submitted to FSF but not yet approved.

libstdc++-v3/include/ext/hashtable.h
  http://b/742065
  http://b/629994
  Reduce min size of hashtable for hash_map, hash_set from 53 to 5

libstdc++-v3/include/ext/hashtable.h
  http://b/629994
  Do not iterate over buckets if hashtable is empty.

gcc/common.opt
gcc/doc/invoke.texi
gcc/flags.h
gcc/gimplify.c
gcc/opts.c
  Add Saito's patch for -finstrument-functions-exclude-* options.

gcc/common.opt
gcc/doc/invoke.texi
gcc/final.c
gcc/flags.h
gcc/opts.c
gcc/testsuite/gcc.dg/Wframe-larger-than.c
  Add a new flag -Wframe-larger-than- which enables a new warning
  when a frame size of a function is larger than specified.
  This patch hasn't been integrated into gcc mainline yet.

gcc/tree-vrp.c
  Add a hack to avoid using ivopts information for pointers starting
  at constant values.

Reference:

[1]
https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.2.1/

Obtained from:	Google Inc.
MFC after:	3 weeks
2013-11-23 18:32:53 +00:00
Pedro F. Giffuni
2bd5e058b7 gcc: another round of merges from the gcc pre-43 branch.
Bring The following revisions from the gcc43 branch[1]:

118360, 118361, 118363, 118576, 119820,
123906, 125246, and 125721.

They all have in common that the were merged long ago
into Apple's gcc and should help improve the general
quality of the compiler and make it easier to bring
new features from Apple's gcc42.

For details please review the additions to the files:
gcc/ChangeLog.gcc43
gcc/cp/ChangeLog.gcc43 (new, adds previous revisions)

Reference:
[1] http://gcc.gnu.org/viewcvs/gcc/trunk/?pathrev=126700

Obtained from:	gcc pre4.3 (GPLv2) branch
MFC after:	3 weeks
2013-11-21 16:38:57 +00:00
Pedro F. Giffuni
6ca7e51c77 gcc: Record some previous commits in the gcc43 ChangeLog.
It is useful to update the ChangeLog with upstream references
related to our local r189824 and r255095.

MFC after:	3 weeks
2013-11-18 20:21:44 +00:00
Pedro F. Giffuni
a88cf0f07f gcc: Fix postreload-gcse treatment of call-clobbered registers.
Reference:
http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01636.html

Obtained from:	gcc 4.3 (rev. 125037; GPLv2)
MFC after:	3 weeks
2013-11-16 01:29:27 +00:00
Pedro F. Giffuni
71fd392a23 gcc: add femit-struct-debug support to reduce Reduce dwarf debug size
Obtained from:	gcc 4.3 (rev. 123909; GPLv2)
MFC after:	3 weeks
2013-11-16 01:16:24 +00:00
Pedro F. Giffuni
007acff069 gcc: Add a new option -Wvla to warn variable length array.
Obtained from:	gcc 4.3 (rev. 122851; GPLv2)
MFC after:	3 weeks
2013-11-16 01:03:56 +00:00
Sean Bruno
2f0e4b9e62 Merge in gcc svn r120505 to include definition of TREE_OVERFLOW_P:
http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/tree.h?revision=120505&view=markup

This repairs build breakage for non x86 arch's that use gcc to build
intruduced at svn R258157
2013-11-15 18:44:25 +00:00