[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/22859] New: gas seems to misassemble cmp r,$label+offset o
From: |
etchedpixels at gmail dot com |
Subject: |
[Bug binutils/22859] New: gas seems to misassemble cmp r,$label+offset on PDP-11 with reproducer |
Date: |
Sun, 18 Feb 2018 17:17:42 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=22859
Bug ID: 22859
Summary: gas seems to misassemble cmp r,$label+offset on PDP-11
with reproducer
Product: binutils
Version: 2.30
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: etchedpixels at gmail dot com
Target Milestone: ---
(Short reproducer below explanation)
I hit this trying to build my OS with GNU binutils 2.30 (it seems to work with
ancient binutils)
Linux 64bit cross build --target=pdp11-aout
ld errors with
sed.o:sed.o:(.text+0x7a4): relocation truncated to fit: 16 against `.data'
sed.o:sed.o:(.text+0x7be): relocation truncated to fit: 16 against `.data'
sed.o:sed.o:(.text+0x1b16): relocation truncated to fit: 16 against `.data'
Doing an objdump on the module shows
79c: 15f7 0001 1e14 mov $1, $25b6 <_lastline>
7a2: 2097 6c5c cmp r2, $66134
7a6: 8306 blos 7b4 <_getline.part.1+0x40>
7a8: 0a26 clr -(sp)
7aa: 09f7 f8f6 jsr pc, a4 <_truncated>
7ae: 0ac2 dec r2
7b0: 65c6 0002 add $2, sp
7b4: 8a0a clrb (r2)
7b6: 1080 mov r2, r0
7b8: 1582 mov (sp)+, r2
7ba: 0087 rts pc
7bc: 2097 6c5c cmp r2, $66134
7c0: 8202 bhi 7c6 <_getline.part.1+0x52>
7c2: 904a movb r1, (r2)
7c4: 0a82 inc r2
So the linker error appears reasonable. However the matching assembler input
for gas is
mov $01, _lastline
L_129:
cmp r2,$_linebuf+01750
blos L_130
clr -(sp)
jsr pc, _truncated
dec r2
add $02, sp
L_130:
clrb (r2)
mov r2, r0
mov (sp)+, r2
rts pc
L_125:
cmp r2,$_linebuf+01750
bhi L_127
movb r1, (r2)
inc r2
Which leads me assume that cmp register, $label+offset is being mis-assembled.
If I try and assemble the following
.text
.even
whoops: cmp r2, $boing+1
.data
boing: .word 0
then sure enough if I objdump it
00000000 <whoops>:
0: 2097 0005 cmp r2, $5
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/22859] New: gas seems to misassemble cmp r,$label+offset on PDP-11 with reproducer,
etchedpixels at gmail dot com <=