| #
72e15f76
|
| 25-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: add see_local parameter to elf_lookup_symbol
This gives the function the ability to return only global symbols.
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Differential Revis
libkldelf: add see_local parameter to elf_lookup_symbol
This gives the function the ability to return only global symbols.
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47206
show more ...
|
| #
599c4399
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: use warnx instead of printf
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46893
|
| #
43628a31
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: add elf_lookup_symbol function
The elf_lookup_symbol function looks up the symbol with a given symbol name. A pointer to the GElf_Sym of the symbol is returned if the symbol exists in the
libkldelf: add elf_lookup_symbol function
The elf_lookup_symbol function looks up the symbol with a given symbol name. A pointer to the GElf_Sym of the symbol is returned if the symbol exists in the opened ELF file.
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46764
show more ...
|
| #
968bcca2
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kern
libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kernel executable. The library can be used to read metadata such as linker_set, mod_depend, mod_version and PNP match info, and raw data from the ELF.
To promote the reuse of the facilities the ELF parsing code is separated from kldxref(8) into a new private library.
For now, libkldelf's source files will be compiled into kldxref(8) directly if kldxref is built during bootstrapping phase. The reason is linking kldxref(8) against the libkldelf static library has an unwanted side effect which renders the linker sets inside the libkldelf implementation empty if the static library is not build by ld -r all the .o files into a single .o before producing the static library.
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Suggested by: jrtc27, markj Differential Revision: https://reviews.freebsd.org/D46719
show more ...
|
| #
50c64df2
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
Revert "libkldelf: add a private library for kernel/kld-related ELF parsing"
This reverts commit 0a2cfd653e86ac41c4e6e32a449d133c0ee6d677.
|
| #
7007de7d
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
Revert "libkldelf: add elf_lookup_symbol function"
This reverts commit 2c7d84795628cb9c7a266718b99b6bca68e0a135.
|
| #
6df3a2d1
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
Revert "libkldelf: use warnx instead of printf"
This reverts commit 550ee2d03c5b88bc5d74b257ffcb3ed2c06a60bb.
|
| #
550ee2d0
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: use warnx instead of printf
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46893
|
| #
2c7d8479
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: add elf_lookup_symbol function
The elf_lookup_symbol function looks up the symbol with a given symbol name. A pointer to the GElf_Sym of the symbol is returned if the symbol exists in the
libkldelf: add elf_lookup_symbol function
The elf_lookup_symbol function looks up the symbol with a given symbol name. A pointer to the GElf_Sym of the symbol is returned if the symbol exists in the opened ELF file.
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46764
show more ...
|
| #
0a2cfd65
|
| 08-Oct-2024 |
Ka Ho Ng <khng@FreeBSD.org> |
libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kern
libkldelf: add a private library for kernel/kld-related ELF parsing
The libkldelf library was originally a part of kldxref(8). It exposed ELF parsing helpers specialized in parsing KLDs and the kernel executable. The library can be used to read metadata such as linker_set, mod_depend, mod_version and PNP match info, and raw data from the ELF.
To promote the reuse of the facilities the ELF parsing code is separated from kldxref(8) into a new private library.
kldxref(8) is modified to link against the libkldelf library.
Sponsored by: Juniper Networks, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46719
show more ...
|
| #
785600d0
|
| 19-Mar-2024 |
John Baldwin <jhb@FreeBSD.org> |
kldxref: Properly handle reading strings near the end of an ELF file
If a string is at or near the end of an input file and the amount of remaining data in the file is smaller than the maximum strin
kldxref: Properly handle reading strings near the end of an ELF file
If a string is at or near the end of an input file and the amount of remaining data in the file is smaller than the maximum string size, the pread(2) system call would return a short read which is treated as an error. Instead, add a new helper function for reading a string which permits short reads so long as the data read from the file contains a terminated string.
Reported by: jrtc27 Reviewed by: jrtc27 Sponsored by: University of Cambridge, Google, Inc. Differential Revision: https://reviews.freebsd.org/D44419
show more ...
|
| #
0d557cdf
|
| 22-Dec-2023 |
John Baldwin <jhb@FreeBSD.org> |
kldxref: Simplify handling of ELF object files
Unlike the backend for ELF DSOs, the object file backend allocated an aligned chunk of memory and read all of the in-memory sections from the file into
kldxref: Simplify handling of ELF object files
Unlike the backend for ELF DSOs, the object file backend allocated an aligned chunk of memory and read all of the in-memory sections from the file into this memory even though most of the file contents were never used. Instead, just track a set of virtual addresses (based at 0) that each loaded section would be loaded at and only read the necessary bits from the backing file when needed.
Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43126
show more ...
|
| #
97530894
|
| 13-Dec-2023 |
Baptiste Daroussin <bapt@FreeBSD.org> |
kldxref: fix build on 32 bits arches
|
| #
0299afdf
|
| 12-Dec-2023 |
John Baldwin <jhb@FreeBSD.org> |
kldxref: Make use of libelf to be a portable cross tool
This allows kldxref to operate on kernel objects from any architecture, not just the native architecture. In particular, this will permit gen
kldxref: Make use of libelf to be a portable cross tool
This allows kldxref to operate on kernel objects from any architecture, not just the native architecture. In particular, this will permit generating linker.hints files as part of a cross-arch release build.
- elf.c is a new file that includes various wrappers around libelf including routines to read ELF data structures such as program and section headers and ELF relocations into the "generic" forms described in <gelf.h>. This file also provides routines for converting a linker set into an array of addresses (GElf_Addr) as well as reading architecture-specific mod_* structures and converting them into "generic" Gmod_* forms where pointers are replaced with addresses.
- The various architecture-specific reloc handlers now use GElf_* types for most values (including GElf_Rel and GElf_Rela for relocation structures) and use routines from <sys/endian.h> to read and write target values. A new linker set matches reloc handlers to specific ELF (class, encoding, machine) tuples.
- The bits of kldxref.c that write out linker.hints now use the encoding (ELFDATA2[LM]SB) of the first file encountered in a directory to set the endianness of the output file. Input files with a different architecture in the same directory are skipped with a warning. In addition, the initial version record for the file must be deferred until the first record is finished since the architecture of the output file is not known until then.
- Various places that used 'sizeof(void *)' throughout now use 'elf_pointer_size()' to determine the size of a pointer in the target architecture.
Tested by: amd64 binary on both amd64 and i386 /boot/kernel Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42966
show more ...
|
| #
4a3cf5f3
|
| 12-Dec-2023 |
John Baldwin <jhb@FreeBSD.org> |
Stop #defining FREEBSD_ELF
This was originally used (along with FREEBSD_AOUT) to prefer the use of ELF in various tools instead of a.out as part of the a.out to ELF transition in the 3.x days. The
Stop #defining FREEBSD_ELF
This was originally used (along with FREEBSD_AOUT) to prefer the use of ELF in various tools instead of a.out as part of the a.out to ELF transition in the 3.x days. The last use of it was removed from <link.h> in commit 66422f5b7a1a6055f0b2358268eb902aab6e2e3e back in 2002, but various files still #define it.
Reviewed by: kevans, imp, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42964
show more ...
|
| #
b3e76948
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
| #
e2d0802c
|
| 17-Jan-2018 |
Ed Maste <emaste@FreeBSD.org> |
kldxref: improve style(9)
Address style issues including some previously raised in D13923.
- Use designated initializers for structs - Always use bracketed return style - No initialization in decla
kldxref: improve style(9)
Address style issues including some previously raised in D13923.
- Use designated initializers for structs - Always use bracketed return style - No initialization in declarations - Align function prototype names - Remove old commented code/unused includes
Submitted by: Mitchell Horne <mhorne063@gmail.com> Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13943
show more ...
|
| #
da67e6e6
|
| 16-Jan-2018 |
Ed Maste <emaste@FreeBSD.org> |
kldxref: handle modules with md_cval at the end of allocated sections
Attempting to retrieve an md_cval string from a kernel module with kldxref would throw a offset error for modules created using
kldxref: handle modules with md_cval at the end of allocated sections
Attempting to retrieve an md_cval string from a kernel module with kldxref would throw a offset error for modules created using lld, since this value would be placed at the end of all allocated sections.
Add an ef_read_seg_string method to the ef interface, to allow reading strings of varying size without attempting to read beyond the segment's bounds.
PR: 224875 Submitted by: Mitchell Horne <mhorne063@gmail.com> Reviewed by: cem, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13923
show more ...
|
| #
f68e716f
|
| 02-Jan-2018 |
Ed Maste <emaste@FreeBSD.org> |
kldxref: correct function names in warning messages
Sponsored by: The FreeBSD Foundation
|
| #
df57947f
|
| 18-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensou
spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point.
Initially, only tag files that use BSD 4-Clause "Original" license.
RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133
show more ...
|
| #
c84739b2
|
| 05-Jun-2013 |
Xin LI <delphij@FreeBSD.org> |
Use calloc().
MFC after: 2 weeks
|
| #
ac8e1396
|
| 05-Jun-2013 |
Xin LI <delphij@FreeBSD.org> |
Remove unneeded reference to link.h (sys/link_elf.h).
MFC after: 2 weeks
|
| #
14560a36
|
| 06-Jan-2009 |
Luigi Rizzo <luigi@FreeBSD.org> |
fix a couple of innocuous compiler warnings
MFC after: 3 days
|
| #
609c1c6c
|
| 12-Jan-2006 |
Jason Evans <jasone@FreeBSD.org> |
Use posix_memalign() rather than assuming that malloc() provides adequate alignment.
Approved by: markm (mentor)
|
| #
757686b1
|
| 18-Dec-2005 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Make our ELF64 type definitions match standards. In particular this means: o Remove Elf64_Quarter, o Redefine Elf64_Half to be 16-bit, o Redefine Elf64_Word to be 32-bit, o Add Elf64_Xword and El
Make our ELF64 type definitions match standards. In particular this means: o Remove Elf64_Quarter, o Redefine Elf64_Half to be 16-bit, o Redefine Elf64_Word to be 32-bit, o Add Elf64_Xword and Elf64_Sxword for 64-bit entities, o Use Elf_Size in MI code to abstract the difference between Elf32_Word and Elf64_Word. o Add Elf_Ssize as the signed counterpart of Elf_Size.
MFC after: 2 weeks
show more ...
|