diff options
author | James Zern <jzern@google.com> | 2023-05-12 19:23:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-05-12 19:23:47 +0000 |
commit | 8adf1be644e897440b05539fdeddc9341290ae3e (patch) | |
tree | f010adee8057bd8510d1b6423e366bd9774c9589 | |
parent | 9e0fc37f6f68685066f3e71e1cd0605d6ee2205e (diff) | |
parent | 2a9b810d3df62ff3c527ce3895f6b80d9d6f6296 (diff) | |
download | libvpx-8adf1be644e897440b05539fdeddc9341290ae3e.tar.gz |
Merge "Don't use -Wl,-z,defs with Clang's sanitizers" into main
-rw-r--r-- | build/make/Makefile | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/build/make/Makefile b/build/make/Makefile index 5c38c18e5..65ac2290c 100644 --- a/build/make/Makefile +++ b/build/make/Makefile @@ -304,6 +304,19 @@ $(1): $(qexec)$$(AR) $$(ARFLAGS) $$@ $$^ endef +# Don't use -Wl,-z,defs with Clang's sanitizers. +# +# Clang's AddressSanitizer documentation says "When linking shared libraries, +# the AddressSanitizer run-time is not linked, so -Wl,-z,defs may cause link +# errors (don't use it with AddressSanitizer)." See +# https://clang.llvm.org/docs/AddressSanitizer.html#usage. +NO_UNDEFINED := -Wl,-z,defs +ifeq ($(findstring clang,$(CC)),clang) + ifneq ($(filter -fsanitize=%,$(LDFLAGS)),) + NO_UNDEFINED := + endif +endif + define so_template # Not using a pattern rule here because we don't want to generate empty # archives when they are listed as a dependency in files not responsible @@ -313,7 +326,8 @@ define so_template $(1): $(if $(quiet),@echo " [LD] $$@") $(qexec)$$(LD) -shared $$(LDFLAGS) \ - -Wl,--no-undefined -Wl,-soname,$$(SONAME) \ + $(NO_UNDEFINED) \ + -Wl,-soname,$$(SONAME) \ -Wl,--version-script,$$(EXPORTS_FILE) -o $$@ \ $$(filter %.o,$$^) $$(extralibs) endef |