#
0cc3a351 |
| 22-Feb-2025 |
Sean Christopherson <seanjc@google.com> |
lib: Use __ASSEMBLER__ instead of __ASSEMBLY__
Convert all non-x86 #ifdefs from __ASSEMBLY__ to __ASSEMBLER__, and remove all manual __ASSEMBLY__ #defines. __ASSEMBLY_ was inherited blindly from th
lib: Use __ASSEMBLER__ instead of __ASSEMBLY__
Convert all non-x86 #ifdefs from __ASSEMBLY__ to __ASSEMBLER__, and remove all manual __ASSEMBLY__ #defines. __ASSEMBLY_ was inherited blindly from the Linux kernel, and must be manually defined, e.g. through build rules or with the aforementioned explicit #defines in assembly code.
__ASSEMBLER__ on the other hand is automatically defined by the compiler when preprocessing assembly, i.e. doesn't require manually #defines for the code to function correctly.
Ignore x86, as x86 doesn't actually rely on __ASSEMBLY__ at the moment, and is undergoing a parallel cleanup.
Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Andrew Jones <andrew.jones@linux.dev> Message-ID: <20250222014526.2302653-1-seanjc@google.com> [thuth: Fix three more occurances in libfdt.h and sbi-tests.h] Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
#
b0fcca88 |
| 27-Mar-2023 |
Nicholas Piggin <npiggin@gmail.com> |
compiler.h: Make __always_inline match glibc definition, preventing redefine error
This makes __always_inline match glibc's cdefs.h file, which prevents redefinition errors which can happen e.g., if
compiler.h: Make __always_inline match glibc definition, preventing redefine error
This makes __always_inline match glibc's cdefs.h file, which prevents redefinition errors which can happen e.g., if glibc limits.h is included before kvm-unit-tests compiler.h.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20230327122248.2693856-1-npiggin@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
#
1721daed |
| 13-Oct-2021 |
Andrew Jones <drjones@redhat.com> |
compiler.h: Fix typos in mul and sub overflow checks
Fixes: 4ceb02bf68f0 ("compiler: Add builtin overflow flag and predicate wrappers") Signed-off-by: Andrew Jones <drjones@redhat.com> Reviewed-by:
compiler.h: Fix typos in mul and sub overflow checks
Fixes: 4ceb02bf68f0 ("compiler: Add builtin overflow flag and predicate wrappers") Signed-off-by: Andrew Jones <drjones@redhat.com> Reviewed-by: Daniele Ahmed <ahmeddan@amazon.com> Message-Id: <20211013164259.88281-2-drjones@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
a9d450af |
| 09-Sep-2021 |
Sean Christopherson <seanjc@google.com> |
lib: Move __unused attribute macro to compiler.h
Move the __unused macro to linux/compiler.h to co-locate it with the other macros that provide syntactic sugar around __attribute__.
No functional c
lib: Move __unused attribute macro to compiler.h
Move the __unused macro to linux/compiler.h to co-locate it with the other macros that provide syntactic sugar around __attribute__.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20210909183207.2228273-4-seanjc@google.com> Reviewed-by: Jim Mattson <jmattson@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
16431a73 |
| 09-Sep-2021 |
Bill Wendling <morbo@google.com> |
lib: define the "noinline" macro
Define "noline" macro to reduce the amount of typing for functions using the "noinline" attribute. Opportunistically convert existing users.
Signed-off-by: Bill We
lib: define the "noinline" macro
Define "noline" macro to reduce the amount of typing for functions using the "noinline" attribute. Opportunistically convert existing users.
Signed-off-by: Bill Wendling <morbo@google.com> [sean: put macro in compiler.h instead of libcflat.h] Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20210909183207.2228273-3-seanjc@google.com> Reviewed-by: Jim Mattson <jmattson@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
53017303 |
| 02-Jun-2021 |
Po-Hsu Lin <po-hsu.lin@canonical.com> |
compiler: use __builtin_add_overflow_p for gcc >= 7.1.0
Compilation on Ubuntu Xenial 4.4.0-210-generic i386 with gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) will fail with: lib/lin
compiler: use __builtin_add_overflow_p for gcc >= 7.1.0
Compilation on Ubuntu Xenial 4.4.0-210-generic i386 with gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) will fail with: lib/linux/compiler.h:37:34: error: implicit declaration of function ‘__builtin_add_overflow_p’ [-Werror=implicit-function-declaration]
From the GCC document[1] it looks like this built-in function was only introduced since 7.1.0
This can be fixed by simply changing the version check from 5.1.0 to 7.1.0
[1] https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Integer-Overflow-Builtins.html
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com> Message-Id: <20210602082443.20252-1-po-hsu.lin@canonical.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
f583d924 |
| 30-Mar-2021 |
Paolo Bonzini <bonzini@gnu.org> |
Merge branch 'arm/queue' into 'master'
arm/arm64: Fixes, improvements, and prep for target-efi
See merge request kvm-unit-tests/kvm-unit-tests!6
|
#
4ceb02bf |
| 23-Mar-2021 |
Andrew Jones <drjones@redhat.com> |
compiler: Add builtin overflow flag and predicate wrappers
Checking for overflow can be difficult, but doing so may be a good idea to avoid difficult to debug problems. Compilers that provide builti
compiler: Add builtin overflow flag and predicate wrappers
Checking for overflow can be difficult, but doing so may be a good idea to avoid difficult to debug problems. Compilers that provide builtins for overflow checking allow the checks to be simple enough that we can use them more liberally. The idea for this flag is to wrap a calculation that should have overflow checking, allowing compilers that support it to give us some extra robustness. For example,
#ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW bool overflow = __builtin_mul_overflow(x, y, &z); assert(!overflow); #else /* Older compiler, hopefully we don't overflow... */ z = x * y; #endif
This is a bit ugly though, so when possible we can just use the predicate wrappers, which have an always-false fallback, e.g.
/* Old compilers won't assert on overflow. Oh, well... */ assert(!check_mul_overflow(x, y)); z = x * y;
Signed-off-by: Andrew Jones <drjones@redhat.com>
show more ...
|
#
3c13c642 |
| 08-Jan-2020 |
Paolo Bonzini <pbonzini@redhat.com> |
Merge branch 'arm/queue' of https://github.com/rhdrjones/kvm-unit-tests into HEAD
|
#
d5b60621 |
| 31-Dec-2019 |
Alexandru Elisei <alexandru.elisei@arm.com> |
lib: Add WRITE_ONCE and READ_ONCE implementations in compiler.h
Add the WRITE_ONCE and READ_ONCE macros which are used to prevent the compiler from optimizing a store or a load, respectively, into s
lib: Add WRITE_ONCE and READ_ONCE implementations in compiler.h
Add the WRITE_ONCE and READ_ONCE macros which are used to prevent the compiler from optimizing a store or a load, respectively, into something else.
Cc: Drew Jones <drjones@redhat.com> Cc: Laurent Vivier <lvivier@redhat.com> Cc: Thomas Huth <thuth@redhat.com> Cc: David Hildenbrand <david@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andrew Jones <drjones@redhat.com>
show more ...
|