[kmscon-devel] [PATCH] Check for GNU ld

David Herrmann dh.herrmann at gmail.com
Mon Mar 24 12:11:32 PDT 2014


Hi

On Mon, Mar 24, 2014 at 7:52 PM, Florian Gilcher
<florian.gilcher at asquera.de> wrote:
> Some flags that are GNU ld-only are used. Deactivate them
> if using a different linker.
> ---
>  Makefile.am  | 10 ++++++++++
>  configure.ac |  7 +++++++
>  2 files changed, 17 insertions(+)
>
> diff --git a/Makefile.am b/Makefile.am
> index a484292..76838b3 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -70,11 +70,16 @@ AM_CFLAGS = \
>  AM_CPPFLAGS = \
>         -include $(top_builddir)/config.h \
>         -I $(srcdir)/src
> +
> +if BUILD_HAVE_GNU_LD
>  AM_LDFLAGS = \
>         -Wl,--as-needed \
>         -Wl,--gc-sections \
>         -Wl,-z,relro \
>         -Wl,-z,now
> +else
> +AM_LDFLAGS =
> +endif
>
>  if BUILD_ENABLE_DEBUG
>  AM_CFLAGS += -g
> @@ -135,10 +140,15 @@ libtsm_test_la_LIBADD = libshl.la
>
>  EXTRA_libtsm_la_DEPENDENCIES = $(top_srcdir)/docs/libtsm.sym
>
> +if BUILD_HAVE_GNU_LD
>  libtsm_la_LDFLAGS = \
>         $(AM_LDFLAGS) \
>         -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
>         -Wl,--version-script="$(top_srcdir)/docs/libtsm.sym"

-version-info is a libtool flag. Are you sure OS-X doesn't have that?

I really dislike disabling all these flags. The version-script is
_required_ for proper symbol-version (OS-X should have a replacement
for that). Furthermore, the --gc-sections and --as-needed are used
explicitly in TSM. We just like all stuff we want and expect the
linker to remove them.

I understand that you probably just want it to build on OS-X, but are
you sure you cannot enable GNU-ld somehow? If I apply this patch, I
will add a big fat warning if GNU-ld is not available.

Thanks
David

> +else
> +libtsm_la_LDFLAGS = $(AM_LDFLAGS)
> +endif
> +
>  libtsm_test_la_LDFLAGS = \
>         $(AM_LDFLAGS)
>
> diff --git a/configure.ac b/configure.ac
> index 4373b92..fbada1d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -117,6 +117,13 @@ AM_CONDITIONAL([BUILD_ENABLE_OPTIMIZATIONS],
>                 [test "x$enable_optimizations" = "xyes"])
>
>  #
> +# Check whether the linker we are linking with is GNU ld.
> +#
> +
> +AM_CONDITIONAL([BUILD_HAVE_GNU_LD],
> +               [test "x$with_gnu_ld" = "xyes"])
> +
> +#
>  # Makefile vars
>  # After everything is configured, we create all makefiles.
>  #
> --
> 1.8.5.2 (Apple Git-48)
>
> _______________________________________________
> kmscon-devel mailing list
> kmscon-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/kmscon-devel


More information about the kmscon-devel mailing list