Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8feb8efe authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

tools build feature: Check if get_current_dir_name() is available

As the namespace support code will use this, which is not available in
some non _GNU_SOURCE libraries such as Android's bionic used in my
container build tests (r12b and r15c at the moment).

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-x56ypm940pwclwu45d7jfj47@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent fb50c09e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ FEATURE_TESTS_BASIC := \
        dwarf_getlocations              \
        fortify-source                  \
        sync-compare-and-swap           \
        get_current_dir_name            \
        glibc                           \
        gtk2                            \
        gtk2-infobar                    \
+4 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ FILES= \
         test-dwarf_getlocations.bin            \
         test-fortify-source.bin                \
         test-sync-compare-and-swap.bin         \
         test-get_current_dir_name.bin          \
         test-glibc.bin                         \
         test-gtk2.bin                          \
         test-gtk2-infobar.bin                  \
@@ -101,6 +102,9 @@ $(OUTPUT)test-bionic.bin:
$(OUTPUT)test-libelf.bin:
	$(BUILD) -lelf

$(OUTPUT)test-get_current_dir_name.bin:
	$(BUILD)

$(OUTPUT)test-glibc.bin:
	$(BUILD)

+5 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@
# include "test-libelf-mmap.c"
#undef main

#define main main_test_get_current_dir_name
# include "test-get_current_dir_name.c"
#undef main

#define main main_test_glibc
# include "test-glibc.c"
#undef main
@@ -174,6 +178,7 @@ int main(int argc, char *argv[])
	main_test_hello();
	main_test_libelf();
	main_test_libelf_mmap();
	main_test_get_current_dir_name();
	main_test_glibc();
	main_test_dwarf();
	main_test_dwarf_getlocations();
+10 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#define _GNU_SOURCE
#include <unistd.h>
#include <stdlib.h>

int main(void)
{
	free(get_current_dir_name());
	return 0;
}
+5 −0
Original line number Diff line number Diff line
@@ -299,6 +299,11 @@ ifndef NO_BIONIC
  endif
endif

ifeq ($(feature-get_current_dir_name), 1)
  CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
endif


ifdef NO_LIBELF
  NO_DWARF := 1
  NO_DEMANGLE := 1
Loading