mirror of
https://github.com/topjohnwu/selinux.git
synced 2024-12-11 13:26:01 +00:00
libsepol: Don't use symbol versioning for static object files
Libraries such as libqpol that link with libsepol statically do not understand the symbolic versioning in libsepol. This patch disables the symbolic versioning in libsepol if building the static library or building for Android. Signed-off-by: Yuli Khodorkovskiy <ykhodorkovskiy@tresys.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Acked-by: Steve Lawrence <slawrence@tresys.com>
This commit is contained in:
parent
b35f8536dd
commit
16796d8dc1
@ -50,8 +50,9 @@
|
||||
#include "cil_binary.h"
|
||||
#include "cil_policy.h"
|
||||
#include "cil_strpool.h"
|
||||
#include "dso.h"
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef DISABLE_SYMVER
|
||||
asm(".symver cil_build_policydb_pdb, cil_build_policydb@");
|
||||
asm(".symver cil_build_policydb_create_pdb, cil_build_policydb@@LIBSEPOL_1.1");
|
||||
|
||||
@ -354,7 +355,7 @@ exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef DISABLE_SYMVER
|
||||
int cil_compile(struct cil_db *db)
|
||||
#else
|
||||
int cil_compile_nopdb(struct cil_db *db)
|
||||
@ -402,7 +403,7 @@ exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef DISABLE_SYMVER
|
||||
int cil_compile_pdb(struct cil_db *db, __attribute__((unused)) sepol_policydb_t *sepol_db)
|
||||
{
|
||||
return cil_compile_nopdb(db);
|
||||
@ -424,7 +425,7 @@ exit:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef DISABLE_SYMVER
|
||||
int cil_build_policydb(cil_db_t *db, sepol_policydb_t **sepol_db)
|
||||
#else
|
||||
int cil_build_policydb_create_pdb(cil_db_t *db, sepol_policydb_t **sepol_db)
|
||||
@ -1116,7 +1117,7 @@ const char * cil_node_to_string(struct cil_tree_node *node)
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef DISABLE_SYMVER
|
||||
int cil_userprefixes_to_string(struct cil_db *db, char **out, size_t *size)
|
||||
#else
|
||||
int cil_userprefixes_to_string_nopdb(struct cil_db *db, char **out, size_t *size)
|
||||
@ -1165,7 +1166,7 @@ exit:
|
||||
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef DISABLE_SYMVER
|
||||
int cil_userprefixes_to_string_pdb(struct cil_db *db, __attribute__((unused)) sepol_policydb_t *sepol_db, char **out, size_t *size)
|
||||
{
|
||||
return cil_userprefixes_to_string_nopdb(db, out, size);
|
||||
@ -1357,7 +1358,7 @@ static int __cil_level_to_string(struct cil_level *lvl, char *out)
|
||||
return str_tmp - out;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef DISABLE_SYMVER
|
||||
int cil_selinuxusers_to_string(struct cil_db *db, char **out, size_t *size)
|
||||
#else
|
||||
int cil_selinuxusers_to_string_nopdb(struct cil_db *db, char **out, size_t *size)
|
||||
@ -1418,14 +1419,14 @@ int cil_selinuxusers_to_string_nopdb(struct cil_db *db, char **out, size_t *size
|
||||
return SEPOL_OK;
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef DISABLE_SYMVER
|
||||
int cil_selinuxusers_to_string_pdb(struct cil_db *db, __attribute__((unused)) sepol_policydb_t *sepol_db, char **out, size_t *size)
|
||||
{
|
||||
return cil_selinuxusers_to_string_nopdb(db, out, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef DISABLE_SYMVER
|
||||
int cil_filecons_to_string(struct cil_db *db, char **out, size_t *size)
|
||||
#else
|
||||
int cil_filecons_to_string_nopdb(struct cil_db *db, char **out, size_t *size)
|
||||
@ -1547,7 +1548,7 @@ int cil_filecons_to_string_nopdb(struct cil_db *db, char **out, size_t *size)
|
||||
return SEPOL_OK;
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef DISABLE_SYMVER
|
||||
int cil_filecons_to_string_pdb(struct cil_db *db, __attribute__((unused)) sepol_policydb_t *sepol_db, char **out, size_t *size)
|
||||
{
|
||||
return cil_filecons_to_string_nopdb(db, out, size);
|
||||
|
27
libsepol/cil/src/dso.h
Normal file
27
libsepol/cil/src/dso.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _SEPOL_DSO_H
|
||||
#define _SEPOL_DSO_H 1
|
||||
|
||||
#if !defined(SHARED) || defined(ANDROID)
|
||||
#define DISABLE_SYMVER 1
|
||||
#endif
|
||||
|
||||
#ifdef SHARED
|
||||
# define hidden __attribute__ ((visibility ("hidden")))
|
||||
# define hidden_proto(fct) __hidden_proto (fct, fct##_internal)
|
||||
# define __hidden_proto(fct, internal) \
|
||||
extern __typeof (fct) internal; \
|
||||
extern __typeof (fct) fct __asm (#internal) hidden;
|
||||
# if defined(__alpha__) || defined(__mips__)
|
||||
# define hidden_def(fct) \
|
||||
asm (".globl " #fct "\n" #fct " = " #fct "_internal");
|
||||
# else
|
||||
# define hidden_def(fct) \
|
||||
asm (".globl " #fct "\n.set " #fct ", " #fct "_internal");
|
||||
#endif
|
||||
#else
|
||||
# define hidden
|
||||
# define hidden_proto(fct)
|
||||
# define hidden_def(fct)
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,6 +1,10 @@
|
||||
#ifndef _SEPOL_DSO_H
|
||||
#define _SEPOL_DSO_H 1
|
||||
|
||||
#if !defined(SHARED) || defined(ANDROID)
|
||||
#define DISABLE_SYMVER 1
|
||||
#endif
|
||||
|
||||
#ifdef SHARED
|
||||
# define hidden __attribute__ ((visibility ("hidden")))
|
||||
# define hidden_proto(fct) __hidden_proto (fct, fct##_internal)
|
||||
|
Loading…
Reference in New Issue
Block a user