Commit Graph

180 Commits

Author SHA1 Message Date
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
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Ed Maste
9e29d20823 crunchide: remove EOL whitespace 2015-05-12 20:04:17 +00:00
Ed Maste
66137b66a4 crunchide: Restore local EM_AARCH64 constant for bootstrapping
Most of the EM_* constants are available in all supported host branches,
but EM_AARCH64 was added relatively recently. Add it back to fix
building HEAD on 10.x.

Noticed by:	adrian, jmallett
2015-04-30 23:48:05 +00:00
Ed Maste
e52f97153a crunchide: add basic string table sanity checks
Reported by:	Coverity Scan
CID:		978805, 980919
Sponsored by:	The FreeBSD Foundation
2015-04-28 13:04:51 +00:00
Ed Maste
a8da2875c6 crunchide: Remove local EM_* ELF definitions provided by system ELF headers
Suggested by:	imp (in review D2314)
2015-04-20 18:30:06 +00:00
Ed Maste
070cadfcc4 crunchide: always include both 32- and 64-bit ELF support
This avoids the need to build a target-specific crunchide for cross-
uilds.

Differential Revision:	https://reviews.freebsd.org/D2314
Sponsored by:	The FreeBSD Foundation
2015-04-18 00:30:36 +00:00
Ed Maste
26934ea0d7 crunchide: remove unused a.out and non-functional ECOFF support
Differential Revision:	https://reviews.freebsd.org/D2311
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2015-04-17 15:18:54 +00:00
Ed Maste
cbfe0ae64b crunchide: arm64 support
Submitted by:	andrew@
Sponsored by:	The FreeBSD Foundation
2015-03-27 19:34:24 +00:00
Ed Maste
b15dc00338 crunchide: Correct 64-bit section header offset
For 64-bit binaries the Elf_Ehdr e_shoff is at offset 40, not 44.
Instead of using an incorrect hardcoded offset, let the compiler
figure it out for us with offsetof().

Differential Revision:	https://reviews.freebsd.org/D1543
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2015-01-16 18:59:15 +00:00
Andrew Turner
5667872e2f Add support to crunchide for handling AArch64 (arm64) ELF files.
Sponsored by:	The FreeBSD Foundation
2015-01-06 20:10:42 +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
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
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
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Warner Losh
3bdf775801 NO_MAN= has been deprecated in favor of MAN= for some time, go ahead
and finish the job. ncurses is now the only Makefile in the tree that
uses it since it wasn't a simple mechanical change, and will be
addressed in a future commit.
2014-04-13 05:21:56 +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
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
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +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
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
c676b1f6e4 MFC: r237574: crunchen uses the same make binary as the rest of the build 2012-06-25 22:07:09 +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