History log of /openbsd-current/sys/arch/landisk/conf/Makefile.landisk
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.83 28-Jan-2024 deraadt

set -fno-stack-protector in NORMAL_C_NOP, which is used to compile
mcount.c, in the same way that -fno-ret-protector is set (because
the default ret-protector is an "always" generator). This change
ensures there is never a stack protector prologue/epilogue in the
functions in that file, no matter what stack protector selection
algorithm is in play.
ok kettenis guenther


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.82 28-Jan-2021 deraadt

Again allow COPTS= to come from the environment again, and don't lose the
SMALL_KERNEL specific variations.
ok espie jsg


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.81 07-Nov-2019 guenther

The compiler -pg option implies -fno-ret-protector, as we want to disable
retguard and similar when profiling. However, that missed all the .S files,
as ${PROF} wasn't added when ${NORMAL_S} was converted from direct invocation
of ${AS} to instead use ${CC}. Similarly, mcount.o still had retguards
as it cannot be built with -pg. So: pass ${PROF} when compiling .S files,
and compile "no profiling" files with -fno-ret-protector on archs with
retguard.

feedback and ok mpi@ mortimer@


Revision tags: OPENBSD_6_6_BASE
# 1.80 21-Jun-2019 deraadt

Further improve the filesystem stability of kernel installation by KARL.
Use install -F to instead of cp, for fsync(2). Coupled with the new
sync(8) in the reorder_kernel script, the window for a incomplete /bsd
file on-disk due to a crash has now shrunk substantially.
Discussion with kettenis, millert and tedu


# 1.79 25-Apr-2019 deraadt

disable -Oz compile for SMALL_KERNEL w/ comment why


# 1.78 14-Apr-2019 deraadt

Instead of using COPTS=-Oz (and similar) in make environment to force
tightly-built ramdisk kernels, set the option in per-arch Makefile.inc
based upon SMALL_KERNEL


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.77 09-Feb-2018 tb

Check for the existence of /bsd before trying to back it up to /obsd.
Fixes 'make install' when /bsd is not present for some reason.

ok rob florian, "fine with me" deraadt


# 1.76 04-Nov-2017 florian

Since rev 1.502 of rc(8) it creates a /bsd.booted hard link. At the
end of rc we call reorder_kernel which creates a /obsd hard link to
the same kernel.
In the past obsd was only created when doing a manual make install in
the kernel sources.
There is no need for two backup hard links during boot, rearange the
kernel Makefiles to restore previous behaviour and thus stopping
reorder_kernel from scribbling over /obsd.

Makes muscle memory of some kernel developers work again: /obsd can
serve as a known good kernel; and there was much rejoycing...

Discussed at length with benno, rpe, phessler and tb at
p2k17.

Seems like a good idea to deraadt.

OK benno, phessler, rpe, tb


Revision tags: OPENBSD_6_2_BASE
# 1.75 28-Sep-2017 patrick

When option DDB_STRUCTINFO was removed from the kernel, too much from
the kernel makefiles was removed which lead to C files not being re-
compiled when a dependency changed. This can lead to panics in odd
places and generally a broken system.

ok deraadt@


# 1.74 12-Sep-2017 mpi

Remove option DDB_STRUCTINFO. Now that ddb(4) is CTF aware, similar
functionnalities are available in GENERIC.

ok jasper@, deraadt@, guenther@, dlg@


# 1.73 12-Aug-2017 mpi

Use ctfstrip(1) by default to strip kernels.

ok deraadt@, jasper@


# 1.72 18-Jul-2017 tb

Stop automatically regenerating gap.o (and hence linking a new kernel)
whenever make is issued. Only do this when there are actual source changes
below /sys. This restores the behavior prior to the KARL implementation.

Problem noticed and patiently explained by mpi
implementation with a lot of help from espie

ok mpi, espie, deraadt


# 1.71 16-Jul-2017 visa

Pass the linker from make environment to makegap.sh. This is (only)
a partial solution to cross compiling the kernel with KARL.

OK deraadt@ a while ago


# 1.70 29-Jun-2017 espie

put SYSTEM_SWAP_DEP out of its misery, it died in 1997, along with config.old
"go for it" deraadt@


# 1.69 25-Jun-2017 deraadt

dull dependency for copying makegap.sh to obj, so that installs
without src and comp work. That is what we've designed for, but since
we always have src and comp on our systems it is so easy to slide...
problem first noted by rpe.


# 1.68 22-Jun-2017 deraadt

Generate a gap.link script, and use that to generate gap.o. On multi-ABI
architectures we must also link against a gapdummy.o to repair the ABI
of the resulting .o file. Woe is me.
Also repair install: target to update the linkkit & hash when a kernel
is installed.
ok rpe tb mlarkin and tested by others also


# 1.67 13-Jun-2017 deraadt

newbsd: target which re-links a kernel. We cannot use the bsd: target
since it has source dependencies, and relinking doesn't have any. Also
the bsd: target is created by config(8)...
worked on with rpe.


# 1.66 13-Jun-2017 deraadt

needs a fake ld.script for KARL tooling


# 1.65 11-Jun-2017 deraadt

make vers.o not depend on gap.o using a trick, because it is piece of
fiction participating only in the linkphase.
tricks from rpe and espie


# 1.64 11-Jun-2017 bluhm

Use umask 077 instead of cp -p when installing the kernel as root.
Otherwise owner of /bsd could be the build user with permissions
inherited from the compile directory.
OK deraadt@ tb@


# 1.63 08-Jun-2017 deraadt

Split early startup code out of locore.S into locore0.S. Adjust link
run so that this locore0.o is always at the start of the executable.
But randomize the link order of all other .o files in the kernel, so
that their exec/rodata/data/bss segments land all over the place.

I haven't worked on the unmap/smashing of the startup code yet.


# 1.62 03-Jun-2017 deraadt

Create gap.S and gap.o with umask 077. Create lorder and bsd* with umask 007.
Prying eyes cannot look at the kernels in the compile directory.
ok tb rpe, kernel developers seem unimpacted


Revision tags: OPENBSD_6_1_BASE
# 1.61 29-Nov-2016 mpi

Build kernel with DEBUG=-g by default.

This will allow us to extract type informations from DWARF2 sections. It
also makes developer life easier as debug information are now included in
every object.

Resulting kernels will be stripped using strip(1) instead of ld(1).

Kernel build time increases by approximately 10%. However it is still
possible to disable this by defining DEBUG="".

ok kettenis@, bluhm@, natano@, jasper@, reyk@, deraadt@


# 1.60 15-Nov-2016 natano

Clean up the kernel Makefile's:

- Remove the 'lint' target. lint has been removed with OpenBSD 5.2.
- Remove the 'tags' target. It does nothing of value.
- Replace 'clean::' with 'clean:', as requested by espie and millert,
and remove files from the 'clean' target, that are never generated.
- Don't create a file called 'depend' in 'make depend', but just do
nothing instead.

ok mpi tb


# 1.59 27-Oct-2016 natano

We don't generate an eddep script for kernel builds nowadays. The last
reference to eddep in the kernel Makefile I could find is in 4.3BSD,
released some 30 years ago.

ok tb millert


# 1.58 24-Oct-2016 deraadt

make cleandir should skip the version file; ok otto millert


# 1.57 15-Oct-2016 deraadt

cleandir: target for kernel compile directories
ok natano


# 1.56 14-Oct-2016 deraadt

Kernel builds now happen in compile/CONFIG/obj@ -> /usr/obj/... [or ./obj/,
if srctree is not rooted at /usr/src]. As a result, stock GENERIC & RAMDISK
kernels are commited to the tree, to ensure the src tree can be "readonly"
during builds, with all writes occuring inside the obj space. config -b
options are handled by ../Makefile.inc. The canonical new way to configure
one of these kernels is:
% cd /sys/arch/amd64/compile/GENERIC.MP
% doas make obj
% make config
% make
% doas cp obj/bsd /bsd
The build infrastructure will use this new mechanism in a de-escalation
way using BUILDUSER.
Much help from natano and tb.


# 1.55 24-Sep-2016 kettenis

Add -Wno-pointer-sign to all our gcc4 architectures.

ok patrick@ (for armv7), deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.54 29-Apr-2016 mpi

Do not remove local symbols from the table.

ddb(4) can now see static functions. That doesn't mean we should start
declaring functions as ``static'', however it helps for the few existing
exceptions.

ok deraadt@, kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.53 13-Jan-2015 deraadt

for the install: target, use cmp as a rough attempt for avoiding repeated
make install
from Simon Nicolussi
ok jsing tedu


# 1.52 11-Jan-2015 tedu

switch prototype warnings to implicit-declaration warnings.
This should catch all the same bad cases, but be a little less aggravating
in circumstances where a prototype isn't necessary
ok deraadt


# 1.51 04-Oct-2014 brad

Switch the kernel configs over to using -Wframe-larger-than= instead of
-Wstack-larger-than-. This is what modern GCC supports as well as LLVM.

ok miod@


Revision tags: OPENBSD_5_6_BASE
# 1.50 08-May-2014 miod

Format string fixes and removal of -Wno-format for landisk kernels


Revision tags: OPENBSD_5_5_BASE
# 1.49 15-Oct-2013 guenther

Rewrite the awk script that generates the data for option DDB_STRUCT:
- switch to perl for better data structures and (thus) speed
- fix a couple glitches in the interpretation of the stabs output
- compress the strings by putting them in one big array and overlaying
suffixes
- all sizes and offsets are <64k, so use u_short for them
This results in ~60% reduction in the resulting text size and it now
takes less than a second to create on fast platforms.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.48 23-Jun-2013 miod

Stop using -traditional-cpp on gcc3/4 platforms.

Add CWARNFLAGS to the command line when using -xassembler-with-cpp. We are
mostly interested in -Werror here.


# 1.47 30-Mar-2013 tedu

reorder include search directories. cuts lookups by quite a bit.
ok deraadt miod


Revision tags: OPENBSD_5_3_BASE
# 1.46 28-Aug-2012 pascal

Add -nopie to LINKFLAGS on ELF architectures. Note that this needs an
updated gcc and ld to understand the new -nopie flag.

ok deraadt@


# 1.45 22-Aug-2012 pascal

Build the kernel with -fno-pie. Just getting Ms out of my tree; this will be
cleaned up later.

ok deraadt@


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.44 08-Nov-2011 matthieu

Garbage collect now unused MKDEP definitions. ok deraadt@


Revision tags: OPENBSD_5_0_BASE
# 1.43 07-Jul-2011 guenther

The drahn memorial bad kernel build fix: prevent blood pressure
spikes in other developers by making it so that removal of a .d
file without removing the corresponding object will result in the
latter being treated as out of date.

ok beck@ art@ drahn@


# 1.42 06-Jul-2011 tedu

make clean should clean .d files, so as to leave a fresh canvas.
ok beck deraadt


# 1.41 15-Apr-2011 guenther

Convert the kernel Makefiles to autogenerate dependencies during compilation
using the -MD option to cc, with -MP, -MT, and -MF where needed, converting
"make depend" to a no-op. This increases parallelism for those using "make -j"
and keeps the dependencies up to date with each compilation automatically.

sparc and vax users will need to rebuild gcc with support for the
-M[PTF] options before config'ing with this diff.


Revision tags: OPENBSD_4_9_BASE
# 1.40 30-Dec-2010 deraadt

If genassym fails, sort on the pipeline will indicate no error resulting
in some grief. Split this out.
From Vladimir Kirillov


# 1.39 02-Dec-2010 deraadt

After the most recent change, make it possible to make -j again. The
early MD and late MI files must be split up so that vers.o can sneak
between. Issue spotted by bluhm, repair discussed with miod


# 1.38 02-Dec-2010 deraadt

move vers.o to before the other objects, so that it is not linked last.
having it linked last is bad (on at least i386 and amd64) because the lapic
is mapped over the start of the data segment -- savecore(8) then reads the
version string for a fixed buffer space, and reads into the lapic area
causing unintended side-effects (at least on Intel X5570 and X5680)
found by pedro, discussed with kettenis and mpf and miod


# 1.37 06-Sep-2010 jsg

move away from using /**/ to ## for cpp paste in sh locore
so we can drop -traditional-cpp
ok miod@


Revision tags: OPENBSD_4_8_BASE
# 1.36 01-Jun-2010 deraadt

use --warn-common for linking (some arch's will show new warnings), and
prefer binutils-compatible options in STRIPFLAGS (now that our non-binutils
strip(1) can handle them too)
ok drahn; miod kettenis (for parts)


# 1.35 28-May-2010 guenther

${PARAM} is now included in ${CPPFLAGS}, so stop passing it separately
to genassym.sh

ok deraadt


# 1.34 25-May-2010 deraadt

The _arch and _mach variables now come from config(8), decreasing even further
the differences between these files. You will need a newer config(8) binary
to be able to build kernels.
ok kettenis miod


# 1.33 25-May-2010 deraadt

Hand-list the two-step assym.h -> .[Ss] -> .o dependencies. The
result: kernels built without 'make depend'-provided information
(ie. the .depend file) are more likely to have their *.[Ss] file
compilations track changes to *.h files.

The "*.o: assym.h" dependencies listed are gotten from reading the
.depend output --- from the biggest kernel possible (ie. GENERIC.MP).
When an architecture changes in a substantial way (new .[sS] files),
the list should be updated in the prettiest way possible.

This is not encouraging people to skip 'make depend'; other issues are
not resolved and may be solved later with a change guenther is working
on. You can still screwed really easily, so continue running make
depend as config tells you.

Idea from a discussion with drahn
ok drahn, kettenis likes the idea too


# 1.32 25-May-2010 deraadt

${SRCS} is only used once, and fits onto the line where it is used
idea that came out of discussion with drahn


# 1.31 24-May-2010 deraadt

give up on -Wvariable-decl
delete the archaic links: target which is easily misused
handle special .[sS] files in a portable way


# 1.30 24-May-2010 deraadt

Unify the dependency time check for whether an architecture has SFILES


# 1.29 24-May-2010 deraadt

Reduce differences between the Makefile.* files for all architectures.
ok various people, tested by fewer people, tested by me on 15.


# 1.28 23-May-2010 deraadt

Does not need -Dlandisk, and instead, but -Dlandisk is nice since that is
the mach (arch is sh). Also move towards passing $PARAM around in CPPFLAGS,
instead of compiling param.c in a special way, as discussed with miod


# 1.27 28-Apr-2010 deraadt

clean up more more subtle and stupid differences between the various
Makefile.* files


# 1.26 27-Apr-2010 drahn

Killing a few more diffs for theo, arm makes #LINKFLAGS, beagle cleanup,
INCLUDE= common.


# 1.25 27-Apr-2010 deraadt

Unifity CPPFLAGS= (using ${_mach}), SYSTEM_LD_TAIL= (always on one line),
and SRCS= (common files always after the \)


# 1.24 27-Apr-2010 jsg

Disable builtin malloc and log2 on gcc3 arches, a no-op for gcc3
but required for gcc4.

ok kettenis@ deraadt@ marco@, log2 suggested by robert@


# 1.23 27-Apr-2010 deraadt

a bit more unification to the arm way of doing this


# 1.22 27-Apr-2010 deraadt

shorten preamble


# 1.21 27-Apr-2010 deraadt

No need for a specific .SUFFIXES list; ok drahn


# 1.20 27-Apr-2010 deraadt

noone needs comments about QUOTA and TRACE


# 1.19 27-Apr-2010 deraadt

over the years we have moved to a machine+architectures scheme that has
two directories. in reality, because of how we place files, it has four:
.../arch/A, .../arch/A/A, .../arch/M, and .../arch/M/M
formalize this A/A and M/M scheme directly in the Makefiles, which makes
them a lot more similar
drahn likes the idea a lot


# 1.18 27-Apr-2010 deraadt

use -f assymp.dep again; worked out with miod


# 1.17 27-Apr-2010 deraadt

alpha/conf/Makefile.alpha


# 1.16 26-Apr-2010 deraadt

even cleaner mach/arch/machdir/archdir


# 1.15 26-Apr-2010 deraadt

next step towards unification: make all the genassym chunks handle both
arch and machine dependent files (and add the missing files)
ok miod drahn


# 1.14 26-Apr-2010 deraadt

next unification step: move all MD naming _mach, _machdir, _arch, and _archdir
ok miod drahn


# 1.13 26-Apr-2010 deraadt

first step of unification: spaces at end of lines; comments, etc.
ok miod


Revision tags: OPENBSD_4_7_BASE
# 1.12 19-Oct-2009 guenther

Correct a target name so that we don't rebuild vers.o (and then
bsd) unless some other object has changed. Rebuild and reinstall
in /usr/src/usr.sbin/config/ after updating!

"I like it" deraadt@


# 1.11 09-Aug-2009 miod

Introduce option DDB_STRUCT. Kernels compiled with this option (except on
a few arches where toolchain limitations apply) will embed some symbolic
information about the various structs used within the kernel, and have
new ddb commands allowing struct display and some useful information
gathering. Kernel rodata increase varies accross platforms from ~150KB to
~300KB.
This option is not enabled by default.


# 1.10 09-Aug-2009 miod

No need to clean genassym{.,o} during `make clean', genassym.sh does this
for us.


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.9 11-Jan-2009 pirofti

Fix a sed bug in the makefile's depend target.

What happened was that the output of mkdep was fed to a sed expression
that trimmed a bit more than required and also failed to work when
attempting to do make depend with pcc.

Example:

genassym_c.o: /tmp/genassym.whatever ../../../../../sys/param.h \

was changed to:

assym.h: \

but what was intended was:

assym.h: ../../../../../sys/param.h \

For the pcc -M output things were a bit different and after the make
depend the genassym entry would still remain and make would fail. This
affected all platforms except amd64 and sgi.

Okay miod@.


Revision tags: OPENBSD_4_4_BASE
# 1.8 12-Apr-2008 miod

Compile kernels with -Wvariable-decl (except on arches with ipmi, for now).


Revision tags: OPENBSD_4_3_BASE
# 1.7 30-Nov-2007 miod

Define NORMAL_C_NOP everywhere.


# 1.6 25-Nov-2007 deraadt

libkern, begone. Move to a new mechanism where config(8)'s "file"
directive can select between MI and MD versions of these files. At
the same time, adjust the boot programs to pick exactly what they need,
instead of the 7 or 8 mechanisms previously used.

There will be some fallout from this, but testing it all by myself is a
ridiculously slow process; it will be finished in-tree.

Various developers were very nice and avoided making fun of me when I
was gibbering in the corner..


# 1.5 25-Nov-2007 deraadt

Get rid of the kernel 'libcompat' framework, and instead use conf/files to
decide which files must be pulled into the kernel. Also conditionalize
the pulling of those files based on the COMPAT_* options.


Revision tags: OPENBSD_4_2_BASE
# 1.4 30-Jul-2007 thib

Shuffle the order in which we look for header files, when doing
kernel builds locally this doesnt change much but over NFS this
cuts about 12% of the build time on my setup (i386).

OK miod@, deraadt@.


Revision tags: OPENBSD_4_1_BASE
# 1.3 06-Oct-2006 miod

Remove explicit -fno-stack-protector now that the compiler workaround is in
place.


# 1.2 06-Oct-2006 mickey

w/ help of netbsd srcs and some mother unzel made it lift off


# 1.1 06-Oct-2006 miod

branches: 1.1.1;
Initial revision


# 1.82 28-Jan-2021 deraadt

Again allow COPTS= to come from the environment again, and don't lose the
SMALL_KERNEL specific variations.
ok espie jsg


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.81 07-Nov-2019 guenther

The compiler -pg option implies -fno-ret-protector, as we want to disable
retguard and similar when profiling. However, that missed all the .S files,
as ${PROF} wasn't added when ${NORMAL_S} was converted from direct invocation
of ${AS} to instead use ${CC}. Similarly, mcount.o still had retguards
as it cannot be built with -pg. So: pass ${PROF} when compiling .S files,
and compile "no profiling" files with -fno-ret-protector on archs with
retguard.

feedback and ok mpi@ mortimer@


Revision tags: OPENBSD_6_6_BASE
# 1.80 21-Jun-2019 deraadt

Further improve the filesystem stability of kernel installation by KARL.
Use install -F to instead of cp, for fsync(2). Coupled with the new
sync(8) in the reorder_kernel script, the window for a incomplete /bsd
file on-disk due to a crash has now shrunk substantially.
Discussion with kettenis, millert and tedu


# 1.79 25-Apr-2019 deraadt

disable -Oz compile for SMALL_KERNEL w/ comment why


# 1.78 14-Apr-2019 deraadt

Instead of using COPTS=-Oz (and similar) in make environment to force
tightly-built ramdisk kernels, set the option in per-arch Makefile.inc
based upon SMALL_KERNEL


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.77 09-Feb-2018 tb

Check for the existence of /bsd before trying to back it up to /obsd.
Fixes 'make install' when /bsd is not present for some reason.

ok rob florian, "fine with me" deraadt


# 1.76 04-Nov-2017 florian

Since rev 1.502 of rc(8) it creates a /bsd.booted hard link. At the
end of rc we call reorder_kernel which creates a /obsd hard link to
the same kernel.
In the past obsd was only created when doing a manual make install in
the kernel sources.
There is no need for two backup hard links during boot, rearange the
kernel Makefiles to restore previous behaviour and thus stopping
reorder_kernel from scribbling over /obsd.

Makes muscle memory of some kernel developers work again: /obsd can
serve as a known good kernel; and there was much rejoycing...

Discussed at length with benno, rpe, phessler and tb at
p2k17.

Seems like a good idea to deraadt.

OK benno, phessler, rpe, tb


Revision tags: OPENBSD_6_2_BASE
# 1.75 28-Sep-2017 patrick

When option DDB_STRUCTINFO was removed from the kernel, too much from
the kernel makefiles was removed which lead to C files not being re-
compiled when a dependency changed. This can lead to panics in odd
places and generally a broken system.

ok deraadt@


# 1.74 12-Sep-2017 mpi

Remove option DDB_STRUCTINFO. Now that ddb(4) is CTF aware, similar
functionnalities are available in GENERIC.

ok jasper@, deraadt@, guenther@, dlg@


# 1.73 12-Aug-2017 mpi

Use ctfstrip(1) by default to strip kernels.

ok deraadt@, jasper@


# 1.72 18-Jul-2017 tb

Stop automatically regenerating gap.o (and hence linking a new kernel)
whenever make is issued. Only do this when there are actual source changes
below /sys. This restores the behavior prior to the KARL implementation.

Problem noticed and patiently explained by mpi
implementation with a lot of help from espie

ok mpi, espie, deraadt


# 1.71 16-Jul-2017 visa

Pass the linker from make environment to makegap.sh. This is (only)
a partial solution to cross compiling the kernel with KARL.

OK deraadt@ a while ago


# 1.70 29-Jun-2017 espie

put SYSTEM_SWAP_DEP out of its misery, it died in 1997, along with config.old
"go for it" deraadt@


# 1.69 25-Jun-2017 deraadt

dull dependency for copying makegap.sh to obj, so that installs
without src and comp work. That is what we've designed for, but since
we always have src and comp on our systems it is so easy to slide...
problem first noted by rpe.


# 1.68 22-Jun-2017 deraadt

Generate a gap.link script, and use that to generate gap.o. On multi-ABI
architectures we must also link against a gapdummy.o to repair the ABI
of the resulting .o file. Woe is me.
Also repair install: target to update the linkkit & hash when a kernel
is installed.
ok rpe tb mlarkin and tested by others also


# 1.67 13-Jun-2017 deraadt

newbsd: target which re-links a kernel. We cannot use the bsd: target
since it has source dependencies, and relinking doesn't have any. Also
the bsd: target is created by config(8)...
worked on with rpe.


# 1.66 13-Jun-2017 deraadt

needs a fake ld.script for KARL tooling


# 1.65 11-Jun-2017 deraadt

make vers.o not depend on gap.o using a trick, because it is piece of
fiction participating only in the linkphase.
tricks from rpe and espie


# 1.64 11-Jun-2017 bluhm

Use umask 077 instead of cp -p when installing the kernel as root.
Otherwise owner of /bsd could be the build user with permissions
inherited from the compile directory.
OK deraadt@ tb@


# 1.63 08-Jun-2017 deraadt

Split early startup code out of locore.S into locore0.S. Adjust link
run so that this locore0.o is always at the start of the executable.
But randomize the link order of all other .o files in the kernel, so
that their exec/rodata/data/bss segments land all over the place.

I haven't worked on the unmap/smashing of the startup code yet.


# 1.62 03-Jun-2017 deraadt

Create gap.S and gap.o with umask 077. Create lorder and bsd* with umask 007.
Prying eyes cannot look at the kernels in the compile directory.
ok tb rpe, kernel developers seem unimpacted


Revision tags: OPENBSD_6_1_BASE
# 1.61 29-Nov-2016 mpi

Build kernel with DEBUG=-g by default.

This will allow us to extract type informations from DWARF2 sections. It
also makes developer life easier as debug information are now included in
every object.

Resulting kernels will be stripped using strip(1) instead of ld(1).

Kernel build time increases by approximately 10%. However it is still
possible to disable this by defining DEBUG="".

ok kettenis@, bluhm@, natano@, jasper@, reyk@, deraadt@


# 1.60 15-Nov-2016 natano

Clean up the kernel Makefile's:

- Remove the 'lint' target. lint has been removed with OpenBSD 5.2.
- Remove the 'tags' target. It does nothing of value.
- Replace 'clean::' with 'clean:', as requested by espie and millert,
and remove files from the 'clean' target, that are never generated.
- Don't create a file called 'depend' in 'make depend', but just do
nothing instead.

ok mpi tb


# 1.59 27-Oct-2016 natano

We don't generate an eddep script for kernel builds nowadays. The last
reference to eddep in the kernel Makefile I could find is in 4.3BSD,
released some 30 years ago.

ok tb millert


# 1.58 24-Oct-2016 deraadt

make cleandir should skip the version file; ok otto millert


# 1.57 15-Oct-2016 deraadt

cleandir: target for kernel compile directories
ok natano


# 1.56 14-Oct-2016 deraadt

Kernel builds now happen in compile/CONFIG/obj@ -> /usr/obj/... [or ./obj/,
if srctree is not rooted at /usr/src]. As a result, stock GENERIC & RAMDISK
kernels are commited to the tree, to ensure the src tree can be "readonly"
during builds, with all writes occuring inside the obj space. config -b
options are handled by ../Makefile.inc. The canonical new way to configure
one of these kernels is:
% cd /sys/arch/amd64/compile/GENERIC.MP
% doas make obj
% make config
% make
% doas cp obj/bsd /bsd
The build infrastructure will use this new mechanism in a de-escalation
way using BUILDUSER.
Much help from natano and tb.


# 1.55 24-Sep-2016 kettenis

Add -Wno-pointer-sign to all our gcc4 architectures.

ok patrick@ (for armv7), deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.54 29-Apr-2016 mpi

Do not remove local symbols from the table.

ddb(4) can now see static functions. That doesn't mean we should start
declaring functions as ``static'', however it helps for the few existing
exceptions.

ok deraadt@, kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.53 13-Jan-2015 deraadt

for the install: target, use cmp as a rough attempt for avoiding repeated
make install
from Simon Nicolussi
ok jsing tedu


# 1.52 11-Jan-2015 tedu

switch prototype warnings to implicit-declaration warnings.
This should catch all the same bad cases, but be a little less aggravating
in circumstances where a prototype isn't necessary
ok deraadt


# 1.51 04-Oct-2014 brad

Switch the kernel configs over to using -Wframe-larger-than= instead of
-Wstack-larger-than-. This is what modern GCC supports as well as LLVM.

ok miod@


Revision tags: OPENBSD_5_6_BASE
# 1.50 08-May-2014 miod

Format string fixes and removal of -Wno-format for landisk kernels


Revision tags: OPENBSD_5_5_BASE
# 1.49 15-Oct-2013 guenther

Rewrite the awk script that generates the data for option DDB_STRUCT:
- switch to perl for better data structures and (thus) speed
- fix a couple glitches in the interpretation of the stabs output
- compress the strings by putting them in one big array and overlaying
suffixes
- all sizes and offsets are <64k, so use u_short for them
This results in ~60% reduction in the resulting text size and it now
takes less than a second to create on fast platforms.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.48 23-Jun-2013 miod

Stop using -traditional-cpp on gcc3/4 platforms.

Add CWARNFLAGS to the command line when using -xassembler-with-cpp. We are
mostly interested in -Werror here.


# 1.47 30-Mar-2013 tedu

reorder include search directories. cuts lookups by quite a bit.
ok deraadt miod


Revision tags: OPENBSD_5_3_BASE
# 1.46 28-Aug-2012 pascal

Add -nopie to LINKFLAGS on ELF architectures. Note that this needs an
updated gcc and ld to understand the new -nopie flag.

ok deraadt@


# 1.45 22-Aug-2012 pascal

Build the kernel with -fno-pie. Just getting Ms out of my tree; this will be
cleaned up later.

ok deraadt@


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.44 08-Nov-2011 matthieu

Garbage collect now unused MKDEP definitions. ok deraadt@


Revision tags: OPENBSD_5_0_BASE
# 1.43 07-Jul-2011 guenther

The drahn memorial bad kernel build fix: prevent blood pressure
spikes in other developers by making it so that removal of a .d
file without removing the corresponding object will result in the
latter being treated as out of date.

ok beck@ art@ drahn@


# 1.42 06-Jul-2011 tedu

make clean should clean .d files, so as to leave a fresh canvas.
ok beck deraadt


# 1.41 15-Apr-2011 guenther

Convert the kernel Makefiles to autogenerate dependencies during compilation
using the -MD option to cc, with -MP, -MT, and -MF where needed, converting
"make depend" to a no-op. This increases parallelism for those using "make -j"
and keeps the dependencies up to date with each compilation automatically.

sparc and vax users will need to rebuild gcc with support for the
-M[PTF] options before config'ing with this diff.


Revision tags: OPENBSD_4_9_BASE
# 1.40 30-Dec-2010 deraadt

If genassym fails, sort on the pipeline will indicate no error resulting
in some grief. Split this out.
From Vladimir Kirillov


# 1.39 02-Dec-2010 deraadt

After the most recent change, make it possible to make -j again. The
early MD and late MI files must be split up so that vers.o can sneak
between. Issue spotted by bluhm, repair discussed with miod


# 1.38 02-Dec-2010 deraadt

move vers.o to before the other objects, so that it is not linked last.
having it linked last is bad (on at least i386 and amd64) because the lapic
is mapped over the start of the data segment -- savecore(8) then reads the
version string for a fixed buffer space, and reads into the lapic area
causing unintended side-effects (at least on Intel X5570 and X5680)
found by pedro, discussed with kettenis and mpf and miod


# 1.37 06-Sep-2010 jsg

move away from using /**/ to ## for cpp paste in sh locore
so we can drop -traditional-cpp
ok miod@


Revision tags: OPENBSD_4_8_BASE
# 1.36 01-Jun-2010 deraadt

use --warn-common for linking (some arch's will show new warnings), and
prefer binutils-compatible options in STRIPFLAGS (now that our non-binutils
strip(1) can handle them too)
ok drahn; miod kettenis (for parts)


# 1.35 28-May-2010 guenther

${PARAM} is now included in ${CPPFLAGS}, so stop passing it separately
to genassym.sh

ok deraadt


# 1.34 25-May-2010 deraadt

The _arch and _mach variables now come from config(8), decreasing even further
the differences between these files. You will need a newer config(8) binary
to be able to build kernels.
ok kettenis miod


# 1.33 25-May-2010 deraadt

Hand-list the two-step assym.h -> .[Ss] -> .o dependencies. The
result: kernels built without 'make depend'-provided information
(ie. the .depend file) are more likely to have their *.[Ss] file
compilations track changes to *.h files.

The "*.o: assym.h" dependencies listed are gotten from reading the
.depend output --- from the biggest kernel possible (ie. GENERIC.MP).
When an architecture changes in a substantial way (new .[sS] files),
the list should be updated in the prettiest way possible.

This is not encouraging people to skip 'make depend'; other issues are
not resolved and may be solved later with a change guenther is working
on. You can still screwed really easily, so continue running make
depend as config tells you.

Idea from a discussion with drahn
ok drahn, kettenis likes the idea too


# 1.32 25-May-2010 deraadt

${SRCS} is only used once, and fits onto the line where it is used
idea that came out of discussion with drahn


# 1.31 24-May-2010 deraadt

give up on -Wvariable-decl
delete the archaic links: target which is easily misused
handle special .[sS] files in a portable way


# 1.30 24-May-2010 deraadt

Unify the dependency time check for whether an architecture has SFILES


# 1.29 24-May-2010 deraadt

Reduce differences between the Makefile.* files for all architectures.
ok various people, tested by fewer people, tested by me on 15.


# 1.28 23-May-2010 deraadt

Does not need -Dlandisk, and instead, but -Dlandisk is nice since that is
the mach (arch is sh). Also move towards passing $PARAM around in CPPFLAGS,
instead of compiling param.c in a special way, as discussed with miod


# 1.27 28-Apr-2010 deraadt

clean up more more subtle and stupid differences between the various
Makefile.* files


# 1.26 27-Apr-2010 drahn

Killing a few more diffs for theo, arm makes #LINKFLAGS, beagle cleanup,
INCLUDE= common.


# 1.25 27-Apr-2010 deraadt

Unifity CPPFLAGS= (using ${_mach}), SYSTEM_LD_TAIL= (always on one line),
and SRCS= (common files always after the \)


# 1.24 27-Apr-2010 jsg

Disable builtin malloc and log2 on gcc3 arches, a no-op for gcc3
but required for gcc4.

ok kettenis@ deraadt@ marco@, log2 suggested by robert@


# 1.23 27-Apr-2010 deraadt

a bit more unification to the arm way of doing this


# 1.22 27-Apr-2010 deraadt

shorten preamble


# 1.21 27-Apr-2010 deraadt

No need for a specific .SUFFIXES list; ok drahn


# 1.20 27-Apr-2010 deraadt

noone needs comments about QUOTA and TRACE


# 1.19 27-Apr-2010 deraadt

over the years we have moved to a machine+architectures scheme that has
two directories. in reality, because of how we place files, it has four:
.../arch/A, .../arch/A/A, .../arch/M, and .../arch/M/M
formalize this A/A and M/M scheme directly in the Makefiles, which makes
them a lot more similar
drahn likes the idea a lot


# 1.18 27-Apr-2010 deraadt

use -f assymp.dep again; worked out with miod


# 1.17 27-Apr-2010 deraadt

alpha/conf/Makefile.alpha


# 1.16 26-Apr-2010 deraadt

even cleaner mach/arch/machdir/archdir


# 1.15 26-Apr-2010 deraadt

next step towards unification: make all the genassym chunks handle both
arch and machine dependent files (and add the missing files)
ok miod drahn


# 1.14 26-Apr-2010 deraadt

next unification step: move all MD naming _mach, _machdir, _arch, and _archdir
ok miod drahn


# 1.13 26-Apr-2010 deraadt

first step of unification: spaces at end of lines; comments, etc.
ok miod


Revision tags: OPENBSD_4_7_BASE
# 1.12 19-Oct-2009 guenther

Correct a target name so that we don't rebuild vers.o (and then
bsd) unless some other object has changed. Rebuild and reinstall
in /usr/src/usr.sbin/config/ after updating!

"I like it" deraadt@


# 1.11 09-Aug-2009 miod

Introduce option DDB_STRUCT. Kernels compiled with this option (except on
a few arches where toolchain limitations apply) will embed some symbolic
information about the various structs used within the kernel, and have
new ddb commands allowing struct display and some useful information
gathering. Kernel rodata increase varies accross platforms from ~150KB to
~300KB.
This option is not enabled by default.


# 1.10 09-Aug-2009 miod

No need to clean genassym{.,o} during `make clean', genassym.sh does this
for us.


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.9 11-Jan-2009 pirofti

