Issue in detection of assembler support for --noexecstack flag

Marc Glisse marc.glisse at
Thu Feb 25 20:32:00 UTC 2016

On Thu, 25 Feb 2016, Rahul Chaudhry wrote:

> This was discovered while trying to use llvm/clang to configure and
> build gmp. This is the bug for this issue on the llvm side:

Thanks for (re-)opening that bug.

> It is true that irrespective of the flags being passed, the error
> messages from the llvm assembler are weird and unexpected.
> The acinclude.m4 change in the attached patch is still is a good
> change, though, independent of the llvm bug. Note that the same macro
> adds the "--noexecstack" flag to ASMFLAGS after checking if it is
> supported. The flag gets used later during the build, so I'm assuming
> that ASMFLAGS is used from the Makefiles when invoking the assembler.
> It makes little sense to use CFLAGS when invoking the assembler to
> check support for the "--noexecstack" flag. The only explanation I can
> think of is that this is how glibc did it, and this macro was borrowed
> from there. And if that's the only reason, then glibc fixed this exact
> instance and the patch is bringing that fix to gmp.

In GMP, we use the compiler on asm files, we never call the assembler 
directly. And CFLAGS is relevant also for asm, it might include -m64 for 
instance, which could change the target of the assembler, or even change 
which assembler the compiler is calling. Dropping CFLAGS might thus result 
in wrong result for the noexecstack test.

Maybe it would actually be safe, but I'll let some other GMP maintainer 
decide that. In any case, thank you for reporting this issue.

Marc Glisse

More information about the gmp-bugs mailing list