Mark, Anthony, Daniel,
this series fixes build errors that occur when building elfutils with uClibc-based toolchain. Most of the patches are taken from [1] and forward-ported to the current git master.
[1] https://bugs.gentoo.org/show_bug.cgi?id=470884
Anthony G. Basile (3): Link against standalone argp library Fall back on utimes if futimes is not available Remove DL_CALL_FCT wrapper which is used in profiling
Daniel Guzman (1): Use -lintl when libc doesn't provide dgettext
Max Filippov (2): Drop mtrace calls. Provide assert_perror when it's not defined
ChangeLog | 14 +++++++++++ configure.ac | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ libasm/ChangeLog | 4 ++++ libasm/Makefile.am | 1 + libdw/ChangeLog | 10 ++++++++ libdw/Makefile.am | 2 +- libelf/ChangeLog | 4 ++++ libelf/Makefile.am | 1 + src/ChangeLog | 36 ++++++++++++++++++++++++++++ src/Makefile.am | 30 ++++++++++++------------ src/addr2line.c | 4 ---- src/ar.c | 12 ++++++---- src/ld.c | 6 ----- src/ld.h | 3 +++ src/nm.c | 4 ---- src/objdump.c | 4 ---- src/ranlib.c | 4 ---- src/size.c | 4 ---- src/strip.c | 22 +++++++++++++----- src/unstrip.c | 4 ---- tests/ChangeLog | 22 ++++++++++++++++++ tests/Makefile.am | 30 ++++++++++++------------ tests/backtrace-child.c | 13 +++++++++++ tests/backtrace-data.c | 12 ++++++++++ tests/backtrace-dwarf.c | 12 ++++++++++ tests/backtrace.c | 12 ++++++++++ 26 files changed, 260 insertions(+), 72 deletions(-)
From: "Anthony G. Basile" blueness@gentoo.org
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 --- ChangeLog | 5 +++++ configure.ac | 25 +++++++++++++++++++++++++ libdw/ChangeLog | 5 +++++ libdw/Makefile.am | 2 +- src/ChangeLog | 7 +++++++ src/Makefile.am | 30 +++++++++++++++--------------- tests/ChangeLog | 8 ++++++++ tests/Makefile.am | 30 +++++++++++++++--------------- 8 files changed, 81 insertions(+), 31 deletions(-)
diff --git a/ChangeLog b/ChangeLog index f727bf2..d3e46fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/configure.ac b/configure.ac index 7ba4d11..68b7f5b 100644 --- a/configure.ac +++ b/configure.ac @@ -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. diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 739e0f6..fd3e4ad 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -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. diff --git a/libdw/Makefile.am b/libdw/Makefile.am index 272289c..2299b2f 100644 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@ -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)
diff --git a/src/ChangeLog b/src/ChangeLog index a4ac4e4..0aa85ee 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index 7a25374..ab5364f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/tests/ChangeLog b/tests/ChangeLog index 0556b1f..11e96a7 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -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. diff --git a/tests/Makefile.am b/tests/Makefile.am index f94bd67..fdbf5bf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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)
On Mon, May 04, 2015 at 02:25:39AM +0300, Max Filippov wrote:
From: "Anthony G. Basile" blueness@gentoo.org
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.
Thanks. Applied and pushed to master. But anybody relying on this is on their own. There is some risk of bit-rot in the test suite when more tests are added that rely on the argp hepers. And as you know the current implementation of standalone argp is buggy and needs at least your isprint.
Cheers,
Mark
mtrace is a GNU extension not supported by uClibc and it's believed to not be really used. Drop mtrace() calls and #include <mcheck.h>.
Signed-off-by: Max Filippov jcmvbkbc@gmail.com --- src/ChangeLog | 12 ++++++++++++ src/addr2line.c | 4 ---- src/ar.c | 4 ---- src/ld.c | 6 ------ src/nm.c | 4 ---- src/objdump.c | 4 ---- src/ranlib.c | 4 ---- src/size.c | 4 ---- src/strip.c | 4 ---- src/unstrip.c | 4 ---- 10 files changed, 12 insertions(+), 38 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog index 0aa85ee..957eeb3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2015-05-04 Max Filippov jcmvbkbc@gmail.com + + * addr2line.c (main): Drop mtrace() call and #include <mcheck.h>. + * ar.c: Likewise. + * ld.c: Likewise. + * nm.c: Likewise. + * objdump.c: Likewise. + * ranlib.c: Likewise. + * size.c: Likewise. + * strip.c: Likewise. + * unstrip.c: Likewise. + 2015-05-04 Anthony G. Basile blueness@gentoo.org
* Makefile.am (readelf_LDADD, nm_LDADD, size_LDADD, strip_LDADD) diff --git a/src/addr2line.c b/src/addr2line.c index de80294..281a91e 100644 --- a/src/addr2line.c +++ b/src/addr2line.c @@ -30,7 +30,6 @@ #include <dwarf.h> #include <libintl.h> #include <locale.h> -#include <mcheck.h> #include <stdbool.h> #include <stdio.h> #include <stdio_ext.h> @@ -131,9 +130,6 @@ main (int argc, char *argv[]) int remaining; int result = 0;
- /* Make memory leak detection possible. */ - mtrace (); - /* We use no threads here which can interfere with handling a stream. */ (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER);
diff --git a/src/ar.c b/src/ar.c index f51f0ef..caed7f3 100644 --- a/src/ar.c +++ b/src/ar.c @@ -28,7 +28,6 @@ #include <libintl.h> #include <limits.h> #include <locale.h> -#include <mcheck.h> #include <search.h> #include <stdbool.h> #include <stdlib.h> @@ -141,9 +140,6 @@ static enum { ipos_none, ipos_before, ipos_after } ipos; int main (int argc, char *argv[]) { - /* Make memory leak detection possible. */ - mtrace (); - /* We use no threads here which can interfere with handling a stream. */ (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); diff --git a/src/ld.c b/src/ld.c index 73e4f04..6e96ae2 100644 --- a/src/ld.c +++ b/src/ld.c @@ -26,7 +26,6 @@ #include <libelf.h> #include <libintl.h> #include <locale.h> -#include <mcheck.h> #include <stdio.h> #include <stdio_ext.h> #include <stdlib.h> @@ -277,11 +276,6 @@ main (int argc, char *argv[]) int remaining; int err;
-#ifndef NDEBUG - /* Enable memory debugging. */ - mtrace (); -#endif - /* Sanity check. We always want to use the LFS functionality. */ if (sizeof (off_t) != sizeof (off64_t)) abort (); diff --git a/src/nm.c b/src/nm.c index 67fb4c2..b6a1e6e 100644 --- a/src/nm.c +++ b/src/nm.c @@ -33,7 +33,6 @@ #include <libdw.h> #include <libintl.h> #include <locale.h> -#include <mcheck.h> #include <obstack.h> #include <search.h> #include <stdbool.h> @@ -217,9 +216,6 @@ main (int argc, char *argv[]) int remaining; int result = 0;
- /* Make memory leak detection possible. */ - mtrace (); - /* We use no threads here which can interfere with handling a stream. */ (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); diff --git a/src/objdump.c b/src/objdump.c index b689024..0aa41e8 100644 --- a/src/objdump.c +++ b/src/objdump.c @@ -26,7 +26,6 @@ #include <inttypes.h> #include <libintl.h> #include <locale.h> -#include <mcheck.h> #include <stdbool.h> #include <stdio.h> #include <stdio_ext.h> @@ -131,9 +130,6 @@ static bool print_disasm; int main (int argc, char *argv[]) { - /* Make memory leak detection possible. */ - mtrace (); - /* We use no threads here which can interfere with handling a stream. */ (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); diff --git a/src/ranlib.c b/src/ranlib.c index 8435fc1..c93c5ac 100644 --- a/src/ranlib.c +++ b/src/ranlib.c @@ -29,7 +29,6 @@ #include <gelf.h> #include <libintl.h> #include <locale.h> -#include <mcheck.h> #include <obstack.h> #include <stdlib.h> #include <stdio.h> @@ -78,9 +77,6 @@ static const struct argp argp = int main (int argc, char *argv[]) { - /* Make memory leak detection possible. */ - mtrace (); - /* We use no threads here which can interfere with handling a stream. */ (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); diff --git a/src/size.c b/src/size.c index 0ec1139..7c03cce 100644 --- a/src/size.c +++ b/src/size.c @@ -28,7 +28,6 @@ #include <libelf.h> #include <libintl.h> #include <locale.h> -#include <mcheck.h> #include <stdbool.h> #include <stdio.h> #include <stdio_ext.h> @@ -160,9 +159,6 @@ main (int argc, char *argv[]) int remaining; int result = 0;
- /* Make memory leak detection possible. */ - mtrace (); - /* We use no threads here which can interfere with handling a stream. */ __fsetlocking (stdin, FSETLOCKING_BYCALLER); __fsetlocking (stdout, FSETLOCKING_BYCALLER); diff --git a/src/strip.c b/src/strip.c index c003647..e81001e 100644 --- a/src/strip.c +++ b/src/strip.c @@ -30,7 +30,6 @@ #include <libelf.h> #include <libintl.h> #include <locale.h> -#include <mcheck.h> #include <stdbool.h> #include <stdio.h> #include <stdio_ext.h> @@ -155,9 +154,6 @@ main (int argc, char *argv[]) int remaining; int result = 0;
- /* Make memory leak detection possible. */ - mtrace (); - /* We use no threads here which can interfere with handling a stream. */ __fsetlocking (stdin, FSETLOCKING_BYCALLER); __fsetlocking (stdout, FSETLOCKING_BYCALLER); diff --git a/src/unstrip.c b/src/unstrip.c index 989ac5f..4a8e5fa 100644 --- a/src/unstrip.c +++ b/src/unstrip.c @@ -36,7 +36,6 @@ #include <fnmatch.h> #include <libintl.h> #include <locale.h> -#include <mcheck.h> #include <stdbool.h> #include <stdio.h> #include <stdio_ext.h> @@ -2252,9 +2251,6 @@ handle_implicit_modules (const struct arg_info *info) int main (int argc, char **argv) { - /* Make memory leak detection possible. */ - mtrace (); - /* We use no threads here which can interfere with handling a stream. */ __fsetlocking (stdin, FSETLOCKING_BYCALLER); __fsetlocking (stdout, FSETLOCKING_BYCALLER);
From: "Anthony G. Basile" blueness@gentoo.org
We check if futimes is provided, and if it is not, we fall back on utimes which is POSIX.
Signed-off-by: Anthony G. Basile blueness@gentoo.org [Max: move futimes/utimes in strip.c into 'if (tvp != NULL)' blocks.] Signed-off-by: Max Filippov jcmvbkbc@gmail.com --- ChangeLog | 4 ++++ configure.ac | 3 +++ src/ChangeLog | 6 ++++++ src/ar.c | 8 +++++++- src/strip.c | 18 ++++++++++++++++-- 5 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index d3e46fc..89045ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-05-04 Anthony G. Basile blueness@gentoo.org
+ * configure.ac (futimes): Check if function exists. + +2015-05-04 Anthony G. Basile blueness@gentoo.org + * configure.ac (argp_LDADD): Check if libc has argp and set argp_LDADD accordingly.
diff --git a/configure.ac b/configure.ac index 68b7f5b..35dfa08 100644 --- a/configure.ac +++ b/configure.ac @@ -278,6 +278,9 @@ else fi AC_SUBST([argp_LDADD])
+dnl Check for futimes +AC_CHECK_FUNC([futimes]) + dnl The directories with content.
dnl Documentation. diff --git a/src/ChangeLog b/src/ChangeLog index 957eeb3..2ee0d1d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2015-05-04 Anthony G. Basile blueness@gentoo.org + + * ar.c (do_oper_extract): Use futimes or utimes depending on + HAVE_FUTIMES. + * strip.c (handle_elf, handle_ar): Likewise. + 2015-05-04 Max Filippov jcmvbkbc@gmail.com
* addr2line.c (main): Drop mtrace() call and #include <mcheck.h>. diff --git a/src/ar.c b/src/ar.c index caed7f3..6882ced 100644 --- a/src/ar.c +++ b/src/ar.c @@ -685,7 +685,13 @@ do_oper_extract (int oper, const char *arfname, char **argv, int argc, tv[1].tv_sec = arhdr->ar_date; tv[1].tv_usec = 0;
- if (unlikely (futimes (xfd, tv) != 0)) + int success; +#ifdef HAVE_FUTIMES + success = futimes (xfd, tv); +#else + success = utimes (arhdr->ar_name, tv); +#endif + if (unlikely (success != 0)) { error (0, errno, gettext ("cannot change modification time of %s"), diff --git a/src/strip.c b/src/strip.c index e81001e..07b7dc5 100644 --- a/src/strip.c +++ b/src/strip.c @@ -2087,7 +2087,14 @@ while computing checksum for debug information")); /* If requested, preserve the timestamp. */ if (tvp != NULL) { - if (futimes (fd, tvp) != 0) + int success; +#ifdef HAVE_FUTIMES + success = futimes (fd, tvp); +#else + success = utimes (fname, tvp); +#endif + + if (success != 0) { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), @@ -2144,7 +2151,14 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
if (tvp != NULL) { - if (unlikely (futimes (fd, tvp) != 0)) + int success; +#ifdef HAVE_FUTIMES + success = futimes (fd, tvp); +#else + success = utimes (fname, tvp); +#endif + + if (unlikely (success != 0)) { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), fname);
On 04 May 2015 02:25, Max Filippov wrote:
From: "Anthony G. Basile" blueness@gentoo.org
We check if futimes is provided, and if it is not, we fall back on utimes which is POSIX.
imo we should use futimens everywhere. that is in POSIX. -mike
On Mon, May 4, 2015 at 8:58 AM, Mike Frysinger vapier@gentoo.org wrote:
On 04 May 2015 02:25, Max Filippov wrote:
From: "Anthony G. Basile" blueness@gentoo.org
We check if futimes is provided, and if it is not, we fall back on utimes which is POSIX.
imo we should use futimens everywhere. that is in POSIX. -mike
Ok, I've changed that.
On Mon, May 04, 2015 at 01:58:57AM -0400, Mike Frysinger wrote:
On 04 May 2015 02:25, Max Filippov wrote:
From: "Anthony G. Basile" blueness@gentoo.org
We check if futimes is provided, and if it is not, we fall back on utimes which is POSIX.
imo we should use futimens everywhere. that is in POSIX.
Agreed. Then we don't need any extra conditionals.
Almost exactly that is already on the portable branch.
On Tue, 2015-05-05 at 12:26 -0700, Roland McGrath wrote:
Almost exactly that is already on the portable branch.
I would like to get rid of the portable branch. It is only there for really ancient glibc versions (which don't have futimens). I do still update the branch and test it against RHEL5 just before each release. But my intention is to do it one last time for the next 0.162 release, and then just get rid of it.
Nobody really should be using it unless they are using glibc <= 2.5, kernel <= 2.6.18 or gcc < 4.4. Hopefully by now those are really ancient memory.
Cheers,
Mark
Hi -
I would like to get rid of the portable branch. [...]
What is the argument against getting rid of the portable branch by merging it into master?
Nobody really should be using it unless they are using glibc <= 2.5, kernel <= 2.6.18 or gcc < 4.4. Hopefully by now those are really ancient memory. [...]
(e.g. RHEL5 is supported till 2020.)
- FChE
On Wed, 2015-05-06 at 07:22 -0400, Frank Ch. Eigler wrote:
I would like to get rid of the portable branch. [...]
What is the argument against getting rid of the portable branch by merging it into master?
It contains hacks that we don't want to have on master because they either just conflict with current standards/implementations (like using %a in scanf instead of %m), inefficient (busy looping to detect process state changes, because of buggy kernels), have conditional code paths (which are a pain to maintain/keep working and obscure the code) or have workarounds that are subtly wrong (like in this case where switching back to path based file manipulation after already having opened and checked a file descriptor might open up possible security issues because of Time-of-check Time-of-use race conditions).
If there are specific hacks you would like to see brought over from the portable branch to master, please do propose and we can discuss them. But I really think none of them are needed or should be used these days.
Cheers,
Mark
On 06 May 2015 13:37, Mark Wielaard wrote:
On Wed, 2015-05-06 at 07:22 -0400, Frank Ch. Eigler wrote:
I would like to get rid of the portable branch. [...]
What is the argument against getting rid of the portable branch by merging it into master?
It contains hacks that we don't want to have on master because they either just conflict with current standards/implementations (like using %a in scanf instead of %m), inefficient (busy looping to detect process state changes, because of buggy kernels), have conditional code paths (which are a pain to maintain/keep working and obscure the code) or have workarounds that are subtly wrong (like in this case where switching back to path based file manipulation after already having opened and checked a file descriptor might open up possible security issues because of Time-of-check Time-of-use race conditions).
If there are specific hacks you would like to see brought over from the portable branch to master, please do propose and we can discuss them. But I really think none of them are needed or should be used these days.
there's still the issue of --disable-werror -mike
On Thu, 2015-05-07 at 22:08 -0400, Mike Frysinger wrote:
If there are specific hacks you would like to see brought over from the portable branch to master, please do propose and we can discuss them. But I really think none of them are needed or should be used these days.
there's still the issue of --disable-werror
I believe we discussed before, but could you remind me why it is necessary for newer GCC versions?
If there are any warnings that are turned into errors we should really just fix them. Do you have any specific examples?
What does the configure option add over just using CFLAGS=-Wno-error?
Thanks,
Mark
On 13 May 2015 16:18, Mark Wielaard wrote:
On Thu, 2015-05-07 at 22:08 -0400, Mike Frysinger wrote:
If there are specific hacks you would like to see brought over from the portable branch to master, please do propose and we can discuss them. But I really think none of them are needed or should be used these days.
there's still the issue of --disable-werror
I believe we discussed before, but could you remind me why it is necessary for newer GCC versions?
If there are any warnings that are turned into errors we should really just fix them. Do you have any specific examples?
What does the configure option add over just using CFLAGS=-Wno-error?
because you guys (reasonably) cannot test every gcc/C library version/flags/arch combination. focusing on newer versions makes sense, but not all distros are always running the latest. i also agree that having it default to on is ok and some distros which have tight control over everything (like fedora) will set it to on. but i think that should be left to the distro to control. in practice, we already are either by `sed` or patching in the werror configure flag.
keep in mind that not all warnings are even correct -- gcc has false positives from time to time. trying to track how to squelch those across multiple gcc versions is a waste of time.
i don't have specific examples readily available ... we noticed in Gentoo when users report via irc (which has no logs). i know some more extensive flags like lto and inline can often trigger unresolvable warnings about functions not being inlined. -mike
Hi -
[...] because you guys (reasonably) cannot test every gcc/C library version/flags/arch combination. [...]
Exactly - and even we encountered the downsides of this as fedora/rawhide moved between different patches of gcc 5.* that had different warning policies.
- FChE
On Wed, May 13, 2015 at 12:17:58PM -0400, Frank Ch. Eigler wrote:
[...] because you guys (reasonably) cannot test every gcc/C library version/flags/arch combination. [...]
Exactly - and even we encountered the downsides of this as fedora/rawhide moved between different patches of gcc 5.* that had different warning policies.
As far as I know when gcc 5.* started to report new issues we fixed them in Fedora and backported them when they made sense.
I really am a fan of fixing compiler warnings, they very often do point out something that needs attention. I also really would like to know what the advantage of a new configure option is over users being able to set their own CFLAGS with -Wno-error included if they feel that is necessary.
Cheers,
Mark
Hi Mike,
On Wed, May 13, 2015 at 12:09:50PM -0400, Mike Frysinger wrote:
On 13 May 2015 16:18, Mark Wielaard wrote:
On Thu, 2015-05-07 at 22:08 -0400, Mike Frysinger wrote:
If there are specific hacks you would like to see brought over from the portable branch to master, please do propose and we can discuss them. But I really think none of them are needed or should be used these days.
there's still the issue of --disable-werror
I believe we discussed before, but could you remind me why it is necessary for newer GCC versions?
If there are any warnings that are turned into errors we should really just fix them. Do you have any specific examples?
What does the configure option add over just using CFLAGS=-Wno-error?
because you guys (reasonably) cannot test every gcc/C library version/flags/arch combination. focusing on newer versions makes sense, but not all distros are always running the latest. i also agree that having it default to on is ok and some distros which have tight control over everything (like fedora) will set it to on. but i think that should be left to the distro to control. in practice, we already are either by `sed` or patching in the werror configure flag.
Sure, but if you are using none supported versions of gcc and glibc you are on your own already and will have to patch yourself. For the rest we would really be error free. I do hope to setup a buildbot soon with slaves for most supported arches to catch any issues early.
What is the advantage of --disable-werror over using CFLAGS=-Wno-error?
keep in mind that not all warnings are even correct -- gcc has false positives from time to time. trying to track how to squelch those across multiple gcc versions is a waste of time.
I don't think so (for a reasonable number of gcc versions). We pick the enabled warning flags carefully and make sure no warnings slip through (possible disabling them per file if necessary). If we enable specific warnings in elfutils they have often caught important bugs that really should be fixed.
Cheers,
Mark
From: "Anthony G. Basile" blueness@gentoo.org
DL_CALL_FCT is defined in <bits/dlfcn.h> on glibc systems and is a macro for calling functions in shared objects with dlsym. This is useful for profiling since these functions would otherwise not use the PLT and so not be counted when profiling with gprof.
Signed-off-by: Anthony G. Basile blueness@gentoo.org --- src/ChangeLog | 4 ++++ src/ld.h | 3 +++ 2 files changed, 7 insertions(+)
diff --git a/src/ChangeLog b/src/ChangeLog index 2ee0d1d..2bb2f0b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2015-05-04 Anthony G. Basile blueness@gentoo.org
+ * ld.h (DL_CALL_FCT): Define if this macro is undefined. + +2015-05-04 Anthony G. Basile blueness@gentoo.org + * ar.c (do_oper_extract): Use futimes or utimes depending on HAVE_FUTIMES. * strip.c (handle_elf, handle_ar): Likewise. diff --git a/src/ld.h b/src/ld.h index 29f4031..e64649c 100644 --- a/src/ld.h +++ b/src/ld.h @@ -24,6 +24,9 @@ #include <stdio.h> #include "xelf.h"
+#ifndef DL_CALL_FCT +#define DL_CALL_FCT(f, a) f a +#endif
/* Recommended size of the buffer passed to ld_strerror. */ #define ERRBUFSIZE (512)
On 04 May 2015 02:25, Max Filippov wrote:
From: "Anthony G. Basile" blueness@gentoo.org
DL_CALL_FCT is defined in <bits/dlfcn.h> on glibc systems and is a macro for calling functions in shared objects with dlsym. This is useful for profiling since these functions would otherwise not use the PLT and so not be counted when profiling with gprof.
uClibc supports gprof optionally, so i'd be fine with adding this to uClibc. at the very least, the stub would be OK. -mike
Hi Mike,
On Mon, May 4, 2015 at 9:14 AM, Mike Frysinger vapier@gentoo.org wrote:
On 04 May 2015 02:25, Max Filippov wrote:
From: "Anthony G. Basile" blueness@gentoo.org
DL_CALL_FCT is defined in <bits/dlfcn.h> on glibc systems and is a macro for calling functions in shared objects with dlsym. This is useful for profiling since these functions would otherwise not use the PLT and so not be counted when profiling with gprof.
uClibc supports gprof optionally, so i'd be fine with adding this to uClibc. at the very least, the stub would be OK.
Ok, I'll drop this patch and submit similar stub to uClibc instead. BTW, I though uClibc does not support profiling at all. Can you point me to the documentation/code for that optional gprof support?
On 04 May 2015 18:09, Max Filippov wrote:
On Mon, May 4, 2015 at 9:14 AM, Mike Frysinger wrote:
On 04 May 2015 02:25, Max Filippov wrote:
From: "Anthony G. Basile" blueness@gentoo.org
DL_CALL_FCT is defined in <bits/dlfcn.h> on glibc systems and is a macro for calling functions in shared objects with dlsym. This is useful for profiling since these functions would otherwise not use the PLT and so not be counted when profiling with gprof.
uClibc supports gprof optionally, so i'd be fine with adding this to uClibc. at the very least, the stub would be OK.
Ok, I'll drop this patch and submit similar stub to uClibc instead. BTW, I though uClibc does not support profiling at all. Can you point me to the documentation/code for that optional gprof support?
i could have sworn we had it. maybe i'm confusing some history in my mind. even if it doesn't, having a macro that stubs it out costs us nothing and increases compatibility with glibc. we don't take a hard POSIX stance like other libraries. -mike
From: Daniel Guzman daniel@guzman.io
dgettext is usually provided directly by libc, but when using uClibc, the macro is expanded to libintl_dgettext, which is provided by libintl. This causes a compilation failure, so this patch fixes that by explicitly checking if the libc provides dgettext, then checking if libintl provides it and mending the linker flags if so. If not, configure will properly fail.
Signed-off-by: Daniel Guzman daniel@guzman.io Signed-off-by: Max Filippov jcmvbkbc@gmail.com --- ChangeLog | 5 +++++ configure.ac | 34 ++++++++++++++++++++++++++++++++++ libasm/ChangeLog | 4 ++++ libasm/Makefile.am | 1 + libdw/ChangeLog | 5 +++++ libdw/Makefile.am | 2 +- libelf/ChangeLog | 4 ++++ libelf/Makefile.am | 1 + src/ChangeLog | 7 +++++++ src/Makefile.am | 30 +++++++++++++++--------------- tests/ChangeLog | 7 +++++++ tests/Makefile.am | 20 ++++++++++---------- 12 files changed, 94 insertions(+), 26 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 89045ef..e86032b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-05-04 Daniel Guzman daniel@guzman.io + + * configure.ac (intl_LDADD): Check if libc has dgettext and if + libintl is available and set intl_LDADD accordingly. + 2015-05-04 Anthony G. Basile blueness@gentoo.org
* configure.ac (futimes): Check if function exists. diff --git a/configure.ac b/configure.ac index 35dfa08..0b9218f 100644 --- a/configure.ac +++ b/configure.ac @@ -278,6 +278,40 @@ else fi AC_SUBST([argp_LDADD])
+dnl Check if we have dgettext available from our libc +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include <libintl.h>], + [char *test=dgettext("test","test"); return 0;] + )], + [libc_has_dgettext="true"], + [libc_has_dgettext="false"] +) + +dnl If our libc doesn't provide dgettext, then test for libintl support +if test "$libc_has_dgettext" = "false" ; then + OLD_LIBS="$LIBS" + LIBS="$OLD_LIBS -lintl" + AC_MSG_WARN("libc does not have dgettext") + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include <libintl.h>], + [char *test=dgettext("test","test"); return 0;] + )], + [libintl_has_dgettext="true"], + [libintl_has_dgettext="false"] + ) + if test "$libintl_has_dgettext" = "false"; then + AC_MSG_ERROR("no libintl with dgettext found") + else + intl_LDADD="-lintl" + fi + LIBS="$OLD_LIBS" +else + intl_LDADD="" +fi +AC_SUBST([intl_LDADD]) + dnl Check for futimes AC_CHECK_FUNC([futimes])
diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 9b25af9..5d63e07 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,7 @@ +2015-05-04 Daniel Guzman daniel@guzman.io + + * Makefile.am (libasm_so_LDLIBS): Append $(intl_LDADD). + 2014-12-18 Ulrich Drepper drepper@gmail.com
* Makefile.am: Suppress output of textrel_check command. diff --git a/libasm/Makefile.am b/libasm/Makefile.am index 6ea2a8e..ec1ce1a 100644 --- a/libasm/Makefile.am +++ b/libasm/Makefile.am @@ -56,6 +56,7 @@ libasm_pic_a_SOURCES = am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
libasm_so_LDLIBS = +libasm_so_LDLIBS += $(intl_LDADD) if USE_LOCKS libasm_so_LDLIBS += -lpthread endif diff --git a/libdw/ChangeLog b/libdw/ChangeLog index fd3e4ad..d165ffe 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2015-05-04 Daniel Guzman daniel@guzman.io + + * Makefile.am (libdw_so_SOURCES): Append $(intl_LDADD) to link + command. + 2015-05-04 Anthony G. Basile blueness@gentoo.org
* Makefile.am (libdw_so_SOURCES): Append $(argp_LDADD) to link diff --git a/libdw/Makefile.am b/libdw/Makefile.am index 2299b2f..b1c5312 100644 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@ -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 $(argp_LDADD) $(zip_LIBS) + -ldl $(argp_LDADD) $(intl_LDADD) $(zip_LIBS) @$(textrel_check) ln -fs $@ $@.$(VERSION)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog index a1b0ee4..8bc086e 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2015-05-04 Daniel Guzman daniel@guzman.io + + * Makefile.am (libelf_so_LDLIBS): Append $(intl_LDADD). + 2015-03-28 Mark Wielaard mjw@redhat.com
* elf.h: Update from glibc. diff --git a/libelf/Makefile.am b/libelf/Makefile.am index afcb2aa..6361cf2 100644 --- a/libelf/Makefile.am +++ b/libelf/Makefile.am @@ -94,6 +94,7 @@ libelf_pic_a_SOURCES = am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
libelf_so_LDLIBS = +libelf_so_LDLIBS += $(intl_LDADD) if USE_LOCKS libelf_so_LDLIBS += -lpthread endif diff --git a/src/ChangeLog b/src/ChangeLog index 2bb2f0b..af80c1d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2015-05-04 Daniel Guzman daniel@guzman.io + + * 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 $(intl_LDADD). + 2015-05-04 Anthony G. Basile blueness@gentoo.org
* ld.h (DL_CALL_FCT): Define if this macro is undefined. diff --git a/src/Makefile.am b/src/Makefile.am index ab5364f..b606e09 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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) $(argp_LDADD) -ldl -nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \ +readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) -ldl +nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) -ldl \ $(demanglelib) -size_LDADD = $(libelf) $(libeu) $(argp_LDADD) -strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl -ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl +size_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) +strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) -ldl +ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(intl_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) $(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) +elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) -ldl +findtextrel_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(intl_LDADD) +addr2line_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(intl_LDADD) +elfcmp_LDADD = $(libebl) $(libelf) $(argp_LDADD) $(intl_LDADD) -ldl +objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) -ldl +ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) +strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) +ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(intl_LDADD) +unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(intl_LDADD) -ldl +stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(intl_LDADD) -ldl $(demanglelib)
ldlex.o: ldscript.c ldlex_no_Werror = yes diff --git a/tests/ChangeLog b/tests/ChangeLog index 11e96a7..f5d9a1b 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2015-05-04 Daniel Guzman daniel@guzman.io + + * 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): Append $(intl_LDADD). + 2015-05-04 Anthony G. Basile blueness@gentoo.org
* Makefile.am (line2addr_LDADD, addrscopes_LDADD, funcscopes_LDADD) diff --git a/tests/Makefile.am b/tests/Makefile.am index fdbf5bf..f64742f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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) $(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) +line2addr_LDADD = $(libdw) $(argp_LDADD) $(intl_LDADD) +addrscopes_LDADD = $(libdw) $(argp_LDADD) $(intl_LDADD) +funcscopes_LDADD = $(libdw) $(argp_LDADD) $(intl_LDADD) +funcretval_LDADD = $(libdw) $(argp_LDADD) $(intl_LDADD) +allregs_LDADD = $(libdw) $(argp_LDADD) $(intl_LDADD) +find_prologues_LDADD = $(libdw) $(argp_LDADD) $(intl_LDADD) #show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) -ldl asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) -ldl @@ -396,25 +396,25 @@ 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) $(argp_LDADD) -ldl +dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) $(intl_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) $(argp_LDADD) -ldl +dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) $(intl_LDADD) -ldl dwarf_getmacros_LDADD = $(libdw) dwarf_ranges_LDADD = $(libdw) dwarf_getstring_LDADD = $(libdw) -addrcfi_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) -ldl +addrcfi_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) $(intl_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) $(argp_LDADD) +low_high_pc_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(intl_LDADD) test_elf_cntl_gelf_getshdr_LDADD = $(libelf) dwflsyms_LDADD = $(libdw) $(libelf) $(argp_LDADD) dwfllines_LDADD = $(libdw) $(libelf) $(argp_LDADD)
On 04 May 2015 02:25, Max Filippov wrote:
[char *test=dgettext("test","test"); return 0;]
these tests might be a little more robust if you return the value: return dgettext("test","test") != NULL;
that said, i think you can drop all of this custom logic. elfutils uses gettext, which means it should call AM_GNU_GETTEXT. once you do that, gettext already sets up $LIBINTL for you and exports it to makefiles.
elfutils used to use this macro, but Ulrich dropped it back in 2005 which is before the git history started, although i doubt he provided a useful commit message in the first place.
maybe something like this ? i picked 0.18.2 merely becuase that's what is listed in m4/gettext.m4 already. -mike
--- a/configure.ac +++ b/configure.ac @@ -71,6 +71,7 @@ AS_IF([test "$use_locks" = yes], AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
AC_PROG_CC +AC_USE_SYSTEM_EXTENSIONS AC_PROG_RANLIB AC_PROG_YACC AM_PROG_LEX @@ -258,10 +259,8 @@ dnl Test suite. AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see. AC_CONFIG_FILES([tests/Makefile])
-# Get the definitions necessary to create the Makefiles in the po -# subdirectories. This is a small subset of the gettext rules. -AC_SUBST(USE_NLS, yes) -AM_PO_SUBDIRS +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([0.18.2])
dnl Appended to the config.h file. dnl We hide all kinds of configuration magic in lib/eu-config.h.
Hi Mike,
On Mon, May 4, 2015 at 9:12 AM, Mike Frysinger vapier@gentoo.org wrote:
On 04 May 2015 02:25, Max Filippov wrote:
[char *test=dgettext("test","test"); return 0;]
these tests might be a little more robust if you return the value: return dgettext("test","test") != NULL;
that said, i think you can drop all of this custom logic. elfutils uses gettext, which means it should call AM_GNU_GETTEXT. once you do that, gettext already sets up $LIBINTL for you and exports it to makefiles.
elfutils used to use this macro, but Ulrich dropped it back in 2005 which is before the git history started, although i doubt he provided a useful commit message in the first place.
maybe something like this ? i picked 0.18.2 merely becuase that's what is listed in m4/gettext.m4 already. -mike
--- a/configure.ac +++ b/configure.ac @@ -71,6 +71,7 @@ AS_IF([test "$use_locks" = yes], AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
AC_PROG_CC +AC_USE_SYSTEM_EXTENSIONS AC_PROG_RANLIB AC_PROG_YACC AM_PROG_LEX @@ -258,10 +259,8 @@ dnl Test suite. AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see. AC_CONFIG_FILES([tests/Makefile])
-# Get the definitions necessary to create the Makefiles in the po -# subdirectories. This is a small subset of the gettext rules. -AC_SUBST(USE_NLS, yes) -AM_PO_SUBDIRS +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([0.18.2])
This doesn't work (as I'd expect): LIBINTL is empty in the config.log and the build fails in the absence of -lintl in e.g. libelf and libdw.
assert_perror is a GNU extension and is not provided by uClibc. Provide definition when that macro is not available.
Signed-off-by: Max Filippov jcmvbkbc@gmail.com --- tests/ChangeLog | 7 +++++++ tests/backtrace-child.c | 13 +++++++++++++ tests/backtrace-data.c | 12 ++++++++++++ tests/backtrace-dwarf.c | 12 ++++++++++++ tests/backtrace.c | 12 ++++++++++++ 5 files changed, 56 insertions(+)
diff --git a/tests/ChangeLog b/tests/ChangeLog index f5d9a1b..9b1b18f 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,10 @@ +2015-05-04 Max Filippov jcmvbkbc@gmail.com + + * backtrace-child.c (assert_perror): Provide conditional definition. + * backtrace-data.c: Likewise. + * backtrace-dwarf.c: Likewise. + * backtrace.c: Likewise. + 2015-05-04 Daniel Guzman daniel@guzman.io
* Makefile.am (line2addr_LDADD, addrscopes_LDADD, funcscopes_LDADD) diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c index 788801c..2f955e0 100644 --- a/tests/backtrace-child.c +++ b/tests/backtrace-child.c @@ -79,6 +79,19 @@ #include <stdio.h> #include <unistd.h>
+#ifndef assert_perror +#define assert_perror(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d %s\n", __FILE__, __LINE__, strerror (err)); \ + abort (); \ + } \ + } \ + while (0) +#endif + #ifndef __linux__
int diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c index 01c1c00..f2ef44c 100644 --- a/tests/backtrace-data.c +++ b/tests/backtrace-data.c @@ -40,6 +40,18 @@ #include <string.h> #include ELFUTILS_HEADER(dwfl)
+#ifndef assert_perror +#define assert_perror(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d %s\n", __FILE__, __LINE__, strerror (err)); \ + abort (); \ + } \ + } \ + while (0) +#endif #if !defined(__x86_64__) || !defined(__linux__)
int diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c index fbcb22e..27aa4a9 100644 --- a/tests/backtrace-dwarf.c +++ b/tests/backtrace-dwarf.c @@ -29,6 +29,18 @@ #include <sys/wait.h> #include ELFUTILS_HEADER(dwfl)
+#ifndef assert_perror +#define assert_perror(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d %s\n", __FILE__, __LINE__, strerror (err)); \ + abort (); \ + } \ + } \ + while (0) +#endif #ifndef __linux__
int diff --git a/tests/backtrace.c b/tests/backtrace.c index 8b19b94..9660560 100644 --- a/tests/backtrace.c +++ b/tests/backtrace.c @@ -38,6 +38,18 @@ #include <argp.h> #include ELFUTILS_HEADER(dwfl)
+#ifndef assert_perror +#define assert_perror(err) \ + do \ + { \ + if (err) \ + { \ + fprintf (stderr, "%s:%d %s\n", __FILE__, __LINE__, strerror (err)); \ + abort (); \ + } \ + } \ + while (0) +#endif #ifndef __linux__
int
Max Filippov jcmvbkbc@gmail.com writes:
assert_perror is a GNU extension and is not provided by uClibc. Provide definition when that macro is not available.
It looks like it would pay off to have a dedicated header file for this macro.
Similarly in the 3/6 patch for utimes/futimes, it would pay off to extract that ifdef/else/endif logic to an inline function in some header file.
Thanks, Petr
On Mon, May 04, 2015 at 07:53:27AM +0200, Petr Machata wrote:
Max Filippov jcmvbkbc@gmail.com writes:
assert_perror is a GNU extension and is not provided by uClibc. Provide definition when that macro is not available.
It looks like it would pay off to have a dedicated header file for this macro.
Yes, but it is only needed in the backtrace tests. So please make it a tests only header. But since this is in the tests a simple assert (errno) would IMHO also be fine. It is just there to make sure the tests fail on something unexpected. For real code we should do proper error checking.
Cheers,
Mark
On Mon, May 4, 2015 at 5:22 PM, Mark Wielaard mjw@redhat.com wrote:
On Mon, May 04, 2015 at 07:53:27AM +0200, Petr Machata wrote:
Max Filippov jcmvbkbc@gmail.com writes:
assert_perror is a GNU extension and is not provided by uClibc. Provide definition when that macro is not available.
It looks like it would pay off to have a dedicated header file for this macro.
Yes, but it is only needed in the backtrace tests. So please make it a tests only header. But since this is in the tests a simple assert (errno) would IMHO also be fine. It is just there to make sure the tests fail on something unexpected. For real code we should do proper error checking.
Ok, I'll turn assert_perrors to simple asserts.
Mark Wielaard mjw@redhat.com writes:
[...] this is in the tests a simple assert (errno) would IMHO also be fine
Agreed.
Petr
elfutils-devel@lists.fedorahosted.org