blob: 3a157615884e6a3c4e3924ceb355ea1d744c0836 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
--- a/src/libelogind/sd-bus/bus-error.h
+++ b/src/libelogind/sd-bus/bus-error.h
@@ -28,11 +28,17 @@ int bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_lis
* 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\"") \
_section_("SYSTEMD_BUS_ERROR_MAP") \
_used_ \
+ __attribute__((retain)) \
_alignptr_ \
_variable_no_sanitize_address_
|