This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

don't use %gprel for linkonce symbols on mips16


We generate %gprel relocations for weak symbols emitted in linkone
sections, such as typeinfo for std::bad_exception.  Unfortunately,
such sections will often end up too far away from the gp base address,
and the linker will complain because the relocation overflows.  This
patch arranges for us to not emit %gprel relocations for linkone
symbols on mips16.  Tested like the previous patch.  Approved by Eric
Christopher.  I'm checking it in.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/mips/mips.h (ENCODE_SECTION_INFO) [TARGET_MIPS16]: Don't
	use %gprel for symbols that are going to be placed in linkonce
	sections.

Index: gcc/config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mips/mips.h,v
retrieving revision 1.168
diff -u -p -r1.168 mips.h
--- gcc/config/mips/mips.h 2002/03/17 00:02:30 1.168
+++ gcc/config/mips/mips.h 2002/03/18 08:01:58
@@ -3407,7 +3407,11 @@ do									\
        specific sections, except for .sdata and .sbss which are		\
        handled above.  */						\
     else if (TARGET_GP_OPT && TREE_CODE (DECL) == VAR_DECL		\
-	     && DECL_SECTION_NAME (DECL) == NULL_TREE)			\
+	     && DECL_SECTION_NAME (DECL) == NULL_TREE			\
+	     && ! (TARGET_MIPS16 && TREE_PUBLIC (DECL)			\
+		   && (DECL_COMMON (DECL)				\
+		       || DECL_ONE_ONLY (DECL)				\
+		       || DECL_WEAK (DECL))))				\
       {									\
 	int size = int_size_in_bytes (TREE_TYPE (DECL));		\
 									\

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]