Re: [PATCH] elfclassify tool
On Mon, Jul 29, 2019 at 04:38:17PM +0200, Florian Weimer wrote: > > On Mon, Jul 29, 2019 at 11:16:31AM +0200, Florian Weimer wrote: > > So the test should be: > > > > diff --git a/src/elfclassify.c b/src/elfclassify.c > > index ebd42c1d5..b17d14d45 100644 > > --- a/src/elfclassify.c > > +++ b/src/elfclassify.c > > @@ -862,7 +862,7 @@ process_stdin (int *status) > > break; > >if (ret < 0) > > abort (); /* Cannot happen due to error checks above. */ > > - if (delim != '\0' && ret > 0) > > + if (delim != '\0' && ret > 0 && buffer[ret - 1] == '\n') > > buffer[ret - 1] = '\0'; > >current_path = buffer; > >process_current_path (status); > > Right. But now I wonder why ret == 0 can ever happen. Maybe on > OpenVMS, which doesn't use in-band signaling for line terminators? I also couldn't create a situation where ret == 0. But I still included the change because it feels more robust. Thanks, Mark
Re: [PATCH] elfclassify tool
Hi, With the dwelf_elf_begin fix now committed I intend to commit the elfclassify tool as attached. It now treats a NULL return from [dwelf_]elf_begin always as error. It has the new --library classification and various fixes that were pointed out during the review. Cheers, Mark>From 3f489b5c7c78df6d52f8982f79c36e9a220e8951 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 13 Aug 2019 13:27:15 +0200 Subject: [PATCH] elfclassify: New tool to analyze ELF objects. Usage: elfclassify [OPTION...] FILE... Determine the type of an ELF file. All of the classification options must apply at the same time to a particular file. Classification options can be negated using a "--not-" prefix. Since modern ELF does not clearly distinguish between programs and dynamic shared objects, you should normally use either --executable or --shared to identify the primary purpose of a file. Only one of the --shared and --executable checks can pass for a file. If you want to know whether an ELF object might a program or a shared library (but could be both), then use --program or --library. Some ELF files will classify as both a program and a library. If you just want to know whether an ELF file is loadable (as program or library) use --loadable. Note that files that only contain (separate) debug information (--debug-only) are never --loadable (even though they might contain program headers). Linux kernel modules are also not --loadable (in the normal sense). Without any of the --print options, the program exits with status 0 if the requested checks pass for all input files, with 1 if a check fails for any file, and 2 if there is an environmental issue (such as a file read error or a memory allocation error). When printing file names, the program exits with status 0 even if no file names are printed, and exits with status 2 if there is an environmental issue. On usage error (e.g. a bad option was given), the program exits with a status code larger than 2. The --quiet or -q oose_filestion suppresses some error warning output, but doesn't change the exit status. Classification options --core File is an ELF core dump file --debug-only File is a debug only ELF file (separate .debug, .dwo or dwz multi-file) --elf File looks like an ELF object or archive/static library (default) --elf-archive File is an ELF archive or static library --elf-file File is an regular ELF object (not an archive/static library) --executable File is (primarily) an ELF program executable (not primarily a DSO) --library File is an ELF shared object (DSO) (might also be an executable) --linux-kernel-module File is a linux kernel module --loadable File is a loadable ELF object (program or shared object) --program File is an ELF program executable (might also be a DSO) --shared File is (primarily) an ELF shared object (DSO) (not primarily an executable) --unstripped File is an ELF file with symbol table or .debug_* sections and can be stripped further Input flags -f, --file Only classify regular (not symlink nor special device) files --no-stdin Do not read files from standard input (default) --stdinAlso read file names to process from standard input, separated by newlines --stdin0 Also read file names to process from standard input, separated by ASCII NUL bytes -z, --compressed Try to open compressed files or embedded (kernel) ELF images Output flags --matching If printing file names, print matching files (default) --no-print Do not output file names --not-matching If printing file names, print files that do not match --printOutput names of files, separated by newline --print0 Output names of files, separated by ASCII NUL Additional flags -q, --quietSuppress some error output (counterpart to --verbose) -v, --verbose Output additional information (can be specified multiple times) -?, --help Give this help list --usageGive a short usage message -V, --version Print program version Report bugs to https://sourceware.org/bugzilla. Signed-off-by: Florian Weimer Signed-off-by: Mark Wielaard --- src/ChangeLog |9 +- src/Makefile.am |4 +- src/elfclassify.c | 1046 + tests/ChangeLog
Re: 0.17(8 -> 7) release next (week -> month) [Tomorrow]
On Mon, Jul 15, 2019 at 12:17:36PM +0200, Mark Wielaard wrote: > On Sat, 2019-07-13 at 00:36 +0200, Mark Wielaard wrote: > > In another thread I said I would like to do a release end of this week > > with the csky backend and the elfclassify tool integrated. But I didn't > > make enough time for reviews, so that moves to next week. Sorry. > > > > I should have enough time next week. But we will have to see if we can > > polish the csky and elfclassify tool enough. If not, we'll still do a > > release next week, just without those additions. The last 4 months saw > > enough improvements to do a new release. And we'll do another in 3 or 4 > > months anyway, so if anything misses this release it will go into the > > next. > > Just for the record, the subject should of course have been 0.177. And "next week" became "next month". Sorry about that. But I believe we are ready now and I like to do the 0.177 release tomorrow with the attached commit (.po regeneration removed). Cheers, Mark >From 5643e037cb7a38ed5d52f50421be706ea8014e3d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 13 Aug 2019 23:53:56 +0200 Subject: [PATCH] Prepare for 0.177 Set version to 0.177. Update NEWS and elfutils.spec.in. Use git --get user.name and user.email for spec changelog. Regenerate po/*.po files. Signed-off-by: Mark Wielaard --- ChangeLog | 8 + NEWS| 16 + config/ChangeLog| 5 + config/Makefile.am | 6 +- config/elfutils.spec.in | 11 + configure.ac| 2 +- po/ChangeLog| 4 + po/de.po| 857 po/es.po| 857 po/ja.po| 857 po/pl.po| 857 po/uk.po| 857 12 files changed, 2218 insertions(+), 2119 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c45cccfb..bed3999f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2019-08-13 Mark Wielaard + + * configure.ac: Set version to 0.177. + * NEWS: Mention elfclassify, readelf DW_AT_data_member_location + and DW_AT_discr_list attribute changes, dwarf.h DW_AT_GNU additions, + dwelf_elf_e_machine_string function, dwelf_elf_begin change and + C-SKY backend support. + 2019-02-14 Mark Wielaard * configure.ac: Set version to 0.176. diff --git a/NEWS b/NEWS index 5a06047f2..2bf19d9cb 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,19 @@ +Version 0.177 + +elfclassify: New tool to analyze ELF objects. + +readelf: Print DW_AT_data_member_location as decimal offset. + Decode DW_AT_discr_list block attributes. + +libdw: Add DW_AT_GNU_numerator, DW_AT_GNU_denominator and DW_AT_GNU_bias. + +libdwelf: Add dwelf_elf_e_machine_string. + dwelf_elf_begin now only returns NULL when there is an error + reading or decompressing a file. If the file is not an ELF file + an ELF handle of type ELF_K_NONE is returned. + +backends: Add support for C-SKY. + Version 0.176 build: Add new --enable-install-elfh option. diff --git a/config/ChangeLog b/config/ChangeLog index 9b1cce4e1..65658118a 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,8 @@ +2019-08-13 Mark Wielaard + + * Makefile.am (elfutils.spec.in): Use git --get user.name and + user.email. + 2019-04-15 Mark Wielaard * upload-release.sh: Add git tag --verify. diff --git a/config/Makefile.am b/config/Makefile.am index 66012d029..9d292cee6 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -38,9 +38,9 @@ if MAINTAINER_MODE $(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS @tmpname=$$(mktemp $${TMPDIR:-/tmp}/elfutils.XX); \ date +'* %a %b %e %Y' | tr '[\n]' '[ ]' > $$tmpname; \ - getent passwd "$$(whoami)" | \ - awk 'BEGIN {FS=":"} { printf $$5; exit 0}' >> $$tmpname; \ - echo -n " <$$(whoami)@gmail.com> " >> $$tmpname; \ + username=$$(git config --get user.name); \ + useremail=$$(git config --get user.email); \ + echo -n "$$username <$$useremail> " >> $$tmpname; \ awk '\ $$1 == "Version" && started { exit } \ $$1 == "Version" { started=1; line=""; sub(/:/,"",$$2); \ diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in index 794cbaf81..19b4229ef 100644 --- a/config/elfutils.spec.in +++ b/config/elfutils.spec.in @@ -227,6 +227,17 @@ rm -rf ${RPM_BUILD_ROOT} %{_sysctldir}/10-default-yama-scope.conf %changelog +* Tue Aug 13 2019 Mark Wielaard 0.177-1 +- elfclassify: New tool to analyze ELF objects. +- readelf: Print DW_AT_data_member_location as decimal offset. + Decode DW_AT_discr_list block attributes. +- libdw: Add DW_AT_GNU_numerator, DW_AT_GNU_denominator and DW_AT_GNU_bias. +- libdwelf: Add dwelf_elf_e_machine_string. +dwelf_elf_begin now only returns NULL when there is an error +reading or decompressing a file. If the file is not an