xtensa: Fix fix linker script transformation for .text / .text.fixup
PATCH 1/1 xtensa: Fix fix linker script transformation for .text / .text.fixup
Commit 779c88c94c34 ("ARM: 8321/1: asm-generic: introduce .text.fixup input section") introduced a new .text.fixup section which is merged with .text at link time. This causes xtensa builds to fail with lots of error messages similar to the following.
lib/lib.a(kobject.o): In function `kobject_create':
(.text+0x498): dangerous relocation: l32r: literal placed after use:
(.literal+0x150)
Linker script transformation needs to be updated to detect and handle the new section.
input section")
--- arch/xtensa/kernel/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/xtensa/kernel/Makefile +1 -0
@@ -29,6 +29,7 @@ AFLAGS_head.o += -mtext-section-literals sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \ -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \ + -e 's/\*(\(\.text .*\))/*(.literal \1)/g' \ -e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g' quiet_cmd__cpp_lds_S = LDS $@
Signature · 1 line
2.1.0
Max Filippov
maintainerHi Guenter,
Quoted 11 lines · Guenter Roeck
Commit
779c88c94c34("ARM: 8321/1: asm-generic: introduce .text.fixup input section") introduced a new .text.fixup section which is merged with .text at link time. This causes xtensa builds to fail with lots of error messages similar to the following.lib/lib.a(kobject.o): In function `kobject_create':
(.text+0x498): dangerous relocation: l32r: literal placed after use:(.literal+0x150)Linker script transformation needs to be updated to detect and handle the new section.
I've posted a patch for it to the linux-xtensa ML a while ago:
http://lists.linux-xtensa.org/pipermail/linux-xtensa/Week-of-Mon-20150330/001913.html
Quoted 14 lines
Fixes 779c88c94c34 ("ARM: 8321/1: asm-generic: introduce .text.fixupinput section")
Cc Ard Biesheuvel <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- arch/xtensa/kernel/Makefile | 1 + 1 file changed, 1 insertion(+)arch/xtensa/kernel/Makefile +0
-0
arch/xtensa/kernel/Makefile AFLAGS_head.o += -mtext-section-literals · line 32
Quoted 4 lines
arch/xtensa/kernel/Makefile +1
-0@@ -29,6 +29,7 @@ AFLAGS_head.o += -mtext-section-literals sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \ -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \ + -e 's/\*(\(\.text .*\))/*(.literal \1)/g' \
This doesn't handle literals for .text.fixup AFAICT.
Signature · 2 lines
Thanks. -- Max
Quoted 33 lines · Max Filippov
Hi Guenter,
Quoted 11 lines · Guenter Roeck
Commit
779c88c94c34("ARM: 8321/1: asm-generic: introduce .text.fixup input section") introduced a new .text.fixup section which is merged with .text at link time. This causes xtensa builds to fail with lots of error messages similar to the following.lib/lib.a(kobject.o): In function `kobject_create':
(.text+0x498): dangerous relocation: l32r: literal placed after use:(.literal+0x150)Linker script transformation needs to be updated to detect and handle the new section.
I've posted a patch for it to the linux-xtensa ML a while ago:
http://lists.linux-xtensa.org/pipermail/linux-xtensa/Week-of-Mon-20150330/001913.htmlQuoted 15 lines
Fixes 779c88c94c34 ("ARM: 8321/1: asm-generic: introduce .text.fixupinput section")
Cc Ard Biesheuvel <[email protected]>Cc Arnd Bergmann <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- arch/xtensa/kernel/Makefile | 1 + 1 file changed, 1 insertion(+)arch/xtensa/kernel/Makefile +0
-0@@ -29,6 +29,7 @@ AFLAGS_head.o += -mtext-section-literals
Quoted 6 lines
arch/xtensa/kernel/Makefile AFLAGS_head.o += -mtext-section-literals · line 32
Quoted 3 lines
arch/xtensa/kernel/Makefile +1
-0sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \ -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \ + -e 's/\*(\(\.text .*\))/*(.literal \1)/g' \This doesn't handle literals for .text.fixup AFAICT.
It doesn't, but then it wasn't supposed to. .text.fixup is arm specific.
Guenter
Chris Zankel
maintainerQuoted 10 lines · Guenter Roeck
Quoted 6 lines · Max Filippov
Quoted 2 lines
Linker script transformation needs to be updated to detect and handle the new section.
I've posted a patch for it to the linux-xtensa ML a while ago:
http://lists.linux-xtensa.org/pipermail/linux-xtensa/Week-of-Mon-20150330/001913.html
This doesn't handle literals for .text.fixup AFAICT.It doesn't, but then it wasn't supposed to. .text.fixup is arm specific.
Guenter
Hi Max,
It would seem Guenter's fix addresses the issue. Are there any additional benefits in your patch (better localized code, etc.?)
Cheers!
-Chris
A message that is not in the archive (sent off-list or not yet received): CAP6Y9+9GwG2DU4Yw2xOOTg8DqpgD8aDMBK8Uaiu5a4HOa7fX9Q@mail.gmail.com
Max Filippov
maintainerQuoted 2 lines · Chris Zankel
It would seem Guenter's fix addresses the issue. Are there any additional benefits in your patch (better localized code, etc.?)
It's a bit more generic. Maybe it's not an advantage.
Also we have a rule for .text already, in the first line. Instead of adding new line, closing parenthesis could be removed there:
Quoted 8 lines
arch/xtensa/kernel/Makefile +1
-0@@ -29,6 +29,7 @@ AFLAGS_head.o += -mtext-section-literals sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \ -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \ + -e 's/\*(\(\.text .*\))/*(.literal \1)/g' \
Signature · 2 lines
Thanks. -- Max