Skip to content

Conversation

@sorear
Copy link
Collaborator

@sorear sorear commented Feb 27, 2024

This needs extensive editing to match the existing document, and I also haven't even started on prototype coding, but it's become clear the specification needs to exist somewhere other than my answers to questions on IRC so let's start a draft here.

I intend to create a second PR when I have something ready for formal review. Feel free to use this as a discussion thread for the high-level design.


NOTE: This style of function descriptor is used in specialized FDPIC ABIs for
Blackfin, FR-V, SuperH, and Arm, and is part of the default ABI for PA-RISC,
POWER (v1 only, has a third "static chain" field), and IA-64.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PPC64 ELFv1, "static chain" is for dynamic linker's lazy binding. This is "environment pointer"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the two terms are interchangeable; they both go into r11 anyway. x86-64 also calls the register static chain.

In ePIC, `gp` is invariant and holds the GOT address for the process image at
all instruction boundries.

== Range extension thunks
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to belong to another proposal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's another proposal to add it to the non-FDPIC ABI but it's considered an integral part of the FDPIC ABI.


=== riscv-toolchain-conventions

Add -mfdpic option for FDPIC and -mepic option for ePIC.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think -mepic in the previous proposal is in spirit identical to -msep-data (m68k, bfin) and -mno-pic-data-is-text-relative (arm).

-fPIE -mfdpic with hidden visibility declarations can replace -fPIE -msep-data, though setting the call-clobbered FDPIC register has slight overhead.

Do we want to introduce another option to avoid the minor FDPIC register overhead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're saving two memory accesses on a generic function call. It's probably close to -fomit-frame-pointer in total.

@kito-cheng
Copy link
Collaborator

Ping, @sorear do you have further update on this, or do you need some help on PoC implementation?

@Ruinland
Copy link

Hi @sorear and @kito-cheng , I am wondering how's the current status of this psABI ?
If my memories serve me correctly, there were once a proposal to add toolchain and musl-libc support with RISC-V FDPIC.
Yet judged from what I see in this PR, the spec seemed have never landed ?

@kito-cheng
Copy link
Collaborator

Hi @sorear and @kito-cheng , I am wondering how's the current status of this psABI ? If my memories serve me correctly, there were once a proposal to add toolchain and musl-libc support with RISC-V FDPIC. Yet judged from what I see in this PR, the spec seemed have never landed ?

Yeah, this PR is kinda lack of resource to moving forward, I am happy to push this forward, however this is not on my priority list yet, and seems @sorear are busy with other stuffs, so...volunteer is welcome :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants