e2ec8a
From 0ed1150ccf8837ca85cbb8d5a42fe81b5efeac32 Mon Sep 17 00:00:00 2001
e2ec8a
From: Jussi Pakkanen <jpakkane@gmail.com>
e2ec8a
Date: Sat, 6 Apr 2019 21:59:06 +0200
e2ec8a
Subject: [PATCH] meson: drop misplaced -Wl,--undefined argument
e2ec8a
e2ec8a
Ld's man page says the following:
e2ec8a
e2ec8a
  -u symbol
e2ec8a
  --undefined=symbol
e2ec8a
e2ec8a
  Force symbol to be entered in the output file as an undefined symbol. Doing
e2ec8a
  this may, for example, trigger linking of additional modules from standard
e2ec8a
  libraries. -u may be repeated with different option arguments to enter
e2ec8a
  additional undefined symbols. This option is equivalent to the "EXTERN"
e2ec8a
  linker script command.
e2ec8a
e2ec8a
  If this option is being used to force additional modules to be pulled into
e2ec8a
  the link, and if it is an error for the symbol to remain undefined, then the
e2ec8a
  option --require-defined should be used instead.
e2ec8a
e2ec8a
This would imply that it always requires an argument, which this does not
e2ec8a
pass. Thus it will grab the next argument on the command line as its
e2ec8a
argument. Before it took one of the many -lrt args (presumably) and now it
e2ec8a
grabs something other random linker argument and things break.
e2ec8a
e2ec8a
[zj: this line was added in the first version of the meson configuration back
e2ec8a
in 5c23128daba7236a6080383b2a5649033cfef85c. AFAICT, this was a mistake. No
e2ec8a
such flag appeared in Makefile.am at the time.]
e2ec8a
e2ec8a
https://github.com/mesonbuild/meson/issues/5113
e2ec8a
(cherry picked from commit 700805f6c546f2adb79059614f3747f7b5474325)
e2ec8a
---
e2ec8a
 meson.build | 3 +--
e2ec8a
 1 file changed, 1 insertion(+), 2 deletions(-)
e2ec8a
e2ec8a
diff --git a/meson.build b/meson.build
e2ec8a
index d58926c981..f2d67b7e02 100644
e2ec8a
--- a/meson.build
e2ec8a
+++ b/meson.build
e2ec8a
@@ -1436,8 +1436,7 @@ foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
e2ec8a
                         # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
e2ec8a
                         link_args : ['-Wl,-z,nodelete',
e2ec8a
                                      '-shared',
e2ec8a
-                                     '-Wl,--version-script=' + version_script_arg,
e2ec8a
-                                     '-Wl,--undefined'],
e2ec8a
+                                     '-Wl,--version-script=' + version_script_arg],
e2ec8a
                         link_with : [libsystemd_static,
e2ec8a
                                      libbasic],
e2ec8a
                         dependencies : [threads,