Fix a sed bug in the makefile's depend target.

What happened was that the output of mkdep was fed to a sed expression
that trimmed a bit more than required and also failed to work when
attempting to do make depend with pcc.

Example:

genassym_c.o: /tmp/genassym.whatever ../../../../../sys/param.h \

was changed to:

assym.h: \

but what was intended was:

assym.h: ../../../../../sys/param.h \

For the pcc -M output things were a bit different and after the make
depend the genassym entry would still remain and make would fail. This
affected all platforms except amd64 and sgi.

Okay miod@.


Revision tags: OPENBSD_4_4_BASE
# 1.8 12-Apr-2008 miod

Compile kernels with -Wvariable-decl (except on arches with ipmi, for now).


Revision tags: OPENBSD_4_3_BASE
# 1.7 30-Nov-2007 miod

Define NORMAL_C_NOP everywhere.


# 1.6 25-Nov-2007 deraadt

libkern, begone. Move to a new mechanism where config(8)'s "file"
directive can select between MI and MD versions of these files. At
the same time, adjust the boot programs to pick exactly what they need,
instead of the 7 or 8 mechanisms previously used.

There will be some fallout from this, but testing it all by myself is a
ridiculously slow process; it will be finished in-tree.

Various developers were very nice and avoided making fun of me when I
was gibbering in the corner..


# 1.5 25-Nov-2007 deraadt

Get rid of the kernel 'libcompat' framework, and instead use conf/files to
decide which files must be pulled into the kernel. Also conditionalize
the pulling of those files based on the COMPAT_* options.


Revision tags: OPENBSD_4_2_BASE
# 1.4 30-Jul-2007 thib

Shuffle the order in which we look for header files, when doing
kernel builds locally this doesnt change much but over NFS this
cuts about 12% of the build time on my setup (i386).

OK miod@, deraadt@.


Revision tags: OPENBSD_4_1_BASE
# 1.3 06-Oct-2006 miod

Remove explicit -fno-stack-protector now that the compiler workaround is in
place.


# 1.2 06-Oct-2006 mickey

w/ help of netbsd srcs and some mother unzel made it lift off


# 1.1 06-Oct-2006 miod

branches: 1.1.1;
Initial revision


# 1.81 07-Nov-2019 guenther

The compiler -pg option implies -fno-ret-protector, as we want to disable
retguard and similar when profiling. However, that missed all the .S files,
as ${PROF} wasn't added when ${NORMAL_S} was converted from direct invocation
of ${AS} to instead use ${CC}. Similarly, mcount.o still had retguards
as it cannot be built with -pg. So: pass ${PROF} when compiling .S files,
and compile "no profiling" files with -fno-ret-protector on archs with
retguard.

feedback and ok mpi@ mortimer@


Revision tags: OPENBSD_6_6_BASE
# 1.80 21-Jun-2019 deraadt

Further improve the filesystem stability of kernel installation by KARL.
Use install -F to instead of cp, for fsync(2). Coupled with the new
sync(8) in the reorder_kernel script, the window for a incomplete /bsd
file on-disk due to a crash has now shrunk substantially.
Discussion with kettenis, millert and tedu


# 1.79 25-Apr-2019 deraadt

disable -Oz compile for SMALL_KERNEL w/ comment why


# 1.78 14-Apr-2019 deraadt

Instead of using COPTS=-Oz (and similar) in make environment to force
tightly-built ramdisk kernels, set the option in per-arch Makefile.inc
based upon SMALL_KERNEL


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.77 09-Feb-2018 tb

Check for the existence of /bsd before trying to back it up to /obsd.
Fixes 'make install' when /bsd is not present for some reason.

ok rob florian, "fine with me" deraadt


# 1.76 04-Nov-2017 florian

Since rev 1.502 of rc(8) it creates a /bsd.booted hard link. At the
end of rc we call reorder_kernel which creates a /obsd hard link to
the same kernel.
In the past obsd was only created when doing a manual make install in
the kernel sources.
There is no need for two backup hard links during boot, rearange the
kernel Makefiles to restore previous behaviour and thus stopping
reorder_kernel from scribbling over /obsd.

Makes muscle memory of some kernel developers work again: /obsd can
serve as a known good kernel; and there was much rejoycing...

Discussed at length with benno, rpe, phessler and tb at
p2k17.

Seems like a good idea to deraadt.

OK benno, phessler, rpe, tb


Revision tags: OPENBSD_6_2_BASE
# 1.75 28-Sep-2017 patrick

When option DDB_STRUCTINFO was removed from the kernel, too much from
the kernel makefiles was removed which lead to C files not being re-
compiled when a dependency changed. This can lead to panics in odd
places and generally a broken system.

ok deraadt@


# 1.74 12-Sep-2017 mpi

Remove option DDB_STRUCTINFO. Now that ddb(4) is CTF aware, similar
functionnalities are available in GENERIC.

ok jasper@, deraadt@, guenther@, dlg@


# 1.73 12-Aug-2017 mpi

Use ctfstrip(1) by default to strip kernels.

ok deraadt@, jasper@


# 1.72 18-Jul-2017 tb

Stop automatically regenerating gap.o (and hence linking a new kernel)
whenever make is issued. Only do this when there are actual source changes
below /sys. This restores the behavior prior to the KARL implementation.

Problem noticed and patiently explained by mpi
implementation with a lot of help from espie

ok mpi, espie, deraadt


# 1.71 16-Jul-2017 visa

Pass the linker from make environment to makegap.sh. This is (only)
a partial solution to cross compiling the kernel with KARL.

OK deraadt@ a while ago


# 1.70 29-Jun-2017 espie

put SYSTEM_SWAP_DEP out of its misery, it died in 1997, along with config.old
"go for it" deraadt@


# 1.69 25-Jun-2017 deraadt

dull dependency for copying makegap.sh to obj, so that installs
without src and comp work. That is what we've designed for, but since
we always have src and comp on our systems it is so easy to slide...
problem first noted by rpe.


# 1.68 22-Jun-2017 deraadt

Generate a gap.link script, and use that to generate gap.o. On multi-ABI
architectures we must also link against a gapdummy.o to repair the ABI
of the resulting .o file. Woe is me.
Also repair install: target to update the linkkit & hash when a kernel
is installed.
ok rpe tb mlarkin and tested by others also


# 1.67 13-Jun-2017 deraadt

newbsd: target which re-links a kernel. We cannot use the bsd: target
since it has source dependencies, and relinking doesn't have any. Also
the bsd: target is created by config(8)...
worked on with rpe.


# 1.66 13-Jun-2017 deraadt

needs a fake ld.script for KARL tooling


# 1.65 11-Jun-2017 deraadt

make vers.o not depend on gap.o using a trick, because it is piece of
fiction participating only in the linkphase.
tricks from rpe and espie


# 1.64 11-Jun-2017 bluhm

Use umask 077 instead of cp -p when installing the kernel as root.
Otherwise owner of /bsd could be the build user with permissions
inherited from the compile directory.
OK deraadt@ tb@


# 1.63 08-Jun-2017 deraadt

Split early startup code out of locore.S into locore0.S. Adjust link
run so that this locore0.o is always at the start of the executable.
But randomize the link order of all other .o files in the kernel, so
that their exec/rodata/data/bss segments land all over the place.

I haven't worked on the unmap/smashing of the startup code yet.


# 1.62 03-Jun-2017 deraadt

Create gap.S and gap.o with umask 077. Create lorder and bsd* with umask 007.
Prying eyes cannot look at the kernels in the compile directory.
ok tb rpe, kernel developers seem unimpacted


Revision tags: OPENBSD_6_1_BASE
# 1.61 29-Nov-2016 mpi

Build kernel with DEBUG=-g by default.

This will allow us to extract type informations from DWARF2 sections. It
also makes developer life easier as debug information are now included in
every object.

Resulting kernels will be stripped using strip(1) instead of ld(1).

Kernel build time increases by approximately 10%. However it is still
possible to disable this by defining DEBUG="".

ok kettenis@, bluhm@, natano@, jasper@, reyk@, deraadt@


# 1.60 15-Nov-2016 natano

Clean up the kernel Makefile's:

- Remove the 'lint' target. lint has been removed with OpenBSD 5.2.
- Remove the 'tags' target. It does nothing of value.
- Replace 'clean::' with 'clean:', as requested by espie and millert,
and remove files from the 'clean' target, that are never generated.
- Don't create a file called 'depend' in 'make depend', but just do
nothing instead.

ok mpi tb


# 1.59 27-Oct-2016 natano

We don't generate an eddep script for kernel builds nowadays. The last
reference to eddep in the kernel Makefile I could find is in 4.3BSD,
released some 30 years ago.

ok tb millert


# 1.58 24-Oct-2016 deraadt

make cleandir should skip the version file; ok otto millert


# 1.57 15-Oct-2016 deraadt

cleandir: target for kernel compile directories
ok natano


# 1.56 14-Oct-2016 deraadt

Kernel builds now happen in compile/CONFIG/obj@ -> /usr/obj/... [or ./obj/,
if srctree is not rooted at /usr/src]. As a result, stock GENERIC & RAMDISK
kernels are commited to the tree, to ensure the src tree can be "readonly"
during builds, with all writes occuring inside the obj space. config -b
options are handled by ../Makefile.inc. The canonical new way to configure
one of these kernels is:
% cd /sys/arch/amd64/compile/GENERIC.MP
% doas make obj
% make config
% make
% doas cp obj/bsd /bsd
The build infrastructure will use this new mechanism in a de-escalation
way using BUILDUSER.
Much help from natano and tb.


# 1.55 24-Sep-2016 kettenis

Add -Wno-pointer-sign to all our gcc4 architectures.

ok patrick@ (for armv7), deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.54 29-Apr-2016 mpi

Do not remove local symbols from the table.

ddb(4) can now see static functions. That doesn't mean we should start
declaring functions as ``static'', however it helps for the few existing
exceptions.

ok deraadt@, kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.53 13-Jan-2015 deraadt

for the install: target, use cmp as a rough attempt for avoiding repeated
make install
from Simon Nicolussi
ok jsing tedu


# 1.52 11-Jan-2015 tedu

switch prototype warnings to implicit-declaration warnings.
This should catch all the same bad cases, but be a little less aggravating
in circumstances where a prototype isn't necessary
ok deraadt


# 1.51 04-Oct-2014 brad

Switch the kernel configs over to using -Wframe-larger-than= instead of
-Wstack-larger-than-. This is what modern GCC supports as well as LLVM.

ok miod@


Revision tags: OPENBSD_5_6_BASE
# 1.50 08-May-2014 miod

Format string fixes and removal of -Wno-format for landisk kernels


Revision tags: OPENBSD_5_5_BASE
# 1.49 15-Oct-2013 guenther

Rewrite the awk script that generates the data for option DDB_STRUCT:
- switch to perl for better data structures and (thus) speed
- fix a couple glitches in the interpretation of the stabs output
- compress the strings by putting them in one big array and overlaying
suffixes
- all sizes and offsets are <64k, so use u_short for them
This results in ~60% reduction in the resulting text size and it now
takes less than a second to create on fast platforms.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.48 23-Jun-2013 miod

Stop using -traditional-cpp on gcc3/4 platforms.

Add CWARNFLAGS to the command line when using -xassembler-with-cpp. We are
mostly interested in -Werror here.


# 1.47 30-Mar-2013 tedu

reorder include search directories. cuts lookups by quite a bit.
ok deraadt miod


Revision tags: OPENBSD_5_3_BASE
# 1.46 28-Aug-2012 pascal

Add -nopie to LINKFLAGS on ELF architectures. Note that this needs an
updated gcc and ld to understand the new -nopie flag.

ok deraadt@


# 1.45 22-Aug-2012 pascal

Build the kernel with -fno-pie. Just getting Ms out of my tree; this will be
cleaned up later.

ok deraadt@


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.44 08-Nov-2011 matthieu

Garbage collect now unused MKDEP definitions. ok deraadt@


Revision tags: OPENBSD_5_0_BASE
# 1.43 07-Jul-2011 guenther

The drahn memorial bad kernel build fix: prevent blood pressure
spikes in other developers by making it so that removal of a .d
file without removing the corresponding object will result in the
latter being treated as out of date.

ok beck@ art@ drahn@


# 1.42 06-Jul-2011 tedu

make clean should clean .d files, so as to leave a fresh canvas.
ok beck deraadt


# 1.41 15-Apr-2011 guenther

Convert the kernel Makefiles to autogenerate dependencies during compilation
using the -MD option to cc, with -MP, -MT, and -MF where needed, converting
"make depend" to a no-op. This increases parallelism for those using "make -j"
and keeps the dependencies up to date with each compilation automatically.

sparc and vax users will need to rebuild gcc with support for the
-M[PTF] options before config'ing with this diff.


Revision tags: OPENBSD_4_9_BASE
# 1.40 30-Dec-2010 deraadt

If genassym fails, sort on the pipeline will indicate no error resulting
in some grief. Split this out.
From Vladimir Kirillov


# 1.39 02-Dec-2010 deraadt

After the most recent change, make it possible to make -j again. The
early MD and late MI files must be split up so that vers.o can sneak
between. Issue spotted by bluhm, repair discussed with miod


# 1.38 02-Dec-2010 deraadt

move vers.o to before the other objects, so that it is not linked last.
having it linked last is bad (on at least i386 and amd64) because the lapic
is mapped over the start of the data segment -- savecore(8) then reads the
version string for a fixed buffer space, and reads into the lapic area
causing unintended side-effects (at least on Intel X5570 and X5680)
found by pedro, discussed with kettenis and mpf and miod


# 1.37 06-Sep-2010 jsg

move away from using /**/ to ## for cpp paste in sh locore
so we can drop -traditional-cpp
ok miod@


Revision tags: OPENBSD_4_8_BASE
# 1.36 01-Jun-2010 deraadt

use --warn-common for linking (some arch's will show new warnings), and
prefer binutils-compatible options in STRIPFLAGS (now that our non-binutils
strip(1) can handle them too)
ok drahn; miod kettenis (for parts)


# 1.35 28-May-2010 guenther

${PARAM} is now included in ${CPPFLAGS}, so stop passing it separately
to genassym.sh

ok deraadt


# 1.34 25-May-2010 deraadt

The _arch and _mach variables now come from config(8), decreasing even further
the differences between these files. You will need a newer config(8) binary
to be able to build kernels.
ok kettenis miod


# 1.33 25-May-2010 deraadt

Hand-list the two-step assym.h -> .[Ss] -> .o dependencies. The
result: kernels built without 'make depend'-provided information
(ie. the .depend file) are more likely to have their *.[Ss] file
compilations track changes to *.h files.

The "*.o: assym.h" dependencies listed are gotten from reading the
.depend output --- from the biggest kernel possible (ie. GENERIC.MP).
When an architecture changes in a substantial way (new .[sS] files),
the list should be updated in the prettiest way possible.

This is not encouraging people to skip 'make depend'; other issues are
not resolved and may be solved later with a change guenther is working
on. You can still screwed really easily, so continue running make
depend as config tells you.

Idea from a discussion with drahn
ok drahn, kettenis likes the idea too


# 1.32 25-May-2010 deraadt

${SRCS} is only used once, and fits onto the line where it is used
idea that came out of discussion with drahn


# 1.31 24-May-2010 deraadt

give up on -Wvariable-decl
delete the archaic links: target which is easily misused
handle special .[sS] files in a portable way


# 1.30 24-May-2010 deraadt

Unify the dependency time check for whether an architecture has SFILES


# 1.29 24-May-2010 deraadt

Reduce differences between the Makefile.* files for all architectures.
ok various people, tested by fewer people, tested by me on 15.


# 1.28 23-May-2010 deraadt

Does not need -Dlandisk, and instead, but -Dlandisk is nice since that is
the mach (arch is sh). Also move towards passing $PARAM around in CPPFLAGS,
instead of compiling param.c in a special way, as discussed with miod


# 1.27 28-Apr-2010 deraadt

clean up more more subtle and stupid differences between the various
Makefile.* files


# 1.26 27-Apr-2010 drahn

Killing a few more diffs for theo, arm makes #LINKFLAGS, beagle cleanup,
INCLUDE= common.


# 1.25 27-Apr-2010 deraadt

Unifity CPPFLAGS= (using ${_mach}), SYSTEM_LD_TAIL= (always on one line),
and SRCS= (common files always after the \)


# 1.24 27-Apr-2010 jsg

Disable builtin malloc and log2 on gcc3 arches, a no-op for gcc3
but required for gcc4.

ok kettenis@ deraadt@ marco@, log2 suggested by robert@


# 1.23 27-Apr-2010 deraadt

a bit more unification to the arm way of doing this


# 1.22 27-Apr-2010 deraadt

shorten preamble


# 1.21 27-Apr-2010 deraadt

No need for a specific .SUFFIXES list; ok drahn


# 1.20 27-Apr-2010 deraadt

noone needs comments about QUOTA and TRACE


# 1.19 27-Apr-2010 deraadt

over the years we have moved to a machine+architectures scheme that has
two directories. in reality, because of how we place files, it has four:
.../arch/A, .../arch/A/A, .../arch/M, and .../arch/M/M
formalize this A/A and M/M scheme directly in the Makefiles, which makes
them a lot more similar
drahn likes the idea a lot


# 1.18 27-Apr-2010 deraadt

use -f assymp.dep again; worked out with miod


# 1.17 27-Apr-2010 deraadt

alpha/conf/Makefile.alpha


# 1.16 26-Apr-2010 deraadt

even cleaner mach/arch/machdir/archdir


# 1.15 26-Apr-2010 deraadt

next step towards unification: make all the genassym chunks handle both
arch and machine dependent files (and add the missing files)
ok miod drahn


# 1.14 26-Apr-2010 deraadt

next unification step: move all MD naming _mach, _machdir, _arch, and _archdir
ok miod drahn


# 1.13 26-Apr-2010 deraadt

first step of unification: spaces at end of lines; comments, etc.
ok miod


Revision tags: OPENBSD_4_7_BASE
# 1.12 19-Oct-2009 guenther

Correct a target name so that we don't rebuild vers.o (and then
bsd) unless some other object has changed. Rebuild and reinstall
in /usr/src/usr.sbin/config/ after updating!

"I like it" deraadt@


# 1.11 09-Aug-2009 miod

Introduce option DDB_STRUCT. Kernels compiled with this option (except on
a few arches where toolchain limitations apply) will embed some symbolic
information about the various structs used within the kernel, and have
new ddb commands allowing struct display and some useful information
gathering. Kernel rodata increase varies accross platforms from ~150KB to
~300KB.
This option is not enabled by default.


# 1.10 09-Aug-2009 miod

No need to clean genassym{.,o} during `make clean', genassym.sh does this
for us.


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.9 11-Jan-2009 pirofti

Fix a sed bug in the makefile's depend target.

What happened was that the output of mkdep was fed to a sed expression
that trimmed a bit more than required and also failed to work when
attempting to do make depend with pcc.

Example:

genassym_c.o: /tmp/genassym.whatever ../../../../../sys/param.h \

was changed to:

assym.h: \

but what was intended was:

assym.h: ../../../../../sys/param.h \

For the pcc -M output things were a bit different and after the make
depend the genassym entry would still remain and make would fail. This
affected all platforms except amd64 and sgi.

Okay miod@.


Revision tags: OPENBSD_4_4_BASE
# 1.8 12-Apr-2008 miod

Compile kernels with -Wvariable-decl (except on arches with ipmi, for now).


Revision tags: OPENBSD_4_3_BASE
# 1.7 30-Nov-2007 miod

Define NORMAL_C_NOP everywhere.


# 1.6 25-Nov-2007 deraadt

libkern, begone. Move to a new mechanism where config(8)'s "file"
directive can select between MI and MD versions of these files. At
the same time, adjust the boot programs to pick exactly what they need,
instead of the 7 or 8 mechanisms previously used.

There will be some fallout from this, but testing it all by myself is a
ridiculously slow process; it will be finished in-tree.

Various developers were very nice and avoided making fun of me when I
was gibbering in the corner..


# 1.5 25-Nov-2007 deraadt

Get rid of the kernel 'libcompat' framework, and instead use conf/files to
decide which files must be pulled into the kernel. Also conditionalize
the pulling of those files based on the COMPAT_* options.


Revision tags: OPENBSD_4_2_BASE
# 1.4 30-Jul-2007 thib

Shuffle the order in which we look for header files, when doing
kernel builds locally this doesnt change much but over NFS this
cuts about 12% of the build time on my setup (i386).

OK miod@, deraadt@.


Revision tags: OPENBSD_4_1_BASE
# 1.3 06-Oct-2006 miod

Remove explicit -fno-stack-protector now that the compiler workaround is in
place.


# 1.2 06-Oct-2006 mickey

w/ help of netbsd srcs and some mother unzel made it lift off


# 1.1 06-Oct-2006 miod

branches: 1.1.1;
Initial revision


# 1.80 21-Jun-2019 deraadt

Further improve the filesystem stability of kernel installation by KARL.
Use install -F to instead of cp, for fsync(2). Coupled with the new
sync(8) in the reorder_kernel script, the window for a incomplete /bsd
file on-disk due to a crash has now shrunk substantially.
Discussion with kettenis, millert and tedu


# 1.79 25-Apr-2019 deraadt

disable -Oz compile for SMALL_KERNEL w/ comment why


# 1.78 14-Apr-2019 deraadt

Instead of using COPTS=-Oz (and similar) in make environment to force
tightly-built ramdisk kernels, set the option in per-arch Makefile.inc
based upon SMALL_KERNEL


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.77 09-Feb-2018 tb

Check for the existence of /bsd before trying to back it up to /obsd.
Fixes 'make install' when /bsd is not present for some reason.

ok rob florian, "fine with me" deraadt


# 1.76 04-Nov-2017 florian

Since rev 1.502 of rc(8) it creates a /bsd.booted hard link. At the
end of rc we call reorder_kernel which creates a /obsd hard link to
the same kernel.
In the past obsd was only created when doing a manual make install in
the kernel sources.
There is no need for two backup hard links during boot, rearange the
kernel Makefiles to restore previous behaviour and thus stopping
reorder_kernel from scribbling over /obsd.

Makes muscle memory of some kernel developers work again: /obsd can
serve as a known good kernel; and there was much rejoycing...

Discussed at length with benno, rpe, phessler and tb at
p2k17.

Seems like a good idea to deraadt.

OK benno, phessler, rpe, tb


Revision tags: OPENBSD_6_2_BASE
# 1.75 28-Sep-2017 patrick

When option DDB_STRUCTINFO was removed from the kernel, too much from
the kernel makefiles was removed which lead to C files not being re-
compiled when a dependency changed. This can lead to panics in odd
places and generally a broken system.

ok deraadt@


# 1.74 12-Sep-2017 mpi

Remove option DDB_STRUCTINFO. Now that ddb(4) is CTF aware, similar
functionnalities are available in GENERIC.

ok jasper@, deraadt@, guenther@, dlg@


# 1.73 12-Aug-2017 mpi

Use ctfstrip(1) by default to strip kernels.

ok deraadt@, jasper@


# 1.72 18-Jul-2017 tb

Stop automatically regenerating gap.o (and hence linking a new kernel)
whenever make is issued. Only do this when there are actual source changes
below /sys. This restores the behavior prior to the KARL implementation.

Problem noticed and patiently explained by mpi
implementation with a lot of help from espie

ok mpi, espie, deraadt


# 1.71 16-Jul-2017 visa

Pass the linker from make environment to makegap.sh. This is (only)
a partial solution to cross compiling the kernel with KARL.

OK deraadt@ a while ago


# 1.70 29-Jun-2017 espie

put SYSTEM_SWAP_DEP out of its misery, it died in 1997, along with config.old
"go for it" deraadt@


# 1.69 25-Jun-2017 deraadt

dull dependency for copying makegap.sh to obj, so that installs
without src and comp work. That is what we've designed for, but since
we always have src and comp on our systems it is so easy to slide...
problem first noted by rpe.


# 1.68 22-Jun-2017 deraadt

Generate a gap.link script, and use that to generate gap.o. On multi-ABI
architectures we must also link against a gapdummy.o to repair the ABI
of the resulting .o file. Woe is me.
Also repair install: target to update the linkkit & hash when a kernel
is installed.
ok rpe tb mlarkin and tested by others also


# 1.67 13-Jun-2017 deraadt

newbsd: target which re-links a kernel. We cannot use the bsd: target
since it has source dependencies, and relinking doesn't have any. Also
the bsd: target is created by config(8)...
worked on with rpe.


# 1.66 13-Jun-2017 deraadt

needs a fake ld.script for KARL tooling


# 1.65 11-Jun-2017 deraadt

make vers.o not depend on gap.o using a trick, because it is piece of
fiction participating only in the linkphase.
tricks from rpe and espie


# 1.64 11-Jun-2017 bluhm

Use umask 077 instead of cp -p when installing the kernel as root.
Otherwise owner of /bsd could be the build user with permissions
inherited from the compile directory.
OK deraadt@ tb@


# 1.63 08-Jun-2017 deraadt

Split early startup code out of locore.S into locore0.S. Adjust link
run so that this locore0.o is always at the start of the executable.
But randomize the link order of all other .o files in the kernel, so
that their exec/rodata/data/bss segments land all over the place.

I haven't worked on the unmap/smashing of the startup code yet.


# 1.62 03-Jun-2017 deraadt

Create gap.S and gap.o with umask 077. Create lorder and bsd* with umask 007.
Prying eyes cannot look at the kernels in the compile directory.
ok tb rpe, kernel developers seem unimpacted


Revision tags: OPENBSD_6_1_BASE
# 1.61 29-Nov-2016 mpi

Build kernel with DEBUG=-g by default.

This will allow us to extract type informations from DWARF2 sections. It
also makes developer life easier as debug information are now included in
every object.

Resulting kernels will be stripped using strip(1) instead of ld(1).

Kernel build time increases by approximately 10%. However it is still
possible to disable this by defining DEBUG="".

ok kettenis@, bluhm@, natano@, jasper@, reyk@, deraadt@


# 1.60 15-Nov-2016 natano

Clean up the kernel Makefile's:

- Remove the 'lint' target. lint has been removed with OpenBSD 5.2.
- Remove the 'tags' target. It does nothing of value.
- Replace 'clean::' with 'clean:', as requested by espie and millert,
and remove files from the 'clean' target, that are never generated.
- Don't create a file called 'depend' in 'make depend', but just do
nothing instead.

ok mpi tb


# 1.59 27-Oct-2016 natano

We don't generate an eddep script for kernel builds nowadays. The last
reference to eddep in the kernel Makefile I could find is in 4.3BSD,
released some 30 years ago.

ok tb millert


# 1.58 24-Oct-2016 deraadt

make cleandir should skip the version file; ok otto millert


# 1.57 15-Oct-2016 deraadt

cleandir: target for kernel compile directories
ok natano


# 1.56 14-Oct-2016 deraadt

Kernel builds now happen in compile/CONFIG/obj@ -> /usr/obj/... [or ./obj/,
if srctree is not rooted at /usr/src]. As a result, stock GENERIC & RAMDISK
kernels are commited to the tree, to ensure the src tree can be "readonly"
during builds, with all writes occuring inside the obj space. config -b
options are handled by ../Makefile.inc. The canonical new way to configure
one of these kernels is:
% cd /sys/arch/amd64/compile/GENERIC.MP
% doas make obj
% make config
% make
% doas cp obj/bsd /bsd
The build infrastructure will use this new mechanism in a de-escalation
way using BUILDUSER.
Much help from natano and tb.


# 1.55 24-Sep-2016 kettenis

Add -Wno-pointer-sign to all our gcc4 architectures.

ok patrick@ (for armv7), deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.54 29-Apr-2016 mpi

Do not remove local symbols from the table.

ddb(4) can now see static functions. That doesn't mean we should start
declaring functions as ``static'', however it helps for the few existing
exceptions.

ok deraadt@, kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.53 13-Jan-2015 deraadt

for the install: target, use cmp as a rough attempt for avoiding repeated
make install
from Simon Nicolussi
ok jsing tedu


# 1.52 11-Jan-2015 tedu

switch prototype warnings to implicit-declaration warnings.
This should catch all the same bad cases, but be a little less aggravating
in circumstances where a prototype isn't necessary
ok deraadt


# 1.51 04-Oct-2014 brad

Switch the kernel configs over to using -Wframe-larger-than= instead of
-Wstack-larger-than-. This is what modern GCC supports as well as LLVM.

ok miod@


Revision tags: OPENBSD_5_6_BASE
# 1.50 08-May-2014 miod

Format string fixes and removal of -Wno-format for landisk kernels


Revision tags: OPENBSD_5_5_BASE
# 1.49 15-Oct-2013 guenther

Rewrite the awk script that generates the data for option DDB_STRUCT:
- switch to perl for better data structures and (thus) speed
- fix a couple glitches in the interpretation of the stabs output
- compress the strings by putting them in one big array and overlaying
suffixes
- all sizes and offsets are <64k, so use u_short for them
This results in ~60% reduction in the resulting text size and it now
takes less than a second to create on fast platforms.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.48 23-Jun-2013 miod

Stop using -traditional-cpp on gcc3/4 platforms.

Add CWARNFLAGS to the command line when using -xassembler-with-cpp. We are
mostly interested in -Werror here.


# 1.47 30-Mar-2013 tedu

reorder include search directories. cuts lookups by quite a bit.
ok deraadt miod


Revision tags: OPENBSD_5_3_BASE
# 1.46 28-Aug-2012 pascal

Add -nopie to LINKFLAGS on ELF architectures. Note that this needs an
updated gcc and ld to understand the new -nopie flag.

ok deraadt@


# 1.45 22-Aug-2012 pascal

Build the kernel with -fno-pie. Just getting Ms out of my tree; this will be
cleaned up later.

ok deraadt@


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.44 08-Nov-2011 matthieu

Garbage collect now unused MKDEP definitions. ok deraadt@


Revision tags: OPENBSD_5_0_BASE
# 1.43 07-Jul-2011 guenther

The drahn memorial bad kernel build fix: prevent blood pressure
spikes in other developers by making it so that removal of a .d
file without removing the corresponding object will result in the
latter being treated as out of date.

ok beck@ art@ drahn@


# 1.42 06-Jul-2011 tedu

make clean should clean .d files, so as to leave a fresh canvas.
ok beck deraadt


# 1.41 15-Apr-2011 guenther

Convert the kernel Makefiles to autogenerate dependencies during compilation
using the -MD option to cc, with -MP, -MT, and -MF where needed, converting
"make depend" to a no-op. This increases parallelism for those using "make -j"
and keeps the dependencies up to date with each compilation automatically.

sparc and vax users will need to rebuild gcc with support for the
-M[PTF] options before config'ing with this diff.


Revision tags: OPENBSD_4_9_BASE
# 1.40 30-Dec-2010 deraadt

If genassym fails, sort on the pipeline will indicate no error resulting
in some grief. Split this out.
From Vladimir Kirillov


# 1.39 02-Dec-2010 deraadt

After the most recent change, make it possible to make -j again. The
early MD and late MI files must be split up so that vers.o can sneak
between. Issue spotted by bluhm, repair discussed with miod


# 1.38 02-Dec-2010 deraadt

move vers.o to before the other objects, so that it is not linked last.
having it linked last is bad (on at least i386 and amd64) because the lapic
is mapped over the start of the data segment -- savecore(8) then reads the
version string for a fixed buffer space, and reads into the lapic area
causing unintended side-effects (at least on Intel X5570 and X5680)
found by pedro, discussed with kettenis and mpf and miod


# 1.37 06-Sep-2010 jsg

move away from using /**/ to ## for cpp paste in sh locore
so we can drop -traditional-cpp
ok miod@


Revision tags: OPENBSD_4_8_BASE
# 1.36 01-Jun-2010 deraadt

use --warn-common for linking (some arch's will show new warnings), and
prefer binutils-compatible options in STRIPFLAGS (now that our non-binutils
strip(1) can handle them too)
ok drahn; miod kettenis (for parts)


# 1.35 28-May-2010 guenther

${PARAM} is now included in ${CPPFLAGS}, so stop passing it separately
to genassym.sh

ok deraadt


# 1.34 25-May-2010 deraadt

The _arch and _mach variables now come from config(8), decreasing even further
the differences between these files. You will need a newer config(8) binary
to be able to build kernels.
ok kettenis miod


# 1.33 25-May-2010 deraadt

Hand-list the two-step assym.h -> .[Ss] -> .o dependencies. The
result: kernels built without 'make depend'-provided information
(ie. the .depend file) are more likely to have their *.[Ss] file
compilations track changes to *.h files.

The "*.o: assym.h" dependencies listed are gotten from reading the
.depend output --- from the biggest kernel possible (ie. GENERIC.MP).
When an architecture changes in a substantial way (new .[sS] files),
the list should be updated in the prettiest way possible.

This is not encouraging people to skip 'make depend'; other issues are
not resolved and may be solved later with a change guenther is working
on. You can still screwed really easily, so continue running make
depend as config tells you.

Idea from a discussion with drahn
ok drahn, kettenis likes the idea too


# 1.32 25-May-2010 deraadt

${SRCS} is only used once, and fits onto the line where it is used
idea that came out of discussion with drahn


# 1.31 24-May-2010 deraadt

give up on -Wvariable-decl
delete the archaic links: target which is easily misused
handle special .[sS] files in a portable way


# 1.30 24-May-2010 deraadt

Unify the dependency time check for whether an architecture has SFILES


# 1.29 24-May-2010 deraadt

Reduce differences between the Makefile.* files for all architectures.
ok various people, tested by fewer people, tested by me on 15.


# 1.28 23-May-2010 deraadt

Does not need -Dlandisk, and instead, but -Dlandisk is nice since that is
the mach (arch is sh). Also move towards passing $PARAM around in CPPFLAGS,
instead of compiling param.c in a special way, as discussed with miod


# 1.27 28-Apr-2010 deraadt

clean up more more subtle and stupid differences between the various
Makefile.* files


# 1.26 27-Apr-2010 drahn

Killing a few more diffs for theo, arm makes #LINKFLAGS, beagle cleanup,
INCLUDE= common.


# 1.25 27-Apr-2010 deraadt

Unifity CPPFLAGS= (using ${_mach}), SYSTEM_LD_TAIL= (always on one line),
and SRCS= (common files always after the \)


# 1.24 27-Apr-2010 jsg

Disable builtin malloc and log2 on gcc3 arches, a no-op for gcc3
but required for gcc4.

ok kettenis@ deraadt@ marco@, log2 suggested by robert@


# 1.23 27-Apr-2010 deraadt

a bit more unification to the arm way of doing this


# 1.22 27-Apr-2010 deraadt

shorten preamble


# 1.21 27-Apr-2010 deraadt

No need for a specific .SUFFIXES list; ok drahn


# 1.20 27-Apr-2010 deraadt

noone needs comments about QUOTA and TRACE


# 1.19 27-Apr-2010 deraadt

over the years we have moved to a machine+architectures scheme that has
two directories. in reality, because of how we place files, it has four:
.../arch/A, .../arch/A/A, .../arch/M, and .../arch/M/M
formalize this A/A and M/M scheme directly in the Makefiles, which makes
them a lot more similar
drahn likes the idea a lot


# 1.18 27-Apr-2010 deraadt

use -f assymp.dep again; worked out with miod


# 1.17 27-Apr-2010 deraadt

alpha/conf/Makefile.alpha


# 1.16 26-Apr-2010 deraadt

even cleaner mach/arch/machdir/archdir


# 1.15 26-Apr-2010 deraadt

next step towards unification: make all the genassym chunks handle both
arch and machine dependent files (and add the missing files)
ok miod drahn


# 1.14 26-Apr-2010 deraadt

next unification step: move all MD naming _mach, _machdir, _arch, and _archdir
ok miod drahn


# 1.13 26-Apr-2010 deraadt

first step of unification: spaces at end of lines; comments, etc.
ok miod


Revision tags: OPENBSD_4_7_BASE
# 1.12 19-Oct-2009 guenther

Correct a target name so that we don't rebuild vers.o (and then
bsd) unless some other object has changed. Rebuild and reinstall
in /usr/src/usr.sbin/config/ after updating!

"I like it" deraadt@


# 1.11 09-Aug-2009 miod

Introduce option DDB_STRUCT. Kernels compiled with this option (except on
a few arches where toolchain limitations apply) will embed some symbolic
information about the various structs used within the kernel, and have
new ddb commands allowing struct display and some useful information
gathering. Kernel rodata increase varies accross platforms from ~150KB to
~300KB.
This option is not enabled by default.


# 1.10 09-Aug-2009 miod

No need to clean genassym{.,o} during `make clean', genassym.sh does this
for us.


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.9 11-Jan-2009 pirofti

Fix a sed bug in the makefile's depend target.

What happened was that the output of mkdep was fed to a sed expression
that trimmed a bit more than required and also failed to work when
attempting to do make depend with pcc.

Example:

genassym_c.o: /tmp/genassym.whatever ../../../../../sys/param.h \

was changed to:

assym.h: \

but what was intended was:

assym.h: ../../../../../sys/param.h \

For the pcc -M output things were a bit different and after the make
depend the genassym entry would still remain and make would fail. This
affected all platforms except amd64 and sgi.

Okay miod@.


Revision tags: OPENBSD_4_4_BASE
# 1.8 12-Apr-2008 miod

Compile kernels with -Wvariable-decl (except on arches with ipmi, for now).


Revision tags: OPENBSD_4_3_BASE
# 1.7 30-Nov-2007 miod

Define NORMAL_C_NOP everywhere.


# 1.6 25-Nov-2007 deraadt

libkern, begone. Move to a new mechanism where config(8)'s "file"
directive can select between MI and MD versions of these files. At
the same time, adjust the boot programs to pick exactly what they need,
instead of the 7 or 8 mechanisms previously used.

There will be some fallout from this, but testing it all by myself is a
ridiculously slow process; it will be finished in-tree.

Various developers were very nice and avoided making fun of me when I
was gibbering in the corner..


# 1.5 25-Nov-2007 deraadt

Get rid of the kernel 'libcompat' framework, and instead use conf/files to
decide which files must be pulled into the kernel. Also conditionalize
the pulling of those files based on the COMPAT_* options.


Revision tags: OPENBSD_4_2_BASE
# 1.4 30-Jul-2007 thib

Shuffle the order in which we look for header files, when doing
kernel builds locally this doesnt change much but over NFS this
cuts about 12% of the build time on my setup (i386).

OK miod@, deraadt@.


Revision tags: OPENBSD_4_1_BASE
# 1.3 06-Oct-2006 miod

Remove explicit -fno-stack-protector now that the compiler workaround is in
place.


# 1.2 06-Oct-2006 mickey

w/ help of netbsd srcs and some mother unzel made it lift off


# 1.1 06-Oct-2006 miod

branches: 1.1.1;
Initial revision


# 1.79 25-Apr-2019 deraadt

disable -Oz compile for SMALL_KERNEL w/ comment why


# 1.78 14-Apr-2019 deraadt

Instead of using COPTS=-Oz (and similar) in make environment to force
tightly-built ramdisk kernels, set the option in per-arch Makefile.inc
based upon SMALL_KERNEL


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.77 09-Feb-2018 tb

Check for the existence of /bsd before trying to back it up to /obsd.
Fixes 'make install' when /bsd is not present for some reason.

ok rob florian, "fine with me" deraadt


# 1.76 04-Nov-2017 florian

Since rev 1.502 of rc(8) it creates a /bsd.booted hard link. At the
end of rc we call reorder_kernel which creates a /obsd hard link to
the same kernel.
In the past obsd was only created when doing a manual make install in
the kernel sources.
There is no need for two backup hard links during boot, rearange the
kernel Makefiles to restore previous behaviour and thus stopping
reorder_kernel from scribbling over /obsd.

Makes muscle memory of some kernel developers work again: /obsd can
serve as a known good kernel; and there was much rejoycing...

Discussed at length with benno, rpe, phessler and tb at
p2k17.

Seems like a good idea to deraadt.

OK benno, phessler, rpe, tb


Revision tags: OPENBSD_6_2_BASE
# 1.75 28-Sep-2017 patrick

When option DDB_STRUCTINFO was removed from the kernel, too much from
the kernel makefiles was removed which lead to C files not being re-
compiled when a dependency changed. This can lead to panics in odd
places and generally a broken system.

ok deraadt@


# 1.74 12-Sep-2017 mpi

Remove option DDB_STRUCTINFO. Now that ddb(4) is CTF aware, similar
functionnalities are available in GENERIC.

ok jasper@, deraadt@, guenther@, dlg@


# 1.73 12-Aug-2017 mpi

Use ctfstrip(1) by default to strip kernels.

ok deraadt@, jasper@


# 1.72 18-Jul-2017 tb

Stop automatically regenerating gap.o (and hence linking a new kernel)
whenever make is issued. Only do this when there are actual source changes
below /sys. This restores the behavior prior to the KARL implementation.

Problem noticed and patiently explained by mpi
implementation with a lot of help from espie

ok mpi, espie, deraadt


# 1.71 16-Jul-2017 visa

Pass the linker from make environment to makegap.sh. This is (only)
a partial solution to cross compiling the kernel with KARL.

OK deraadt@ a while ago


# 1.70 29-Jun-2017 espie

put SYSTEM_SWAP_DEP out of its misery, it died in 1997, along with config.old
"go for it" deraadt@


# 1.69 25-Jun-2017 deraadt

dull dependency for copying makegap.sh to obj, so that installs
without src and comp work. That is what we've designed for, but since
we always have src and comp on our systems it is so easy to slide...
problem first noted by rpe.


# 1.68 22-Jun-2017 deraadt

Generate a gap.link script, and use that to generate gap.o. On multi-ABI
architectures we must also link against a gapdummy.o to repair the ABI
of the resulting .o file. Woe is me.
Also repair install: target to update the linkkit & hash when a kernel
is installed.
ok rpe tb mlarkin and tested by others also


# 1.67 13-Jun-2017 deraadt

newbsd: target which re-links a kernel. We cannot use the bsd: target
since it has source dependencies, and relinking doesn't have any. Also
the bsd: target is created by config(8)...
worked on with rpe.


# 1.66 13-Jun-2017 deraadt

needs a fake ld.script for KARL tooling


# 1.65 11-Jun-2017 deraadt

make vers.o not depend on gap.o using a trick, because it is piece of
fiction participating only in the linkphase.
tricks from rpe and espie


# 1.64 11-Jun-2017 bluhm

Use umask 077 instead of cp -p when installing the kernel as root.
Otherwise owner of /bsd could be the build user with permissions
inherited from the compile directory.
OK deraadt@ tb@


# 1.63 08-Jun-2017 deraadt

Split early startup code out of locore.S into locore0.S. Adjust link
run so that this locore0.o is always at the start of the executable.
But randomize the link order of all other .o files in the kernel, so
that their exec/rodata/data/bss segments land all over the place.

I haven't worked on the unmap/smashing of the startup code yet.


# 1.62 03-Jun-2017 deraadt

Create gap.S and gap.o with umask 077. Create lorder and bsd* with umask 007.
Prying eyes cannot look at the kernels in the compile directory.
ok tb rpe, kernel developers seem unimpacted


Revision tags: OPENBSD_6_1_BASE
# 1.61 29-Nov-2016 mpi

Build kernel with DEBUG=-g by default.

This will allow us to extract type informations from DWARF2 sections. It
also makes developer life easier as debug information are now included in
every object.

Resulting kernels will be stripped using strip(1) instead of ld(1).

Kernel build time increases by approximately 10%. However it is still
possible to disable this by defining DEBUG="".

