Commit Graph

129 Commits

Author SHA1 Message Date
Bryan Drewery
c04d716b55 Revert r290740.
Discussing with sjg@, we agree the better fix is to be done in meta.stage.mk.

This also broke staging of SYMLINKS for non-shared libraries, such as for
lib/libcompiler_rt, which results in all Makefile.depend removing it.

Sponsored by:	EMC / Isilon Storage Division
2015-11-13 20:25:30 +00:00
Bryan Drewery
e13d8c1244 META MODE: Don't double stage SYMLINKS for libraries.
meta.stage.mk is handling ${SYMLINKS:T} for stage_libs already.  The logic in
bsd.sys.mk to handle ${SYMLINKS} was brought in r247817 when it was moved out
of bsd.prog.mk and bsd.lib.mk into bsd.sys.mk.  The logic previously was
limited to bsd.prog.mk.

This fixes a race, seen easily in lib/libthr, where libpthread_p.a is created
by both stage_libs and stage_symlinks resulting in 'ln: File exists'.

Sponsored by:	EMC / Isilon Storage Division
2015-11-13 01:47:56 +00:00
Enji Cooper
a52bef9c99 Only enable -fstack-protector-strong on gcc 4.9+ and default to -fstack-protector
when -fstack-protector-strong is not available, like it was implicitly before
r288669

As noted by antoine@, devel/gcc (which is 4.8.5) lacks -fstack-protector-strong
support, whereas 4.8.4i (devel/gcc48) has the support.

Until a version is available which has -fstack-protector-strong support, be
conservative and only enable support with 4.9+.

Reviewed by: pfg
X-MFC with: r288669, r289465
Differential Revision: https://reviews.freebsd.org/D3924
2015-10-18 04:07:40 +00:00
Enji Cooper
835f328986 Only use -fstack-protector-strong with supported compilers
This includes clang 3.5.0+, gcc 4.2.1, gcc 4.8.4+

This allows me to do subdirectory makes again after setting
MAKESYSPATH on 10.2-RELEASE as it comes with clang 3.4.1.

As a sidenote: this isn't technically correct for all vintages
of gcc 4.2.1, but will be correct when gcc is rebuilt/reinstalled
after r286074, so this version check should be good enough.

X-MFC with: r288669
Differential Revision: https://reviews.freebsd.org/D3924
Reviewed by: emaste, pfg
2015-10-17 19:48:17 +00:00
Bryan Drewery
08cf86fef8 Add missing targets to PHONY_NOTMAIN.
- buildconfig, installconfig (missed in r289085)
- files (missed in r241298)

Sponsored by:	EMC / Isilon Storage Division
2015-10-14 20:38:51 +00:00
Simon J. Gerraty
eef72759b5 In jobs mode we can use .ORDER to force stage_links to run after other
stage_* targets.
In non-jobs mode we can achieve the same result by simply introducing
the targets in the correct order.
Thus in bsd*.mk we simply add targets to STAGE_TARGETS which we
realize in meta.stage.mk

Reviewed by: bdrewery
2015-10-07 00:24:27 +00:00
Dimitry Andric
c710e87b3b Merge ^/head r288457 through r288830. 2015-10-05 17:54:54 +00:00
Pedro F. Giffuni
c621a626db Bump the stack protector to level "strong".
The general stack protector is known to be weak and has pretty small
coverage. While setting stack-protector-all would give better protection
it would come with a performance cost: for this reason Google's Chrome OS
team developed a new stack-protector-strong variant.

In addition to the protections offered by -fstack-protector, the new option
will guard any function that declares any type or length of local array,
even those in structs or unions. It will also protect functions that use a
local variable's address in a function argument or on the right-hand side
of an assignment.

The option was introduced in GCC-4.9, but support for it has been
back-ported to our base GCC (r286074) and is also available in clang.

The change was tested with dbench and doesn't introduce performance
regressions. An exp-run over the ports tree revealed no failures when
using the stricter stack-protector-all. Thanks to all testers involved.

Reference:
https://outflux.net/blog/archives/2014/01/27/fstack-protector-strong/

Tested by:	pho, portmgr (antoine)
Discussed with:	secteam (delphij)

Differential Revision: https://reviews.freebsd.org/D3463
PR:		203394 (exp-run)

Relnotes:	yes
MFC:		no (not supported in older clang)
2015-10-04 18:54:02 +00:00
Dimitry Andric
ae2d96ab3a Merge ^/head r287878 through r288034. 2015-09-20 20:34:17 +00:00
Bryan Drewery
db31773f3e Garbage collect _SHLIBDIRPREFIX leftovers from r284898.
Sponsored by:	EMC / Isilon Storage Division
2015-09-18 22:28:13 +00:00
Dimitry Andric
76aeda8ad4 Merge ^/head r284188 through r284643. 2015-06-20 19:34:50 +00:00
Dimitry Andric
944e1910da From 3.7.0 onwards, we no longer need the -mllvm -enable-gvn=false hack
to compile boot2 successfully.
2015-05-30 18:10:43 +00:00
Simon J. Gerraty
b17ff922d4 Merge from head 2015-05-26 21:52:57 +00:00
Dimitry Andric
ab0116f5fb Re-enable using -mllvm -enable-load-pre=false in CLANG_OPT_SMALL for
clang versions before 3.5.0.  This should enable building head's version
of sys/boot/i386/boot2 on 9.x and 10.x again.

Reported by:	bz
2015-03-28 12:23:15 +00:00
Dimitry Andric
22a3c2dd5d Correctly pass the -mllvm -enable-gvn=false flag in CLANG_OPT_SMALL
(this has to be passed as a combination of two flags).  Should fix the
case where the clang version is before 3.5.0.

Submitted by:	Pedro Arthur <bygrandao@gmail.com>
X-MFC-With:	r279018, r279378
2015-03-21 19:13:13 +00:00
Dimitry Andric
ca65be80fd Merge ^/head r279313 through r279595. 2015-03-04 19:47:33 +00:00
David E. O'Brien
1b398e4ee3 Update r279018 so it only applies to Clang version 3.5+ and not 3.4.[1-9]. 2015-02-27 22:18:33 +00:00
Dimitry Andric
0d36d957d3 Merging ^/head r278916 through r279022. 2015-02-19 21:10:01 +00:00
Warner Losh
b4d7059828 Only disable gvn on clang 3.5 and newer. 2015-02-19 20:22:30 +00:00
Dimitry Andric
accc510ac3 Since clang 3.6.0 now implements the archetype 'freebsd_kprintf' for
__attribute__((format(...))), and the -fformat-extensions flag was
removed, introduce a new macro in bsd.sys.mk to choose the right variant
of compile flag for the used compiler, and use it.

Also add something similar to kern.mk, since including bsd.sys.mk from
that file will anger Warner. :-)

Note that bsd.sys.mk does not support the MK_FORMAT_EXTENSIONS knob used
in kern.mk, since that knob is only available in kern.opts.mk, not in
src.opts.mk.  We might want to add it later, to more easily support
external compilers for building world (in particular, sys/boot).
2015-01-28 18:36:33 +00:00
Dimitry Andric
e004ed0266 Disable the new -Wunused-local-typedef warning for WARNS <= 3, since it
triggers way too many times for the version of libc++ we have in base at
this point.  While here, fix the compiler version check for
-Wno-unused-const-variable.
2015-01-28 07:29:38 +00:00
Warner Losh
8f610c093a Put the conditional back. For the default case it isn't really needed,
but for the gcc case it still is on i386 and amd64's build of
sys/boot.

Submited by: dim@
2015-01-01 08:30:32 +00:00
Warner Losh
7ed11c5e5a Fix module builds on arm (and maybe others) by turning off a whole
raft of new warnings that appear to be on by default in clang 3.5.0.
Fix RPI-B build issues with new clang not liking the ability to pass
arbitrary flags to as, since some flags are more arbitrary (and thus
verboten) than others.

These warnings should be actually fixed in the code, but this is a
band-aide to get things (almost) building again.
2015-01-01 02:00:04 +00:00
Dimitry Andric
a58b298927 Ensure boot2 stays below the limit, by applying a patch from Roman
Divacky which shrinks the code, and by using the custom llvm option to
disable the Global Value Numbering optimization pass.
2014-11-24 20:01:05 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Ed Schouten
13b7412dad Add -Wthread-safety to WARNS=6.
While there, add a NO_WTHREAD_SAFETY flag that can be used to disable
this specific warning flag. Disable it for auditdistd. We can easily
patch up auditdistd to have the right annotations to build, but as
auditdistd is intended to be portable across other operating systems,
it's not worth the effort.

Approved by:	brueffer@
2014-09-01 20:18:09 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Marcel Moolenaar
e7d939bda2 Remove ia64.
This includes:
o   All directories named *ia64*
o   All files named *ia64*
o   All ia64-specific code guarded by __ia64__
o   All ia64-specific makefile logic
o   Mention of ia64 in comments and documentation

This excludes:
o   Everything under contrib/
o   Everything under crypto/
o   sys/xen/interface
o   sys/sys/elf_common.h

