Commit Graph

104 Commits

Author SHA1 Message Date
Bryan Drewery
5017231ad7 META_MODE/DIRDEPS_BUILD: Fix various issues with crunch builds.
- DIRDEPS_BUILD: Fix crunchgen builds losing their library dependencies
  on a nop-rebuild.
- META_MODE: Fix not rebuilding various crunch.mk targets if their .meta
  files warrant a rebuild.  They were lacking .meta files previously.
  This adds .NOMETA to the crunch objects being used since they are
  already built.  Bmake was forcing a rebuild on them since their
  .meta files were not in the expected place; there is no reason to
  rebuild them.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-09-01 23:21:08 +00:00
Bryan Drewery
eb9b07bb77 WITH_AUTO_OBJ: Fix crunchgen builds.
Passing MAKEOBJDIRPREFIX to the main prog build (rescue) would confuse
WITH_AUTO_OBJ and cause it to create a recursed object directory that
then broke the actual prog build.  This is normally not a problem since
we do not call 'make -f prog.mk obj' before building anything in it.

Crunchgen(1) also assumes that if -o is not passed then if an object
directory does not already exist then it should build in the source
directories.  The normal buildworld process will have already ran 'make
obj' in each of the component directories so this is not a problem.
With WITH_AUTO_OBJ though this is not the case.  So we must tell
crunchgen(1) that MK_AUTO_OBJ=yes will create the directory and to not
require it be present before generating its Makefile.

Sponsored by:	EMC / Isilon Storage Division
2016-05-26 23:20:36 +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
b99a71b1da Fix rescue build after r284356 with STRIP= by using proper STRIPBIN per build(7).
This was causing the following error:

  rescue
  sh: rescue: not found
  *** [rescue] Error code 127

  make[1]: stopped in /usr/obj/usr/src/rescue/rescue

Sponsored by:	EMC / Isilon Storage Division
2015-07-28 21:39:58 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Tijl Coosemans
19e58304b3 Change -Wl,-r back to -r so gcc doesn't pass --relax to the linker on some
architectures.

PR:		200881
2015-06-15 19:48:28 +00:00
Tijl Coosemans
7a51826c2a Tell the compiler that -dc and -r are linker flags.
Reviewed by:	adrian
2015-06-14 15:40:17 +00:00
Adrian Chadd
8d769a021c Fix typo - this upsets llvm/gcc-4.9, but not gcc-4.2 for some reason. 2015-06-14 00:31:22 +00:00
Adrian Chadd
c1e0b4d15b Fix up crunchgen binary generation to work with external cross-build
tools.

* Allow STRIP to be overridden by the environment
* Use CC to tie things together, not LD

Tested:

* i386, mips32

Submitted by:	kan
2015-06-13 22:01:21 +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
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Bryan Drewery
5608fd23c2 Revert r267233 for now. PIE support needs to be reworked.
1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other
   build-only utility libraries.
2. Another 40% is fixed by generating _pic.a variants of various libraries.
3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR)
   where it never would work anyhow, such as csu or loader. This suggests
   there may be better ways of adding support to the tree. Many of these
   cases can be fixed such that -fPIE will work but there is really no
   reason to have it in those cases.
4. Some of the uses are working around hacks done to some Makefiles that are
   really building libraries but have been using bsd.prog.mk because the code
   is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have
   been needed.

We likely do want to enable PIE by default (opt-out) for non-tree consumers
(such as ports). For in-tree though we probably want to only enable PIE
(opt-in) for common attack targets such as remote service daemons and setuid
utilities. This is also a great performance compromise since ASLR is expected
to reduce performance. As such it does not make sense to enable it in all
utilities such as ls(1) that have little benefit to having it enabled.

Reported by:	kib
2014-08-19 15:04:32 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Bryan Drewery
864c53ead8 In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.
This is currently an opt-in build flag. Once ASLR support is ready and stable
it should changed to opt-out and be enabled by default along with ASLR.

Each application Makefile uses opt-out to ensure that ASLR will be enabled by
default in new directories when the system is compiled with PIE/ASLR. [2]

Mark known build failures as NO_PIE for now.

The only known runtime failure was rtld.

[1] http://www.bsdcan.org/2014/schedule/events/452.en.html
Submitted by:		Shawn Webb <lattera@gmail.com>
Discussed between:	des@ and Shawn Webb [2]
2014-06-08 17:29:31 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +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
Pedro F. Giffuni
2ebed5db20 crunchgen: Permit use of alternative linkers.
Submitted by:	Pete Chou
MFC after:	1 week
2013-02-05 02:57:59 +00:00
Pedro F. Giffuni
997d42d7a7 crunch: Sync some NetBSD changes
Revert a comment that was not supposed to go away.

Obtained from:	NetBSD
2013-02-02 22:39:21 +00:00
Pedro F. Giffuni
96acb2c4fa crunch: Sync some NetBSD changes.
crunchide:
Apr 11, 2009: fix some -Wsign-compare issues.
Sep 20, 1999: Free the right thing.

crunchgen:
Apr 14, 2009: Fix some WARNS=4 issues (-Wshadow -Wcast-qual)
Oct 30, 2004: Add (unsigned char) cast to ctype functions
Feb 5, 2001: fix nested extern.

examples:
Aug 30, 2007: NetBSD 36867 - trsp references are deprecated

Obtained from:	NetBSD
MFC after:	1 week
2013-02-02 21:51:14 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +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
David E. O'Brien
02c751922e Some amount of style(9)
-- function definitions, header ordering, and $FreeBSD$.
2012-06-27 04:39:30 +00:00
David E. O'Brien
70840a510a Ensure crunchen uses the same make binary as the rest of the build.
Submitted by:	Simon Gerraty <sjg@juniper.net>
2012-06-25 21:56:36 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Ulrich Spörlein
0afc94c17a mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the
bottom of the manpages and order them consistently.

GNU groff doesn't care about the ordering, and doesn't even mention
CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put
them.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:07:55 +00:00
David E. O'Brien
b08897254c Run with -B and just .POSIX. 2009-01-31 07:03:36 +00:00
David E. O'Brien
7328f91370 Set .POSIX mode, along with disable parallel mode. Crunchgen parses the
output from make(1) and its picky what it should look like.
Also use make's conditional assignment operator rather than test and set.
2009-01-13 06:52:51 +00:00
Yaroslav Tykhiy
5e8bbdf131 Include <stdlib.h> for the right prototype for exit(3). 2007-10-27 16:16:02 +00:00
Yaroslav Tykhiy
a7aebe893d Set the program name if the crunched program is selected through
argv[1] to mimic crt0 behaviour.  Do the job by a direct assignment
to __progname in order to stay compatible with NetBSD, whose
setprogname() is a deliberate no-op.

The reason for this change is that some programs (usually those
imported from NetBSD) use getprogname() to distinguish between their
aliases.  (See pkill aka pgrep for example.)

This change can be useful, and applicable, to NetBSD, too.
2007-10-27 16:13:31 +00:00
John Birrell
51d9ddc635 Back out half of my previous change to support parallel makes.
The generated Makefile clashes with the src/bin/sh/Makefile, causing
it to try to use a rule to build something it doesn't need to.
2006-11-27 01:35:11 +00:00
John Birrell
80f498e559 Fix another parallel make problem with the generated make file.
Define the xxx_OBJPATHS earlier and then use it in the xxx_make
target because each obj is actually made through that.

This allows the crunch to work with -j32 on sun4v.

The makefile generated is still poor, though. It really shouldn't use
the general 'make all' to do the submakes in the app directories being
crunched because each of those objects is listed as a dependency in
the generated crunch makefile. Doing that really requires a unique rule
to generate them.
2006-11-24 03:56:25 +00:00
John Birrell
e8a1d46e97 Add the SUBMAKE_TARGETS (like ppp_make) to the dependency list
for linking the crunched app so that when a parallel make is run
(like -j32 on sun4v), the link waits for the sub-make processes
to complete.
2006-11-22 07:52:14 +00:00
Ruslan Ermilov
bc84aa4ba3 Markup fixes. 2006-09-29 17:57:04 +00:00
Ceri Davies
8211eded3e Bump .Dd before I get told off. 2005-12-23 15:33:31 +00:00
Ceri Davies
55f92f6465 Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
 for geom, libraries like -lmd, -lcrypto).

The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically.  This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments.  Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.

Approved by:		murray (mentor, in spirit), jhb
In collaboration with:	Adrian Steinmann <ast at marabu dot ch>
MFC After:		6 weeks
2005-12-23 15:31:37 +00:00
Ruslan Ermilov
951e4d1c91 In crunchgen(1), when calling make(1), don't redirect stderr to stdout,
just rely on the exit status to detect an error.  This makes crunchgen(1)
safe to use with certain make(1) debugging flags.

MFC after:	1 week
2005-01-20 10:49:03 +00:00
Hartmut Brandt
a8595b6640 Fix a 4.X -> 5.X upgrade problem: crunchgen used to emit a line 'MAKE=make'
or 'env MAKEOBJDIRPREFIX=... make' depending on the setting of
MAKEOBJDIRPREFIX in the environment. In any case this line kills the
original value of ${MAKE}. When during buildworld a new make is built (as
is the case during the upgrade) this causes a wrong make to be picked up
(the first one in the path). Use the same technique as Makefile.inc1:
create a MAKEENV variable and a CRUNCHMAKE that calls ${MAKE} with that
MAKEENV prefixed. Use CRUNCHMAKE instead of MAKE throughout the generated
makefile. This leaves the original ${MAKE} undisturbed.
2004-08-09 19:18:19 +00:00
Ruslan Ermilov
2343a53401 The second chdir(1) that I trimmed is needed too
if the program has an object directory.

Explained by:	Tim Kientzle <kientzle@acm.org>
2003-04-23 04:28:35 +00:00
Ruslan Ermilov
7cc7315cfb chdir(1) into a source directory before attempting to determine the
OBJS list.  This is needed to crunch any program that relies on the
correct .CURDIR setting, e.g. src/bin/csh.

Submitted by:	Tim Kientzle <kientzle@acm.org>
2003-04-22 14:01:33 +00:00
Gregory Neil Shapiro
b0c70f811b Apply the envp fix to the other call to main() as well.
Submitted by:	Peter Edwards <pmedwards@eircom.net>
2002-08-09 02:39:38 +00:00
Gregory Neil Shapiro
8f3548b29f Pass envp to crunched program's main() routines as some depend on it.
Note that crunchgen's stub .c programs already have the code to use it:

	    "int _crunched_%s_stub(int argc, char **argv, char **envp)"
	    "{return main(argc,argv,envp);}\" >%s_stub.c\n",

Add $FreeBSD$ to allow the commit.

Reviewed by:	luigi
MFC after:	3 days
2002-08-04 22:14:44 +00:00
Ruslan Ermilov
3d8d000653 mdoc(7) police: markup nit. 2002-05-30 07:51:22 +00:00
Philippe Charnier
7f94b8deee Use `The .Nm utility' 2002-04-20 12:27:18 +00:00
Luigi Rizzo
252f13ab51 Add a "special progname lib xxx ..." command to crunchgen
so the .lo files can be partially linked against libraries
which redefine symbols in the standard libs, or which reference
symbols in the objects.

Submitted by: Sam Leffler
MFC After: 3 days
2002-03-30 16:48:30 +00:00
Josef Karthauser
1554755e12 Make source crunches work as well as object crunches; broken in the
last commit that fixed object crunches.

Repeat after me, "no excuses for not testing".
2001-08-17 11:11:10 +00:00