diff options
| author | Mark Wielaard <mark@klomp.org> | 2026-06-05 15:04:56 +0200 |
|---|---|---|
| committer | Mark Wielaard <mark@klomp.org> | 2026-06-05 15:05:05 +0200 |
| commit | 140f2d6a3f59816240fbc6564f7d45284af470f4 (patch) | |
| tree | bc7447f4378dc8318dcb8c318a618e595d540980 /tools/debugedit.c | |
| parent | debugedit-classify-ar: Check while elf_begin loop failed or succeeded (diff) | |
Normally elf_update will do some strict checks on sections,
specifically it will check that sh_size is a multiple of sh_entsize
(if not zero). This might prevent debugedit from writing out some
sections it just wants to keep unchanged (even if they aren't strictly
valid ELF).
* tools/debugedit.c (fdopen_dso): Set elf_flagelf
ELF_F_PERMISSIVE.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'tools/debugedit.c')
| -rw-r--r-- | tools/debugedit.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/debugedit.c b/tools/debugedit.c index 03788ff..d473b80 100644 --- a/tools/debugedit.c +++ b/tools/debugedit.c | |||
| @@ -3638,7 +3638,15 @@ fdopen_dso (int fd, const char *name) | |||
| 3638 | /* If there are phdrs we want to maintain the layout of the | 3638 | /* If there are phdrs we want to maintain the layout of the |
| 3639 | allocated sections in the file. */ | 3639 | allocated sections in the file. */ |
| 3640 | if (phnum != 0) | 3640 | if (phnum != 0) |
| 3641 | elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT); | 3641 | { |
| 3642 | elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT); | ||
| 3643 | /* Normally elf_update will do some strict checks on sections, | ||
| 3644 | specifically it will check that sh_size is a multiple of | ||
| 3645 | sh_entsize (if not zero). This might prevent debugedit from | ||
| 3646 | writing out some sections it just wants to keep unchanged | ||
| 3647 | (even if they aren't strictly valid ELF). */ | ||
| 3648 | elf_flagelf (elf, ELF_C_SET, ELF_F_PERMISSIVE); | ||
| 3649 | } | ||
| 3642 | 3650 | ||
| 3643 | memset (dso, 0, sizeof(DSO)); | 3651 | memset (dso, 0, sizeof(DSO)); |
| 3644 | dso->elf = elf; | 3652 | dso->elf = elf; |
