Home | History | Annotate | Download | only in elf2ecoff
History log of /src/usr.bin/elf2ecoff/elf2ecoff.c
RevisionDateAuthorComments
 1.38  13-Sep-2025  christos s/estimate/compute/
 1.37  12-Sep-2025  tsutsui elf2ecoff: fix PR port-pmax/59234: "buffer overflow detected" problem.

Explicitly calculate a size of the target ECOFF string table before
copying symbol strings, as suggested by mlelstv@.

Tested "build.sh -U -m pmax release" on ubuntu 24.04.2:
---
% ./nbmips-elf2ecoff netboot.elf netboot
combining PH 0 type 1 flags 0x7 with data, ndata = 73568, nbss =1392
skipping PH 1 type 0x70000000 flags 0x4
skipping PH 2 type 0x70000003 flags 0x4
wrote 20 byte file header.
wrote 56 byte a.out header.
wrote 240 bytes of section headers.
wrote 4 byte pad.
writing 73568 bytes...
writing syms at offset 0x12100
2605 (0xa2d) bytes ELF string table
2705 (0xa91) bytes required for ECOFF string table
2705 (0xa91) bytes used for ECOFF string table
writing symhdr for 258 entries at offset 0x120a0
ECOFF symhdr: symhdr 60, strsize a91, symsize 1020
---

Should be pulled up to netbsd-9, netbsd-10, and netbsd-11.
 1.36  30-Mar-2025  tsutsui Revert "debug" variable to global to override it on debugger etc.
 1.35  08-Feb-2024  andvar branches: 1.35.2;
s/sharable/shareable in comments and documentation.
 1.34  06-Mar-2023  andvar fix few typos in comments and log messages.
 1.33  24-Feb-2017  christos fix printf format
 1.32  24-Feb-2017  christos fix printf format.
 1.31  23-Feb-2017  christos This only works with 32 bit Elf and COFF files, make it specific this way
and use sized types so that it works on 64 bit systems (so it can become
a tool).
 1.30  03-Sep-2016  christos branches: 1.30.2;
ignore the abiflags section
 1.29  10-Nov-2013  christos branches: 1.29.4; 1.29.8;
remove unused variables
 1.28  23-Aug-2011  christos branches: 1.28.2; 1.28.8;
misc knf cleanup.
 1.27  28-Jun-2011  tsutsui ANSIfy, KNF, misc cosmetics.
 1.26  19-Dec-2009  tsutsui Use %zu for size_t, not %zd.
 1.25  14-Dec-2009  uebayasi Adjust size_t format specifiers for mips64e[bl].
 1.24  14-Dec-2009  matt Merge from matt-nb5-mips64
 1.23  23-Apr-2009  tsutsui Fix -Wcast-qual and -Wsign-compare issues.
 1.22  31-May-2006  simonb branches: 1.22.28; 1.22.32;
Fix "pointer targets in passing argument X of 'Y' differ in signedness"
warnings. Originally, bswap32_region() took a u_int32_t * as its first
argument. Since no args passed to it are u_int32_t *, but some are
int32_t *, change it to int32_t * and fix remaining casts.
 1.21  27-Oct-2003  lukem branches: 1.21.12;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.20  25-Apr-2002  tv Proper usage of HAVE_CONFIG_H.
 1.19  24-Mar-2002  bouyer Include config.h when compiled as host tool.
 1.18  23-Mar-2002  bouyer Don't need <sys/exec.h> either.
 1.17  23-Mar-2002  bouyer We don't need <sys/exec_aout.h> here.
 1.16  23-Mar-2002  bouyer Add byte-swapping calls where appropriate, so that this can be used as
cross-tool on opposite endian host.
 1.15  19-Mar-2002  bouyer Respect byte order of the ELF executable. This allows elf2ecoff to be used
for mipseb platforms (especially to produce bootable ecoff kernel for sgimips).
 1.14  13-Mar-2000  soren Fix doubled 'the's.
 1.13  02-Nov-1999  drochner make it compile after ELF definition changes
 1.12  11-Jan-1999  kleink branches: 1.12.4;
In userland, pull in <errno.h> instead of <sys/errno.h> for the declaration
of errno.
 1.11  27-Nov-1998  simonb Truncate the output file before writing to it, and silence the verbose
output.
 1.10  10-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.9  18-Oct-1997  lukem KNFify (with indent(1))
 1.8  20-Jul-1997  jonathan * Rewrite symbol-remapping code, compatible with mips ECOFF toolchain.
* delint for -Wall -Wstrict-prototypes -Wmissing-prototypes.
 1.7  07-Jul-1997  jonathan Re-commit (from non-stale NFS filehandle) with debugging really turned off.
 1.6  06-Jul-1997  jonathan * Delint for gcc -Wall -Wmissing-prototypes -Wstrict-prototypes.
* Add an extra 4096 bytes of padding to the end of ECOFF files for
the benefit of dumb TFTP clietns that read entire pages.
 1.5  16-Jun-1997  thorpej Need <sys/exec.h> to get stuff that <machine/ecoff_machdep.h> needs.
 1.4  09-Jan-1997  tls RCS ID police
 1.3  16-Oct-1996  jonathan Rework to compile with <sys/exec_elf.h>.
 1.2  29-Sep-1996  jonathan Add RCS id lines to Ted Lemon's original code.
Update elf2ecoff to compile against NetBSD-1.2 distribtion ECOFF headers.
 1.1  29-Sep-1996  jonathan Import Ted Lemon's ELF toolchain utilties used to build kernels
for the pmax port in NetBSD 1.1 and 1.2.
 1.12.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.21.12.1  19-Jun-2006  chap Sync with head.
 1.22.32.1  11-Dec-2009  matt Use z format for size_t ...
 1.22.28.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.28.8.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.2.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.8.1  20-Mar-2017  pgoyette Sync with HEAD
 1.29.4.1  12-May-2017  snj Pull up following revision(s) (requested by skrll in ticket #1406):
sys/arch/mips/include/ecoff_machdep.h: revision 1.23
sys/sys/exec_ecoff.h: revision 1.21
tools/Makefile.nbincludes: revision 1.5
tools/mips-elf2ecoff/Makefile: revision 1.3
tools/mips-elf2ecoff/machine/ecoff_machdep.h: revision 1.3
tools/mips-elf2ecoff/sys/exec_elf.h: file removal
tools/mips-elf2ecoff/sys/exec_ecoff.h: file removal
usr.bin/elf2ecoff/elf2ecoff.c: revision 1.30-1.33
use the nbcompat copies for those files
--
ignore the abiflags section
--
Add exec_ecoff.h
--
provide ecoff 32 defines.
--
This only works with 32 bit Elf and COFF files, make it specific this way
and use sized types so that it works on 64 bit systems (so it can become
a tool).
--
Provided sized definitions for ecoff 32 bit headers.
--
refresh
--
fix printf format.
--
fix printf format
 1.30.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.35.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed