This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: mn10300: clarify a diagnostic


getting back to this...

> >> Hmm? We're returning bfd_reloc_dangerous for gotoff relocations
> >> which are, admittedly link time, but they're off the got so I don't
> >> know that the message is quite correct. Maybe "warning: local
> >> relocation against non-local symbol seen when linking a shared
> >> object"?
> >
> > I was thinking of how you generate this error - the only way I've been
> > able to generate it is to link a non-"-fpic" object into a shared
> > library.  Maybe we could split the error case up so we can properly
> > inform the user?  But first we'd need to figure out how to generate
> > the other cases, I couldn't get any of the 8, 16, or 24 bit
> > relocations out of gcc.
> 
>  From looking at SYMBOL_REFERENCES_LOCAL I can imagine a protected
> function that somehow gets a local relocation, but in fact it may  
> resolve
> non-locally.
> 
> > Basically, I want to tell the user how to get rid of the error.
> 
> I'm fine with splitting it up as you had in mind.

I could only find one "common" case that happened, which is calling a
function without specifying -fpic.  So I broke that one out, patch
below.  I'm open to suggestions on the wording of these messages, but
let's improve on "dangerous error".

Index: elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.77
diff -p -U3 -r1.77 elf-m10300.c
--- elf-m10300.c	17 Oct 2006 13:41:46 -0000	1.77
+++ elf-m10300.c	26 Jan 2007 02:18:38 -0000
@@ -1499,7 +1499,10 @@ mn10300_elf_relocate_section (output_bfd
 	      goto common_error;
 
 	    case bfd_reloc_dangerous:
-	      msg = _("internal error: dangerous error");
+	      if (r_type == R_MN10300_PCREL32)
+		msg = _("error: inappropriate relocation type for shared library (did you forget -fpic?)");
+	      else
+		msg = _("internal error: dangerous relocation type used in shared library");
 	      goto common_error;
 
 	    default:


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