diff mbox series

[1/1] libsemanage: include internal header to use the hidden function prototypes

Message ID 20190805200434.26911-1-nicolas.iooss@m4x.org (mailing list archive)
State Accepted
Headers show
Series [1/1] libsemanage: include internal header to use the hidden function prototypes | expand

Commit Message

Nicolas Iooss Aug. 5, 2019, 8:04 p.m. UTC
When functions from libsemanage calls other functions that are exported,
these functions need to be "wrapped" using hidden_proto() macro. This is
done in headers such as "user_internal.h". Several functions in
genhomedircon.c are not doing this, which makes building with -flto
fail with errors such as:

    /usr/bin/ld: /tmp/libsemanage.so.1.KebOLC.ltrans1.ltrans.o: in
    function `user_sort_func':
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:758:
    undefined reference to `semanage_user_get_name'
    /usr/bin/ld:
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:758:
    undefined reference to `semanage_user_get_name'
    /usr/bin/ld: /tmp/libsemanage.so.1.KebOLC.ltrans1.ltrans.o: in
    function `fcontext_matches':
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:240:
    undefined reference to `semanage_fcontext_get_expr'
    /usr/bin/ld:
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:248:
    undefined reference to `semanage_fcontext_get_type'
    /usr/bin/ld: /tmp/libsemanage.so.1.KebOLC.ltrans1.ltrans.o: in
    function `add_user.isra.0':
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:992:
    undefined reference to `semanage_user_get_mlslevel'
    /usr/bin/ld: /tmp/libsemanage.so.1.KebOLC.ltrans1.ltrans.o: in
    function `write_context_file':
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:892:
    undefined reference to `semanage_user_key_create'
    /usr/bin/ld:
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:764:
    undefined reference to `semanage_user_get_name'
    /usr/bin/ld:
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:897:
    undefined reference to `semanage_user_query'
    /usr/bin/ld:
    /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:905:
    undefined reference to `semanage_user_get_mlslevel'

Include the missing headers.

Fixes: https://github.com/SELinuxProject/selinux/issues/169

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsemanage/src/genhomedircon.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Nicolas Iooss Sept. 1, 2019, 5:51 p.m. UTC | #1
On Mon, Aug 5, 2019 at 10:05 PM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> When functions from libsemanage calls other functions that are exported,
> these functions need to be "wrapped" using hidden_proto() macro. This is
> done in headers such as "user_internal.h". Several functions in
> genhomedircon.c are not doing this, which makes building with -flto
> fail with errors such as:
>
>     /usr/bin/ld: /tmp/libsemanage.so.1.KebOLC.ltrans1.ltrans.o: in
>     function `user_sort_func':
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:758:
>     undefined reference to `semanage_user_get_name'
>     /usr/bin/ld:
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:758:
>     undefined reference to `semanage_user_get_name'
>     /usr/bin/ld: /tmp/libsemanage.so.1.KebOLC.ltrans1.ltrans.o: in
>     function `fcontext_matches':
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:240:
>     undefined reference to `semanage_fcontext_get_expr'
>     /usr/bin/ld:
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:248:
>     undefined reference to `semanage_fcontext_get_type'
>     /usr/bin/ld: /tmp/libsemanage.so.1.KebOLC.ltrans1.ltrans.o: in
>     function `add_user.isra.0':
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:992:
>     undefined reference to `semanage_user_get_mlslevel'
>     /usr/bin/ld: /tmp/libsemanage.so.1.KebOLC.ltrans1.ltrans.o: in
>     function `write_context_file':
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:892:
>     undefined reference to `semanage_user_key_create'
>     /usr/bin/ld:
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:764:
>     undefined reference to `semanage_user_get_name'
>     /usr/bin/ld:
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:897:
>     undefined reference to `semanage_user_query'
>     /usr/bin/ld:
>     /home/tkloczko/rpmbuild/BUILD/libsemanage-2.9-rc1/src/genhomedircon.c:905:
>     undefined reference to `semanage_user_get_mlslevel'
>
> Include the missing headers.
>
> Fixes: https://github.com/SELinuxProject/selinux/issues/169
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Merged.

> ---
>  libsemanage/src/genhomedircon.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
> index e5f8d3710e8a..d08c88de99a7 100644
> --- a/libsemanage/src/genhomedircon.c
> +++ b/libsemanage/src/genhomedircon.c
> @@ -28,8 +28,10 @@
>  #include <semanage/fcontexts_policy.h>
>  #include <sepol/context.h>
>  #include <sepol/context_record.h>
> +#include "fcontext_internal.h"
>  #include "semanage_store.h"
>  #include "seuser_internal.h"
> +#include "user_internal.h"
>  #include "debug.h"
>
>  #include "utilities.h"
> --
> 2.22.0
>
diff mbox series

Patch

diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
index e5f8d3710e8a..d08c88de99a7 100644
--- a/libsemanage/src/genhomedircon.c
+++ b/libsemanage/src/genhomedircon.c
@@ -28,8 +28,10 @@ 
 #include <semanage/fcontexts_policy.h>
 #include <sepol/context.h>
 #include <sepol/context_record.h>
+#include "fcontext_internal.h"
 #include "semanage_store.h"
 #include "seuser_internal.h"
+#include "user_internal.h"
 #include "debug.h"
 
 #include "utilities.h"