android_kernel_samsung_a7y1.../lib
Nick Desaulniers d8299652d3 lib/string.c: implement a basic bcmp
[ Upstream commit 5f074f3e192f10c9fade898b9b3b8812e3d83342 ]

A recent optimization in Clang (r355672) lowers comparisons of the
return value of memcmp against zero to comparisons of the return value
of bcmp against zero.  This helps some platforms that implement bcmp
more efficiently than memcmp.  glibc simply aliases bcmp to memcmp, but
an optimized implementation is in the works.

This results in linkage failures for all targets with Clang due to the
undefined symbol.  For now, just implement bcmp as a tailcail to memcmp
to unbreak the build.  This routine can be further optimized in the
future.

Other ideas discussed:

 * A weak alias was discussed, but breaks for architectures that define
   their own implementations of memcmp since aliases to declarations are
   not permitted (only definitions). Arch-specific memcmp
   implementations typically declare memcmp in C headers, but implement
   them in assembly.

 * -ffreestanding also is used sporadically throughout the kernel.

 * -fno-builtin-bcmp doesn't work when doing LTO.

Link: https://bugs.llvm.org/show_bug.cgi?id=41035
Link: https://code.woboq.org/userspace/glibc/string/memcmp.c.html#bcmp
Link: 8e16d73346
Link: https://github.com/ClangBuiltLinux/linux/issues/416
Link: http://lkml.kernel.org/r/20190313211335.165605-1-ndesaulniers@google.com
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Reported-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: James Y Knight <jyknight@google.com>
Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
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: Sasha Levin <sashal@kernel.org>
2020-04-06 15:07:18 +02:00
..
842 A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fonts A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lz4 A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lzo A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mpi A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
raid6 ARM: 8833/1: Ensure that NEON code always compiles with Clang 2020-04-06 14:51:24 +02:00
reed_solomon A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xz A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
zlib_deflate A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
zlib_inflate A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
zstd A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
argv_split.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
asn1_decoder.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
assoc_array.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
atomic64_test.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
atomic64.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
audit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bcd.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bch.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bitmap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bitrev.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bsearch.c kprobes: Prohibit probing on bsearch() 2020-04-06 14:51:19 +02:00
btree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
build_OID_registry A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bust_spinlocks.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
check_signature.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checksum.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
clz_ctz.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
clz_tab.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cmdline.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
compat_audit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cordic.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpu_rmap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpu-notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpumask.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc-ccitt.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc-itu-t.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc-t10dif.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc7.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc8.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc16.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc32.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc32defs.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ctype.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
debug_info.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
debug_locks.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
debugobjects.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dec_and_lock.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_bunzip2.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_inflate.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_unlz4.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_unlzma.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_unlzo.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_unxz.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
devres.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
digsig.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
div64.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dma-debug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dump_stack.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dynamic_debug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dynamic_queue_limits.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
earlycpio.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fault-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_empty_tree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_ro.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_rw.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_strerror.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_sw.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_wip.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
find_bit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
flex_array.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
flex_proportions.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcd.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gen_crc32table.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
genalloc.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
glob.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
halfmd4.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
hexdump.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
hweight.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
idr.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
inflate.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
int_sqrt.c lib/int_sqrt: optimize initial value compute 2020-04-06 13:43:46 +02:00
interval_tree_test.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
interval_tree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iomap_copy.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iomap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iommu-common.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iommu-helper.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ioremap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iov_iter.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
irq_regs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
is_single_threaded.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
jedec_ddr_data.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kasprintf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.debug A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.kasan A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.kgdb A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.kmemcheck A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kfifo.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
klist.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kobject_uevent.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kobject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kstrtox.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kstrtox.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lcm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
libcrc32c.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
list_debug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
list_sort.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
llist.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-hardirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-mutex.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-rlock-hardirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-rlock-softirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-rlock.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-rsem.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-softirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-spin-hardirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-spin-softirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-spin.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-wlock-hardirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-wlock-softirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-wlock.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-wsem.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lockref.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lru_cache.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
md5.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
memory-notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
memweight.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
net_utils.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
nlattr.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
nmi_backtrace.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
notifier-error-inject.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
of-reconfig-notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
oid_registry.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
once.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
parser.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pci_iomap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
percpu_counter.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
percpu_ida.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
percpu_test.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
percpu-refcount.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
plist.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pm-notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
proportions.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
radix-tree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
random32.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ratelimit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rational.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rbtree_test.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rbtree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
reciprocal_div.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rhashtable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
scatterlist.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
seq_buf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sg_split.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sha1.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
show_mem.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
smp_processor_id.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sort.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stackdepot.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stmp_device.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
string_helpers.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
string.c lib/string.c: implement a basic bcmp 2020-04-06 15:07:18 +02:00
strncpy_from_user.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
strnlen_user.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
swiotlb.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
syscall.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_bpf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_firmware.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_kasan.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_module.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_printf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_rhashtable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_static_key_base.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_static_keys.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_user_copy.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test-hexdump.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test-kstrtox.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test-string_helpers.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
textsearch.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
timerqueue.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ts_bm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ts_fsm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ts_kmp.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ucs2_string.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
usercopy.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
uuid.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
vsprintf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xxhash.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30