summaryrefslogtreecommitdiffstats
path: root/tests/elfcopy.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2019-06-03 18:00:20 +0200
committerMark Wielaard <[email protected]>2019-06-03 18:00:20 +0200
commitd08c68fec94b26663257d24dbb8d94f2ed8935cd (patch)
tree39007ac4ea9659f88cc0737c6e72caaa851eac87 /tests/elfcopy.c
parentbfcf8b1fee8805b42b262baf352c58574df59362 (diff)
tests: elfcopy --reverse-offs should only swap sections next to each other.
The run-reverse-sections-self.sh (which really should have been called "swap-sections") could fail if the ELF file had sections that were not directly next to each other swapped. Add a check to make sure the swapped sections are actually directly next to each other. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests/elfcopy.c')
-rw-r--r--tests/elfcopy.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/elfcopy.c b/tests/elfcopy.c
index d457badb..4542222e 100644
--- a/tests/elfcopy.c
+++ b/tests/elfcopy.c
@@ -225,6 +225,7 @@ copy_elf (const char *in, const char *out, bool use_mmap, bool reverse_offs)
&& shdr.sh_addralign == 1
&& last_shdr.sh_type != SHT_NOBITS
&& shdr.sh_type != SHT_NOBITS
+ && last_shdr.sh_offset + last_shdr.sh_size == shdr.sh_offset
&& (phnum == 0
|| ((shdr.sh_flags & SHF_ALLOC) == 0
&& (last_shdr.sh_flags & SHF_ALLOC) == 0)))