Commit Graph

138 Commits

Author SHA1 Message Date
rin 4a92937c6f crunchgen(1): Clear PaX flags instead of removing its ELF note section.
The latter results in zero-filled hole in ELF note segment for EARM,
where PaX section is not located the bottom of that segment (see
src/lib/csu/sysident.S). Fortunately, this hole does not cause real
harms for our in-kernel ELF note parser, except for noisy warnings on
DIAGNOSTIC kernels.

Bump CRUNCH_VERSION.

PR toolchain/52675
2023-06-23 02:13:03 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
andvar c651c20bd5 fix syntax error and typo in overwritten. 2021-08-01 15:52:11 +00:00
wiz ac8e57cbc4 New sentence, new line. Fix typo. 2020-01-02 23:21:14 +00:00
christos e33cbeae47 Provide a migration guide from the old flags to -V. 2020-01-02 19:02:41 +00:00
christos 128e5f5e67 1. Remove all the special handling of variables (-d -p -P -s -S) that
were dealing with DBG (-d) LDSTATIC/NOPIE (-p), and the rest with
   disabling/enabling sanitizers.
2. Use emalloc/estrdup for all the allocators instead of only some cases.
3. Add -V varspec which passes variables on the command line (as DBG
   and LDSTATIC used to be passed before) instead of appending them
   to the on-the-fly Makefile using -v varspec.
4. Change the distrib and rescue Makefiles to use -V instead of the removed
   flags.

The motivation of this is to make variable handling consistent, less magical,
and remove the need for changing crunchgen each time we want to add disabling
an option by default.

(as proposed in tech-toolchain)
2019-12-29 18:26:16 +00:00
christos 19a77b177c Also disable ssp and fortify by default. 2019-12-18 02:16:04 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
mrg d40c522149 remove the hack to remove .eh_frame -- gcc7 is fixed it seems. 2019-02-14 12:22:06 +00:00
mrg 26711b697b while we're still figuring out the gcc7 vs .eh_frame issue, apply
the don't remove eh_frame hack to mips as well.  hpcmips testbed
is also failing currently:

[   3.1238738] panic: init died (signal 6, exit 12)
2019-02-13 20:48:56 +00:00
mrg 91af807154 hack alert time:
on sparc and sparc64, don't remove .eh_frame section.  it leads
to failure as something is referenced, and objcopy ends up
emitting a broken binary that can't be run -- it attempts to
load at va=0, beyond having missing referenced data.

also, on sparc64 also don't remove .note.netbsd.mcmodel.


the former should be revised when we can avoid it.
2019-02-12 10:16:58 +00:00
wiz 8c602bad3c Sync usage with man page. 2018-07-26 08:57:32 +00:00
wiz 4426bfba8a Add -S to SYNOPSIS. Sort option descriptions. 2018-07-26 08:57:26 +00:00
kamil 783e210b8b Introduce a new option -S in crunchgen(1)
The -S argument enables sanitization with a sanitizer in libc.
2018-07-25 23:41:28 +00:00
kamil b6ed70bb6e Add new option -s to crunchgen(1) -- enable sanitization
As of today typical sanitizers require dynamic executables, while
crunchgen(1) programs are produced with static properties.

Lack of specified -s will:
 - generate a Makefile file with NOSANITIZER=
 - build programs that are dependencies with NOSANITIZER=

In future there is an option to handle sanitization in statically linked
programs.

