Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FDPIC/ePIC draft specification and work plan #429

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

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?

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.

3 participants