> gcc t.c -g
> objcopy --add-gnu-debuglink=a.out.debug a.out
> readelf -S a.out
 .gnu_debuglink PROGBITS 0000000000000000 00001d90
0000000000000010 0000000000000000 0 0 1
you can see ALIGN 1. eu-strip -g creates it with ALIGN 4:
 .gnu_debuglink PROGBITS 0000000000000000 00001834
0000000000000010 0000000000000000 0 0 4
and this is what RPMs sepdebugcrcfix expects:
const uint8_t *zerop = memchr (data->d_buf, '\0', data->d_size);
const uint8_t *crcp = (zerop == NULL
: (const uint8_t *) ((uintptr_t) (zerop + 1 + 3)
if (crcp + 4 != (uint8_t *) data->d_buf + data->d_size)
error (0, 0, _("invalid format of section \"%s\" # %zu in \"%s\""),
scnname, elf_ndxscn (scn), fname);
appearantly also objcopy pads the string part to 4 bytes but the above also
requires alignment (on the libelf representation which honors ALIGN).
I will fix the tool but it would be nice to check the "specification" of
.gnu_debuglink as if that padding implicitely assumes alignment of the
section (why would we pad otherwise?).
The master branch has been updated by Nick Clifton <email@example.com>:
Author: Nick Clifton <firstname.lastname@example.org>
Date: Wed Feb 22 17:28:33 2017 +0000
Align .gnu_debuglink sections on a 4-byte boundary.
* opncls.c (bfd_create_gnu_debuglink_section): Give the newly
created section 4-byte alignment.
There is no definitive specification for the .gnu_debuglink section, but I
think that it is clear that it is meant to be aligned on a 4-byte boundary
so that the CRC value can be read using 32-bit reads.
So I have checked in a patch to update the bfd_create_gnu_debuglink_section
function to add the required alignment.
Is that sufficient, or is there anything else that needs to be updated ?
On Wed, 22 Feb 2017, nickc at redhat dot com wrote:
> Nick Clifton <nickc at redhat dot com> changed:
> What |Removed |Added
> Status|NEW |ASSIGNED
> CC| |nickc at redhat dot com
> --- Comment #2 from Nick Clifton <nickc at redhat dot com> ---
> Hi Richard,
> There is no definitive specification for the .gnu_debuglink section, but I
> think that it is clear that it is meant to be aligned on a 4-byte boundary
> so that the CRC value can be read using 32-bit reads.
> So I have checked in a patch to update the bfd_create_gnu_debuglink_section
> function to add the required alignment.
> Is that sufficient, or is there anything else that needs to be updated ?
I think that's sufficient, can you put it on the 2.28 branch as well?