[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uclinux-dev
Subject:    [uClinux-dev] [PATCH 1/2] elf2flt: allow people to always process
From:       Mike Frysinger <vapier () gentoo ! org>
Date:       2010-01-16 9:35:48
Message-ID: 1263634549-4339-1-git-send-email-vapier () gentoo ! org
[Download RAW message or body]

From: Bernd Schmidt <bernds_cb1@t-online.de>

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 <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 Makefile.in  |    3 ++-
 configure    |   21 +++++++++++++++++++++
 configure.in |   13 +++++++++++++
 elf2flt.c    |    2 +-
 4 files changed, 37 insertions(+), 2 deletions(-)

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);
-- 
1.6.6

_______________________________________________
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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic