Link against standalone argp library

argp is not part of POSIX standards and not provided by uClibc or
some other standard C libraries.  However, it is possible to link
against a breakout argp library.  One is provided at

    http://www.lysator.liu.se/~nisse/misc/

This patch tests if libc provides argp otherwise it adds the linker
flag -largp where needed in the build system.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
Anthony G. Basile
2015-05-04 02:25:39 +03:00
committed by Mark Wielaard
parent 1ce4a45932
commit 1ab3c2befe
8 changed files with 81 additions and 31 deletions
+5
View File
@@ -1,3 +1,8 @@
2015-05-04 Anthony G. Basile <blueness@gentoo.org>
* configure.ac (argp_LDADD): Check if libc has argp and set
argp_LDADD accordingly.
2015-05-03 Max Filippov <jcmvbkbc@gmail.com>
* configure.ac (DEMANGLE): Fix enable_demangler setting.
+25
View File
@@ -253,6 +253,31 @@ AS_IF([test "x$enable_symbol_versioning" = "xno"],
[AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.])
enable_symbol_versioning=no],[enable_symbol_versioning=yes])
dnl Check if we have argp available from our libc
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include <argp.h>],
[int argc=1; char *argv[]={"test"}; argp_parse(0,argc,argv,0,0,0); return 0;]
)],
[libc_has_argp="true"],
[libc_has_argp="false"]
)
dnl If our libc doesn't provide argp, then test for libargp
if test "$libc_has_argp" = "false" ; then
AC_MSG_WARN("libc does not have argp")
AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
if test "$have_argp" = "false"; then
AC_MSG_ERROR("no libargp found")
else
argp_LDADD="-largp"
fi
else
argp_LDADD=""
fi
AC_SUBST([argp_LDADD])
dnl The directories with content.
dnl Documentation.
+5
View File
@@ -1,3 +1,8 @@
2015-05-04 Anthony G. Basile <blueness@gentoo.org>
* Makefile.am (libdw_so_SOURCES): Append $(argp_LDADD) to link
command.
2015-04-22 Mark Wielaard <mjw@redhat.com>
* memory-access.h (__libdw_max_len_leb128): Take type_len as argument.
+1 -1
View File
@@ -112,7 +112,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-ldl $(zip_LIBS)
-ldl $(argp_LDADD) $(zip_LIBS)
@$(textrel_check)
ln -fs $@ $@.$(VERSION)
+7
View File
@@ -1,3 +1,10 @@
2015-05-04 Anthony G. Basile <blueness@gentoo.org>
* Makefile.am (readelf_LDADD, nm_LDADD, size_LDADD, strip_LDADD)
(ld_LDADD, elflint_LDADD, findtextrel_LDADD, addr2line_LDADD)
(elfcmp_LDADD, objdump_LDADD, ranlib_LDADD, strings_LDADD)
(ar_LDADD, unstrip_LDADD, stack_LDADD): Append $(argp_LDADD).
2015-03-22 Mark Wielaard <mjw@redhat.com>
* readelf.c (print_debug_frame_section): Cast start to Dwarf_Off
+15 -15
View File
@@ -89,27 +89,27 @@ endif
# XXX While the file is not finished, don't warn about this
ldgeneric_no_Wunused = yes
readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl \
readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \
$(demanglelib)
size_LDADD = $(libelf) $(libeu)
strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl
ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl
size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
if NATIVE_LD
# -ldl is always needed for libebl.
ld_LDADD += libld_elf.a
endif
ld_LDFLAGS = -rdynamic
elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl
findtextrel_LDADD = $(libdw) $(libelf)
addr2line_LDADD = $(libdw) $(libelf)
elfcmp_LDADD = $(libebl) $(libelf) -ldl
objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) -ldl
ranlib_LDADD = libar.a $(libelf) $(libeu)
strings_LDADD = $(libelf) $(libeu)
ar_LDADD = libar.a $(libelf) $(libeu)
unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl
stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) -ldl $(demanglelib)
elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
findtextrel_LDADD = $(libdw) $(libelf) $(argp_LDADD)
addr2line_LDADD = $(libdw) $(libelf) $(argp_LDADD)
elfcmp_LDADD = $(libebl) $(libelf) $(argp_LDADD) -ldl
objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl
stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib)
ldlex.o: ldscript.c
ldlex_no_Werror = yes
+8
View File
@@ -1,3 +1,11 @@
2015-05-04 Anthony G. Basile <blueness@gentoo.org>
* Makefile.am (line2addr_LDADD, addrscopes_LDADD, funcscopes_LDADD)
(funcretval_LDADD, allregs_LDADD, find_prologues_LDADD)
(dwflmodtest_LDADD, dwfl_addr_sect_LDADD, addrcfi_LDADD)
(low_high_pc_LDADD, dwflsyms_LDADD, dwfllines_LDADD, varlocs_LDADD)
(backtrace_LDADD, aggregate_size_LDADD): Append $(argp_LDADD).
2015-05-01 Mark Wielaard <mjw@redhat.com>
* run-stack-d-test.sh: Use --raw and mangled output.
+15 -15
View File
@@ -380,12 +380,12 @@ get_lines_LDADD = $(libdw) $(libelf)
get_files_LDADD = $(libdw) $(libelf)
get_aranges_LDADD = $(libdw) $(libelf)
allfcts_LDADD = $(libdw) $(libelf)
line2addr_LDADD = $(libdw)
addrscopes_LDADD = $(libdw)
funcscopes_LDADD = $(libdw)
funcretval_LDADD = $(libdw)
allregs_LDADD = $(libdw)
find_prologues_LDADD = $(libdw)
line2addr_LDADD = $(libdw) $(argp_LDADD)
addrscopes_LDADD = $(libdw) $(argp_LDADD)
funcscopes_LDADD = $(libdw) $(argp_LDADD)
funcretval_LDADD = $(libdw) $(argp_LDADD)
allregs_LDADD = $(libdw) $(argp_LDADD)
find_prologues_LDADD = $(libdw) $(argp_LDADD)
#show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf)
asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) -ldl
asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) -ldl
@@ -396,31 +396,31 @@ asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) -ldl
asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) -ldl
asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) -ldl
asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) -ldl
dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) -ldl
dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) -ldl
rdwrmmap_LDADD = $(libelf)
dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) -ldl
arls_LDADD = $(libelf)
dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) -ldl
dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) -ldl
dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) -ldl
dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) -ldl
dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) -ldl
dwarf_getmacros_LDADD = $(libdw)
dwarf_ranges_LDADD = $(libdw)
dwarf_getstring_LDADD = $(libdw)
addrcfi_LDADD = $(libdw) $(libebl) $(libelf) -ldl
addrcfi_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) -ldl
test_flag_nobits_LDADD = $(libelf)
rerequest_tag_LDADD = $(libdw)
alldts_LDADD = $(libebl) $(libelf)
md5_sha1_test_LDADD = $(libeu)
typeiter_LDADD = $(libdw) $(libelf)
typeiter2_LDADD = $(libdw) $(libelf)
low_high_pc_LDADD = $(libdw) $(libelf)
low_high_pc_LDADD = $(libdw) $(libelf) $(argp_LDADD)
test_elf_cntl_gelf_getshdr_LDADD = $(libelf)
dwflsyms_LDADD = $(libdw) $(libelf)
dwfllines_LDADD = $(libdw) $(libelf)
dwflsyms_LDADD = $(libdw) $(libelf) $(argp_LDADD)
dwfllines_LDADD = $(libdw) $(libelf) $(argp_LDADD)
dwfl_report_elf_align_LDADD = $(libdw)
varlocs_LDADD = $(libdw) $(libelf)
backtrace_LDADD = $(libdw) $(libelf)
varlocs_LDADD = $(libdw) $(libelf) $(argp_LDADD)
backtrace_LDADD = $(libdw) $(libelf) $(argp_LDADD)
# backtrace-child-biarch also uses those *_CFLAGS and *_LDLAGS variables:
backtrace_child_CFLAGS = -fPIE
backtrace_child_LDFLAGS = -pie -pthread
@@ -434,7 +434,7 @@ buildid_LDADD = $(libdw) $(libelf)
deleted_LDADD = ./deleted-lib.so
deleted_lib_so_LDFLAGS = -shared -rdynamic
deleted_lib_so_CFLAGS = -fPIC -fasynchronous-unwind-tables
aggregate_size_LDADD = $(libdw) $(libelf)
aggregate_size_LDADD = $(libdw) $(libelf) $(argp_LDADD)
vdsosyms_LDADD = $(libdw) $(libelf)
getsrc_die_LDADD = $(libdw) $(libelf)
strptr_LDADD = $(libelf)