History log of /netbsd-current/sys/sys/exec_elf.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.171 08-Jan-2023 christos

sync machine list with spec


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.170 08-Jun-2022 rin

Do not warn for ELF note for FDO packaging metadata
(https://systemd.io/COREDUMP_PACKAGE_METADATA/),
found in userland binaries of Fedora 36.


# 1.169 28-May-2022 andvar

s/hidding/hiding/


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.168 19-Oct-2020 christos

Arrange so that no options COREDUMP and no options PTRACE work together.
Thanks to Paul Goyette for testing.


# 1.167 10-Oct-2020 thorpej

Rename:
- EM_ALPHA (41) -> EM_OLD_ALPHA
- EM_ALPHA_EXP (36902) -> EM_ALPHA

36902 has been the value in common usage for a long time, and this naming
aligns with binutils, etc.

PR port-alpha/51926


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406
# 1.166 29-Feb-2020 kamil

Add defines for MIPS_XHASH (.MIPS.xhash)

MIPS version of GNU_HASH as supported by GNU toolchain.


Revision tags: ad-namecache-base3
# 1.165 27-Feb-2020 kamil

Register DT_GNU_HASH

GNU-style hash table is supported in GNU and LLVM toolchains.

https://sourceware.org/ml/binutils/2006-10/msg00377.html


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.164 02-Jan-2020 kamil

branches: 1.164.2;
Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.163 02-Jan-2020 kamil

Update e_machine magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.162 02-Jan-2020 kamil

Fix the EM_TILEGX number in the ELF header

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

191 is confirmed in LLVM, GNU toolchain, FreeBSD.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

branches: 1.160.2;
Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.170 08-Jun-2022 rin

Do not warn for ELF note for FDO packaging metadata
(https://systemd.io/COREDUMP_PACKAGE_METADATA/),
found in userland binaries of Fedora 36.


# 1.169 28-May-2022 andvar

s/hidding/hiding/


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.168 19-Oct-2020 christos

Arrange so that no options COREDUMP and no options PTRACE work together.
Thanks to Paul Goyette for testing.


# 1.167 10-Oct-2020 thorpej

Rename:
- EM_ALPHA (41) -> EM_OLD_ALPHA
- EM_ALPHA_EXP (36902) -> EM_ALPHA

36902 has been the value in common usage for a long time, and this naming
aligns with binutils, etc.

PR port-alpha/51926


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406
# 1.166 29-Feb-2020 kamil

Add defines for MIPS_XHASH (.MIPS.xhash)

MIPS version of GNU_HASH as supported by GNU toolchain.


Revision tags: ad-namecache-base3
# 1.165 27-Feb-2020 kamil

Register DT_GNU_HASH

GNU-style hash table is supported in GNU and LLVM toolchains.

https://sourceware.org/ml/binutils/2006-10/msg00377.html


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.164 02-Jan-2020 kamil

branches: 1.164.2;
Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.163 02-Jan-2020 kamil

Update e_machine magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.162 02-Jan-2020 kamil

Fix the EM_TILEGX number in the ELF header

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

191 is confirmed in LLVM, GNU toolchain, FreeBSD.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

branches: 1.160.2;
Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.169 28-May-2022 andvar

s/hidding/hiding/


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.168 19-Oct-2020 christos

Arrange so that no options COREDUMP and no options PTRACE work together.
Thanks to Paul Goyette for testing.


# 1.167 10-Oct-2020 thorpej

Rename:
- EM_ALPHA (41) -> EM_OLD_ALPHA
- EM_ALPHA_EXP (36902) -> EM_ALPHA

36902 has been the value in common usage for a long time, and this naming
aligns with binutils, etc.

PR port-alpha/51926


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406
# 1.166 29-Feb-2020 kamil

Add defines for MIPS_XHASH (.MIPS.xhash)

MIPS version of GNU_HASH as supported by GNU toolchain.


Revision tags: ad-namecache-base3
# 1.165 27-Feb-2020 kamil

Register DT_GNU_HASH

GNU-style hash table is supported in GNU and LLVM toolchains.

https://sourceware.org/ml/binutils/2006-10/msg00377.html


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.164 02-Jan-2020 kamil

branches: 1.164.2;
Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.163 02-Jan-2020 kamil

Update e_machine magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.162 02-Jan-2020 kamil

Fix the EM_TILEGX number in the ELF header

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

191 is confirmed in LLVM, GNU toolchain, FreeBSD.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

branches: 1.160.2;
Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.168 19-Oct-2020 christos

Arrange so that no options COREDUMP and no options PTRACE work together.
Thanks to Paul Goyette for testing.


# 1.167 10-Oct-2020 thorpej

Rename:
- EM_ALPHA (41) -> EM_OLD_ALPHA
- EM_ALPHA_EXP (36902) -> EM_ALPHA

36902 has been the value in common usage for a long time, and this naming
aligns with binutils, etc.

PR port-alpha/51926


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406
# 1.166 29-Feb-2020 kamil

Add defines for MIPS_XHASH (.MIPS.xhash)

MIPS version of GNU_HASH as supported by GNU toolchain.


Revision tags: ad-namecache-base3
# 1.165 27-Feb-2020 kamil

Register DT_GNU_HASH

GNU-style hash table is supported in GNU and LLVM toolchains.

https://sourceware.org/ml/binutils/2006-10/msg00377.html


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.164 02-Jan-2020 kamil

branches: 1.164.2;
Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.163 02-Jan-2020 kamil

Update e_machine magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.162 02-Jan-2020 kamil

Fix the EM_TILEGX number in the ELF header

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

191 is confirmed in LLVM, GNU toolchain, FreeBSD.


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

branches: 1.160.2;
Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.167 10-Oct-2020 thorpej

Rename:
- EM_ALPHA (41) -> EM_OLD_ALPHA
- EM_ALPHA_EXP (36902) -> EM_ALPHA

36902 has been the value in common usage for a long time, and this naming
aligns with binutils, etc.

PR port-alpha/51926


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406
# 1.166 29-Feb-2020 kamil

Add defines for MIPS_XHASH (.MIPS.xhash)

MIPS version of GNU_HASH as supported by GNU toolchain.


Revision tags: ad-namecache-base3
# 1.165 27-Feb-2020 kamil

Register DT_GNU_HASH

GNU-style hash table is supported in GNU and LLVM toolchains.

https://sourceware.org/ml/binutils/2006-10/msg00377.html


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.164 02-Jan-2020 kamil

branches: 1.164.2;
Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.163 02-Jan-2020 kamil

Update e_machine magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.162 02-Jan-2020 kamil

Fix the EM_TILEGX number in the ELF header

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

191 is confirmed in LLVM, GNU toolchain, FreeBSD.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

branches: 1.160.2;
Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.166 29-Feb-2020 kamil

Add defines for MIPS_XHASH (.MIPS.xhash)

MIPS version of GNU_HASH as supported by GNU toolchain.


Revision tags: ad-namecache-base3
# 1.165 27-Feb-2020 kamil

Register DT_GNU_HASH

GNU-style hash table is supported in GNU and LLVM toolchains.

https://sourceware.org/ml/binutils/2006-10/msg00377.html


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.164 02-Jan-2020 kamil

branches: 1.164.2;
Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.163 02-Jan-2020 kamil

Update e_machine magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.162 02-Jan-2020 kamil

Fix the EM_TILEGX number in the ELF header

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

191 is confirmed in LLVM, GNU toolchain, FreeBSD.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

branches: 1.160.2;
Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.165 27-Feb-2020 kamil

Register DT_GNU_HASH

GNU-style hash table is supported in GNU and LLVM toolchains.

https://sourceware.org/ml/binutils/2006-10/msg00377.html


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.164 02-Jan-2020 kamil

Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.163 02-Jan-2020 kamil

Update e_machine magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.162 02-Jan-2020 kamil

Fix the EM_TILEGX number in the ELF header

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

191 is confirmed in LLVM, GNU toolchain, FreeBSD.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

branches: 1.160.2;
Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.164 02-Jan-2020 kamil

Sync the e_ident[EI_OSABI] magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.163 02-Jan-2020 kamil

Update e_machine magic values with the ELF specification

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html


# 1.162 02-Jan-2020 kamil

Fix the EM_TILEGX number in the ELF header

source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

191 is confirmed in LLVM, GNU toolchain, FreeBSD.


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

branches: 1.160.2;
Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.161 07-Jun-2019 christos

deduplicate the elf auxv builder code, welcome to 8.99.43


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.160 24-May-2018 christos

Complete the list of DF_1 flags.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.159 12-Apr-2018 christos

There have never been binaries with a checksum tag for NetBSD.
These days the equivalent functionality is provided by the build
id tag. It was incorrect in the first place to overload tag #2
(which used to be the emulation name) with a different meaning, so
actually document the meaning that was once used (because binaries
with that tag exist).

Tag existance noticed by kre@


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.158 06-Nov-2017 christos

branches: 1.158.2;
Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


# 1.158 06-Nov-2017 christos

Since _RUMPKERNEL is really userland code it needs ARCH_ELFSIZE,
not KERN_ELFSIZE, make it so!


# 1.157 06-Nov-2017 christos

Use KERN_ELFSIZE if we are in the kernel.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914
# 1.156 03-Sep-2016 christos

Add mips abiflags section


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.155 31-May-2016 christos

Add an ElfW() macro like linux.


Revision tags: nick-nhusb-base-20160529
# 1.154 24-May-2016 christos

Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.153 19-Feb-2016 christos

Intel MCU.


# 1.152 06-Feb-2016 riastradh

Don't do _BSD_SIZE_T_ dance here. Use <stddef.h> in userland.

This file is used in tools, where _BSD_SIZE_T_ is unreliable. In the
kernel, <sys/types.h> will define size_t anyway. Outside the kernel,
<stddef.h> is the standard way to get size_t.


Revision tags: nick-nhusb-base-20151226
# 1.151 01-Nov-2015 christos

Ignore the ancient 01.01 tag that gnuc used to put in old NetBSD binaries.


# 1.150 01-Nov-2015 christos

Add buildid Go note


Revision tags: nick-nhusb-base-20150921
# 1.149 30-Jul-2015 maxv

Revamp PaX:
- don't confuse between ELF flags and proc flags. Introduce the proc-
specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
- introduce pax_setup_elf_flags(), which takes as argument the PaX flag
of the ELF PaX note section, and which sets the proc flag as
appropriate. Also introduce a couple of other functions used for that
purpose.
- modify pax_aslr_active(), and all the other similar pieces of code, so
that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
- declare PAX_DPRINTF, makes it more readable
- fix a typo in exec_elf.h


# 1.148 24-Jul-2015 matt

Remove unofficial AVR32


# 1.147 24-Jul-2015 matt

Add a few more EM_*


Revision tags: nick-nhusb-base-20150606
# 1.146 20-May-2015 matt

add struct exec_package;


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.145 23-Oct-2014 martin

branches: 1.145.2;
Add standard size_t dance


# 1.144 19-Sep-2014 matt

Add EM_RISCV


# 1.143 25-Aug-2014 joerg

Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.


# 1.142 19-Aug-2014 matt

EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.141 08-Jul-2014 maxv

branches: 1.141.2;
Define ELF_MAXNOTESIZE, ELF_MAXSHNUM and ELF_MAXPHNUM in <sys/exec_elf.h>, so
that it can be used externally.


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.140 09-Mar-2014 christos

branches: 1.140.2;
Add more definitions, needed by the new elf toolchain.


# 1.139 15-Feb-2014 maxv

Remove the last argument of elf_check_header(). It is easier - and faster - to
check the e_type field in the calling function. Other BSD's already do this.

ok christos@


# 1.138 11-Feb-2014 skrll

Fix typo in DF_STATIC_TLS. From Elliott Hughes on tech-userlevel.


# 1.137 03-Jan-2014 dsl

Fix bug in previous (panic during process core dump).
Change the interface to ELFNAMEEND(coredump_savenote) so that the caller
doesn't need to know the type of the elf note header.
Simplifies the calling code somewhat.


# 1.136 03-Jan-2014 dsl

Instead of generating all the 'note' sections twice (and hoping that the
'fast path' size on the first path matches the actual size on the second)
save all the notes (mostly the cpu registers for all the LWPs) in
malloced memory on the first pass.
Sanity check that the number of memory segments matches written matches
the count obtained earlier. If gcore() is used they could differ.
(Not sure that returning ENOMEM is ideal, but it is better than a crash.)


# 1.135 03-Jan-2014 dsl

Remove the incorrect and unused Elf64_Shalf.
At one time it was used for a 32bit item - but that definition has long
since been changed to use a reasonable 32bit type.


# 1.134 02-Jan-2014 christos

Add more gnu sections


# 1.133 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


# 1.132 05-Nov-2013 martin

Define a new NetBSD specific note to encode the code model used for a binary.
Allow MD code to check these notes in the exec path.


# 1.131 29-Oct-2013 christos

Add EM_AARCH64 from Elliott Hughes


# 1.130 28-Oct-2013 matt

Add DF_* values for DT_FLAGS


# 1.129 10-Sep-2013 matt

Add a NetBSD note variant for recording the machine_arch for which the
executable was built. (currently only used by earm variants)


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.128 21-Jun-2013 christos

branches: 1.128.2;
Add the ARM processor-specific sections:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf


Revision tags: agc-symver-base
# 1.127 30-Jan-2013 matt

Add DT_PREINIT_ARRAY/DT_PREINIT_ARRAYSZ and few other missing ones.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.126 05-Aug-2012 matt

branches: 1.126.2;
back out elf note changes and use EF_ARM_ABIVERS to determine EABI usage.


# 1.125 04-Aug-2012 skrll

define<tab> consistency


# 1.124 03-Aug-2012 matt

Add a elf note to describe the ARM ABI in use. If encounters on arm,
set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.123 22-May-2012 christos

- Recognize the SuSE ABI note.
- Restructure the code to do the checking in the appropriate note type,
and harmonize all the checks to be positive.
- Print only the tag data being careful not to overrun the allocated buffer.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.122 04-Feb-2012 joerg

Add AuxInfo record with the base address of the main thread.


# 1.121 21-Jan-2012 njoly

Kill duplicate SHF_MASKOS/SHF_MASKPROC defines.


# 1.120 19-Jan-2012 christos

Add more SHF_ and whitespace align SHT_


# 1.119 19-Jan-2012 christos

whitespace diffs [and comments]


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base
# 1.118 25-Nov-2011 joerg

branches: 1.118.2;
Add SHT_GNU_HASH.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.117 03-Aug-2011 enami

branches: 1.117.2;
Replace the word `NetBSD' with `SuSE' in the rest of comments
for the cpp macro constatnt ELF_NOTE_SUSE_*.


# 1.116 02-Aug-2011 christos

Add SuSE note


# 1.115 19-Jul-2011 christos

define<tab>


# 1.114 19-Jul-2011 christos

document all the notes we know about in a consistent fashion.
XXX: someone please document the checksum tags.


# 1.113 25-Jun-2011 nonaka

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.112 26-May-2011 nonaka

fix ELFxx_M_SIZE macro.


# 1.111 26-May-2011 nonaka

fix spelling.


Revision tags: bouyer-quota2-nbase
# 1.110 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base
# 1.109 16-Feb-2011 christos

add the rest of the gnu specific pt sections.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.108 24-Dec-2010 skrll

branches: 1.108.2; 1.108.4;
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.


# 1.107 13-Dec-2010 joerg

Add PT_GNU_EH_FRAME definition


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.106 16-Oct-2010 skrll

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.


# 1.105 14-Oct-2010 skrll

Define PT_TLS.


Revision tags: yamt-nfs-mp-base11
# 1.104 30-Sep-2010 skrll

Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.


# 1.103 28-Aug-2010 joerg

Replace the current usage of Elf64_Half with Elf64_Word and rename
NetBSD specific Elf64_Quarter to Elf64_Half. This restores compatibility
with the common ELF specifications.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.102 01-Mar-2010 skrll

branches: 1.102.2;
Use #define<tab> consistently.


# 1.101 01-Mar-2010 darran

DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).


Revision tags: uebayasi-xip-base
# 1.100 20-Dec-2009 thorpej

branches: 1.100.2;
Add defns for Elf{32,64}_Syminfo.


# 1.99 19-Dec-2009 thorpej

Add some definitions, from FreeBSD.


Revision tags: matt-premerge-20091211
# 1.98 24-Nov-2009 pooka

fix comments: st_name is index in .strtab


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.97 22-May-2009 martin

Add a signed offset type


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.96 12-Nov-2008 ad

branches: 1.96.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.95 28-Apr-2008 martin

branches: 1.95.6; 1.95.8; 1.95.10; 1.95.14;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.94 26-Dec-2007 christos

branches: 1.94.6; 1.94.8; 1.94.10;
Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]

For regular (non PIE) executables randomization is enabled for:
1. The data segment
2. The stack

For PIE executables(*) randomization is enabled for:
1. The program itself
2. All shared libraries
3. The data segment
4. The stack

(*) To generate a PIE executable:
- compile everything with -fPIC
- link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.93 07-Dec-2007 ad

branches: 1.93.4;
rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
should be recording a dependency on libc, but it's too late to do that.

Ok christos@.


Revision tags: vmlocking2-base1 vmlocking-nbase reinoud-bufcleanup-base
# 1.92 03-Dec-2007 christos

branches: 1.92.2;
- add an elf aux vector entry for implementing $ORIGIN.
- the code to convert from a vnode to a path is commented out now until
a better solution is implemented. Only absolute paths work for now
(which is most of the cases).

requested by core


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base vmlocking-base
# 1.91 19-Aug-2007 matt

branches: 1.91.2; 1.91.8;
Add EM_AVR32


Revision tags: matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base
# 1.90 24-Jun-2007 christos

branches: 1.90.2; 1.90.6;
Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.89 22-Nov-2006 riz

branches: 1.89.2; 1.89.8; 1.89.10; 1.89.12; 1.89.16;
Make sys/exec_elf.h and machine/elf_machdep.h available to host
tools, and allow paxctl to use them when compiled as a host
tool. This fixes the build on MacOS X (and perhaps other platforms)


# 1.88 22-Nov-2006 elad

Damn, missed in previous commit. Add PaX Segvguard flags.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.87 30-Aug-2006 matt

branches: 1.87.2; 1.87.4;
Regen.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.86 16-May-2006 elad

Introduce PaX MPROTECT -- mprotect(2) restrictions used to strengthen
W^X mappings.

Disabled by default.

First proposed in:

http://mail-index.netbsd.org/tech-security/2005/12/18/0000.html

More information in:

http://pax.grsecurity.net/docs/mprotect.txt

Read relevant parts of options(4) and sysctl(3) before using!

Lots of thanks to the PaX author and Matt Thomas.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.85 18-Dec-2005 christos

branches: 1.85.4; 1.85.6; 1.85.8; 1.85.12;
there is no elf64_read_from.


# 1.84 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.83 17-Aug-2005 matt

Add NetBSD checksum notes.


# 1.82 10-Jun-2005 matt

branches: 1.82.2;
Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.81 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.80 03-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge
# 1.79 28-Dec-2004 thorpej

branches: 1.79.2; 1.79.4;
Use uint32_t casts, rather than Elf_Byte, in ELF_ST_BIND() and ELF_ST_TYPE()
so we don't get screwed by promotion rules (and makes nlist_elf32.ln build
again).


# 1.78 27-Dec-2004 christos

According to the ELF docs, ELF{32,64}_ST_{BIND,TYPE,INFO,VISIBILITY} are
parts of the public interface. Define them in terms of ELF_ST_*.
Add STN_UNDEF which is part of the public interface also.


# 1.77 26-Dec-2004 mycroft

Remove ELFn_ST_{BIND,TYPE,INFO}(), and instead add a generic ELF_ST_*() that
works with an Elf_Byte. Also add ELF_ST_VISIBILITY() and STV_* types.


Revision tags: kent-audio1-base
# 1.76 17-May-2004 mrg

add EI_NIDENT (16) as seen in other <elf.h> headers.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.75 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.74 10-Feb-2004 pooka

fix typo in comment: magic numbers are indexed EI_MAG0 through EI_MAG3,
not ELFMAG0 through ELFMAG3 (which are the contents)


# 1.73 31-Oct-2003 drochner

introduce another "magic" ELF address to tell that the file has to be
mapped at the address it was linked for


# 1.72 08-Aug-2003 christos

- Add execsw es_setup_stack
- gc all the rest of the setup stack functions.


# 1.71 06-Aug-2003 manu

Make elf{32|64}_check_header public, as it will be used by irix_elf32_probe.
While we are there, cut to 80 chars, and ANSIfy prototypes


