HackMD
  • Prime
    Prime  Full-text search on all paid plans
    Search anywhere and reach everything in a Workspace with Prime plan.
    Got it
    • Prime  Full-text search on all paid plans
      Prime  Full-text search on all paid plans
      Search anywhere and reach everything in a Workspace with Prime plan.
      Got it
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
    Menu Sharing Help
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Gist
    Import
    Dropbox Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    Write
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # GCC Rust Meeting 2022-05-13 - Date/Time: 13th May 2022 at: 09h00 UTC - Mailing list: https://gcc.gnu.org/mailman/listinfo/gcc-rust - Zulip: https://gcc-rust.zulipchat.com/ - IRC: irc.oftc.net #gccrust - Video Link: https://meet.jit.si/gccrs-community-call ## Agenda - Project Reports - What are we working on - Testing project - Slices magic - Goal testcase - Metadata exports - i386 build issue - Build Badges - Maintaining cargo-gccrs - Rust edition poll on internals.rust-lang.org - Questions ## Project Reports Monthly report: https://github.com/Rust-GCC/Reporting/blob/main/2022-04-monthly-report.org ### What are we working on philbert: - Metadata exports - Bugs arthur: - Privacy analysis - Reporting "private in public" errors and so on - More path resolution ### Testing project ### Slices magic I had issues when it came to debugging the compiled code generating a slice from an array. It boilds down to this function which was allocating FatPtr on the stack and this address won't exist: ```rust struct FatPtr<T> { data: *const T, len: usize, } pub union Repr<T> { rust: *const [T], rust_mut: *mut [T], raw: FatPtr<T>, } const fn slice_from_raw_parts<T>(data: *const T, len: usize) -> *const [T] { unsafe { Repr { raw: FatPtr { data, len }, } .rust } } ``` see: https://godbolt.org/z/KrxeYfxo9 From libcore 1.49.0 ``` 262 #[inline] 263 #[stable(feature = "slice_from_raw_parts", since = "1.42.0")] 264 #[rustc_const_unstable(feature = "const_slice_from_raw_parts", issue = "67456")] 265 pub const fn slice_from_raw_parts<T>(data: *const T, len: usize) -> *const [T] { 266 // SAFETY: Accessing the value from the `Repr` union is safe since *const [T] 267 // and FatPtr have the same memory layouts. Only std can make this 268 // guarantee. 269 unsafe { Repr { raw: FatPtr { data, len } }.rust } ``` Thanks to @flip1995 - https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=fbdf833b8adc64f4151752e2301db15b - https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9873f9af2ad5620a77466797fae362ba - https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=672adac002939a2dab43b8d231adc1dc Turns out it is documented! - https://doc.rust-lang.org/reference/dynamically-sized-types.html ```*const [T]``` is _not_ a pointer to the FatPtr struct. The language type of ```*const [T]``` is a dynamicaly sized type which is itself a struct passed by value which _is_ FatPtr itself. see: https://github.com/Rust-GCC/gccrs/issues/1232 GDB must have some code here to know that taking the address of an array automatically make a slice structure. ### Privacy Pass https://github.com/Rust-GCC/gccrs/pull/1246 @arthur TODO ### Goal testcase https://github.com/Rust-GCC/gccrs/issues/682 Need support for range iterators and for loops. @bjorn3 has also been testing with gccrs with the SIP hasher in libcore: see: https://github.com/Rust-GCC/gccrs/issues/1247 ### Metadata exports This is in progress but I dedicated time to bugs and the goal-test case which has been really useful. Looks like there are tests in GCC that assemble and link files together which will be really interesting way to do testing for this. ``` PASS: gcc.dg/lto/20081125 c_lto_20081125_0.o assemble, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects PASS: gcc.dg/lto/20081125 c_lto_20081125_1.o assemble, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects PASS: gcc.dg/lto/20081125 c_lto_20081125_0.o-c_lto_20081125_1.o link, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects ``` ### i386 build issue We were printing i64's using %i in some test cases which is not going to be platform agnostic. The other issue was that we did not respect host-wide-int when printing the array capacity mismatch errors. - https://github.com/Rust-GCC/gccrs/commit/48cad9e8aed699c396afb7592dd637f2e87723dc - https://github.com/Rust-GCC/gccrs/commit/dd213da6a3bd0587dc1e85a94674f935360ee5af ### Build Badges - https://builder.sourceware.org/ - https://github.com/Rust-GCC/gccrs/issues/1236 ### Maitaining cargo-gccrs I plan on doing a full revamp of the architecture so that it's easier in the future to add flags, since gccrs is starting to support more and more. ### Rust edition poll - https://internals.rust-lang.org/t/discussion-editions-in-rust-gcc-and-other-rust-compilers/16608/8 2015 seems to be heavily favored. What do people think? ## Questions ### Taking advantage of GCC Take advantage of GCC tree's https://github.com/Rust-GCC/gccrs/issues/1204 We could add in a field to store the associated TyTy type to the tree for example: ```cpp RUST_TY(TREE_TYPE(expr)) ``` This would help make alot of code in the code-generation pass alot better. Lang fields like: ```cpp /* These flags are available for each language front end to use internally. */ #define TREE_LANG_FLAG_0(NODE) \ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_0) #define TREE_LANG_FLAG_1(NODE) \ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_1) #define TREE_LANG_FLAG_2(NODE) \ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_2) #define TREE_LANG_FLAG_3(NODE) \ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_3) #define TREE_LANG_FLAG_4(NODE) \ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_4) #define TREE_LANG_FLAG_5(NODE) \ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_5) #define TREE_LANG_FLAG_6(NODE) \ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_6) ``` Could be used for useful flags. ### GCC Git Branch <https://github.com/Rust-GCC/gccrs/issues/143> What if we create the Git branch by maintaining what the "mega-commit" will be to merge upstream. Pros: - Avoid rewriting the history to fix the bad commit message - Avoid tweaking the git hooks Cons: - Looses history - Doesn't resolve the general issue going forward (after the "mega-commit"): GCC/Rust development commit logs don't adhere to the standard GCC style - ..., and we probably don't want to enforce that as this point (proper ChangeLog updates for each Git commit!) However, I (Thomas) have news to share about this topic, and also need discussion: - *devel* vs. *mirror*: Should GCC folks be permitted to push to the GCC-side *devel/rust/master*, and we occasionally merge that back into GitHub, or should the GCC-side branch in fact be just a read-only *mirror/rust/master*? - *mirror* would be a new Git branch hierarchy, with, basically, read-only semantics; just to make something visible on the GCC-side Git repository. - Also set up GCC Bugzilla? - Add new component "rust" at <https://gcc.gnu.org/bugzilla/editcomponents.cgi?product=gcc>. - Add new version "rust/master" at <https://gcc.gnu.org/bugzilla/editversions.cgi?product=gcc>. ### Tracking Contributors We will be loosing our Git history when eventually merging upstream. Should we maintain a CONTRIBUTORS file in our front-end folder?

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in via Google

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully