[PATCH] XDM: Fix missing linking dependency on -ldl.

Gaetan Nadon memsize at videotron.ca
Sat Feb 19 13:51:45 PST 2011


On Sat, 2011-02-19 at 17:53 -0200, Fernando Tarlá Cardoso Lemos wrote:

> Recent versions of GCC ship with a linker that doesn't add the deps
> of the DSOs to the linking process. This behavior is also found in
> GNU gold. This change fixes building with those linkers.
> 
> Some references:
> 
> http://wiki.debian.org/ToolChain/DSOLinking
> https://fedoraproject.org/wiki/UnderstandingDSOLinkChange
> ---
>  configure.ac |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 39a3655..e22aa43 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -79,6 +79,9 @@ AM_CONDITIONAL(HAVE_ARC4RANDOM, test x$HAVE_ARC4RANDOM = xyes)
>  
>  # Function crypt() comes from the C library or the -lcrypt data encryption library
>  AC_SEARCH_LIBS(crypt, crypt)
> +
> +# Function dl() comes from the C library or -ldl
> +AC_SEARCH_LIBS([dlopen], [dl])
>  #------------------------------------------------------------------------------
>  
>  # Checks for header files.


Libtool (we still support v 1.5), is initialized with AC_LIBTOOL_DLOPEN.

It does check for -ldl but it does not add it to LIBS.

configure:10876: checking for dlopen
configure:10932: gcc -o conftest -g -O2   conftest.c  >&5
/tmp/ccOqrtkL.o: In function `main':
/home/nadon/xorg/src/app/xdm/conftest.c:61: undefined reference to
`dlopen'
collect2: ld returned 1 exit status
configure:10939: $? = 1

        configure:10959: result: no
        configure:10964: checking for dlopen in -ldl
        configure:10999: gcc -o conftest -g -O2   conftest.c -ldl   >&5
        configure:11006: $? = 0
        configure:11027: result: yes



With the DSO linker, it would no longer work if I understand.
This is why libdl needs to be added to LIBS as it cannot use dlopen
indirectly from other libraries it links to. 

Have you checked there is no issue with adding this to BSD/MAC/Solaris
systems?
I would guess it cannot hurt.

Thanks for the comment in the code and placing it in the appropriate
section.
Consider adding something like (needed by DSO linker) if this is
correct.
It might prevent someone from removing it as duplicate code.

Reviewed-by: Gaetan Nadon <memsize at videotron.ca>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110219/2df96df9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110219/2df96df9/attachment.pgp>


More information about the xorg-devel mailing list