Skip to content

Commit

Permalink
macaw-aarch32: add test for binary containing empty section
Browse files Browse the repository at this point in the history
  • Loading branch information
danmatichuk committed Jul 18, 2023
1 parent 399309e commit 3ba6ee3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions macaw-aarch32/tests/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ all: $(patsubst %.c,%-a32.exe,$(wildcard *.c)) $(patsubst %.c,%-t32.exe,$(wildca
%-mixed.s: %-mixed.c
$(A32CC) -fno-stack-protector -S -c $< -o $@

# doesn't work witn arm-none-eabi
test-empty-section.exe: test-empty-section.c
arm-linux-gnueabi-objdump -nostartfiles -O2 -static $< -o $@

syscall.o: syscall.s
$(A32AS) $< -o $@

Expand Down
Binary file not shown.
5 changes: 5 additions & 0 deletions macaw-aarch32/tests/arm/test-empty-section-a32.mcw.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
R { funcs = [ (0x100d8, [(0x100d8,8), (0x100e0, 8)]),
(0x100e8, [(0x100e8,32)])
]
, ignoreBlocks = []
}
14 changes: 14 additions & 0 deletions macaw-aarch32/tests/arm/test-empty-section.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// test.c
#include <stdint.h>

uint64_t x = 0;

int __attribute__((noinline)) test_strd() {
x = 42;
return x == 42;
}

int main() {
test_strd();
return 0;
}

0 comments on commit 3ba6ee3

Please sign in to comment.