[Bug gas/26025] New: riscv gas inserts relocation for BFD_RELOC_RISCV_CFA in last section of file, instead of relevant section

2020-05-22 Thread je...@j-software.dk
https://sourceware.org/bugzilla/show_bug.cgi?id=26025

Bug ID: 26025
   Summary: riscv gas inserts relocation for BFD_RELOC_RISCV_CFA
in last section of file, instead of relevant section
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gas
  Assignee: unassigned at sourceware dot org
  Reporter: je...@j-software.dk
  Target Milestone: ---

Created attachment 12562
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12562&action=edit
Assembly triggering the bug

Somehow a specific sequence of Dwarf debug info triggers this bug.

It causes R_RISCV_SET32 and R_RISCV_SUB32 relocations to be added to the last
section of the file, in the attached example that would be
.text.z_DEBUGEND_$P$TEST

When trying to link this it would generate a segfault because it's not the
right section, and an empty one

I'm guessing it's because relocations can't be added in riscv_pre_output_hook
the way it's currently done

Steps to reproduce:
riscv32-linux-as test.s -o test.o
riscv32-linux-ld test.o
riscv32-linux-objdump -r test.o

objdump would show two relocations in the last section that should be in
.debug_frame instead

Same thing happens on 64bit toolchain as well

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


[Bug gas/26025] riscv gas inserts relocation for BFD_RELOC_RISCV_CFA in last section of file, instead of relevant section

2020-05-22 Thread je...@j-software.dk
https://sourceware.org/bugzilla/show_bug.cgi?id=26025

--- Comment #1 from je...@j-software.dk ---
Created attachment 12563
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12563&action=edit
Potential fix

This patch removes the crash and seems to put the relocations in the right
place

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


[Bug gas/26025] riscv gas inserts relocation for BFD_RELOC_RISCV_CFA in last section of file, instead of relevant section

2020-05-24 Thread je...@j-software.dk
https://sourceware.org/bugzilla/show_bug.cgi?id=26025

--- Comment #3 from je...@j-software.dk ---
I don't have a copyright assignment, but the patch is in public domain

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