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

Enable building with lld #75

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

Commits on Jan 27, 2024

  1. libsel4utils: Fix TLS page fault if PT_PHDR exists

    PT_PHDR is emitted by ld.lld but not ld.bfd. This segment should only
    exist if the program header *is* part of the program memory image itself
    (which is not the case in seL4, as it copies the program header in the
    stack). This is important as muslc’s TLS init is relying on the existence
    of PT_PHDR to get the base address of the image in memory and from that,
    it calculates the TLS base for the source ELF. The calculation will be
    wrong in seL4 as the program header is copied in the stack; thus it may
    trigger a page fault if the new TLS base is not mapped, or affects the
    integrity of programs relying on TLS variables (e.g., those with
    __thread).
    
    By setting PT_PHDR's segment to PT_NULL, muslc will skip this search and
    won't do any relocations for the TLS segment which is part of the
    loaded ELF image itself, thus getting the correct mapped address.
    
    Sponsored by: DARPA.
    
    Signed-off-by: Hesham Almatary <hesham.almatary@cl.cam.ac.uk>
    heshamelmatary committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    273deba View commit details
    Browse the repository at this point in the history
  2. libsel4test: retain _test_type and _test_case

    unused attribute does not prevent the sections from being
    garbage-collected during link-time optimisation. This may trigger
    undefined references errors to [__start|__stop]_test_case symbols
    that are expected to be emitted by the linker anyway.
    
    Adding "retain" attribute makes sure that the section and its
    associated symbols are kept regardless of linker's garbage
    collection. Another fix could be adding "nostart-stop-gc" to the
    linker flags, but since it is only one section (_test_case)
    where its __start/__stop symbols are references, adding retain to
    it makes more sense. This additional functionality requires
    binutils version 2.36 or later.
    
    Sponsored by: DARPA.
    
    Signed-off-by: Hesham Almatary <hesham.almatary@cl.cam.ac.uk>
    heshamelmatary committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    05fc543 View commit details
    Browse the repository at this point in the history