An idea with -s LGTM by <christos>
2018-06-21 10:55:54 +00:00
mrg 1f3c181244 in dir_search(), don't assume a directory existing is useful, instead
confirm that there is a non zero makefile in there.  (this assumes
the makefile is called "Makefile", which is assumed in other places
in crunchgen.c already, so this doesn't make it worse.)

this fixes build issues when an empty subdir exists because some files
were moved subdir at some stage (ktrace, rcorder), and a non-prune
update may look in the wrong dir.

bump version (lots of updates between now and the previous update.)
2018-05-08 23:05:17 +00:00
wiz ec85326579 New sentence, new line. Remove superfluous Pps. 2017-10-09 10:31:50 +00:00
christos ed570cec90 Handle static PIE 2017-10-08 15:06:17 +00:00
christos c2dcc0c09c Don't make crunch binaries PIE 2016-05-29 16:12:58 +00:00
matt cac6d59cc3 Use :Q instead of " to quote make vars DBG and LDSTATIC 2015-05-16 02:33:12 +00:00
riastradh 6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
martin 65dddd35c0 Remove .note.netbsd.mcmodel and .note.netbsd.pax from the chrunched binaries.
We don't know wether the former would make sense (as currently used, it never
makes sense for static binaries) and we can not conclude safe PAX flags from
combined binaries.
2014-01-04 08:58:51 +00:00
wiz a5684d07dd Use Mt for email addresses. 2013-07-20 21:39:55 +00:00
joerg f43bb6a704 Document section stripping. 2013-06-10 19:40:53 +00:00
joerg 4619e36982 Strip .eh_frame and .eh_frame_hdr from crunched binaries. 2013-06-10 18:27:30 +00:00
wiz 1ac719d147 Remove unnecessary Bk/Ek pairs from SYNOPSIS.
No effective change except where I used the opportunity to sort options
and/or option descriptions.
2012-04-08 22:00:37 +00:00
joerg 1009d03daf static + __dead 2011-08-30 23:10:45 +00:00
christos 7aac162c51 Make this produce proper ansi c and knf. 2011-05-15 21:28:51 +00:00
christos d61830c284 pass LDSTATIC to recursive makes. 2010-04-24 17:58:40 +00:00
christos cf1f9ba391 move LDSTATIC before the includes because the rules need it early for
conditionals.
2010-04-21 14:58:10 +00:00
kiyohara 5a06e069fd Fix a bug.
always mkdir for 'objs' and 'objdir' when NEW_TOOLCHAIN.
2010-01-09 06:37:57 +00:00
lukem 9a472d38d4 Fix WARNS=4 issues (-Wshadow -Wcast-qual) 2009-04-14 22:03:07 +00:00
joerg 8deda0e429 Use paragraph breaks before notes, not just line breaks. 2009-03-12 12:36:48 +00:00
apb cd5c0f944d In shell scripts invoked during a build, and in crunchgen, use ${AWK}
instead of plain "awk".  The Makefiles that invoke these scripts
or programs will pass AWK=${HOST_AWK:Q}.
2008-10-19 22:10:04 +00:00
wiz a45316f7a5 Bump date for previous. 2006-10-26 10:49:35 +00:00
freza 57dc9ea382 Treat multiple
SPECIAL prog {objs,objpaths,keepsymbols} itemX

lines (where "prog" is fixed) in crunchgen configuration the same as

  SPECIAL prog {objs,objpaths,keepsymbols} item1 ... itemN

OK by David Laight
2006-10-18 21:20:44 +00:00
christos 4623faa261 We only need libutil in native mode. 2006-08-29 12:50:49 +00:00
christos cdab3a7a06 More programs using efun. 2006-08-26 18:17:41 +00:00
christos afe552b7f1 detect overflow and exit with an error. 2006-06-13 17:18:56 +00:00
christos e1168b9564 PR/33698: Kevin Massey: use strlcpy/strlcat to avoid stack overwrites. 2006-06-11 16:11:53 +00:00
simonb 2f8c495ce2 Fix problems with program names with a "-" in them, where crunchgen was
outputting the original program name for the stub name instead of the
mangled name.

From Mikolaj Golub on tech-embed.
2006-06-02 10:11:56 +00:00
mrg 2ed99b6c90 need <stdlib.h> for exit(3). 2006-05-10 21:34:20 +00:00
tsutsui a46df0d20b Don't use data in freed stack. 2006-01-13 16:36:25 +00:00
jmc 1bd5227b67 Make dependency checking for the pull-over make's actually work.
The make depend needs to be it's own separate make so it's done before the
main make runs. This also fixes issues w. -j breaking on 'depend <target'.

In addition, force the sub cross-over make to always run or otherwise it'll
never check dependencies once a valid foo.cro has been created.

Bump to 20050208
2005-02-10 16:03:04 +00:00
christos 36eef77064 Revert part of previous [remove cd to objdir] and bump the crunchdate.
Make has been fixed. The cd was in the wrong place anyway, it should
immediately follow ${MAKE}, so it did not work as expected.
2005-01-31 23:48:38 +00:00
lukem ebb5895a82 Explicitly cd to the .OBJDIR in the ${PROG}.strip target.
This fixes the "make -j N dependall" build issues people were
seeing in src/rescue, that appears to have been introduced
in rev 1.62.

Use the MAKEVERBOSE macros (if present) to print the pretty message.

Set the CRUNCH_VERSION to 20050130.
2005-01-30 23:04:33 +00:00
dsl 43371ff1ac Add (unsigned char) cast to ctype functions 2004-10-30 17:17:35 +00:00
wiz ab90f76ed3 Sync usage with man page (sort, add -O). 2004-09-25 21:48:15 +00:00
wiz 7a57b6bd09 Sort options in SYNOPSIS and in description; use more mdoc macros. 2004-09-25 21:47:53 +00:00
dsl 6e443a613f Change the way crunchgen works when doing 'reachover' builds.
Instead of trying to identify all the .o files that make each target rely
on the targets own Makefile having a program.ro target that will compile
all the objects and link them into a single relocatable.
Rename each program's 'main' to '_crunched_<prog>_stub' instead of compiling
a small piece of C.
The old behaviour can be forced by specifying -O, and is also done if the
config file specifies 'objs' or 'objpaths'.
As well as simplifying the logic, this means you only get a single 'prog.ro
is up to date' message for each program during the build.
2004-09-25 20:43:47 +00:00