title: libtool in cross-compile: relinking issue only on arm target; i386/x86_64/aarch64 targets are OK
body: <p>I adding to my project (MiniMyth2) additional targets: arm and aarch64 
  (MiniMyth2 uses cross-compile to build mythtv appliance for given platform).</p>
  
  <p>I have nicely cross-compiling (and working appliance) for: i386, x86_64 and aarch64.</p>
  
  <p>All targets are built with exactly the same packages, build system, makefiles, etc. To select target I'm changing only: cross-compilation target string and gcc/ld flags. </p>
  
  <p>This works Ok for i386, x86_64 and aarch64 - but not for ARM target.</p>
  
  <p>On ARM however I have many packages failing with libtool relinking. Usually failure looks like this:</p>
  
  <pre><code>make[11]: Entering directory `/home/piotro/minimyth-dev/script/gtk/glib/work/main.d/glib-2.53.1/gmodule'
   //home/piotro/minimyth-dev/images/build/usr/bin/mkdir -p '/home/piotro/minimyth-dev/images/main/usr/lib'
   //home/piotro/minimyth-dev/images/build/bin/bash ../libtool   --mode=install //home/piotro/minimyth-dev/images/build/usr/bin/install -c   libgmodule-2.0.la '/home/piotro/minimyth-dev/images/main/usr/lib'
  libtool: warning: relinking 'libgmodule-2.0.la'
  libtool: install: (cd /home/piotro/minimyth-dev/script/gtk/glib/work/main.d/glib-2.53.1/gmodule; //home/piotro/minimyth-dev/images/build/bin/bash "/home/piotro/minimyth-dev/script/gtk/glib/work/main.d/glib-2.53.1/libtool"  --tag CC --mode=relink armv7a-minimyth-linux-gnueabihf-gcc -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -Werror=missing-include-dirs -fvisibility=hidden -pipe -pipe -march=armv7-a -O2 -flto -Wl,-Bsymbolic-functions -Wl,-z,nodelete -Wl,--export-dynamic -version-info 5301:0:5301 -export-dynamic -Wl,--as-needed -pipe -pipe -march=armv7-a -O2 -flto -o libgmodule-2.0.la -rpath /usr/lib libgmodule_2_0_la-gmodule.lo -ldl ../glib/libglib-2.0.la -inst-prefix-dir /home/piotro/minimyth-dev/images/main)
  libtool: relink: armv7a-minimyth-linux-gnueabihf-gcc -shared  -fPIC -DPIC  .libs/libgmodule_2_0_la-gmodule.o   -ldl -L/home/piotro/minimyth-dev/images/main/usr/lib -L/usr/lib -lglib-2.0 -lpcre -lpthread  -march=armv7-a -O2 -flto -Wl,-Bsymbolic-functions -Wl,-z -Wl,nodelete -Wl,--export-dynamic -Wl,--as-needed -march=armv7-a -O2 -flto   -Wl,-soname -Wl,libgmodule-2.0.so.0 -o .libs/libgmodule-2.0.so.0.5301.0
  /usr/lib/libgcc_s.so: file not recognized: File format not recognized
  collect2: error: ld returned 1 exit status
  libtool:   error: error: relink 'libgmodule-2.0.la' with the above command before installing it
  make[11]: *** [install-libLTLIBRARIES] Error 1
  </code></pre>
  
  <p>Of course /usr/lib/libgcc_s.so will be not recognised as it is for x86_64 architecture (my OS on which I'm cross-compiling is x86_64) while target is ARM.</p>
  
  <p>But:
  <strong>Why libtool relinking is looking for /usr/lib/libgcc_s.so durring durring relinking on ARM target - but not on i386, x86_64 and aarch64 targets?</strong></p>
  
  <p>Only difference between targets in my cross-building process are: target string and gcc/ld flags:</p>
  
  <pre><code>NAME:        cross-compilation target (in glibc, etc):
  c3           -&gt; i586-minimyth-linux-gnu
  c3-2         -&gt; i586-minimyth-linux-gnu
  pentium-mmx  -&gt; i586-minimyth-linux-gnu
  atom         -&gt; x86_64-minimyth-linux-gnu
  x86-64       -&gt; x86_64-minimyth-linux-gnu
  armv7        -&gt; armv7a-minimyth-linux-gnueabihf
  armv8        -&gt; aarch64-minimyth-linux-gnu
  </code></pre>
  
  <p>gcc/ld lfags:</p>
  
  <pre><code>c3           -&gt; -march=atom -mtune=atom -O2 -mfpmath=sse -ftree-vectorize -mmovbe
  c3-2         -&gt; -march=c3-2 -mtune=c3-2 -Os -mfpmath=sse
  pentium-mmx  -&gt; -march=pentium-mmx -mtune=generic  -Os
  atom         -&gt; -march=atom -mtune=atom -O2 -mfpmath=sse -ftree-vectorize -mmovbe
  x86-64       -&gt; -march=x86-64 -mtune=generic  -O3 -mfpmath=sse
  armv7        -&gt; -march=armv7-a -O2
  armv8        -&gt; -march=armv8-a -O2
  </code></pre>
  
  <p>and gcc common for all: <code>-pipe -flto</code></p>
  
  <p>ld common for all: <code>-Wl,--as-needed -pipe -flto</code></p>
  
  <p>Rest (packages, makefiles, etc are exactly the same)</p>
  
  <p>gcc is 7.3.0, glibc is 2.27, binutils are 2.28.1</p>