# 1.70 29-Jun-2003 fvdl

branches: 1.70.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.69 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.68 20-May-2003 nathanw

Add a field to netbsd_elfcore_procinfo that identifies the LWP targeted
by the killing signal.


# 1.67 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.66 27-Nov-2002 wiz

Fix typo in comment.


# 1.65 27-Nov-2002 junyoung

Program header types 0x60000000 ~ 0x6fffffff are reserved for
OS-specific semantics.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.64 05-Oct-2002 bjh21

Update URLs again (serves me right for committing an old change
without checking it). Back to sco.com, but with a different path.


# 1.63 05-Oct-2002 bjh21

Update URLs for ELF spec (sco.com -> caldera.com).


Revision tags: gehenna-devsw-base kqueue-base
# 1.62 26-Aug-2002 christos

- pass struct proc to copyargs
- rename aux vector entries AT_{R,E}{U,G}ID from AT_SYUN_{R,}P{U,G}ID
- update new aux vector size.


# 1.61 14-Jun-2002 ragge

Add official machine numbers for PDP10 and PDP11.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.60 28-Jan-2002 thorpej

branches: 1.60.8;
Define ELF32_EHDR_FLAGS_OK()/ELF64_EHDR_FLAGS_OK() and use it
as an added measure to make sure that we can execute a binary.
These default to (1) if elf_machdep.h does not override them.