Discussed at: BSDcan
2014-07-07 00:27:09 +00:00
Simon J. Gerraty
f187ca8c90 Using lib*.so as a linker script ...
the paths can be avoided, making the file mobile, so generate during build
and we need to handle staging it.
2014-05-16 14:51:19 +00:00
Warner Losh
dfd11a4413 g/c unmaintained, uninstalled bsd.pkg.mk. It tied into the ports
system, as it existed 9 years ago, and has been obsolete for a long
time.
2014-05-10 16:38:27 +00:00
Warner Losh
7273339dc4 Eliminate EARLY_BUILD flag. It is redundant and means MK_CLANG_FULL=no
and MK_LLDB=no, so set those explicitly (now that we can do
that). Simplify tests for these variables as well, since we know they
will always be defined regardless of the phase of the build.
2014-05-10 16:38:03 +00:00
Warner Losh
ab72ce6b1b Migrate NO_WARN to MK_WARN. Support legacy NO_WARN usage. Remove a
check for EARLY_BUILD because it isn't necessary (MK_WARN=no will
always be defined for that).
2014-05-10 16:37:53 +00:00
Warner Losh
999298523e Support, to the extent we generate proper command lines, compiling
with clang 3.3. Useful for test building -current on a -stable system
in individual directories. Potentially useful if we ever want to
support, say, gcc 4.8 or 4.9's new warnings when building with an
external toolchain (but such support not yet committed). Document
the bsd.compiler.mk interface.
2014-05-10 16:37:44 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
41603b8357 Simplify use of the semi-bogus EARLY_BUILD variable. Also, simplify
use of semi-bogus NO_WARNS variable. Both of these, in this case,
should collapse to WITHOUT_WARNS in a future commit.
2014-05-05 22:03:08 +00:00
Warner Losh
a18673d42d Introduce CWARNFLAGS.${COMPILER_TYPE} and use that to simplify the
thicket of .if ${COMPILER_TYPE} == "clang" that controls
warnings. Also, use CFLAGS.clang in a couple places in preference to
having a similar construct that's related to the CWARNFLAGS changes.
2014-05-05 22:03:01 +00:00
Simon J. Gerraty
1c19778e8d Some warnings depened on the version of clang, allow us to check.
Reviewed by: obrien
2014-05-02 01:39:44 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Warner Losh
2ded1ea292 Generalize FOO.clang to FOO.${COMPILER_TYPE}. There's no reason these
need to be clang specific. Also generalize things a bit.
2014-04-25 19:25:57 +00:00
Andrey A. Chernov
c34a97a05d Add fetch and patch to .PHONY and .NOTMAIN only if PORTNAME is defined.
Unconditional addition cause real fetch(1) and patch(1) programs are
builded every time.

MFC after:      1 week
2014-03-02 13:12:06 +00:00
Dimitry Andric
9bc21aae69 Merge from head up to r262311. 2014-02-21 22:54:35 +00:00
Dimitry Andric
2879baf24b Move the part in bsd.own.mk that sets -Wno-c++11-extensions for clang to
bsd.sys.mk, where it really belongs.  This also causes the flag to get
added when clang is *not* the default system compiler, but is still
used, e.g. by setting WITH_CLANG_IS_CC manually.

MFC after:	3 days
2014-02-21 22:38:25 +00:00
Dimitry Andric
7e4113e2e1 In case source files are compiled with -g, tell clang not to emit .cfi
directives, since on sparc64 we must still GNU as, which does not
support those directives.

Note there are several programs and libraries in our tree, which are
always compiled with -g, even if DEBUG_FLAGS is not set by the user!
2014-02-21 19:58:45 +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
Dimitry Andric
f66aed321e Apply band-aid for 32-bit compat libs failures after r260334: put back
-Qunused-arguments for clang for now, until I can figure out a way to
make it unneeded in all scenarios.  Sorry about the breakage.
2014-01-06 14:39:10 +00:00
Dimitry Andric
4abd7edcbd Split the last gcc-specific flags off into CFLAGS.gcc. This also
removes the need to use -Qunused-arguments for clang throughout the
tree.

MFC after:	3 days
2014-01-05 21:03:49 +00:00
Dimitry Andric
20dcbdb6be In addition to r260102, also define GCC_MS_EXTENSIONS in bsd.sys.mk,
since kernel module builds do not use kern.pre.mk.

MFC after:	3 days
X-MFC-With:	r260102
2014-01-05 16:40:41 +00:00
Dimitry Andric
b294993d63 To avoid having to explicitly test COMPILER_TYPE for setting
clang-specific or gcc-specific flags, introduce the following new
variables for use in Makefiles:

CFLAGS.clang
CFLAGS.gcc
CXXFLAGS.clang
CXXFLAGS.gcc

In bsd.sys.mk, these get appended to the regular CFLAGS or CXXFLAGS for
the right compiler.

MFC after:	1 week
2013-12-22 17:51:33 +00:00
Dimitry Andric
e33625bfdc For WARNS <= 3, change the clang warning flag -Wno-conversion to
-Wno-enum-conversion.  In earlier clang versions (before 3.2), the
latter did not exist, and suppressing enum conversion warnings was
really the goal of this warning suppression flag.

This should enable the same kind of warning again as was fixed by
r259072 ("incompatible integer to pointer conversion passing 'Elf_Addr'
(aka 'unsigned int') to parameter of type 'void *'"), and which was only
emitted by gcc.

Noticed by:	kib
MFC after:	3 days
2013-12-07 22:30:07 +00:00
Simon J. Gerraty
7248444645 Ensure that $PROG isn't make .PHONY
Also add some additional control over staging (for use by bsd.test.mk)
2013-10-12 23:51:00 +00:00