Add missing linker flags for memtag sanitizers.
This fixes a discrepancy between Make and Soong build systems. Memtag sanitizers rely on the linker to mark the executable as requesting heap/stack/globals tagging. Test: readelf -n <binary> | grep .note.android.memtag Bug: 322107634 Change-Id: I4a25509ff280e25d14576157903a2bbf162a4895
This commit is contained in:
@@ -261,10 +261,10 @@ endif
|
||||
|
||||
ifneq ($(filter memtag_heap memtag_stack memtag_globals,$(my_sanitize)),)
|
||||
ifneq ($(filter memtag_heap,$(my_sanitize_diag)),)
|
||||
my_cflags += -fsanitize-memtag-mode=sync
|
||||
my_ldflags += -fsanitize-memtag-mode=sync
|
||||
my_sanitize_diag := $(filter-out memtag_heap,$(my_sanitize_diag))
|
||||
else
|
||||
my_cflags += -fsanitize-memtag-mode=async
|
||||
my_ldflags += -fsanitize-memtag-mode=async
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -277,11 +277,13 @@ endif
|
||||
|
||||
ifneq ($(filter memtag_heap,$(my_sanitize)),)
|
||||
my_cflags += -fsanitize=memtag-heap
|
||||
my_ldflags += -fsanitize=memtag-heap
|
||||
my_sanitize := $(filter-out memtag_heap,$(my_sanitize))
|
||||
endif
|
||||
|
||||
ifneq ($(filter memtag_stack,$(my_sanitize)),)
|
||||
my_cflags += -fsanitize=memtag-stack
|
||||
my_ldflags += -fsanitize=memtag-stack
|
||||
my_cflags += -march=armv8a+memtag
|
||||
my_ldflags += -march=armv8a+memtag
|
||||
my_asflags += -march=armv8a+memtag
|
||||
@@ -290,6 +292,7 @@ endif
|
||||
|
||||
ifneq ($(filter memtag_globals,$(my_sanitize)),)
|
||||
my_cflags += -fsanitize=memtag-globals
|
||||
my_ldflags += -fsanitize=memtag-globals
|
||||
# TODO(mitchp): For now, enable memtag-heap with memtag-globals because the
|
||||
# linker isn't new enough
|
||||
# (https://reviews.llvm.org/differential/changeset/?ref=4243566).
|
||||
|
Reference in New Issue
Block a user