Commit Graph

69 Commits

Author SHA1 Message Date
Bryan Drewery
35c12dd688 csu: Add proper .depend tracking for each object.
This doesn't appear to have ever worked. After a .depend is generated
there will be duplicate .c dependencies so only use the first one.

MFC after:	2 weeks
Sponsored by:	DellEMC
2019-06-15 17:08:39 +00:00
Bryan Drewery
dcf1f83876 Support reading in .depend files.
This is for an upcoming change that fixes .depend handling in here.
It will cause some duplicate sources which need to be trimmed out.

MFC after:	2 weeks
Sponsored by:	DellEMC
2019-06-15 17:08:32 +00:00
Justin Hibbits
5d031e332f Create crtsavres.o for powerpc builds
Summary:
GCC expects to link in a crtsavres.o on powerpc platforms.  On
powerpc64 this is an empty file, but on powerpc and powerpcspe this does contain
some save/restore functions, which may not actually be necessary for newer
modern GCC and clang.  This appeases the in-tree gcc, though, and is needed in
order to switch to the BSD CRTRBEGIN.

PR:	233751
Reviewed By: andrew
Differential Revision: https://reviews.freebsd.org/D18826
2019-01-12 21:29:54 +00:00
Warner Losh
ffec315183 Convert gnu to using SRCTOP
Prefer SRCTOP over CURDIR/../../contrib, etc. However, retain the "up
one level" instances of ../ because they are really relative to this
part of the tree and not a means to find the root of the tree. As
such, it's better to leave them since that further the goal of being
able to move directories if watned to in the future.

Differential Revision:	https://reviews.freebsd.org/D9932
Sponsored by:		Netflix
Silence	On:		arch@ (twice)
2017-03-12 18:59:16 +00:00
Bryan Drewery
09fb6bff29 Follow-up r297842: Rework header generation to fix always rebuilding.
This reworks the handling of common headers to just include the needed
logic rather than invoke MAKE.  This avoids the problem listed in r297842
and avoids other dependency tracking issues.

Pointyhat to:	bdrewery
Reported by:	Nikolai Lifanov <lifanov@mail.lifanov.com>
Sponsored by:	EMC / Isilon Storage Division
2016-04-18 18:13:58 +00:00
Bryan Drewery
8a5f439677 META_MODE: Avoid changed build command every build.
Because the file is generated with -f using another Makefile, 2
different Makefiles are trying to handle the .meta file for the
target.  The obvious .NOMETA_CMP or .NOMETA on the ${MAKE} targets
don't work as they are very limited in scope in bmake.  Using
.PHONY fixes the problem and ensures that the ${MAKE} command
is always ran to check if it is outdated in the sub-make.

