]> git.wh0rd.org Git - elf2flt.git/commitdiff
- add target h8300h
authorDavid McCullough <davidm@snapgear.com>
Thu, 13 May 2004 00:45:07 +0000 (00:45 +0000)
committerDavid McCullough <davidm@snapgear.com>
Thu, 13 May 2004 00:45:07 +0000 (00:45 +0000)
- shared flat binary support for h8

Yoshinori Sato <ysato@users.sourceforge.jp>

elf2flt.c
ld-elf2flt.in

index bca57bc81a6f11817f8b6d8f661d0fe360d5a2cf..23e5e978e2021ceba0b1a80b6536bc28ef88d710 100644 (file)
--- a/elf2flt.c
+++ b/elf2flt.c
@@ -87,7 +87,7 @@
 #error "Don't know how to support your CPU architecture??"
 #endif
 
-#ifdef TARGET_m68k
+#if defined(TARGET_m68k) || defined(TARGET_h8300)
 /*
  * Define a maximum number of bytes allowed in the offset table.
  * We'll fail if the table is larger than this.
@@ -720,6 +720,9 @@ dump_symbols(symbols, number_of_symbols);
                                        sym_addr = (*(q->sym_ptr_ptr))->value;
                                        sym_vma = bfd_section_vma(abs_bfd, sym_section);
                                        sym_addr += sym_vma + q->addend;
+                                       /* no reloc from area7 */
+                                       if (sym_addr > 0xe00000)
+                                               relocation_needed = 0;
                                        break;
                                case R_H8_DIR32:
                                case R_H8_DIR32A16: /* currently 32,  could be made 16 */
index ab5d44868beac51d87a9eccf228e3618b23bc98b..9dc903e0d70115537b3999f3c79dcf45a03f2aa6 100644 (file)
@@ -17,6 +17,9 @@ LDSCRIPTPATH="${TOOLDIR}/../@target_alias@/lib"               # and the scripts
 SHARED_ID=""
 NEWLDSCRIPT=""
 
+# check TOOLDIR from prefix/bin/ or prefix/target-alias/bin/
+[ -d "${TOOLDIR}/../@target_alias@/lib" ] || LDSCRIPTPATH="${TOOLDIR}/../lib"
+
 #
 # if we have the elf2flt options, run it
 #
@@ -72,6 +75,9 @@ then
                                  VERBOSE="y"
                                  ;;
 
+               -m)       shift; EMUL="-m $1";;        # ld emulations for h8300
+               -m*)      EMUL=$1;;
                *)        ARG1="$ARG1 $1"
                                  ;;
                esac
@@ -112,7 +118,11 @@ then
                        fi
 
                        # Provide the magic parameter that defines the library data segment pointer offset
-                       ARG1="$ARG1 -defsym _current_shared_library_a5_offset_=`expr ${SHARED_ID} '*' -4 - 4`"
+                       case "@target_cpu@" in
+                           h8300) GOT_OFFSET="__current_shared_library_er5_offset_";;
+                           *)     GOT_OFFSET="_current_shared_library_a5_offset_";;
+                       esac
+                       ARG1="$ARG1 -defsym $GOT_OFFSET=`expr ${SHARED_ID} '*' -4 - 4`"
                fi
                
                # provide a default linker script, we usually need one
@@ -133,12 +143,12 @@ then
 
                if [ "@got_check@" = "no" ]
                then
-                $LINKER $SDIRS -T $LDSCRIPT -Ur -d -o "$OFILE.elf" $ARG1         ||exit $?
-                $LINKER $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" $ARG1                ||exit $?
+                $LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -d -o "$OFILE.elf" $ARG1         ||exit $?
+                $LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" $ARG1                ||exit $?
                else
-                $LINKER -r -d -o "$OFILE.elf2flt" $ARG1                          ||exit $?
-                $LINKER $SDIRS -T $LDSCRIPT -Ur -o "$OFILE.elf" "$OFILE.elf2flt" ||exit $?
-                $LINKER $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" "$OFILE.elf2flt"     ||exit $?
+                $LINKER $EMUL -r -d -o "$OFILE.elf2flt" $ARG1                          ||exit $?
+                $LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -o "$OFILE.elf" "$OFILE.elf2flt" ||exit $?
+                $LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" "$OFILE.elf2flt"     ||exit $?
                 rm -f "$OFILE.elf2flt"
                fi
                if grep _GLOBAL_OFFSET_TABLE_ "$OFILE.gdb" > /dev/null