mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-21 09:46:49 +00:00
[clang][cmake] Fix support for dynamic libraries in CLANG_BOLT
Simpler detection of dynamic library operands as the readelf one seems to be unreliable (works on my setup, not on buildbots). This is a follow-up to #127020
This commit is contained in:
parent
86fc248ff6
commit
f3d4d11547
@ -628,15 +628,14 @@ def bolt_optimize(args):
|
||||
sys.stdout.write(line)
|
||||
process.check_returncode()
|
||||
|
||||
output = subprocess.check_output(
|
||||
[opts.readelf, "--file-header", input], universal_newlines=True
|
||||
)
|
||||
if re.search(r"Type:\s*((Shared)|(DYN))", output):
|
||||
# force using the instrumented version
|
||||
# Shared library must be preloaded to be covered.
|
||||
if ".so" in input:
|
||||
preloads.append(instrumented_output)
|
||||
|
||||
if preloads:
|
||||
print("Patching execution environment for dynamic library")
|
||||
print(
|
||||
f"Patching execution environment for dynamic libraries: {' '.join(preloads)}"
|
||||
)
|
||||
environ["LD_PRELOAD"] = os.pathsep.join(preloads)
|
||||
|
||||
args = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user