~motumedia/libav/master

« back to all changes in this revision

Viewing changes to libavutil/aarch64/asm.S

  • Committer: Martin Storsjö
  • Author(s): Peter Collingbourne
  • Date: 2019-08-21 19:31:27 UTC
  • Revision ID: git-v1:e5afa1b556542fd7a52a0a9b409c80f2e6e1e9bb
aarch64: 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>
Signed-off-by: Martin Storsjö <martin@martin.st>

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#   define FUNC #
33
33
#endif
34
34
 
 
35
#ifndef __has_feature
 
36
#   define __has_feature(x) 0
 
37
#endif
 
38
 
35
39
.macro  function name, export=0, align=2
36
40
    .macro endfunc
37
41
ELF     .size   \name, . - \name
94
98
        add             \rd, \rd, :lo12:\val+(\offset)
95
99
    .endif
96
100
#elif CONFIG_PIC
 
101
#   if __has_feature(hwaddress_sanitizer)
 
102
        adrp            \rd, :pg_hi21_nc:\val+(\offset)
 
103
#   else
97
104
        adrp            \rd, \val+(\offset)
 
105
#   endif
98
106
        add             \rd, \rd, :lo12:\val+(\offset)
99
107
#else
100
108
        ldr             \rd, =\val+\offset