https://sourceware.org/bugzilla/show_bug.cgi?id=35013

            Bug ID: 35013
           Summary: bpf: gas encodes a conditional jump's symbolic
                    immediate as 0
           Product: binutils
           Version: 2.47
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: mumumu0722 at gmail dot com
  Target Milestone: ---

With the default -misa-spec (v4), gas silently encodes a conditional jump's
immediate as 0 when the jump target is a label and the immediate is defined
later with .set.

$ bpf-as --version
GNU assembler (GNU Binutils) 2.47.50.20261116
....

$ cat t.s
        if r1 > N goto 1f
        r0 = 1
1:
        exit
        .set N, 10
$ bpf-as -mdialect=pseudoc t.s -o t.o
$ bpf-objdump -d -M pseudoc --no-show-raw-insn t.o
   ...
   0:   if r1>0 goto 1
   8:   r0=1
  10:   exit

The comparison should be `if r1>10 goto 1`, but the immediate is 0.

The same input is assembled correctly with -misa-spec=v3:

$ bpf-as -mdialect=pseudoc -misa-spec=v3 t.s -o t.o
$ bpf-objdump -d -M pseudoc --no-show-raw-insn t.o
   0:   if r1>10 goto 1
   8:   r0=1
  10:   exit

Found by automated testing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to