tweag / clodl

Turn dynamically linked ELF binaries and libraries into self-contained closures.
BSD 3-Clause "New" or "Revised" License
164 stars 6 forks source link

Remove reliance on pie #40

Closed facundominguez closed 3 years ago

facundominguez commented 3 years ago

The existing mechanism that relies on making position independent executables no longer works.

Before this PR, after updating nixpkgs we get

$ nix-shell --pure --run 'bazel run //:clotestbin-cc-pie'
...
INFO: Build completed successfully, 1 total action
/run/user/1000/tmp.nNI0UvUmLI/clodl-top0: error while loading shared libraries: hello-cc-pie: cannot dynamically load position-independent executable

See this SO question for a discussion.

This PR strips the support for pie. We can still build library closures and load them in the JVM. Building binary closures is also possible, but they can't be loaded with dlopen, neither in the JVM.

Also, to keep things simpler binary_closure doesn't accept libraries anymore. Now, it only accepts executables. We probably can recover the old behavior if there is some use case to justify it.

facundominguez commented 3 years ago

The failure in darwin was caused by a bug in the bash scripts which caused them to drop libraries when the install name of a top-level library didn't match its current path.

I think I finished my edits to this PR.