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

            Bug ID: 34228
           Summary: [RISC-V] GNU ld.bfd Zicfilp funcsig force option
                    ignored
           Product: binutils
           Version: 2.45
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: l784896635 at gmail dot com
  Target Milestone: ---

I ran into this while reducing a RISC-V linker testcase. The reproducer is
already quite small, and I have been seeing the same result consistently across
three reruns.

Summary
=======
Current GNU ld.bfd 2.45 links the legal shared object successfully but warns
`-z zicfilp=func-sig ignored` and leaves the output without any GNU property
note. ld.lld 22.1.0 accepts the same option and emits a non-empty RISC-V
feature note carrying bit `4`, which current `readelf` prints as `<unknown:
4>`.

Expected behavior
=================
Force-enable ZICFILP function-signature landing pads on a legal RV64
shared-object link using `-z zicfilp=func-sig`, so the linker must synthesize
the corresponding GNU property note instead of silently ignoring the option.

Environment
===========
- product: binutils
- component: ld
- toolchain route: llvm-mc 22 plus current GNU ld.bfd 2.45 with ld.lld 22
control
- march: rv64i
- mabi: lp64
- first failing stage: link

Reduced testcase
================
--- f1-s.s ---
.section ".note.gnu.property", "a"
.balign 8
.4byte 4
.4byte (ndesc_end - ndesc_begin)
.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0
.asciz "GNU"
ndesc_begin:
.balign 8
.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND
.4byte 4
.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG
.balign 8
ndesc_end:

.text
.globl _start
.type f1,%function
f1:
  call f2
  ret

--- f2.s ---
.text
.globl f2
.type f2,@function
f2:
  .globl f3
  .type f3, @function
  call f3
  ret

--- f3-s.s ---
.section ".note.gnu.property", "a"
.balign 8
.4byte 4
.4byte (ndesc_end - ndesc_begin)
.4byte 0x5        // NT_GNU_PROPERTY_TYPE_0
.asciz "GNU"
ndesc_begin:
.balign 8
.4byte 0xc0000000 // GNU_PROPERTY_RISCV_FEATURE_1_AND
.4byte 4
.4byte 4          // GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG
.balign 8
ndesc_end:

.text
.globl f3
.type f3,@function
f3:
  ret

Reproduction notes
==================
- This packaged root does not have a single canonical `run.ps1` wrapper.
- Use the reduced inputs under `case/` and follow the commands documented in
`case/README.md`.
- Stable witness outputs, when present, are preserved under
`verify/run1..run3/`.

What I checked
==============
- Reduced inputs are preserved under case/.
- Stable witness outputs are preserved under verify/run1..run3/.
- The strict recheck says stable normalized run signatures across three runs:
True.
- Tracker guidance link:
https://sourceware.org/binutils/docs/ld/Bug-Reporting.html
- evidence summary: 3 clean reproductions under
hunt/verify/bfd_zicfilp_funcsig_force_option_ignored/run1..run3 are stable by
hash. In every run, all three assemblies succeed, `bfd.rc.txt` is 0 with the
same ignored-option `bfd.stderr.txt` hash, `bfd.notes.txt` is empty, and the
`ld.lld 22.1.0` control links successfully with identical non-empty
`lld22.notes.txt` showing the func-sig feature bit.

Notes
=====
upstream/llvm-project/lld/test/ELF/riscv-feature-zicfilp-func-sig.s

Root key: bfd.riscv.zicfilp_funcsig_force_option_ignored
Case id: 20260528-bfd-zicfilp-funcsig-force-option-ignored

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

Reply via email to