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

linker: Add a linker rerun hack for gcc versions not supporting -static-pie #72708

Merged
merged 1 commit into from
Jun 7, 2020

Conversation

petrochenkov
Copy link
Contributor

Which mirrors the existing -no-pie linker rerun hack, but the logic is a bit more elaborated in this case.

If the linker (gcc or clang) errors on -static-pie we rerun in with -static instead.
We must also replace CRT objects corresponding to -static-pie with ones corresponding to -static in this case.

(One sanity check for CRT objects in target specs is also added as a drive-by fix.)

To do in the future: refactor all linker rerun hacks into separate functions and share more code with add_(pre,post)_link_objects.

This PR accompanies #71804 and unblocks #70740.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(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 May 28, 2020
@petrochenkov
Copy link
Contributor Author

r? @cuviper

@haraldh
Copy link
Contributor

haraldh commented May 28, 2020

What about:

    cmd.env_remove("LANG");
    cmd.env_remove("LC_MESSAGES");
    cmd.env_remove("LC_ALL");

to ensure non-localized error messages?
#70740 (comment)

... sorry.. didn't see

linker::disable_localization(&mut cmd);

@cuviper
Copy link
Member

cuviper commented Jun 1, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jun 1, 2020

📌 Commit 071f042 has been approved by cuviper

@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 Jun 1, 2020
@bors
Copy link
Contributor

bors commented Jun 4, 2020

⌛ Testing commit 071f042 with merge a7f7469ecbb747fe8bd78de5cf3b38d7e01d0a65...

@Dylan-DPC-zz
Copy link

@bors retry yield

RalfJung added a commit to RalfJung/rust that referenced this pull request Jun 6, 2020
linker: Add a linker rerun hack for gcc versions not supporting -static-pie

Which mirrors the existing `-no-pie` linker rerun hack, but the logic is a bit more elaborated in this case.

If the linker (gcc or clang) errors on `-static-pie` we rerun in with `-static` instead.
We must also replace CRT objects corresponding to `-static-pie` with ones corresponding to `-static` in this case.

(One sanity check for CRT objects in target specs is also added as a drive-by fix.)

To do in the future: refactor all linker rerun hacks into separate functions and share more code with `add_(pre,post)_link_objects`.

This PR accompanies rust-lang#71804 and unblocks rust-lang#70740.
RalfJung added a commit to RalfJung/rust that referenced this pull request Jun 6, 2020
linker: Add a linker rerun hack for gcc versions not supporting -static-pie

Which mirrors the existing `-no-pie` linker rerun hack, but the logic is a bit more elaborated in this case.

If the linker (gcc or clang) errors on `-static-pie` we rerun in with `-static` instead.
We must also replace CRT objects corresponding to `-static-pie` with ones corresponding to `-static` in this case.

(One sanity check for CRT objects in target specs is also added as a drive-by fix.)

To do in the future: refactor all linker rerun hacks into separate functions and share more code with `add_(pre,post)_link_objects`.

This PR accompanies rust-lang#71804 and unblocks rust-lang#70740.
RalfJung added a commit to RalfJung/rust that referenced this pull request Jun 6, 2020
linker: Add a linker rerun hack for gcc versions not supporting -static-pie

Which mirrors the existing `-no-pie` linker rerun hack, but the logic is a bit more elaborated in this case.

If the linker (gcc or clang) errors on `-static-pie` we rerun in with `-static` instead.
We must also replace CRT objects corresponding to `-static-pie` with ones corresponding to `-static` in this case.

(One sanity check for CRT objects in target specs is also added as a drive-by fix.)

To do in the future: refactor all linker rerun hacks into separate functions and share more code with `add_(pre,post)_link_objects`.

This PR accompanies rust-lang#71804 and unblocks rust-lang#70740.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 6, 2020
Rollup of 3 pull requests

Successful merges:

 - rust-lang#71796 (de-promote Duration::from_secs)
 - rust-lang#72508 (Make `PolyTraitRef::self_ty` return `Binder<Ty>`)
 - rust-lang#72708 (linker: Add a linker rerun hack for gcc versions not supporting -static-pie)

Failed merges:

r? @ghost
@bors bors merged commit d112d8b into rust-lang:master Jun 7, 2020
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants