Fix bug in assembler: incorrect reordering of branch instruction.
Increase cpp buffer size.
This commit is contained in:
@@ -1721,6 +1721,14 @@ done:
|
||||
((type & FRT2) && rt == reorder_clobber))
|
||||
reorder_flush();
|
||||
}
|
||||
if (reorder_full && (type & (FOFF18 | FAOFF18)) &&
|
||||
relinfo.flags == RABS && (opcode & 0x8000)) {
|
||||
/* Branch instruction with negative offset is being displaced
|
||||
* by one word. Need to update the offset field. */
|
||||
offset = opcode + 1;
|
||||
opcode &= ~0xffff;
|
||||
opcode |= (offset & 0xffff);
|
||||
}
|
||||
fputword (opcode, sfile[segm]);
|
||||
fputrel (&relinfo, rfile[segm]);
|
||||
if (reorder_full) {
|
||||
|
||||
@@ -2,14 +2,14 @@ TOPSRC = $(shell cd ../../../..; pwd)
|
||||
include $(TOPSRC)/target.mk
|
||||
|
||||
CFLAGS += -Wall -Os
|
||||
TESTS = test1 test2 test3 test4
|
||||
TESTS = test1 test2 test3 test4 test5
|
||||
|
||||
all: ../as ../aout
|
||||
all: ../../../../lib/as ../../../../lib/aout
|
||||
for i in $(TESTS); do \
|
||||
$(AS) $$i.s -o $$i.o; \
|
||||
$(OBJDUMP) -D $$i.o > $$i.gcc-dis; \
|
||||
../as $$i.s -o $$i.o; \
|
||||
../aout -r $$i.o > $$i.dis; \
|
||||
../../../../lib/as $$i.s -o $$i.o; \
|
||||
../../../../lib/aout -r $$i.o > $$i.dis; \
|
||||
done
|
||||
|
||||
clean:
|
||||
|
||||
26
src/cmd/as/tests/test5.s
Normal file
26
src/cmd/as/tests/test5.s
Normal file
@@ -0,0 +1,26 @@
|
||||
.set reorder
|
||||
x:
|
||||
add $2, $16, $31
|
||||
b x
|
||||
sub $31, $11, $26
|
||||
|
||||
add $2, $16, $31
|
||||
beqz $3, x
|
||||
sub $31, $11, $26
|
||||
|
||||
add $2, $16, $31
|
||||
j x
|
||||
sub $31, $11, $26
|
||||
|
||||
and $31, $3, $18
|
||||
b y
|
||||
or $31, $8, $23
|
||||
|
||||
and $31, $3, $18
|
||||
beqz $2, y
|
||||
or $31, $8, $23
|
||||
|
||||
and $31, $3, $18
|
||||
j y
|
||||
or $31, $8, $23
|
||||
y:
|
||||
@@ -48,7 +48,7 @@ extern int ofd;
|
||||
#define ENTER 1
|
||||
|
||||
/* buffer used internally */
|
||||
#define CPPBUF 512
|
||||
#define CPPBUF 640
|
||||
#ifndef CPPBUF
|
||||
#if defined(__pdp11__)
|
||||
#define CPPBUF BUFSIZ
|
||||
|
||||
Reference in New Issue
Block a user