Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc-at-google.com@ffmpeg.org>2019-08-21 21:55:25 +0300
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-08-22 12:22:07 +0300
commit9bcb1cb6ed50e66e0489beb871eed83533b3de97 (patch)
tree503f7d90ff784af838a56a93ecd6ce0a17a89be3 /libavutil/aarch64/asm.S
parentc87237d10511a28a3cfb7bb88ed2af1907dc8f66 (diff)
Add assembly support for -fsanitize=hwaddress tagged globals.
As of LLVM r368102, Clang will set a pointer tag in bits 56-63 of the address of a global when compiling with -fsanitize=hwaddress. This requires an adjustment to assembly code that takes the address of such globals: the code cannot use the regular R_AARCH64_ADR_PREL_PG_HI21 relocation to refer to the global, since the tag would take the address out of range. Instead, the code must use the non-checking (_NC) variant of the relocation (the link-time check is substituted by a runtime check). This change makes the necessary adjustment in the movrel macro, where it is needed when compiling with -fsanitize=hwaddress. Signed-off-by: Peter Collingbourne <pcc@google.com> Reviewed-by: Martin Storsjö Reviewed-by: Janne Grunau
Diffstat (limited to 'libavutil/aarch64/asm.S')
-rw-r--r--libavutil/aarch64/asm.S8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/aarch64/asm.S b/libavutil/aarch64/asm.S
index 5c329430fd..3ac2ba0d52 100644
--- a/libavutil/aarch64/asm.S
+++ b/libavutil/aarch64/asm.S
@@ -32,6 +32,10 @@
# define FUNC #
#endif
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+
.macro function name, export=0, align=2
.macro endfunc
ELF .size \name, . - \name
@@ -94,7 +98,11 @@ ELF .size \name, . - \name
add \rd, \rd, :lo12:\val+(\offset)
.endif
#elif CONFIG_PIC
+# if __has_feature(hwaddress_sanitizer)
+ adrp \rd, :pg_hi21_nc:\val+(\offset)
+# else
adrp \rd, \val+(\offset)
+# endif
add \rd, \rd, :lo12:\val+(\offset)
#else
ldr \rd, =\val+\offset