Bug 26126 - aarch64/mips: reject symbolic operand of an instruction taking an immediate operand
Summary: aarch64/mips: reject symbolic operand of an instruction taking an immediate o...
Status: UNCONFIRMED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.35
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-17 05:38 UTC by Fangrui Song
Modified: 2020-06-17 05:38 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2020-06-17 05:38:29 UTC
Rigid:
% powerpc64le-linux-gnu-as <<< 'or 3, 3, start-.; start:'  # good
% powerpc64le-linux-gnu-as <<< 'or 3, 3, start; start:'
{standard input}: Assembler messages:
{standard input}:1: Error: unsupported relocation against .text

Permissive:

% aarch64-linux-gnu-as <<< 'orr w3, w3, start; start:'
# no relocation

% mipsel-linux-gnu-as <<< 'ori $3, $3, start; start:'
% llvm-objdump -dr
...
       0: 04 00 63 34   ori     $3, $3, 4 <start>
                        00000000:  R_MIPS_LO16  .text

% mips64el-linux-gnuabi64-as <<< 'ori $3, $3, start; start:'  # succeeded
% llvm-objdump -dr
...
       0: 00 00 63 34   ori     $3, $3, 0 <.text>
                0000000000000000:  R_MIPS_LO16/R_MIPS_NONE/R_MIPS_NONE  .text+0x4

On most RISC architectures, the immediate bits cannot encode an arbitrary symbolic value (32-bit/64-bit). It probably makes sense rejecting assembling the instruction.