llvm-project/llvm/lib
Adhemerval Zanella dad55c2218 [ARM] [ELF] Fix ARMMaterializeGV for Indirect calls
Recent shouldAssumeDSOLocal changes (introduced by 961f31d8ad)
do not take in consideration the relocation model anymore.  The ARM
fast-isel pass uses the function return to set whether a global symbol
is loaded indirectly or not, and without the expected information
llvm now generates an extra load for following code:

```
$ cat test.ll
@__asan_option_detect_stack_use_after_return = external global i32
define dso_local i32 @main(i32 %argc, i8** %argv) #0 {
entry:
  %0 = load i32, i32* @__asan_option_detect_stack_use_after_return,
align 4
  %1 = icmp ne i32 %0, 0
  br i1 %1, label %2, label %3

2:
  ret i32 0

3:
  ret i32 1
}

attributes #0 = { noinline optnone }

$ lcc test.ll -o -
[...]
main:
        .fnstart
[...]
        movw    r0, :lower16:__asan_option_detect_stack_use_after_return
        movt    r0, :upper16:__asan_option_detect_stack_use_after_return
        ldr     r0, [r0]
        ldr     r0, [r0]
        cmp     r0, #0
[...]
```

And without 'optnone' it produces:
```
[...]
main:
        .fnstart
[...]
        movw    r0, :lower16:__asan_option_detect_stack_use_after_return
        movt    r0, :upper16:__asan_option_detect_stack_use_after_return
        ldr     r0, [r0]
        clz     r0, r0
        lsr     r0, r0, #5
        bx      lr

[...]
```

This triggered a lot of invalid memory access in sanitizers for
arm-linux-gnueabihf.  I checked this patch both a stage1 built with
gcc and a stage2 bootstrap and it fixes all the Linux sanitizers
issues.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D95379
2021-01-26 15:57:55 -03:00
..
Analysis [InlineAdvisor] Allow replay of inline decisions for the CGSCC inliner from optimization remarks 2021-01-25 15:38:57 -08:00
AsmParser [X86] Add x86_amx type for intel AMX. 2020-12-30 13:52:13 +08:00
BinaryFormat [Debuginfo][DW_OP_implicit_pointer] (1/7) Support for DW_OP_LLVM_implicit_pointer 2021-01-15 14:45:04 +05:30
Bitcode [llvm] Use pop_back_val (NFC) 2021-01-24 12:18:57 -08:00
Bitstream [llvm] Use llvm::append_range (NFC) 2021-01-06 18:27:33 -08:00
CodeGen [NFC] Refine some uninitialized used variables. 2021-01-26 16:51:05 +08:00
DWARFLinker [llvm] Use pop_back_val (NFC) 2021-01-24 12:18:57 -08:00
DebugInfo [llvm] Use pop_back_val (NFC) 2021-01-24 12:18:57 -08:00
Demangle [llvm] Remove redundant return and continue statements (NFC) 2021-01-14 20:30:34 -08:00
ExecutionEngine [ORC] Attempt to auto-claim responsibility for weak defs in ObjectLinkingLayer. 2021-01-27 00:09:40 +11:00
Extensions llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
FileCheck [llvm] Use llvm::sort (NFC) 2021-01-17 10:39:45 -08:00
Frontend [OpenMPIRBuilder] Silence compiler warning. NFC. 2021-01-23 21:00:37 -06:00
FuzzMutate [FuzzMutate] Add mutator to modify instruction flags. 2021-01-23 19:05:20 +00:00
Fuzzer
IR Revert "[ObjC][ARC] Annotate calls with attributes instead of emitting retainRV" 2021-01-25 13:53:38 -08:00
IRReader static const char *const foo => const char foo[] 2020-12-01 10:33:18 -08:00
InterfaceStub [llvm-elfabi] Add flag to preserve timestamp when output is the same 2020-12-29 20:27:06 -08:00
LTO [LTO] Move DisableVerify setting to LTOCodeGenerator class (NFC). 2021-01-24 14:14:40 +00:00
LineEditor llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
Linker [llvm-link] Fix for an assertion when linking global with appending linkage 2021-01-23 00:10:42 -08:00
MC Revert "[WebAssembly] MC layer writes table symbols to object files" 2021-01-25 22:32:36 -08:00
MCA [llvm] Use llvm::find (NFC) 2021-01-19 20:19:14 -08:00
Object [Object][WebAssembly] Update format of error messages 2021-01-25 21:12:53 -08:00
ObjectYAML [yaml2obj][obj2yaml] - Improve how we set/dump the sh_entsize field. 2021-01-26 13:33:02 +03:00
Option [llvm] Simplify string comparisons (NFC) 2021-01-11 18:48:09 -08:00
Passes [LoopRotate] Add PrepareForLTO stage, avoid rotating with inline cands. 2021-01-19 10:15:29 +00:00
ProfileData [llvm] Use isDigit (NFC) 2021-01-21 19:59:50 -08:00
Remarks llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
Support [AMDGPU] HSAMD::fromString - replace std::string arg with StringRef. NFCI. 2021-01-26 16:09:39 +00:00
TableGen [llvm] Use pop_back_val (NFC) 2021-01-24 12:18:57 -08:00
Target [ARM] [ELF] Fix ARMMaterializeGV for Indirect calls 2021-01-26 15:57:55 -03:00
Testing [llvm][NFC] Remove unnecessary vector creation in Annotations 2020-11-14 15:55:09 +00:00
TextAPI [llvm] Use llvm::sort (NFC) 2021-01-17 10:39:45 -08:00
ToolDrivers llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
Transforms [LoopUtils] do not initialize Cmp predicate unnecessarily; NFC 2021-01-26 11:22:51 -05:00
WindowsManifest llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
XRay [lib/Object, tools] - Make ELFObjectFile::getELFFile return reference. 2020-12-04 16:02:29 +03:00
CMakeLists.txt llvmbuildectomy - support disabled native target 2020-11-13 15:50:13 +01:00