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

Implement the #[boot] attribute #11153

Closed
wants to merge 1 commit into from

Commits on Jan 10, 2014

  1. Implement the #[boot] attribute

    Before this patch there was no ability to link to both libnative and libgreen
    and specify which should be used to boot the main function. This commit moves
    this logic into a #[boot] attribute which can allow control over this. The
    changes made are:
    
    1. The lang_start function is moved back into libstd with the signature:
       fn(*u8, *u8, int, *u8) or (main, boot, argc, argv)
    2. Functions can now be tagged with #[boot] to indicate that the function can be
       used to boot a rust crate. This boot function is serialized to metadata.
    3. Imports of external modules can also be tagged with #[boot] to indicate that
       the crate's boot-function should be used to boot the runtime
    4. Only one #[boot] function/crate is allowed in an executable, more than one is
       an error (along with zero as well).
    5. The compiler will automatically inject '#[boot] extern mod green;' for now,
       this can be overrided with #[no_boot].
    
    With this new attribute, control over how a crate boots can be fine-tuned per
    executable and libraries can specify arbitrary boot functions. The boot function
    is purely responsible for dictating what context the 'main' function is run in,
    runtime initialization via rt::init is not the responsibility of the boot
    function. Finally, the boot function is also responsible for blocking until all
    rust tasks have exited.
    alexcrichton committed Jan 10, 2014
    Configuration menu
    Copy the full SHA
    6ad0d93 View commit details
    Browse the repository at this point in the history