On Sun2, ELF32_EHDR_FLAGS_OK() checks for the presense of EF_M68000,
since the 68010 cannot run binaries for the 68020-and-up.


# 1.59 09-Dec-2001 thorpej

Add support for dumping ELF-cormat core files.


Revision tags: thorpej-mips-cache-base
# 1.58 31-Oct-2001 thorpej

Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.


# 1.57 31-Oct-2001 thorpej

Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).


# 1.56 31-Oct-2001 thorpej

Include <machine/elf_machdep.h> earlier, at the beginning of the file,
after the inttypes header.


# 1.55 29-Oct-2001 simonb

Add EM_NS32K for the ns32k series CPUs.


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.54 30-Jul-2001 pooka

branches: 1.54.4;
make elf64_copyargs() of type int also per the recent copyargs changes


# 1.53 29-Jul-2001 christos

adjust to the new copyargs footprint


# 1.52 14-Jul-2001 christos

- add exec_read_from and make exec_elf32 use it.
- add a macho probe function


# 1.51 20-Jun-2001 simonb

branches: 1.51.2;
Fix up comment botch.
_Never_ fix a simple formatting thing _after_ a test compile.


# 1.50 20-Jun-2001 simonb

Add some more e_machine values and a reference to the SCO website with
ELF ABI information.


# 1.49 20-Jun-2001 fvdl

X8664 -> X86_64


# 1.48 20-Jun-2001 fvdl

Elf64_Word should be 32 bits; alpha is the exception rather than
the rule, so change the ifdef to reflect this.


# 1.47 19-Jun-2001 fvdl

Fix botched commit; I forgot to bring this up to date to -current
before committing it.


# 1.46 19-Jun-2001 fvdl

Add IDs for x86-64.


Revision tags: thorpej_scsipi_beforemerge
# 1.45 25-Apr-2001 kleink

ElfNN_RelA -> ElfNN_Rela, which I missed in the Great Renaming;
noticed by Juan Jose Garcia-Ripoll in PR standards/12274.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.44 22-Apr-2001 pooka

Fix misinformation in comment


# 1.43 13-Apr-2001 kleink

Slight readability improvement to rev. 1.39.


# 1.42 13-Apr-2001 pooka

Describe possible section types with a few words.


# 1.41 14-Mar-2001 christos

populate OSABI list


# 1.40 15-Dec-2000 mycroft

branches: 1.40.2;
Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.


# 1.39 26-Jul-2000 mycroft

Introduce Elf64_Xword and Elf64_Sxword, and use them in various places instead
of Elf64_Word.
Make Elf64_Word be 32 bits on sparc64. (XXXX Need to determine what it's
supposed to be on other, but it's current used to size entries in DT_HASH,
which is 32 bits on sparc64 and 64 bits on alpha.)


# 1.38 27-Jun-2000 kleink

Be less invasive and use private names for exact-width integer types.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 1.37 22-Feb-2000 augustss

branches: 1.37.4;
Make this file possible to use again.


# 1.36 22-Feb-2000 kleink

* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
constants, and add more comments.


# 1.35 22-Feb-2000 kleink

Add OS ABI constants from the 1998-04-29 draft.


Revision tags: chs-ubc2-newbase
# 1.34 22-Jan-2000 mycroft

Delint.


# 1.33 30-Dec-1999 eeh

Make sure the elf_args strucure is appropriate for the size of the ELF binary.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.32 10-Nov-1999 thorpej

Define ELF_ST_*() to ELF{32,64}_ST_* as appropriate. They evaluate to
the same thing, but this provides consistency with everything else.


# 1.31 09-Nov-1999 kleink

Fix comment typo introduced in rev. 1.27.


Revision tags: comdex-fall-1999-base
# 1.30 01-Nov-1999 mycroft

Fix obvious typos.


# 1.29 27-Oct-1999 simonb

Add a few comments from <mips/elf.h>.


# 1.28 26-Oct-1999 kleink

Add ELF64 versions of st_info manipulation macros I missed in previous.


# 1.27 25-Oct-1999 kleink

As discussed with Christos, rename the definitions in this file to match those
found in various SVR4 ABIs.


# 1.26 23-Oct-1999 erh

Move ELFNAME macros out of #ifdef _KERNEL.


# 1.25 13-Sep-1999 itojun

branches: 1.25.2; 1.25.4; 1.25.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.24 21-Aug-1999 matt

Add the newly blessed magic number for VAX.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base
# 1.23 23-Dec-1998 christos

Add NetBSD note constants.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.22 03-Oct-1998 christos

Add a few new machine numbers and aux vectors.


# 1.21 01-Oct-1998 erh

Move elf function name building macros here (ELFNAME, ELFNAME2, etc...) Add defines related to elf note sections for use in determining executable type/emulation.


# 1.20 13-Sep-1998 christos

Fix copyright typos...


# 1.19 05-Sep-1998 christos

Assign copyright to TNF.


# 1.18 11-Aug-1998 kleink

Oops, change previous to use the registered name found in the System V ABI,
draft edition as of April 29, 1998.


# 1.17 11-Aug-1998 kleink

Add machine identifier for the PA.


# 1.16 10-Aug-1998 matt

Add machine identifier for ARM. Add (commented out) real ident
for Alpha as well.


Revision tags: eeh-paddr_t-base
# 1.15 29-Jul-1998 mrg

add Elf_em_sparc64 at 43 (from solaris 2.7)


# 1.14 12-Jul-1998 veego

Remove a trailing ',' in an enum declaration.


# 1.13 25-Jun-1998 eeh

Addes support for sparc32plus ELF executables: v9 in v8's clothing.


# 1.12 22-Jan-1998 thorpej

Generate dependencies on the exec format options EXEC_AOUT, EXEC_ECOFF,
EXEC_ELF32, EXEC_ELF64, and EXEC_SCRIPT.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Jun-1997 thorpej

Add Section Attribute Flags (SHF_*) as defined in _System V Application
Binary Interface, Third Edition_, section 4, page 16.


# 1.10 21-Mar-1997 cgd

define Elf{,32,64}_Note as appropriate, add a constant for NetBSD-specific
notes' 'name' fields, and add a couple of NetBSD-specific note types.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 03-Oct-1996 cgd

rename the ELF section type constants to be Elf_* rather than Elf32_*,
since they're shared between ELF32 and ELF64. (Thought i checked this in
earlier, but apparently didn't!)


# 1.8 03-Oct-1996 cgd

fix typo in definition of Elf32_e_ident


# 1.7 30-Sep-1996 ws

PowerPC port


# 1.6 27-Sep-1996 cgd

fix up section header type enum/values


# 1.5 26-Sep-1996 cgd

add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.


# 1.4 26-Sep-1996 cgd

add definitions for 64-bit ELF. Provided by Matt Thomas, then integrated
and cleaned up a fair bit.


# 1.3 13-Jun-1996 christos

- Add definitions for Elf section headers.
- Add prototype for elf_read_from.
- KNF.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.2 16-Jan-1996 fvdl

Attempt #2 :-( (where did that tag come from..)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.1 22-Jun-1995 fvdl

Generic ELF exec include file, like the other exec_xxx include files.