Commit Graph

820 Commits

Author SHA1 Message Date
Pedro F. Giffuni
691f7fadcd Add support for "d" floating-point suffix, as defined by draft N1312
of TR 24732. Emit pedantic warning if the feature is being used.

Should solve GCC bug 39027.

Obtained from:	OpenBSD
MFC after:	2 weeks
2013-05-12 15:29:35 +00:00
Pedro F. Giffuni
fcd6d20340 Update the gcc43 changelog.
The issue solved in r250392 actually originated upstream and was
fixed in upstream gcc43 branch in 2006/10/24 (under GPLv2).

Register it in the appropriate ChangeLog for reference.

MFC after:	3 days
2013-05-12 03:36:28 +00:00
Dimitry Andric
ca21efa1b5 For some reason, the gcc intrinsics header tmmintrin.h was imported with
two copies of itself pasted together.  Remove the extraneous copy.

MFC after:	3 days
2013-05-08 22:50:36 +00:00
Andrew Turner
9d9758ed46 Add #undef TARGET_DEFAULT back as it shouldn't have been removed in r245539 2013-02-04 09:42:12 +00:00
Andrew Turner
93c7e89712 Allow the unwind functions int libgcc_s to interact correctly with libthr.
_Unwind_ForcedUnwind in libgcc_s takes as one of it's parameters a stop
function to tell it when to stop unwinding. One of the stop function's
parameters is a _Unwind_Exception_Class. On most architectures this is an
int64_t, however on ARM EABI the gcc developers have made this a char array
with 8 items. While both of these take the same space they are passed into
the stop function differently, an int64_t is passed in in registers r2 and
r3, while the char[8] is passed in as a pointer to the first item in
register r2.

Because libthr expects the value to be an int64_t we would get incorrect
results when it passes a function that take an int64_t but libgcc passes in
a pointer to a char array including crashing.

The fix is to update libgcc_s to make it pass an int64_t to the stop
function and to libstdc++ as it expects _Unwind_Exception_Class to be an
array.
2013-02-04 09:28:36 +00:00
Pedro F. Giffuni
646a7fea0c Clean some 'svn:executable' properties in the tree.
Submitted by:	Christoph Mallon
MFC after:	3 days
2013-01-26 22:08:21 +00:00
Andrew Turner
1992e9a10c Add compiler support for the ARM EABI.
ARM EABI support is disabled by default and can be enabled by setting
WITH_ARM_EABI when building, however only the kernel-toolchain target will
work with this flag until the rest of the support is added.
2013-01-17 05:56:28 +00:00
Andrew Turner
ed53231d73 Switch the default CPU to an arm9. This removes compiler support for the
unsupported 26-bit addressing mode. This change is required for moving to
the ARM EABI.
2013-01-14 08:39:48 +00:00
Dimitry Andric
bfd6a1d202 Add an ugly hack to libgcc's unwind code, to make it behave properly at
runtime on amd64, when it is compiled by clang.  Some versions of clang
don't save and restore all callee registers, if a __builtin_eh_return()
intrinsic is used in a function.  This is particularly bad on amd64.

Until the problem gets fixed by upstream, use an asm statement to force
clang to assume the registers in question are clobbered, when invoking
__builtin_eh_return(), so it will emit code to save and restore them.

This should fix the crashes reported on -current with some C++ programs,
particularly those that throw exceptions over multiple function
boundaries.

Reported by:	stefanf
MFC after:	3 days
2013-01-10 23:36:02 +00:00
Pedro F. Giffuni
833966f999 gcc: avoid generating negative values to DW_AT_byte_size.
The previous change was actually a NOP because size is
unsigned and compilers are dumb.

Submitted by:	Christoph Mallon
MFC after:	1 week
2012-12-28 22:06:50 +00:00
Pedro F. Giffuni
b76bfc09c3 gcc: avoid generating negative values to DW_AT_byte_size.
There is a bug in gcc (GCC/35998) where dwarf reports
sizes of unsigned -1 (0xffffffff).

On NetBSD this generated a faulty CTF entry which then
caused a segfault in ctfmerge. The issue was worked
around in NetBSD's Dtrace but since the issue originated
in gcc, it seems reasonable to fix it here.

Upstream gcc has been slow to react to this issue and
the author that submitted the patch is not interested
in licensing the change to us, so I did an independent
workaround for the issue.

MFC after:	1 week
2012-12-28 19:02:28 +00:00
Andrew Turner
d131070105 Don't define CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP on arm when
built with clang. When these are defined the lists are defined similar to:

asm(".section .ctors");
STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) };
asm(".section .dtors");
STATIC func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };

The problem is clang will move the two arrays out of the .ctors and .dtors
sections causing these sections to contain a single null address. By not
defining these macros we use the version of the code that places the arrays
is their sections by using __attribute__((section(".ctors"))) and similar
for .dtors.

Submitted by:	Daisuke Aoyama <aoyama AT peach.ne.jp>
2012-12-15 21:24:31 +00:00
Andrew Turner
2890206e6e Fix a comment in an asm block to work with compilers other than GCC 2012-12-15 21:06:14 +00:00
Eitan Adler
37a6031461 Clean up hardcoded ar(1) flags in the tree to use the global ARFLAGS in
share/mk/sys.mk instead.

This is part of a medium term project to permit deterministic builds of
FreeBSD.

Submitted by:	Erik Cederstrand <erik@cederstrand.dk>
Reviewed by:	imp, toolchain@
Approved by:	cperciva
MFC after:	2 weeks
2012-12-06 01:31:25 +00:00
Alexander Kabaev
31e8efde08 Follow clang lead and include mm_malloc.h only in hosted configurations.
This makes the use of intrinsics easier in kernel environment, according
to the submitter.

