Commit a293c7e6 authored by Russ Cox's avatar Russ Cox

cmd/9a: fix GLOBL instruction

Because it was lumped in with the TEXT instruction,
the high 32 bits of the 64-bit constant holding the size
were always set to 0x80000000 (ArgsSizeUnknown).
This only worked because cmd/9l was reading the 64-bit
value into an int32.

While we're here, fix 5a.
It wasn't as much of a problem there because
the two values were being stored in two different fields.
But it was still wrong.

Change-Id: I69a2214c7be939530d499e29cfdc3b26720ac05a
Reviewed-on: https://go-review.googlesource.com/3570Reviewed-by: default avatarAustin Clements <austin@google.com>
parent eaa87200
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
%left '*' '/' '%' %left '*' '/' '%'
%token <lval> LTYPE1 LTYPE2 LTYPE3 LTYPE4 LTYPE5 %token <lval> LTYPE1 LTYPE2 LTYPE3 LTYPE4 LTYPE5
%token <lval> LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA %token <lval> LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA
%token <lval> LTYPEB LTYPEC LTYPED LTYPEE %token <lval> LTYPEB LGLOBL LTYPEC LTYPED LTYPEE
%token <lval> LTYPEG LTYPEH LTYPEI LTYPEJ LTYPEK %token <lval> LTYPEG LTYPEH LTYPEI LTYPEJ LTYPEK
%token <lval> LTYPEL LTYPEM LTYPEN LTYPEBX LTYPEPLD %token <lval> LTYPEL LTYPEM LTYPEN LTYPEBX LTYPEPLD
%token <lval> LCONST LSP LSB LFP LPC %token <lval> LCONST LSP LSB LFP LPC
...@@ -210,7 +210,7 @@ inst: ...@@ -210,7 +210,7 @@ inst:
outcode($1, $2, &nullgen, 0, &nullgen); outcode($1, $2, &nullgen, 0, &nullgen);
} }
/* /*
* TEXT/GLOBL * TEXT
*/ */
| LTYPEB name ',' imm | LTYPEB name ',' imm
{ {
...@@ -233,6 +233,19 @@ inst: ...@@ -233,6 +233,19 @@ inst:
$6.u.argsize = $8; $6.u.argsize = $8;
outcode($1, Always, &$2, $4, &$6); outcode($1, Always, &$2, $4, &$6);
} }
/*
* GLOBL
*/
| LGLOBL name ',' imm
{
settext($2.sym);
outcode($1, Always, &$2, 0, &$4);
}
| LGLOBL name ',' con ',' imm
{
settext($2.sym);
outcode($1, Always, &$2, $4, &$6);
}
/* /*
* DATA * DATA
*/ */
......
...@@ -406,7 +406,7 @@ struct ...@@ -406,7 +406,7 @@ struct
"RFE", LTYPEA, ARFE, "RFE", LTYPEA, ARFE,
"TEXT", LTYPEB, ATEXT, "TEXT", LTYPEB, ATEXT,
"GLOBL", LTYPEB, AGLOBL, "GLOBL", LGLOBL, AGLOBL,
"DATA", LTYPEC, ADATA, "DATA", LTYPEC, ADATA,
"CASE", LTYPED, ACASE, "CASE", LTYPED, ACASE,
"END", LTYPEE, AEND, "END", LTYPEE, AEND,
......
This diff is collapsed.
...@@ -50,43 +50,44 @@ ...@@ -50,43 +50,44 @@
LTYPE9 = 266, LTYPE9 = 266,
LTYPEA = 267, LTYPEA = 267,
LTYPEB = 268, LTYPEB = 268,
LTYPEC = 269, LGLOBL = 269,
LTYPED = 270, LTYPEC = 270,
LTYPEE = 271, LTYPED = 271,
LTYPEG = 272, LTYPEE = 272,
LTYPEH = 273, LTYPEG = 273,
LTYPEI = 274, LTYPEH = 274,
LTYPEJ = 275, LTYPEI = 275,
LTYPEK = 276, LTYPEJ = 276,
LTYPEL = 277, LTYPEK = 277,
LTYPEM = 278, LTYPEL = 278,
LTYPEN = 279, LTYPEM = 279,
LTYPEBX = 280, LTYPEN = 280,
LTYPEPLD = 281, LTYPEBX = 281,
LCONST = 282, LTYPEPLD = 282,
LSP = 283, LCONST = 283,
LSB = 284, LSP = 284,
LFP = 285, LSB = 285,
LPC = 286, LFP = 286,
LTYPEX = 287, LPC = 287,
LTYPEPC = 288, LTYPEX = 288,
LTYPEF = 289, LTYPEPC = 289,
LR = 290, LTYPEF = 290,
LREG = 291, LR = 291,
LF = 292, LREG = 292,
LFREG = 293, LF = 293,
LC = 294, LFREG = 294,
LCREG = 295, LC = 295,
LPSR = 296, LCREG = 296,
LFCR = 297, LPSR = 297,
LCOND = 298, LFCR = 298,
LS = 299, LCOND = 299,
LAT = 300, LS = 300,
LFCONST = 301, LAT = 301,
LSCONST = 302, LFCONST = 302,
LNAME = 303, LSCONST = 303,
LLAB = 304, LNAME = 304,
LVAR = 305 LLAB = 305,
LVAR = 306
}; };
#endif #endif
/* Tokens. */ /* Tokens. */
...@@ -101,43 +102,44 @@ ...@@ -101,43 +102,44 @@
#define LTYPE9 266 #define LTYPE9 266
#define LTYPEA 267 #define LTYPEA 267
#define LTYPEB 268 #define LTYPEB 268
#define LTYPEC 269 #define LGLOBL 269
#define LTYPED 270 #define LTYPEC 270
#define LTYPEE 271 #define LTYPED 271
#define LTYPEG 272 #define LTYPEE 272
#define LTYPEH 273 #define LTYPEG 273
#define LTYPEI 274 #define LTYPEH 274
#define LTYPEJ 275 #define LTYPEI 275
#define LTYPEK 276 #define LTYPEJ 276
#define LTYPEL 277 #define LTYPEK 277
#define LTYPEM 278 #define LTYPEL 278
#define LTYPEN 279 #define LTYPEM 279
#define LTYPEBX 280 #define LTYPEN 280
#define LTYPEPLD 281 #define LTYPEBX 281
#define LCONST 282 #define LTYPEPLD 282
#define LSP 283 #define LCONST 283
#define LSB 284 #define LSP 284
#define LFP 285 #define LSB 285
#define LPC 286 #define LFP 286
#define LTYPEX 287 #define LPC 287
#define LTYPEPC 288 #define LTYPEX 288
#define LTYPEF 289 #define LTYPEPC 289
#define LR 290 #define LTYPEF 290
#define LREG 291 #define LR 291
#define LF 292 #define LREG 292
#define LFREG 293 #define LF 293
#define LC 294 #define LFREG 294
#define LCREG 295 #define LC 295
#define LPSR 296 #define LCREG 296
#define LFCR 297 #define LPSR 297
#define LCOND 298 #define LFCR 298
#define LS 299 #define LCOND 299
#define LAT 300 #define LS 300
#define LFCONST 301 #define LAT 301
#define LSCONST 302 #define LFCONST 302
#define LNAME 303 #define LSCONST 303
#define LLAB 304 #define LNAME 304
#define LVAR 305 #define LLAB 305
#define LVAR 306
...@@ -153,7 +155,7 @@ typedef union YYSTYPE ...@@ -153,7 +155,7 @@ typedef union YYSTYPE
Addr addr; Addr addr;
} }
/* Line 1529 of yacc.c. */ /* Line 1529 of yacc.c. */
#line 157 "y.tab.h" #line 159 "y.tab.h"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
%left '*' '/' '%' %left '*' '/' '%'
%token <lval> LMOVW LMOVB LABS LLOGW LSHW LADDW LCMP LCROP %token <lval> LMOVW LMOVB LABS LLOGW LSHW LADDW LCMP LCROP
%token <lval> LBRA LFMOV LFCONV LFCMP LFADD LFMA LTRAP LXORW %token <lval> LBRA LFMOV LFCONV LFCMP LFADD LFMA LTRAP LXORW
%token <lval> LNOP LEND LRETT LWORD LTEXT LDATA LRETRN %token <lval> LNOP LEND LRETT LWORD LTEXT LGLOBL LDATA LRETRN
%token <lval> LCONST LSP LSB LFP LPC LCREG LFLUSH %token <lval> LCONST LSP LSB LFP LPC LCREG LFLUSH
%token <lval> LREG LFREG LR LCR LF LFPSCR %token <lval> LREG LFREG LR LCR LF LFPSCR
%token <lval> LLR LCTR LSPR LSPREG LSEG LMSR %token <lval> LLR LCTR LSPR LSPREG LSEG LMSR
...@@ -611,7 +611,7 @@ inst: ...@@ -611,7 +611,7 @@ inst:
outcode($1, &nullgen, 0, &nullgen); outcode($1, &nullgen, 0, &nullgen);
} }
/* /*
* TEXT/GLOBL * TEXT
*/ */
| LTEXT name ',' imm | LTEXT name ',' imm
{ {
...@@ -632,6 +632,20 @@ inst: ...@@ -632,6 +632,20 @@ inst:
$6.offset |= ($8 & 0xffffffffull) << 32; $6.offset |= ($8 & 0xffffffffull) << 32;
outcode($1, &$2, $4, &$6); outcode($1, &$2, $4, &$6);
} }
/*
* GLOBL
*/
| LGLOBL name ',' imm
{
settext($2.sym);
outcode($1, &$2, 0, &$4);
}
| LGLOBL name ',' con ',' imm
{
settext($2.sym);
outcode($1, &$2, $4, &$6);
}
/* /*
* DATA * DATA
*/ */
......
...@@ -454,7 +454,7 @@ struct ...@@ -454,7 +454,7 @@ struct
"FMOVS", LFMOV, AFMOVS, "FMOVS", LFMOV, AFMOVS,
"FMOVDCC", LFCONV, AFMOVDCC, /* fmr. */ "FMOVDCC", LFCONV, AFMOVDCC, /* fmr. */
"GLOBL", LTEXT, AGLOBL, "GLOBL", LGLOBL, AGLOBL,
"MOVB", LMOVB, AMOVB, "MOVB", LMOVB, AMOVB,
"MOVBZ", LMOVB, AMOVBZ, "MOVBZ", LMOVB, AMOVBZ,
......
This diff is collapsed.
...@@ -60,45 +60,46 @@ ...@@ -60,45 +60,46 @@
LRETT = 276, LRETT = 276,
LWORD = 277, LWORD = 277,
LTEXT = 278, LTEXT = 278,
LDATA = 279, LGLOBL = 279,
LRETRN = 280, LDATA = 280,
LCONST = 281, LRETRN = 281,
LSP = 282, LCONST = 282,
LSB = 283, LSP = 283,
LFP = 284, LSB = 284,
LPC = 285, LFP = 285,
LCREG = 286, LPC = 286,
LFLUSH = 287, LCREG = 287,
LREG = 288, LFLUSH = 288,
LFREG = 289, LREG = 289,
LR = 290, LFREG = 290,
LCR = 291, LR = 291,
LF = 292, LCR = 292,
LFPSCR = 293, LF = 293,
LLR = 294, LFPSCR = 294,
LCTR = 295, LLR = 295,
LSPR = 296, LCTR = 296,
LSPREG = 297, LSPR = 297,
LSEG = 298, LSPREG = 298,
LMSR = 299, LSEG = 299,
LPCDAT = 300, LMSR = 300,
LFUNCDAT = 301, LPCDAT = 301,
LSCHED = 302, LFUNCDAT = 302,
LXLD = 303, LSCHED = 303,
LXST = 304, LXLD = 304,
LXOP = 305, LXST = 305,
LXMV = 306, LXOP = 306,
LRLWM = 307, LXMV = 307,
LMOVMW = 308, LRLWM = 308,
LMOVEM = 309, LMOVMW = 309,
LMOVFL = 310, LMOVEM = 310,
LMTFSB = 311, LMOVFL = 311,
LMA = 312, LMTFSB = 312,
LFCONST = 313, LMA = 313,
LSCONST = 314, LFCONST = 314,
LNAME = 315, LSCONST = 315,
LLAB = 316, LNAME = 316,
LVAR = 317 LLAB = 317,
LVAR = 318
}; };
#endif #endif
/* Tokens. */ /* Tokens. */
...@@ -123,45 +124,46 @@ ...@@ -123,45 +124,46 @@
#define LRETT 276 #define LRETT 276
#define LWORD 277 #define LWORD 277
#define LTEXT 278 #define LTEXT 278
#define LDATA 279 #define LGLOBL 279
#define LRETRN 280 #define LDATA 280
#define LCONST 281 #define LRETRN 281
#define LSP 282 #define LCONST 282
#define LSB 283 #define LSP 283
#define LFP 284 #define LSB 284
#define LPC 285 #define LFP 285
#define LCREG 286 #define LPC 286
#define LFLUSH 287 #define LCREG 287
#define LREG 288 #define LFLUSH 288
#define LFREG 289 #define LREG 289
#define LR 290 #define LFREG 290
#define LCR 291 #define LR 291
#define LF 292 #define LCR 292
#define LFPSCR 293 #define LF 293
#define LLR 294 #define LFPSCR 294
#define LCTR 295 #define LLR 295
#define LSPR 296 #define LCTR 296
#define LSPREG 297 #define LSPR 297
#define LSEG 298 #define LSPREG 298
#define LMSR 299 #define LSEG 299
#define LPCDAT 300 #define LMSR 300
#define LFUNCDAT 301 #define LPCDAT 301
#define LSCHED 302 #define LFUNCDAT 302
#define LXLD 303 #define LSCHED 303
#define LXST 304 #define LXLD 304
#define LXOP 305 #define LXST 305
#define LXMV 306 #define LXOP 306
#define LRLWM 307 #define LXMV 307
#define LMOVMW 308 #define LRLWM 308
#define LMOVEM 309 #define LMOVMW 309
#define LMOVFL 310 #define LMOVEM 310
#define LMTFSB 311 #define LMOVFL 311
#define LMA 312 #define LMTFSB 312
#define LFCONST 313 #define LMA 313
#define LSCONST 314 #define LFCONST 314
#define LNAME 315 #define LSCONST 315
#define LLAB 316 #define LNAME 316
#define LVAR 317 #define LLAB 317
#define LVAR 318
...@@ -177,7 +179,7 @@ typedef union YYSTYPE ...@@ -177,7 +179,7 @@ typedef union YYSTYPE
Addr addr; Addr addr;
} }
/* Line 1529 of yacc.c. */ /* Line 1529 of yacc.c. */
#line 181 "y.tab.h" #line 183 "y.tab.h"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment