[PATCH v2] riscv: Ignore attributes in input file with empty code section
H.J. Lu
hjl.tools@gmail.com
Thu May 28 21:45:06 GMT 2026
On Thu, May 28, 2026 at 5:29 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Ignore empty and .note.gnu.build-id sections when merging attributes.
> The following linker tests now pass for riscv:
>
> FAIL: Diagnostics - Wrong magic number mixed with valid CTF sections
> FAIL: --gc-sections with --defsym
> FAIL: --gc-sections with KEEP
> FAIL: --gc-sections with __start_SECTIONNAME
> FAIL: ld-plugin/lto-10r
> FAIL: ld-plugin/lto-3r
> FAIL: ld-plugin/lto-4r-a
> FAIL: ld-plugin/lto-4r-b
> FAIL: ld-plugin/lto-4r-c
> FAIL: ld-plugin/lto-4r-d
> FAIL: ld-plugin/lto-5r
> FAIL: PR ld/19317 (2)
> FAIL: PR ld/19317 (3)
>
> PR ld/34185
> * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Ignore
> attributes in empty input file
>
Here is the v2 patch to ignore attributes in input file with empty code section
when merging attributes.
--
H.J.
---
Ignore attributes in input file with empty code section when merging
attributes. The following linker tests now pass for riscv:
FAIL: Diagnostics - Wrong magic number mixed with valid CTF sections
FAIL: --gc-sections with --defsym
FAIL: --gc-sections with KEEP
FAIL: --gc-sections with __start_SECTIONNAME
FAIL: ld-plugin/lto-10r
FAIL: ld-plugin/lto-3r
FAIL: ld-plugin/lto-4r-a
FAIL: ld-plugin/lto-4r-b
FAIL: ld-plugin/lto-4r-c
FAIL: ld-plugin/lto-4r-d
FAIL: ld-plugin/lto-5r
FAIL: PR ld/19317 (2)
FAIL: PR ld/19317 (3)
bfd/
PR ld/34185
* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Ignore
attributes in input file with empty code section.
ld/
PR ld/34185
* testsuite/ld-elf/pr17068d.s: Make text section non-empty in the
only input file to create a shared library with the proper ELF
header for riscv.
* testsuite/ld-elf/pr20995c.s: Likewise.
* testsuite/ld-elf/pr22471a.s: Likewise.
* testsuite/ld-elf/pr25458b.s: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v2-0001-riscv-Ignore-attributes-in-input-file-with-empty-.patch
Type: text/x-patch
Size: 3700 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260529/965f0f89/attachment.bin>
More information about the Binutils
mailing list