return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"PCRE2 support is not installed: %s", dlerror());
+ /* So here's something weird: PCRE2 actually renames the symbols exported by the library via C
+ * macros, so that the exported symbols carry a suffix "_8" but when used from C the suffix is
+ * gone. In the argument list below we ignore this mangling. Surprisingly (at least to me), we
+ * actually get away with that. That's because DLSYM_ARG() useses STRINGIFY() to generate a string
+ * version of the symbol name, and that resolves the macro mapping implicitly already, so that the
+ * string actually contains the "_8" suffix already due to that and we don't have to append it
+ * manually anymore. C is weird. 🤯 */
+
r = dlsym_many_and_warn(
dl,
LOG_ERR,
- &sym_pcre2_match_data_create, "pcre2_match_data_create_8",
- &sym_pcre2_match_data_free, "pcre2_match_data_free_8",
- &sym_pcre2_code_free, "pcre2_code_free_8",
- &sym_pcre2_compile, "pcre2_compile_8",
- &sym_pcre2_get_error_message, "pcre2_get_error_message_8",
- &sym_pcre2_match, "pcre2_match_8",
- &sym_pcre2_get_ovector_pointer, "pcre2_get_ovector_pointer_8",
+ DLSYM_ARG(pcre2_match_data_create),
+ DLSYM_ARG(pcre2_match_data_free),
+ DLSYM_ARG(pcre2_code_free),
+ DLSYM_ARG(pcre2_compile),
+ DLSYM_ARG(pcre2_get_error_message),
+ DLSYM_ARG(pcre2_match),
+ DLSYM_ARG(pcre2_get_ovector_pointer),
NULL);
if (r < 0)
return r;
r = dlsym_many_and_warn(
dl,
LOG_DEBUG,
- &sym_crypt_activate_by_passphrase, "crypt_activate_by_passphrase",
+ DLSYM_ARG(crypt_activate_by_passphrase),
#if HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY
- &sym_crypt_activate_by_signed_key, "crypt_activate_by_signed_key",
+ DLSYM_ARG(crypt_activate_by_signed_key),
#endif
- &sym_crypt_activate_by_volume_key, "crypt_activate_by_volume_key",
- &sym_crypt_deactivate_by_name, "crypt_deactivate_by_name",
- &sym_crypt_format, "crypt_format",
- &sym_crypt_free, "crypt_free",
- &sym_crypt_get_dir, "crypt_get_dir",
- &sym_crypt_get_verity_info, "crypt_get_verity_info",
- &sym_crypt_init, "crypt_init",
- &sym_crypt_init_by_name, "crypt_init_by_name",
- &sym_crypt_keyslot_add_by_volume_key, "crypt_keyslot_add_by_volume_key",
- &sym_crypt_load, "crypt_load",
- &sym_crypt_resize, "crypt_resize",
- &sym_crypt_set_data_device, "crypt_set_data_device",
- &sym_crypt_set_debug_level, "crypt_set_debug_level",
- &sym_crypt_set_log_callback, "crypt_set_log_callback",
- &sym_crypt_volume_key_get, "crypt_volume_key_get",
+ DLSYM_ARG(crypt_activate_by_volume_key),
+ DLSYM_ARG(crypt_deactivate_by_name),
+ DLSYM_ARG(crypt_format),
+ DLSYM_ARG(crypt_free),
+ DLSYM_ARG(crypt_get_dir),
+ DLSYM_ARG(crypt_get_verity_info),
+ DLSYM_ARG(crypt_init),
+ DLSYM_ARG(crypt_init_by_name),
+ DLSYM_ARG(crypt_keyslot_add_by_volume_key),
+ DLSYM_ARG(crypt_load),
+ DLSYM_ARG(crypt_resize),
+ DLSYM_ARG(crypt_set_data_device),
+ DLSYM_ARG(crypt_set_debug_level),
+ DLSYM_ARG(crypt_set_log_callback),
+ DLSYM_ARG(crypt_volume_key_get),
NULL);
if (r < 0)
return r;
r = dlsym_many_and_warn(
dl,
LOG_DEBUG,
- &sym_idn2_lookup_u8, "idn2_lookup_u8",
- &sym_idn2_strerror, "idn2_strerror",
- &sym_idn2_to_unicode_8z8z, "idn2_to_unicode_8z8z",
+ DLSYM_ARG(idn2_lookup_u8),
+ DLSYM_ARG(idn2_strerror),
+ DLSYM_ARG(idn2_to_unicode_8z8z),
NULL);
if (r < 0)
return r;
r = dlsym_many_and_warn(
dl,
LOG_DEBUG,
- &sym_idna_to_ascii_4i, "idna_to_ascii_4i",
- &sym_idna_to_unicode_44i, "idna_to_unicode_44i",
- &sym_stringprep_ucs4_to_utf8, "stringprep_ucs4_to_utf8",
- &sym_stringprep_utf8_to_ucs4, "stringprep_utf8_to_ucs4",
+ DLSYM_ARG(idna_to_ascii_4i),
+ DLSYM_ARG(idna_to_unicode_44i),
+ DLSYM_ARG(stringprep_ucs4_to_utf8),
+ DLSYM_ARG(stringprep_utf8_to_ucs4),
NULL);
if (r < 0)
return r;
r = dlsym_many_and_warn(
dl,
LOG_DEBUG,
- &sym_pwquality_check, "pwquality_check",
- &sym_pwquality_default_settings, "pwquality_default_settings",
- &sym_pwquality_free_settings, "pwquality_free_settings",
- &sym_pwquality_generate, "pwquality_generate",
- &sym_pwquality_get_str_value, "pwquality_get_str_value",
- &sym_pwquality_read_config, "pwquality_read_config",
- &sym_pwquality_set_int_value, "pwquality_set_int_value",
- &sym_pwquality_strerror, "pwquality_strerror",
+ DLSYM_ARG(pwquality_check),
+ DLSYM_ARG(pwquality_default_settings),
+ DLSYM_ARG(pwquality_free_settings),
+ DLSYM_ARG(pwquality_generate),
+ DLSYM_ARG(pwquality_get_str_value),
+ DLSYM_ARG(pwquality_read_config),
+ DLSYM_ARG(pwquality_set_int_value),
+ DLSYM_ARG(pwquality_strerror),
NULL);
if (r < 0)
return r;
r = dlsym_many_and_warn(
dl,
LOG_DEBUG,
- &sym_QRcode_encodeString, "QRcode_encodeString",
- &sym_QRcode_free, "QRcode_free",
+ DLSYM_ARG(QRcode_encodeString),
+ DLSYM_ARG(QRcode_free),
NULL);
if (r < 0)
return r;