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

Use small code model for UEFI targets #87124

Merged
merged 1 commit into from
Jul 17, 2021

Commits on Jul 17, 2021

  1. Use small code model for UEFI targets

    * Since the code model only applies to the code and not the data and the code model
    only applies to functions you call through using `call`, `jmp` and data with `lea`, etc…
    
    If you are calling functions using the function pointers from the UEFI structures the code
    model does not apply in that case. It’s just related to the address space size of your own binary.
    Since UEFI (uefi is all relocatable) uses relocatable PEs (relocatable code does not care about the
    code model) so, we use the small code model here.
    
    * Since applications don't usually take gigabytes of memory, setting the
    target to use the small code model should result in better codegen (comparable
    with majority of other targets).
    
    Large code models are also known for generating horrible code, for
    example 16 bytes of code to load a single 8-byte value.
    
    * Use the LLVM default code model for the architecture for the
    x86_64-unknown-uefi targets. For reference small is the default
    code model on x86 in LLVM: <https://github.com/llvm/llvm-project/blob/7de2173c2a4c45711831cfee3ccf53690c76ff07/llvm/lib/Target/X86/X86TargetMachine.cpp#L204>
    
    * Remove the comments too as they are not UEFI-specific and applies
    to pretty much any target. I added them before as I was explicitily
    setting the code model to small.
    
    Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
    Andy-Python-Programmer committed Jul 17, 2021
    Configuration menu
    Copy the full SHA
    db1e492 View commit details
    Browse the repository at this point in the history