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

codegen #[naked] functions using global asm #128004

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Commits on Oct 7, 2024

  1. Configuration menu
    Copy the full SHA
    ed9caf4 View commit details
    Browse the repository at this point in the history
  2. squashed changes to inlining and const eval

    first steps of codegen for `#[naked]` functions using `global_asm!`
    
    configure external linkage if no linkage is explicitly set
    
    create a `FunctionCx` and properly evaluate consts
    
    inline attribute is no longer relevant for naked functions
    
    the naked attribute no longer needs to be set by llvm/...
    
    we're generating global asm now, so this attribute is meaningless for the codegen backend
    folkertdev committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    3e95dcc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ca51a80 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7ebfe9e View commit details
    Browse the repository at this point in the history
  5. squashed changes to tests

    correctly emit `.hidden`
    
    this test was added in rust-lang#105193
    
    but actually NO_COVERAGE is no longer a thing in the compiler. Sadly,
    the link to the issue is broken, so I don't know what the problem was
    originally, but I don't think this is relevant any more with the global
    asm approach
    
    rename test file
    
    because it now specifically checks for directives only used by
    non-macos, non-windows x86_64
    
    add codegen tests for 4 interesting platforms
    
    add codegen test for the `#[instruction_set]` attribute
    
    add test for `#[link_section]`
    
    use `tcx.codegen_fn_attrs` to get attribute info
    
    Fix rust-lang#124375
    
    inline const monomorphization/evaluation
    
    getting rid of FunctionCx
    
    mark naked functions as `InstantiatedMode::GloballyShared`
    
    this makes sure that the function prototype is defined correctly, and we don't see LLVM complaining about a global value with invalid linkage
    
    monomorphize type given to `SymFn`
    
    remove hack that always emits `.globl`
    
    monomorphize type given to `Const`
    
    remove `linkage_directive`
    
    make naked functions always have external linkage
    
    mark naked functions as `#[inline(never)]`
    
    add test file for functional generics/const/impl/trait usage of naked functions
    folkertdev committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    20012cc View commit details
    Browse the repository at this point in the history
  6. make naked functions always have external linkage *in LLVM*. If we do…

    … it earlier, then some other logic causes invalid visibility for the item (exporting when it shouldn't).
    folkertdev committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    55e31b8 View commit details
    Browse the repository at this point in the history
  7. squashed changes:

    - codegen tests: change `windows` to `win`
    - cleanup
    - fix review comments
        - better way of checking for thumb
        - get the mangled name from the codegen backend
    - propagate function alignment
    - fix gcc backend
    - fix asan test
    - check that assembler mode restored
    folkertdev committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    f36e463 View commit details
    Browse the repository at this point in the history