)]}'
{
  "commit": "27f754ee503500d4986bfec4e4daf6fda014e159",
  "tree": "2894b096da64aac288079582d1fda96fef828a75",
  "parents": [
    "bbac5532cc14433df45b08d89c2d25cee3e9d218"
  ],
  "author": {
    "name": "Tsukasa OI",
    "email": "research_trasio@irq.a4lg.com",
    "time": "Tue May 13 08:14:01 2025 +0000"
  },
  "committer": {
    "name": "Nelson Chu",
    "email": "nelson@rivosinc.com",
    "time": "Fri May 16 09:47:27 2025 +0800"
  },
  "message": "RISC-V: check offsets when linker relaxation is disabled\n\nThe assembler partially relied on the linker to check whether the\noffset is valid.  However, some optimization logic (added later)\nremoves relocations relative to local symbols without checking offsets.\n\nFor instance, it caused following code to silently emit wrong jumps\n(to the jump instruction \".\" itself) without relocations:\n\n\u003e .option norelax\n\u003e j .+0x200000   # J (or JAL) instruction cannot encode this offset.\n\u003e j .+1          # Jump to odd address is not valid.\n\nThis commit adds offset checks where necessary.\n\ngas/ChangeLog:\n\n\t* config/tc-riscv.c (md_apply_fix): Check offsets when the\n\trelocation relative to a local symbol is being optimized out.\n\t* testsuite/gas/riscv/no-relax-branch-offset-fail.s: Failure\n\tcase where the branch offset is invalid.\n\t* testsuite/gas/riscv/no-relax-branch-offset-fail.d: Ditto.\n\t* testsuite/gas/riscv/no-relax-branch-offset-fail.l: Ditto.\n\t* testsuite/gas/riscv/no-relax-branch-offset-ok.s: Border case.\n\t* testsuite/gas/riscv/no-relax-branch-offset-ok.d: Ditto.\n\t* testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.s: Failure\n\tcase only on RV64 where the PC-relative offset exceed limits.\n\t* testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.d: Ditto.\n\t* testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.l: Ditto.\n\t* testsuite/gas/riscv/no-relax-pcrel-offset-fail-not-32.d: Test\n\tcase for RV32 so that no errors occur.\n\t* testsuite/gas/riscv/no-relax-pcrel-offset-ok.s: Border case.\n\t* testsuite/gas/riscv/no-relax-pcrel-offset-ok.d: Ditto.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ca4030d6a9340d8738f53e48d88ec432ce7bc4e0",
      "old_mode": 33188,
      "old_path": "gas/config/tc-riscv.c",
      "new_id": "a35288e55cb1ca3b91db81049e0ff049786d7d09",
      "new_mode": 33188,
      "new_path": "gas/config/tc-riscv.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "0e8477146805b0312db986a639650c0c677c22bf",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-branch-offset-fail.d"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "8f6b5c955915aeb8f53e2a3817ad525952370084",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-branch-offset-fail.l"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "98a0978e7fc3aa3e665c653e13cde0cce2507a1c",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-branch-offset-fail.s"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "6ef31e2df417910287ce80d0be6da2d247bf4d7c",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-branch-offset-ok.d"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "4711c90c023b76c03e6561748cbe1c5ee5146a0e",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-branch-offset-ok.s"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "79d59deb095b2c16b69fdb8d36ae2fd219a57586",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.d"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "bcc09252b7584c34347e25426ca11d3ad2f6f45c",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.l"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "d01ffe965ed62d39aa1b8e7236ea279c54eb804b",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.s"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "0d7cb7c650de3ec939e3a045f0691c27c64756ce",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-pcrel-offset-fail-not-32.d"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e585032f8624ff09e13bb7a2867320b8a82e6009",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-pcrel-offset-ok.d"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ededcca02b1badeaab19631fd5fc136c691fab93",
      "new_mode": 33188,
      "new_path": "gas/testsuite/gas/riscv/no-relax-pcrel-offset-ok.s"
    }
  ]
}
