This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Makerules: pass CFLAGS when building .S files, BZ #23273


On Mon, 11 Jun 2018 18:25:19 -0300
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> On 11/06/2018 12:30, Sergei Trofimovich wrote:
> > On Mon, 11 Jun 2018 15:47:41 +0200
> > Florian Weimer <fweimer@redhat.com> wrote:
> >   
> >> On 06/11/2018 03:41 PM, Sergei Trofimovich wrote:  
> >>> The below works on unmodified glibc as well:
> >>>
> >>> $ ../glibc/configure \
> >>>      --build=x86_64-pc-linux-gnu \
> >>>      --host=armv7a-hardfloat-linux-gnueabi \
> >>>      CC="armv7a-hardfloat-linux-gnueabi-gcc -march=armv7-a -mfpu=neon" \
> >>>      CFLAGS="-pipe -O2" \
> >>>      --prefix=/usr    
> >>
> >> Then please use that instead.  It's what we do on other architectures, too.  
> > 
> > Aha. Gentoo allows user to specify CFLAGS from a limited (but not small) set of
> > flags when glibc is built locally:
> >     https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/flag-o-matic.eclass#n25
> > 
> > Does it mean that canonical way to build glibc would be to always pass all
> > CFLAGS/CXXFLAGS as part of CC/CXX?
> >     CC="${TARGET_CC} ${CFLAGS}"
> >     CXX="${TARGET_CC} ${CXXFLAGS}"
> > 
> > Or should only a small subset of CFLAGS/CXXFLAGS go to CC/CXX?
> >     CC="${TARGET_CC} ${filtered_CFLAGS}"
> >     CXX="${TARGET_CC} ${filtered_CXXFLAGS}"
> > 
> > If it should be a filtered subset, how can we easily infer supported subset?
> >   
> 
> It is not exactly the canonical way, but rather the usual one which should be
> simpler when the compiler flags may change the target ABI.  One option is
> to set the ABI flags on CC/CXX, another option is to set on both CFLAGS and
> CPPFLAGS.
> 
> For armv7 neon you can either set:
> 
> ./configure CC="gcc -march=armv7-a -mfpu=neon" CXX="g++ -march=armv7-a -mfpu=neon"
> 
> or
> 
> ./configure CFLAGS="-O2 -march=armv7-a -mfpu=neon" CPPFLAGS="-O2 -march=armv7-a -mfpu=neon"
> 
> The only difference is you will need to explicit set the optimization level when
> setting CFLAGS.

CFLAGS/CPPFLAGS should work for us.

I was about to ask why glibc is special in handling CFLAGS. But I guess it's not
special and is mimicked after default rules of GNU make. Which is:

  .o: .S
    $(AS) $(CPPFLAGS) $(ASFLAGS) ...
  .o: .s
    $(AS) $(ASFLAGS) ...

Thus passing ABI flags as part of ASFLAGS might be more generic (for projects
that use .s and .S). But for glibc CPPFLAGS are used in the same context as CPPFLAGS.

Thanks! I'll close the bug as invalid.

-- 

  Sergei

Attachment: pgpREensCysED.pgp
Description: Цифровая подпись OpenPGP


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]