[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri May 14 01:51:01 UTC 2021


The branch, master has been updated
       via  9be3be8aca8 build: wscript. Fix the build on FreeBSD with the clang ld.lld-XX linker.
      from  2b9a1feae73 lib:util: Fix return value of tdb_fetch_uint32_byblob()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9be3be8aca8d1ee198791c5ffebeddf997372caf
Author: Jeremy Allison <jra at samba.org>
Date:   Thu May 13 13:20:17 2021 -0700

    build: wscript. Fix the build on FreeBSD with the clang ld.lld-XX linker.
    
    FreeBSD is broken. It doesn't include 'extern char **environ'
    in any shared library, but statically inside crt0.o.
    
    If we're running on a FreeBSD with the GNU linker ld we
    can get around this by explicitly telling the linker to
    ignore 'environ' as an unresolved symbol in a shared library.
    
    However, the clang linker ld.lld-XX is broken in that it
    doesn't have that option.
    First try to see if have '-Wl,--ignore-unresolved-symbol,environ'
    and just use that if so.
    
    If not, we have to use '-Wl,--allow-shlib-undefined' instead
    and remove all instances of '-Wl,-no-undefined'.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri May 14 01:50:25 UTC 2021 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 wscript | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)


Changeset truncated at 500 lines:

diff --git a/wscript b/wscript
index f928b16a298..ee7daa953b2 100644
--- a/wscript
+++ b/wscript
@@ -380,6 +380,34 @@ def configure(conf):
                          msg="Checking compiler for full RELRO support"):
             conf.env['ENABLE_RELRO'] = True
 
+    #
+    # FreeBSD is broken. It doesn't include 'extern char **environ'
+    # in any shared library, but statically inside crt0.o.
+    #
+    # If we're running on a FreeBSD with the GNU linker ld we
+    # can get around this by explicitly telling the linker to
+    # ignore 'environ' as an unresolved symbol in a shared library.
+    #
+    # However, the clang linker ld.lld-XX is broken in that it
+    # doesn't have that option.
+    #
+    # First try to see if have '-Wl,--ignore-unresolved-symbol,environ'
+    # and just use that if so.
+    #
+    # If not, we have to use '-Wl,--allow-shlib-undefined' instead
+    # and remove all instances of '-Wl,-no-undefined'.
+
+    if sys.platform.startswith('freebsd'):
+        # Do we have Wl,--ignore-unresolved-symbol,environ ?
+        flag_added = conf.ADD_LDFLAGS('-Wl,--ignore-unresolved-symbol,environ', testflags=True)
+        if not flag_added:
+            # No, fall back to -Wl,--allow-shlib-undefined.
+            conf.ADD_LDFLAGS('-Wl,--allow-shlib-undefined', testflags=True)
+            # Remove any uses of '-Wl,-no-undefined'
+            conf.env['EXTRA_LDFLAGS'] = list(filter(('-Wl,-no-undefined').__ne__, conf.env['EXTRA_LDFLAGS']))
+            # And make sure we don't try and remove it again when 'allow_undefined_symbols=true'
+            conf.env.undefined_ldflags = []
+
     conf.SAMBA_CONFIG_H('include/config.h')
 
 def etags(ctx):


-- 
Samba Shared Repository



More information about the samba-cvs mailing list