From 4a7c4c76e06b6f2e5a8eef4dc7eb0d93d2754755 Mon Sep 17 00:00:00 2001 From: Roland McGrath <mcgrathr@google.com> Date: Mon, 13 May 2019 21:01:33 +0000 Subject: [PATCH] [libc] Make sure libc doesn't link against libc++ Bug: ZX-4099 #done Change-Id: I23e6d4b163ddc8616a22decc2029424888305cdf --- zircon/system/ulib/c/BUILD.gn | 3 +++ zircon/third_party/lib/cortex-strings/README.fuchsia | 1 + .../third_party/lib/cortex-strings/src/aarch64/memmove.S | 9 ++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/zircon/system/ulib/c/BUILD.gn b/zircon/system/ulib/c/BUILD.gn index 4b50f98be28..252447012c1 100644 --- a/zircon/system/ulib/c/BUILD.gn +++ b/zircon/system/ulib/c/BUILD.gn @@ -25,6 +25,9 @@ library("c") { # Suppress the ${toolchain.implicit_deps} that points back to here. no_implicit_deps = true + # Don't link against the shared libc++. + configs += [ "$zx/public/gn/config:static-libc++" ] + # TODO(BLD-353): temporary kludges; see //zircon/public/sysroot metadata = { legacy_sysroot = [ diff --git a/zircon/third_party/lib/cortex-strings/README.fuchsia b/zircon/third_party/lib/cortex-strings/README.fuchsia index 9934c6eba1e..2b9a99f3987 100644 --- a/zircon/third_party/lib/cortex-strings/README.fuchsia +++ b/zircon/third_party/lib/cortex-strings/README.fuchsia @@ -13,3 +13,4 @@ Modifications: - The no-neon directory is taken from an earlier revision of the same repo: bc654e7a594385071b42db3c9c94bd0fd5fe0da5 It contains only a subset of src/aarch64 from that revision. +- Added ".Lmemcpy" branch veneer to src/aarch64/memmove.S diff --git a/zircon/third_party/lib/cortex-strings/src/aarch64/memmove.S b/zircon/third_party/lib/cortex-strings/src/aarch64/memmove.S index c9fe6c1f571..9a3fc8e08b5 100644 --- a/zircon/third_party/lib/cortex-strings/src/aarch64/memmove.S +++ b/zircon/third_party/lib/cortex-strings/src/aarch64/memmove.S @@ -93,7 +93,11 @@ def_fn memmove, 6 sub tmp1, dstin, src cmp count, 96 ccmp tmp1, count, 2, hi - b.hs memcpy + // The linker doesn't generate a veneer for a conditional branch + // whose target is too far away, so we need to use our own "veneer". + // Unfortunately that introduces the extra jump even when the + // distance would allow removing it, because only the linker knows. + b.hs .Lmemcpy cbz tmp1, 3f add dstend, dstin, count @@ -147,4 +151,7 @@ def_fn memmove, 6 stp C_l, C_h, [dstin] 3: ret +.Lmemcpy: + b memcpy + .size memmove, . - memmove -- GitLab