summaryrefslogtreecommitdiff
path: root/include/linux/compiler-clang.h (follow)
Commit message (Collapse)AuthorAge
* UPSTREAM: compiler, clang: always inline when CONFIG_OPTIMIZE_INLINING is ↵David Rientjes2017-10-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | disabled The motivation for commit abb2ea7dfd82 ("compiler, clang: suppress warning for unused static inline functions") was to suppress clang's warnings about unused static inline functions. For configs without CONFIG_OPTIMIZE_INLINING enabled, such as any non-x86 architecture, `inline' in the kernel implies that __attribute__((always_inline)) is used. Some code depends on that behavior, see https://lkml.org/lkml/2017/6/13/918: net/built-in.o: In function `__xchg_mb': arch/arm64/include/asm/cmpxchg.h:99: undefined reference to `__compiletime_assert_99' arch/arm64/include/asm/cmpxchg.h:99: undefined reference to `__compiletime_assert_99 The full fix would be to identify these breakages and annotate the functions with __always_inline instead of `inline'. But since we are late in the 4.12-rc cycle, simply carry forward the forced inlining behavior and work toward moving arm64, and other architectures, toward CONFIG_OPTIMIZE_INLINING behavior. (cherry picked from commit 9a04dbcfb33b4012d0ce8c0282f1e3ca694675b1) Change-Id: I13891c2f1e588d8c7febe5d2d57134abb31d6ecd Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1706261552200.1075@chino.kir.corp.google.com Signed-off-by: David Rientjes <rientjes@google.com> Reported-by: Sodagudi Prasad <psodagud@codeaurora.org> Tested-by: Sodagudi Prasad <psodagud@codeaurora.org> Tested-by: Matthias Kaehlcke <mka@chromium.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Hackmann <ghackmann@google.com>
* UPSTREAM: compiler, clang: properly override 'inline' for clangLinus Torvalds2017-10-09
| | | | | | | | | | | | | | | | | Commit abb2ea7dfd82 ("compiler, clang: suppress warning for unused static inline functions") just caused more warnings due to re-defining the 'inline' macro. So undef it before re-defining it, and also add the 'notrace' attribute like the gcc version that this is overriding does. Maybe this makes clang happier. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit 6d53cefb18e4646fb4bf62ccb6098fb3808486df) Signed-off-by: Greg Hackmann <ghackmann@google.com> Change-Id: Ie01b45583954c6104c854a3810e35c1171764e78
* UPSTREAM: compiler, clang: suppress warning for unused static inline functionsDavid Rientjes2017-10-09
| | | | | | | | | | | | | | | | | | | | | GCC explicitly does not warn for unused static inline functions for -Wunused-function. The manual states: Warn whenever a static function is declared but not defined or a non-inline static function is unused. Clang does warn for static inline functions that are unused. It turns out that suppressing the warnings avoids potentially complex Suppress the warning for clang. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit abb2ea7dfd82451d85ce669b811310c05ab5ca46) Signed-off-by: Greg Hackmann <ghackmann@google.com> Change-Id: I68e6246b03c962cc87b9d0bf4b7fefeda27068c0
* UPSTREAM: Kbuild: provide a __UNIQUE_ID for clangArnd Bergmann2017-10-09
| | | | | | | | | | | | | | | | | | The default __UNIQUE_ID macro in compiler.h fails to work for some drivers: drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:615:1: error: redefinition of '__UNIQUE_ID_firmware615' BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt"); This adds a copy of the version we use for gcc-4.3 and higher, as the same one works with all versions of clang that I could find in svn (2.6 and higher). Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Michal Marek <mmarek@suse.com> (cherry picked from commit b41c29b0527c7fd6a95d0f71274abb79933bf960) Signed-off-by: Greg Hackmann <ghackmann@google.com> Change-Id: I161dfa3ccb6b226966c3c87bba6b2fff1561bc61
* LLVMLinux: Add support for clang to compiler.h and new compiler-clang.hMark Charlebois2014-04-09
Add a compiler-clang.h file to add specific macros needed for compiling the kernel with clang. Initially the only override required is the macro for silencing the compiler for a purposefully uninintialized variable. Author: Mark Charlebois <charlebm@gmail.com> Signed-off-by: Mark Charlebois <charlebm@gmail.com> Signed-off-by: Behan Webster <behanw@converseincode.com>