Page MenuHomeFreeBSD

readelf: Add support for RISC-V specific e_flags
ClosedPublic

Authored by mhorne on Jun 26 2019, 1:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 15 2024, 5:34 PM
Unknown Object (File)
Feb 15 2024, 6:40 AM
Unknown Object (File)
Jan 30 2024, 9:21 PM
Unknown Object (File)
Jan 30 2024, 9:21 PM
Unknown Object (File)
Jan 30 2024, 9:21 PM
Unknown Object (File)
Jan 2 2024, 4:50 AM
Unknown Object (File)
Dec 22 2023, 11:20 PM
Unknown Object (File)
Dec 22 2023, 10:48 PM

Details

Summary
Test Plan

Sample outputs from readelf -h:

ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            NONE
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           RISC-V
  Version:                           0x1
  Entry point address:               0x120aa
  Start of program headers:          64 (bytes into file)
  Start of section headers:          15976 (bytes into file)
  Flags:                             0x5, double-float ABI, RVC
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         7
  Size of section headers:           64 (bytes)
  Number of section headers:         26
  Section header string table index: 25

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Update the flag messages to match GNU's readelf.
Include a check for soft-float ABI.

This revision is now accepted and ready to land.Jun 26 2019, 4:14 PM

Use EF_RISCV_FLOAT_ABI_MASK instead of EF_RISCV_FLOAT_ABI_QUAD

This revision now requires review to proceed.Jun 26 2019, 4:42 PM

What is the process for committing changes to elftoolchain? Should I commit them to FreeBSD and make separate submissions for the upstream repo?

contrib/elftoolchain/common/elfdefinitions.h
431 ↗(On Diff #59066)

I'm not sure if this file needs an EF_RISCV_FLOAT_ABI_SOFT as well. Honestly I'm not sure what uses these definitions since readelf uses sys/elf_common.h. Is this still worth keeping in the same commit?

What is the process for committing changes to elftoolchain? Should I commit them to FreeBSD and make separate submissions for the upstream repo?

You can just commit to FreeBSD for now. @emaste asked me to submit my recent changes as commits against https://github.com/elftoolchain/elftoolchain so I guess you could do that too, but maybe see if he chimes in here first.

contrib/elftoolchain/common/elfdefinitions.h
431 ↗(On Diff #59066)

I don't think it hurts to keep it.

I'm not sure what these are used for. They might be useful on other operating systems which don't have an equivalent system header.

Ideally we'd commit changes upstream and then import a new version with a latency of several days or a week or so but that process seems to be somewhat slow right now so I'm fine with just committing to FreeBSD and then having @markj or me work on upstreaming changes in batches.

That said if you do have changes in a GitHub fork (and submit pull requests or just point me at them) I can cherry pick and git-svn commit.

Patches sent to elftoolchain-developers and tickets filed on SF are
usually responded to within a few days (usually by the weekend).

Regards,
Joseph Koshy

Add EF_RISCV_FLOAT_ABI_MASK to elfdefinitions.h.

mhorne added inline comments.
contrib/elftoolchain/common/elfdefinitions.h
431 ↗(On Diff #59066)

You were right, it needs to be defined here to build the upstream elftoolchain, even on FreeBSD.

This revision is now accepted and ready to land.Jun 27 2019, 3:46 PM
This revision was automatically updated to reflect the committed changes.
mhorne marked an inline comment as done.