Requested by: jmg
2012-10-27 17:39:36 +00:00
Oleksandr Tymoshenko
4da573d910 Merging of projects/armv6, part 3
r238211:
Support TARGET_ARCH=armv6 and TARGET_ARCH=armv6eb

This adds a new TARGET_ARCH for building on ARM
processors that support the ARMv6K multiprocessor
extensions.  In particular, these processors have
better support for TLS and mutex operations.

This mostly touches a lot of Makefiles to extend
existing patterns for inferring CPUARCH from ARCH.
It also configures:
 * GCC to default to arm1176jz-s
 * GCC to predefine __FreeBSD_ARCH_armv6__
 * gas to default to ARM_ARCH_V6K
 * uname -p to return 'armv6'
 * make so that MACHINE_ARCH defaults to 'armv6'
It also changes a number of headers to use
the compiler __ARM_ARCH_XXX__ macros to configure
processor-specific support routines.

Submitted by:	Tim Kientzle <kientzle@freebsd.org>
2012-08-15 03:21:56 +00:00
Konstantin Belousov
b375a6d71d Pass --enable-new-dtags to the linker invocation by default. If
desired, one can turn off the generation of post-ELF standard dtags by
overriding it with --disable-new-dtags after the default switch.

Immediate effect of the change is that -rpath path is now stored both
in DT_RPATH and DT_RUNPATH tags, which is the right way to provide
rpath for dynamic linker supporting DT_RUNPATH per specification.

Reviewed by:	kan
MFC after:	1 month
2012-07-15 10:54:10 +00:00
Pedro F. Giffuni
5917560e17 Bring a couple of fixes for gcc optimizations.
The GCC4.3 branch contains some optimization fixes
that were not considered regressions and therefore
were never backported. We are bringing a couple of
them that are under GPLv2 since they were made
before the license switch upstream.

While here, add the GCC revision numbers in the
log.

Discussed with: jkim
MFC after:	1 week
2012-06-21 16:49:20 +00:00
Marius Strobl
d2a3fae7ec Merge r236137 from x86:
Enable GNU hash generation for dynamic ELF binaries.
2012-06-14 20:29:49 +00:00
Pedro F. Giffuni
a6c34d9e26 Revert r236962 - Experimental amdfam10/barcelona support.
The patches are unexpectedly causing gcc to fail while
building ports/graphics/ImageMagick even when the cpu
flags are not used.

Reported by:	Andreas Tobler
2012-06-13 20:21:08 +00:00
Pedro F. Giffuni
d3d19ef9c2 Space mismatch - typo in r236962.
Found by:	Dima Panov
Approved by:	jhb (mentor)
MFC after:	2 weeks
2012-06-12 16:07:03 +00:00
Pedro F. Giffuni
b28518a59a Add experimental support for amdfam10/barcelona from the GCC 4.3 branch.
Initial support for the AMD barcelona chipsets has been available in the
gcc43 branch under GPLv2 but was not included when the Core 2 support
was brought to the system gcc.

AMD and some linux distributions (OpenSUSE) did a backport of the amdfam10
support and made them available. Unfortunately this is still experimental
and while it can improve performance, enabling the CPUTYPE may break some
C++ ports (like clang).

Special care was taken to make sure that the patches predate the GPLv3
switch upstream.

Tested by:	Vladimir Kushnir
Reviewed by:	mm
Approved by:	jhb (mentor)
MFC after:	2 weeks
2012-06-12 15:04:18 +00:00
Marius Strobl
a985a6f303 Merge r236137 from x86:
Enable GNU hash generation for dynamic ELF binaries.

While at it, sync the order of options with x86 and pass along the verbose
flag.
2012-05-30 20:13:49 +00:00
Konstantin Belousov
c5ec8d1ddd Enable gnu hash generation for dynamic ELF binaries on x86.
Reviewed by:	kan
2012-05-27 05:27:47 +00:00
David E. O'Brien
41d25f72a0 Revert r235797. GCC's mis-assumptions has led to incorrect usage of
"%q[diouxX]" within FreeBSD sources.
2012-05-23 23:43:55 +00:00
David E. O'Brien
08c5bca9c7 Do not incorrectly warn when printing a quad_t using "%qd" on 64-bit platforms. 2012-05-22 18:18:06 +00:00
Pedro F. Giffuni
c6e2105845 Bring in a subset of gcc fixes that were back ported to
the GCC 4.1 branch and are available under GPLv2.

2007-11-07  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR rtl-optimization/33822
	* rtl.h (REG_OFFSET): Fix comment.
	* var-tracking.c (INT_MEM_OFFSET): New macro.
	(var_mem_set): Use it.
	(var_mem_delete_and_set): Likewise.
	(var_mem_delete): Likewise.
	(vt_get_decl_and_offset): Likewise.
	(offset_valid_for_tracked_p): New predicate.
	(count_uses): Do not track locations with invalid offsets.
	(add_uses): Likewise.
	(add_stores): Likewise.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129972

2007-11-16  Richard Guenther  <rguenther@suse.de>
	PR middle-end/34030
	* fold-const.c (fold_binary): Use correct types for folding
	1 << X & Y to Y >> X & 1.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130242

2008-01-14  Eric Botcazou  <ebotcazou@adacore.com>

	PR rtl-optimization/31944
	* cse.c (remove_pseudo_from_table): New function.
	(merge_equiv_classes): Use above function to remove pseudo-registers.
	(invalidate): Likewise
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131524

2008-01-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

        Backport:
	2007-11-07  Kenneth Zadeck <zadeck@naturalbridge.com>

	PR middle-end/33826
	* ipa-pure-const (static_execute): Added code to keep recursive
	functions from being marked as pure or const.
	* ipa-utils (searchc): Fixed comment.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131807

2008-02-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	Backport:
	2007-08-02  Nathan Froyd  <froydnj@codesourcery.com>

	PR middle-end/25445
	* varasm.c (default_binds_local_p_1): Consult flag_whole_program
	if we are compiling with -fPIC.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132061

2008-02-04  Richard Guenther  <rguenther@suse.de>

	PR middle-end/33631
	* expr.c (count_type_elements): Give for unions instead of
	guessing.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132101

2008-02-14  Alan Modra  <amodra@bigpond.net.au>

	PR target/34393
	* config/rs6000/rs6000.md (restore_stack_block): Force operands[1]
	to a reg.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132309

2008-03-25  Richard Guenther  <rguenther@suse.de>

	Backport from mainline:
	2008-02-12  Richard Guenther  <rguenther@suse.de>

	PR middle-end/35163
	* fold-const.c (fold_widened_comparison): Use get_unwidened in
	value-preserving mode.  Disallow final truncation.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133509

2008-11-30  Eric Botcazou  <ebotcazou@adacore.com>

	PR target/38287
	* config/sparc/sparc.md (divsi3 expander): Remove constraints.
	(divsi3_sp32): Add new alternative with 'K' for operand #2.
	(cmp_sdiv_cc_set): Factor common string.
	(udivsi3_sp32): Add new alternative with 'K' for operand #2.
	Add TARGET_V9 case.
	(cmp_udiv_cc_set): Factor common string.
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142298

Reviewed by:	mm
Approved by:	jhb (mentor)
MFC after:	1 week
2012-05-18 19:02:39 +00:00
Oleksandr Tymoshenko
b3f67bed16 Unbreak jemalloc build with MALLOC_PRODUCTION set. New jemalloc version
uncovered MIPS-related gcc bug described in
    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33256

The patch was obtained from r128198 in gcc-4_1-branch, which is GPLv2,
so it's OK to merge it.
2012-04-30 22:46:09 +00:00
Pedro F. Giffuni
a90710e961 Fix a typo in GCC affecting calculations with -ffast-math.
The fix is similar to the one applied in GCC-4.3 in
GCCSVN-r117929 under the GPLv2.

Submitted by:	Andrey Simonenko
Reviewed by:	mm
Approved by:	jhb (mentor)
MFC after:	3 days
2012-04-05 15:16:51 +00:00
Oleksandr Tymoshenko
59e1f8ae92 Disable IRIX compatibility flags for DWARF code generator. IRIX-compatible
DWARF code is not compatible with CTF tools
2012-03-23 21:07:10 +00:00
Tim Kientzle
acf8ebb0e9 Implement -print-file-name=include (which is undocumented
but used by some Linux boot loaders).  This option prints
out the directory holding the include files needed by
a freestanding program.  The default implementation of
this doesn't work on FreeBSD because of the different
include file layout.  But it's easy to implement:
just return /usr/include (or the cross-compiling equivalent).

Reviewed by:	kan
MFC after:	1 week
2012-02-10 05:05:42 +00:00
Andreas Tobler
ca3759b5de Silence a warning about redefinition of TARGET_ELF on powerpc. 2012-01-06 18:37:49 +00:00
Pedro F. Giffuni
4ee8547efb Clean an inconsistency with -ffinite-math-only.
Backported from the gcc-4_3-branch, revision 118001,
under the GPLv2.

This issue was also fixed in Apple's gcc.

PR:		157025
Reviewed by:	mm
Approved by:	jhb (mentor)
MFC:		2 weeks
2011-12-21 01:58:35 +00:00
Andreas Tobler
6bac4c3e6a Rename the linker emulation name for powerpc and powerc64. This is needed that
we can also use the upstream binutils linker where we have to have a unique
name for the FreeBSD emulation.
2011-11-19 19:25:57 +00:00
Andreas Tobler
8e803f5a7c Copy over the ASM_DECLARE_FUNCTION_SIZE macro from linux64.h. This macro
declares the proper size of a function. Without this macro recent GNU as will
complain about with:
'Error: .size expression for main does not evaluate to a constant.'

Up to now we produce this:

.L.main:
 	....
	.size   main, .-main

With the macro defined the output is this:

.L.main:
 	....
	.size   main,.-.L.main

This affects only the 64-bit compiler.
Tested with world and kernel on both, 32 and 64-bit powerpc.
2011-11-16 21:22:51 +00:00
Fabien Thomas
da5a448eb2 Import gcc fix for -fstack-protector that produces segfaulting
binaries on arm/armel.

Related gcc bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35965

PR: 161128
MFC after: 1 week
2011-11-09 15:59:02 +00:00
David E. O'Brien
d65033b604 * Don't give the impression that this compiler is GPLv3.
(It is "well known" that GCC 4.2.2 is GPLv3.)
* Don't give the impression that this compiler isn't "trustable".
* Fix dependency nit.
2011-10-24 20:52:41 +00:00
Stefan Farfeleder
0c60230835 Adjust posix_memalign() prototype to match what we define in stdlib.h for
C++ compilation.

PR:	standards/147210
2011-10-16 10:14:33 +00:00
Martin Matuska
b8596ed3ac Fix accidential dos-style endings to unix-style line endings
from last commit (r224523) to match the version approved by re@

Approved by:	re (implicit)
2011-07-30 17:40:11 +00:00
Martin Matuska
6cf3367c6d Fix invalid assertion of C++ external static data member declarations
as anonymous namespaces are local to the current translation.

GCC PR:		c++/33094

Reviewed by:	uqs
Approved by:	re (kib)
Obtained from:	gcc (branches/redhat/gcc-4_1-branch, rev. 129554, GPLv2)
MFC after:	1 week
2011-07-30 17:27:29 +00:00
Ulrich Spörlein
d218e1127b - Fix typo in check_for_nested_with_variably_modified present
- Implement -Wvariable-decl.
- Port -Wtrampolines support from gcc3.
(all three also via OpenBSD)

PR:		gnu/127136, gnu/157019
Submitted by:	Henning Petersen, Pedro Giffuni
MFC after:	6 weeks
2011-07-01 20:45:55 +00:00
Ben Laurie
5f301949ef Fix clang warnings.
Approved by:	philip (mentor)
2011-06-18 13:56:33 +00:00
Ben Laurie
104c8fc527 Fix clang warnings.
Approved by:	philip (mentor)
2011-05-22 22:17:06 +00:00
Ben Laurie
a5b05a8d85 Fix clang warnings.
Approved by:	philip (mentor)
2011-05-19 15:18:35 +00:00
Ben Laurie
7f49567fa4 Fix clang warnings.
Approved by:	philip (mentor)
2011-05-18 21:00:27 +00:00
Martin Matuska
60658a3a55 Add ChangeLog.gcc43 for backported changes from gcc 4.3
MFC after:	3 days
2011-04-30 23:00:41 +00:00
Dimitry Andric
6d67f69487 Remove libobjc and other Objective-C related components, as these are
extremely outdated, and not used by anything in the base system.

Silence from:	current@
2011-04-17 21:03:23 +00:00
Martin Matuska
5377a72618 Upgrade of base gcc and libstdc++ to the last GPLv2-licensed revision
(rev. 127959 of gcc-4_2-branch).

Resolved GCC bugs:
	c++: 17763, 29365, 30535, 30917, 31337, 31941, 32108, 32112, 32346,
	     32898, 32992
	debug: 32610, 32914
	libstdc++: 33084, 33128
	middle-end: 32563
	rtl-optimization: 33148
	tree-optimization: 25413, 32723
	target: 32218

Tested by:	pointyhat (miwi)
Obtained from:	gcc (gcc-4_2-branch up to rev. 127959)
PR:		gnu/153298, gnu/153959, gnu/154385
MFC after:	1 month
2011-03-29 20:53:51 +00:00
Martin Matuska
19aad99109 Backport missing tunings for -march=core2:
- enable extra 80387 mathematical constants (ext_80387_constants) [1]
- enable compare and exchange 16 bytes (cmpxchg16b) [2]

Verified against llvm-gcc (and apple gcc)

Obtained from:	gcc-4.3 (ref. svn revs. 119260 [1], 121140 [2]; GPLv2)
MFC after:	2 weeks
2011-03-17 09:44:33 +00:00
Martin Matuska
e98198cdbb Fix -march/-mtune=native autodetection for Intel Core 2 CPUs
Obtained from:	gcc 4.3 (partial rev. 119454; GPLv2)
MFC after:	2 weeks
2011-03-16 12:40:58 +00:00
Martin Matuska
c031e7949e Backport SSSE3 instruction set support to base gcc.
Enabled by default for -march=core2

Obtained from:	gcc 4.3 (rev. 117958, 121687, 121726, 123639; GPLv2)
MFC after:	2 weeks
2011-03-14 13:31:34 +00:00
Marius Strobl
d6582233c1 Now that TLS is supported for sparc64 by both binutils 2.17.50 committed
in r218822 and rtld(1) committed in r219533 turn on TLS support in GCC.
2011-03-11 21:24:02 +00:00
Martin Matuska
91b1eb9429 Backport Intel Core 2 and AMD Geode CPU types from gcc-4.3 (GPLv2)
These options are supported in this shape in all newer GCC versions.

PR:		gnu/155308
Obtained from:	gcc 4.3 (rev. 118090, 118973, 120846; GPLv2)
MFC after:	2 weeks
2011-03-07 14:48:22 +00:00
Martin Matuska
c33f0aaf60 Backport svn r124339 from gcc 4.3 and add opteron-sse3, athlon64-sse3
and k8-sse3 cpu-types for -march=/-mtune= gcc options.
These new cpu-types include the SSE3 instruction set that is supported
by all newer AMD Athlon 64 and Opteron processors.
All three cpu-types are supported by clang and all gcc versions
starting with 4.3 SVN rev 124339 (at that time GPLv2 licensed).

PR:		gnu/154906
Discussed with:	kib, kan, dim
Obtained from:	gcc 4.3 (r124339, GPLv2 licensed)
MFC after:	2 weeks
2011-02-20 22:25:23 +00:00
Nathan Whitehorn
79c77d726e Turn off default generation of userland dot symbols on powerpc64 now that
we have a binutils that supports it. Kernel dot symbols remain on to assist
DDB.
2011-02-18 21:44:53 +00:00
Konstantin Belousov
e2e30ff971 Configure gcc to emit .note.GNU-stack for both 32 and 64 bits PowerPC.
Mark gcc-provided asm files as not requiring executable stack.

It seems that non-FreeBSD ABIs for powerpc64 claim stack non-executable.
Due to this, rs6000_elf_end_indicate_exec_stack() only emit the note for
32 bit target. I decided not to change FreeBSD ABI and patch
emit the notes for both variants.

Reviewed and tested by:	nwhitehorn
2011-01-14 11:31:22 +00:00
Konstantin Belousov
e81361ede0 Make gcc emit the .note.GNU-stack section into the assembler files.
Reviewed by:	kan
2011-01-07 14:24:24 +00:00
Dimitry Andric
d8f878a1c5 Now that the fix for gcc PR 20218 is applied, and hidden attributes
actually work, linking of libgcc_s.so.1 on ia64 will fail with:

