[PATCH 2/2] RISC-V: Merge ELF attribute for ld

7 views
Skip to first unread message

Kito Cheng

unread,
Jan 9, 2019, 8:47:41 AM1/9/19
to binu...@sourceware.org, Jim Wilson, Palmer Dabbelt, pat...@groups.riscv.org
This is version 2 patch of implement the RISC-V ELF attribute merge.

Patch tested with 4 different configuration: (rv32gc, rv64gc) x (newlib, glibc)

Change list:
- Fix several typo.
- Fix testcase fail on RV64.
- Add more comment.
- Use strcasecmp instead of strcmp in riscv_i_or_e_p
- Check and compare version of baseline ISA.
- Check ARCH_SIZE with xlen_in and xlen_out
- Remove PT_RISCV_ATTRIBUTES and related codes.

ChangeLog
bfd/
* elfnn-riscv.c (in_subsets): New.
(out_subsets): Likewise.
(merged_subsets): Likewise.
(riscv_std_ext_p): Likewise.
(riscv_non_std_ext_p): Likewise.
(riscv_std_sv_ext_p): Likewise.
(riscv_non_std_sv_ext_p): Likewise.
(riscv_version_mismatch): Likewise.
(riscv_i_or_e_p): Likewise.
(riscv_merge_std_ext): Likewise.
(riscv_merge_non_std_and_sv_ext): Likewise.
(riscv_merge_arch_attr_info): Likewise.
(riscv_merge_attributes): Likewise.
(_bfd_riscv_elf_merge_private_bfd_data): Merge attribute.

ld/
* testsuite/ld-elf/orphan-region.d: XFAIL for RISC-V, because add new
section.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Add new tests.
* testsuite/ld-riscv-elf/attr-merge-arch-01.d: New test.
* testsuite/ld-riscv-elf/attr-merge-arch-01a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-01b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-02a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-02b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-03a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-03b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec-b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-priv-spec.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-stack-align-a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-stack-align-b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-stack-align-failed-a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-stack-align-failed-b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-stack-align-failed.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-stack-align.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-01.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-01a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-01b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-02.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-02a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-02b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-03.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-03a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-03b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-04.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-04a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-04b.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-05.d: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-05a.s: Likewise.
* testsuite/ld-riscv-elf/attr-merge-strict-align-05b.s: Likewise.

Jim Wilson

unread,
Jan 9, 2019, 3:28:39 PM1/9/19
to Kito Cheng, Binutils, Palmer Dabbelt, RISC-V Patches
On Wed, Jan 9, 2019 at 5:47 AM Kito Cheng <kito....@gmail.com> wrote:
> This is version 2 patch of implement the RISC-V ELF attribute merge.

You forgot to attach the patch.

Jim

Kito Cheng

unread,
Jan 9, 2019, 8:53:11 PM1/9/19
to pat...@groups.riscv.org, Binutils, Palmer Dabbelt
Sorry, next time I'll use git to sent mail directly instead of gmail
to prevent such stupid thing happen again...
> --
> You received this message because you are subscribed to the Google Groups "RISC-V Patches" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to patches+u...@groups.riscv.org.
> To post to this group, send email to pat...@groups.riscv.org.
> Visit this group at https://groups.google.com/a/groups.riscv.org/group/patches/.
> To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/patches/CAFyWVaaOyimjwtCoZSFWPP8rz_Z-krfw2FyefwTX_kL%3D6L_CUg%40mail.gmail.com.
> For more options, visit https://groups.google.com/a/groups.riscv.org/d/optout.
0002-RISC-V-Merge-ELF-attribute-for-ld.patch

Jim Wilson

unread,
Jan 14, 2019, 9:00:38 PM1/14/19
to Kito Cheng, Binutils, Palmer Dabbelt, RISC-V Patches
On Wed, Jan 9, 2019 at 12:28 PM Jim Wilson <ji...@sifive.com> wrote:
> On Wed, Jan 9, 2019 at 5:47 AM Kito Cheng <kito....@gmail.com> wrote:
> > This is version 2 patch of implement the RISC-V ELF attribute merge.

This looks good. It fixes the testsuite failures I had with only the
other two patches applied.

I noticed one place in riscv_merge_non_std_and_sv_ext where you still
have a line that ends with an open paren, but that is a minor style
issue.

I found it interesting that now that we use standard numbering for
attributes and standard code for parsing them, we can't have a zero
value Tag_RISCV_unaligned_access attribute anymore, as the standard
code filters out attributes with default values. That looks OK
though, I don't think it will be a problem.

This is OK to go in once the other two patches are in.

Jim
Reply all
Reply to author
Forward
0 new messages