HAVE_INITFINI_ARRAY problem

Dave Murphy wintermute2k4@ntlworld.com
Wed Jun 14 16:19:00 GMT 2006


Hi,

I recently encountered a problem building an arm-eabi newlib toolchain 
where __libc_init_array was missing from the libraries. The issue was 
eventually tracked to the following section of newlib/configure. What's 
happening is that it's checking for readelf which fails on hosts which 
do not have this program installed. It should really be checking for the 
target readelf but I'm not sure how to modify the configure script to 
look for the correct file. Is the check for readelf actually required or 
is the compilation test for a .init_array section sufficient?

Can I remove the readelf check? If not how would I obtain the name of 
the target readelf at this point?

Dave


echo $ac_n "checking for .preinit_array/.init_array/.fini_array 
support""... $ac_c" 1>&6
echo "configure:3430: checking for 
.preinit_array/.init_array/.fini_array support" >&5
if eval "test \"`echo '$''{'libc_cv_initfinit_array'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.c <<EOF
int _start (void) { return 0; }
int __start (void) { return 0; }
int foo (void) { return 1; }
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
EOF
if { ac_try='${CC} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
           -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD'; { 
(eval echo configure:3441: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
then
  if readelf -S conftest | grep -e INIT_ARRAY > /dev/null; then
    libc_cv_initfinit_array=yes
  else
    libc_cv_initfinit_array=no
  fi
else
  libc_cv_initfinit_array=no
fi
rm -f conftest*
fi

echo "$ac_t""$libc_cv_initfinit_array" 1>&6

if test $libc_cv_initfinit_array = yes; then
  cat >> confdefs.h <<EOF
#define HAVE_INITFINI_ARRAY 1
EOF

fi



More information about the Newlib mailing list