[llvmlinux] [PATCH] x86/hweight: LLVMLinux: Fix __arch_hweight{32, 64}() for compilation with clang

Sedat Dilek sedat.dilek at gmail.com
Sun Sep 13 18:24:29 UTC 2015

On Sun, Sep 13, 2015 at 6:50 PM, Jan-Simon Moeller <dl9pf at gmx.de> wrote:
> Hi,
> Am Sonntag, 13. September 2015, 17:20:24 schrieb Sedat Dilek:
>> Adapted partly from the original patch (see [1]).
>> This patch was formerly together with [2] and provided as a single
> patch.
>> To quote [3]:
>> "interesting, Jan-Simon said that patch was still part of the llvmlinux
>> tree (it is really mandatory for clang) so i'm not sure what's going
> on."
> Read the code, Luke.
> We still patch it, but in the Makefile: see [1]

That seems not to be enough - except you compile with OptLevel -O0 or -O1.

> [1]
> http://git.linuxfoundation.org/?p=llvmlinux.git;a=blob;f=arch/x86_64/patches/hweight-x86.patch;h=959ec0711e84b195632f63a2f0ddd0c31f3c14d7;hb=HEAD
>> See also [3] for an explanation of PaX Team on how to do a proper fix.
> What might manifest is an issue with the asm ALTERNATIVE.
> This is _already_ filed as
> https://llvm.org/bugs/show_bug.cgi?id=24487

I did not build with integrated-as compiler-flag, so can you explain
what this BR is dealing with this issue?

> Please comment there and help to get it fixed.

> Nack on the patch as it won't go upstream like this in the linux kernel.

Again, this patch is needed for a successful x86_64, you did not lost
one word on it.
AFAICS -no-integrated-as is default.
With GCC v4.9 this workaround works well, just to let you know.

Finally, will you reactivate that patch in arch/x86_64?

- Sedat -

More information about the LLVMLinux mailing list