« Return to Thread: RE: PR 6848: Not all targets generate relocs against kept symbols.

Re: PR gas/5543 broke mmix: "can't equate global symbol foo with register name"

by H.J. Lu-30 :: Rate this Message:

Reply to Author | View in Thread

On Mon, Oct 06, 2008 at 09:07:51AM +0100, Nick Clifton wrote:

> Hi Guys,
>
> >> On Sun, 5 Oct 2008, H.J. Lu wrote:
> >> This patch allows global register symbol if GLOBAL_REGISTER_SYMBOL_OK
> >> is defined.  OK to install?
>
> > Hans-Peter Nilsson wrote:
>> I think the convention is to call it e.g.
>> TC_GLOBAL_REGISTER_SYMBOL_OK, but (without actually testing it)
>
> Correct.  Also target macros like this should be documented in  
> gas/doc/internals.texi.
>
> H.J.:  The patch is approved with these two changes.
>

I am checking in this patch.

Thanks.


H.J.
----
2008-10-07  H.J. Lu  <hongjiu.lu@...>

        * read.c (pseudo_set): Don't allow global register symbol only
        if TC_GLOBAL_REGISTER_SYMBOL_OK is undefined.
        * symbols.c (S_SET_EXTERNAL): Likewise.

        * config/tc-mmix.h (TC_GLOBAL_REGISTER_SYMBOL_OK): Defined.

        * doc/internals.texi: Document TC_GLOBAL_REGISTER_SYMBOL_OK.

--- gas/config/tc-mmix.h.reg 2007-07-03 06:45:21.000000000 -0700
+++ gas/config/tc-mmix.h 2008-10-07 07:12:19.000000000 -0700
@@ -224,3 +224,6 @@ extern void mmix_md_do_align (int, char
 
 /* This target is buggy, and sets fix size too large.  */
 #define TC_FX_SIZE_SLACK(FIX) 6
+
+/* MMIX has global register symbols.  */
+#define TC_GLOBAL_REGISTER_SYMBOL_OK
--- gas/doc/internals.texi.reg 2008-09-20 09:25:29.000000000 -0700
+++ gas/doc/internals.texi 2008-10-07 07:16:51.000000000 -0700
@@ -1325,6 +1325,11 @@ This macro is evaluated for any fixup wi
 @code{fixup_segment} cannot reduce to a number.  If the macro returns
 @code{false} an error will be reported.
 
+@item TC_GLOBAL_REGISTER_SYMBOL_OK
+@cindex TC_GLOBAL_REGISTER_SYMBOL_OK
+Define this macro if global register symbols are supported. The default
+is to disallow global register symbols.
+
 @item MD_APPLY_SYM_VALUE (@var{fix})
 @cindex MD_APPLY_SYM_VALUE
 This macro controls whether the symbol value becomes part of the value passed
--- gas/read.c.reg 2008-10-06 19:52:44.000000000 -0700
+++ gas/read.c 2008-10-07 07:12:19.000000000 -0700
@@ -3621,12 +3621,14 @@ pseudo_set (symbolS *symbolP)
       break;
 
     case O_register:
+#ifndef TC_GLOBAL_REGISTER_SYMBOL_OK
       if (S_IS_EXTERNAL (symbolP))
  {
   as_bad ("can't equate global symbol `%s' with register name",
   S_GET_NAME (symbolP));
   return;
  }
+#endif
       S_SET_SEGMENT (symbolP, reg_section);
       S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
       set_zero_frag (symbolP);
--- gas/symbols.c.reg 2008-08-22 08:07:08.000000000 -0700
+++ gas/symbols.c 2008-10-07 07:12:19.000000000 -0700
@@ -2191,12 +2191,14 @@ S_SET_EXTERNAL (symbolS *s)
      _("section symbols are already global"));
       return;
     }
+#ifndef TC_GLOBAL_REGISTER_SYMBOL_OK
   if (S_GET_SEGMENT (s) == reg_section)
     {
       as_bad ("can't make register symbol `%s' global",
       S_GET_NAME (s));
       return;
     }
+#endif
   s->bsym->flags |= BSF_GLOBAL;
   s->bsym->flags &= ~(BSF_LOCAL | BSF_WEAK);
 

 « Return to Thread: RE: PR 6848: Not all targets generate relocs against kept symbols.