-
Notifications
You must be signed in to change notification settings - Fork 163
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
Clarify Tag_RISCV_arch is the minimum execution environment requireme… #292
base: master
Are you sure you want to change the base?
Conversation
riscv-elf.adoc
Outdated
when object files are merged. | ||
Tag_RISCV_arch contains a string for the target architecture, this information | ||
used as the minimum execution environment requirement. Different architectures | ||
will be integrated into a superset when object files are merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's now how current binaries work, and it's a pretty strong meaning associated with that tag. IMO it's best to add a new one, as trying to re-purpose something with a bunch of old binaries lying around is going to lead to confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think that's my bad, isn't define that clearly that in spec before even I preaching this concept for several years :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how it poses a problem? If you add a new tag, you still have old binaries lying around that have Tag_RISCV_arch specifying some arch string without some Tag_RISCV_min_req_arch specifying the minimum, so you'd have to fall back on treating Tag_RISCV_arch as the requirement for those, at which point binaries without Tag_RISCV_min_req_arch behave identically to how Tag_RISCV_min_req_arch is specified. Redefining Tag_RISCV_arch to be the minimum required architecture to run the binary (as always intended, just not adequately captured due to a lack of IFUNC etc specification) wouldn't change behaviour at all, no? What am I missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has some off list discussion with Palmer, his concern is maybe here is already some binary has set that beyond the minimal requirement, but that currently work fine for now since no simulator or execution environment, however that could be problem those kind of old binary run on newer execution environment which will check Tag_RISCV_arch as minimum execution environment.
I think currently there are 3 options:
- Update the definition as this PR.
- Add a new tag called Tag_RISCV_min_req_arch for minimum execution environment requirement, but that will identical to Tag_RISCV_arch in most case.
- Add a new tag to identify Tag_RISCV_arch is presenting minimum execution environment requirement, e.g. Tag_RISCV_arch_is_min_req or a more generic attribute to recording the psABI version to disctionsu that
However option 2 seems just waste bunch of space to saving the duplicated string, so only option 1 or option 3 should be consider I think.
Regardless of whether a specific solution can be agreed ahead of 1.0 or not, I think it would be helpful for the psABI to comment on the case of one ELF file with functions that target different architecture baselines. If it's something that isn't handled well right now but is planned for future work, it would be helpful to say so. |
Further reflecting on this - it's not immediately obvious to me if/how this PR alters the status quo (vs my understanding of the current text at least). The current text talks about taking I think part of the confusion / challenge with these ELF attributes is that we've looked to use them to solve multiple problems, but they're not well suited to solving all of them as defined and the problems aren't the same priority:
|
09221dc
to
5ef692d
Compare
Changes:
|
After few rounds of off-list chat I realized I put the design story in different places like @asb do you mind take a look to see it's much clear to you now? I intentionally NOT document about disassembler part since mapping symbol ins't included in this release yet. |
What do you think about adding a sentence to clarify what is meant by "minimum execution environment". e.g. "this information |
…nt of objects And also add NOTE to mention we could use more than Tag_RISCV_arch specify, but must make sure that should work on the execution environment with what Tag_RISCV_arch specify only.
5ef692d
to
93e7068
Compare
@asb , thanks for the suggestion, applied! |
Existing binaries don't behave as described in this: the |
Defer this change, and adding another tag to mark this tag is minimum execution environment requirement. |
I think "this information reflects the minimum execution environment requirement. i.e. the set of instruction set extensions that the compiler may have used in code generation without any runtime feature detection or gating." is a logical consequence of the references to this tag being set based on |
The "minimal" set has its merits, but I'd vote to keep the exact user specified -march as well (and a superset when combining object files with disparate such entries in an executable/dso). This could be used to make runtime decisions. See [1] [1] https://sourceware.org/pipermail/libc-alpha/2023-January/144578.html |
-march is the minimal set, without further application-specific knowledge about the conditions under which functions get called (there's no way for a compiler or linker to know that functions compiled in an -march=rv32if file are only ever called when F's existence has already been dynamically checked). For anything else you should be using |
Indeed I'm only referring to build time info available to compiler/linker and nothing about execution env itself. Kito's msg in above thread seemed to indicate that glibc with V based ifuncs won't have 'V' in attributes to convey a "minimal" execution env which is a problem for what I'm envisioning trying to the attr for. |
V not showing up for V IFUNCs is a feature/deliberate design decision. In fact, this lets you have conflicting extensions in use by different IFUNCs, which is a feature that needs to be supported (for example, it lets you have F and Zfinx versions of floating-point library routines). |
…nt of objects
And also add NOTE to mention we could use more than Tag_RISCV_arch
specify, but must make sure that should work on the execution
environment with what Tag_RISCV_arch specify only.