1 diff -Nur elf2flt-6d80ab6c93409e796f85da404bde84b841231531.orig/elf2flt.c elf2flt-6d80ab6c93409e796f85da404bde84b841231531/elf2flt.c
2 --- elf2flt-6d80ab6c93409e796f85da404bde84b841231531.orig/elf2flt.c 2017-09-27 06:06:04.000000000 +0200
3 +++ elf2flt-6d80ab6c93409e796f85da404bde84b841231531/elf2flt.c 2017-09-27 06:07:51.032597579 +0200
6 #elif defined(TARGET_h8300)
8 +#elif defined(TARGET_lm32)
10 #elif defined(TARGET_m68k)
12 #elif defined(TARGET_microblaze)
15 #elif defined(TARGET_nios2)
17 +#elif defined(TARGET_lm32)
19 +#define FLAT_LM32_RELOC_TYPE_32_BIT 0
20 +#define FLAT_LM32_RELOC_TYPE_HI16_BIT 1
21 +#define FLAT_LM32_RELOC_TYPE_LO16_BIT 2
22 #elif defined(TARGET_xtensa)
30 +#if defined (TARGET_bfin) || defined (TARGET_lm32)
31 unsigned long persistent_data = 0;
37 goto bad_resolved_reloc;
38 +#elif defined(TARGET_lm32)
41 + if (q->howto->type == R_LM32_HI16) {
42 + pflags = FLAT_LM32_RELOC_TYPE_HI16_BIT << 29;
44 + pflags = FLAT_LM32_RELOC_TYPE_LO16_BIT << 29;
47 + relocation_needed = 1;
49 + /* remember the upper 16 bits */
50 + if ((0xffff0000 & sym_addr) != persistent_data) {
51 + flat_relocs = (uint32_t *)
52 + (realloc (flat_relocs, (flat_reloc_count + 1) * sizeof (uint32_t)));
54 + printf ("New persistent data for %08lx\n", sym_addr);
55 + persistent_data = 0xffff0000 & sym_addr;
56 + flat_relocs[flat_reloc_count++] = (sym_addr >> 16) | (3 << 29);
60 + pflags = FLAT_LM32_RELOC_TYPE_32_BIT << 29;
61 + relocation_needed = 1;
64 + relocation_needed = 0;
67 + goto bad_resolved_reloc;
68 #elif defined(TARGET_m68k)
70 goto good_32bit_resolved_reloc;
71 @@ -1459,6 +1496,63 @@
78 + pflags = FLAT_LM32_RELOC_TYPE_32_BIT << 29;
79 + sym_vma = bfd_section_vma(abs_bfd, sym_section);
80 + sym_addr += sym_vma + q->addend;
81 + relocation_needed = 1;
87 + sym_addr += sym_vma + q->addend;
88 + sym_addr -= q->address;
89 + sym_addr = (int32_t)sym_addr >> q->howto->rightshift;
91 + if ((int32_t)sym_addr < -0x8000000 || (int32_t)sym_addr > 0x7ffffff) {
92 + printf("ERROR: Relocation overflow for R_LM32_CALL relocation against %s\n", sym_name);
97 + r_mem[0] |= (sym_addr >> 24) & 0x03;
98 + r_mem[1] = (sym_addr >> 16) & 0xff;
99 + r_mem[2] = (sym_addr >> 8) & 0xff;
100 + r_mem[3] = sym_addr & 0xff;
106 + if (q->howto->type == R_LM32_HI16) {
107 + pflags = FLAT_LM32_RELOC_TYPE_HI16_BIT << 29;
109 + pflags = FLAT_LM32_RELOC_TYPE_LO16_BIT << 29;
112 + sym_vma = bfd_section_vma(abs_bfd, sym_section);
113 + sym_addr += sym_vma + q->addend;
115 + relocation_needed = 1;
117 + /* remember the upper 16 bits */
118 + if ((0xffff0000 & sym_addr) != persistent_data) {
119 + flat_relocs = (uint32_t *)
120 + (realloc (flat_relocs, (flat_reloc_count + 1) * sizeof (uint32_t)));
122 + printf ("New persistent data for %08lx\n", sym_addr);
123 + persistent_data = 0xffff0000 & sym_addr;
124 + flat_relocs[flat_reloc_count++] = (sym_addr >> 16) | (3 << 29);
127 + r_mem[2] = (sym_addr >> 8) & 0xff;
128 + r_mem[3] = sym_addr & 0xff;
131 +#endif /* TARGET_lm32 */
133 /* missing support for other types of relocs */
134 printf("ERROR: bad reloc type %d\n", (*p)->howto->type);
135 @@ -1596,6 +1690,13 @@
143 + /* entry has already been written */
147 /* The alignment of the build host
148 might be stricter than that of the
149 diff -Nur elf2flt-6d80ab6c93409e796f85da404bde84b841231531.orig/elf2flt.ld.in elf2flt-6d80ab6c93409e796f85da404bde84b841231531/elf2flt.ld.in
150 --- elf2flt-6d80ab6c93409e796f85da404bde84b841231531.orig/elf2flt.ld.in 2017-09-27 06:06:04.000000000 +0200
151 +++ elf2flt-6d80ab6c93409e796f85da404bde84b841231531/elf2flt.ld.in 2017-09-29 18:11:30.999698955 +0200
155 W_RODAT *(.gnu.linkonce.r*)
158 /* .ARM.extab name sections containing exception unwinding information */
159 *(.ARM.extab* .gnu.linkonce.armextab.*)