Commit Graph

105 Commits

Author SHA1 Message Date
Kai Wang
88d795a0a4 Bump SHLIB_MAJOR for libelf. 2014-01-21 21:13:13 +00:00
Kai Wang
6eabfa9670 Reapply revisions r237528, r237531 and r238741 which make libelf
properly include sys/ headers from the source tree instead of the
host.

These patches are also applied to libdwarf since libdwarf requires
the same sys/ headers as libelf.
2014-01-21 20:42:15 +00:00
Kai Wang
a1abeb052e Remove INCSDIR variable which is only used in elftoolchain's own build
framework.
2014-01-21 20:23:39 +00:00
Kai Wang
7c4a6907ee Set CFLAGS in just one line. 2014-01-15 22:47:53 +00:00
Kai Wang
edbef29b9b Removed source code for the old libelf and build the new libelf from
contrib/ instead.
2014-01-15 22:35:55 +00:00
Andrew Turner
be01a59a79 Add support to the ARM platform specific section types. 2013-08-31 18:13:20 +00:00
Mark Johnston
a25349736d Merge part of r1712 from elftoolchain, making it possible to resize ELF
sections and indirectly change the layout of an ELF file when
ELF_F_LAYOUT is not set.

PR:		bin/167103
Approved by:	rstone (co-mentor)
Obtained from:	elftoolchain
MFC after:	2 weeks
2013-02-24 15:15:50 +00:00
Mark Johnston
9be24c38b8 - Make sure to set an error code when trying to obtain a data descriptor for
a section of type SHT_NULL.
- Update the man page to reflect the fact that elf_getdata() and
  elf_rawdata() may return with an error of ELF_E_SECTION.

PR:		bin/175491
Approved by:	emaste (co-mentor)
MFC after:	1 week
2013-02-19 03:23:13 +00:00
Ed Schouten
ae824d80f2 Fix warnings found by -Wmising-variable-declarations.
This self-written compiler warning, which is hopefully going to be
committed into LLVM sources soon, warns about potentially missing
`static' keywords, similar to -Wmissing-prototypes.

- bin/pax: Move external declaration of chdname and s_mask into extern.h.
- bin/setfacl: Move setfacl.c-specific stuff out of setfacl.h.
- sbin/mount_fusefs: Remove char *progname; use getprogname().
- others: add `static' where possible.
2012-10-19 05:43:38 +00:00
Andrey A. Chernov
7066cac012 Don't ever build files depending on the directory where they are placed in.
It is obvious that its modification time will change with each such file
builded.
This bug cause whole libelf to rebuild itself each second make run
(and relink that files on each first make run) in the loop.
2012-07-24 16:03:28 +00:00
Andrew Turner
6b14dddf9a Add the sys directory we create to the list of items to clean. 2012-06-24 09:19:24 +00:00
Andrew Turner
ec280fdbf5 Create a symlink to sys/elf32.h, sys/elf64.h, and sys/elf_common.h.
When building libelf in the bootstrap stage this would include the tree
versions of, for example, sys/_types.h. This would work as long as the
tree's version of this file was close enough to the system's version of
the file. If, however, there was a change in the tree such that the location
of a typedef was moved this would cause problems. In this case the version
of sys/_types.h in the tree no longer defines __wchar_t and expects it to
to be defined in machine/_types.h, however we pick up machine/_types.h from
the system and find it is not defined there. The solution is to restrict the
parts of sys er include from the tree to those that are needed.

This fixes the recent Tinderbox failure.

Pointy Hat to:	andrew
2012-06-24 08:43:34 +00:00
Joel Dahl
a4dec862ed Remove repeated words. 2012-06-05 18:19:52 +00:00
Joel Dahl
9ee2158b55 mdoc: minor Bl improvements. 2012-06-02 08:47:26 +00:00
Glen Barber
a3fb6da9ba General mdoc(7) and typo fixes.
PR:		167734
Submitted by:	Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after:	3 days
2012-05-11 20:06:46 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Oleksandr Tymoshenko
68fc871575 Handle MIPS .reginfo section as ELF_T_BYTE 2012-03-26 21:31:57 +00:00
Joel Dahl
bea977e7f6 mdoc: sort prologue macros. 2012-03-26 19:23:57 +00:00
Joel Dahl
41949a1ed5 Remove superfluous paragraph macro. 2012-03-25 12:13:24 +00:00
Oleksandr Tymoshenko
e36c52f18a Add handler for MIPS.options section 2012-03-23 22:55:37 +00:00
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