diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2015-02-07 15:08:20 +0100 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2015-02-07 15:08:20 +0100 |
commit | 6f5934c1afa8f34bfb8f86b191ded9af854e757f (patch) | |
tree | cf31aaacbd08ef337189fe7c5fb96d7fafa729c0 | |
parent | 96f7667a2e804465adc3d4cfbb17c022adfa40f0 (diff) | |
download | elfutils-6f5934c1afa8f34bfb8f86b191ded9af854e757f.tar.gz |
libelf: Consider sh_addralign 0 as 1
Currently the Koji build for arm32 fails with:
extracting debug info from /builddir/build/BUILDROOT/etcd-2.0.0-0.3.rc1.fc22.arm/usr/bin/etcd
Failed to write file: invalid section alignment
This is because the binary etcd
http://people.redhat.com/jkratoch/etcdctl.xz
contains:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[11] .rel.plt REL 00459ee0 449ee0 000088 08 A 13 0 0
^
which corresponds to golang's code:
go/src/cmd/ld/elf.c
case EM_X86_64:
sh = elfshname(".rela.plt");
sh->addralign = RegSize;
default:
sh = elfshname(".rel.plt");
<nothing>
ELF spec says:
Values 0 and 1 mean the section has no alignment constraints.
and libelf/elf32_updatenull.c really parses it that way at line 204
ElfW2(LIBELFBITS,Word) sh_align = shdr->sh_addralign ?: 1;
but unfortunately the later line being patched no longer does.
libelf/
2015-02-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* elf32_updatenull.c (__elfw2(LIBELFBITS,updatenull_wrlock)): Consider
sh_addralign 0 as 1.
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
-rw-r--r-- | libelf/ChangeLog | 5 | ||||
-rw-r--r-- | libelf/elf32_updatenull.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog index f1756301..235b750b 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,8 @@ +2015-02-07 Jan Kratochvil <jan.kratochvil@redhat.com> + + * elf32_updatenull.c (__elfw2(LIBELFBITS,updatenull_wrlock)): Consider + sh_addralign 0 as 1. + 2015-01-22 Mark Wielaard <mjw@redhat.com> * elf_strptr (elf_strptr): Make sure returned string is NUL diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c index be4cea03..5e809b79 100644 --- a/libelf/elf32_updatenull.c +++ b/libelf/elf32_updatenull.c @@ -328,7 +328,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) enough for the largest alignment required by a data block. */ if (unlikely (! powerof2 (shdr->sh_addralign)) - || unlikely (shdr->sh_addralign < sh_align)) + || unlikely ((shdr->sh_addralign ?: 1) < sh_align)) { __libelf_seterrno (ELF_E_INVALID_ALIGN); return -1; |