summaryrefslogtreecommitdiffstats
path: root/lib/libelf/elf_getbase.3
diff options
context:
space:
mode:
authorkaiw <kaiw@FreeBSD.org>2010-06-13 10:58:50 +0000
committerkaiw <kaiw@FreeBSD.org>2010-06-13 10:58:50 +0000
commit04e875d138b0f0687b75c3c2bd7ae8a22dfc293e (patch)
tree696bfa973f99aa4aead1ebdaac75cd47c02438cc /lib/libelf/elf_getbase.3
parent9100139edc3976c40b4dd05903c61be5c5fc333d (diff)
downloadFreeBSD-src-04e875d138b0f0687b75c3c2bd7ae8a22dfc293e.zip
FreeBSD-src-04e875d138b0f0687b75c3c2bd7ae8a22dfc293e.tar.gz
* 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
Diffstat (limited to 'lib/libelf/elf_getbase.3')
-rw-r--r--lib/libelf/elf_getbase.324
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/libelf/elf_getbase.3 b/lib/libelf/elf_getbase.3
index be9d103..c19445d 100644
--- a/lib/libelf/elf_getbase.3
+++ b/lib/libelf/elf_getbase.3
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2006 Joseph Koshy. All rights reserved.
+.\" Copyright (c) 2006,2008,2010 Joseph Koshy. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -23,7 +23,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 11, 2006
+.Dd June 6, 2010
.Dt ELF_GETBASE 3
.Os
.Sh NAME
@@ -38,17 +38,21 @@
.Sh DESCRIPTION
Function
.Fn elf_getbase
-returns the file offset in the containing archive of the first byte of
-the file referenced by ELF descriptor
+returns the file offset to the first byte of the object referenced by ELF
+descriptor
.Ar elf .
+.Pp
+For descriptors referencing members of archives, the returned offset is
+the file offset of the member in its containing archive.
+For descriptors to regular objects, the returned offset is (vacuously)
+zero.
.Sh RETURN VALUES
Function
.Fn elf_getbase
-returns a valid file offset into the containing archive if successful.
-It returns -1 if argument
-.Ar elf
-is NULL or is not a member of an
-archive.
+returns a valid file offset if successful, or
+.Pq Vt off_t
+.Li -1
+in case of an error.
.Sh ERRORS
Function
.Fn elf_getbase
@@ -57,7 +61,7 @@ may fail with the following errors:
.It Bq Er ELF_E_ARGUMENT
Argument
.Ar elf
-is not an ELF descriptor for an archive member.
+was NULL.
.El
.Sh SEE ALSO
.Xr elf 3 ,
OpenPOWER on IntegriCloud