Add patchset from ptxdist which is required to produce working
ARM flat binaries. Tested with busybox on Kinetis K70.

Signed-off-by: Waldemar Brodkorb <w...@openadk.org>
---

After this patch is upstream, I want to send an update
patch to buildroot to use your repository. Then I will
take my copy of elf2flt offline.

Without the fprintf changes I get segfaults.

---
 elf2flt.c     |   19 ++++++++++++-------
 elf2flt.ld.in |   17 ++++++++++++++---
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/elf2flt.c b/elf2flt.c
index fcd797c..c6978e1 100644
--- a/elf2flt.c
+++ b/elf2flt.c
@@ -56,6 +56,8 @@ const char *elf2flt_progname;
 
 #if defined(TARGET_h8300)
 #include <elf/h8.h>      /* TARGET_* ELF support for the BFD library           
 */
+#elif defined(TARGET_arm)
+#include <elf/arm.h>
 #elif defined(__CYGWIN__) || defined(__MINGW32__) || defined(TARGET_nios) || 
defined(TARGET_nios2)
 #include "cygwin-elf.h"        /* Cygwin uses a local copy */
 #elif defined(TARGET_xtensa)
@@ -646,16 +648,23 @@ dump_symbols(symbols, number_of_symbols);
                                default:
                                        goto good_32bit_resolved_reloc;
 #elif defined(TARGET_arm)
+                               case R_ARM_TARGET1:
+                               case R_ARM_TARGET2:
                                case R_ARM_ABS32:
                                        relocation_needed = 1;
                                        break;
                                case R_ARM_REL32:
+                               case R_ARM_JUMP24:
+                               case R_ARM_CALL:
                                case R_ARM_THM_PC11:
                                case R_ARM_THM_PC22:
+                               case R_ARM_THM_JUMP24:
                                case R_ARM_PC24:
                                case R_ARM_PLT32:
                                case R_ARM_GOTPC:
                                case R_ARM_GOT32:
+                               case R_ARM_PREL31:
+                               case R_ARM_NONE:
                                        relocation_needed = 0;
                                        break;
                                default:
@@ -871,9 +880,7 @@ dump_symbols(symbols, number_of_symbols);
                                        relocation_needed = 1;
                                        if (verbose)
                                                fprintf(stderr,
-                                                       "%s vma=0x%x, "
-                                                       
"value=0x%"BFD_VMA_FMT"x, "
-                                                       
"address=0x%"BFD_VMA_FMT"x "
+                                                       "%s vma=0x%x, 
value=0x%x, address=0x%x "
                                                        "sym_addr=0x%x rs=0x%x, 
opcode=0x%x\n",
                                                        "ABS32",
                                                        sym_vma, 
(*(q->sym_ptr_ptr))->value,
@@ -890,9 +897,7 @@ dump_symbols(symbols, number_of_symbols);
                                case R_ARM_PLT32:
                                        if (verbose)
                                                fprintf(stderr,
-                                                       "%s vma=0x%x, "
-                                                       
"value=0x%"BFD_VMA_FMT"x, "
-                                                       
"address=0x%"BFD_VMA_FMT"x "
+                                                       "%s vma=0x%x, 
value=0x%x, address=0x%x "
                                                        "sym_addr=0x%x rs=0x%x, 
opcode=0x%x\n",
                                                        "PLT32",
                                                        sym_vma, 
(*(q->sym_ptr_ptr))->value,
@@ -1446,7 +1451,7 @@ DIS29_RELOCATION:
                                }
                        }
 
-                       sprintf(&addstr[0], "+0x%lx", sym_addr - 
(*(q->sym_ptr_ptr))->value -
+                       sprintf(&addstr[0], "+0x%x", sym_addr - 
(*(q->sym_ptr_ptr))->value -
                                         bfd_section_vma(abs_bfd, sym_section));
 
 
diff --git a/elf2flt.ld.in b/elf2flt.ld.in
index bfda0ef..ec1fe6f 100644
--- a/elf2flt.ld.in
+++ b/elf2flt.ld.in
@@ -35,6 +35,8 @@ W_RODAT               *(.rodata1)
 W_RODAT                *(.rodata.*)
 W_RODAT                *(.gnu.linkonce.r*)
 
+               /* .ARM.extab name sections containing exception unwinding 
information */
+               *(.ARM.extab* .gnu.linkonce.armextab.*)
                /* This is special code area at the end of the normal
                   text section.  It contains a small lookup table at
                   the start followed by the code pointed to by entries
@@ -43,11 +45,20 @@ W_RODAT             *(.gnu.linkonce.r*)
                PROVIDE(@SYMBOL_PREFIX@__ctbp = .);
                *(.call_table_data)
                *(.call_table_text)
-
-               . = ALIGN(0x20) ;
-               @SYMBOL_PREFIX@_etext = . ;
        } > flatmem :text
 
+       /* .ARM.exidx name sections containing index entries for section 
unwinding */
+       /* .ARM.exidx is sorted, so has to go in its own output section.  */
+       @SYMBOL_PREFIX@__exidx_start = .;
+       .ARM.exidx :
+       {
+               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+       } > flatmem
+       @SYMBOL_PREFIX@__exidx_end = .;
+
+       . = ALIGN(0x20) ;
+       @SYMBOL_PREFIX@_etext = . ;
+
        .data : {
                . = ALIGN(0x4) ;
                @SYMBOL_PREFIX@_sdata = . ;
-- 
1.7.10.4

_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to