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

[FMV] Change the default versions name mangling. #277

Merged
merged 5 commits into from
Mar 8, 2024

Conversation

DanielKristofKiss
Copy link
Contributor

The default version's name to be mangled to avoid problems with ifuncs due to the ifunc to be called as the base name of the function.

As for any pull request, please make sure to go through the below
checklist.

Checklist: (mark with X those which apply)

  • If an issue reporting the bug exists, I have mentioned it in the
    PR (do not bother creating the issue if all you want to do is
    fixing the bug yourself).
  • I have added/updated the SPDX-FileCopyrightText lines on top
    of any file I have edited. Format is SPDX-FileCopyrightText: Copyright {year} {entity or name} <{contact informations}>
    (Please update existing copyright lines if applicable. You can
    specify year ranges with hyphen , as in 2017-2019, and use
    commas to separate gaps, as in 2018-2020, 2022).
  • I have updated the Copyright section of the sources of the
    specification I have edited (this will show up in the text
    rendered in the PDF and other output format supported). The
    format is the same described in the previous item.
  • I have run the CI scripts (if applicable, as they might be
    tricky to set up on non-*nix machines). The sequence can be
    found in the contribution
    guidelines
    . Don't
    worry if you cannot run these scripts on your machine, your
    patch will be automatically checked in the Actions of the pull
    request.
  • I have added an item that describes the changes I have
    introduced in this PR in the section Changes for next
    release
    of the section Change Control/Document history
    of the document. Create Changes for next release if it does
    not exist. Notice that changes that are not modifying the
    content and rendering of the specifications (both HTML and PDF)
    do not need to be listed.
  • When modifying content and/or its rendering, I have checked the
    correctness of the result in the PDF output (please refer to the
    instructions on how to build the PDFs
    locally
    ).
  • The variable draftversion is set to true in the YAML header
    of the sources of the specifications I have modified.
  • Please DO NOT add my GitHub profile to the list of contributors
    in the README page of the project.

@vhscampos
Copy link
Member

Some points aren't clear in the text:

  1. Will this new default name mangling happen only with FMV enabled or globally?
  2. If the only version specified is the default one, either explicitly with the attribute or implictly without the attribute, will the new mangling still take place?

@DanielKristofKiss
Copy link
Contributor Author

Some points aren't clear in the text:

  1. Will this new default name mangling happen only with FMV enabled or globally?

Only when FMV enabled. By amending the default version with "default" the basename could be used by the resolved symbol, referenced externally as it won't collide with the default function.

  1. If the only version specified is the default one, either explicitly with the attribute or implictly without the attribute, will the new mangling still take place?

Depends on, for the same as above reasons. if the toolchain can avoid emitting redirections then no need to use the default version. maybe a alias could be useful.

main/acle.md Outdated
mangling.
The `"default"` version is mangled with `".default"` on top of the
language-specific name mangling. When the `"default"` version matches with an
explicitly provided version an alias to be generated.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
explicitly provided version an alias to be generated.
explicitly provided version an alias to be generated.
All versions expected to have at least alias that points to actual version.

@andrewcarlotti
Copy link

I don't understand the remark about aliases in this change. Is this saying that the compiler can optimise versions with identical function bodies to a single function with additional aliased names? If so, I don't think that's relevant to this spec. Alternatively, is it referring to a case where a non-default version specifies only features that the compiler is already assuming to be present?

@andrewcarlotti
Copy link

Aside from that, I think the mangling changes are reasonable. It might be worth adding an explicit remark that the versioned symbol (i.e. the one that is resolved to one of the versions) should have the same mangling as would be used if the function didn't use function multiversioning.

@DanielKristofKiss
Copy link
Contributor Author

I don't understand the remark about aliases in this change. Is this saying that the compiler can optimise versions with identical function bodies to a single function with additional aliased names? If so, I don't think that's relevant to this spec. Alternatively, is it referring to a case where a non-default version specifies only features that the compiler is already assuming to be present?

The intention is to be sure all function names remain always available when the certain optimisation eliminates a version. (e.g. the default and a given version got merged).

Aside from that, I think the mangling changes are reasonable. It might be worth adding an explicit remark that the versioned symbol (i.e. the one that is resolved to one of the versions) should have the same mangling as would be used if the function didn't use function multiversioning.

ACK.

main/acle.md Outdated Show resolved Hide resolved
main/acle.md Outdated Show resolved Hide resolved
main/acle.md Outdated Show resolved Hide resolved
@andrewcarlotti
Copy link

This looks good to me now. I've already implemented this mangling in GCC.

@vhscampos vhscampos merged commit 66b1970 into ARM-software:main Mar 8, 2024
4 checks passed
hassnaaHamdi pushed a commit to hassnaaHamdi/ACLE that referenced this pull request Mar 11, 2024
Comment on lines +369 to 372
* Change name mangling of the default version.
* Align priorities to account for feature dependencies.
* Introduce alternative names (aliases) `rdma` for `rdm`.
* Correct FEAT_BTI feature register value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Changed
Aligned
Introduced
Corrected

Copy link
Contributor

@sallyarmneale sallyarmneale left a comment

Choose a reason for hiding this comment

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

Minor changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants