Skip to contentSkip to conversation

4.9.0 build error on Alpha

BUG Bob Tracy 5 participants 16 messages Dec 30, 2016 – Jan 12, 2017 Alpha port

lore
Share & tools
lore

Bob Tracy

author
#0 lore raw

I'm guessing this is Alpha-specific at the moment, because I'm getting a world-class lettin' alone from the kernel developers.

Saw another binutils update come through a couple of days ago, so tried another from-scratch kernel build. No change in the outcome. This "smells" like a gcc or binutils issue, because the Alpha-specific code being compiled and linked against hasn't changed in a very long time. Both "strcat" and "stxcpy" come from assembly language source files in the "arch/alpha/lib" directory.

In addition to trying new toolchain components as updates appear, I've tried making various changes to my kernel configuration in an attempt to make the problem move to a different place in the build process or go away entirely. Nothing has had any effect whatsoever.

I would reluctantly try downgrading gcc to version 4.x if someone thought that might make any difference. I'd rather identify how the current toolchain is going off in the weeds, if that's what is going on here.

Quoted 7 lines

LD init/built-in.o
arch/alpha/lib/lib.a(strcat.o): In function `strcat':
(.text+0x60): relocation truncated to fit: BRADDR against symbol __stxcpy' defined in .text section in arch/alpha/lib/lib.a(stxcpy.o) arch/alpha/lib/lib.a(strncat.o): In function strncat':
(.text+0x60): relocation truncated to fit: BRADDR against symbol `__stxncpy' defined in .text section in arch/alpha/lib/lib.a(stxncpy.o) Makefile:969: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

--Bob

maintainer
#1 lore raw

FWIW, when I saw your first email I tried compiling with gcc-4.9.4, 5.4.0, and 6.2.0. All compiled my config fine.

I'm guessing it's another symptom of the old "kernel too big" problem?

author
#2 lore raw
Quoted 2 lines · Matt Turner

FWIW, when I saw your first email I tried compiling with gcc-4.9.4, 5.4.0, and 6.2.0. All compiled my config fine.

That's worth quite a bit to me, actually :-). Tells me that downgrading my toolchain is probably a waste of time and effort.

Quoted 1 line

I'm guessing it's another symptom of the old "kernel too big" problem?

How has this been worked around in the past? I have a fairly feature-full kernel, but the only built-in drivers are for the things that have to be present at boot time.

If drivers compiled as modules contribute to the bloat, I could easily omit file system support for things I'll likely never see attached to an alpha. Similarly, drivers for removable USB devices I don't currently use with the system could be omitted as well. Netfilter keeps growing like the hairball it is: features I'm not likely to ever use could be disabled if that might help.

--Bob

#3 lore raw
Quoted 5 lines · Bob Tracy
Quoted 1 line

I'm guessing it's another symptom of the old "kernel too big" problem?

How has this been worked around in the past? I have a fairly feature-full kernel, but the only built-in drivers are for the things that have to be present at boot time.

