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]

[PATCH] bug 5543: do not allow register symbols to be global


Hello,

Attached patch fixes bug 5543 for me.
With this patch:

        .globl  foo
        .set    foo,(%eax)

z.s: Assembler messages:
z.s:2: Error: attempt to produce global register symbol


and

        .set    foo,(%eax)
        .globl  foo

z2.s: Assembler messages:
z2.s:2: Error: cannot make register symbol global
--
vda
diff -d -urpN src.0/gas/read.c src.1/gas/read.c
--- src.0/gas/read.c	2008-02-07 09:40:29.000000000 +0100
+++ src.1/gas/read.c	2008-02-21 12:21:50.000000000 +0100
@@ -3604,6 +3604,11 @@ pseudo_set (symbolS *symbolP)
       break;
 
     case O_register:
+      if (S_IS_EXTERNAL (symbolP))
+	{
+	  as_bad ("attempt to produce global register symbol");
+	  return;
+	}
       S_SET_SEGMENT (symbolP, reg_section);
       S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
       set_zero_frag (symbolP);
diff -d -urpN src.0/gas/symbols.c src.1/gas/symbols.c
--- src.0/gas/symbols.c	2007-07-12 09:16:39.000000000 +0200
+++ src.1/gas/symbols.c	2008-02-21 12:24:06.000000000 +0100
@@ -2184,6 +2184,12 @@ S_SET_EXTERNAL (symbolS *s)
 		     _("section symbols are already global"));
       return;
     }
+  if (S_GET_SEGMENT (s) == reg_section)
+    {
+      /* Cannot make ".set foo,%reg" symbol global */
+      as_bad ("cannot make register symbol global");
+      return;
+    }
   s->bsym->flags |= BSF_GLOBAL;
   s->bsym->flags &= ~(BSF_LOCAL | BSF_WEAK);
 

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