Commit Graph

147 Commits

Author SHA1 Message Date
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
e8ee1a1ea5 crunchide(1): Put e_shnum into a local variable.
This simplifies the code a bit.

Submitted by:	Cristoph Mallon
MFC after:	2 weeks
2013-02-03 21:16:33 +00:00
Pedro F. Giffuni
b5782a4705 crunchide(1): support non-custom elf object layout
The crunchide utility presumes the last 3 chunks of an ELF object
layout are section headers, symbol table, and then string table.
However, this is  not specified in the ELF standards, and linkers
may generate different layouts when doing partial linking (-r).

This change is required to build FreeBSD with mclinker or the
gold linker.

PR:		bin/174011
Submitted by:	Pete Chou
Reviewed by:	Cristoph Mallon
MFC after:	2 weeks
2013-02-03 20:35:37 +00:00
Pedro F. Giffuni
bf861ada38 crunch: Sync some NetBSD changes
Fix a couple of free's in previous commit.

Obtained from:	NetBSD
MFC after:	1 week
2013-02-03 01:54:25 +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
Attilio Rao
55793cdccf Disconnect non-MPSAFE PORTALFS from the build in preparation for dropping
GIANT from VFS.

This is not targeted for MFC.
2012-10-16 09:59:10 +00:00
Marcel Moolenaar
0815243c39 Add support for bmake. This includes:
1.  Don't do upgrade_checks when using bmake. As long as we have WITH_BMAKE,
    there's a bootstrap complication in ths respect. Avoid it. Make the
    necessary changes to have upgrade_checks work wth bmake anyway.
2.  Remove the use of -E. It's not needed in our build because we use ?= for
    the respective variables, which means that we'll take the environment
    value (if any) anyway.
3.  Properly declare phony targets as phony as bmake is a lot smarter (and
    thus agressive) about build avoidance.
4.  Make sure CLEANFILES is complete and use it on .NOPATH. bmake is a lot
    smarter about build avoidance and should not find files we generate in
    the source tree. We should not have files in the repository we want to
    generate, but this is an easier way to cross this hurdle.
5.  Have behavior under bmake the same as it is under make with respect to
    halting when sub-commands fail. Add "set -e" to compound commands so
    that bmake is informed when sub-commands fail.
6.  Make sure crunchgen uses the same make as the rest of the build. This
    is important when the make utility isn't called make (but bmake for
    example).
7.  While here, add support for using MAKEOBJDIR to set the object tree
    location. It's the second alternative bmake looks for when determining
    the actual object directory (= .OBJDIR).

Submitted by:	Simon Gerraty <sjg@juniper.net>
Submitted by:	John Van Horne <jvanhorne@juniper.net>
2012-10-06 20:01:05 +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
Eitan Adler
1d76342e83 Remove variables which are initialized but never used thereafter reported by gcc46 warning
Approved by:	cperciva
MFC After:	3 days
2012-06-19 06:09:58 +00:00
Juli Mallett
505a01e936 Fix crunchide on MIPS with other than the O32 ABI. 2012-03-13 05:21:14 +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
Warner Losh
9117ce0c88 It turns out that TARGET_CPUARCH doesn't buy us much here, if anything, but
costs us another copy of the transform.  Revert it.

# Maybe makefile.inc1 should set TARGET_CPUARCH for the cross-tools, but
# it doesn't now.  That would solve problems in other places too.

Submitted by:	jmallet@
2010-09-13 07:15:01 +00:00
Warner Losh
cb015705d8 Use TARGET_CPUARCH instead of TARGET_ARCH here. Define TARGET_CPUARCH
based on TARGET_ARCH.  Use TARGET_ARCH still for a powerpc64 test.
Futureproof for coming mipsel/mipseb and arm/armeb rename.
2010-09-13 00:57:48 +00:00
Adrian Chadd
2c4575477e Fix crunchide to work on sparc64 and perhaps other 64 bit platforms.
I used the wrong type when setting st_name in the symbol table entry
struct. It's an Elf64_Word which is defined as an unsigned 32 bit int
on both 32 and 64 bit platforms.

To make things sensible, define some new macros to use as "word" macros
and use those, rather than simply using the explicit 32 bit macros.
2010-08-12 14:16:57 +00:00
Adrian Chadd
7420b323a0 Port over changes to the crunch symbol hiding method from NetBSD.
The older symbol hiding method breaks for MIPS. This implements
symbol hiding through renaming to a symbol name which is highly
unlikely to clash.

The NetBSD code didn't use byte-swapping macros for endian-awareness;
so it didn't work when cross-compiling a MIPS world on i386/amd64.
This patch includes those (as best as I could figure what they
should be) and has been tested to generate valid MIPS crunch
binaries both cross- and native- compiled.
2010-08-10 09:24:19 +00:00
Nathan Whitehorn
8a10bad25e Teach crunchide(1) about PPC ELF64. 2010-07-10 22:06:51 +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
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Edward Tomasz Napierala
871130f516 Remove extra space introduced by the previous commit.
Submitted by:	rwatson
2009-12-29 20:30:50 +00:00
Edward Tomasz Napierala
ee00619105 Remove pppd and SLIP-related stuff. 2009-12-29 20:15:23 +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
David E. O'Brien
22407452f5 Introduce crunchide to the ELF e_machine MIPS values. 2008-09-03 16:21:28 +00:00
Kevin Lo
784bddbc5b Cleanup of userland __P use 2007-11-07 10:53:41 +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
Kevin Lo
d069140339 Use sizeof() for calculating the buffer size instead of hard-coded values. 2007-03-06 09:32:41 +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
Craig Rodrigues
c327d865f6 Remove reference to mount_fdescfs.
Reminded by:	ru
2006-11-22 00:34:17 +00:00
Ruslan Ermilov
bc84aa4ba3 Markup fixes. 2006-09-29 17:57:04 +00:00
Bruce M Simpson
2d20d32344 Push removal of mrouted down to the rest of the tree. 2006-09-29 15:45:11 +00:00
Ruslan Ermilov
2b46c64c9c Remove alpha left-overs. 2006-08-22 08:03:01 +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
Marcel Moolenaar
757686b115 Make our ELF64 type definitions match standards. In particular this
means:
o  Remove Elf64_Quarter,
o  Redefine Elf64_Half to be 16-bit,
o  Redefine Elf64_Word to be 32-bit,
o  Add Elf64_Xword and Elf64_Sxword for 64-bit entities,
o  Use Elf_Size in MI code to abstract the difference between
   Elf32_Word and Elf64_Word.
o  Add Elf_Ssize as the signed counterpart of Elf_Size.

MFC after: 2 weeks
2005-12-18 04:52: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
Ruslan Ermilov
e653b48c80 Start the dreaded NOFOO -> NO_FOO conversion.
OK'ed by:	core
2004-12-21 08:47:35 +00:00
Ruslan Ermilov
a35d88931c For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +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
07bfccd71e Mechanically kill hard sentence breaks. 2004-07-02 23:13:00 +00:00
David E. O'Brien
49a3940873 Adjust the system endian and a.out headers to be more MI and cross-building
friendly.  Use the systems headers rather than local versions.

Reviewed by:	ru
2004-06-22 17:05:39 +00:00
Olivier Houchard
ed575be468 Tell crunchide to deal with arm elf binaries as well.
Rescue can now be built for arm.
2004-06-06 16:01:36 +00:00
Stefan Farfeleder
40905e9049 Include <netinet/in.h> for ntoh*() and hton*() prototypes.
Approved by:	das (mentor)
2004-05-24 11:59:17 +00:00
Ruslan Ermilov
adcb86e214 Fix a bug that caused i386 to produce broken binaries for big-endian
64-bit platforms.  (size_t is 32bit on i386, but Elf_Shdr.sh_size is
64bit on SPARC64.)
2003-08-08 15:44:17 +00:00
David E. O'Brien
930d8c703a Teach crunchide(1) about PowerPC ELF.
PR:		54526
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
2003-07-22 00:19:40 +00:00
Peter Wemm
8e81109e14 Add AMD64 support. 2003-06-03 01:37:32 +00:00