diff options
author | spreis <spreis@yandex-team.com> | 2024-08-05 06:25:11 +0300 |
---|---|---|
committer | spreis <spreis@yandex-team.com> | 2024-08-05 06:45:37 +0300 |
commit | bce53150cdcc96594c071350dc134be6f81c22eb (patch) | |
tree | 5b8e8954f5cd19ca49be7d0513dd9b37c9718d90 /build/scripts/go_tool.py | |
parent | 7569dda284b7c987f215fe1556e76e7a76fa585d (diff) | |
download | ydb-bce53150cdcc96594c071350dc134be6f81c22eb.tar.gz |
Let go properly link binries in PIC mode
81668e85a416903e82cfa2a2223680f04a3343c7
Diffstat (limited to 'build/scripts/go_tool.py')
-rw-r--r-- | build/scripts/go_tool.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/build/scripts/go_tool.py b/build/scripts/go_tool.py index 0d1dd78b2b..f11b3b82df 100644 --- a/build/scripts/go_tool.py +++ b/build/scripts/go_tool.py @@ -497,9 +497,14 @@ def do_link_exe(args): if args.buildmode: cmd.append('-buildmode={}'.format(args.buildmode)) elif args.mode in ('exe', 'test'): - cmd.append('-buildmode=exe') + mode = '-buildmode=exe' if 'ld.lld' in str(args): - extldflags.append('-Wl,-no-pie') + if '-fPIE' in str(args) or '-fPIC' in str(args): + # support explicit PIE + mode = '-buildmode=pie' + else: + extldflags.append('-Wl,-no-pie') + cmd.append(mode) elif args.mode == 'dll': cmd.append('-buildmode=c-shared') else: |