summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/Memory.inc
Commit message (Collapse)AuthorAgeFilesLines
* [Support] Use zx_cache_flush on Fuchsia to flush instruction cachePetr Hosek2018-06-061-1/+10
| | | | | | | | | Fuchsia doesn't use __clear_cache, instead it provide zx_cache_flush system call. Use it to flush instruction cache. Differential Revision: https://reviews.llvm.org/D47753 llvm-svn: 334068
* IWYU for llvm-config.h in llvm, additions.Nico Weber2018-04-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See r331124 for how I made a list of files missing the include. I then ran this Python script: for f in open('filelist.txt'): f = f.strip() fl = open(f).readlines() found = False for i in xrange(len(fl)): p = '#include "llvm/' if not fl[i].startswith(p): continue if fl[i][len(p):] > 'Config': fl.insert(i, '#include "llvm/Config/llvm-config.h"\n') found = True break if not found: print 'not found', f else: open(f, 'w').write(''.join(fl)) and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p` and tried to fix include ordering and whatnot. No intended behavior change. llvm-svn: 331184
* [ARM][AArch64] Workaround ARM/AArch64 peculiarity in clearing icache.Peter Smith2017-11-281-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | Certain ARM implementations treat icache clear instruction as a memory read, and CPU segfaults on trying to clear cache on !PROT_READ page. We workaround this in Memory::protectMappedMemory by adding PROT_READ to affected pages, clearing the cache, and then setting desired protection. This fixes "AllocationTests/MappedMemoryTest.***/3" unit-tests on affected hardware. Reviewers: psmith, zatrazz, kristof.beyls, lhames Reviewed By: lhames Subscribers: llvm-commits, krytarowski, peter.smith, jgreenhalgh, aemerson, rengolin Patch by maxim-kuvrykov! Differential Revision: https://reviews.llvm.org/D40423 llvm-svn: 319166
* [Support] Support NetBSD PaX MPROTECT in sys::Memory.Lang Hames2017-11-161-123/+4
| | | | | | | | | Removes AllocateRWX, setWritable and setExecutable from sys::Memory and standardizes on allocateMappedMemory / protectMappedMemory. The allocateMappedMemory method is updated to request full permissions for memory blocks so that they can be marked executable later. llvm-svn: 318464
* Don't try to use a non-existent header on FreeBSD/mips.John Baldwin2017-10-251-1/+1
| | | | | | | | Reviewers: dim Differential Revision: https://reviews.llvm.org/D38807 llvm-svn: 316581
* Implement AllocateRWX and ReleaseRWX for NetBSDKamil Rytarowski2017-06-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: NetBSD ships with PaX MPROTECT disallowing RWX mappings. There is a solution to bypass this restriction with double mapping RX (code) and RW (data) using mremap(2) MAP_REMAPDUP. The initial mapping must be mmap(2)ed with protection: PROT_MPROTECT(PROT_EXEC). This functionality to bypass PaX MPROTECT appeared in NetBSD-7.99.72. This patch fixes 20 failing tests: - LLVM :: DebugInfo/debuglineinfo-macho.test - LLVM :: DebugInfo/debuglineinfo.test - LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_Mips64r2N64_PIC_relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_N32_relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_N64R6_relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_O32R6_relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/COFF_i386.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/COFF_x86_64.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF-relaxed.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_STT_FILE.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x64-64_PC8_relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x64-64_PIC_relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x86-64_PIC-small-relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x86-64_debug_frame.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/ELF_x86_64_StubBuf.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_empty_ehframe.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_i386_DynNoPIC_relocations.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_i386_eh_frame.s - LLVM :: ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s Sponsored by <The NetBSD Foundation> Reviewers: joerg, lhames Reviewed By: joerg Subscribers: sdardis, llvm-commits, arichardson Differential Revision: https://reviews.llvm.org/D33874 llvm-svn: 305650
* Correct mprotect page boundries to round up end page. Fixes PR30905.Alina Sbirlea2016-11-051-1/+4
| | | | | | | | | | | | | | Summary: Update the boundries for mprotect. Patch by Andrew Adams. Fixes PR30905. Reviewers: loladiro, andrew.w.kaylor, chandlerc Subscribers: abadams, llvm-commits Differential Revision: https://reviews.llvm.org/D26312 llvm-svn: 286032
* Deal with the (historic) MAP_ANONYMOUS vs MAP_ANON directly by using CPPJoerg Sonnenberger2016-09-301-2/+2
| | | | | | to check for the former, don't depend on (dangling) HAVE_MMAP_ANONYMOUS. llvm-svn: 282925
* Retire NEED_DEV_ZERO_FOR_MMAP. It should be needed only on outdatedJoerg Sonnenberger2016-09-301-16/+0
| | | | | | | systems. It wasn't even hooked up in cmake, so problems on such systems would be visible with 3.9 release already. llvm-svn: 282924
* Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; ↵Eugene Zelenko2016-01-261-2/+2
| | | | | | | | other minor fixes. Differential revision: reviews.llvm.org/D16568 llvm-svn: 258831
* [SectionMemoryManager] Make better use of virtual memoryKeno Fischer2015-12-161-2/+3
| | | | | | | | | | | | | | | | | Summary: On Windows, the allocation granularity can be significantly larger than a page (64K), so with many small objects, just clearing the FreeMem list rapidly leaks quite a bit of virtual memory space (if not rss). Fix that by only removing those parts of the FreeMem blocks that overlap pages for which we are applying memory permissions, rather than dropping the FreeMem blocks entirely. Reviewers: lhames Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15202 llvm-svn: 255760
* [JIT/Memory] Fix up semantic of setExecutable().Davide Italiano2015-11-171-4/+1
| | | | | | | | | | setExecutable() should do everything that's needed to make the memory executable on host, i.e. unconditionally set permissions + invalidate instruction cache. llvm-rtdyld will be updated in my next commit. Discusseed with: Lang Hames (as part of D13631). llvm-svn: 253341
* Untabify.NAKAMURA Takumi2015-09-221-3/+2
| | | | llvm-svn: 248264
* [mips] Use __clear_cache builtin instead of cacheflush()Petar Jovanovic2015-01-271-13/+2
| | | | | | | | | Use __clear_cache builtin instead of cacheflush() in Unix Memory::InvalidateInstructionCache(). Differential Revision: http://reviews.llvm.org/D7198 llvm-svn: 227269
* Remove dead code. NFC.Rafael Espindola2014-12-041-2/+2
| | | | | | This interface was added 2 years ago but users never developed. llvm-svn: 223368
* Revert: r211588 - [mips] Use __clear_cache builtin instead of cacheflush() ↵Daniel Sanders2014-06-241-2/+10
| | | | | | | | | | | | in Unix Memory::InvalidateInstructionCache() Buildbot reports a test failure on the llvm-mips-linux builder and blames r211588. Although it doesn't appear in the blamelist, it seems it could also be r211587 (because it's committed to compiler-rt?) since they were tested together. Reverting the most likely suspect (r211588) to confirm one way or the other. llvm-svn: 211594
* [mips] Use __clear_cache builtin instead of cacheflush() in Unix ↵Daniel Sanders2014-06-241-10/+2
| | | | | | | | | | Memory::InvalidateInstructionCache() MIPS64 Android bionic has removed cacheflush(). Use __clear_cache() instead for 32-bit and 64-bit MIPS Patch by Duane Sand <Duane.Sand@imgtec.com> llvm-svn: 211588
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-131-14/+13
| | | | llvm-svn: 210871
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Don't put generic_category in the llvm namespace.Rafael Espindola2014-06-121-5/+5
| | | | llvm-svn: 210737
* Uses generic_category instead of system_category.Rafael Espindola2014-06-111-4/+4
| | | | | | | Some c++ libraries (libstdc++ at least) don't seem to map to the generic category in in the system_category's default_error_condition. llvm-svn: 210635
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-311-5/+5
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209952
* [C++] Use 'nullptr'.Craig Topper2014-04-281-7/+7
| | | | llvm-svn: 207394
* ARM64: initial backend importTim Northover2014-03-291-7/+8
| | | | | | | | | | | | This adds a second implementation of the AArch64 architecture to LLVM, accessible in parallel via the "arm64" triple. The plan over the coming weeks & months is to merge the two into a single backend, during which time thorough code review should naturally occur. Everything will be easier with the target in-tree though, hence this commit. llvm-svn: 205090
* Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."Rafael Espindola2013-07-261-2/+2
| | | | | | This reverts commit r187248. It broke many bots. llvm-svn: 187254
* [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.Bill Schmidt2013-07-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for all PowerPC targets, whether 32- or 64-bit. They will both implicitly define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not for 32-bit targets. We cannot be sure that all other possible compilers used to compile Clang/LLVM define both __ppc__ and __powerpc__, for example, so it is best to check for both when relying on either inside the Clang/LLVM code base. This patch makes sure we always check for both variants. In addition, it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp. (At least one of __ppc__ and __powerpc__ should always be defined when compiling for a PowerPC target, no matter which compiler is used, so testing for them is unnecessary.) There are some places in the compiler that check for other variants, like __POWERPC__ and _POWER, and I have left those in place. There is no need to add them elsewhere. This seems to be in Apple-specific code, and I won't take a chance on breaking it. There is no intended change in behavior; thus, no test cases are added. llvm-svn: 187248
* Remove declaration of __clear_cache for __APPLE__. <rdar://problem/13924072>Bob Wilson2013-05-191-0/+3
| | | | | | | | | | | | | | | This fixes a bootstrapping problem with builds for Apple ARM targets. Clang had the wrong prototype for __clear_cache with ARM targets. Rafael fixed that in clang svn r181784 and r181810, but without those changes, we can't build this code for ARM because clang reports an error about the declaration in Memory.inc not matching the builtin declaration. Some of our buildbots need to use an older compiler that doesn't have the clang fix. Since __clear_cache is never used here when __APPLE__ is defined, I'm just conditionalizing the declaration to match that. I also moved the declaration of sys_icache_invalidate inside the conditional for __APPLE__ while I was at it. llvm-svn: 182223
* Invalidate instruction cache when setting memory to be executable.Tim Northover2013-05-191-0/+3
| | | | | | | | | lli's remote MCJIT code calls setExecutable just prior to running code. In line with Darwin behaviour this seems to be the place to invalidate any caches needed so that relocations can take effect properly. llvm-svn: 182213
* Fix __clear_cache declaration.Rafael Espindola2013-05-141-1/+1
| | | | | | This fixes the build with gcc in gnu++98 and gnu++11 mode. llvm-svn: 181811
* Declare __clear_cache.Rafael Espindola2013-05-141-0/+1
| | | | | | | | GCC declares __clear_cache in the gnu modes (-std=gnu++98, -std=gnu++11), but not in the strict modes (-std=c++98, -std=c++11). This patch declares it and therefore fixes the build when using one of the strict modes. llvm-svn: 181785
* AArch64: use __clear_cache under GCCish environmentsTim Northover2013-05-041-1/+1
| | | | | | | | | AArch64 is going to need some kind of cache-invalidation in order to successfully JIT since it has a weak memory-model. This is provided by a __clear_cache builtin in libgcc, which acts very much like the 32-bit ARM equivalent (on platforms where it exists). llvm-svn: 181129
* Android uses cacheflush(long start, long end, long flags) for MIPS.Akira Hatanaka2013-03-141-0/+9
| | | | | | Patch by Stephen Hines. llvm-svn: 177101
* Add comment in Memory.inc explaining r175646.Krzysztof Parzyszek2013-02-201-0/+7
| | | | llvm-svn: 175650
* On PowerPC, the cache-flush instructions dcbf and icbi are treated asKrzysztof Parzyszek2013-02-201-0/+4
| | | | | | | loads. On FreeBSD, add PROT_READ page protection flag before flushing cache. llvm-svn: 175646
* Go ahead and get rid of the old page size interface and convert all theChandler Carruth2012-12-311-8/+8
| | | | | | | users over to the new one. No sense maintaining this "compatibility" layer it seems. llvm-svn: 171331
* This patch adds memory support functions which will later be used to ↵Andrew Kaylor2012-09-191-12/+186
| | | | | | implement section-specific protection handling in MCJIT. llvm-svn: 164249
* Add support for finding cacheflush on OpenBSD/mips64 platforms.Chandler Carruth2012-09-111-0/+8
| | | | | | Patch by Brad Smith! llvm-svn: 163584
* setExecutable() should default to success if there's nothing custom for it.Jim Grosbach2011-03-181-1/+1
| | | | llvm-svn: 127891
* Merge System into Support.Michael J. Spencer2010-11-291-0/+151
llvm-svn: 120298
OpenPOWER on IntegriCloud