On Thu, Dec 21 2017, Jeremie Courreges-Anglas <[email protected]> wrote:
> On Thu, Dec 21 2017, Matthias Kilian <[email protected]> wrote:
>> Hi,
>>
>> I just got a bug report from Sebastian Neuper about editors/gummi
>> misbehaving when built with clang. Details about the bug aren't
>> important, but he well-spooted this one in the build log:
>>
>> cc: warning: argument unused during compilation: '-e xport-dynamic'
>> [-Wunused-command-line-argument]
>>
>> He also reported that using GCC did fix the problem (not only the
>> warning).
IIUC gcc passes -export-dynamic to ld(1) not because it recognizes the
keyword explicitely, but because of LINK_COMMAND_SPEC which contains
"%{e*}". The spec matches "-e _symbol" but also "-export-dynamic",
which end sup doing the right thing.
Upstream gcc noticed the this quirk and explicitely added support
for -export-dynamic:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47390
clang passes "-e xport-dynamic" to ld(1) which interprets it as a bogus
entry point. This breaks libglade[1].
>> Looking at my build logs (only a few, because I run dpb -uR), I
>> noticed some other ports producing this warning, and they invoke
>> gcc with the flag -export-dynamic. Which is wrong.
>>
>> When using gcc(1), -rdynamic should be used to pass -export-dynamic
>> to the linker (so says the man page).
>>
>> When using clang(1) -rdynamic can be used to pass -export-dynamic
>> to eh linker (so says jca@ on icb after having a look at the clang
>> sources).
Yep, it's probably the easiest way to fix those issues. The alternative
would be to handle -export-dynamic like recent gcc versions do.
Also there seems to be a bad handling of -export-dynamic by libtool
(base and gnu), need to confirm.
Fix for klavaro, which is affected by the same problems as audio/tagtool
and editors/gummi. The diff below patches both Makefile.am (could be
upstreamed?) and Makefile.in (to avoid bringing in automake).
ok?
[1] https://developer.gnome.org/libglade/unstable/libglade-notes.html
Index: Makefile
===================================================================
RCS file: /d/cvs/ports/x11/klavaro/Makefile,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile
--- Makefile 28 Aug 2016 17:22:29 -0000 1.17
+++ Makefile 21 Dec 2017 21:47:57 -0000
@@ -3,7 +3,7 @@
COMMENT = touch typing tutor program
DISTNAME = klavaro-1.5.0
-REVISION = 6
+REVISION = 7
CATEGORIES = x11
Index: patches/patch-src_Makefile_am
===================================================================
RCS file: patches/patch-src_Makefile_am
diff -N patches/patch-src_Makefile_am
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_Makefile_am 21 Dec 2017 22:19:11 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Fix passing --export-dynamic to the linker.
+
+Index: src/Makefile.am
+--- src/Makefile.am.orig
++++ src/Makefile.am
+@@ -24,5 +24,6 @@ AM_CPPFLAGS = @PACKAGE_CFLAGS@ \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
+
+-AM_CFLAGS = -export-dynamic -Wall
++AM_CFLAGS = -Wall
++AM_LDAGS = -rdynamic
+
Index: patches/patch-src_Makefile_in
===================================================================
RCS file: patches/patch-src_Makefile_in
diff -N patches/patch-src_Makefile_in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_Makefile_in 21 Dec 2017 22:19:11 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Fix passing --export-dynamic to the linker.
+
+Index: src/Makefile.in
+--- src/Makefile.in.orig
++++ src/Makefile.in
+@@ -194,7 +194,8 @@ AM_CPPFLAGS = @PACKAGE_CFLAGS@ \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
+
+-AM_CFLAGS = -export-dynamic -Wall
++AM_CFLAGS = -Wall
++AM_LDFLAGS = -rdynamic
+ all: all-am
+
+ .SUFFIXES:
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE