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 08:17:37 -0300
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> On 11/06/2018 07:46, Florian Weimer wrote:
> > On 06/11/2018 12:28 PM, Sergei Trofimovich wrote:  
> >> When glibc is built on armv7 with CFLAGS="-pipe -march=armv7-a -O2 -mfpu=neon"
> >> rtld fails to link due to missing memcpy symbol.
> >>
> >> This happens because .c files are built with -mfpu=neon flag but .S/.s files
> >> are built without it. Among other things -mfpu=neon defines __ARM_NEON__.
> >>
> >> To fix this mismatch CFLAGS should be passed consistently to .c and .S files.  
> > 
> > Please check if you can fix this by putting the architecture selection flags into the CC and CXX variables when invoking configure.  

I'm not sure just adding an arch flag is enough:
    https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/arm/armv7/multiarch/memcpy_neon.S;h=1a8d8bbe9e128618105be0652de42a34fbc52d73;hb=HEAD
   ...
   2 #ifndef __ARM_NEON__
   3 # define memcpy __memcpy_neon
Here memcpy_neon.S explicitly supports both neon-enabled and disabled flags.

C code assumes the same automatic selection:
    https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/arm/armv7/multiarch/ifunc-impl-list.c;h=48e43da66e6c307dca7cce5f397bca9fbbc265a7;hb=HEAD#l35
   ...
   35 #ifdef __ARM_NEON__
   36 # define __memcpy_neon  memcpy
   37 # define __memchr_neon  memchr
   ...

I see a few ways to do it:
- filter out CFLAGS from -mfpu=neon from C compilation (sounds too harsh)
- add CFLAGS only for memcpy_neon.S file (might be ok)
- do not use __ARM_NEON__ explicitly as an implementation switch but use
  new configure-based flag (

How should mismatch be handled to reach consistency?

> That is the usual way build-many-glibcs.py does to check for different
> variant and this is the way I used to check such flag combination when
> I refactor arm ifunc.  The armv7 configuration does build fine when
> the options are used for CC and CXX.

Looks like -mfpu=neon is not covered by build-many-glibcs.py. -mfpu=neon is needed
to trigger this type of failure as .S/.c files both use #ifndef __ARM_NEON__
and expect consistent setting:
    https://sourceware.org/bugzilla/show_bug.cgi?id=23273#c1

Should it be added explicitly as well? I never used build-many-glibcs.py before.

-- 

  Sergei

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


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