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

Docs: meaning of push-state and pop-state unclear #339

Closed
matu3ba opened this issue Feb 10, 2022 · 0 comments
Closed

Docs: meaning of push-state and pop-state unclear #339

matu3ba opened this issue Feb 10, 2022 · 0 comments

Comments

@matu3ba
Copy link

matu3ba commented Feb 10, 2022

In lld the docs say

In the lld
.It Fl -push-state
Save the current state of
.Fl -as-needed ,
.Fl -static ,
and
.Fl -while-archive.
.It Fl -pop-state
Undo the effect of
.Fl -push-state.

In mold this has the behavior

    } else if (read_flag(args, "push-state")) {
      state.push_back({ctx.as_needed, ctx.whole_archive, ctx.is_static,
                       ctx.in_lib});
    } else if (read_flag(args, "pop-state")) {
      if (state.empty())
        Fatal(ctx) << "no state pushed before popping";
      std::tie(ctx.as_needed, ctx.whole_archive, ctx.is_static, ctx.in_lib) =
        state.back();
      state.pop_back();

For example --start-lib mentions in-archive-file,

  --start-lib                 Give following object files in-archive-file semantics
    --end-lib                 End the effect of --start-lib

and it set via ctx.in_lib = true.

  1. What does in-archive-file mean? Is in-lib-file meant?
  2. Do you want to add this also to lld or is this the same behavior with fine-tuned controlled?

For me to remember: The docs do not mention -- and - can be used for linker flags.

@matu3ba matu3ba changed the title Docs: push-state and pop-state and the meaning Docs: meaning of push-state and pop-state unclear Feb 10, 2022
@rui314 rui314 closed this as completed in b0d75f8 Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant