On Thu, Nov 7, 2019 at 10:46 AM Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> wrote: > On 11/7/19 12:22 PM, Alexander Potapenko wrote: > > On Thu, Nov 7, 2019 at 10:04 AM Arnd Bergmann <arnd@xxxxxxxx> wrote: > >> On Thu, Nov 7, 2019 at 7:08 AM Sergey Senozhatsky > >> <sergey.senozhatsky.work@xxxxxxxxx> wrote: > >> The normal way to do a volatile access would be > >> READ_ONCE()/WRITE_ONCE(), but that seems stronger than > >> the barrier() here. I'd just stick to adding a barrier. > > I actually like the READ_ONCE idea more, as READ_ONCE is really a > > documented way to prevent the compiler from merging reads, which is > > what we want here. > > I would rather go with -fno-builtin-bcmp or maybe even -fno-builtin if that works. The commit message for 5f074f3e192f ("lib/string.c: implement a basic bcmp") mentions that -fno-builtin-bcmp did not work for LTO when the global bcmp() help was added. I don't know whether the same applies here, but my guess is that it's the same issue. Arnd