This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: mn10300: clarify a diagnostic
- From: DJ Delorie <dj at redhat dot com>
- To: echristo at apple dot com
- Cc: binutils at sourceware dot org, aoliva at redhat dot com
- Date: Thu, 25 Jan 2007 21:23:48 -0500
- Subject: Re: mn10300: clarify a diagnostic
- References: <200610170218.k9H2IKQ8005493@greed.delorie.com> <1ED5E297-E6BC-4B87-9748-E8126E257EB0@apple.com> <200610170351.k9H3pEPP007079@greed.delorie.com> <8B98F1A9-0B00-41EB-A47C-A126F61337DD@apple.com>
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: