[PATCH 0/3] aarch64: add some core note types name
Patch 1: - Add MTE related regset in core note Patch 2: - Add PAC related regset in core note Patch 3: - Add some core note types name Kuan-Ying Lee (3): aarch64: Add NT_ARM_TAGGED_ADDR_CTRL regset aarch64: Add NT_ARM_PAC_* regset aarch64: add some new core note types name backends/aarch64_corenote.c | 33 - libebl/eblcorenotetypename.c | 6 ++ libelf/elf.h | 2 ++ 3 files changed, 40 insertions(+), 1 deletion(-) -- 2.43.0
[PATCH 2/3] aarch64: Add NT_ARM_PAC_* regset
Add the NT_ARM_PAC_MASK and NT_ARM_PAC_ENABLED_KEYS for aarch64. Recognize and print the new core item. Signed-off-by: Kuan-Ying Lee --- backends/aarch64_corenote.c | 24 +++- libebl/eblcorenotetypename.c | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/backends/aarch64_corenote.c b/backends/aarch64_corenote.c index bd0a4a725411..35c8e8012c7b 100644 --- a/backends/aarch64_corenote.c +++ b/backends/aarch64_corenote.c @@ -115,6 +115,26 @@ static const Ebl_Core_Item aarch64_mte_items [] = } }; +static const Ebl_Core_Item aarch64_pac_enabled_items [] = + { +{ + .name = "enabled_keys", .type = ELF_T_XWORD, .format = 'x', + .offset = 0, .group = "register" +} + }; + +static const Ebl_Core_Item aarch64_pac_mask_items [] = + { +{ + .name = "pauth_dmask", .type = ELF_T_XWORD, .format = 'x', + .offset = 0, .group = "register" +}, +{ + .name = "pauth_cmask", .type = ELF_T_XWORD, .format = 'x', + .offset = 8, .group = "register" +} + }; + #define AARCH64_HWBP_REG(KIND, N) \ { \ .name = "DBG" KIND "VR" #N "_EL1", .type = ELF_T_XWORD, .format = 'x', \ @@ -176,6 +196,8 @@ AARCH64_BP_WP_GROUP ("W", aarch64_hw_wp_items); EXTRA_ITEMS (NT_ARM_HW_BREAK, 264, aarch64_hw_bp_items) \ EXTRA_ITEMS (NT_ARM_HW_WATCH, 264, aarch64_hw_wp_items) \ EXTRA_ITEMS (NT_ARM_SYSTEM_CALL, 4, aarch64_syscall_items) \ - EXTRA_ITEMS (NT_ARM_TAGGED_ADDR_CTRL, 8, aarch64_mte_items) + EXTRA_ITEMS (NT_ARM_TAGGED_ADDR_CTRL, 8, aarch64_mte_items) \ + EXTRA_ITEMS (NT_ARM_PAC_ENABLED_KEYS, 8, aarch64_pac_enabled_items) \ + EXTRA_ITEMS (NT_ARM_PAC_MASK, 16, aarch64_pac_mask_items) #include "linux-core-note.c" diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c index 49331bdf76e8..3e2f8daa0fd5 100644 --- a/libebl/eblcorenotetypename.c +++ b/libebl/eblcorenotetypename.c @@ -93,6 +93,8 @@ ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf, size_t len) KNOWNSTYPE (ARM_HW_WATCH); KNOWNSTYPE (ARM_SYSTEM_CALL); KNOWNSTYPE (ARM_TAGGED_ADDR_CTRL); + KNOWNSTYPE (ARM_PAC_ENABLED_KEYS); + KNOWNSTYPE (ARM_PAC_MASK); KNOWNSTYPE (SIGINFO); KNOWNSTYPE (FILE); #undef KNOWNSTYPE -- 2.43.0
[PATCH 3/3] aarch64: add some new core note types name
Recognize names of some new core note types in ebl_core_note_type_name. Signed-off-by: Kuan-Ying Lee --- libebl/eblcorenotetypename.c | 3 +++ libelf/elf.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c index 3e2f8daa0fd5..18114eb9d0da 100644 --- a/libebl/eblcorenotetypename.c +++ b/libebl/eblcorenotetypename.c @@ -95,6 +95,9 @@ ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf, size_t len) KNOWNSTYPE (ARM_TAGGED_ADDR_CTRL); KNOWNSTYPE (ARM_PAC_ENABLED_KEYS); KNOWNSTYPE (ARM_PAC_MASK); + KNOWNSTYPE (ARM_SVE); + KNOWNSTYPE (ARM_SSVE); + KNOWNSTYPE (ARM_ZA); KNOWNSTYPE (SIGINFO); KNOWNSTYPE (FILE); #undef KNOWNSTYPE diff --git a/libelf/elf.h b/libelf/elf.h index 081742a9c38c..b17f4fdea070 100644 --- a/libelf/elf.h +++ b/libelf/elf.h @@ -831,6 +831,8 @@ typedef struct control. */ #define NT_ARM_PAC_ENABLED_KEYS0x40a /* AArch64 pointer authentication enabled keys. */ +#define NT_ARM_SSVE0x40b /* ARM Streaming SVE registers */ +#define NT_ARM_ZA 0x40c /* ARM SME ZA registers */ #define NT_VMCOREDD0x700 /* Vmcore Device Dump Note. */ #define NT_MIPS_DSP0x800 /* MIPS DSP ASE registers. */ #define NT_MIPS_FP_MODE0x801 /* MIPS floating-point mode. */ -- 2.43.0
[PATCH 1/3] aarch64: Add NT_ARM_TAGGED_ADDR_CTRL regset
Add the NT_ARM_TAGGED_ADDR_CTRL regset for aarch64. Recognize and print this new core itme. Signed-off-by: Kuan-Ying Lee --- backends/aarch64_corenote.c | 11 ++- libebl/eblcorenotetypename.c | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/backends/aarch64_corenote.c b/backends/aarch64_corenote.c index 905a4b8ab9f5..bd0a4a725411 100644 --- a/backends/aarch64_corenote.c +++ b/backends/aarch64_corenote.c @@ -107,6 +107,14 @@ static const Ebl_Core_Item aarch64_syscall_items [] = } }; +static const Ebl_Core_Item aarch64_mte_items [] = + { +{ + .name = "tag_ctrl", .type = ELF_T_XWORD, .format = 'x', + .offset = 0, .group = "register" +} + }; + #define AARCH64_HWBP_REG(KIND, N) \ { \ .name = "DBG" KIND "VR" #N "_EL1", .type = ELF_T_XWORD, .format = 'x', \ @@ -167,6 +175,7 @@ AARCH64_BP_WP_GROUP ("W", aarch64_hw_wp_items); EXTRA_ITEMS (NT_ARM_TLS, 8, aarch64_tls_items) \ EXTRA_ITEMS (NT_ARM_HW_BREAK, 264, aarch64_hw_bp_items) \ EXTRA_ITEMS (NT_ARM_HW_WATCH, 264, aarch64_hw_wp_items) \ - EXTRA_ITEMS (NT_ARM_SYSTEM_CALL, 4, aarch64_syscall_items) + EXTRA_ITEMS (NT_ARM_SYSTEM_CALL, 4, aarch64_syscall_items) \ + EXTRA_ITEMS (NT_ARM_TAGGED_ADDR_CTRL, 8, aarch64_mte_items) #include "linux-core-note.c" diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c index 0e790d062de5..49331bdf76e8 100644 --- a/libebl/eblcorenotetypename.c +++ b/libebl/eblcorenotetypename.c @@ -92,6 +92,7 @@ ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf, size_t len) KNOWNSTYPE (ARM_HW_BREAK); KNOWNSTYPE (ARM_HW_WATCH); KNOWNSTYPE (ARM_SYSTEM_CALL); + KNOWNSTYPE (ARM_TAGGED_ADDR_CTRL); KNOWNSTYPE (SIGINFO); KNOWNSTYPE (FILE); #undef KNOWNSTYPE -- 2.43.0
[Bug debuginfod/32063] let debuginfod-find locate pre-installed (/usr/lib/.debug or similar) exec / .debug files
https://sourceware.org/bugzilla/show_bug.cgi?id=32063 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org --- Comment #1 from Mark Wielaard --- (In reply to Frank Ch. Eigler from comment #0) > This might not be necessary or appropriate in the client side C code, as it > is usually invoked as a *fallback* to system paths not being found. ... > But some applications might directly call debuginfod_find_* APIs, rather > than the searching elfutils paths, in which case looking in system paths > might be appropriate. It actually seems nice to add this functionality to libdebuginfod-client. Maybe by adding the same kind of "magic" search paths with something like new debuginfod_add_search_paths (debuginfod_client *client, const char *paths); Where the paths are like those for dwfl_standard_find_debuginfo /* The default used by dwfl_standard_find_debuginfo. */ #define DEFAULT_DEBUGINFO_PATH ":.debug:/usr/lib/debug" hmmm, I see there is no documentation what that search path string means. But that could be fixed :) -- You are receiving this mail because: You are on the CC list for the bug.
Re: [PATCH] Prevent binaries in src from colliding with libc++ headers
Hi Tristan, On Fri, Aug 9, 2024 at 10:43 AM Tristan ross wrote: > > Well, that's great. Probably should use it instead since it's simpler. > > 日付:Fri, 09 Aug 2024 07:38:05 -0700 差出人:ame...@redhat.com > > (elfutils-devel CC'ed) > > On Fri, Aug 9, 2024 at 10:32 AM Tristan ross > wrote: > > > > The Gentoo patch looks essentially the same as what we started with which > > might bring that warning back. It also uses `-iquote .` but from what I've > > seen, no files in src import with quotes. But that patch will work. > > I built elfutils with the gentoo patch and there were no autoreconf warnings. I've merged the gentoo patch as commit b426c4db31e Thanks, Aaron
[PATCH 1/9] doc: Add elf32_checksum.3 and elf64_checksum.3
Signed-off-by: Aaron Merey --- doc/elf32_checksum.3 | 47 doc/elf64_checksum.3 | 47 2 files changed, 94 insertions(+) create mode 100644 doc/elf32_checksum.3 create mode 100644 doc/elf64_checksum.3 diff --git a/doc/elf32_checksum.3 b/doc/elf32_checksum.3 new file mode 100644 index ..617b955c --- /dev/null +++ b/doc/elf32_checksum.3 @@ -0,0 +1,47 @@ +.TH ELF32_CHECKSUM 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_checksum \- compute the checksum for an ELF32 object file + +.SH SYNOPSIS +.B #include + +.BI "long int elf32_checksum(Elf *" elf ");" + +.SH DESCRIPTION +Compute a checksum for the ELF32 object file referred to by +.I elf. +The checksum is computed from permanent parts of the ELF file and +the result is repeatable. + +.SH PARAMETERS +.TP +.I elf +The ELF32 object file for which the checksum is to be computed. + +.SH RETURN VALUE +On success, return the computed checksum. If an error occurs, return -1 and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf64_checksum (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_checksum () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_checksum.3 b/doc/elf64_checksum.3 new file mode 100644 index ..916cedaa --- /dev/null +++ b/doc/elf64_checksum.3 @@ -0,0 +1,47 @@ +.TH ELF64_CHECKSUM 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_checksum \- compute the checksum for an ELF64 object file + +.SH SYNOPSIS +.B #include + +.BI "long int elf64_checksum(Elf *" elf ");" + +.SH DESCRIPTION +Compute a checksum for the ELF64 object file referred to by +.I elf. +The checksum is computed from permanent parts of the ELF file and +the result is repeatable. + +.SH PARAMETERS +.TP +.I elf +The ELF64 object file for which the checksum is to be computed. + +.SH RETURN VALUE +On success, return the computed checksum. If an error occurs, return -1 and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_checksum (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_checksum () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. -- 2.46.0
[PATCH 2/9] doc: Add elf32_fsize.3 and elf64_fsize.3
Signed-off-by: Aaron Merey --- doc/elf32_fsize.3 | 59 +++ doc/elf64_fsize.3 | 59 +++ 2 files changed, 118 insertions(+) create mode 100644 doc/elf32_fsize.3 create mode 100644 doc/elf64_fsize.3 diff --git a/doc/elf32_fsize.3 b/doc/elf32_fsize.3 new file mode 100644 index ..ea86157f --- /dev/null +++ b/doc/elf32_fsize.3 @@ -0,0 +1,59 @@ +.TH ELF32_FSIZE 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_fsize \- calculate the file size of various ELF32 data structures + +.SH SYNOPSIS +.B #include + +.BI "size_t elf32_fsize(Elf_Type " type ", size_t " count ", unsigned int " version ");" + +.SH DESCRIPTION +Calculate the file size in bytes of various ELF32 data structures, +given their type and count. + +.SH PARAMETERS +.TP +.I type +The ELF32 data structure type for which the file size is to be calculated. See +.BR libelf.h +for a list of valid +.BR Elf_Type +values. + +.TP +.I count +The number of elements of the specified type. + +.TP +.I version +The ELF version. This should be set to +.B EV_CURRENT. + +.SH RETURN VALUE +The size in bytes of the specified count and type of data structure. If an error occurs, +return 0 and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf64_fsize (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_fsize () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_fsize.3 b/doc/elf64_fsize.3 new file mode 100644 index ..45e1d04c --- /dev/null +++ b/doc/elf64_fsize.3 @@ -0,0 +1,59 @@ +.TH ELF64_FSIZE 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_fsize \- calculate the file size of various ELF64 data structures + +.SH SYNOPSIS +.B #include + +.BI "size_t elf64_fsize(Elf_Type " type ", size_t " count ", unsigned int " version ");" + +.SH DESCRIPTION +Calculate the file size in bytes of various ELF64 data structures, +given their type and count. + +.SH PARAMETERS +.TP +.I type +The ELF64 data structure type for which the file size is to be calculated. See +.BR libelf.h +for a list of valid +.BR Elf_Type +values. + +.TP +.I count +The number of elements of the specified type. + +.TP +.I version +The ELF version. This should be set to +.B EV_CURRENT. + +.SH RETURN VALUE +The size in bytes of the specified count and type of data structure. If an error occurs, +return 0 and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_fsize (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_fsize () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. -- 2.46.0
[PATCH 4/9] doc: Add elf32_getphdr.3 and elf64_getphdr.3
Signed-off-by: Aaron Merey --- doc/elf32_getphdr.3 | 45 + doc/elf64_getphdr.3 | 45 + 2 files changed, 90 insertions(+) create mode 100644 doc/elf32_getphdr.3 create mode 100644 doc/elf64_getphdr.3 diff --git a/doc/elf32_getphdr.3 b/doc/elf32_getphdr.3 new file mode 100644 index ..7245f81b --- /dev/null +++ b/doc/elf32_getphdr.3 @@ -0,0 +1,45 @@ +.TH ELF32_GETPHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_getphdr \- retrieve the program header table for an ELF32 object file + +.SH SYNOPSIS +.B #include + +.BI "Elf32_Phdr *elf32_getphdr(Elf *" elf ");" + +.SH DESCRIPTION +Retrieve the program header table for the given ELF descriptor +.I elf. + +.SH PARAMETERS +.TP +.I elf +ELF descriptor from which to retrieve the program header table. + +.SH RETURN VALUE +On success, return a pointer to the program header table. On failure, return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf64_getphdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_getphdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_getphdr.3 b/doc/elf64_getphdr.3 new file mode 100644 index ..b27c8de3 --- /dev/null +++ b/doc/elf64_getphdr.3 @@ -0,0 +1,45 @@ +.TH ELF64_GETPHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_getphdr \- retrieve the program header table for an ELF64 object file + +.SH SYNOPSIS +.B #include + +.BI "Elf64_Phdr *elf64_getphdr(Elf *" elf ");" + +.SH DESCRIPTION +Retrieve the program header table for the given ELF descriptor +.I elf. + +.SH PARAMETERS +.TP +.I elf +ELF descriptor from which to retrieve the program header table. + +.SH RETURN VALUE +On success, return a pointer to the program header table. On failure, return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_getphdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_getphdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. -- 2.46.0
[PATCH 6/9] doc: Add elf32_newehdr.3 and elf64_newehdr.3
Signed-off-by: Aaron Merey --- doc/elf32_newehdr.3 | 53 + doc/elf64_newehdr.3 | 53 + 2 files changed, 106 insertions(+) create mode 100644 doc/elf32_newehdr.3 create mode 100644 doc/elf64_newehdr.3 diff --git a/doc/elf32_newehdr.3 b/doc/elf32_newehdr.3 new file mode 100644 index ..95f8f16d --- /dev/null +++ b/doc/elf32_newehdr.3 @@ -0,0 +1,53 @@ +.TH ELF32_NEWEHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_newehdr \- create a new ELF header for an ELF32 object file + +.SH SYNOPSIS +.B #include + +.BI "Elf32_Ehdr *elf32_newehdr(Elf *" elf ");" + +.SH DESCRIPTION +This function initializes a new ELF header +and associates it with +.I elf. +If +.I elf +already has an ELF header associated with it, no new header will be created. + +.SH PARAMETERS +.TP +.I elf +ELF descriptor for which a new ELF header is to be created. + +.SH RETURN VALUE +On success, return a pointer to the newly created ELF header. If +.I elf +already has an ELF header associated with it, this pre-existing header is +returned and no new header is created. On failure, return NULL and set a +libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf64_newehdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_newehdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_newehdr.3 b/doc/elf64_newehdr.3 new file mode 100644 index ..5147826b --- /dev/null +++ b/doc/elf64_newehdr.3 @@ -0,0 +1,53 @@ +.TH ELF64_NEWEHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_newehdr \- create a new ELF header for an ELF64 object file + +.SH SYNOPSIS +.B #include + +.BI "Elf64_Ehdr *elf64_newehdr(Elf *" elf ");" + +.SH DESCRIPTION +This function initializes a new ELF header +and associates it with +.I elf. +If +.I elf +already has an ELF header associated with it, no new header will be created. + +.SH PARAMETERS +.TP +.I elf +ELF descriptor for which a new ELF header is to be created. + +.SH RETURN VALUE +On success, return a pointer to the newly created ELF header. If +.I elf +already has an ELF header associated with it, this pre-existing header is +returned and no new header is created. On failure, return NULL and set a +libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_newehdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_newehdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. -- 2.46.0
[PATCH 7/9] doc: Add elf32_newphdr.3 and elf64_newphdr.3
Signed-off-by: Aaron Merey --- doc/elf32_newphdr.3 | 62 + doc/elf64_newphdr.3 | 62 + 2 files changed, 124 insertions(+) create mode 100644 doc/elf32_newphdr.3 create mode 100644 doc/elf64_newphdr.3 diff --git a/doc/elf32_newphdr.3 b/doc/elf32_newphdr.3 new file mode 100644 index ..8f55566c --- /dev/null +++ b/doc/elf32_newphdr.3 @@ -0,0 +1,62 @@ +.TH ELF32_NEWPHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_newphdr \- create a new program header table for an ELF32 object file + +.SH SYNOPSIS +.B #include + +.BI "Elf32_Phdr *elf32_newphdr(Elf *" elf ", size_t " count ");" + +.SH DESCRIPTION +Create a new program header table for the ELF32 object file referred to by +.I elf. +The number of entries in the new program header table is specified by +.I count. A +.I count +of zero removes the existing program header table. + +The function allocates a new array of +.I Elf32_Phdr +and makes it the program header table for +.I elf. +Any previous program header table is discarded. + +.SH PARAMETERS +.TP +.I elf +Pointer to the ELF object for which a new program header table is to be created. + +.TP +.I count +The number of entries in the new program header table. A count of zero removes +the existing program header table. + +.SH RETURN VALUE +On success, return a pointer to the first +.I Elf32_Phdr +in the newly created program header table. If an error occurs, return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf64_newphdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_newphdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_newphdr.3 b/doc/elf64_newphdr.3 new file mode 100644 index ..1de450a0 --- /dev/null +++ b/doc/elf64_newphdr.3 @@ -0,0 +1,62 @@ +.TH ELF64_NEWPHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_newphdr \- create a new program header table for an ELF64 object file + +.SH SYNOPSIS +.B #include + +.BI "Elf64_Phdr *elf64_newphdr(Elf *" elf ", size_t " count ");" + +.SH DESCRIPTION +Create a new program header table for the ELF64 object file referred to by +.I elf. +The number of entries in the new program header table is specified by +.I count. A +.I count +of zero removes the existing program header table. + +The function allocates a new array of +.I Elf64_Phdr +and makes it the program header table for +.I elf. +Any previous program header table is discarded. + +.SH PARAMETERS +.TP +.I elf +Pointer to the ELF object for which a new program header table is to be created. + +.TP +.I count +The number of entries in the new program header table. A count of zero removes +the existing program header table. + +.SH RETURN VALUE +On success, return a pointer to the first +.I Elf64_Phdr +in the newly created program header table. If an error occurs, return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_newphdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_newphdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. -- 2.46.0
[PATCH 5/9] doc: Add elf32_getshdr.3 and elf64_getshdr.3
Signed-off-by: Aaron Merey --- doc/elf32_getshdr.3 | 46 + doc/elf64_getshdr.3 | 46 + 2 files changed, 92 insertions(+) create mode 100644 doc/elf32_getshdr.3 create mode 100644 doc/elf64_getshdr.3 diff --git a/doc/elf32_getshdr.3 b/doc/elf32_getshdr.3 new file mode 100644 index ..5e01fe1c --- /dev/null +++ b/doc/elf32_getshdr.3 @@ -0,0 +1,46 @@ +.TH ELF32_GETSHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_getshdr \- retrieve the section header for a section in an ELF32 object file + +.SH SYNOPSIS +.B #include + +.BI "Elf32_Shdr *elf32_getshdr(Elf_Scn *" scn ");" + +.SH DESCRIPTION +Retrieve the section header for the section referred to by +.I scn. + +.SH PARAMETERS +.TP +.I scn +The section descriptor whose section header is to be retrieved. + +.SH RETURN VALUE +On success, return a pointer to the section header. If an error occurs, returns +NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf64_getshdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_getshdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_getshdr.3 b/doc/elf64_getshdr.3 new file mode 100644 index ..cd816aa9 --- /dev/null +++ b/doc/elf64_getshdr.3 @@ -0,0 +1,46 @@ +.TH ELF64_GETSHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_getshdr \- retrieve the section header for a section in an ELF64 object file + +.SH SYNOPSIS +.B #include + +.BI "Elf64_Shdr *elf64_getshdr(Elf_Scn *" scn ");" + +.SH DESCRIPTION +Retrieve the section header for the section referred to by +.I scn. + +.SH PARAMETERS +.TP +.I scn +The section descriptor whose section header is to be retrieved. + +.SH RETURN VALUE +On success, return a pointer to the section header. If an error occurs, returns +NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_getshdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_getshdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. -- 2.46.0
[PATCH 3/9] doc: Add elf32_getchdr.3 and elf64_getchdr.3
Signed-off-by: Aaron Merey --- doc/elf32_getchdr.3 | 48 + doc/elf64_getchdr.3 | 48 + 2 files changed, 96 insertions(+) create mode 100644 doc/elf32_getchdr.3 create mode 100644 doc/elf64_getchdr.3 diff --git a/doc/elf32_getchdr.3 b/doc/elf32_getchdr.3 new file mode 100644 index ..902ae09c --- /dev/null +++ b/doc/elf32_getchdr.3 @@ -0,0 +1,48 @@ +.TH ELF32_GETCHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_getchdr \- retrieve the compression header for a section from an ELF32 object file. + +.SH SYNOPSIS +.B #include + +.BI "Elf32_Chdr *elf32_getchdr(Elf_Scn *" scn ");" + +.SH DESCRIPTION +Retrieve the compression header for a section with compressed data. + +.SH PARAMETERS +.TP +.I scn +Section whose compression header will be retrieved. + +.SH RETURN VALUE +On success, return a pointer to the compression header. On failure, return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf64_getchdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_getchdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. + +.SH HISTORY +.B elf32_getchdr +first appeared in elfutils 0.165. This elfutils libelf function may not be found in other libelf implementations. diff --git a/doc/elf64_getchdr.3 b/doc/elf64_getchdr.3 new file mode 100644 index ..bfcc9c3e --- /dev/null +++ b/doc/elf64_getchdr.3 @@ -0,0 +1,48 @@ +.TH ELF64_GETCHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_getchdr \- retrieve the compression header for a section from an ELF64 object file. + +.SH SYNOPSIS +.B #include + +.BI "Elf64_Chdr *elf64_getchdr(Elf_Scn *" scn ");" + +.SH DESCRIPTION +Retrieve the compression header for a section with compressed data. + +.SH PARAMETERS +.TP +.I scn +Section whose compression header will be retrieved. + +.SH RETURN VALUE +On success, return a pointer to the compression header. On failure, return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_getchdr (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_getchdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. + +.SH HISTORY +.B elf64_getchdr +first appeared in elfutils 0.165. This elfutils libelf function may not be found in other libelf implementations. -- 2.46.0
[PATCH 9/9] doc: Add elf32_xlatetom.3 and elf64_xlatetom.3
Signed-off-by: Aaron Merey --- doc/elf32_xlatetom.3 | 61 doc/elf64_xlatetom.3 | 61 2 files changed, 122 insertions(+) create mode 100644 doc/elf32_xlatetom.3 create mode 100644 doc/elf64_xlatetom.3 diff --git a/doc/elf32_xlatetom.3 b/doc/elf32_xlatetom.3 new file mode 100644 index ..35d9dc6e --- /dev/null +++ b/doc/elf32_xlatetom.3 @@ -0,0 +1,61 @@ +.TH ELF32_XLATETOM 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_xlatetom \- translate ELF32 data from file representation to memory representation + +.SH SYNOPSIS +.B #include + +.BI "int elf32_xlatetom(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");" + +.SH DESCRIPTION +Translates ELF32 data from its file representation to its memory representation. + +.SH PARAMETERS +.TP +.I dst +Destination where the translated data will be stored. + +.TP +.I src +Source data in its file representation. + +.TP +.I encoding +The encoding of the source data. +.I encoding +can be either +.B ELFDATA2LSB +(two's complement little-endian) or +.B ELFDATA2MSB +(two's complement big-endian). + +.SH RETURN VALUE +Return +.I dest +on success. If an error occurs, return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_xlatetof (3), +.BR elf64_xlatetom (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_xlatetom () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_xlatetom.3 b/doc/elf64_xlatetom.3 new file mode 100644 index ..70098013 --- /dev/null +++ b/doc/elf64_xlatetom.3 @@ -0,0 +1,61 @@ +.TH ELF64_XLATETOM 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_xlatetom \- translate ELF64 data from file representation to memory representation + +.SH SYNOPSIS +.B #include + +.BI "int elf64_xlatetom(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");" + +.SH DESCRIPTION +Translates ELF64 data from its file representation to its memory representation. + +.SH PARAMETERS +.TP +.I dst +Destination where the translated data will be stored. + +.TP +.I src +Source data in its file representation. + +.TP +.I encoding +The encoding of the source data. +.I encoding +can be either +.B ELFDATA2LSB +(two's complement little-endian) or +.B ELFDATA2MSB +(two's complement big-endian). + +.SH RETURN VALUE +Return +.I dest +on success. If an error occurs, return NULL and set a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_xlatetom (3), +.BR elf64_xlatetof (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_xlatetom () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. -- 2.46.0
[PATCH 8/9] doc: Add elf32_xlatetof.3 and elf64_xlatetof.3
Signed-off-by: Aaron Merey --- doc/elf32_xlatetof.3 | 61 doc/elf64_xlatetof.3 | 61 2 files changed, 122 insertions(+) create mode 100644 doc/elf32_xlatetof.3 create mode 100644 doc/elf64_xlatetof.3 diff --git a/doc/elf32_xlatetof.3 b/doc/elf32_xlatetof.3 new file mode 100644 index ..a33471f4 --- /dev/null +++ b/doc/elf32_xlatetof.3 @@ -0,0 +1,61 @@ +.TH ELF32_XLATETOF 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf32_xlatetof \- translate ELF32 data to file representation + +.SH SYNOPSIS +.B #include + +.BI "int elf32_xlatetof(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");" + +.SH DESCRIPTION +Translate ELF32 data from its memory representation to its file representation. + +.SH PARAMETERS +.TP +.I dst +Destination where the translated data will be stored. + +.TP +.I src +Source data in its memory representation. + +.TP +.I encoding +The encoding of the destination data. +.I encoding +can be either +.B ELFDATA2LSB +(two's complement little-endian) or +.B ELFDATA2MSB +(two's complement big-endian). + +.SH RETURN VALUE +Return +.I dest +on success. If an error occurs, return NULL and sets a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_xlatetom (3), +.BR elf64_xlatetof (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf32_xlatetof () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. diff --git a/doc/elf64_xlatetof.3 b/doc/elf64_xlatetof.3 new file mode 100644 index ..4af26c91 --- /dev/null +++ b/doc/elf64_xlatetof.3 @@ -0,0 +1,61 @@ +.TH ELF64_XLATETOF 3 2024-08-14 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +elf64_xlatetof \- translate ELF64 data to file representation + +.SH SYNOPSIS +.B #include + +.BI "int elf64_xlatetof(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");" + +.SH DESCRIPTION +Translate ELF64 data from its memory representation to its file representation. + +.SH PARAMETERS +.TP +.I dst +Destination where the translated data will be stored. + +.TP +.I src +Source data in its memory representation. + +.TP +.I encoding +The encoding of the destination data. +.I encoding +can be either +.B ELFDATA2LSB +(two's complement little-endian) or +.B ELFDATA2MSB +(two's complement big-endian). + +.SH RETURN VALUE +Return +.I dest +on success. If an error occurs, return NULL and sets a libelf error code. + +.SH SEE ALSO +.BR elf_errno (3), +.BR elf32_xlatetof (3), +.BR elf64_xlatetom (3), +.BR libelf (3), +.BR elf (5) + +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR elf64_xlatetof () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to or https://sourceware.org/bugzilla/. -- 2.46.0