This looks like a link ordering issue to me, the failures are branches
between objects built from arch/alpha/lib/*.S assembly sources, which must have got moved apart more with the switch of the compiler version.

One workaround might be making them a .o rather than .a target, which
will ensure they're close to each other, at the cost of a small kernel size increase if some of these functions would otherwise be unused.

Replacing branches with full address calculation and register jumps might
be another, although this would cost some run time instead, so I think the former approach is a bit better.

HTH,

Maciej

#4 lore raw

Hi Bob,

Quoted 11 lines · Maciej W. Rozycki
Quoted 5 lines · Bob Tracy
Quoted 1 line

I'm guessing it's another symptom of the old "kernel too big" problem?

How has this been worked around in the past? I have a fairly feature-full kernel, but the only built-in drivers are for the things that have to be present at boot time.

This looks like a link ordering issue to me, the failures are branches
between objects built from arch/alpha/lib/*.S assembly sources, which must have got moved apart more with the switch of the compiler version.

Seems right.

Quoted 3 lines

One workaround might be making them a .o rather than .a target, which
will ensure they're close to each other, at the cost of a small kernel size increase if some of these functions would otherwise be unused.

Possible.

Quoted 3 lines

Replacing branches with full address calculation and register jumps might
be another, although this would cost some run time instead, so I think the former approach is a bit better.

Another possibility could be to put all the lib functions into a "alphalib" section into the final vmlinux.
For that add at the top of each of the .S files in lib/
.section .alphalib,"ax"
and apply the attached patch for arch/alpha/kernel/vmlinux.lds.S Patch and suggestion is completely untested.

Helge

arch/alpha/kernel/vmlinux.lds.S +3 -0
index cebecfb..88af6bc 100644
@@ -20,6 +20,9 @@ SECTIONS
 	_text = .;	/* Text and read-only data */
 	.text : {
 		HEAD_TEXT
+		.alphalib: {
+			*(.alphalib)
+		} :kernel
 		TEXT_TEXT
 		SCHED_TEXT
 		CPUIDLE_TEXT
author
#5 lore raw
Quoted 7 lines · Helge Deller

(...)
Another possibility could be to put all the lib functions into a "alphalib" section into the final vmlinux.
For that add at the top of each of the .S files in lib/
.section .alphalib,"ax"
and apply the attached patch for arch/alpha/kernel/vmlinux.lds.S Patch and suggestion is completely untested.

Worth a try. I'll get going on this and report back with the results in a few hours.

--Bob

author
#6 lore raw
Quoted 11 lines · Bob Tracy
Quoted 7 lines · Helge Deller

(...)
Another possibility could be to put all the lib functions into a "alphalib" section into the final vmlinux.
For that add at the top of each of the .S files in lib/
.section .alphalib,"ax"
and apply the attached patch for arch/alpha/kernel/vmlinux.lds.S Patch and suggestion is completely untested.

Worth a try. I'll get going on this and report back with the results in a few hours.

Apologies in advance if the formatting isn't properly preserved :-(. Syntax error on line 294 of the generated "vmlinux.lds" file, which is right where the added ".alphalib:" stanza begins:

(...)
OUTPUT_FORMAT("elf64-alpha")
OUTPUT_ARCH(alpha)
ENTRY(__start)
PHDRS { kernel PT_LOAD; note PT_NOTE; }
jiffies = jiffies_64;
SECTIONS
{
. = 0xfffffc0000310000;
_text = .; /* Text and read-only data */
.text : {
*(.head.text)
.alphalib: {
*(.alphalib)
} :kernel
. = ALIGN(8); *(.text.hot .text .text.fixup .text.unlikely) *(.ref.text) . = ALIGN(8); __sched_text_start = .; *(.sched.text) __sched_text_end = .; . = ALIGN(8); __cpuidle_text_start = .; *(.cpuidle.text) __cpuidle_text_end = .; . = ALIGN(8); __lock_text_start = .; *(.spinlock.text) __lock_text_end = .; *(.fixup)
*(.gnu.warning)
} :kernel
swapper_pg_dir = (0xfffffc0000000000 +0x300000);
_etext = .; /* End of text section */
.notes : AT(ADDR(.notes) - 0) { __start_notes = .; *(.note.*) __stop_notes = .; } :kernel :note
.dummy : {
*(.dummy)
} :kernel
(...)

--Bob

#7 lore raw
Quoted 6 lines · Bob Tracy
Quoted 6 lines
Quoted 6 lines

Another possibility could be to put all the lib functions into a "alphalib" section into the final vmlinux.
For that add at the top of each of the .S files in lib/
.section .alphalib,"ax"
and apply the attached patch for arch/alpha/kernel/vmlinux.lds.S Patch and suggestion is completely untested.

Indeed, this is even better as there won't be any unused objects included
in output this way. Good idea!

Quoted 6 lines
Quoted 2 lines

Worth a try. I'll get going on this and report back with the results in a few hours.

Apologies in advance if the formatting isn't properly preserved :-(. Syntax error on line 294 of the generated "vmlinux.lds" file, which is right where the added ".alphalib:" stanza begins:

You need to keep the `*(.alphalib)' line only, i.e. drop the first and
the last line added by the patch, as the output section statement and its curly braces surrounding input section specifiers are already produced elsewhere. As a good measure you may want to prepend `ALIGN_FUNCTION();' as well, although I'm not sure offhand if it really matters here.

HTH,

Maciej

author
#8 lore raw
Quoted 6 lines · Maciej W. Rozycki

(...)
You need to keep the `*(.alphalib)' line only, i.e. drop the first and
the last line added by the patch, as the output section statement and its curly braces surrounding input section specifiers are already produced elsewhere.
(...)

Thought to try this, but, bad news.

With '.section .alphalib,"ax"' added to the top of "arch/alpha/lib/*.S" (below opening comment block, if present, but prior to any include directives), and the modified patch to "arch/alpha/kernel/vmlinux.lds.S", I now get multiple relocation errors as follows:

LD init/built-in.o
arch/alpha/lib/lib.a(strcat.o): In function `strcat':
(.text+0x60): relocation truncated to fit: BRADDR against symbol __stxcpy' defined in .text section in arch/alpha/lib/lib.a(stxcpy.o) arch/alpha/lib/lib.a(strncat.o): In function strncat':
(.text+0x60): relocation truncated to fit: BRADDR against symbol __stxncpy' defined in .text section in arch/alpha/lib/lib.a(stxncpy.o) drivers/built-in.o: In function radeon_cs_parser_init.part.4':
drivers/gpu/drm/radeon/radeon_cs.o:(.text+0x119bd0): relocation truncated to fit: BRSGP against symbol __copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o) drivers/gpu/drm/radeon/radeon_cs.o:(.text+0x119cd8): relocation truncated to fit: BRSGP against symbol __copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o) drivers/gpu/drm/radeon/radeon_cs.o:(.text+0x119db4): relocation truncated to fit: BRSGP against symbol __copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o) drivers/built-in.o: In function radeon_cs_ioctl':
(.text+0x11aa28): relocation truncated to fit: BRSGP against symbol __copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o) drivers/built-in.o: In function radeon_cs_ioctl':
(.text+0x11aaf8): relocation truncated to fit: BRSGP against symbol __copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o) drivers/built-in.o: In function vga_arb_read':
drivers/gpu/vga/.tmp_vgaarb.o:(.text+0x215844): relocation truncated to fit: BRSGP against symbol __copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o) drivers/built-in.o: In function vga_arb_write':
drivers/gpu/vga/.tmp_vgaarb.o:(.text+0x2162c4): relocation truncated to fit: BRSGP against symbol __copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o) drivers/built-in.o: In function dma_buf_ioctl':
drivers/dma-buf/.tmp_dma-buf.o:(.text+0x233998): relocation truncated to fit: BRSGP against symbol __copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o) drivers/built-in.o: In function generic_ide_ioctl':
(.text+0x237c64): additional relocation overflows omitted from the output
Makefile:969: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

--Bob

#9 lore raw
Quoted 15 lines · Bob Tracy
Quoted 6 lines · Maciej W. Rozycki

(...)
You need to keep the `*(.alphalib)' line only, i.e. drop the first and
the last line added by the patch, as the output section statement and its curly braces surrounding input section specifiers are already produced elsewhere.
(...)

Thought to try this, but, bad news.

With '.section .alphalib,"ax"' added to the top of "arch/alpha/lib/*.S" (below opening comment block, if present, but prior to any include directives), and the modified patch to "arch/alpha/kernel/vmlinux.lds.S", I now get multiple relocation errors as follows:

Quoted 7 lines

LD init/built-in.o
arch/alpha/lib/lib.a(strcat.o): In function `strcat':
(.text+0x60): relocation truncated to fit: BRADDR against symbol __stxcpy' defined in .text section in arch/alpha/lib/lib.a(stxcpy.o) arch/alpha/lib/lib.a(strncat.o): In function strncat':
(.text+0x60): relocation truncated to fit: BRADDR against symbol __stxncpy' defined in .text section in arch/alpha/lib/lib.a(stxncpy.o) drivers/built-in.o: In function radeon_cs_parser_init.part.4':
drivers/gpu/drm/radeon/radeon_cs.o:(.text+0x119bd0): relocation truncated to fit: BRSGP against symbol `__copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o)

Try changing the #ifdef MODULE above __copy_tofrom_user_nocheck to
#if 1 in uaccess.h. That should fix the copy_user relocation errors.

Cheers
Michael.

author
#10 lore raw
Quoted 14 lines · Michael Cree
Quoted 5 lines · Bob Tracy

With '.section .alphalib,"ax"' added to the top of "arch/alpha/lib/*.S" (below opening comment block, if present, but prior to any include directives), and the modified patch to "arch/alpha/kernel/vmlinux.lds.S", I now get multiple relocation errors as follows:

Quoted 7 lines

LD init/built-in.o
arch/alpha/lib/lib.a(strcat.o): In function `strcat':
(.text+0x60): relocation truncated to fit: BRADDR against symbol __stxcpy' defined in .text section in arch/alpha/lib/lib.a(stxcpy.o) arch/alpha/lib/lib.a(strncat.o): In function strncat':
(.text+0x60): relocation truncated to fit: BRADDR against symbol __stxncpy' defined in .text section in arch/alpha/lib/lib.a(stxncpy.o) drivers/built-in.o: In function radeon_cs_parser_init.part.4':
drivers/gpu/drm/radeon/radeon_cs.o:(.text+0x119bd0): relocation truncated to fit: BRSGP against symbol `__copy_user' defined in .alphalib section in arch/alpha/lib/lib.a(copy_user.o)

Quoted 2 lines

Try changing the #ifdef MODULE above __copy_tofrom_user_nocheck to
#if 1 in uaccess.h. That should fix the copy_user relocation errors.

Have accumulated enough patches that I'm running a "from scratch" build rather than trusting all the dependency checking. It will be sometime next year before I report back :-).

--Bob

#11 lore raw
In reply to Bob Tracy
Quoted 4 lines · Bob Tracy

With '.section .alphalib,"ax"' added to the top of "arch/alpha/lib/*.S" (below opening comment block, if present, but prior to any include directives), and the modified patch to "arch/alpha/kernel/vmlinux.lds.S", I now get multiple relocation errors as follows:

You need to *replace* any `.text' pseudo-ops throughout with the said
`.section' pseudo-op for this to have any effect.

HTH,

Maciej

author
#12 lore raw
Quoted 2 lines · Maciej W. Rozycki

You need to *replace* any `.text' pseudo-ops throughout with the said
`.section' pseudo-op for this to have any effect.

That makes sense, especially given the fact the *original* error messages didn't change. Sorry for being "thick". Corrections made. Build proceeding...

--Bob

author
#13 lore raw
Quoted 7 lines · Bob Tracy
Quoted 2 lines · Maciej W. Rozycki

You need to *replace* any `.text' pseudo-ops throughout with the said
`.section' pseudo-op for this to have any effect.

That makes sense, especially given the fact the *original* error messages didn't change. Sorry for being "thick". Corrections made. Build proceeding...

That did the trick, along with Michael's "uaccess.h" patch. Success.

--Bob

author Tested-by
#14 lore raw

Credit to all who participated in working this issue. Matt -- attached is a patch set to be applied against the kernel.org 4.9.0 source tree. If it passes inspection, please approve and forward upstream.

Apologies for not including in-line, but I don't trust my mailer to preserve formatting unless I send as an attachment.

Thanks.
--Bob

This series of patches addresses vmlinux ld relocation errors on the Alpha architecture that appeared at some point after the 4.8.0 release of the kernel.org source tree. Fixes are as suggested by Helge Deller <[email protected]> and Michael Cree <[email protected]>, with significant input from Maciej W. Rozycki <[email protected]> and Matt Turner <[email protected]>. The patch set is known to apply cleanly to 4.9.0.

Approach is to define a new "alphalib" section for all the Alpha-specific library functions to be linked into the final vmlinux. The "uaccess.h" patch addresses "__copy_user" relocation errors reported elsewhere.

arch/alpha/include/asm/uaccess.h +1 -1
@@ -344,7 +344,7 @@
 /* This little bit of silliness is to get the GP loaded for a function
    that ordinarily wouldn't.  Otherwise we could have it done by the macro
    directly, which can be optimized the linker.  */
-#ifdef MODULE
+#if 1
 #define __module_address(sym)		"r"(sym),
 #define __module_call(ra, arg, sym)	"jsr $" #ra ",(%" #arg ")," #sym
 #else
arch/alpha/kernel/vmlinux.lds.S +1 -0
@@ -20,6 +20,7 @@
 	_text = .;	/* Text and read-only data */
 	.text : {
 		HEAD_TEXT
+		*(.alphalib)
 		TEXT_TEXT
 		SCHED_TEXT
 		CPUIDLE_TEXT
arch/alpha/lib/callback_srm.S +1 -1
@@ -5,7 +5,7 @@
 #include <asm/console.h>
 #include <asm/export.h>
 
-.text
+.section .alphalib,"ax"
 #define HWRPB_CRB_OFFSET 0xc0
 
 #if defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC)
arch/alpha/lib/clear_page.S +1 -1
@@ -4,7 +4,7 @@
  * Zero an entire page.
  */
 #include <asm/export.h>
-	.text
+	.section .alphalib,"ax"
 	.align 4
 	.global clear_page
 	.ent clear_page
arch/alpha/lib/clear_user.S +2 -0
@@ -24,6 +24,8 @@
  * Clobbers:
  *	$1,$2,$3,$4,$5,$6
  */
+.section .alphalib,"ax"
+
 #include <asm/export.h>
 
 /* Allow an exception for an insn; exit if we get one.  */
arch/alpha/lib/copy_page.S +1 -1
@@ -4,7 +4,7 @@
  * Copy an entire page.
  */
 #include <asm/export.h>
-	.text
+	.section .alphalib,"ax"
 	.align 4
 	.global copy_page
 	.ent copy_page
arch/alpha/lib/copy_user.S +1 -0
@@ -26,6 +26,7 @@
  *	$1,$2,$3,$4,$5,$6,$7
  */
 
+.section .alphalib,"ax"
 #include <asm/export.h>
 
 /* Allow an exception for an insn; exit if we get one.  */
arch/alpha/lib/csum_ipv6_magic.S +1 -0
@@ -12,6 +12,7 @@
  * added by Ivan Kokshaysky <[email protected]>
  */
 
+.section .alphalib,"ax"
 #include <asm/export.h>
 	.globl csum_ipv6_magic
 	.align 4
arch/alpha/lib/dbg_current.S +1 -1
@@ -7,7 +7,7 @@
 
 #include <asm/pal.h>
 
-	.text
+	.section .alphalib,"ax"
 	.set noat
 
 	.globl _mcount
arch/alpha/lib/dbg_stackcheck.S +1 -1
@@ -7,7 +7,7 @@
 
 #include <asm/asm-offsets.h>
 
-	.text
+	.section .alphalib,"ax"
 	.set noat
 
 	.align 3
arch/alpha/lib/dbg_stackkill.S +1 -1
@@ -8,7 +8,7 @@
 
 #include <asm/asm-offsets.h>
 
-	.text
+	.section .alphalib,"ax"
 	.set noat
 
 	.align 5
arch/alpha/lib/divide.S +1 -0
@@ -45,6 +45,7 @@
  *	$28 - compare status
  */
 
+.section .alphalib,"ax"
 #include <asm/export.h>
 #define halt .long 0
 
arch/alpha/lib/ev67-strcat.S +1 -1
@@ -20,7 +20,7 @@
  */
 
 #include <asm/export.h>
-	.text
+	.section .alphalib,"ax"
 
 	.align 4
 	.globl strcat
arch/alpha/lib/ev67-strchr.S +1 -0
@@ -15,6 +15,7 @@
  *	L	- lower subcluster; L0 - subcluster L0; L1 - subcluster L1
  * Try not to change the actual algorithm if possible for consistency.
  */
+.section .alphalib,"ax"
 #include <asm/export.h>
 #include <asm/regdef.h>
 
arch/alpha/lib/ev67-strlen.S +1 -0
@@ -17,6 +17,7 @@
  *	U	- upper subcluster; U0 - subcluster U0; U1 - subcluster U1
  *	L	- lower subcluster; L0 - subcluster L0; L1 - subcluster L1
  */
+.section .alphalib,"ax"
 #include <asm/export.h>
 	.set noreorder
 	.set noat
arch/alpha/lib/ev67-strncat.S +1 -1
@@ -21,7 +21,7 @@
  */
 
 #include <asm/export.h>
-	.text
+	.section .alphalib,"ax"
 
 	.align 4
 	.globl strncat
arch/alpha/lib/ev67-strrchr.S +1 -0
@@ -18,6 +18,7 @@
  *	L	- lower subcluster; L0 - subcluster L0; L1 - subcluster L1
  */
 
+.section .alphalib,"ax"
 #include <asm/export.h>
 #include <asm/regdef.h>
 
arch/alpha/lib/ev6-clear_page.S +1 -1
@@ -4,7 +4,7 @@
  * Zero an entire page.
  */
 #include <asm/export.h>
-        .text
+	.section .alphalib,"ax"
         .align 4
         .global clear_page
         .ent clear_page
arch/alpha/lib/ev6-clear_user.S +1 -0
@@ -43,6 +43,7 @@
  *	want to leave a hole (and we also want to avoid repeating lots of work)
  */
 
+.section .alphalib,"ax"
 #include <asm/export.h>
 /* Allow an exception for an insn; exit if we get one.  */
 #define EX(x,y...)			\
arch/alpha/lib/ev6-copy_page.S +1 -1
@@ -57,7 +57,7 @@
    less important than the dcache miss case.  */
 
 #include <asm/export.h>
-	.text
+	.section .alphalib,"ax"
 	.align 4
 	.global copy_page
 	.ent copy_page
arch/alpha/lib/ev6-copy_user.S +1 -0
@@ -37,6 +37,7 @@
  *	L	- lower subcluster; L0 - subcluster L0; L1 - subcluster L1
  */
 
+.section .alphalib,"ax"
 #include <asm/export.h>
 /* Allow an exception for an insn; exit if we get one.  */
 #define EXI(x,y...)			\
arch/alpha/lib/ev6-csum_ipv6_magic.S +1 -0
@@ -52,6 +52,7 @@
  * may cause additional delay in rare cases (load-load replay traps).
  */
 
+.section .alphalib,"ax"
 #include <asm/export.h>
 	.globl csum_ipv6_magic
 	.align 4
arch/alpha/lib/ev6-divide.S +1 -0
@@ -55,6 +55,7 @@
  * Try not to change the actual algorithm if possible for consistency.
  */
 
+.section .alphalib,"ax"
 #include <asm/export.h>
 #define halt .long 0
 
arch/alpha/lib/ev6-memchr.S +1 -0
@@ -27,6 +27,7 @@
  *	L	- lower subcluster; L0 - subcluster L0; L1 - subcluster L1
  * Try not to change the actual algorithm if possible for consistency.
  */
+.section .alphalib,"ax"
 #include <asm/export.h>
         .set noreorder
         .set noat
arch/alpha/lib/ev6-memcpy.S +1 -0
@@ -19,6 +19,7 @@
  * Temp usage notes:
  *	$1,$2,		- scratch
  */
+.section .alphalib,"ax"
 #include <asm/export.h>
 	.set noreorder
 	.set noat
arch/alpha/lib/ev6-memset.S +1 -1
@@ -29,7 +29,7 @@
 #include <asm/export.h>
 	.set noat
 	.set noreorder
-.text
+.section .alphalib,"ax"
 	.globl memset
 	.globl __memset
 	.globl ___memset
arch/alpha/lib/ev6-stxcpy.S +1 -1
@@ -35,7 +35,7 @@
 	.set noat
 	.set noreorder
 
-	.text
+	.section .alphalib,"ax"
 
 /* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that
    doesn't like putting the entry point for a procedure somewhere in the
arch/alpha/lib/ev6-stxncpy.S +1 -1
@@ -43,7 +43,7 @@
 	.set noat
 	.set noreorder
 
-	.text
+	.section .alphalib,"ax"
 
 /* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that
    doesn't like putting the entry point for a procedure somewhere in the
arch/alpha/lib/memchr.S +1 -0
@@ -31,6 +31,7 @@
       - only minimum number of quadwords may be accessed
       - the third argument is an unsigned long
 */
+.section .alphalib,"ax"
 #include <asm/export.h>
         .set noreorder
         .set noat
arch/alpha/lib/memmove.S +1 -1
@@ -9,7 +9,7 @@
 #include <asm/export.h>        
 	.set noat
 	.set noreorder
-	.text
+	.section .alphalib,"ax"
 
 	.align 4
 	.globl memmove
arch/alpha/lib/memset.S +1 -1
@@ -16,7 +16,7 @@
 #include <asm/export.h>
 	.set noat
 	.set noreorder
-.text
+.section .alphalib,"ax"
 	.globl memset
 	.globl __memset
 	.globl ___memset
arch/alpha/lib/strcat.S +1 -1
@@ -6,7 +6,7 @@
  */
 #include <asm/export.h>
 
-	.text
+	.section .alphalib,"ax"
 
 	.align 3
 	.globl strcat
arch/alpha/lib/strchr.S +1 -0
@@ -5,6 +5,7 @@
  * Return the address of a given character within a null-terminated
  * string, or null if it is not found.
  */
+.section .alphalib,"ax"
 #include <asm/export.h>
 #include <asm/regdef.h>
 
arch/alpha/lib/strcpy.S +1 -1
@@ -6,7 +6,7 @@
  * to the null-terminator in the source.
  */
 #include <asm/export.h>
-	.text
+	.section .alphalib,"ax"
 
 	.align 3
 	.globl strcpy
arch/alpha/lib/strlen.S +1 -0
@@ -11,6 +11,7 @@
  *	  do this instead of the 9 instructions that
  *	  binary search needs).
  */
+.section .alphalib,"ax"
 #include <asm/export.h>
 	.set noreorder
 	.set noat
arch/alpha/lib/strncat.S +1 -1
@@ -10,7 +10,7 @@
  * implementation in lib/string.c and is, IMHO, more sensible.
  */
 #include <asm/export.h>
-	.text
+	.section .alphalib,"ax"
 
 	.align 3
 	.globl strncat
arch/alpha/lib/strncpy.S +1 -1
@@ -14,7 +14,7 @@
 	.set noat
 	.set noreorder
 
-	.text
+	.section .alphalib,"ax"
 
 	.align 4
 	.globl strncpy
arch/alpha/lib/strrchr.S +1 -0
@@ -5,6 +5,7 @@
  * Return the address of the last occurrence of a given character
  * within a null-terminated string, or null if it is not found.
  */
+.section .alphalib,"ax"
 #include <asm/export.h>
 #include <asm/regdef.h>
 
arch/alpha/lib/stxcpy.S +1 -1
@@ -25,7 +25,7 @@
 	.set noat
 	.set noreorder
 
-	.text
+	.section .alphalib,"ax"
 
 /* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that
    doesn't like putting the entry point for a procedure somewhere in the
arch/alpha/lib/stxncpy.S +1 -1
@@ -33,7 +33,7 @@
 	.set noat
 	.set noreorder
 
-	.text
+	.section .alphalib,"ax"
 
 /* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that
    doesn't like putting the entry point for a procedure somewhere in the
#15 lore raw

Bob,

Quoted 6 lines

Credit to all who participated in working this issue. Matt -- attached is a patch set to be applied against the kernel.org 4.9.0 source tree. If it passes inspection, please approve and forward upstream.

Apologies for not including in-line, but I don't trust my mailer to preserve formatting unless I send as an attachment.

Thanks for your contribution; you need to add a `Signed-off-by' tag
though for your change to go anywhere.

Also I think the <asm/uaccess.h> part will need some further work; at the
very least the comment needs to be updated to state why the conditional has now been hardwired. Ultimately I think all the hackery can go and __copy_tofrom_user_nocheck' and __clear_user' be replaced with direct calls to __copy_user' and __do_clear_user' respectively (and __do_clear_user' renamed to __clear_user' at the same time) as the +/- 4MiB branch range is too low these days to guarantee a kernel binary to fit within.

Alternatively a configuration option might be added for the branch
optimisation to stay instead if selected, perhaps also adding the `-msmall-text' compiler option to let small configurations take advantage of it globally rather than just in <asm/uaccess.h>. This might not be liked by people running build bots though as it would inevitably cause some configurations to fail linking.

Maciej