0.161-7 Add elfutils-0.161-aarch64relro.patch (#1201778)

This commit is contained in:
Mark Wielaard 2015-03-23 15:18:46 +01:00
parent 6c0c17ad44
commit 0c39d9c06d
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,59 @@
commit aea89f2c1ad1cfa2ddd09fb5262f7a0616708baa
Author: Mark Wielaard <mjw@redhat.com>
Date: Mon Mar 23 15:08:27 2015 +0100
backends: aarch64 can have _GLOBAL_OFFSET_TABLE_ point anywhere in .got.
When building with relro aarch64 splits .got in a writable and read-only
part. _GLOBAL_OFFSET_TABLE_ points to the first writable symbol, not the
start of .got.
https://bugzilla.redhat.com/show_bug.cgi?id=1201778
Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/backends/aarch64_symbol.c b/backends/aarch64_symbol.c
index 3fdc9cf..76999e4 100644
--- a/backends/aarch64_symbol.c
+++ b/backends/aarch64_symbol.c
@@ -1,5 +1,5 @@
/* AArch64 specific symbolic name handling.
- Copyright (C) 2013 Red Hat, Inc.
+ Copyright (C) 2013, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -56,8 +56,11 @@ aarch64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
}
}
-/* If this is the _GLOBAL_OFFSET_TABLE_ symbol, then it should point to
- .got[0] even if there is a .got.plt section. */
+/* If this is the _GLOBAL_OFFSET_TABLE_ symbol, then it should point in
+ the .got even if there is a .got.plt section.
+ https://sourceware.org/ml/libc-ports/2013-06/msg00057.html
+ https://bugzilla.redhat.com/show_bug.cgi?id=1201778
+ */
bool
aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
const char *name, const GElf_Shdr *destshdr)
@@ -66,7 +69,8 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
&& strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
{
const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name);
- if (sname != NULL && strcmp (sname, ".got.plt") == 0)
+ if (sname != NULL
+ && (strcmp (sname, ".got") == 0 || strcmp (sname, ".got.plt") == 0))
{
Elf_Scn *scn = NULL;
while ((scn = elf_nextscn (elf, scn)) != NULL)
@@ -77,7 +81,8 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
{
sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name);
if (sname != NULL && strcmp (sname, ".got") == 0)
- return sym->st_value == shdr->sh_addr;
+ return (sym->st_value >= shdr->sh_addr
+ && sym->st_value < shdr->sh_addr + shdr->sh_size);
}
}
}

View File

@ -1,7 +1,7 @@
Name: elfutils Name: elfutils
Summary: A collection of utilities and DSOs to handle compiled objects Summary: A collection of utilities and DSOs to handle compiled objects
Version: 0.161 Version: 0.161
%global baserelease 6 %global baserelease 7
URL: https://fedorahosted.org/elfutils/ URL: https://fedorahosted.org/elfutils/
%global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/ %global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/
License: GPLv3+ and (GPLv2+ or LGPLv3+) License: GPLv3+ and (GPLv2+ or LGPLv3+)
@ -52,6 +52,7 @@ Patch3: elfutils-0.161-formref-type.patch
# rhbz#1189928 - Consider sh_addralign 0 as 1 # rhbz#1189928 - Consider sh_addralign 0 as 1
Patch4: elfutils-0.161-addralign.patch Patch4: elfutils-0.161-addralign.patch
Patch5: elfutils-0.161-copyreloc.patch Patch5: elfutils-0.161-copyreloc.patch
Patch6: elfutils-0.161-aarch64relro.patch
%if !%{compat} %if !%{compat}
Release: %{baserelease}%{?dist} Release: %{baserelease}%{?dist}
@ -218,6 +219,7 @@ sed -i.scanf-m -e 's/%m/%a/g' src/addr2line.c tests/line2addr.c
%patch3 -p1 -b .formref_type %patch3 -p1 -b .formref_type
%patch4 -p1 -b .addralign %patch4 -p1 -b .addralign
%patch5 -p1 -b .copyreloc %patch5 -p1 -b .copyreloc
%patch6 -p1 -b .aarch64relro
find . -name \*.sh ! -perm -0100 -print | xargs chmod +x find . -name \*.sh ! -perm -0100 -print | xargs chmod +x
@ -346,6 +348,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.a %{_libdir}/libelf.a
%changelog %changelog
* Mon Mar 23 2015 Mark Wielaard <mjw@redhat.com> - 0.161-7
- Add elfutils-0.161-aarch64relro.patch (#1201778)
* Mon Mar 09 2015 Mark Wielaard <mjw@redhat.com> - 0.161-6 * Mon Mar 09 2015 Mark Wielaard <mjw@redhat.com> - 0.161-6
- Add elfutils-0.161-copyreloc.patch. - Add elfutils-0.161-copyreloc.patch.