git: ffe546db80d9 - main - devel/basu: unbreak build with LLD 13 (devel/llvm13 or -CURRENT)

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sat, 30 Oct 2021 02:45:43 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ffe546db80d95396051300a693d07acdcda457a3

commit ffe546db80d95396051300a693d07acdcda457a3
Author:     Evgeniy Khramtsov <evgeniy@khramtsov.org>
AuthorDate: 2021-10-09 15:37:45 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-10-30 02:45:34 +0000

    devel/basu: unbreak build with LLD 13 (devel/llvm13 or -CURRENT)
    
    ld: error: undefined symbol: __start_BUS_ERROR_MAP
    >>> referenced by bus-error.c
    >>>               libsystemd_static.a.p/sd-bus_bus-error.c.o:(bus_error_name_to_errno) in archive src/libsystemd/libsystemd_static.a
    
    ld: error: undefined symbol: __stop_BUS_ERROR_MAP
    >>> referenced by bus-error.c
    >>>               libsystemd_static.a.p/sd-bus_bus-error.c.o:(bus_error_name_to_errno) in archive src/libsystemd/libsystemd_static.a
    >>> referenced by bus-error.c
    >>>               libsystemd_static.a.p/sd-bus_bus-error.c.o:(bus_error_name_to_errno) in archive src/libsystemd/libsystemd_static.a
    cc: error: linker command failed with exit code 1 (use -v to see invocation)
    
    PR:             258812
    Obtained from:  https://github.com/systemd/systemd/commit/945317a4b69d
---
 devel/basu/files/patch-lld13 | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/devel/basu/files/patch-lld13 b/devel/basu/files/patch-lld13
new file mode 100644
index 000000000000..fde89d2ea9ac
--- /dev/null
+++ b/devel/basu/files/patch-lld13
@@ -0,0 +1,23 @@
+https://lists.sr.ht/~emersion/public-inbox/%3CCANvPQf_5qOdfbe4Tk029yVB6BHipmYfQnuuCVoTUv3N%3D2f8jfw%40mail.gmail.com%3E
+https://github.com/systemd/systemd/commit/945317a4b69d33752c9513bb8994fe8d5a786ea6
+
+--- src/libsystemd/sd-bus/bus-error.h.orig	2021-01-06 13:56:51 UTC
++++ src/libsystemd/sd-bus/bus-error.h
+@@ -28,11 +28,17 @@ int bus_error_set_errnofv(sd_bus_error *e, int error, 
+  * the bus error table, and BUS_ERROR_MAP_ELF_USE has to be used at
+  * least once per compilation unit (i.e. per library), to ensure that
+  * the error map is really added to the final binary.
++ *
++ * In addition, set the retain attribute so that the section cannot be
++ * discarded by ld --gc-sections -z start-stop-gc. Older compilers would
++ * warn for the unknown attribute, so just disable -Wattributes.
+  */
+ 
+ #define BUS_ERROR_MAP_ELF_REGISTER                                      \
++        _Pragma("GCC diagnostic ignored \"-Wattributes\"")              \
+         __attribute__ ((__section__("BUS_ERROR_MAP")))                  \
+         __attribute__ ((__used__))                                      \
++        __attribute__ ((retain))                                        \
+         __attribute__ ((aligned(8)))
+ 
+ #define BUS_ERROR_MAP_ELF_USE(errors)                                   \