--- /dev/null
+/* 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;
+}
+++ /dev/null
-/* 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;
-}
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)