unwind-ia64.So(.text+0x1762): In function `_Unwind_FindEnclosingFunction':
: undefined reference to `_Unwind_FindTableEntry'
unwind-ia64.So(.text+0x1d82): In function `uw_frame_state_for':
: undefined reference to `_Unwind_FindTableEntry'
/usr/bin/ld: libgcc_s.so.1: hidden symbol `_Unwind_FindTableEntry' isn't defined

Repair this by not hiding the _Unwind_FindTableEntry symbol; on FreeBSD,
it is in libc, not in libgcc.

Silence from:	current@
2010-11-25 20:35:49 +00:00
Dimitry Andric
0e1c5cba52 Apply backported fix for gcc PR 20218. This makes __attribute__
((visibility ("hidden"))) work properly, and fixes building devel/glib20
with newer binutils.

Silence from:	current@
2010-11-25 20:29:14 +00:00
Nathan Whitehorn
a9f035fdd9 Check for NULL link registers as found in initial stack frames when doing
stack unwinding, instead of naively trying to check the instruction at
that location. This fixes signal handling in threaded applications after
recent changes regarding unwinding in libthr. While here, clean up our
MD_FROB_UPDATE_CONTEXT() implementation a little.
2010-09-26 14:20:09 +00:00
Rui Paulo
ed5d030788 Mark __DTOR_LIST__, __EH_FRAME_BEGIN__ and __CTOR_END__ as used to avoid
segfaults when building with clang.

This comes (partly) from the LLVM svn r41105.
2010-08-26 13:04:16 +00:00
Rui Paulo
30ca19f436 Mark __JCR_LIST__, __DTOR_END__, __JCR_END__, __FRAME_END__ as used to
avoid segfaults when building with clang.

Permission to backport given by Jan hubicka <jh at suse.cz>.
2010-08-26 13:00:29 +00:00
Rui Paulo
0c898ccd30 Mark the following static variables as __used__ instead of __unused__:
o force_to_data
o __CTOR_LIST__
o __do_global_dtors_aux_fini_array_entry
o __frame_dummy_init_array_entry

This is necessary because Clang is smart enough to optimize out these
variables was they were marked as __unused__ (and they are also static).
The end result was programs segfaulting because these symbols weren't
present.

This follows the upstream revision 159228 and the author of that
revision (Jan Hubicka <jh at suse.de>) allowed us to backport this to our
GPLv2 GCC.

Discussed with:	core
2010-08-24 00:23:40 +00:00
Rui Paulo
28be8b2ba9 Revert part of r211505. Some of the removed casts are actually safe so
put them back in again. Also, clang only complained about the lvalue
cast.

Submitted by:	Dimitry Andric <dimitry at andric.com>
Pointed out:	bde
2010-08-21 10:31:26 +00:00
Rui Paulo
aeba5ab26b Remove unneeded casts in inline assembly in contrib/gcc/longlong.h,
which are apparently "heinous" GNU extensions, so clang can
compile this without using the -fheinous-gnu-extensions option.

Results in *no* binary change, neither with clang, nor with gcc.

Submitted by:	Dimitry Andric <dimitry at andric.com>
2010-08-19 12:59:57 +00:00
Nathan Whitehorn
2cf64c8006 Teach our toolchain how to generate 64-bit PowerPC binaries. This fixes
a variety of bugs in binutils related to handling of 64-bit PPC ELF,
provides a GCC configuration for 64-bit PowerPC on FreeBSD, and
associated build systems tweaks.

Obtained from:	projects/ppc64
2010-07-10 02:29:22 +00:00
Juli Mallett
5619a3e4bf Add/improve mips64r2, Octeon, n32 and n64 support in the toolchain.
o) Add TARGET_ABI to the MIPS toolchain build process.  This sets the default
   ABI to one of o32, n32 or n64.  If it is not set, o32 is assumed as that is
   the current default.
o) Set the default GCC cpu type to any specified TARGET_CPUTYPE.  This is
   necessary to have a working "cc" if e.g. mips64 is specified, as binutils
   will refuse to link objects using different ISAs in some cases.
o) Add support for n32 and n64 ABIs to binutils and GCC.
o) Add additional required libgcc2 stubs for n32 and n64.
o) Add support for the "mips64r2" architecture to GCC.  Add the "octeon"
o) When static linking, wrap default libraries in --start-group and
   --end-group.  This is required for static linking to work on n64 with the
   interdependencies between libraries there.  This is what other OSes that
   support n64 seem to do, as well.
o) Fix our GCC spec to define __mips64 for 64-bit targets, not __mips64__, the
   former being what libgcc, etc., check and the latter seemingly being a
   misspelling of a hand merge from a Linux spec.
o) When no TARGET_CPUTYPE is specified at build time, make GCC take the default
   ISA from the ABI.  Our old defaults were too liberal and assumed that 64-bit
   ABIs should default to the MIPS64 ISA and that 32-bit ABIs should default to
   the MIPS32 ISA, when we are supporting or will support some systems based on
   earlier 32-bit and 64-bit ISAs, most notably MIPS-III.
o) Merge a new opcode file (and support code) from a later version of binutils
   and add flags and code necessary to support Octeon-specific instructions.
   This should also make merging opcodes for other modern architectures easier.

Reviewed by:	imp
2010-06-02 11:06:03 +00:00
Warner Losh
b2be35012a Tweak the linker spec a smidge.
Correct a typo.
2010-03-05 21:25:20 +00:00
Warner Losh
63f3798125 Add support for o32 (when it isn't the default), n32, n64, and o64 to
the linker spec.  Provide the ability to have a default ABI that's
different than o32 (again, for all 4).

Submitted by:	C. Jayachandran (JC) with tweaks for o64/o32 by me
2010-03-05 16:56:08 +00:00
Warner Losh
fa8ce1239c Also define _MIPS_ISA here.
Submitted by:	jmallet@
2010-03-03 02:44:20 +00:00
Warner Losh
24179b0140 Bring in more built-in defines from NetBSD
a few #defines from JC.

# tested only with o32 at the moment

Submitted by:	C. Jayachandran (CJ)
Obtained from:	NetBSD
2010-03-02 05:59:14 +00:00
Warner Losh
168194c97f Merge r194519 from projects/mips to head by hand:
r194519 | gonzo | 2009-06-19 17:28:26 -0600 (Fri, 19 Jun 2009) | 3 lines
- set -mabicalls and -msoft-float as a default in order to
    simplify building ports
2010-01-08 23:37:30 +00:00
Konstantin Belousov
c09ba32715 Properly support -fPIE by linking PIE binaries with specially-built
Scrt1.o instead of crt1.o, since the later is built as non-PIC.

Separate i386-elf crt1.c into the pure assembler part and C code,
supplying all data extracted by assembler stub as explicit parameters [1].
Hide and localize _start1 symbol used as an interface between asm and
C code.

In collaboration with:	kan
Inspired by:	PR i386/127387 [1]
Prodded and tested by:	rdivacky [1]
MFC after:	3 weeks
2009-12-02 16:34:20 +00:00
John Baldwin
22239c9dc4 Change gcc to assume a default machine architecture of 486 instead of 386
on "i386".  Doing it in the compiler is deemed to be less fragile then
attempting to provide a default -march setting via bsd.cpu.mk.  FreeBSD
itself has not supported plain 386 CPUs since 5.x.

Suggested by:	kan
Requested by:	rdivacky
MFC after:	1 month
2009-10-21 19:26:12 +00:00
Bruce M Simpson
f667763060 Output DWARF debug information for global 'using' declarations, instead
of just blowing up. A very similar change to this exists which is
GPLv3 licensed, this is my own change.

This problem was triggered by running the Boost regression tests.

See also:	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899
Reviewed by:	luigi
Approved by:	re (kib)
2009-07-22 01:07:11 +00:00
Alexander Kabaev
2286fe7635 Second attempt at eliminating .text relocations in shared libraries
compiled with stack protector.

Use libssp_nonshared library to pull __stack_chk_fail_local symbol into
each library that needs it instead of pulling it from libc. GCC
generates local calls to this function which result in absolute
relocations put into position-independent code segment, making dynamic
loader do extra work every time given shared library is being relocated
and making affected text pages non-shareable.

Reviewed by:        kib
Approved by:        re (kib)
2009-07-14 21:19:13 +00:00
David Schultz
e4c3a7fc88 Merge an important change that I mistakenly left out when merging C99
inline function support. This should fix instances where gcc
spuriously reports the following error:

    error: nested function 'foo' declared but never defined
2009-03-25 05:10:32 +00:00
David Schultz
d5ed956300 Make gcc use C99 inline semantics in c99 and gnu99 mode. This was the
original intent, but the functionality wasn't implemented until after
gcc 4.2 was released. However, if you compiled a program that would
behave differently before and after this change, gcc 4.2 would have
warned you; hence, everything currently in the base system is
unaffected by this change.  This patch also adds additional warnings
about certain inline function-related bogosity, e.g., using a
static non-const local variable in an inline function.

These changes were merged from a snapshot of gcc mainline from March
2007, prior to the GPLv3 switch. I then ran the regression test suite
from a more recent gcc snapshot and fixed the important bugs it found.
I also squelched the following warning unless -pedantic is specified:

    foo is static but used in inline function bar which is not static

This is consistent with LLVM's behavior, but not consistent with gcc 4.3.

Reviewed by:	arch@
2009-03-14 19:36:13 +00:00
David E. O'Brien
5a33926c5b If arm.h is going to define WCHAR_TYPE, don't assume WCHAR_TYPE_SIZE
doesn't already have a definition.

Reported by:	imp
2008-09-10 15:47:31 +00:00
David E. O'Brien
0b4f8552dd We're not quite ready for the full %(endian_spec). 2008-09-01 23:09:45 +00:00
David E. O'Brien
1b34d5982b Add __unix__. Tweak __KPRINTF_ATTRIBUTE__ while I'm here. 2008-09-01 22:22:44 +00:00
David E. O'Brien
4bdc01a9f9 Add FreeBSD/MIPS support to GCC. 2008-09-01 18:46:03 +00:00
David E. O'Brien
9dec52bfb2 Turn cc_tools/Makefile and Makefile.tgt into a "linear" read. Shared
parts of the configuration aren't duplicated, and arch-specific exceptions
are made "in-place".  Also clean up the FreeBSD/amd64 config a little.
2008-08-31 23:38:28 +00:00
David Schultz
7a9e0a96e0 Doc updates for changes in the default values of
-ffancy-math-387 and -mmath-errno.
2008-08-10 19:35:09 +00:00
David Schultz
7a5b5fae94 Make -fno-math-errno the default. Our libm doesn't support the SysV
mistake of setting errno, and never has.  This will need to be fixed
upstream in a more generic way, but the changes are somewhat more
involved.
2008-08-10 19:33:35 +00:00
David Schultz
1b93600c85 Make -mfancy-math-387 the default on FreeBSD, as it is on most other
operating systems. Previously, gcc would inhibit the generation of
fsqrt, fsin, and several other floating point instructions, for the
benefit of the old in-kernel math emulator, which was removed over 5
years ago.
2008-08-10 19:02:57 +00:00
David E. O'Brien
b370e2cfea White space fixes. 2008-06-28 15:28:17 +00:00
David E. O'Brien
c4a2958381 Reduce diff to vendor. 2008-06-28 15:17:02 +00:00
Peter Wemm
497e80a371 Reorganize the gcc vendor import work area. This flattens out a bunch
of unnecessary path components that are relics of cvs2svn.

(These are directory moves)
2008-06-01 00:03:21 +00:00
Marius Strobl
7125e147b2 * gthr-posix.h (__gthread_active_p): Use the Solaris implementation
for FreeBSD as well.

This is the fix for __gthread_active_p() returning false positives
which was committed as rev. 1.1.1.8.2.1 to RELENG_7 but now looped
back to the vendor branch via the GCC repository and relicensed to
be GPLv2 by me.
Thanks go to gerald@ for getting the fix approved upstream and for
committing to the GCC repository.

PR:		119289
Approved by:	core
2008-04-21 20:40:42 +00:00
Marius Strobl
ae8e775b82 This commit was generated by cvs2svn to compensate for changes in r178388,
which included commits to RCS files with non-trunk default branches.
2008-04-21 20:40:42 +00:00
David E. O'Brien
c817ff638d Do not fold -C*ABS<n> to ABS<-C*n> (i.e., do not move negative constants
inside ABS expression).
Obtained from:	Richard Guenther <rguenther@suse.de>
Approved by:	core
2007-12-11 03:35:39 +00:00
David E. O'Brien
c5ace62e4e This commit was generated by cvs2svn to compensate for changes in r174531,
which included commits to RCS files with non-trunk default branches.
2007-12-11 03:35:39 +00:00
Marius Strobl
3df889c865 Allow the targeted CPU type to be set via -mcpu instead of
limiting to the hardcoded equivalent of -mcpu=ultrasparc.

PR:		109510
MFC after:	3 months
2007-12-09 17:41:47 +00:00
David E. O'Brien
efd1233d59 Do not imply -ftree-vrp with -O2 and above. One must implicitly specify
'-ftree-vrp' if one wants it.
Some bad code generation has been tracked to -ftree-vrp.  jdk1{5,6} are
notable examples.

Approved by:	re(kensmith)
2007-10-02 20:06:14 +00:00
Alexander Kabaev
4da6937165 Update locally changed files to GCC 4.2.1.
Approved by: re (kensmith)
2007-08-14 03:04:42 +00:00
Alexander Kabaev
89ec829aba Merge files that are no longer carry FreeBSD local changes.
Approved by:	re (kensmith)
2007-08-14 03:02:26 +00:00
Alexander Kabaev
23baddbde1 GCC 4.2.1 release. 2007-08-14 02:45:23 +00:00
Alexander Kabaev
997921685c This commit was generated by cvs2svn to compensate for changes in r171825,
which included commits to RCS files with non-trunk default branches.
2007-08-14 02:45:23 +00:00
Alexander Kabaev
7a6bf861d6 Disable shared libgcc use for profiled builds. GNU linker pulls symbols
out of libgcc_s.so.1 somehow and fails to record DT_NEEED dependency
when linking with profiled libraries despite --ld-as-needed option.
2007-05-28 23:02:56 +00:00
Olivier Houchard
67de64dde8 FreeBSD expects VFP, so use that as the default FPU.
Reviewed by:	kan
2007-05-21 08:38:42 +00:00
Alexander Kabaev
f1d9718c03 Cosmetics: remove extra space from GCC version string. 2007-05-19 06:37:32 +00:00
Alexander Kabaev
fe32ca9af4 Merge arm-freebsd.h.diff directly into the target file. Maintaining
separate patch is much more painful than taking this file off the
vendor branch.
2007-05-19 03:11:26 +00:00
Alexander Kabaev
23400e5a44 Add FMT_FLAG_NULL_FORMAT_OK flag. 2007-05-19 03:09:31 +00:00
Alexander Kabaev
888346df5f Remove files that are no more part of GCC distribution from FSF branch. 2007-05-19 02:42:17 +00:00
Alexander Kabaev
ef444676f3 This commit was generated by cvs2svn to compensate for changes in r169708,
which included commits to RCS files with non-trunk default branches.
2007-05-19 02:42:17 +00:00
Alexander Kabaev
8902467bb7 Remove files that are not part of GCC distribution anymore. 2007-05-19 02:34:18 +00:00
Alexander Kabaev
096b39c236 Update configuration files for GCC 4.2. 2007-05-19 02:30:20 +00:00
Alexander Kabaev
0d6df2bb56 Merge local FreeBSD changes for -mno-align-long-strings. 2007-05-19 02:26:26 +00:00
Alexander Kabaev
be54bacbaf Merge local FreeBSD changes. 2007-05-19 02:23:49 +00:00
Alexander Kabaev
2bc5055037 In FreeBSD -O0 -O1 optimize alignment for time, not size. 2007-05-19 02:22:16 +00:00
Alexander Kabaev
f48faea4fa Merge local changes for -mprofiler-epilogue support. 2007-05-19 02:18:38 +00:00
Alexander Kabaev
2f68bca35b Merge local FreeBSD changes to support -fformat-extensions. 2007-05-19 02:16:45 +00:00
Alexander Kabaev
e2f01f3f63 Add FreeBSD suffix to GCC version string. 2007-05-19 02:14:13 +00:00
Alexander Kabaev
9d6b9560a8 FreeBSD uses unchanged versions of this files. 2007-05-19 02:12:21 +00:00
Alexander Kabaev
6b834ef156 GCC 4.2.0 release. 2007-05-19 01:19:51 +00:00
Alexander Kabaev
533952614f This commit was generated by cvs2svn to compensate for changes in r169689,
which included commits to RCS files with non-trunk default branches.
2007-05-19 01:19:51 +00:00
Bruce Evans
11e27303d3 Fixed -mprofiler-epilogue. The garbage collector apparently doesn't
understand that non-local variables can never be collected, and when
it collected the static variable for mexitcount_libfunc, gcc aborted
on the next use of this variable.

This quick fix is to reinitialize the variable on every use and depend
on garbage collection recovering the small amount of memory wasted by
this, and not worry by the small amount of time wasted by this.  It
would be better to initialize the variable together with most of the
other libfuncs in optabs.c and depend on whatever magic is there to
prevent its collection, but we initialize it here to avoid taking at
least 2 more files off the vendor branch.
2006-10-25 07:29:22 +00:00
Ruslan Ermilov
f981f1923b Removed these from HEAD as well. 2006-09-21 07:55:28 +00:00
Ruslan Ermilov
89de143f92 These files live in the doc/ subdir in later releases of GCC. 2006-09-21 07:54:02 +00:00
Ruslan Ermilov
5bb8cebbb4 This commit was generated by cvs2svn to compensate for changes in r162512,
which included commits to RCS files with non-trunk default branches.
2006-09-21 07:54:02 +00:00
Ruslan Ermilov
932b1e2fe8 Updated manpages for 3.4.6 release.
OK'ed by:	kan
Obtained from:	gcc-3.4.6.tar.bz2
2006-09-21 07:45:37 +00:00
Ruslan Ermilov
83cc3b492f This commit was generated by cvs2svn to compensate for changes in r162509,
which included commits to RCS files with non-trunk default branches.
2006-09-21 07:45:37 +00:00
Alexander Kabaev
f2d5255ddd Resolve conflicts after GCC 3.4.6 20060825 import. 2006-08-26 21:37:21 +00:00
Alexander Kabaev
e35cf0a56c Gcc 3.4.6 as of 2006/08/25 #116475. 2006-08-26 21:29:10 +00:00
Alexander Kabaev
35cc3dc5ba This commit was generated by cvs2svn to compensate for changes in r161651,
which included commits to RCS files with non-trunk default branches.
2006-08-26 21:29:10 +00:00
David E. O'Brien
a1cfcf9970 Locate __FreeBSD_cc_version's value beside __FreeBSD__'s value to make it
easier to keep them in sync.
2005-10-30 19:04:47 +00:00
David E. O'Brien
67ae096798 Catch up with FreeBSD 7. 2005-10-29 09:13:31 +00:00
Craig Rodrigues
5dbed42856 Submitted following patch to FSF GCC:
* freebsd-spec.h (FBSD_TARGET_OS_CPP_BUILTINS):
	  Use builtin_define_with_int_value() instead of
	  adding a new check for every new major FreeBSD version.

Motivated by:	simon
Discussed with:	obrien, kan
2005-10-27 23:57:55 +00:00
David E. O'Brien
d109621656 Fix bug where static forward declarations weren't accepted.
This allows us to fix non-ISO-C constructs in our kernel to legal ISO-C.

Submitted by:	rodrigc
Obtained from:	http://gcc.gnu.org/ml/gcc-patches/2005-09/msg00006.html
2005-09-07 09:23:39 +00:00
David E. O'Brien
8d85d711c3 Fix bug where GCC thought athlon-tbird had SSE support. 2005-07-19 21:53:22 +00:00
Scott Long
98e104cbc9 Patch the freebsd spec file for PowerPC so that PIC code builds correctly.
This allows FreeBSD/PPC to build and run out of stock CVS sources.  This
also takes the file off of the vendor branch.

Submitted by: kan, grehan
Approved by: re, kan
2005-07-07 21:40:37 +00:00
Alexander Kabaev
b297022008 Enable handling of MS-compatible packing push and pop pragmas. This change was
inadvertedly left out of the last import.
2005-06-03 17:35:13 +00:00
Alexander Kabaev
441d901f19 Fix a typo from previos commit. 2005-06-03 05:58:56 +00:00
Alexander Kabaev
65bbb3030a Catch up with changes in BDX_OUTPUT_[LR]BRAC callers. 2005-06-03 04:19:23 +00:00
Alexander Kabaev
c3cbf7fdb9 Merge conflicts for GCC 3.4.4. 2005-06-03 04:02:20 +00:00
Alexander Kabaev
d14a001770 Localize GCC version string for FreeBSD. 2005-06-03 03:52:25 +00:00
Alexander Kabaev
31a119f3ed Stock files. 2005-06-03 03:50:42 +00:00
Alexander Kabaev
d51085f37e Gcc 3.4.4 release. 2005-06-03 03:28:44 +00:00
Alexander Kabaev
4101e78861 This commit was generated by cvs2svn to compensate for changes in r146895,
which included commits to RCS files with non-trunk default branches.
2005-06-03 03:28:44 +00:00
David E. O'Brien
337c1d7b9b Break lines at sentence ends, etc... 2004-11-11 07:50:09 +00:00
David E. O'Brien
fb89b41ce4 Don't attempt to claim what version of GCC we're documenting. The manpage
is still mostly the GCC 2.95 one, with faint attempts by me over the years
to document a few new switches.  Thus, it is dubious to claim documentation
of specific modern GCC versions.

Noted by:	delphij
2004-11-11 07:45:01 +00:00
Alexander Kabaev
1689e31de6 Import a patch from GCC PR c/16999 to stop quoting already quoted ident
strings.
2004-10-15 03:22:13 +00:00
Alexander Kabaev
f75a5631b8 This commit was generated by cvs2svn to compensate for changes in r136527,
which included commits to RCS files with non-trunk default branches.
2004-10-15 03:22:13 +00:00
David E. O'Brien
b4e8286b3b Enter the long awaited start of FreeBSD 6.0! 2004-08-21 03:58:39 +00:00
Alexander Kabaev
292f200484 Remove files that are not part of GCC 3.4.x from the vendor branch. 2004-08-12 16:41:42 +00:00
Alexander Kabaev
6d3e93598f This commit was generated by cvs2svn to compensate for changes in r133582,
which included commits to RCS files with non-trunk default branches.
2004-08-12 16:41:42 +00:00
Alexander Kabaev
025ee8b5ee Import one more file for Gcc 3.4.2 20040728. 2004-08-12 02:21:58 +00:00
Alexander Kabaev
db20bc12fe This commit was generated by cvs2svn to compensate for changes in r133534,
which included commits to RCS files with non-trunk default branches.
2004-08-12 02:21:58 +00:00
Alexander Kabaev
dfa9c64b20 Remove obsolete ASM_FINAL_SPEC definition.
Reported by:	green
2004-07-29 21:49:34 +00:00