Hello,

In configuring gcc, there's a check to determine if the linker has support for 
STV_Hidden.  It determines support by checking for the date in the linker's 
version string.
On the other hand, the version string for the linker is constructed without a 
date, bfd/Makefile.am recipe for bfdver.h.
I am enclosing the lines I am referring to in this email.
It looks like there's a disconnect.  This results in incorrectly identifying a 
linker with support for STV_HIDDEN as one that doesn't.
This is from GCC 8.3.1 and Binutils 2.31.1.  Is this known/intended?

Thanks,
Visda

gcc/configure

if test $in_tree_ld != yes ; then
  ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
  if echo "$ld_ver" | grep GNU > /dev/null; then
    if test x"$ld_is_gold" = xyes; then
      # GNU gold --version looks like this:
      #     
      # GNU gold (GNU Binutils 2.21.51.20110225) 1.11
      #     
      # We extract the binutils version which is more familiar and specific
      # than the gold version.
      ld_vers=`echo $ld_ver | sed -n \
          -e 's,^[^)]*[  ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
    else  
      # GNU ld --version looks like this:
      #     
      # GNU ld (GNU Binutils) 2.21.51.20110225
      ld_vers=`echo $ld_ver | sed -n \
          -e 's,^.*[     ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
    fi    
    ld_date=`echo $ld_ver | sed -n 
's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'` 
  <-------------------looking for a YYYY-MM-DD
    ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
    ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
    ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
  else  
    case "${target}" in
      *-*-solaris2*)
        # Solaris 2 ld -V output looks like this for a regular version:

...
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker for .hidden support" 
>&5
$as_echo_n "checking linker for .hidden support... " >&6; }
if test "${gcc_cv_ld_hidden+set}" = set; then :
  $as_echo_n "(cached) " >&6
else
  if test $in_tree_ld = yes ; then
  gcc_cv_ld_hidden=no
  if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 
13 -o "$gcc_cv_gld_major_version" -gt 2 \
     && test $in_tree_ld_is_elf = yes; then
     gcc_cv_ld_hidden=yes
  fi
else
  gcc_cv_ld_hidden=yes
  if test x"$ld_is_gold" = xyes; then
    :
  elif echo "$ld_ver" | grep GNU > /dev/null; then
    case "${target}" in
      mmix-knuth-mmixware)
        # The linker emits by default mmo, not ELF, so "no" is appropriate.
        gcc_cv_ld_hidden=no
        ;;
    esac
    if test 0"$ld_date" -lt 20020404; then          <--------- linker released 
before 20020404 doesn't support .hidden
      if test -n "$ld_date"; then
        # If there was date string, but was earlier than 2002-04-04, fail
        gcc_cv_ld_hidden=no


bfd/Makefile.am
the default in development.sh is development=false

bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
        @echo "creating $@"
        @bfd_version=`echo "$(VERSION)" | $(SED) -e 
's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/'
 -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
        bfd_version_string="\"$(VERSION)\"" ;\
        bfd_soversion="$(VERSION)" ;\
        bfd_version_package="\"$(PKGVERSION)\"" ;\
        report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
        . $(srcdir)/development.sh ;\
        if test "$$development" = true ; then \
          bfd_version_date=`$(SED) -n -e 's/.*DATE //p' < $(srcdir)/version.h` 
;\
          bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
          bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
        fi ;\
        $(SED) -e "s,@bfd_version@,$$bfd_version," \
            -e "s,@bfd_version_string@,$$bfd_version_string," \
            -e "s,@bfd_version_package@,$$bfd_version_package," \
            -e "s,@report_bugs_to@,$$report_bugs_to," \
            < $(srcdir)/version.h > $@; \
        echo "$${bfd_soversion}" > libtool-soversion

Reply via email to