OpenBSD CVS

CVS log for src/usr.bin/nm/elf.c


[BACK] Up to [local] / src / usr.bin / nm

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.39 / (download) - annotate - [select for diffs], Sun Nov 7 08:09:04 2021 UTC (2 years, 6 months ago) by semarie
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.38: +4 -1 lines
Diff to previous 1.38 (colored)

nm: add some .text.* support for symbols

.text.* are generated when using -ffunction-sections.

makes nm(1) to correctly identify the function symbols as N_TEXT.

found while debugging librsvg build error, where some symbols where not found by libtool(1) (which is using nm(1)).

ok gkoehler@

Revision 1.38 / (download) - annotate - [select for diffs], Sun Nov 22 10:40:39 2020 UTC (3 years, 5 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

fix typo; from Kris Katterjohn

Revision 1.37 / (download) - annotate - [select for diffs], Fri Dec 14 19:56:02 2018 UTC (5 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.36: +12 -56 lines
Diff to previous 1.36 (colored)

Delete unused phdr functions; move declarations for functions internal to
elf.c to that file

ok mpi@

Revision 1.36 / (download) - annotate - [select for diffs], Sat Dec 9 06:39:04 2017 UTC (6 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.35: +3 -1 lines
Diff to previous 1.35 (colored)

recognize .openbsd.randomdata section and indicate it roughly, so
that objects within it are identified as being in read-only space.
ok guenther

Revision 1.35 / (download) - annotate - [select for diffs], Fri Oct 27 16:47:08 2017 UTC (6 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

Use <elf.h> instead of <elf_abi.h>

ok jasper@, jca@, deraadt@

Revision 1.34 / (download) - annotate - [select for diffs], Wed Dec 9 19:28:34 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.33: +3 -5 lines
Diff to previous 1.33 (colored)

Remove NULL-checks before free(). ok tb@

Revision 1.33 / (download) - annotate - [select for diffs], Thu Aug 13 19:13:28 2015 UTC (8 years, 9 months ago) by miod
Branch: MAIN
Changes since 1.32: +33 -30 lines
Diff to previous 1.32 (colored)

Grow -P (POSIX output) and -t (POSIX output radix) support. Several 3rd-party
software depend upon this.

Requested by feinerer@, ok millert@; manpage bits ok jmc@

Revision 1.32 / (download) - annotate - [select for diffs], Tue Jun 23 15:16:34 2015 UTC (8 years, 10 months ago) by semarie
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.31: +7 -1 lines
Diff to previous 1.31 (colored)

This patch ensure that when an error is detected, the freed variables in
elf_symloadx() are reinitialised.

Else show_file() in nm.c will used these variables, even if they has
just been freed. (nm.c +689).

Problem found by afl.

ok miod@

Revision 1.31 / (download) - annotate - [select for diffs], Tue Jun 23 15:13:29 2015 UTC (8 years, 10 months ago) by semarie
Branch: MAIN
Changes since 1.30: +7 -2 lines
Diff to previous 1.30 (colored)

This patch ensure that e_shentsize (sections header's size in bytes) is
big enough to fill at least one Elf_Shdr.

While here, inverts calloc() arguments to be calloc(nmemb, size),
according to fread() call after.

This problem was found with afl, with e_shentsize=1.

ok miod@

Revision 1.30 / (download) - annotate - [select for diffs], Tue Jun 23 15:02:58 2015 UTC (8 years, 10 months ago) by semarie
Branch: MAIN
Changes since 1.29: +8 -4 lines
Diff to previous 1.29 (colored)

corrects a read after bound that occurs in strcmp (line just
after the added bound check).

Found with afl.

ok miod@

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jun 23 13:43:08 2015 UTC (8 years, 10 months ago) by semarie
Branch: MAIN
Changes since 1.28: +11 -1 lines
Diff to previous 1.28 (colored)

add some check before accessing data:
 - if section header table is be present
 - consistency of section header table size

ok miod@

Revision 1.28 / (download) - annotate - [select for diffs], Sun May 17 20:19:08 2015 UTC (9 years ago) by guenther
Branch: MAIN
Changes since 1.27: +5 -3 lines
Diff to previous 1.27 (colored)

Add -D option for displaying the dynamic symbol table

ok miod@

Revision 1.27 / (download) - annotate - [select for diffs], Thu Apr 9 04:46:18 2015 UTC (9 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.26: +1 -2 lines
Diff to previous 1.26 (colored)

ELF weak symbols are _not_ like a.out indirect symbols.  Nothing in ELF is,
so remove N_INDR handling.

ok kettenis@

Revision 1.26 / (download) - annotate - [select for diffs], Fri Feb 6 23:21:59 2015 UTC (9 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

SIZE_MAX is standard, we should be using it in preference to the
obsolete SIZE_T_MAX.  OK miod@ beck@

Revision 1.25 / (download) - annotate - [select for diffs], Mon Jan 19 20:25:36 2015 UTC (9 years, 4 months ago) by miod
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

Missing initialization; tjenahej@speedmail.se

Revision 1.24 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:10 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.23 / (download) - annotate - [select for diffs], Tue Nov 26 13:19:07 2013 UTC (10 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

unsigned char casts for ctype
ok krw

Revision 1.22 / (download) - annotate - [select for diffs], Wed Nov 13 06:37:24 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.21: +5 -2 lines
Diff to previous 1.21 (colored)

proto and such cleanup
ok guenther

Revision 1.21 / (download) - annotate - [select for diffs], Sat Mar 30 21:26:09 2013 UTC (11 years, 1 month ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.20: +6 -3 lines
Diff to previous 1.20 (colored)

Correctly report `weak' status of non-function symbols. Makes nm agree with
objdump -t on, say, _DYNAMIC in libpthread.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Sep 28 19:58:14 2011 UTC (12 years, 7 months ago) by uwe
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.19: +9 -2 lines
Diff to previous 1.19 (colored)

Support symbols in .tbss and .tdata ELF sections

With this change nm(1) prints the expected symbol type ('B' or 'D')
for variables in the .tbss and .tdata sections respectively, instead
of '?'.  This would be what binutils do for non-automatic variables
that are marked as thread-local with the __thread attribute in GCC.

help and ok miod@, guenther@

Revision 1.19 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:41 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.18: +1 -5 lines
Diff to previous 1.18 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.18 / (download) - annotate - [select for diffs], Sun Sep 2 15:19:33 2007 UTC (16 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.17: +5 -5 lines
Diff to previous 1.17 (colored)

use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg

Revision 1.17 / (download) - annotate - [select for diffs], Wed Apr 18 19:03:04 2007 UTC (17 years, 1 month ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.16: +7 -2 lines
Diff to previous 1.16 (colored)

Fix a NULL dereference if the symbol table size is zero; ok millert@ deraadt@

Revision 1.16 / (download) - annotate - [select for diffs], Thu Feb 8 03:50:49 2007 UTC (17 years, 3 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.15: +3 -12 lines
Diff to previous 1.15 (colored)

Do all allocation and deallocation of shstr in elf_symload() to
prevent double-freeing shstr.

Also don't free known NULL values (*pnames and *psnames).

Initially inspired by Charles Longeau's first diff to tech@; he
later sent a second diff to tech@ nearly identical to this commit.
Freaky.

OK mickey@.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Feb 7 10:20:40 2007 UTC (17 years, 3 months ago) by mickey
Branch: MAIN
Changes since 1.14: +4 -3 lines
Diff to previous 1.14 (colored)

check st_name validity also check for overflow and not only for zero; found by Charles Longeau <chl@tuxfamily.org>

Revision 1.14 / (download) - annotate - [select for diffs], Sat Sep 30 14:34:13 2006 UTC (17 years, 7 months ago) by kettenis
Branch: MAIN
Changes since 1.13: +49 -30 lines
Diff to previous 1.13 (colored)

Some fixes for running nm on ELF binaries.
- Fix printing the symbol type of undefined symbols.
- Fall back onto the dynamic symbol table if the normal symbol table is not
  available (i.e. if the binary has been stripped).

ok mickey@

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jan 19 19:37:29 2005 UTC (19 years, 4 months ago) by grange
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.12: +30 -2 lines
Diff to previous 1.12 (colored)

Add elf{32,64}_load_phdrs() for loading program headers.

ok mickey@

Revision 1.12 / (download) - annotate - [select for diffs], Mon Oct 11 04:50:47 2004 UTC (19 years, 7 months ago) by mickey
Branch: MAIN
Changes since 1.11: +5 -1 lines
Diff to previous 1.11 (colored)

add rcisd[]

Revision 1.11 / (download) - annotate - [select for diffs], Sun Oct 10 16:41:18 2004 UTC (19 years, 7 months ago) by mickey
Branch: MAIN
Changes since 1.10: +55 -22 lines
Diff to previous 1.10 (colored)

parse the cpu-specific ids based on the e_machine

Revision 1.10 / (download) - annotate - [select for diffs], Sat Oct 9 20:26:57 2004 UTC (19 years, 7 months ago) by mickey
Branch: MAIN
Changes since 1.9: +203 -3 lines
Diff to previous 1.9 (colored)

move out elf code into elf.c and generate 32 and 64 versions of it;
allow operation on size-mixed host-target as well as ensianess for
both a.out and elf (though a.out 64bit probably does not exist ;)
tested on hppa-sparc64-i386-vax intermixen

Revision 1.9 / (download) - annotate - [select for diffs], Sat Oct 9 20:17:52 2004 UTC (19 years, 7 months ago) by mickey
Branch: MAIN
Changes since 1.8: +79 -69 lines
Diff to previous 1.8 (colored)

factor out code for mapping section index into nlist type

Revision 1.8 / (download) - annotate - [select for diffs], Fri Aug 20 04:42:51 2004 UTC (19 years, 9 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.7: +30 -12 lines
Diff to previous 1.7 (colored)

grok STT_SECTION and beautify STT_OBJECT

Revision 1.7 / (download) - annotate - [select for diffs], Thu Aug 19 19:23:08 2004 UTC (19 years, 9 months ago) by mickey
Branch: MAIN
Changes since 1.6: +4 -2 lines
Diff to previous 1.6 (colored)

STT_FUNC can be an absolute too

Revision 1.6 / (download) - annotate - [select for diffs], Tue May 4 23:07:53 2004 UTC (20 years ago) by mickey
Branch: MAIN
Changes since 1.5: +16 -4 lines
Diff to previous 1.5 (colored)

dig .plt*, .got*, .init, .fini sections

Revision 1.5 / (download) - annotate - [select for diffs], Tue Mar 30 15:35:51 2004 UTC (20 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

no need to force N_EXT as deducted later from type

Revision 1.4 / (download) - annotate - [select for diffs], Tue Mar 30 15:29:44 2004 UTC (20 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.3: +4 -3 lines
Diff to previous 1.3 (colored)

there is more than one way to define symbol type in elf...; kill a debugging printf too

Revision 1.3 / (download) - annotate - [select for diffs], Tue Mar 30 15:12:38 2004 UTC (20 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.2: +5 -1 lines
Diff to previous 1.2 (colored)

translate names in .sbss section as static N_BSS; found by drahn@

Revision 1.2 / (download) - annotate - [select for diffs], Tue Jan 13 17:32:32 2004 UTC (20 years, 4 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.1: +1 -2 lines
Diff to previous 1.1 (colored)

kill unused local vars; from deraadt@

Revision 1.1 / (download) - annotate - [select for diffs], Mon Jan 5 01:27:22 2004 UTC (20 years, 4 months ago) by mickey
Branch: MAIN

nm digs elf and merges w/ size; millert@ ok

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.