summaryrefslogtreecommitdiff
path: root/lib/libelf
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2012-11-04 02:52:03 +0000
commit23090366f729c56cab62de74c7a51792357e98a9 (patch)
treec511c885796e28ec571b5267e8f11f3b103d35e9 /lib/libelf
parent7750ad47a9a7dbc83f87158464170c8640723293 (diff)
parent22ff74b2f44234d31540b1f7fd6c91489c37cad3 (diff)
Notes
Diffstat (limited to 'lib/libelf')
-rw-r--r--lib/libelf/Makefile15
-rw-r--r--lib/libelf/elf.316
-rw-r--r--lib/libelf/elf_begin.32
-rw-r--r--lib/libelf/elf_errmsg.c2
-rw-r--r--lib/libelf/gelf.314
5 files changed, 31 insertions, 18 deletions
diff --git a/lib/libelf/Makefile b/lib/libelf/Makefile
index fe921cbe674b..f4baf1412ab2 100644
--- a/lib/libelf/Makefile
+++ b/lib/libelf/Makefile
@@ -55,9 +55,22 @@ SRCS= elf_begin.c \
${GENSRCS}
INCS= libelf.h gelf.h
+#
+# We need to link against the correct version of these files. One
+# solution is to include ../../sys in the include path. This causes
+# problems when a header file in sys depends on a file in another
+# part of the tree, e.g. a machine dependent header.
+#
+SRCS+= sys/elf32.h sys/elf64.h sys/elf_common.h
+
GENSRCS= libelf_fsize.c libelf_msize.c libelf_convert.c
CLEANFILES= ${GENSRCS}
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../sys
+CLEANDIRS= sys
+CFLAGS+= -I${.CURDIR} -I.
+
+sys/elf32.h sys/elf64.h sys/elf_common.h: ${.CURDIR}/../../sys/${.TARGET}
+ mkdir -p ${.OBJDIR}/sys
+ ln -sf ${.CURDIR}/../../sys/${.TARGET} ${.TARGET}
SHLIB_MAJOR= 1
diff --git a/lib/libelf/elf.3 b/lib/libelf/elf.3
index 609fab60c0a2..35bba9c3e8ee 100644
--- a/lib/libelf/elf.3
+++ b/lib/libelf/elf.3
@@ -385,9 +385,9 @@ See
This section contains a brief overview of the available functionality
in the ELF library.
Each function listed here is described further in its own manual page.
-.Bl -tag -width indent
+.Bl -tag -width 2n
.It "Archive Access"
-.Bl -tag -compact
+.Bl -tag -width 17n -compact
.It Fn elf_getarsym
Retrieve the archive symbol table.
.It Fn elf_getarhdr
@@ -404,7 +404,7 @@ Random access inside an
archive.
.El
.It "Data Structures"
-.Bl -tag -compact
+.Bl -tag -width 17n -compact
.It Fn elf_getdata
Retrieve translated data for an ELF section.
.It Fn elf_getscn
@@ -437,7 +437,7 @@ Allocate an Executable Header in an ELF object.
Allocate or resize the Program Header Table in an ELF object.
.El
.It "Data Translation"
-.Bl -tag -compact
+.Bl -tag -width 17n -compact
.It Fn elf32_xlatetof , Fn elf64_xlatetof
Translate an ELF data structure from its native representation to its
file representation.
@@ -446,14 +446,14 @@ Translate an ELF data structure from its file representation to a
native representation.
.El
.It "Error Reporting"
-.Bl -tag -compact
+.Bl -tag -width 17n -compact
.It Fn elf_errno
Retrieve the current error.
.It Fn elf_errmsg
Retrieve a human readable description of the current error.
.El
.It "Initialization"
-.Bl -tag -compact
+.Bl -tag -width 17n -compact
.It Fn elf_begin
Opens an
.Xr ar 1
@@ -468,7 +468,7 @@ archive or ELF object present in a memory area.
Sets the operating version.
.El
.It "IO Control"
-.Bl -tag -width ".Fn elf_setshstrndx" -compact
+.Bl -tag -width 17n -compact
.It Fn elf_cntl
Manage the association between and ELF descriptor and its underlying file.
.It Fn elf_flagdata
@@ -492,7 +492,7 @@ Recompute ELF object layout and optionally write the modified object
back to the underlying file.
.El
.It "Queries"
-.Bl -tag -width ".Fn elf_getshstrndx" -compact
+.Bl -tag -width 17n -compact
.It Fn elf32_checksum , Fn elf64_checkum
Compute checksum of an ELF object.
.It Fn elf_getident
diff --git a/lib/libelf/elf_begin.3 b/lib/libelf/elf_begin.3
index ea68c26c6f88..6d9371a9a6f3 100644
--- a/lib/libelf/elf_begin.3
+++ b/lib/libelf/elf_begin.3
@@ -252,7 +252,7 @@ was created.
.It Bq Er ELF_E_ARGUMENT
An
.Xr ar 1
-archive was opened with with
+archive was opened with
.Ar cmd
set to
.Dv ELF_C_RDWR .
diff --git a/lib/libelf/elf_errmsg.c b/lib/libelf/elf_errmsg.c
index 05947a7cf28a..193a6024512e 100644
--- a/lib/libelf/elf_errmsg.c
+++ b/lib/libelf/elf_errmsg.c
@@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
* Retrieve a human readable translation for an error message.
*/
-const char *_libelf_errors[] = {
+static const char *_libelf_errors[] = {
#define DEFINE_ERROR(N,S) [ELF_E_##N] = S
DEFINE_ERROR(NONE, "No Error"),
DEFINE_ERROR(ARCHIVE, "Malformed ar(1) archive"),
diff --git a/lib/libelf/gelf.3 b/lib/libelf/gelf.3
index d541388aee39..1c2f0108f6c7 100644
--- a/lib/libelf/gelf.3
+++ b/lib/libelf/gelf.3
@@ -115,7 +115,7 @@ routines will signal an error if a GElf value is out of range
for the underlying ELF data type.
.Ss Namespace use
The GElf interface uses the following symbols:
-.Bl -tag
+.Bl -tag -width 8n
.It GElf_*
Class-independent data types.
.It gelf_*
@@ -125,16 +125,16 @@ For functions defined in the API set.
This section provides an overview of the GElf programming APIs.
Further information is provided in the manual page of each function
listed here.
-.Bl -tag
+.Bl -tag -width 2n
.It "Allocating ELF Data Structures"
-.Bl -tag -compact
+.Bl -tag -width 19n -compact
.It Fn gelf_newehdr
Allocate a new ELF Executable Header.
.It Fn gelf_newphdr
Allocate a new ELF Program Header Table.
.El
.It "Data Translation"
-.Bl -tag -compact
+.Bl -tag -width 19n -compact
.It Fn gelf_xlatetof
Translate the native representation of an ELF data structure to its
file representation.
@@ -143,7 +143,7 @@ Translate from the file representation of an ELF data structure to a
native representation.
.El
.It "Retrieving ELF Data"
-.Bl -tag -compact
+.Bl -tag -width 19n -compact
.It Fn gelf_getdyn
Retrieve an ELF
.Sy .dynamic
@@ -162,7 +162,7 @@ Retrieve an ELF Section Header Table entry from the underlying ELF descriptor.
Retrieve an ELF symbol table entry.
.El
.It Queries
-.Bl -tag -compact
+.Bl -tag -width 19n -compact
.It Fn gelf_checksum
Retrieves the ELF checksum for an ELF descriptor.
.It Fn gelf_fsize
@@ -171,7 +171,7 @@ Retrieves the size of the file representation of an ELF type.
Retrieves the ELF class of an ELF descriptor.
.El
.It "Updating ELF Data"
-.Bl -tag -compact -width ".Fn gelf_update_shdr"
+.Bl -tag -width 19n -compact
.It Fn gelf_update_dyn
Copy back an ELF
.Sy .dynamic