[PATCH] Fix detecting ld version with crosstool-NG (to fix symbol exporting)

Yann E. MORIN yann.morin.1998@free.fr
Sun Jul 15 17:30:00 GMT 2012


Olivier, All,

On Tuesday 03 July 2012 17:41:13 Olivier Blin wrote:
> ld from crosstool-NG reports a version string with an extra version:
> GNU ld (crosstool-NG 1.13.0) 2.21.1

Fact is, (not so) recent binutils can be configured with an arbitrary
extra-version string, so it may contain whatever the user would set it to.

It just happens that crosstool-NG uses this extra-version string to store
its own version in it.

> This made libtool assume that the ld version was the crosstool-NG
> version (1.13.0) instead of the real ld version (2.21.1).
> 
> To fix the ld version string, this patch filters out any string
> between parentheses that is followed by a space.
> 
> Because of this bug, filtering of exported symbols was not taking
> place with crosstool-NG toolchains.
> 
> This issue has bee noticed when building pango, which exported
> harfbuzz symbols that should have remained hidden.
> ---
>  m4/libtool.m4 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/m4/libtool.m4 b/m4/libtool.m4
> index a8ecbc3..61ea4cc 100644
> --- a/m4/libtool.m4
> +++ b/m4/libtool.m4
> @@ -4690,7 +4690,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
>        _LT_TAGVAR(whole_archive_flag_spec, $1)=
>      fi
>      supports_anon_versioning=no
> -    case `$LD -v 2>&1` in
> +    case `$LD -v 2>&1 | $SED -e 's/([[^)]]\+)\s\+//'` in

Maybe we want to be even more robust here, in case the extra-version also
contains braces, like (barely tested):

+    case `$LD -v 2>&1 | $SED -r -e 's/^([[^\(]]+)(\(.*\))?([[^\)]]+)$/\1\3/'` in


>        *GNU\ gold*) supports_anon_versioning=yes ;;
>        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
>        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list