Commit 4d19e45
committed
unix: link libpython with
This changes the runtime loader lookup semantics for libpython so
function references are resolved in the local library first.
* May improve startup time by eliding symbol lookups in the executable
and other libraries.
* Prevents symbols provided by libpython from resolving to other loaded
libraries.
* Enables additional compiler+linker optimizations by guaranteeing that
libpython symbols resolve to the local library. (e.g. more aggressive
inlining across translations units.)
I believe this change is safe since we're already disabling semantic
interposition and PGO+LTO+BOLT result in substantial inlining.
However, this change can break `LD_PRELOAD` where a separate DSO providing
libpython symbols is injected at the front of the loader search path.
In this scenario, the libpython symbol will be used instead of the variant
injected via `LD_PRELOAD`. I'm unsure if any popular software (that isn't
malware) is relying on intercepting libpython symbols via `LD_PRELOAD`. But
because of our aggressive build optimizations, various functions would have
been inlined and wouldn't have been `LD_PRELOAD` interceptable anyway since
the PLT was already elided. So this change effectively finishes the
"migration" of making `LD_PRELOAD` unreliable.-Bsymbolic-functions
1 parent 517bea8 commit 4d19e45
3 files changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
197 | 213 | | |
198 | 214 | | |
199 | 215 | | |
| |||
0 commit comments