Commit Graph

135 Commits

Author SHA1 Message Date
jkoshy
f8600f40e7 Ensure that the section header table is written out in an order
consistent with the section indices returned to the application by
elf_ndxscn().

Submitted by:		kaiw
2008-03-19 06:06:34 +00:00
jkoshy
af7049a2cd Clarify that the ELF library only sets the sh_entsize field of a
section header entry if the application is not taking charge of ELF
object layout.

Update (c) years, and bump the manual page's date.

Submitted by:		kaiw
2008-03-19 05:07:49 +00:00
jkoshy
35a6571045 - Fix an off-by-one bug in _libelf_insert_section(). [1]
- Update (c) years.

Submitted by:		kaiw [1]
2008-03-03 04:29:25 +00:00
jkoshy
380ba89956 Translate the r_info field of ELF relocation records when converting
between 64 and 32 bit variants.

Submitted by:		kaiw
2008-03-02 06:33:10 +00:00
jkoshy
5c5b24c7a8 Document the return type for gelf_fsize(3).
Submitted by:		kaiw
2008-02-04 18:50:28 +00:00
jkoshy
6bb7675a71 - Allow source descriptors with no data to be used as arguments to the
elf{32,64}_xlateto[fm]() translation functions.  This change makes our
  libelf compatible with other ELF(3) implementations. [1]
- Update manual page to reflect this change.
- Style fixes: wrap a long line.

Submitted by:	jb [1]
2007-11-26 03:09:33 +00:00
jkoshy
02cd3fead5 Sections of type SHT_GNU_versym use ELF type ELF_T_HALF. Update manual
page and code to match.

Submitted by:	jb
MFC After: 	1 day
2007-11-23 11:29:36 +00:00
jkoshy
9392728ba0 Consistently use the word 'flag' to refer to ELF_F_* constants.
MFC after:	1 day
2007-10-22 03:38:43 +00:00
jkoshy
3d86cf4179 Remove references to the 'e_phnum' field of the ELF header. Instead,
point the reader to the elf_getphnum() function.

MFC after:	1 day
2007-10-21 05:15:07 +00:00
jkoshy
0f156735c0 Refer the reader to the elf_update(3) manual page for more information
on application control of ELF object layout.

MFC after:	1 day
2007-10-21 05:08:40 +00:00
jkoshy
3a55a053ea Do not generate unneeded initializers.
Approved by:	re (bmah)
2007-09-09 02:10:53 +00:00
jkoshy
a632b8cbc0 Fix a bug that prevented applications from laying out ELF objects
with section header tables residing in between other sections.

Introduce additional checks for overlaps between section data and
the section header table when the application is performing section
layout.

Document additional error returns.

Reported by:	Kai Wang <kaiw27 at gmail dot com>
Approved by:	re (rwatson)
2007-09-08 08:20:12 +00:00
jkoshy
bbf0406634 Cross-reference the correct manual page.
Approved by:	re (bmah)
2007-07-28 15:35:03 +00:00
deischen
2a7306fdc5 Use C comments since we now preprocess these files with CPP. 2007-04-29 14:05:22 +00:00
jkoshy
9645b900be Describe the contents of the "ar_name" and "ar_rawname" fields of
Elf_Arhdr structures better.
2007-03-27 04:47:50 +00:00
jkoshy
e13fe525e7 Bug fixes to ar(1) archive handling:
- Correctly retrieve the initial (special) members of an archive after
   an archive descriptor is rewound using elf_rand(SARMAG).
 - Do not strip trailing white space from the 'raw' names retrieved
   using elf_getarhdr().

Reported by:	"Hyo geol, Lee" <hyogeollee at gmail dot com>
2007-03-27 04:40:57 +00:00
jkoshy
359932b592 Document the return type of elf_rand(3) correctly. 2007-03-26 16:31:42 +00:00
jkoshy
b5f826c9a6 Correct a typo.
Submitted by:	 Kai Wang <kaiw27 at gmail dot com>
2007-03-19 03:52:20 +00:00
jkoshy
cb00361cdd Add GELF_* accessor macros.
Prodded by:	Sam Arun Raj <samarunraj at gmail dot com>
2007-03-08 04:01:30 +00:00
jkoshy
cf625a0a3b Fix a typo.
Submitted by:	 Kai Wang <kaiw27 at gmail dot com>
2007-03-03 06:13:38 +00:00
dumbbell
d110653fb0 Fix a bug with the release of section's raw data. Both release loops
were using translated data linked list, leading to a memory leak.

Jkoshy's testsuite was used to check for non-regression.
2007-02-21 08:14:22 +00:00
jkoshy
594130bd7c Document the additional error returns possible when handling ELF objects
that require extended numbering.
2006-12-25 02:24:39 +00:00
jkoshy
26d8253ac6 Keep shadow copies of the e_shnum', e_phnum' and `e_shstrndx'
members of the ELF Executable Header inside the library-private
`struct _Elf' descriptor and only update the underlying Elf{32,64}_Ehdr
structure on an elf_update(3) call.  These fields of the Ehdr
structure are technically `out of bounds' for an application program
per the ELF(3) API, but we've seen applications that initialize
a new Ehdr structure using memcpy(), messing up the library's
invariants. [1]

Implement elf_getphnum() and handle ELF objects with more than
64K program header table entries.

Reported by:	jb [1]
2006-12-25 02:22:22 +00:00
jkoshy
44313eba34 Use strncpy() instead of strlcpy() when copying members of
a `struct ar_hdr'.  These members do not use NUL-termination
while strlcpy() expects its source buffer to be NUL-terminated.
2006-12-25 02:06:32 +00:00
jkoshy
4df7e1dc11 Correct a logic error. 2006-12-24 09:45:10 +00:00
jkoshy
25bc13b736 Use <osreldate.h> rather than the OS version reported by the kernel
to determine which Elf Types are to be handled.  Change the M4
templates to wrap an `#if __FreeBSD_version >= NNN'/`#endif' pair
around the generated code for each ELF data type, where `NNN' is
the OS version where the ELF type was added to the source tree.

This change allows cross-builds of old sources on newer FreeBSD
systems to work correctly.

Problem reported by:	ru
2006-12-18 05:40:01 +00:00
jkoshy
fdbeae7cd4 Use the correct value of __FreeBSD_version. 2006-12-18 05:36:23 +00:00
jkoshy
38887bc05d Fix a typo. 2006-12-16 10:45:43 +00:00
jkoshy
646e93c9a4 Name the functions documented by this manual page correctly. 2006-12-13 15:14:46 +00:00
jkoshy
64e15beb8d Document the ELF types supported by libelf.
Document the relationship between section types (SHT_*) and the
types known to the libelf.
2006-12-11 09:03:27 +00:00
jkoshy
e60a96b820 Make the generated message from `elf_errmsg(-1)' a little more readable. 2006-12-09 16:27:15 +00:00
ru
e3fcf40047 - style: use =' instead of +=' for initial assignments.
- don't add generated sources' objects to OBJS explicitly;
  GENSRCS is part of SRCS so they were already in OBJS.
2006-11-24 06:38:11 +00:00
ru
8ee020ccf7 Fix minor formatting issues:
- make document title match filename;
- remove hard sentence breaks, whitespace at EOL, and double whitespace;
- sort SEE ALSO xrefs, adding missing section numbers;
- fix a misspelled macro name.
2006-11-13 09:46:16 +00:00
jkoshy
1d082af7af - Replace the use of DPSRCS with something more appropriate. DPSRCS
is for when you need something in ".depend", but not compiled in.
- Style fixes: Spell ${.OBJDIR} as ".".
- Neaten a comment.

Submitted by:	ru
2006-11-12 18:43:25 +00:00
jkoshy
62913629e6 MFP4: Add an implementation of the ELF(3) and GELF(3) API set.
Bump __FreeBSD_version.

Reviewed by:	jb
2006-11-11 17:16:35 +00:00