From 06985213c2318985dec26014d91ab9a2a0252550 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 22 Jul 2014 19:04:36 +0200 Subject: fix kernel module linking for xtensa, from buildroot --- .../patches/2.24/ld-segfault-linux-modules.xtensa | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 toolchain/binutils/patches/2.24/ld-segfault-linux-modules.xtensa (limited to 'toolchain/binutils/patches/2.24/ld-segfault-linux-modules.xtensa') diff --git a/toolchain/binutils/patches/2.24/ld-segfault-linux-modules.xtensa b/toolchain/binutils/patches/2.24/ld-segfault-linux-modules.xtensa new file mode 100644 index 000000000..6a0846ef8 --- /dev/null +++ b/toolchain/binutils/patches/2.24/ld-segfault-linux-modules.xtensa @@ -0,0 +1,47 @@ +From e7d17e71cdc10a2e81e454ce3b9637f1b2a587f2 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Thu, 10 Jul 2014 01:47:33 +0400 +Subject: [PATCH] Fix xtensa ld segfault when linking linux modules + +is_inconsistent_linkonce_section makes an assumption that section name +that starts with ".gnu.linkonce.prop." has one more dot in its suffix. +However gas generates such section name by insertion of "prop." right +after ".gnu.linkonce." part of the name of the original section. So, for +section named ".gnu.linkonce.this_module" corresponding property section +name does not satisfy the assumption. Such section names are common in +linux modules. This bug was exposed by the patch "a35d5e8 Fix alignment +for the first section frag on xtensa", that makes gas produce property +section for each section that has ".align" directive in it. + +Use suffix that immediately follows ".gnu.linkonce.prop." when there are +no more dots following it. + +2014-07-10 Max Filippov + +ld/ + * emultempl/xtensaelf.em (is_inconsistent_linkonce_section): + correctly handle missing dot in section name after + ".gnu.linkonce.prop.". +--- +Backported from: e7d17e71cdc10a2e81e454ce3b9637f1b2a587f2 +Changes to ld/ChangeLog file are dropped. + + ld/emultempl/xtensaelf.em | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em +index 151eea4..948d18d 100644 +--- a/ld/emultempl/xtensaelf.em ++++ b/ld/emultempl/xtensaelf.em +@@ -1310,7 +1310,7 @@ is_inconsistent_linkonce_section (asection *sec) + for Tensilica's XCC compiler. */ + name = sec_name + linkonce_len; + if (CONST_STRNEQ (name, "prop.")) +- name = strchr (name + 5, '.') + 1; ++ name = strchr (name + 5, '.') ? strchr (name + 5, '.') + 1 : name + 5; + else if (name[1] == '.' + && (name[0] == 'p' || name[0] == 'e' || name[0] == 'h')) + name += 2; +-- +1.8.1.4 + -- cgit v1.2.3