Commit Graph

85 Commits

Author SHA1 Message Date
Eitan Adler
36daf0495a - change "is is" to "is" or "it is"
- change "the the" to "the"

Approved by:	lstewart
Approved by:	sahil (mentor)
MFC after:	3 days
2011-10-16 14:30:28 +00:00
Kai Wang
b8331e4264 Document the behavior of elf_getdata() and elf_rawdata() with
zero-sized ELF sections.

Obtained from:	elftoolchain
2011-05-07 11:29:48 +00:00
Kai Wang
08a7f479dd For zero-sized sections, set the d_buf field of the Elf_Data
descriptor returned by `elf_rawdata()` to NULL.

Obtained from:	elftoolchain
2011-05-07 11:04:36 +00:00
David E. O'Brien
9b2a96cc04 Add the ability to search for all the inlined instances of a given function.
Reviewed by:	jb
Obtained from:	Juniper Networks
2011-05-07 01:05:31 +00:00
Ulrich Spörlein
c9bb895ec8 Fix some duplicate-word typos in manpages.
Submitted by:	arundel
MFC after:	1 week
2011-03-02 21:59:53 +00:00
Rebecca Cran
ac095af538 Remove duplicate "in".
Suggested by:	Rob Farmer <rfarmer at predatorlabs.net>
MFC after:	3 days
2011-03-01 11:47:51 +00:00
Rebecca Cran
b633aa9451 Revert some of r177626. "in in" is valid in certain sentences.
PR:		121490
MFC after:	3 days
2011-02-28 10:03:48 +00:00
Alexander Kabaev
1bc9325f8a Do not allocate buffer to hold data for zero-sized sections. 2011-01-25 19:17:50 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Kai Wang
ea22f625a7 libelf is overly strict about the type and alignment of Elf_Data
objects inside one ELF section, which prevents the creation of a ELF
section with mixed data types. For example, gcc LTO use libelf to
create a .gnu_lto_XXX section that contains integers and a string
table, which doesn't work with our libelf implementation.

The changes made in this commit include:
* Allow Elf_Data type to be different than section type.
* Relax Elf_Data alignment check.
* Align each Elf_Data by their own alignment instead of section alignment.

MFC after:   1 month
2010-09-09 18:51:50 +00:00
Rui Paulo
029a737371 Don't link drti.o with libelf_pic.a. This means that all software with
userland SDT probes must be linked with libelf explicitly.

Requested by:	kib
Sponsored by:	The FreeBSD Foundation
2010-08-21 17:29:59 +00:00
Rui Paulo
9329096b80 Install a PIC libelf. This will be needed by the DTrace runtime
instrumentation object (dtri.o).

Sponsored by:	The FreeBSD Foundation
2010-08-21 10:40:12 +00:00
Joel Dahl
c2025a7660 Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
2010-08-16 15:18:30 +00:00
Kai Wang
f4717fa913 Add translation support for section type SHT_SUNW_dof.
Submitted by:	rpaulo
MFC after:	2 weeks
2010-08-11 19:59:31 +00:00
Joel Dahl
799162a628 Spelling fixes. 2010-08-03 17:40:09 +00:00
Kai Wang
41bc155d1f Protect GNUHASH translation functions with #ifdef; unbreak cross
toolchain build.

Reported by:	jchandra
MFC after:	1 month
2010-07-28 11:01:07 +00:00
Kai Wang
85de6c411e * Remove a superfluous error description.
* Document an additional error that may be returned: `ELF_E_ARCHIVE`.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 13:29:00 +00:00
Kai Wang
0806107365 Add a cross-reference to elf_rawfile(3).
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 13:23:07 +00:00
Kai Wang
52d63629e6 * Note that ar(1) archives may also be opened using elf_memory(3).
* Ignore the passed in value of the `fd` argument for ar(1) archives
  opened with elf_memory(3).

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 13:18:57 +00:00
Kai Wang
d284162491 Remove a redundant word.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 13:00:01 +00:00
Kai Wang
d961c5b461 Move helper functions _libelf_ar_get_{name,number,string}() and
`_libelf_ar_open()` to a new compilation unit "libelf_ar_util.c"
to break the circular dependency between "elf_memory.o" and
"libelf_ar.o".

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 12:54:34 +00:00
Kai Wang
e2efa43644 Fix a memory leak.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 12:30:58 +00:00
Kai Wang
86f5401b91 * Deprecate elf_getshnum(), elf_getphnum() and elf_getshstrndx() in
favour of `elf_getshdrnum()`, `elf_getphdrnum()` and `elf_getshdrstrndx()`
  respectively.
* Add new manual pages for `elf_getshdrstrndx()`, `elf_getphdrnum()` and
  `elf_getshdrnum()`.
* Add a deprecation warning for `elf_getshstrndx()`, `elf_getphnum()` and
  `elf_getshnum()`.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 12:14:50 +00:00
Kai Wang
9eab8b61d9 Avoid switching between "unsigned char" and "char" in the C code
generated from "libelf_convert.m4".

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 11:26:18 +00:00
Kai Wang
1d69e83ddd Add support for translating sections of type ELF_T_GNUHASH.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 10:57:22 +00:00
Kai Wang
fff07a4233 - Document that the *fsize() functions return a size of 1 for Elf
types that don't have a fixed size.
- The *fsize() functions should return a size of 1, for variable length
  types.
- Redefine symbol ELF_T_LAST to match the current end of the list.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 10:39:29 +00:00
Kai Wang
f0f10541db Perform additional checks when translating between file and memory
representations of ELF types.

The ELF(3) API allows applications to request a conversion that is
`in-place', i.e., with source and destinations data buffers being
the same.  However, the file and memory sizes of ELF sections that
have additional internal structure, such as those of type `Elf_Note',
or `Elf_GNU_Hash_Header', can be determined only known after the
type-specific headers that comprise the first few words in these
sections are read and translated.

Pass in the size of destination buffer to type translation routines
in "libelf_convert.m4" and have these routines return an error code
if the translated data would not fit inside the destination buffer.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 10:25:02 +00:00
Kai Wang
5d261af96d Reduce verbosity.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 10:11:46 +00:00
Kai Wang
a2cf6dae18 - Return zero for file sizes of ELF types that have a variable size.
- Neaten a few comments.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 10:08:25 +00:00
Kai Wang
135fdd3027 Note that the *_fsize() functions are only defined for ELF types that
have a fixed size.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 10:02:59 +00:00
Kai Wang
0e3c61d436 Changes for supporting GNU Hash sections.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 09:56:42 +00:00
Kai Wang
894afa87d6 Add a new ELF type denoting GNU style hash tables.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 09:51:24 +00:00
Kai Wang
7384c87800 Allow an application that updates only the ELF Ehdr to work.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 09:47:14 +00:00
Kai Wang
f44d4dafb4 Use <unistd.h> to declare the prototype for ftruncate().
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 09:33:45 +00:00
Kai Wang
c0308c2c84 Bug fix: permit the creation of zero-sized sections.
Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 09:27:16 +00:00
Kai Wang
3fd7b10a01 Improve compatibility with other implementations of the ELF(3) API:
when an output file has no program headers, set the 'e_phentsize'
field of the ELF executable header to zero.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 09:20:40 +00:00
Kai Wang
e8968eb491 Bug fix: when updating headers using the gelf_update_*() functions,
the appropriate `dirty' bit needs to be set for both the Elf32 and
Elf64 case.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 08:58:52 +00:00
Kai Wang
7ee5b008fb - Correctly handle sections of type SHT_NOBITS. For these sections:
- elf_getdata() and elf_rawdata() should return an "Elf_Data" structure
    that has its "d_buf" member set to NULL and "d_size" member set to
    the nominal 'size' of the section.  [1]
  - Update the manual page for these functions.
- Fix a memory leak in an error handling path inside elf_getdata().
- Use _libelf_allocate_data() in elf_newdata() for consistency.

Obtained from:	elftoolchain
MFC after:		1 month
2010-07-21 08:54:46 +00:00
Kai Wang
c0aaca95a7 Remove a superfluous comment.
Obtained from:	     elftoolchain
MFC after:	     1 month
2010-07-21 08:43:48 +00:00
Kai Wang
b2c6fcf986 * Improve compatibility with existing application code by permitting the
use of `elf_getbase()` on non-archive members. This change is needed
  for gcc LTO (-flto) to work properly.
* Style fix: paranthesize returned values.
* Document the current behaviour of `elf_getbase()`.

Tested by:	gerald, Steve Kargl (original patch)
Obtained from:	elftoolchain
MFC after:	3 days
2010-06-13 10:58:50 +00:00
Ulrich Spörlein
2a10d6d199 mdoc: fix parenthesis
Reviewed by:	brueffer
2010-05-11 23:08:31 +00:00
Ulrich Spörlein
aa12cea2cc mdoc: order prologue macros consistently by Dd/Dt/Os
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 19:08:06 +00:00
Christian Brueffer
0ae739d6b2 Remove useless .TE groff macro.
Submitted by:	Joerg Sonnenberger
MFC after:	3 days
2010-01-12 17:38:23 +00:00
Ed Schouten
daaf575910 Build lib/ with WARNS=6 by default.
Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and
lower it when needed.

I'm setting WARNS?=0 for secure/. It seems secure/ includes the
Makefile.inc provided by lib/. I'm not going to touch that directory.
Most of the code there is contributed anyway.
2010-01-02 09:58:07 +00:00
David E. O'Brien
449c70725e Don't need to set symbol, default value is OK. 2009-03-12 04:44:09 +00:00
Joseph Koshy
175efc49f4 Add a README. 2009-01-05 05:14:26 +00:00
John Birrell
9445f413ee Relax the strict type check because gcc as distributed doesn't create
debug strtabs with type SHT_STRTAB. Although we could change FreeBSD's
gcc, we really need to play nicely with gcc as distributed by the FSF.
2008-05-23 07:35:36 +00:00
John Birrell
7d15d0a9c6 Change the alignment of the NOTE to match what gcc does. 2008-05-23 07:33:45 +00:00
John Birrell
c4607eb7ad Add the case for SHT_AMD64_UNWIND. 2008-05-23 07:32:19 +00:00
Christian Brueffer
662cac9f23 Fix some "in in" typos in comments.
PR:		121490
Submitted by:	Anatoly Borodin <anatoly.borodin@gmail.com>
Approved by:	rwatson (mentor), jkoshy
MFC after:	3 days
2008-03-26 07:32:08 +00:00