Denys Vlasenko [Thu, 5 Dec 2019 12:30:17 +0000 (13:30 +0100)]
find-debuginfo.sh: speed up %dir generation
For kernel build, "${LISTFILE}.dirs.sed" is debugfiles.list.dirs.sed
and it contains 1782 lines of sed script.
It is applied to two files, both are about 4450 lines long.
This is slow (~30 seconds) because of ~16 million regex matches
performed by sed.
But we don't need or want regex match here
(and it's buggy, since dots in pattern match will be treated
as "any character", which is wrong here. For example,
/usr/lib/debug/lib/modules/5@4@0-0@rc7@0@fc31@test@x86_64/vdso/
would match
/usr/lib/debug/lib/modules/5.4.0-0.rc7.0.fc31.test.x86_64/vdso/
pattern, but it should not).
This change performs matching using shell string comparison ops.
For kernel build, this change results in run time of about one second.
Michal Čihař [Sat, 11 Nov 2017 13:27:10 +0000 (14:27 +0100)]
Fix sepdebugcrcfix compilation on platforms without MAP_POPULATE
Not all architectures offer MAP_POPULATE. As MAP_POPULATE is only an
optimization to improve performance, it is safe to drop it when it is
unavailable. Originally fixed in a Debian patch.
Tom de Vries [Mon, 26 Aug 2019 09:30:31 +0000 (11:30 +0200)]
Remove unused variable id in find-debuginfo.sh
There's code setting variable id in scripts/find-debuginfo.sh, but there's no
subsequent use. The only use of $id in the script is in do_file, where it is
a local variable.
The variable setting was introduced in commit fe280a20b "Add dwz debuginfo
compression support" in combination with a subsequent make_id_link using the
variable, but the make_id_link was removed in commit 62807f0df
"Add build-id links to rpm for all ELF files".
Eliminate use of ambiguous logical operators in script conditionals
Prefer '[] && []' to '[ -a ]' and '[] || []' to '[ -o ]' in tests.
-a and -o to mean AND and OR in a [ .. ] test expression is not well
defined, and can cause incorrect results when arguments start with
dashes or contain !. Moreover binary -a and -o are inherently
ambiguous. test(1) man page recommends to use
'test EXPR1 && test EXPR2' or 'test EXPR1 || test EXPR2' instead.
Mark Wielaard [Mon, 17 Jun 2019 09:23:26 +0000 (11:23 +0200)]
debugedit: Make sure .debug_line old/new idx start equal.
Found by running the debugedit tests under valgrind.
If the old and new .debug_line offset isn't changed then we might
write out an uninitialized new_idx.
Mark Wielaard [Mon, 17 Jun 2019 09:23:25 +0000 (11:23 +0200)]
Handle .debug_macro in debugedit.
When compiling with -g3 gcc will generate a .debug_macro section
which has pointers to the .debug_str section. Since we might rewrite
the .debug_str section, we also need to update any .debug_macro
pointers.
Updated the debugedit.at testcase by building everything with -g
and add various checks to see the .debug_macro section looks OK
after running debugedit. Added a new rpmbuild.at testcase to check
handing of .debug_macro in the whole rpmbuild debuginfo pipeline
to double check the separate .debug file also contains the macros.
Original patch by Michael Schroeder <mls@suse.de>. Extended by
Mark Wielaard <mark@klomp.org> to deal with relocations and possible
multiple COMDAT .debug_macro sections.
Mark Wielaard [Mon, 17 Jun 2019 09:23:24 +0000 (11:23 +0200)]
debugedit: Refactor reading/writing of relocated values.
This refactors the reading and writing of relocated values into seperate
helper functions (setup_relbuf and update_rela_data). It will be easier
to reuse this code in case we want to read/write relocated values in other
sections than DEBUG_INFO. The only functional change is that we explicitly
track whether the relocation data is updated, and only explicitly update
and write out the relocation data if so. In the case there were no strp
or stmt updates, there will also not be any relocation updates, even if
there is relocation data available.
All new debugedit testcases pass before and after this refactoring.
Mark Wielaard [Mon, 17 Jun 2019 09:23:23 +0000 (11:23 +0200)]
Add some debugedit tests.
debugedit didn't have any direct tests, it was only tested indirectly
through some other debuginfo testcases. So add some testcases that
just test debugedit functionality directly.
The tests create different kinds of ELF files (object files, partially
linked files and executables) and run debugedit path replacements on
them, checking that the resulting .debug_str, .debug_info and .debug_line
sections look sane.
Testcases verified against various different gcc and binutils versions.
gcc 4.8 and gcc 6 generate slightly different .debuginfo
Also add debugedit --version. Which makes it easy to see we are
testing the correct version/install of debugedit in rpmtests.log.
Adjust autotest paths to include rpmlibexecdir, where debuginfo
is installed. Note that rpmlibexecdir != libexecdir (see rpm.am).
nickclifton [Wed, 19 Jun 2019 11:45:09 +0000 (12:45 +0100)]
Add step to find-debuginfo.sh script to compress annobin notes.
With the introduction of the annobin gcc plugin to the build process,
built binary files have become larger. Sometimes significantly so.
This is a patch that adds a new step to the post-link process performed
by rpmbuild, to run the objcopy program with the --merge-notes option
specified. This will reduce the size of the annobin notes in binary
files, thus alleviating the size growth.
Add flag to use strip -g instead of full strip on DSOs (RhBug:1663264)
The find-debuginfo.sh flag -g had exactly this meaning. But from
version rpm-4.13.0-alpha flag -g changes its behavior. It affects
both libraries and executables.
For some packages the original behavior was preferred. That is why
the new find-debuginfo.sh flag --g-libs is created.
Since file 5.33, PIEs are identified by a new MIME type, meaning that,
currently, for such executables, the .gnu_debugdata section is not
added, even if -m is passed.
Panu Matilainen [Mon, 1 Oct 2018 10:41:45 +0000 (13:41 +0300)]
Report debuginfo size in kilobytes
By standard, 'du' defaults to 512 byte units, but this differs between
implementations: GNU du defaults to 1024 unless POSIXLY_CORRECT is set
and also allows overriding via number of environment variables. It also
supports various other ways of controlling the block size, but the
only standard means to control the size is -k, and we really don't
want to break portability for the sake of FYI statistics.
This is breaking suid bit handling in packaging unless an unreleased
bleeding edge version of elfutils is used. In other words it's not
an acceptable requirement and wont be for a long time. This needs
to be fixed in some other way.
Panu Matilainen [Wed, 1 Aug 2018 08:29:10 +0000 (11:29 +0300)]
Fix an obvious typo in dwz filename generation
This typo has always been there since the initial implementation in
Fedora-specific patches in 2012 and inherited upstream. Which suggests
something hasn't been working right all this time, or then this will
break something all of a sudden...
A new version of file (5.33) changed the output for PIE executables.
Which are now represented as application/x-pie-executable; charset=binary.
The following change simply recognizes that binary format as one for
which -g applies. This fixes accidental stripping of the .symtab in
glibc (which use -g to keep that symbol table).
Mark Wielaard [Mon, 12 Mar 2018 13:16:15 +0000 (14:16 +0100)]
debugedit: Only try to collect comp_dir in phase zero.
edit_attributes is run twice. Once for phase zero in which all strings are
collected. Then then for phase one in which the strings are rewritten. In
phase zero we also try to collect the comp_dir (either from the
DW_AT_comp_dir or the DW_AT_name of the compile unit). We were also
collecting the comp_dir is phase 1, which is unnecessary, and would not
actually work, since we would be using to old string table index for that,
which had already been rewritten.
Mark Wielaard [Wed, 7 Mar 2018 15:25:31 +0000 (16:25 +0100)]
debugedit: Check .debug_str index is valid before use.
debugedit would blindly use an .debug_str index from the .debug_info or
.debug_line sections assuming it would result in a valid string. Which
would crash and burn if the DWARF data was bogus when the string was
used. So check whenever converting an string index into a char pointer
so we can produce a more helpful error message.
Mark Wielaard [Mon, 22 Jan 2018 15:55:51 +0000 (16:55 +0100)]
Fix type mismatch calculating new line program offset in debugedit.c.
edit_dwarf2 calculates the (new) offset in the line program by
taking the difference between the old and new idx, which are of type
size_t (unsigned), plus the size_diff of the header given as ssize_t
(signed), and adding that to the current r_offset, which is an Elf64_Addr
(unsigned). On 64bit architectures, where the size of Elf64_Addr and
ssize_t are the same this isn't a problem. But on 32bit architectures,
where the size of ssize_t is smaller than Elf64_Addr the smaller signed
result gets promoted to an unsigned long first causing issues if the
size_diff was negative.
This would have been caught by gcc -Wsign-conversion
warning: conversion to ‘long unsigned int’ from ‘ssize_t’ {aka ‘long int’}
may change the sign of the result
But enabling this by default gives a lot of false positives.
Found and fixed by Richard Biener <rguenther@suse.de>.
Igor Gnatenko [Fri, 28 Jul 2017 05:42:38 +0000 (07:42 +0200)]
find-debuginfo.sh: make sure that debugsourcefiles.list is generated under the builddir
The %_debugsource_template expects the debugsourcefiles.list file
to be in the (current) build dir. Make sure that is always the case
even if find-debuginfo.sh was invoked in a different (sub) directory
by prepending $BUILDDIR to the output file as written in description
"All file names in switches are relative to builddir (. if not given).".
Closes: https://github.com/rpm-software-management/rpm/issues/279 Based-on-patch-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Mark Wielaard [Wed, 19 Jul 2017 12:53:53 +0000 (14:53 +0200)]
find-debuginfo.sh: Remove non-allocated NOBITS sections from minisymtab.
In the minisymtab section (the .gnu_debugdata embedded ELF image) we
do not need unallocated sections (except for the SYMTAB and STRTAB
sections we are creating). We already remove PROGBITS and NOTES. Also
remove NOBITS sections. They should not really take up much (any) space
but they still add to the section tables. These sections might be created
with the new --keep-section support (which puts the actual section in
the main ELF binary, and a NOBITS variant in the .debug file).
Also binutils objcopy seems to sometimes add them anyway filled with
zeros instead of marking them NOBITS.
Mark Wielaard [Mon, 17 Jul 2017 10:58:26 +0000 (12:58 +0200)]
find-debuginfo.sh: Add --keep-section and --remove-section for eu-strip.
Use --keep-section SECTION or --remove-section SECTION to explicitly
keep a (non-allocated) section in the main executable or explicitly
remove it into the .debug file. SECTION is an extended wildcard pattern.
Both options can be given more than once.
Mark Wielaard [Wed, 28 Jun 2017 12:21:32 +0000 (14:21 +0200)]
find-debuginfo.sh: Use 'return', not 'continue', to break out do_file().
commit 038bfe "Split directory traversal and debuginfo extraction"
put the core of a while loop into its own function 'do_file()'.
That means that instead of using 'continue' to break out early it now
needs to use 'return'. Otherwise the script will give errors like:
continue: only meaningful in a `for', `while', or `until' loop
Mark Wielaard [Wed, 28 Jun 2017 11:34:55 +0000 (13:34 +0200)]
find-debuginfo.sh: Filter out all <built-in> like fake file names.
There is no official way to mark an instruction range as being not
part of some actual source code, but as part of a compiler built-in
construct in DWARF. So different compilers have come up with fake
source file names like <built-in> or <__thread_local_inner macros>.
We already filtered out the strings "<internal>" and "<built-in>".
Just filter out all '(^|/)<[a-z _-]+>$'. They are fake files!
This is mainly to appease the rustc compiler which generates lots of
different variants to encode some instruction sequence is part of an
compiler generated macro expansion.
Mark Wielaard [Wed, 28 Jun 2017 18:25:39 +0000 (20:25 +0200)]
debugedit: skip_dir_prefix should check for dir separator.
To count as a real directory prefix the string matched should either
be equal to the given prefix or start with the prefix plus '/'.
skip_dir_prefix is always used with base_dir or dest_dir which don't
end with a slash themselves.
This really only is an issue if a package would put a directory named
similar to the package source dir (which cargo on fedora does, by adding
a directory named cargo-vendor in the builddir itself).
Mark Wielaard [Mon, 26 Jun 2017 15:38:30 +0000 (17:38 +0200)]
find-debuginfo.sh: Don't create dwz multi file if there is only one .debug.
dwz -m multi only works when there are multiple .debug input files.
With just one .debug file it doesn't really make sense to extract
the shared debug info into a separate file and dwz will complain:
dwz: Too few files for multifile optimization.
So only add -m multi if there is more than one .debug file.
Mark Wielaard [Mon, 26 Jun 2017 11:35:48 +0000 (13:35 +0200)]
Update find-debuginfo.sh options and macros documentation.
This adds some missing documentation for rpm macros and find-debuginfo.sh
options that were recently added (or renamed). -j N, --build-id-seed SEED,
--unique-debug-suffix SUFFIX and --unique-debug-src-base BASE.
Untangle unique build options in find-debuginfo.sh
Rename --ver-rel option to --build-id-seed, so that it reflects what
it does, not how it is used.
Remove implcit usage of the old --ver-rel option for --unique-debug-arch
and --unique-debug-src-base, instead already call find-debuginfo.sh with
the version included.
Rename --unique-debug-arch to --unique-debug-suffix because it now
also contains the package version.
Mark Wielaard [Fri, 21 Apr 2017 15:33:26 +0000 (17:33 +0200)]
debugedit: Only output comp_dir under build dir (once).
The fix for rhbz#444310 (commit c1a5eb - Include empty CU current dirs)
was a little greedy. It would also include comp_dirs outside the build
root. Those are unnecessary and we don't have a good way to store them.
Such dirs (e.g. /tmp) would then show up at the root of /usr/src/debug.
Fix this by including only comp_dirs under base_dir. Also only output
all dirs once (during phase zero) and don't output empty dirs (which
was harmless but would produce a warning from cpio).
This still includes all empty dirs from the original rhbz#444310
nodir testcase and it is an alternative fix for rhbz#641022
(commit c707ab).
Both fixes are necessary in case of an unexpected mode for a directory
actually in the build root that we want to include in the source list.
Mark Wielaard [Sun, 16 Apr 2017 16:16:02 +0000 (18:16 +0200)]
find-debuginfo.sh: Only add minisymtab for executables or shared libraries.
It only makes sense to add a minisymtab for executables and shared
libraries. Other executable ELF files (like kernel modules) don't need it.
Since those don't have a dynsym section trying to add it will fail and
produce confusing errors from nm.
Mark Wielaard [Sun, 16 Apr 2017 16:16:46 +0000 (18:16 +0200)]
debugedit: Add -n, --no-recompute-build-id.
Some packages depend on the build-ids as generated during the build
and cannot handle rpmbuild recomputing them before generating the
package file list. Add -n, --no-recompute-build-id to debugedit and
add -n to find-debuginfo.sh set by defining the %_no_recompute_build_ids
macro for such packages. %_no_recompute_build_ids can not be used together
with %_unique_build_ids.
Robin Lee [Sat, 8 Apr 2017 13:21:39 +0000 (21:21 +0800)]
Fix non-standard inherented modes of directories in debuginfo
In case that binary compiled from source generated in /tmp, a
/usr/src/debug/tmp directory will be created with the same mode as
/tmp, a.k.a 777, which should be avoided.
Fix Large File Support (LFS) in sepdebugcrcfix tool and systemd_inhibit.so plugin
This problem was found by ALT rpm verify-elf brp script:
verify-elf: WARNING: ./usr/lib/rpm-plugins/systemd_inhibit.so: uses non-LFS functions: __lxstat
verify-elf: WARNING: ./usr/lib/rpm/sepdebugcrcfix: uses non-LFS functions: __xstat mmap open pread pwrite
We would put one too many slashes in between the new dest_dir and file name
part of the replacement of a DW_FORM_string in the .debug_info. If there
was file part then we would overwrite the first character of the name. If
there was no file part at all then this would overwrite the zero terminator
and cause a crash reading the rest of the data.
A crash did happen while building the docker package on fedora s390x.
https://bugzilla.redhat.com/show_bug.cgi?id=1434347
The reason neither issue would normally trigger is because if we do detect
that the dest_dir is larger than the base_dir we refuse to replace anything.
We wouldn't replace the changed file names if replace_dirs was false,
but replace_files was true. This could overrun the new debug_line data
buffer if the original file name was larger than the replacement. It
wasn't found before because often when we need to replace files we
also would have to replace dirs.
Mark Wielaard [Fri, 17 Mar 2017 20:03:35 +0000 (21:03 +0100)]
debugedit: Fix cross-endian build-id reading and updating section data.
debugedit doesn't read raw mmap data any longer. Which made the complex
way to read the build-id unnecessary (and it was broken for cross-endian).
Just use gelf_getnote to read the notes.
Also in some special cases when only the debug_info or build_id data
was updated, but no section changed size and we had to preserve the
allocated section headers we could hit a bug in elfutils that could
trash some section data in case there were gaps between non-dirty and
dirty sections. See https://sourceware.org/bugzilla/show_bug.cgi?id=21199
Add a workaround for that issue.
This fixes the kompose package build on fedora ppc64.
And makes it possible to replicate that issue on x86_64.
Mark Wielaard [Tue, 28 Feb 2017 20:34:34 +0000 (21:34 +0100)]
Add option to have unique debug source dirs across version/release/arch.
Introduce a new macro _unique_debug_srcs that when set will pass
--unique-debug-src-base "%{name}" to find-debuginfo.sh which will
move sources into a unique "<name>-<ver>-<rel>.<arch>" directory
under /usr/src/debug/ and makes debugedit rewrite the source paths
in the debuginfo to use that unique directory name.
Traditionally the debug src dir was named after the builddir which
was defined through the %setup macro which used the -n name argument
to define the builddir name and source archive to use. The builddir
might not be unique though between package versions.
Now that debugedit doesn't have strict base and dest dir length
restrictions for rewriting the source dir paths this can now be made
more flexible.
The added testcases show the difference between the old and new way.
The hello2.spec file defines the name of the package as hello2, but
uses the %setup marcro with -n hello-1.0 to use the hello-1.0.tar.gz
archive. This would traditionally result in a hello-1.0 builddir
which would be moved under /usr/src/debug. Possibly conflicting
with any other package (version) that used the same builddir name.
When defining _unique_debug_srcs to 1 that builddir will be moved
to <name>-<ver>-<rel>.<arch> instead (hello2-1.0-1.<arch>).
The testcases check that both the actual package source filess under
/usr/debug/src/ and the source paths as found in the .debug files are
under the traditional or new unique directory names depending on whether
the new _unique_debug_srcs macro is defined.
Mark Wielaard [Mon, 27 Feb 2017 15:28:18 +0000 (16:28 +0100)]
debugedit: Support String/Line table rewriting for larger/smaller paths.
debugedit --base to --dest rewriting of debug source file paths only
supported dest paths that were smaller or equal than the base path
(and the size should differ more than 1 character for correct debug lines).
All paths were changed "in place". Which could in theory mess up debug str
sharing.
This rewrite supports base and dest strings of any size (some limitations,
see below). This is done by reconstructing the debug_str and debug_line
tables and updating the references in the debug_info attributes pointing
to these tables. Plus, if necessary (only for ET_REL kernel modules),
updating any relocations for the debug_info and debug_line sections.
This has the nice benefit of merging any duplicate strings in the
debug_str table which might resulting on slightly smaller files.
kernel modules are ET_REL files that often contain a lot of duplicate
strings.
The rewrite uses elfutils (either libebl or libdw) to reconstruct the
debug_str table. Since we are changing some section sizes now we cannot
just use mmap and rawdata to poke the values, but need to read in and
write out the changed sections. This does take a bit more memory because
we now also need to keep track of all string/line references.
There are still some limitations (already in the original debugedit)
not fixed by this rewrite:
- DW_AT_comp_dir in .debug_info using DW_FORM_string can not be made
larger. We only warn about that now instead of failing. The only
producer of DW_FORM_string comp_dirs is binutils gas. It seems simpler
to fix gas than to try to support resizing the debug_info section.
- A DW_AT_name on a DW_TAG_compile_unit is only rewritten for DW_FORM_strp
not for DW_FORM_string. Probably no problem in practice since this
wasn't supported originally either.
- The debug_line program isn't scanned for DW_LNE_define_file which
could in theory define an absolute path that might need rewriting.
Again probably not a problem because this wasn't supported before
and there are no know producers for this construct.
To support the upcoming DWARFv5 in gcc 7 (not on by default), we will
need to add support for the new debug_line format and scan the new
debug_macro section that can have references to the debug_str table.
Mark Wielaard [Fri, 9 Dec 2016 08:31:23 +0000 (10:31 +0200)]
Eliminate unnecessary dependency on bfd.h from sepdebugcrcfix
I think the reliance on bfd.h was a mistake. The code was lifted from
bfd, but should be totally independent (it just calculates a CRC).
Fix the type to be a normal size_t and include sys/stat.h (which was
included through bfd.h) to get the definitions of stat and chmod.
Mark Wielaard [Fri, 7 Oct 2016 13:45:47 +0000 (15:45 +0200)]
Fix mini-symtab in find-debuginfo.sh for arches with function descriptors.
add_minidebug uses nm to select the function symbols to include in the
mini-symtab table. But on arches that use function descriptors (like ppc64)
nm --format-posix doesn't make it clear which symbols are real functions
The symbols point to the (stripped away) function descriptor table).
Use --format=sysv style to match the ELF symbol type directly instead of
using the somewhat ambiguous symbol type char used in --format=posix style
in binutils nm.
Mark Wielaard [Fri, 7 Oct 2016 15:00:44 +0000 (17:00 +0200)]
find-debuginfo.sh: Don't copy extra sections into .gnu_debugdata.
When creating the compressed mini-symtab section in find-debuginfo
add_minidebug we explicitly remove .gdb_index and .comment. But there
can be other non-empty sections in the debuginfo that shouldn't be
copied. For example rust binaries might have a .rustc section.
Explicitly remove any non-allocated PROGBITS or NOTE sections.
Michal Marek [Sat, 10 Sep 2016 21:13:25 +0000 (23:13 +0200)]
find-debuginfo.sh: Process files in parallel
Add a -j <n> option, which, when used, will spawn <n> processes to do the
debuginfo extraction in parallel. A pipe is used to dispatch the files among
the processes.
Mark Wielaard [Thu, 16 Jun 2016 12:24:22 +0000 (14:24 +0200)]
Add option to have unique debug file names across version/release/arch.
Introduce a new macro _unique_debug_names that when set will pass
--unique-debug-arch "%{_arch}" to find-debuginfo.sh to create debuginfo
files which end in "-<ver>-<rel>.<arch>.debug" instead of simply ".debug".
Adds testcases for dwz and buildid with and without unique debug file names.
Mark Wielaard [Tue, 14 Jun 2016 15:07:14 +0000 (17:07 +0200)]
Make adding GDB index sections configurable.
Introduces _include_gdb_index macro and -i flag to find-debuginfo.sh to
enable or disable adding a .gdb_index section to debug files. Adds tests
to make sure the .gdb_index is really added (or not) when requested.
Checks that gdb-add-index is actually installed instead of silently
failing if not. Similar for dwz.
Mark Wielaard [Tue, 14 Jun 2016 15:07:13 +0000 (17:07 +0200)]
Make it possible to have unique build-ids across build versions/releases.
Introduce a new macro _unique_build_ids that when set will pass the
version and release to find-debuginfo.sh and debugedit to recalculate
the build-id of ELF files.
Includes two new testcases to make sure the new setting works as expected
both when set and unset.
Mark Wielaard [Tue, 14 Jun 2016 15:07:12 +0000 (17:07 +0200)]
Add build-id links to rpm for all ELF files.
This patch moves the main ELF file build-id symlinks from the
debuginfo package into the main package. And uses different
base directories for the main ELF file build-id symlink.
For the main build-id use /usr/lib/.build-id and for the debug
build-id use /usr/lib/debug/.build-id.
There are two reasons for doing this. The main package and the
debuginfo package might get out of sync, or the debuginfo package
might not be installed at all. In which case finding the main ELF
file through the build-id symlink becomes impossible. Secondly by
moving the main ELF build-id symlink in its own directory the
/usr/lib/debug directory gets populated with only debuginfo files
which is convenient if the user might want to have that directory
populated through a network mountpoint.
To support the new logic the symlink code has been moved from
find-debuginfo.sh to build/files.c.
This also includes support for a new config %_build_id_links that
defaults to compat. The other settings are none, alldebug (the old
style) and separate. compat is like separate, but adds a compatibility
link under /usr/lib/debug/.build-id for the main build-id symlink.
There are several new testcases added to test the various settings
using the new keyword "buildid".
Mark Wielaard [Tue, 14 Jun 2016 15:07:11 +0000 (17:07 +0200)]
Add sepdebugcrcfix to fixup old style gnu_debuglink CRC checksum.
Some old tools might still use the .gnu_debuglink section to find
separate debuginfo files instead of build-id style lookups. When
dwz has compresses the .debug files the original CRC in the main
ELF file will no longer match. Make sure to run sepdebugcrcfix
after dwz to recalculate the CRC.
The original fix was created by Jan Kratochvil based on code
from GNU binutils BFD. https://bugzilla.redhat.com/show_bug.cgi?id=971119
I added a testcase to make sure the CRCs were all correctly
updated after dwz has run to compress a debuginfo package.
And a change (plus testcase) to make sure implicit suid binaries
didn't accidentially got their suid flag bit.
Mark Wielaard [Tue, 14 Jun 2016 15:07:09 +0000 (17:07 +0200)]
Add dwz debuginfo compression support.
Support for dwz compression has been in Fedora since a couple of years.
https://fedoraproject.org/wiki/Features/DwarfCompressor
The original find-debuginfo.sh patch was written by Jakub Jelinek.
https://bugzilla.redhat.com/show_bug.cgi?id=833311
The new testcase using the macros.debug was added by me.
Mark Wielaard [Tue, 14 Jun 2016 15:07:08 +0000 (17:07 +0200)]
Add find-debuginfo.sh -m minisymtab support.
Support for minisymtab (a minimal function symbol table in a compressed
section in the main binary) has been in gdb and elfutils based tools
since some years. Fedora has had this as rpm-4.10.0-minidebuginfo.patch
since 2012.
The patch adjusts macros to pass -m to find-debuginfo.sh when
_include_minidebuginfo has been set. find-debuginfo.sh now takes -m
as argument to generate the .gnu_debugdata ELF section to be added
to the main executable.
To support the testcases a new macros.debug is added that is used to
generate debuginfo packages in the rpmbuild.at testsuite.
The original support was added to Fedora rpm by Alexander Larsson.
Lubos Kardos fixed a bug in it when strip -g was used. I added some
configuration macros and two testcases to check the basic support works
and for the strip -g bug.
AArch64 generates a relocation which must be handled similar to other
architectures. Adding this patch allows debugedit to run against the
kernel debuginfo.
Panu Matilainen [Wed, 9 Jan 2013 11:48:40 +0000 (13:48 +0200)]
Revert "make "canonicalization(...)shrank by one character" error message more usefull"
- The message is not about basedir and destdir, and printing them
here only makes the message even more confusing than it was, eg:
canonicalization unexpectedly shrank by one character \
('/home/pmatilai/rpmbuild/BUILD/' vs '/usr/src/debug/')
- This reverts commit bda09c382b90fdbad9a166a49642f36b5a5396ce
Panu Matilainen [Wed, 7 Mar 2012 11:47:09 +0000 (13:47 +0200)]
Warn but dont fail the build on STABS debuginfo (RhBug:725378, others)
- debugedit doesn't support STABS but there are some crazy cases
like PPC Linux kernel which contains both STABS and DWARF debuginfo
sections, manually added. A better fix would be erroring out
if we didn't find any usable debuginfo and warning otherwise but
this at least folks get their kernels built.
Jeff Tickle [Tue, 6 Sep 2011 06:52:19 +0000 (09:52 +0300)]
$RPM_BUILD_ROOT breaks brp-* scripts if it contains spaces (ticket #843)
- This patch adds quotes around $RPM_BUILD_ROOT in places that I noticed
they were missing, and attempts to handle some of the problems that can
occur when looping over the output of find.
Mark Wielaard [Wed, 25 May 2011 13:44:42 +0000 (15:44 +0200)]
Add -r flag to find-debuginfo.sh to invoke eu-strip --reloc-debug-sections.
- This is a new option to eu-strip that strips out/resolves relocations
between .debug_* elf sections in ET_REL files. This can save a lot of
space for kernel module.
Panu Matilainen [Tue, 24 May 2011 14:23:37 +0000 (17:23 +0300)]
Bail out of debuginfo if stabs format encountered (RhBug:453506)
- The previous "silently ignore" policy produces bogus debuginfo
packages on some architectures and fails with other mysterious
errors on others, better just fail hard until (if ever) somebody adds
stabs support.
Roland McGrath [Mon, 9 Aug 2010 12:27:03 +0000 (15:27 +0300)]
Fix find-debuginfo.sh behavior on cross-directory hardlinks (RhBug:618426)
- The find-debuginfo.sh script makes hard links of .debug files to
correspond to hard links between install binaries. It can fail to
create one of these .debug hard links if it's in a directory that
didn't exist at that point in the script run. How this happens
depends on things like the order "find" lists files, so it can
be hard to reproduce off hand.
Jindrich Novy [Fri, 27 Feb 2009 13:34:39 +0000 (14:34 +0100)]
Add md5->filedigest aliases (rhbz#487597)
- add %verify(nofiledigest) as %verify(nomd5) file attribute alias
- reference digests as digests not checksums
- make old md5 related symbols obsolete and use newer reference
- update man page accordingly
Panu Matilainen [Thu, 8 Jan 2009 11:17:22 +0000 (13:17 +0200)]
Delay NSS initialization until actually used
- since NSS is allergic (ie becomes non-functional) after forking, delay
it's initialization until really needed, ie lazy init in rpmDigestInit()
- however as NSS init can fail if attempted in completely empty chroot,
we force crypto init to happen at transaction set create time, forking
past that is pretty much doomed anyway
- this is the other half of the fix for rhbz#476737, and similar case
noticed by Pixel in Mandriva (due to urpm forking)