This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [POWERPC] Don't override gcc -mcpu with wrong asm .machine
- From: "Tulio Magno Quites Machado Filho" <tuliom at linux dot vnet dot ibm dot com>
- To: Alan Modra <amodra at gmail dot com>, libc-alpha at sourceware dot org
- Cc:
- Date: Fri, 20 Oct 2017 15:51:54 -0200
- Subject: Re: [POWERPC] Don't override gcc -mcpu with wrong asm .machine
- Authentication-results: sourceware.org; auth=none
- References: <20171020130241.GA27132@bubble.grove.modra.org>
Alan Modra <amodra@gmail.com> writes:
> If powerpc gcc is modified to not pass -many to the assembler, glibc
> builds break. -many is a sticky option, which means .machine in the
> source isn't really effective in selecting an instruction set. You do
> get the insns you want, in particular with the operand variations for
> the given cpu, but then all other cpu instructions are made available
> too.
> So, ".machine power4" in power4/memcmp.S doesn't stop you using
> power7 insns as used by the little-endian code in that file. However
> if -many is not in force, power4/memcmp.S won't compile for
> powerpc64le.
Isn't this the expected behavior?
After all, this file is in the power4 directory and, AFAIU, shouldn't be using
instructions incompatible with POWER4.
I understand that ppc64le was never tested on POWER4, but I'm afraid this
failure is actually showing there is another problem.
> It's rather strange that these files use .machine at all. Perhaps
> that was a workaround for versions of gcc that didn't pass -m<cpu> (or
> passed a wrong -m<cpu>) to the assembler unless -mcpu was given?
I think that's a (tentative?) way to guarantee the file would never have
unsupported instructions for the given cpu.
> Even with such a gcc, I believe you'll get the correct -m<cpu> if the glibc
> makefiles always pass -mcpu=<cpu> to gcc.
I don't think that's guaranteed to happen, e.g. if glibc is not configured
with --with-cpu on big endian, it may not pass -mcpu to GCC.
> Since I haven't verified that all possible powerpc build variants do that
Ack. I'm running some tests and will get back to you.
--
Tulio Magno