An example of the problem in gnu/lib/libgcc (with make -dM):
  /usr/obj/root/git/freebsd/gnu/lib/libgcc/tm.h.meta: 2: a build command has changed
  TARGET_CPU_DEFAULT=""  HEADERS="options.h i386/biarch64.h i386/i386.h i386/unix.h i386/att.h dbxelf.h elfos-undef.h elfos.h freebsd-native.h freebsd-spec.h freebsd.h i386/x86-64.h i386/freebsd.h i386/freebsd64.h defaults.h"  DEFINES=""  /bin/sh /root/git/freebsd/gnu/lib/libgcc/../../../contrib/gcc/mkconfig.sh tm.h
  vs
  (cd /root/git/freebsd/gnu/lib/libgcc; make -f /root/git/freebsd/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile MFILE=/root/git/freebsd/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile GCCDIR=/root/git/freebsd/gnu/lib/libgcc/../../../contrib/gcc tm.h)
  Skipping meta for tm.h: .NOMETA
  (cd /root/git/freebsd/gnu/lib/libgcc; make -f /root/git/freebsd/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile MFILE=/root/git/freebsd/gnu/lib/libgcc/../../usr.bin/cc/cc_tools/Makefile GCCDIR=/root/git/freebsd/gnu/lib/libgcc/../../../contrib/gcc tm.h)
  `tm.h' is up to date.

Sponsored by:	EMC / Isilon Storage Division
2016-04-12 02:45:19 +00:00
Bryan Drewery
497e80911e Remove the old depend (mkdep) code and make FAST_DEPEND the one true way.
Reviewed by:	emaste, hselasky (partial), brooks (brief)
Discussed on:	arch@
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D5742
2016-03-30 23:50:23 +00:00
Bryan Drewery
bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Bryan Drewery
266a154003 Remove redundant .NOPATH.
All of these are already in CLEANFILES which is added to .NOPATH in bsd.obj.mk.

Sponsored by:	EMC / Isilon Storage Division
2015-09-26 14:15:01 +00:00
Bryan Drewery
7c6cc9de3a Fix installation of 32bit libraries after r288074.
FILES is not used when LIBRARIES_ONLY is set, which is used to build and
install the lib32 sysroot.  All of the csu files do quality as "libraries"
for this case so just undefine LIBRARIES_ONLY.

This is still better than the previous realinstall handling as it does
not hook into META_MODE properly.

Sponsored by:	EMC / Isilon Storage Division
2015-09-21 21:44:02 +00:00
Bryan Drewery
5ca34122ec Replace realinstall: and META_MODE staging hacks with FILES mechanism.
This partially reverts r270170 for lib/csu/i386 while retaining the
change for using bsd.lib.mk.

These FILES groups could go into lib/csu/Makefile.inc but I've kept them
in the Makefiles for clarity.

Sponsored by:	EMC / Isilon Storage Division
2015-09-21 18:39:13 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Simon J. Gerraty
cbf53e7311 all is MAIN target 2014-11-30 18:46:34 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Simon J. Gerraty
29c34e9d27 fixed dep 2014-11-19 00:44:21 +00:00
Andrew Turner
6d4766c1b8 Remove MK_ARM_EABI, the armeb issues have been fixed. The code to support
the oabi is still in the tree, but it is expected this will be removed
as developers work on surrounding code.

With this commit the ARM EABI is the only supported supported ABI by
FreeBSD on ARMa 32-bit processors.

X-MFC after:	never
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D876
2014-10-01 08:26:51 +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
Warner Losh
b037ca43df Make sure that the sub-makes for unwind.h start from the CURDIR
(/usr/src) tree rather than the OBJDIR (/usr/obj) tree. This fixes
broken incremental builds with the canonical MAKESYSPATH workaround
of .../share/mk. This is a gross kludge.
2014-06-24 22:15:27 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
3d4adb0524 Need to stage_files 2014-05-05 22:55:42 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +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
6b1fe0f9ac For gnu/lib/csu, only use gcc-specific flags when compiling with gcc.
MFC after:	3 days
2013-12-22 12:53:56 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +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
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Marcel Moolenaar
c7a6b0911b Build the "S" objects with the same name they get installed under.
That is, build crtbeginS.o and crtendS.o instead of crtbegin.So and
crtend.So. Remove the name substitution during install.

Obtained from:	Juniper Networks, Inc.
2012-05-17 20:38:01 +00:00
Dimitry Andric
db3212b375 Revert r234356 for now, as it leads to run-time problems on 32-bit
PowerPC.  Note this will break world.

Reported by:	andreast
Pointy hat to:	dim
2012-04-23 06:33:27 +00:00
Dimitry Andric
4f78aa4725 Work around an issue on 32-bit PowerPC, where clang executable can get
too big, causing 'relocation truncated to fit' errors at link time.

Reviewed by:	nwhitehorn
2012-04-16 21:36:55 +00:00
Warner Losh
25faff346c MFtbemd:
Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.
2010-08-23 22:24:11 +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
Konstantin Belousov
15744a9c4c Often reported issue with newer ld is:
error in /usr/lib/crtendS.o(.eh_frame); no .eh_frame_hdr table will be created.

The issue is that crtend is compiled with unwind table, and also it
places the special CIE into the .eh_frame indicating the end of section,
that is located before generated unwind table. New ld has assertion that
verifies that closing CIE is indeed the last CIE, causing the crypting
message to be issued, and refusing to generate dwarf unwind.

Add -fno-asynchronous-unwind-tables to disable unwind table generation
for crtbegin/crtend. While there, disable omitting the frame pointer [1].

Requested by:	kan [1]
Reviewed by:	kan
MFC after:	2 weeks
2010-06-18 11:09:51 +00:00
Ruslan Ermilov
d9ca85fca7 Fix build when WITH_SSP is set explicitly.
Submitted by:	Jeremie Le Hen
2009-02-21 15:04:31 +00:00
Marcel Moolenaar
5f85c2cdd9 Revert previous commit. The prototype has been moved to unistd.h 2008-09-28 19:17:54 +00:00
Marcel Moolenaar
3e5dafac90 Add -D_OSRELDATE_H to CFLAGS to prevent the declaration of
getosreldate() in assembler source files. We still get the
definition of __FreeBSD_version this way, because it's
outside the standard multiple-inclusion protection trick.

All this is specific to ia64.
2008-09-26 15:00:18 +00:00
Ruslan Ermilov
042df2e2da Enable GCC stack protection (aka Propolice) for userland:
- It is opt-out for now so as to give it maximum testing, but it may be
  turned opt-in for stable branches depending on the consensus.  You
  can turn it off with WITHOUT_SSP.
- WITHOUT_SSP was previously used to disable the build of GNU libssp.
  It is harmless to steal the knob as SSP symbols have been provided
  by libc for a long time, GNU libssp should not have been much used.
- SSP is disabled in a few corners such as system bootstrap programs
  (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves.
- It should be safe to use -fstack-protector-all to build world, however
  libc will be automatically downgraded to -fstack-protector because it
  breaks rtld otherwise.
- This option is unavailable on ia64.

Enable GCC stack protection (aka Propolice) for kernel:
- It is opt-out for now so as to give it maximum testing.
- Do not compile your kernel with -fstack-protector-all, it won't work.

Submitted by:	Jeremie Le Hen <jeremie@le-hen.org>
2008-06-25 21:33:28 +00:00
Ruslan Ermilov
c4579b502b Remove one more alpha leftover. 2008-01-24 07:43:09 +00:00
Ruslan Ermilov
281fc7f295 Back out last commit -- it breaks sparc64 build which has
more than one .c file in SRCS.
2007-10-13 05:50:43 +00:00
David E. O'Brien
1d2c824f26 Minor tweak to finding BEG/END source. 2007-10-12 18:14:41 +00:00
Alexander Kabaev
afb57df680 Update bmake glue to build GCC 4.2.
Also:
        Switch FreeBSD to use libgcc_s.so.1.

        Use dl_iterate_phdr to locate shared objects' exception frame
        info instead of depending on older register_frame_info machinery.
        This allows us to avoid depending on libgcc_s.so.1 in binaries
        that do not use exception handling directly. As an additional
        benefit it breaks circular libc <=> libgcc_s.so.1 dependency too.

        Build newly added libgomp.so.1 library, the runtime support
        bits for OpenMP.

        Build LGPLed libssp library. Our libc provides our own
        BSD-licensed SSP callbacks implementation, so this library
        is only built to benefit applications that have hadcoded
        knowledge of libssp.so and libssp_nonshared.a. When linked
        in from command line, these libraries override libc
        implementation.
2007-05-19 04:25:59 +00:00
Ruslan Ermilov
1754e424a6 Fix a problem mentioned in the previous revision in a different,
non-intrusive way.  This should also fix the PowerPC build that
broke due to this change.
2004-09-10 06:48:04 +00:00
David E. O'Brien
d7ec0e6aca Add the .h files to the .o dependency lists so the .h's are created before
trying to build the .o's.
2004-09-09 20:47:58 +00:00
Alexander Kabaev
81efba8c9e Bmake glue for GCC 3.4.2-prerelease. 2004-07-28 05:27:21 +00:00
Ruslan Ermilov
45f05f025a Just pass -DCRT_BEGIN as an option to mkdep(1), no need to override
the entire command.
2004-03-06 07:34:51 +00:00
Alexander Kabaev
0810229e75 Including dynamically generated osreldate.h wasn't such a good
idea after all.

Fix cross-builds and ia64 builds. gnu/lib/csu/Makefile is modified to
pre-include osreldate.h and gnu/usr.bin/cc/cc_tools/auto-host.h
will avoid including sys/param.h if __FreeBSD_version is already defined.
2003-07-13 02:41:48 +00:00