ok kettenis@, bluhm@, natano@, jasper@, reyk@, deraadt@


# 1.60 15-Nov-2016 natano

Clean up the kernel Makefile's:

- Remove the 'lint' target. lint has been removed with OpenBSD 5.2.
- Remove the 'tags' target. It does nothing of value.
- Replace 'clean::' with 'clean:', as requested by espie and millert,
and remove files from the 'clean' target, that are never generated.
- Don't create a file called 'depend' in 'make depend', but just do
nothing instead.

ok mpi tb


# 1.59 27-Oct-2016 natano

We don't generate an eddep script for kernel builds nowadays. The last
reference to eddep in the kernel Makefile I could find is in 4.3BSD,
released some 30 years ago.

ok tb millert


# 1.58 24-Oct-2016 deraadt

make cleandir should skip the version file; ok otto millert


# 1.57 15-Oct-2016 deraadt

cleandir: target for kernel compile directories
ok natano


# 1.56 14-Oct-2016 deraadt

Kernel builds now happen in compile/CONFIG/obj@ -> /usr/obj/... [or ./obj/,
if srctree is not rooted at /usr/src]. As a result, stock GENERIC & RAMDISK
kernels are commited to the tree, to ensure the src tree can be "readonly"
during builds, with all writes occuring inside the obj space. config -b
options are handled by ../Makefile.inc. The canonical new way to configure
one of these kernels is:
% cd /sys/arch/amd64/compile/GENERIC.MP
% doas make obj
% make config
% make
% doas cp obj/bsd /bsd
The build infrastructure will use this new mechanism in a de-escalation
way using BUILDUSER.
Much help from natano and tb.


# 1.55 24-Sep-2016 kettenis

Add -Wno-pointer-sign to all our gcc4 architectures.

ok patrick@ (for armv7), deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.54 29-Apr-2016 mpi

Do not remove local symbols from the table.

ddb(4) can now see static functions. That doesn't mean we should start
declaring functions as ``static'', however it helps for the few existing
exceptions.

ok deraadt@, kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.53 13-Jan-2015 deraadt

for the install: target, use cmp as a rough attempt for avoiding repeated
make install
from Simon Nicolussi
ok jsing tedu


# 1.52 11-Jan-2015 tedu

switch prototype warnings to implicit-declaration warnings.
This should catch all the same bad cases, but be a little less aggravating
in circumstances where a prototype isn't necessary
ok deraadt


# 1.51 04-Oct-2014 brad

Switch the kernel configs over to using -Wframe-larger-than= instead of
-Wstack-larger-than-. This is what modern GCC supports as well as LLVM.

ok miod@


Revision tags: OPENBSD_5_6_BASE
# 1.50 08-May-2014 miod

Format string fixes and removal of -Wno-format for landisk kernels


Revision tags: OPENBSD_5_5_BASE
# 1.49 15-Oct-2013 guenther

Rewrite the awk script that generates the data for option DDB_STRUCT:
- switch to perl for better data structures and (thus) speed
- fix a couple glitches in the interpretation of the stabs output
- compress the strings by putting them in one big array and overlaying
suffixes
- all sizes and offsets are <64k, so use u_short for them
This results in ~60% reduction in the resulting text size and it now
takes less than a second to create on fast platforms.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.48 23-Jun-2013 miod

Stop using -traditional-cpp on gcc3/4 platforms.

Add CWARNFLAGS to the command line when using -xassembler-with-cpp. We are
mostly interested in -Werror here.


# 1.47 30-Mar-2013 tedu

reorder include search directories. cuts lookups by quite a bit.
ok deraadt miod


Revision tags: OPENBSD_5_3_BASE
# 1.46 28-Aug-2012 pascal

Add -nopie to LINKFLAGS on ELF architectures. Note that this needs an
updated gcc and ld to understand the new -nopie flag.

ok deraadt@


# 1.45 22-Aug-2012 pascal

Build the kernel with -fno-pie. Just getting Ms out of my tree; this will be
cleaned up later.

ok deraadt@


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.44 08-Nov-2011 matthieu

Garbage collect now unused MKDEP definitions. ok deraadt@


Revision tags: OPENBSD_5_0_BASE
# 1.43 07-Jul-2011 guenther

The drahn memorial bad kernel build fix: prevent blood pressure
spikes in other developers by making it so that removal of a .d
file without removing the corresponding object will result in the
latter being treated as out of date.

ok beck@ art@ drahn@


# 1.42 06-Jul-2011 tedu

make clean should clean .d files, so as to leave a fresh canvas.
ok beck deraadt


# 1.41 15-Apr-2011 guenther

Convert the kernel Makefiles to autogenerate dependencies during compilation
using the -MD option to cc, with -MP, -MT, and -MF where needed, converting
"make depend" to a no-op. This increases parallelism for those using "make -j"
and keeps the dependencies up to date with each compilation automatically.

sparc and vax users will need to rebuild gcc with support for the
-M[PTF] options before config'ing with this diff.


Revision tags: OPENBSD_4_9_BASE
# 1.40 30-Dec-2010 deraadt

If genassym fails, sort on the pipeline will indicate no error resulting
in some grief. Split this out.
From Vladimir Kirillov


# 1.39 02-Dec-2010 deraadt

After the most recent change, make it possible to make -j again. The
early MD and late MI files must be split up so that vers.o can sneak
between. Issue spotted by bluhm, repair discussed with miod


# 1.38 02-Dec-2010 deraadt

move vers.o to before the other objects, so that it is not linked last.
having it linked last is bad (on at least i386 and amd64) because the lapic
is mapped over the start of the data segment -- savecore(8) then reads the
version string for a fixed buffer space, and reads into the lapic area
causing unintended side-effects (at least on Intel X5570 and X5680)
found by pedro, discussed with kettenis and mpf and miod


# 1.37 06-Sep-2010 jsg

move away from using /**/ to ## for cpp paste in sh locore
so we can drop -traditional-cpp
ok miod@


Revision tags: OPENBSD_4_8_BASE
# 1.36 01-Jun-2010 deraadt

use --warn-common for linking (some arch's will show new warnings), and
prefer binutils-compatible options in STRIPFLAGS (now that our non-binutils
strip(1) can handle them too)
ok drahn; miod kettenis (for parts)


# 1.35 28-May-2010 guenther

${PARAM} is now included in ${CPPFLAGS}, so stop passing it separately
to genassym.sh

ok deraadt


# 1.34 25-May-2010 deraadt

The _arch and _mach variables now come from config(8), decreasing even further
the differences between these files. You will need a newer config(8) binary
to be able to build kernels.
ok kettenis miod


# 1.33 25-May-2010 deraadt

Hand-list the two-step assym.h -> .[Ss] -> .o dependencies. The
result: kernels built without 'make depend'-provided information
(ie. the .depend file) are more likely to have their *.[Ss] file
compilations track changes to *.h files.

The "*.o: assym.h" dependencies listed are gotten from reading the
.depend output --- from the biggest kernel possible (ie. GENERIC.MP).
When an architecture changes in a substantial way (new .[sS] files),
the list should be updated in the prettiest way possible.

This is not encouraging people to skip 'make depend'; other issues are
not resolved and may be solved later with a change guenther is working
on. You can still screwed really easily, so continue running make
depend as config tells you.

Idea from a discussion with drahn
ok drahn, kettenis likes the idea too


# 1.32 25-May-2010 deraadt

${SRCS} is only used once, and fits onto the line where it is used
idea that came out of discussion with drahn


# 1.31 24-May-2010 deraadt

give up on -Wvariable-decl
delete the archaic links: target which is easily misused
handle special .[sS] files in a portable way


# 1.30 24-May-2010 deraadt

Unify the dependency time check for whether an architecture has SFILES


# 1.29 24-May-2010 deraadt

Reduce differences between the Makefile.* files for all architectures.
ok various people, tested by fewer people, tested by me on 15.


# 1.28 23-May-2010 deraadt

Does not need -Dlandisk, and instead, but -Dlandisk is nice since that is
the mach (arch is sh). Also move towards passing $PARAM around in CPPFLAGS,
instead of compiling param.c in a special way, as discussed with miod


# 1.27 28-Apr-2010 deraadt

clean up more more subtle and stupid differences between the various
Makefile.* files


# 1.26 27-Apr-2010 drahn

Killing a few more diffs for theo, arm makes #LINKFLAGS, beagle cleanup,
INCLUDE= common.


# 1.25 27-Apr-2010 deraadt

Unifity CPPFLAGS= (using ${_mach}), SYSTEM_LD_TAIL= (always on one line),
and SRCS= (common files always after the \)


# 1.24 27-Apr-2010 jsg

Disable builtin malloc and log2 on gcc3 arches, a no-op for gcc3
but required for gcc4.

ok kettenis@ deraadt@ marco@, log2 suggested by robert@


# 1.23 27-Apr-2010 deraadt

a bit more unification to the arm way of doing this


# 1.22 27-Apr-2010 deraadt

shorten preamble


# 1.21 27-Apr-2010 deraadt

No need for a specific .SUFFIXES list; ok drahn


# 1.20 27-Apr-2010 deraadt

noone needs comments about QUOTA and TRACE


# 1.19 27-Apr-2010 deraadt

over the years we have moved to a machine+architectures scheme that has
two directories. in reality, because of how we place files, it has four:
.../arch/A, .../arch/A/A, .../arch/M, and .../arch/M/M
formalize this A/A and M/M scheme directly in the Makefiles, which makes
them a lot more similar
drahn likes the idea a lot


# 1.18 27-Apr-2010 deraadt

use -f assymp.dep again; worked out with miod


# 1.17 27-Apr-2010 deraadt

alpha/conf/Makefile.alpha


# 1.16 26-Apr-2010 deraadt

even cleaner mach/arch/machdir/archdir


# 1.15 26-Apr-2010 deraadt

next step towards unification: make all the genassym chunks handle both
arch and machine dependent files (and add the missing files)
ok miod drahn


# 1.14 26-Apr-2010 deraadt

next unification step: move all MD naming _mach, _machdir, _arch, and _archdir
ok miod drahn


# 1.13 26-Apr-2010 deraadt

first step of unification: spaces at end of lines; comments, etc.
ok miod


Revision tags: OPENBSD_4_7_BASE
# 1.12 19-Oct-2009 guenther

Correct a target name so that we don't rebuild vers.o (and then
bsd) unless some other object has changed. Rebuild and reinstall
in /usr/src/usr.sbin/config/ after updating!

"I like it" deraadt@


# 1.11 09-Aug-2009 miod

Introduce option DDB_STRUCT. Kernels compiled with this option (except on
a few arches where toolchain limitations apply) will embed some symbolic
information about the various structs used within the kernel, and have
new ddb commands allowing struct display and some useful information
gathering. Kernel rodata increase varies accross platforms from ~150KB to
~300KB.
This option is not enabled by default.


# 1.10 09-Aug-2009 miod

No need to clean genassym{.,o} during `make clean', genassym.sh does this
for us.


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.9 11-Jan-2009 pirofti

Fix a sed bug in the makefile's depend target.

What happened was that the output of mkdep was fed to a sed expression
that trimmed a bit more than required and also failed to work when
attempting to do make depend with pcc.

Example:

genassym_c.o: /tmp/genassym.whatever ../../../../../sys/param.h \

was changed to:

assym.h: \

but what was intended was:

assym.h: ../../../../../sys/param.h \

For the pcc -M output things were a bit different and after the make
depend the genassym entry would still remain and make would fail. This
affected all platforms except amd64 and sgi.

Okay miod@.


Revision tags: OPENBSD_4_4_BASE
# 1.8 12-Apr-2008 miod

Compile kernels with -Wvariable-decl (except on arches with ipmi, for now).


Revision tags: OPENBSD_4_3_BASE
# 1.7 30-Nov-2007 miod

Define NORMAL_C_NOP everywhere.


# 1.6 25-Nov-2007 deraadt

libkern, begone. Move to a new mechanism where config(8)'s "file"
directive can select between MI and MD versions of these files. At
the same time, adjust the boot programs to pick exactly what they need,
instead of the 7 or 8 mechanisms previously used.

There will be some fallout from this, but testing it all by myself is a
ridiculously slow process; it will be finished in-tree.

Various developers were very nice and avoided making fun of me when I
was gibbering in the corner..


# 1.5 25-Nov-2007 deraadt

Get rid of the kernel 'libcompat' framework, and instead use conf/files to
decide which files must be pulled into the kernel. Also conditionalize
the pulling of those files based on the COMPAT_* options.


Revision tags: OPENBSD_4_2_BASE
# 1.4 30-Jul-2007 thib

Shuffle the order in which we look for header files, when doing
kernel builds locally this doesnt change much but over NFS this
cuts about 12% of the build time on my setup (i386).

OK miod@, deraadt@.


Revision tags: OPENBSD_4_1_BASE
# 1.3 06-Oct-2006 miod

Remove explicit -fno-stack-protector now that the compiler workaround is in
place.


# 1.2 06-Oct-2006 mickey

w/ help of netbsd srcs and some mother unzel made it lift off


# 1.1 06-Oct-2006 miod

branches: 1.1.1;
Initial revision


# 1.77 09-Feb-2018 tb

Check for the existence of /bsd before trying to back it up to /obsd.
Fixes 'make install' when /bsd is not present for some reason.

ok rob florian, "fine with me" deraadt


# 1.76 04-Nov-2017 florian

Since rev 1.502 of rc(8) it creates a /bsd.booted hard link. At the
end of rc we call reorder_kernel which creates a /obsd hard link to
the same kernel.
In the past obsd was only created when doing a manual make install in
the kernel sources.
There is no need for two backup hard links during boot, rearange the
kernel Makefiles to restore previous behaviour and thus stopping
reorder_kernel from scribbling over /obsd.

Makes muscle memory of some kernel developers work again: /obsd can
serve as a known good kernel; and there was much rejoycing...

Discussed at length with benno, rpe, phessler and tb at
p2k17.

Seems like a good idea to deraadt.

OK benno, phessler, rpe, tb


Revision tags: OPENBSD_6_2_BASE
# 1.75 28-Sep-2017 patrick

When option DDB_STRUCTINFO was removed from the kernel, too much from
the kernel makefiles was removed which lead to C files not being re-
compiled when a dependency changed. This can lead to panics in odd
places and generally a broken system.

ok deraadt@


# 1.74 12-Sep-2017 mpi

Remove option DDB_STRUCTINFO. Now that ddb(4) is CTF aware, similar
functionnalities are available in GENERIC.

ok jasper@, deraadt@, guenther@, dlg@


# 1.73 12-Aug-2017 mpi

Use ctfstrip(1) by default to strip kernels.

ok deraadt@, jasper@


# 1.72 18-Jul-2017 tb

Stop automatically regenerating gap.o (and hence linking a new kernel)
whenever make is issued. Only do this when there are actual source changes
below /sys. This restores the behavior prior to the KARL implementation.

Problem noticed and patiently explained by mpi
implementation with a lot of help from espie

ok mpi, espie, deraadt


# 1.71 16-Jul-2017 visa

Pass the linker from make environment to makegap.sh. This is (only)
a partial solution to cross compiling the kernel with KARL.

OK deraadt@ a while ago


# 1.70 29-Jun-2017 espie

put SYSTEM_SWAP_DEP out of its misery, it died in 1997, along with config.old
"go for it" deraadt@


# 1.69 25-Jun-2017 deraadt

dull dependency for copying makegap.sh to obj, so that installs
without src and comp work. That is what we've designed for, but since
we always have src and comp on our systems it is so easy to slide...
problem first noted by rpe.


# 1.68 22-Jun-2017 deraadt

Generate a gap.link script, and use that to generate gap.o. On multi-ABI
architectures we must also link against a gapdummy.o to repair the ABI
of the resulting .o file. Woe is me.
Also repair install: target to update the linkkit & hash when a kernel
is installed.
ok rpe tb mlarkin and tested by others also


# 1.67 13-Jun-2017 deraadt

newbsd: target which re-links a kernel. We cannot use the bsd: target
since it has source dependencies, and relinking doesn't have any. Also
the bsd: target is created by config(8)...
worked on with rpe.


# 1.66 13-Jun-2017 deraadt

needs a fake ld.script for KARL tooling


# 1.65 11-Jun-2017 deraadt

make vers.o not depend on gap.o using a trick, because it is piece of
fiction participating only in the linkphase.
tricks from rpe and espie


# 1.64 11-Jun-2017 bluhm

Use umask 077 instead of cp -p when installing the kernel as root.
Otherwise owner of /bsd could be the build user with permissions
inherited from the compile directory.
OK deraadt@ tb@


# 1.63 08-Jun-2017 deraadt

Split early startup code out of locore.S into locore0.S. Adjust link
run so that this locore0.o is always at the start of the executable.
But randomize the link order of all other .o files in the kernel, so
that their exec/rodata/data/bss segments land all over the place.

I haven't worked on the unmap/smashing of the startup code yet.


# 1.62 03-Jun-2017 deraadt

Create gap.S and gap.o with umask 077. Create lorder and bsd* with umask 007.
Prying eyes cannot look at the kernels in the compile directory.
ok tb rpe, kernel developers seem unimpacted


Revision tags: OPENBSD_6_1_BASE
# 1.61 29-Nov-2016 mpi

Build kernel with DEBUG=-g by default.

This will allow us to extract type informations from DWARF2 sections. It
also makes developer life easier as debug information are now included in
every object.

Resulting kernels will be stripped using strip(1) instead of ld(1).

Kernel build time increases by approximately 10%. However it is still
possible to disable this by defining DEBUG="".

ok kettenis@, bluhm@, natano@, jasper@, reyk@, deraadt@


# 1.60 15-Nov-2016 natano

Clean up the kernel Makefile's:

- Remove the 'lint' target. lint has been removed with OpenBSD 5.2.
- Remove the 'tags' target. It does nothing of value.
- Replace 'clean::' with 'clean:', as requested by espie and millert,
and remove files from the 'clean' target, that are never generated.
- Don't create a file called 'depend' in 'make depend', but just do
nothing instead.

ok mpi tb


# 1.59 27-Oct-2016 natano

We don't generate an eddep script for kernel builds nowadays. The last
reference to eddep in the kernel Makefile I could find is in 4.3BSD,
released some 30 years ago.

ok tb millert


# 1.58 24-Oct-2016 deraadt

make cleandir should skip the version file; ok otto millert


# 1.57 15-Oct-2016 deraadt

cleandir: target for kernel compile directories
ok natano


# 1.56 14-Oct-2016 deraadt

Kernel builds now happen in compile/CONFIG/obj@ -> /usr/obj/... [or ./obj/,
if srctree is not rooted at /usr/src]. As a result, stock GENERIC & RAMDISK
kernels are commited to the tree, to ensure the src tree can be "readonly"
during builds, with all writes occuring inside the obj space. config -b
options are handled by ../Makefile.inc. The canonical new way to configure
one of these kernels is:
% cd /sys/arch/amd64/compile/GENERIC.MP
% doas make obj
% make config
% make
% doas cp obj/bsd /bsd
The build infrastructure will use this new mechanism in a de-escalation
way using BUILDUSER.
Much help from natano and tb.


# 1.55 24-Sep-2016 kettenis

Add -Wno-pointer-sign to all our gcc4 architectures.

ok patrick@ (for armv7), deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.54 29-Apr-2016 mpi

Do not remove local symbols from the table.

ddb(4) can now see static functions. That doesn't mean we should start
declaring functions as ``static'', however it helps for the few existing
exceptions.

ok deraadt@, kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.53 13-Jan-2015 deraadt

for the install: target, use cmp as a rough attempt for avoiding repeated
make install
from Simon Nicolussi
ok jsing tedu


# 1.52 11-Jan-2015 tedu

switch prototype warnings to implicit-declaration warnings.
This should catch all the same bad cases, but be a little less aggravating
in circumstances where a prototype isn't necessary
ok deraadt


# 1.51 04-Oct-2014 brad

Switch the kernel configs over to using -Wframe-larger-than= instead of
-Wstack-larger-than-. This is what modern GCC supports as well as LLVM.

ok miod@


Revision tags: OPENBSD_5_6_BASE
# 1.50 08-May-2014 miod

Format string fixes and removal of -Wno-format for landisk kernels


Revision tags: OPENBSD_5_5_BASE
# 1.49 15-Oct-2013 guenther

Rewrite the awk script that generates the data for option DDB_STRUCT:
- switch to perl for better data structures and (thus) speed
- fix a couple glitches in the interpretation of the stabs output
- compress the strings by putting them in one big array and overlaying
suffixes
- all sizes and offsets are <64k, so use u_short for them
This results in ~60% reduction in the resulting text size and it now
takes less than a second to create on fast platforms.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.48 23-Jun-2013 miod

Stop using -traditional-cpp on gcc3/4 platforms.

Add CWARNFLAGS to the command line when using -xassembler-with-cpp. We are
mostly interested in -Werror here.


# 1.47 30-Mar-2013 tedu

reorder include search directories. cuts lookups by quite a bit.
ok deraadt miod


Revision tags: OPENBSD_5_3_BASE
# 1.46 28-Aug-2012 pascal

Add -nopie to LINKFLAGS on ELF architectures. Note that this needs an
updated gcc and ld to understand the new -nopie flag.

ok deraadt@


# 1.45 22-Aug-2012 pascal

Build the kernel with -fno-pie. Just getting Ms out of my tree; this will be
cleaned up later.

ok deraadt@


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.44 08-Nov-2011 matthieu

Garbage collect now unused MKDEP definitions. ok deraadt@


Revision tags: OPENBSD_5_0_BASE
# 1.43 07-Jul-2011 guenther

The drahn memorial bad kernel build fix: prevent blood pressure
spikes in other developers by making it so that removal of a .d
file without removing the corresponding object will result in the
latter being treated as out of date.

ok beck@ art@ drahn@


# 1.42 06-Jul-2011 tedu

make clean should clean .d files, so as to leave a fresh canvas.
ok beck deraadt


# 1.41 15-Apr-2011 guenther

Convert the kernel Makefiles to autogenerate dependencies during compilation
using the -MD option to cc, with -MP, -MT, and -MF where needed, converting
"make depend" to a no-op. This increases parallelism for those using "make -j"
and keeps the dependencies up to date with each compilation automatically.

sparc and vax users will need to rebuild gcc with support for the
-M[PTF] options before config'ing with this diff.


Revision tags: OPENBSD_4_9_BASE
# 1.40 30-Dec-2010 deraadt

If genassym fails, sort on the pipeline will indicate no error resulting
in some grief. Split this out.
From Vladimir Kirillov


# 1.39 02-Dec-2010 deraadt

After the most recent change, make it possible to make -j again. The
early MD and late MI files must be split up so that vers.o can sneak
between. Issue spotted by bluhm, repair discussed with miod


# 1.38 02-Dec-2010 deraadt

move vers.o to before the other objects, so that it is not linked last.
having it linked last is bad (on at least i386 and amd64) because the lapic
is mapped over the start of the data segment -- savecore(8) then reads the
version string for a fixed buffer space, and reads into the lapic area
causing unintended side-effects (at least on Intel X5570 and X5680)
found by pedro, discussed with kettenis and mpf and miod


# 1.37 06-Sep-2010 jsg

move away from using /**/ to ## for cpp paste in sh locore
so we can drop -traditional-cpp
ok miod@


Revision tags: OPENBSD_4_8_BASE
# 1.36 01-Jun-2010 deraadt

use --warn-common for linking (some arch's will show new warnings), and
prefer binutils-compatible options in STRIPFLAGS (now that our non-binutils
strip(1) can handle them too)
ok drahn; miod kettenis (for parts)


# 1.35 28-May-2010 guenther

${PARAM} is now included in ${CPPFLAGS}, so stop passing it separately
to genassym.sh

ok deraadt


# 1.34 25-May-2010 deraadt

The _arch and _mach variables now come from config(8), decreasing even further
the differences between these files. You will need a newer config(8) binary
to be able to build kernels.
ok kettenis miod


# 1.33 25-May-2010 deraadt

Hand-list the two-step assym.h -> .[Ss] -> .o dependencies. The
result: kernels built without 'make depend'-provided information
(ie. the .depend file) are more likely to have their *.[Ss] file
compilations track changes to *.h files.

The "*.o: assym.h" dependencies listed are gotten from reading the
.depend output --- from the biggest kernel possible (ie. GENERIC.MP).
When an architecture changes in a substantial way (new .[sS] files),
the list should be updated in the prettiest way possible.

This is not encouraging people to skip 'make depend'; other issues are
not resolved and may be solved later with a change guenther is working
on. You can still screwed really easily, so continue running make
depend as config tells you.

Idea from a discussion with drahn
ok drahn, kettenis likes the idea too


# 1.32 25-May-2010 deraadt

${SRCS} is only used once, and fits onto the line where it is used
idea that came out of discussion with drahn


# 1.31 24-May-2010 deraadt

give up on -Wvariable-decl
delete the archaic links: target which is easily misused
handle special .[sS] files in a portable way


# 1.30 24-May-2010 deraadt

Unify the dependency time check for whether an architecture has SFILES


# 1.29 24-May-2010 deraadt

Reduce differences between the Makefile.* files for all architectures.
ok various people, tested by fewer people, tested by me on 15.


# 1.28 23-May-2010 deraadt

Does not need -Dlandisk, and instead, but -Dlandisk is nice since that is
the mach (arch is sh). Also move towards passing $PARAM around in CPPFLAGS,
instead of compiling param.c in a special way, as discussed with miod


# 1.27 28-Apr-2010 deraadt

clean up more more subtle and stupid differences between the various
Makefile.* files


# 1.26 27-Apr-2010 drahn

Killing a few more diffs for theo, arm makes #LINKFLAGS, beagle cleanup,
INCLUDE= common.


# 1.25 27-Apr-2010 deraadt

Unifity CPPFLAGS= (using ${_mach}), SYSTEM_LD_TAIL= (always on one line),
and SRCS= (common files always after the \)


# 1.24 27-Apr-2010 jsg

Disable builtin malloc and log2 on gcc3 arches, a no-op for gcc3
but required for gcc4.

ok kettenis@ deraadt@ marco@, log2 suggested by robert@


# 1.23 27-Apr-2010 deraadt

a bit more unification to the arm way of doing this


# 1.22 27-Apr-2010 deraadt

shorten preamble


# 1.21 27-Apr-2010 deraadt

No need for a specific .SUFFIXES list; ok drahn


# 1.20 27-Apr-2010 deraadt

noone needs comments about QUOTA and TRACE


# 1.19 27-Apr-2010 deraadt

over the years we have moved to a machine+architectures scheme that has
two directories. in reality, because of how we place files, it has four:
.../arch/A, .../arch/A/A, .../arch/M, and .../arch/M/M
formalize this A/A and M/M scheme directly in the Makefiles, which makes
them a lot more similar
drahn likes the idea a lot


# 1.18 27-Apr-2010 deraadt

use -f assymp.dep again; worked out with miod


# 1.17 27-Apr-2010 deraadt

alpha/conf/Makefile.alpha


# 1.16 26-Apr-2010 deraadt

even cleaner mach/arch/machdir/archdir


# 1.15 26-Apr-2010 deraadt

next step towards unification: make all the genassym chunks handle both
arch and machine dependent files (and add the missing files)
ok miod drahn


# 1.14 26-Apr-2010 deraadt

next unification step: move all MD naming _mach, _machdir, _arch, and _archdir
ok miod drahn


# 1.13 26-Apr-2010 deraadt

first step of unification: spaces at end of lines; comments, etc.
ok miod


Revision tags: OPENBSD_4_7_BASE
# 1.12 19-Oct-2009 guenther

Correct a target name so that we don't rebuild vers.o (and then
bsd) unless some other object has changed. Rebuild and reinstall
in /usr/src/usr.sbin/config/ after updating!

"I like it" deraadt@


# 1.11 09-Aug-2009 miod

Introduce option DDB_STRUCT. Kernels compiled with this option (except on
a few arches where toolchain limitations apply) will embed some symbolic
information about the various structs used within the kernel, and have
new ddb commands allowing struct display and some useful information
gathering. Kernel rodata increase varies accross platforms from ~150KB to
~300KB.
This option is not enabled by default.


# 1.10 09-Aug-2009 miod

No need to clean genassym{.,o} during `make clean', genassym.sh does this
for us.


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.9 11-Jan-2009 pirofti

Fix a sed bug in the makefile's depend target.

What happened was that the output of mkdep was fed to a sed expression
that trimmed a bit more than required and also failed to work when
attempting to do make depend with pcc.

Example:

genassym_c.o: /tmp/genassym.whatever ../../../../../sys/param.h \

was changed to:

assym.h: \

but what was intended was:

assym.h: ../../../../../sys/param.h \

For the pcc -M output things were a bit different and after the make
depend the genassym entry would still remain and make would fail. This
affected all platforms except amd64 and sgi.

Okay miod@.


Revision tags: OPENBSD_4_4_BASE
# 1.8 12-Apr-2008 miod

Compile kernels with -Wvariable-decl (except on arches with ipmi, for now).


Revision tags: OPENBSD_4_3_BASE
# 1.7 30-Nov-2007 miod

Define NORMAL_C_NOP everywhere.


# 1.6 25-Nov-2007 deraadt

libkern, begone. Move to a new mechanism where config(8)'s "file"
directive can select between MI and MD versions of these files. At
the same time, adjust the boot programs to pick exactly what they need,
instead of the 7 or 8 mechanisms previously used.

There will be some fallout from this, but testing it all by myself is a
ridiculously slow process; it will be finished in-tree.

Various developers were very nice and avoided making fun of me when I
was gibbering in the corner..


# 1.5 25-Nov-2007 deraadt

Get rid of the kernel 'libcompat' framework, and instead use conf/files to
decide which files must be pulled into the kernel. Also conditionalize
the pulling of those files based on the COMPAT_* options.


Revision tags: OPENBSD_4_2_BASE
# 1.4 30-Jul-2007 thib

Shuffle the order in which we look for header files, when doing
kernel builds locally this doesnt change much but over NFS this
cuts about 12% of the build time on my setup (i386).

OK miod@, deraadt@.


Revision tags: OPENBSD_4_1_BASE
# 1.3 06-Oct-2006 miod

Remove explicit -fno-stack-protector now that the compiler workaround is in
place.


# 1.2 06-Oct-2006 mickey

w/ help of netbsd srcs and some mother unzel made it lift off


# 1.1 06-Oct-2006 miod

branches: 1.1.1;
Initial revision


# 1.76 04-Nov-2017 florian

Since rev 1.502 of rc(8) it creates a /bsd.booted hard link. At the
end of rc we call reorder_kernel which creates a /obsd hard link to
the same kernel.
In the past obsd was only created when doing a manual make install in
the kernel sources.
There is no need for two backup hard links during boot, rearange the
kernel Makefiles to restore previous behaviour and thus stopping
reorder_kernel from scribbling over /obsd.

Makes muscle memory of some kernel developers work again: /obsd can
serve as a known good kernel; and there was much rejoycing...

Discussed at length with benno, rpe, phessler and tb at
p2k17.

Seems like a good idea to deraadt.

OK benno, phessler, rpe, tb


Revision tags: OPENBSD_6_2_BASE
# 1.75 28-Sep-2017 patrick

When option DDB_STRUCTINFO was removed from the kernel, too much from
the kernel makefiles was removed which lead to C files not being re-
compiled when a dependency changed. This can lead to panics in odd
places and generally a broken system.

ok deraadt@


# 1.74 12-Sep-2017 mpi

Remove option DDB_STRUCTINFO. Now that ddb(4) is CTF aware, similar
functionnalities are available in GENERIC.

ok jasper@, deraadt@, guenther@, dlg@


# 1.73 12-Aug-2017 mpi

Use ctfstrip(1) by default to strip kernels.

ok deraadt@, jasper@


# 1.72 18-Jul-2017 tb

Stop automatically regenerating gap.o (and hence linking a new kernel)
whenever make is issued. Only do this when there are actual source changes
below /sys. This restores the behavior prior to the KARL implementation.

Problem noticed and patiently explained by mpi
implementation with a lot of help from espie

ok mpi, espie, deraadt


# 1.71 16-Jul-2017 visa

Pass the linker from make environment to makegap.sh. This is (only)
a partial solution to cross compiling the kernel with KARL.

OK deraadt@ a while ago


# 1.70 29-Jun-2017 espie

put SYSTEM_SWAP_DEP out of its misery, it died in 1997, along with config.old
"go for it" deraadt@


# 1.69 25-Jun-2017 deraadt

dull dependency for copying makegap.sh to obj, so that installs
without src and comp work. That is what we've designed for, but since
we always have src and comp on our systems it is so easy to slide...
problem first noted by rpe.


# 1.68 22-Jun-2017 deraadt

Generate a gap.link script, and use that to generate gap.o. On multi-ABI
architectures we must also link against a gapdummy.o to repair the ABI
of the resulting .o file. Woe is me.
Also repair install: target to update the linkkit & hash when a kernel
is installed.
ok rpe tb mlarkin and tested by others also


# 1.67 13-Jun-2017 deraadt

newbsd: target which re-links a kernel. We cannot use the bsd: target
since it has source dependencies, and relinking doesn't have any. Also
the bsd: target is created by config(8)...
worked on with rpe.


# 1.66 13-Jun-2017 deraadt

needs a fake ld.script for KARL tooling


# 1.65 11-Jun-2017 deraadt

make vers.o not depend on gap.o using a trick, because it is piece of
fiction participating only in the linkphase.
tricks from rpe and espie


# 1.64 11-Jun-2017 bluhm

Use umask 077 instead of cp -p when installing the kernel as root.
Otherwise owner of /bsd could be the build user with permissions
inherited from the compile directory.
OK deraadt@ tb@


# 1.63 08-Jun-2017 deraadt

Split early startup code out of locore.S into locore0.S. Adjust link
run so that this locore0.o is always at the start of the executable.
But randomize the link order of all other .o files in the kernel, so
that their exec/rodata/data/bss segments land all over the place.

I haven't worked on the unmap/smashing of the startup code yet.


# 1.62 03-Jun-2017 deraadt

Create gap.S and gap.o with umask 077. Create lorder and bsd* with umask 007.
Prying eyes cannot look at the kernels in the compile directory.
ok tb rpe, kernel developers seem unimpacted


Revision tags: OPENBSD_6_1_BASE
# 1.61 29-Nov-2016 mpi

Build kernel with DEBUG=-g by default.

This will allow us to extract type informations from DWARF2 sections. It
also makes developer life easier as debug information are now included in
every object.

Resulting kernels will be stripped using strip(1) instead of ld(1).

Kernel build time increases by approximately 10%. However it is still
possible to disable this by defining DEBUG="".

ok kettenis@, bluhm@, natano@, jasper@, reyk@, deraadt@


# 1.60 15-Nov-2016 natano

Clean up the kernel Makefile's:

- Remove the 'lint' target. lint has been removed with OpenBSD 5.2.
- Remove the 'tags' target. It does nothing of value.
- Replace 'clean::' with 'clean:', as requested by espie and millert,
and remove files from the 'clean' target, that are never generated.
- Don't create a file called 'depend' in 'make depend', but just do
nothing instead.

ok mpi tb


# 1.59 27-Oct-2016 natano

We don't generate an eddep script for kernel builds nowadays. The last
reference to eddep in the kernel Makefile I could find is in 4.3BSD,
released some 30 years ago.

ok tb millert


# 1.58 24-Oct-2016 deraadt

make cleandir should skip the version file; ok otto millert


# 1.57 15-Oct-2016 deraadt

cleandir: target for kernel compile directories
ok natano


# 1.56 14-Oct-2016 deraadt

Kernel builds now happen in compile/CONFIG/obj@ -> /usr/obj/... [or ./obj/,
if srctree is not rooted at /usr/src]. As a result, stock GENERIC & RAMDISK
kernels are commited to the tree, to ensure the src tree can be "readonly"
during builds, with all writes occuring inside the obj space. config -b
options are handled by ../Makefile.inc. The canonical new way to configure
one of these kernels is:
% cd /sys/arch/amd64/compile/GENERIC.MP
% doas make obj
% make config
% make
% doas cp obj/bsd /bsd
The build infrastructure will use this new mechanism in a de-escalation
way using BUILDUSER.
Much help from natano and tb.


# 1.55 24-Sep-2016 kettenis

Add -Wno-pointer-sign to all our gcc4 architectures.

ok patrick@ (for armv7), deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.54 29-Apr-2016 mpi

Do not remove local symbols from the table.

ddb(4) can now see static functions. That doesn't mean we should start
declaring functions as ``static'', however it helps for the few existing
exceptions.

ok deraadt@, kettenis@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.53 13-Jan-2015 deraadt

for the install: target, use cmp as a rough attempt for avoiding repeated
make install
from Simon Nicolussi
ok jsing tedu


# 1.52 11-Jan-2015 tedu

switch prototype warnings to implicit-declaration warnings.
This should catch all the same bad cases, but be a little less aggravating
in circumstances where a prototype isn't necessary
ok deraadt


# 1.51 04-Oct-2014 brad

Switch the kernel configs over to using -Wframe-larger-than= instead of
-Wstack-larger-than-. This is what modern GCC supports as well as LLVM.

ok miod@


Revision tags: OPENBSD_5_6_BASE
# 1.50 08-May-2014 miod

Format string fixes and removal of -Wno-format for landisk kernels


Revision tags: OPENBSD_5_5_BASE
# 1.49 15-Oct-2013 guenther

Rewrite the awk script that generates the data for option DDB_STRUCT:
- switch to perl for better data structures and (thus) speed
- fix a couple glitches in the interpretation of the stabs output
- compress the strings by putting them in one big array and overlaying
suffixes
- all sizes and offsets are <64k, so use u_short for them
This results in ~60% reduction in the resulting text size and it now
takes less than a second to create on fast platforms.

ok miod@


Revision tags: OPENBSD_5_4_BASE
# 1.48 23-Jun-2013 miod

Stop using -traditional-cpp on gcc3/4 platforms.

Add CWARNFLAGS to the command line when using -xassembler-with-cpp. We are
mostly interested in -Werror here.


# 1.47 30-Mar-2013 tedu

reorder include search directories. cuts lookups by quite a bit.
ok deraadt miod


Revision tags: OPENBSD_5_3_BASE
# 1.46 28-Aug-2012 pascal

Add -nopie to LINKFLAGS on ELF architectures. Note that this needs an
updated gcc and ld to understand the new -nopie flag.

ok deraadt@


# 1.45 22-Aug-2012 pascal

Build the kernel with -fno-pie. Just getting Ms out of my tree; this will be
cleaned up later.

ok deraadt@


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.44 08-Nov-2011 matthieu

Garbage collect now unused MKDEP definitions. ok deraadt@


Revision tags: OPENBSD_5_0_BASE
# 1.43 07-Jul-2011 guenther

The drahn memorial bad kernel build fix: prevent blood pressure
spikes in other developers by making it so that removal of a .d
file without removing the corresponding object will result in the
latter being treated as out of date.

ok beck@ art@ drahn@


# 1.42 06-Jul-2011 tedu

make clean should clean .d files, so as to leave a fresh canvas.
ok beck deraadt


# 1.41 15-Apr-2011 guenther

Convert the kernel Makefiles to autogenerate dependencies during compilation
using the -MD option to cc, with -MP, -MT, and -MF where needed, converting
"make depend" to a no-op. This increases parallelism for those using "make -j"
and keeps the dependencies up to date with each compilation automatically.

sparc and vax users will need to rebuild gcc with support for the
-M[PTF] options before config'ing with this diff.


Revision tags: OPENBSD_4_9_BASE
# 1.40 30-Dec-2010 deraadt

If genassym fails, sort on the pipeline will indicate no error resulting
in some grief. Split this out.
From Vladimir Kirillov


# 1.39 02-Dec-2010 deraadt

After the most recent change, make it possible to make -j again. The
early MD and late MI files must be split up so that vers.o can sneak
between. Issue spotted by bluhm, repair discussed with miod


# 1.38 02-Dec-2010 deraadt

move vers.o to before the other objects, so that it is not linked last.
having it linked last is bad (on at least i386 and amd64) because the lapic
is mapped over the start of the data segment -- savecore(8) then reads the
version string for a fixed buffer space, and reads into the lapic area
causing unintended side-effects (at least on Intel X5570 and X5680)
found by pedro, discussed with kettenis and mpf and miod


# 1.37 06-Sep-2010 jsg

move away from using /**/ to ## for cpp paste in sh locore
so we can drop -traditional-cpp
ok miod@


Revision tags: OPENBSD_4_8_BASE
# 1.36 01-Jun-2010 deraadt

use --warn-common for linking (some arch's will show new warnings), and
prefer binutils-compatible options in STRIPFLAGS (now that our non-binutils
strip(1) can handle them too)
ok drahn; miod kettenis (for parts)


# 1.35 28-May-2010 guenther

${PARAM} is now included in ${CPPFLAGS}, so stop passing it separately
to genassym.sh

ok deraadt


# 1.34 25-May-2010 deraadt

The _arch and _mach variables now come from config(8), decreasing even further
the differences between these files. You will need a newer config(8) binary
to be able to build kernels.
ok kettenis miod


# 1.33 25-May-2010 deraadt

Hand-list the two-step assym.h -> .[Ss] -> .o dependencies. The
result: kernels built without 'make depend'-provided information
(ie. the .depend file) are more likely to have their *.[Ss] file
compilations track changes to *.h files.

The "*.o: assym.h" dependencies listed are gotten from reading the
.depend output --- from the biggest kernel possible (ie. GENERIC.MP).
When an architecture changes in a substantial way (new .[sS] files),
the list should be updated in the prettiest way possible.

This is not encouraging people to skip 'make depend'; other issues are
not resolved and may be solved later with a change guenther is working
on. You can still screwed really easily, so continue running make
depend as config tells you.

Idea from a discussion with drahn
ok drahn, kettenis likes the idea too


# 1.32 25-May-2010 deraadt

${SRCS} is only used once, and fits onto the line where it is used
idea that came out of discussion with drahn


# 1.31 24-May-2010 deraadt

give up on -Wvariable-decl
delete the archaic links: target which is easily misused
handle special .[sS] files in a portable way


# 1.30 24-May-2010 deraadt

Unify the dependency time check for whether an architecture has SFILES


# 1.29 24-May-2010 deraadt

Reduce differences between the Makefile.* files for all architectures.
ok various people, tested by fewer people, tested by me on 15.


# 1.28 23-May-2010 deraadt

Does not need -Dlandisk, and instead, but -Dlandisk is nice since that is
the mach (arch is sh). Also move towards passing $PARAM around in CPPFLAGS,
instead of compiling param.c in a special way, as discussed with miod


# 1.27 28-Apr-2010 deraadt

clean up more more subtle and stupid differences between the various
Makefile.* files


# 1.26 27-Apr-2010 drahn

Killing a few more diffs for theo, arm makes #LINKFLAGS, beagle cleanup,
INCLUDE= common.


# 1.25 27-Apr-2010 deraadt

Unifity CPPFLAGS= (using ${_mach}), SYSTEM_LD_TAIL= (always on one line),
and SRCS= (common files always after the \)


# 1.24 27-Apr-2010 jsg

Disable builtin malloc and log2 on gcc3 arches, a no-op for gcc3
but required for gcc4.

ok kettenis@ deraadt@ marco@, log2 suggested by robert@


# 1.23 27-Apr-2010 deraadt

a bit more unification to the arm way of doing this


# 1.22 27-Apr-2010 deraadt

shorten preamble


# 1.21 27-Apr-2010 deraadt

No need for a specific .SUFFIXES list; ok drahn


# 1.20 27-Apr-2010 deraadt

noone needs comments about QUOTA and TRACE


# 1.19 27-Apr-2010 deraadt

over the years we have moved to a machine+architectures scheme that has
two directories. in reality, because of how we place files, it has four:
.../arch/A, .../arch/A/A, .../arch/M, and .../arch/M/M
formalize this A/A and M/M scheme directly in the Makefiles, which makes
them a lot more similar
drahn likes the idea a lot


# 1.18 27-Apr-2010 deraadt

use -f assymp.dep again; worked out with miod


# 1.17 27-Apr-2010 deraadt

alpha/conf/Makefile.alpha


# 1.16 26-Apr-2010 deraadt

even cleaner mach/arch/machdir/archdir


# 1.15 26-Apr-2010 deraadt

next step towards unification: make all the genassym chunks handle both
arch and machine dependent files (and add the missing files)
ok miod drahn


# 1.14 26-Apr-2010 deraadt

next unification step: move all MD naming _mach, _machdir, _arch, and _archdir
ok miod drahn


# 1.13 26-Apr-2010 deraadt

first step of unification: spaces at end of lines; comments, etc.
ok miod


Revision tags: OPENBSD_4_7_BASE
# 1.12 19-Oct-2009 guenther

Correct a target name so that we don't rebuild vers.o (and then
bsd) unless some other object has changed. Rebuild and reinstall
in /usr/src/usr.sbin/config/ after updating!

"I like it" deraadt@


# 1.11 09-Aug-2009 miod

Introduce option DDB_STRUCT. Kernels compiled with this option (except on
a few arches where toolchain limitations apply) will embed some symbolic
information about the various structs used within the kernel, and have
new ddb commands allowing struct display and some useful information
gathering. Kernel rodata increase varies accross platforms from ~150KB to
~300KB.
This option is not enabled by default.


# 1.10 09-Aug-2009 miod

No need to clean genassym{.,o} during `make clean', genassym.sh does this
for us.


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.9 11-Jan-2009 pirofti

Fix a sed bug in the makefile's depend target.

What happened was that the output of mkdep was fed to a sed expression
that trimmed a bit more than required and also failed to work when
attempting to do make depend with pcc.

Example:

genassym_c.o: /tmp/genassym.whatever ../../../../../sys/param.h \

was changed to:

assym.h: \

but what was intended was:

assym.h: ../../../../../sys/param.h \

For the pcc -M output things were a bit different and after the make
depend the genassym entry would still remain and make would fail. This
affected all platforms except amd64 and sgi.

Okay miod@.


Revision tags: OPENBSD_4_4_BASE
# 1.8 12-Apr-2008 miod

Compile kernels with -Wvariable-decl (except on arches with ipmi, for now).


Revision tags: OPENBSD_4_3_BASE
# 1.7 30-Nov-2007 miod

Define NORMAL_C_NOP everywhere.


# 1.6 25-Nov-2007 deraadt

libkern, begone. Move to a new mechanism where config(8)'s "file"
directive can select between MI and MD versions of these files. At
the same time, adjust the boot programs to pick exactly what they need,
instead of the 7 or 8 mechanisms previously used.

There will be some fallout from this, but testing it all by myself is a
ridiculously slow process; it will be finished in-tree.

Various developers were very nice and avoided making fun of me when I
was gibbering in the corner..


# 1.5 25-Nov-2007 deraadt

Get rid of the kernel 'libcompat' framework, and instead use conf/files to
decide which files must be pulled into the kernel. Also conditionalize
the pulling of those files based on the COMPAT_* options.


Revision tags: OPENBSD_4_2_BASE
# 1.4 30-Jul-2007 thib

Shuffle the order in which we look for header files, when doing
kernel builds locally this doesnt change much but over NFS this
cuts about 12% of the build time on my setup (i386).

OK miod@, deraadt@.


Revision tags: OPENBSD_4_1_BASE
# 1.3 06-Oct-2006 miod

Remove explicit -fno-stack-protector now that the compiler workaround is in
place.


# 1.2 06-Oct-2006 mickey

w/ help of netbsd srcs and some mother unzel made it lift off


# 1.1 06-Oct-2006 miod

branches: 1.1.1;
Initial revision