1
0
mirror of https://github.com/golang/go synced 2024-11-20 08:34:41 -07:00
go/src/liblink
Russ Cox 6654188190 liblink: remove dead computation of p->back in span6/span8
Originally, when this code was part of 6l/8l, every new
Prog was constructed starting with zprg, which set back=2,
and then this code walked over the list setting back=1 for
backward branches, back=0 otherwise. The initial back=2
setting was used to identify forward branches (the branched-to
instruction had back == 2 since it hadn't yet been set to 0 or 1).

When the code was extracted into liblink and linked directly
with 6a/6g/8a/8g, those programs created the Prog struct
and did not set back=2, breaking this backward branch detection.

No one noticed, because the next loop recomputes the information.
The only requirement for the next loop is that p->back == 0 or 1 for
each of the Progs in the list.

The initialization of the zprg with back=2 would cause problems
in this second loop, for the few liblink-internally-generated instructions
that are created by copying zprg, except that the first loop was
making sure that back == 0 or 1.

The first loop's manipulation of p->back can thus be deleted,
provided we also delete the zprg.back = 2 initializations.

This is awful and my fault. I apologize.

While we're here, remove the .scale = 1 from the zprg init too.
Anything that sets up a scaled index should set the scale itself.
(And mostly those come from outside liblink anyway.)

Tested by checking that all generated code is bit-for-bit
identical to before this CL.

Change-Id: I7f6e0b33ce9ccd5b7dc25e0f00429fedd0957c8c
Reviewed-on: https://go-review.googlesource.com/3574
Reviewed-by: Austin Clements <austin@google.com>
2015-02-03 18:22:35 +00:00
..
asm5.c liblink: renumber ARM conditions to make C_SCOND_NONE == 0 2015-02-03 18:22:26 +00:00
asm6.c liblink: remove dead computation of p->back in span6/span8 2015-02-03 18:22:35 +00:00
asm8.c liblink: remove dead computation of p->back in span6/span8 2015-02-03 18:22:35 +00:00
asm9.c liblink: place TEXT/GLOBL flags in p->from3 always 2015-02-03 18:22:15 +00:00
data.c cmd/gc, cmd/ld, liblink: update for portable Prog, Addr changes 2015-01-30 03:15:44 +00:00
go.c cmd/6g, liblink, runtime: support saving base pointers 2015-02-02 19:36:05 +00:00
ld.c liblink: support big-endian properly 2014-08-06 00:25:41 -04:00
list5.c liblink: renumber ARM conditions to make C_SCOND_NONE == 0 2015-02-03 18:22:26 +00:00
list6.c liblink: place TEXT/GLOBL flags in p->from3 always 2015-02-03 18:22:15 +00:00
list8.c liblink: place TEXT/GLOBL flags in p->from3 always 2015-02-03 18:22:15 +00:00
list9.c liblink: place TEXT/GLOBL flags in p->from3 always 2015-02-03 18:22:15 +00:00
Makefile
obj5.c liblink: place TEXT/GLOBL flags in p->from3 always 2015-02-03 18:22:15 +00:00
obj6.c liblink: remove dead computation of p->back in span6/span8 2015-02-03 18:22:35 +00:00
obj8.c liblink: remove dead computation of p->back in span6/span8 2015-02-03 18:22:35 +00:00
obj9.c liblink: place TEXT/GLOBL flags in p->from3 always 2015-02-03 18:22:15 +00:00
obj.c cmd/gc: record line number for auto-generated wrappers as <autogenerated>:1 2014-05-12 11:59:55 -04:00
objfile.c liblink: place TEXT/GLOBL flags in p->from3 always 2015-02-03 18:22:15 +00:00
pass.c cmd/gc, cmd/ld, liblink: update for portable Prog, Addr changes 2015-01-30 03:15:44 +00:00
pcln.c cmd/gc, cmd/ld, liblink: update for portable Prog, Addr changes 2015-01-30 03:15:44 +00:00
sym.c liblink: fix error message on linux for unknown TLS base 2015-01-30 02:50:08 +00:00