summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-01-06 01:04:49 +0000
committerMike Frysinger <vapier@gentoo.org>2006-01-06 01:04:49 +0000
commitdeb362fc70887039e1251be5a3fdf7841b18059b (patch)
treec57b2de6b3dd6f1b38898e5798de076f226cbe14 /dev-libs/elfutils/files
parentuse games eclass (bug #117921) (diff)
downloadgentoo-2-deb362fc70887039e1251be5a3fdf7841b18059b.tar.gz
gentoo-2-deb362fc70887039e1251be5a3fdf7841b18059b.tar.bz2
gentoo-2-deb362fc70887039e1251be5a3fdf7841b18059b.zip
Add a hack so eu-nm is not generated with an executable stack #116968 by Benno Schulenberg.
(Portage version: 2.1_pre3-r1)
Diffstat (limited to 'dev-libs/elfutils/files')
-rw-r--r--dev-libs/elfutils/files/elfutils-0.118-no-nested-functions.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/dev-libs/elfutils/files/elfutils-0.118-no-nested-functions.patch b/dev-libs/elfutils/files/elfutils-0.118-no-nested-functions.patch
new file mode 100644
index 000000000000..f89158b1a1b3
--- /dev/null
+++ b/dev-libs/elfutils/files/elfutils-0.118-no-nested-functions.patch
@@ -0,0 +1,59 @@
+Using nested functions causes gcc to generate trampolines which
+requires an executable stack.
+
+http://bugs.gentoo.org/116968
+
+--- elfutils/src/nm.c
++++ elfutils/src/nm.c
+@@ -926,23 +926,22 @@
+ /* Maximum size of memory we allocate on the stack. */
+ #define MAX_STACK_ALLOC 65536
+
+-static void
+-show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn,
+- GElf_Shdr *shdr, const char *prefix, const char *fname,
+- const char *fullname)
+-{
++/* hack to avoid nested functions -> executable stack */
++static Ebl *_show_symbols_ebl;
++static GElf_Shdr *_show_symbols_shdr;
++static
+ int sort_by_name (const void *p1, const void *p2)
+ {
+ GElf_SymX *s1 = (GElf_SymX *) p1;
+ GElf_SymX *s2 = (GElf_SymX *) p2;
+ int result;
+
+- result = strcmp (elf_strptr (ebl->elf, shdr->sh_link, s1->sym.st_name),
+- elf_strptr (ebl->elf, shdr->sh_link, s2->sym.st_name));
++ result = strcmp (elf_strptr (_show_symbols_ebl->elf, _show_symbols_shdr->sh_link, s1->sym.st_name),
++ elf_strptr (_show_symbols_ebl->elf, _show_symbols_shdr->sh_link, s2->sym.st_name));
+
+ return reverse_sort ? -result : result;
+ }
+-
++static
+ int sort_by_address (const void *p1, const void *p2)
+ {
+ GElf_SymX *s1 = (GElf_SymX *) p1;
+@@ -954,6 +953,11 @@
+ return reverse_sort ? -result : result;
+ }
+
++static void
++show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn,
++ GElf_Shdr *shdr, const char *prefix, const char *fname,
++ const char *fullname)
++{
+ /* Get the section header string table index. */
+ size_t shstrndx;
+ if (elf_getshstrndx (ebl->elf, &shstrndx) < 0)
+@@ -1129,6 +1133,8 @@
+ nentries = nentries_used;
+
+ /* Sort the entries according to the users wishes. */
++ _show_symbols_ebl = ebl;
++ _show_symbols_shdr = shdr;
+ if (sort == sort_name)
+ qsort (sym_mem, nentries, sizeof (GElf_SymX), sort_by_name);
+ else if (sort == sort_numeric)