From: David McCullough Date: Wed, 3 Feb 2010 22:32:46 +0000 (+0000) Subject: This is needed for Blackfin FLAT's to be processed properly, and apparently X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7bd4c6daf869a889b26a990d01e16df8f9453d92;p=elf2flt.git This is needed for Blackfin FLAT's to be processed properly, and apparently some other people have seen similar behavior. http://lists.uclibc.org/pipermail/uclibc/2009-April/042363.html http://thread.gmane.org/gmane.linux.hardware.blackfin.toolchain.devel/1121 Signed-off-by: Bernd Schmidt Signed-off-by: Mike Frysinger --- diff --git a/Makefile.in b/Makefile.in index 861f62b..81e1afc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -25,7 +25,8 @@ DEFS = @DEFS@ \ -DTARGET_ALIAS=\"$(TARGET)\" \ -DNO_GOT_CHECK=@got_check@ \ -DUSE_EMIT_RELOCS=@emit_relocs@ \ - -DEMIT_CTOR_DTOR=@emit_ctor_dtor@ + -DEMIT_CTOR_DTOR=@emit_ctor_dtor@ \ + -DALWAYS_RELOC_TEXT=@always_reloc_text@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ diff --git a/configure b/configure index 8177dff..6884892 100755 --- a/configure +++ b/configure @@ -638,6 +638,7 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS SYMBOL_PREFIX +always_reloc_text emit_ctor_dtor emit_relocs got_check @@ -722,6 +723,7 @@ enable_ld_elf2flt_binary enable_got_check enable_emit_relocs enable_emit_ctor_dtor +enable_always_reloc_text ' ac_precious_vars='build_alias host_alias @@ -1361,6 +1363,9 @@ Optional Features: --disable-got-check - disable check for GOT (needed on H8) --disable-emit-relocs - don't use the --emit-relocs (-q) linker option --enable-emit-ctor-dtor manually create ctor/dtor list + --enable-always-reloc-text + always process text relocs ignoring pic/got (needed + on Blackfin) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1940,6 +1945,21 @@ fi var_yn_to_10 emit_ctor_dtor +# Check whether --enable-always-reloc-text was given. +if test "${enable_always_reloc_text+set}" = set; then + enableval=$enable_always_reloc_text; always_reloc_text=$enableval +else + + case $target in + bfin*) always_reloc_text=yes;; + *) always_reloc_text=no;; + esac + + +fi + +var_yn_to_10 always_reloc_text + ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -5128,6 +5148,7 @@ test "$GCC" = yes && CFLAGS="-Wall $CFLAGS" + ac_config_files="$ac_config_files ld-elf2flt.sh:ld-elf2flt.in Makefile elf2flt.ld" cat >confcache <<\_ACEOF diff --git a/configure.in b/configure.in index 8c4ebdb..6003d8c 100644 --- a/configure.in +++ b/configure.in @@ -79,6 +79,18 @@ AC_ARG_ENABLE(emit-ctor-dtor, ) var_yn_to_10 emit_ctor_dtor +AC_ARG_ENABLE(always-reloc-text, + AS_HELP_STRING([--enable-always-reloc-text], [always process text relocs ignoring pic/got (needed on Blackfin)]), + [ always_reloc_text=$enableval ], + [ + case $target in + bfin*) always_reloc_text=yes;; + *) always_reloc_text=no;; + esac + ] +) +var_yn_to_10 always_reloc_text + AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -207,6 +219,7 @@ AC_SUBST(use_ld_elf2flt_binary) AC_SUBST(got_check) AC_SUBST(emit_relocs) AC_SUBST(emit_ctor_dtor) +AC_SUBST(always_reloc_text) AC_SUBST(SYMBOL_PREFIX) AC_OUTPUT(ld-elf2flt.sh:ld-elf2flt.in Makefile elf2flt.ld) diff --git a/elf2flt.c b/elf2flt.c index 5e9c698..2fea9b5 100644 --- a/elf2flt.c +++ b/elf2flt.c @@ -396,7 +396,7 @@ dump_symbols(symbols, number_of_symbols); * Only relocate things in the data sections if we are PIC/GOT. * otherwise do text as well */ - if (!pic_with_got && (a->flags & SEC_CODE)) + if ((!pic_with_got || ALWAYS_RELOC_TEXT) && (a->flags & SEC_CODE)) sectionp = text + (a->vma - text_vma); else if (a->flags & SEC_DATA) sectionp = data + (a->vma - data_vma);