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

pass -Wl,-z,origin to set DF_ORIGIN when using rpath #91858

Merged
merged 1 commit into from
Dec 18, 2021

Conversation

semarie
Copy link
Contributor

@semarie semarie commented Dec 13, 2021

DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string.

Some implementations are just ignoring DF_ORIGIN and do substitution for $ORIGIN if present (whatever DF_ORIGIN presence or not) like glibc. But some others mandate the present of DF_ORIGIN for the substitution (like OpenBSD).

Set the flag inconditionally if rpath is wanted.

One possible fallout is if the linker rejects -z origin option.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 13, 2021
@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 13, 2021
@rust-log-analyzer

This comment has been minimized.

@semarie
Copy link
Contributor Author

semarie commented Dec 13, 2021

After some tests, FreeBSD and DragonFlyBSD requires DF_ORIGIN to properly do subtitution too.
NetBSD is ignoring the flag as Linux.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 16, 2021

📌 Commit 8ae5780 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 16, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 16, 2021
pass -Wl,-z,origin to set DF_ORIGIN when using rpath

DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string.

Some implementations are just ignoring [DF_ORIGIN](http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#df_flags) and do [substitution](http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#substitution) for $ORIGIN if present (whatever DF_ORIGIN presence or not) like glibc. But some others mandate the present of DF_ORIGIN for the substitution (like OpenBSD).

Set the flag inconditionally if rpath is wanted.

One possible fallout is if the linker rejects `-z origin` option.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 17, 2021
pass -Wl,-z,origin to set DF_ORIGIN when using rpath

DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string.

Some implementations are just ignoring [DF_ORIGIN](http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#df_flags) and do [substitution](http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#substitution) for $ORIGIN if present (whatever DF_ORIGIN presence or not) like glibc. But some others mandate the present of DF_ORIGIN for the substitution (like OpenBSD).

Set the flag inconditionally if rpath is wanted.

One possible fallout is if the linker rejects `-z origin` option.
@semarie
Copy link
Contributor Author

semarie commented Dec 17, 2021

@petrochenkov could you r- please ? it seems that apple linker doesn't like the -z option. I will rework the PR.

@matthiaskrgr
Copy link
Member

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 17, 2021
DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string.

Some implementations are just ignoring DF_ORIGIN and do substitution for $ORIGIN if present (whatever DF_ORIGIN pr

Set the flag inconditionally if rpath is wanted.
@semarie
Copy link
Contributor Author

semarie commented Dec 17, 2021

in codegen_ssa, I moved the flag addition to linker_is_gnu case. it should be fine now regarding windows or apple.

but I think a rollup=never might be preferable (even if it means more long time before merge)

@petrochenkov
Copy link
Contributor

@bors r+ rollup=iffy

@bors
Copy link
Contributor

bors commented Dec 17, 2021

📌 Commit c3da28e has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 17, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 18, 2021
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#91858 (pass -Wl,-z,origin to set DF_ORIGIN when using rpath)
 - rust-lang#91923 (Remove `in_band_lifetimes` from `rustc_query_impl`)
 - rust-lang#91925 (Remove `in_band_lifetimes` from `rustc_privacy`)
 - rust-lang#91977 (Clean up search code and unify function returned values)
 - rust-lang#92018 (Fix typo in "new region bound" suggestion)
 - rust-lang#92022 (Eliminate duplicate codes of expected_found_bool)
 - rust-lang#92032 (hir: Do not introduce dummy type names for `extern` blocks in def paths)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 069ffec into rust-lang:master Dec 18, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 18, 2021
@semarie semarie deleted the runpath branch December 18, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants