Commit Graph

58 Commits

Author SHA1 Message Date
Ed Maste
9e8f606352 elfdump: limit STDIN to no rights rather than closing it
Closing stdin/stdout/stderr is often a bad idea as a future open()
can end up with its fd. Leave it open and limit it to no rights
instead.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D7984
2016-09-20 21:38:12 +00:00
Ed Maste
06403dbce5 elfdump: adjust stdout/stderr capabilities
stdio uses fstat and the TIOCGETA ioctl. Also collapse the
cap_rights_limit and new cap_ioctls_limit calls into one if statement.
Errors here are not actionable by the user and distinguishing stdout
from stderr doesn't really have value.

Reported by:	kib
Reviewed by:	allanjude, bapt
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7944
2016-09-18 20:23:26 +00:00
Ed Maste
3a4b59a2cf elfdump: handle STT_SPARC_REGISTER
STT_SPARC_REGISTER is a SPARC-specific symbol type specified by the
Sparcv9 ABI to provide some information on register use by the object.

Also rework st_info type lookup to avoid out-of-bounds array access.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2016-01-25 04:22:01 +00:00
Ed Maste
453b09caf5 Rename ELFOSABI_SYSV to ELFOSABI_NONE to match current spec
Source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3731
2015-09-24 21:04:48 +00:00
Ed Maste
050747f2c3 elfdump: report MIPS ELF section type SHT_MIPS_REGINFO
Sponsored by:	The FreeBSD Foundation
2015-09-23 00:32:38 +00:00
Ed Maste
4db90148e1 elfdump: report MIPS-specific section type SHT_MIPS_ABIFLAGS
Sponsored by:	The FreeBSD Foundation
2015-09-22 01:45:43 +00:00
Ed Maste
119b75925c Add RISC-V ELF machine type definition
EM_RISCV is now officially registered as e_machine 243.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-07-24 16:52:21 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Ed Maste
9afb8b24ad Add ELF machine EM_IAMCU, 32-bit Intel MCU
It is e_machine 6, which was previously reserved for 486.
2015-05-14 18:29:05 +00:00
Christian Brueffer
9efc7e72bb Limit descriptors and enter capability mode.
Differential:	D1009
Reviewed by:	jonathan, pjd
MFC after:	2 weeks
Relnotes:	yes
2014-11-24 09:31:38 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Mark Johnston
f4f080c659 Fix a typo.
MFC after:	3 days
2014-09-16 22:26:01 +00:00
Ed Maste
494053f4ee elfdump: Remove extraneous _SUNW_ in reported DT_ names
Sponsored by:	The FreeBSD Foundation
2014-08-21 20:58:43 +00:00
Ed Maste
4d52a0fd97 Rename DT_FEATURE_1 to DT_FEATURE
This provides a minor cleanup in elfdump; there are otherwise no
consumers in the tree.  Old SUN documentation can be found for either
variant, but GNU binutils switched to DT_FEATURE around 2000.

Sponsored by:	The FreeBSD Foundation
2014-08-21 20:55:10 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Ed Maste
ee8e9ecaf1 elfdump: use existing ELF constants where available
Sponsored by:	The FreeBSD Foundation
2014-07-31 15:40:03 +00:00
Ed Maste
2d538f8c83 elfdump: add EM_AARCH64 64-bit ARM machine architecture 2014-07-31 15:25:12 +00:00
Andreas Tobler
8edba45283 Further improvements on elfdump, to follow up r269092:
- Add ARM specific section header types.
- Add SHT_GNU_HASH section header type.
- Improve reporting of undefined tags in d_tags.
- Add DT_GNU_HASH tag.

Reviewed by:	emaste
2014-07-26 19:44:45 +00:00
Ed Maste
b385405966 elfdump: Improve section type reporting
The SHT range 0x70000000-0x7fffffff is processor-specific.  Pass the
ELF machine type header to sh_types so the section header type name can
be reported correctly for the given processor.

For all ranges report the actual value for unknown types.

Add MIPS-specific type SHT_MIPS_OPTIONS.

CR:		D483
Reviewed by:	sbruno, marcel
Sponsored by:	DARPA, AFRL
2014-07-25 18:20:56 +00:00
Baptiste Daroussin
2b7af31cf5 use .Mt to mark up email addresses consistently (part3)
PR:		191174
Submitted by:	Franco Fichtner  <franco at lastsummer.de>
2014-06-23 08:23:05 +00:00
Marcel Moolenaar
a589e596c0 Don't dump core when the ELF file has no section headers. The ELF
core files created by gcore are among those.
2014-06-19 20:12:28 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Ed Maste
97a9b0b123 Handle ELF files with 65280 or more sections
If e_shnum or e_shstrndx are at least SHN_LORESERVE (0xff00) then an
escape value is used to indicate that the actual value is found in one
of section 0's fields.

Sponsored by:	DARPA, AFRL
2014-05-07 21:16:47 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Justin Hibbits
fee1155508 Add missing EM_PPC64 to e_machine header display.
MFC after:	1 week
2014-01-14 04:28:41 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Ed Schouten
bf70becee6 More -Wmissing-variable-declarations fixes.
In addition to adding `static' where possible:

- bin/date: Move `retval' into extern.h to make it visible to date.c.
- bin/ed: Move globally used variables into ed.h.
- sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
- usr.bin/calendar: Remove unneeded variables.
- usr.bin/chat: Make `line' local instead of global.
- usr.bin/elfdump: Comment out unneeded function.
- usr.bin/rlogin: Use _Noreturn instead of __dead2.
- usr.bin/tset: Pull `Ospeed' into extern.h.
- usr.sbin/mfiutil: Put global variables in mfiutil.h.
- usr.sbin/pkg: Remove unused `os_corres'.
- usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.
2012-10-19 14:49:42 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Eitan Adler
097cd85002 Don't extract the n_type value from the elf header, since it is never used
Fix warning when compiling with gcc46:
	variable 'type' set but not used

Approved by:	cperciva
MFC after:	3 days
2012-02-16 05:16:55 +00:00
Marcel Moolenaar
ead616352b o Use C99 designated initializer to properly handle ELFOSABI_STANDALONE.
o  In elf_get_byte(), cast through uint8_t and not char to avoid sign
   extension.
2011-10-16 14:11:05 +00:00
Rui Paulo
bf7cda5121 Teach elfdump(1) about the SUNW_dof section.
Sponsored by:	The FreeBSD Foundation
2010-08-11 18:02:48 +00:00
Ruslan Ermilov
aa4a335bae Use the newly brought %U macro. 2010-01-15 16:01:22 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Marcel Moolenaar
05157fa0a1 s/DT_IA64_PLT_RESERVE/DT_IA_64_PLT_RESERVE/ 2006-01-28 17:58:22 +00:00
Marcel Moolenaar
57668ad84b Know the machines FreeBSD runs on. Print the machine value for
unknown machines.

MFC after: 1 week
2005-12-17 23:24:34 +00:00
Ruslan Ermilov
6c7216df78 Sort sections. 2005-01-18 13:43:56 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Jake Burkholder
d499047c83 Elf_Phdr.p_type 7 is "PT_TLS". 2004-03-02 14:06:27 +00:00
Jens Schweikhardt
dcae6166e2 Removed another spurious semicolon forgotten in the previous commit. 2003-09-06 11:55:05 +00:00
Jens Schweikhardt
81f8caf7ef Removed two spurious semicolons after function definitions.
Removed three spurious tabs on lines by themselves.

PR:		bin/56492
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
MFC after:	6 weeks
2003-09-06 10:55:30 +00:00
Marcel Moolenaar
ac2ded1df3 Fix sign-extension bug for 32 and 64-bit values. For 64-bit values
this involves the sign-extension of the high and low "word". Both
of which are 32-bit. The bug is especially harmful on ia64, where
0x9fffffffe0000000 is a common address (base of register stack).
This was invariably displayed as 0xffffffffe0000000.

The sign-extension is fixed by using {b|l}e{16|32|64}dec() where
applicable. Since elfdump(1) is not a bootstrap tool, dependency
on these functions is not a problem.
2003-08-09 01:55:37 +00:00
Ruslan Ermilov
73e57b801f Synchronize usage() and SYNOPSIS, and fix them (flags are not
optional here).  Sort options.  Print the file name on error.
2003-06-28 22:30:46 +00:00
Ruslan Ermilov
f1e65894d2 mdoc(7) police: Revision. 2003-03-03 11:51:30 +00:00
Jacques Vidrine
de8ab39c6a Spellcheck. 2003-02-28 15:01:31 +00:00