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
cc-wrapper: More intelligent sierra hack #29096
cc-wrapper: More intelligent sierra hack #29096
Conversation
@@ -2,67 +2,113 @@ | |||
|
|||
set -eu -o pipefail | |||
|
|||
# For cmd | while; read; do ...; done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed for the block after the pipe (the while
loop here) to set Bash variables. Otherwise it runs in a subshell and the variables it sets are not visible outside that block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking about the comment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't have though of this reason without the comment, so it was useful for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's not clear to my lastpipe is always an improvement, unlike the other extensions I used, so I wanted to motivate it.
I should remove the extra semicolon, however :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed!
bc87860
to
ff214ff
Compare
Patch is drawn from [1], a back-port of [2]. Eventually, we might consider doing something for GNU binutils too, in order that we switch (the normal) ld-wrapper to always use this to leverage ld to resolve libraries, rather than faking it in bash. [1]: https://github.com/obsidiansystems/cctools-port/tree/libs-normalize-17.03 [2]: tpoechtrager/cctools-port#34
86316fb
to
ba053dc
Compare
Also fix numberous bugs, such as: - Not getting confused on more flags taking file arguments. - Ensuring children reexport their children, but the original binary/library doesn't. - Not spawning children when it turns out we just dynamically link under the threshold but our total number of inputs exceeeds it. - Children were always named `libunnamed-*`, when that name was supposed to be the last resort only. In addition to the script, we also patch ld-wrapper to respect `.dylib` and `.so` alike. In a future version of nixpkgs, this can be so enabled by defaut. Newer nixpkgs will probably do this by default.
ba053dc
to
c5b655a
Compare
Ok! I tested this on a big haskell project ;) and with my existing C test. It passes! |
Motivation for this change
I made a patch for cctool's ld in order to get it to split out flags for all inputs in a fully-resolved normal form. I use this to avoid trying to
-reexport-l
static libraries. Linking them directly will reexport them just fine.@TaktInc needs this for 17.03, so I'm starting here and then forward porting to master (and probably
17.09
if all goes well).The patch itself uses
\0
as a delimiter, but perhapsexpandResponseParams
could be used to parse a more human readable output. I just bring this up if it would help upstream the patch.N.B. as I mentioned in #24844 (comment), if we likewise patch GNU Binutils, we can dramatically simplify ld-wrapper (with and without the sierra hack) by not trying to resolve linker scripts on our own.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)CC @orivej