mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
libapparmor: fix building with link time optimization (lto)
Currently libapparmor fails to build when lto is used because it uses the asm directive to provide different version of some symbols. Unfortunately gcc does not recognize this and the symbols defined by asm are lost and optimized out by lto and then the link fails. Fixes: https://gitlab.com/apparmor/apparmor/-/issues/214 MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/831 Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
72c06c4d35
commit
7cde91f57f
3 changed files with 9 additions and 8 deletions
|
@ -38,7 +38,7 @@ include $(COMMONDIR)/Make.rules
|
|||
BUILT_SOURCES = grammar.h scanner.h af_protos.h
|
||||
AM_LFLAGS = -v
|
||||
AM_YFLAGS = -d -p aalogparse_
|
||||
AM_CFLAGS = -Wall $(EXTRA_WARNINGS) -fPIC
|
||||
AM_CFLAGS = -Wall $(EXTRA_WARNINGS) -fPIC -flto-partition=none
|
||||
AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/include/
|
||||
scanner.h: scanner.l
|
||||
$(LEX) -v $<
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
__asm__ (".symver " #real "," #name "@" #version)
|
||||
#define default_symbol_version(real, name, version) \
|
||||
__asm__ (".symver " #real "," #name "@@" #version)
|
||||
#define DLLEXPORT __attribute__((visibility("default"),externally_visible))
|
||||
|
||||
#define UNCONFINED "unconfined"
|
||||
#define UNCONFINED_SIZE strlen(UNCONFINED)
|
||||
|
@ -824,7 +825,7 @@ int aa_change_onexec(const char *profile)
|
|||
}
|
||||
|
||||
/* create an alias for the old change_hat@IMMUNIX_1.0 symbol */
|
||||
extern typeof((__change_hat)) __old_change_hat __attribute__((alias ("__change_hat")));
|
||||
DLLEXPORT extern typeof((__change_hat)) __old_change_hat __attribute__((alias ("__change_hat")));
|
||||
symbol_version(__old_change_hat, change_hat, IMMUNIX_1.0);
|
||||
default_symbol_version(__change_hat, change_hat, APPARMOR_1.0);
|
||||
|
||||
|
@ -1222,7 +1223,7 @@ int query_label(uint32_t mask, char *query, size_t size, int *allowed,
|
|||
|
||||
/* export multiple aa_query_label symbols to compensate for downstream
|
||||
* releases with differing symbol versions. */
|
||||
extern typeof((query_label)) __aa_query_label __attribute__((alias ("query_label")));
|
||||
DLLEXPORT extern typeof((query_label)) __aa_query_label __attribute__((alias ("query_label")));
|
||||
symbol_version(__aa_query_label, aa_query_label, APPARMOR_1.1);
|
||||
default_symbol_version(query_label, aa_query_label, APPARMOR_2.9);
|
||||
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
IMMUNIX_1.0 {
|
||||
global:
|
||||
change_hat;
|
||||
change_hat; __old_change_hat;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
||||
APPARMOR_1.0 {
|
||||
global:
|
||||
change_hat;
|
||||
change_hat; __change_hat;
|
||||
parse_record;
|
||||
free_record;
|
||||
local:
|
||||
|
@ -24,7 +24,7 @@ APPARMOR_1.1 {
|
|||
global:
|
||||
aa_is_enabled;
|
||||
aa_find_mountpoint;
|
||||
aa_change_hat;
|
||||
aa_change_hat; __old_change_hat;
|
||||
aa_change_hatv;
|
||||
aa_change_hat_vargs;
|
||||
aa_change_profile;
|
||||
|
@ -37,7 +37,7 @@ APPARMOR_1.1 {
|
|||
free_record;
|
||||
aa_getprocattr_raw;
|
||||
aa_getprocattr;
|
||||
aa_query_label;
|
||||
aa_query_label; __aa_query_label;
|
||||
|
||||
# no more symbols here, please
|
||||
|
||||
|
@ -47,7 +47,7 @@ APPARMOR_1.1 {
|
|||
|
||||
APPARMOR_2.9 {
|
||||
global:
|
||||
aa_query_label;
|
||||
aa_query_label; query_label;
|
||||
local:
|
||||
*;
|
||||
} APPARMOR_1.1;
|
||||
|
|
Loading…
Add table
Reference in a new issue