[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C200, 712/80: strange sysfs issues with Linux 4.18.0-1-parisc



* John David Anglin <dave.anglin@bell.net>:
> On 2018-11-28 12:14 p.m., Helge Deller wrote:
> >   7 .text         00000c8c  00000000  00000000  00016910  2**2
> >                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
> >   8 .text         00000000  00000000  00000000  0001759c  2**0
> >                   CONTENTS, ALLOC, LOAD, READONLY, CODE
> > 
> > As can be seen, we now get multiple sections all named ".text" which is
> > what triggers the kernel warning.
> > 
> > It seems we need to revert the patch, or find a way that the compiler
> > doesn't produce multiple .text sections...?
> > 
> The linker should merge them.  It looks like some .text sections may
> be lacking a .align directive.  Maybe that's the problem.

I only see one section with "2**0" alignment, and that one is even empty
(length of 0 bytes).
I tried the attached patch which adds a module linker script, but it doesn't help either.

This is what I see now. Why aren't the last .text sections (#2-6 a
least) merged? Are there any linker options I can try?

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
...
  2 .text         000004a4  00001000  00001000  00001000  2**12
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  3 .text         0000984c  00000000  00000000  000014a4  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  4 .text         00005cdc  00000000  00000000  0000acf0  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  5 .text         00003e20  00000000  00000000  000109cc  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  6 .text         00000b88  00000000  00000000  000147ec  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  7 .text         00000000  00000000  00000000  00015374  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

But maybe we should revert to -ffunction-sections for modules anyway.
If all .text sections get merged it may happen that we get too big
modules again which fail to load because the distance for jumps are too
far. Currently the module loader will insert jump tables between
sections if necessary...

Helge


diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index d047a09d660f..111e2bf2fc20 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -71,6 +71,8 @@ ifdef CONFIG_MLONGCALLS
 KBUILD_CFLAGS_KERNEL += -mlong-calls
 endif
 
+KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/parisc/module.lds
+
 # select which processor to optimise for
 cflags-$(CONFIG_PA7000)		+= -march=1.1 -mschedule=7100
 cflags-$(CONFIG_PA7200)		+= -march=1.1 -mschedule=7200
diff --git a/arch/parisc/module.lds b/arch/parisc/module.lds
new file mode 100644
index 000000000000..b3573d3ce805
--- /dev/null
+++ b/arch/parisc/module.lds
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+SECTIONS {
+	/* Group all text sections into a single section: */
+	.text : ALIGN(4096)
+	{
+		*(.text .text.* .fixup)
+	}
+	.init.text : ALIGN(4096)
+	{
+		*(.init.text .init.text.*)
+	}
+	.exit.text : ALIGN(4096)
+	{
+		*(.exit.text .exit.text.*)
+	}
+}


Reply to: