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

kernel: Unify and simplify constructor support #74700

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

Commits on Aug 25, 2024

  1. kernel: Unify .ctors and .init_array handling

    Handle both of these sections in a single chunk of code instead of
    separately. We don't need to use the legacy .ctors ABI as both
    the constructors array and startup logic are managed within a single
    link result.
    
    This can now also be used with ARC MWDT which had been using the .ctors
    sections but with .init_array semantics. For ARC MWDT, we now always
    discard .dtors and .fini sections as Zephyr will never cause global
    destructors to execute. Stop discarding .eh_frame sections so that
    exception handling works as expected.
    
    When building a NATIVE_APPLICATION, we ask the native C library to run all
    of the constructors to ensure any non-Zephyr constructors are run before
    main is invoked. It might be "nice" to split the constructors so that the
    Zephyr constructors were executed by the Zephyr code while the non-Zephyr
    ones were executed by the native C library. I think that could be done if
    we knew the pathnames of either the Zephyr or non-Zephyr files. That might
    make a good future enhancement.
    
    Signed-off-by: Keith Packard <[email protected]>
    keith-packard committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    91c964e View commit details
    Browse the repository at this point in the history
  2. tests/kernel: Validate constructor execution order

    Check the order of constructors, making sure those with a specified
    priority are called in numeric order after which those without priority are
    called.
    
    Signed-off-by: Keith Packard <[email protected]>
    keith-packard committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    7095dba View commit details
    Browse the repository at this point in the history