From: Eli Bendersky Date: Wed, 5 Sep 2018 12:32:04 +0000 (-0700) Subject: Rename input files for arm relocation test to be more consistent X-Git-Tag: v0.26~39 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8e8e8b86fe1dd438072313508dc1e0ec20f41caf;p=pyelftools.git Rename input files for arm relocation test to be more consistent --- diff --git a/test/testfiles_for_unittests/arm_reloc_relocated.elf b/test/testfiles_for_unittests/arm_reloc_relocated.elf new file mode 100755 index 0000000..f1cfbb8 Binary files /dev/null and b/test/testfiles_for_unittests/arm_reloc_relocated.elf differ diff --git a/test/testfiles_for_unittests/arm_reloc_source.c b/test/testfiles_for_unittests/arm_reloc_source.c new file mode 100644 index 0000000..4ea1c67 --- /dev/null +++ b/test/testfiles_for_unittests/arm_reloc_source.c @@ -0,0 +1,41 @@ +/* Generated by compiling with any LLVM version and +** with any GNU Arm Embedded Toolchain version. +** LLVM 3.8.0/5.0.0 and GNU Arm Embedded Toolchain 2.26 is fine. +** +** clang -O0 --target=arm-none-eabi -emit-llvm -c simple.c -o simple.bc +** llc -O0 -march=arm -filetype=obj simple.bc -o reloc_simple_arm_llvm.o +** arm-none-eabi-ld -e main reloc_simple_arm_llvm.o -o simple_arm_llvm.elf +** +** reloc_simple_arm_llvm.o is ELF file that needs call relocation. +** +** simple_arm_llvm.elf is a relocated ELF file. +*/ + +int add(int a, int b) { + return a + b; +} + +int sub(int a, int b) { + return a - b; +} + +int mul(int a, int b) { + return a * b; +} + +void triple(int a, int b) { + add(a, b); + sub(a, b); + mul(a, b); +} + +int main(void) { + int a = 0xABCD, b = 0x1234; + + add(a, b); + sub(a, b); + mul(a, b); + triple(a, b); + + return 0; +} diff --git a/test/testfiles_for_unittests/arm_reloc_unrelocated.o b/test/testfiles_for_unittests/arm_reloc_unrelocated.o new file mode 100644 index 0000000..a1bfbaa Binary files /dev/null and b/test/testfiles_for_unittests/arm_reloc_unrelocated.o differ diff --git a/test/testfiles_for_unittests/reloc_simple_arm_llvm.o b/test/testfiles_for_unittests/reloc_simple_arm_llvm.o deleted file mode 100644 index a1bfbaa..0000000 Binary files a/test/testfiles_for_unittests/reloc_simple_arm_llvm.o and /dev/null differ diff --git a/test/testfiles_for_unittests/simple.c b/test/testfiles_for_unittests/simple.c deleted file mode 100644 index 4ea1c67..0000000 --- a/test/testfiles_for_unittests/simple.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Generated by compiling with any LLVM version and -** with any GNU Arm Embedded Toolchain version. -** LLVM 3.8.0/5.0.0 and GNU Arm Embedded Toolchain 2.26 is fine. -** -** clang -O0 --target=arm-none-eabi -emit-llvm -c simple.c -o simple.bc -** llc -O0 -march=arm -filetype=obj simple.bc -o reloc_simple_arm_llvm.o -** arm-none-eabi-ld -e main reloc_simple_arm_llvm.o -o simple_arm_llvm.elf -** -** reloc_simple_arm_llvm.o is ELF file that needs call relocation. -** -** simple_arm_llvm.elf is a relocated ELF file. -*/ - -int add(int a, int b) { - return a + b; -} - -int sub(int a, int b) { - return a - b; -} - -int mul(int a, int b) { - return a * b; -} - -void triple(int a, int b) { - add(a, b); - sub(a, b); - mul(a, b); -} - -int main(void) { - int a = 0xABCD, b = 0x1234; - - add(a, b); - sub(a, b); - mul(a, b); - triple(a, b); - - return 0; -} diff --git a/test/testfiles_for_unittests/simple_arm_llvm.elf b/test/testfiles_for_unittests/simple_arm_llvm.elf deleted file mode 100755 index f1cfbb8..0000000 Binary files a/test/testfiles_for_unittests/simple_arm_llvm.elf and /dev/null differ diff --git a/test_arm_call_reloc.py b/test_arm_call_reloc.py index 685cd71..cb52419 100755 --- a/test_arm_call_reloc.py +++ b/test_arm_call_reloc.py @@ -35,8 +35,8 @@ def do_relocation(rel_elf): class TestARMRElocation(unittest.TestCase): def test_reloc(self): test_dir = os.path.joinjoin('test', 'testfiles_for_unittests') - with open(join(test_dir, 'reloc_simple_arm_llvm.o'), 'rb') as rel_f, \ - open(join(test_dir, 'simple_arm_llvm.elf'), 'rb') as f: + with open(join(test_dir, 'arm_reloc_unrelocated.o'), 'rb') as rel_f, \ + open(join(test_dir, 'arm_reloc_relocated.elf'), 'rb') as f: rel_elf = ELFFile(rel_f) elf = ELFFile(f)