Skip to content

proc-macro-srv: make usage of RTLD_DEEPBIND portable #135591

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

Conversation

Fabian-Gruenbichler
Copy link
Contributor

the constant is wrong on some platforms (e.g., on mips64el it's 0x10, and 0x8 is RTLD_NOLOAD which makes all this functionality broken), the libc crate takes care of those differences for us.

fallback to old hard-coded value for non-glibc environments (which might or might not have RTLD_DEEPBIND support).

@rustbot
Copy link
Collaborator

rustbot commented Jan 16, 2025

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 16, 2025

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

the constant is wrong on some platforms (e.g., on mips64el it's 0x10, and 0x8
is RTLD_NOLOAD which makes all this functionality broken), the libc crate takes
care of those differences for us.

fallback to old hard-coded value for non-glibc environments (which might or
might not of DEEPBIND support).

Signed-off-by: Fabian Grünbichler <[email protected]>
@Mark-Simulacrum
Copy link
Member

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

Why is this change being proposed here, instead of in rust-analyzer?

r? @bjorn3 since you started reviewing the previous PR (I don't have much context here but it seems like not using a non-declared context is OK, though probably a better comment referencing whether we care is good).

@rustbot rustbot assigned bjorn3 and unassigned Mark-Simulacrum Jan 19, 2025
@Fabian-Gruenbichler
Copy link
Contributor Author

Fabian-Gruenbichler commented Jan 20, 2025

Why is this change being proposed here, instead of in rust-analyzer?

because AFAICT the test cases exercising this only run when built as part of the rustc tree. but if you prefer it coming in the other way, that's fine by me as well :)

@Veykril
Copy link
Member

Veykril commented Jan 20, 2025

The proc-macro server tests do run in the rust-analyzer CI (when relevant source files are changed, as is the case here). Unless you mean some other specific test with relevant.

@Fabian-Gruenbichler
Copy link
Contributor Author

I didn't manage to get them to run locally (except via ./x.py test rust-analyzer), and from the rust-analyzer CI output it seems they don't run there either:

     Running unittests src/lib.rs (target/debug/deps/proc_macro_srv-ce7345e9fe0e53b0)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/main.rs (target/debug/deps/rust_analyzer_proc_macro_srv-bdf12f69c82496e0)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/proc_macro_test-22a583937d8810d1)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

whereas the CI run for this PR:

       Running unittests src/lib.rs (obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/proc_macro_srv-3d134170492b442b)
  
  running 17 tests
  12%  --  2/17,  2 passed, 0 failed, 0 ignored
  24%  --  4/17,  4 passed, 0 failed, 0 ignored
  35%  --  6/17,  6 passed, 0 failed, 0 ignored
  41%  --  7/17,  7 passed, 0 failed, 0 ignored
  53%  --  9/17,  9 passed, 0 failed, 0 ignored
  65%  -- 11/17, 11 passed, 0 failed, 0 ignored
  71%  -- 12/17, 12 passed, 0 failed, 0 ignored
  82%  -- 14/17, 14 passed, 0 failed, 0 ignored
  94%  -- 16/17, 16 passed, 0 failed, 0 ignored
  100% -- 17/17, 17 passed, 0 failed, 0 ignored
  
  
  test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.82ms

@Veykril
Copy link
Member

Veykril commented Jan 20, 2025

They require the nightly toolchain so they only run on r-a CI when proc-macro things change. To run them locally you'll need to pass a feature flag sysroot-abi as otherwise the proc-macro-srv crate is empty.

@Fabian-Gruenbichler
Copy link
Contributor Author

that was the missing piece, thanks :) I will move this over to R-A then!

@Fabian-Gruenbichler
Copy link
Contributor Author

closed in favour of rust-lang/rust-analyzer#18981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants