Skip to content

[go1.20] Updated the linkname to handle new directives #1282

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

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

grantnelson-wf
Copy link
Collaborator

The linkname directive, //go:linkname localname [importpath.name], now optionally allows one-argument forms. Details found in compiler directives document. There was also a TODO in linkname.go to check for any additional arguments. The os package had a new insert-link to net that needed to be ignored and handled in the native overrides.

  • I reorganized the parseGoLinknames method to separate it into:
    • reading the linkname from the comment
    • checking if the linkname is supported by GopherJS
  • I added two methods to check for known links to ignore:
    • one method is for specific var-links
    • one method is for specific insert-links or any insert-links in specific packages
  • I added the native override for net.newUnixFile

The introduction of the one-argument form (and the new part in the compiler directives document) makes me feel like there will be more insert-style links on the horizon since the one-argument is to "suppresses the usual error for a function that lacks a body." So by having a better way to deal with specific links when needed, we will be able to track new insert-links and var-links better.

If enough insert-links are added we will probably have to start handling them directly instead of ignoring them and handling them in the native overrides. However, that's seems to be outside of the scope of this PR and #1270.

@grantnelson-wf grantnelson-wf marked this pull request as ready for review April 2, 2024 19:44
@grantnelson-wf grantnelson-wf changed the title [g01.20] Updated the linkname to handle new directives [go1.20] Updated the linkname to handle new directives Apr 2, 2024
@grantnelson-wf grantnelson-wf force-pushed the updateLinkname branch 2 times, most recently from 4415fb0 to cdd523b Compare April 3, 2024 16:43
@nevkontakte nevkontakte merged commit a1c6032 into gopherjs:go1.20 Apr 7, 2024
@grantnelson-wf grantnelson-wf deleted the updateLinkname branch April 11, 2024 21:45
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