1
Fork 0

use newer arm64 glibc explicitly

This commit is contained in:
Motiejus Jakštys 2021-08-06 09:49:52 +03:00
parent 50c5e58dcd
commit 5f5b25d34b
2 changed files with 11 additions and 19 deletions

View File

@ -15,12 +15,6 @@ tasks:
grep -q "ELF 64-bit.* x86-64.* dynamically linked" grep -q "ELF 64-bit.* x86-64.* dynamically linked"
- test_amd64-linux-gnu: | - test_amd64-linux-gnu: |
cd bazel-zig-cc; . .envrc; ./build-and-file \ cd bazel-zig-cc; . .envrc; ./build-and-file \
--extra_toolchains @zig_sdk//:linux_amd64_gnu_toolchain \
--platforms @io_bazel_rules_go//go/toolchain:linux_amd64_cgo //test:hello | \
grep -q "ELF 64-bit.* x86-64.* dynamically linked"
- test_amd64-linux-gnu-2_19: |
cd bazel-zig-cc; . .envrc; ./build-and-file \
--extra_toolchains @zig_sdk//:linux_amd64_gnu.2.19_toolchain \
--platforms @io_bazel_rules_go//go/toolchain:linux_amd64_cgo //test:hello | \ --platforms @io_bazel_rules_go//go/toolchain:linux_amd64_cgo //test:hello | \
grep -q "ELF 64-bit.* x86-64.* dynamically linked" grep -q "ELF 64-bit.* x86-64.* dynamically linked"
- test_amd64-linux-musl: | - test_amd64-linux-musl: |

View File

@ -57,8 +57,9 @@ _GLIBCS = [
] ]
DEFAULT_TOOLCHAINS = [ DEFAULT_TOOLCHAINS = [
"linux_arm64_gnu.2.28", # Cannot apply fcntl64 hack for older versions. "linux_arm64_gnu.2.19", # Debian Jessie arm64
"linux_amd64_gnu.2.19", # Debian Jessie #"linux_amd64_gnu.2.19", # there is a problem with fcntl on arm64, this is WIP
"linux_amd64_gnu.2.28", # there is a problem with fcntl on arm64, this is WIP
"darwin_amd64", "darwin_amd64",
"darwin_arm64", "darwin_arm64",
] ]
@ -92,18 +93,15 @@ def _target_linux_gnu(gocpu, zigcpu, glibc_version = ""):
# fcntl_hack is only required for glibc 2.27 or less. We assume that # fcntl_hack is only required for glibc 2.27 or less. We assume that
# glibc_version == "" (autodetect) is running a recent glibc version, thus # glibc_version == "" (autodetect) is running a recent glibc version, thus
# adding this hack only when glibc is explicitly 2.27 or lower. # adding this hack only when glibc is explicitly 2.27 or lower.
# __asm__ directive does not work on aarch64 (for some reasons unknown to
# me), so the hack applies to x86_64 only.
fcntl_hack = False fcntl_hack = False
if zigcpu == "x86_64": if glibc_version == "":
if glibc_version == "": # zig doesn't reliably detect the glibc version, so
# zig doesn't reliably detect the glibc version, so # often falls back to 2.17; the hack should be included.
# often falls back to 2.17; the hack should be included. # https://github.com/ziglang/zig/issues/6469
# https://github.com/ziglang/zig/issues/6469 fcntl_hack = True
fcntl_hack = True else:
else: # hack is required for 2.27 or less.
# we know the version; hack is required for 2.27 or less. fcntl_hack = glibc_version < "2.28"
fcntl_hack = glibc_version < "2.28"
return struct( return struct(
gotarget = "linux_{}_{}".format(gocpu, glibc_suffix), gotarget = "linux_{}_{}".format(gocpu, glibc_suffix),