2016-12-14 12:55:09

by Stafford Horne

[permalink] [raw]
Subject: [PATCH] openrisc: Add _text symbol to fix ksym build error

The build report reports:

.tmp_kallsyms1.o: In function `kallsyms_relative_base':
>> (.rodata+0x8a18): undefined reference to `_text'

This is when using 'make alldefconfig'. Adding this _text symbol to mark
the start of the kernel as in other architecture fixes this.

Signed-off-by: Stafford Horne <[email protected]>
---
arch/openrisc/kernel/vmlinux.lds.S | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S
index ef31fc2..58eaca0 100644
--- a/arch/openrisc/kernel/vmlinux.lds.S
+++ b/arch/openrisc/kernel/vmlinux.lds.S
@@ -44,6 +44,8 @@ SECTIONS
/* Read-only sections, merged into text segment: */
. = LOAD_BASE ;

+ _text = .;
+
/* _s_kernel_ro must be page aligned */
. = ALIGN(PAGE_SIZE);
_s_kernel_ro = .;
@@ -66,6 +68,7 @@ SECTIONS
* fixup is definitely necessary
*/

+ _data = .;
_sdata = .;

/* Page alignment required for RO_DATA_SECTION */
--
2.7.4


2016-12-14 13:14:03

by Stafford Horne

[permalink] [raw]
Subject: Re: [OpenRISC] [PATCH] openrisc: Add _text symbol to fix ksym build error

Hi Geert,

On Wed, Dec 14, 2016 at 01:58:32PM +0100, Geert Uytterhoeven wrote:
> Hi Stafford,
>
> On Wed, Dec 14, 2016 at 1:55 PM, Stafford Horne <[email protected]> wrote:
> > The build report reports:
> >
> > .tmp_kallsyms1.o: In function `kallsyms_relative_base':
> >>> (.rodata+0x8a18): undefined reference to `_text'
> >
> > This is when using 'make alldefconfig'. Adding this _text symbol to mark
> > the start of the kernel as in other architecture fixes this.
> >
> > Signed-off-by: Stafford Horne <[email protected]>
> > ---
> > arch/openrisc/kernel/vmlinux.lds.S | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S
> > index ef31fc2..58eaca0 100644
> > --- a/arch/openrisc/kernel/vmlinux.lds.S
> > +++ b/arch/openrisc/kernel/vmlinux.lds.S
> > @@ -44,6 +44,8 @@ SECTIONS
> > /* Read-only sections, merged into text segment: */
> > . = LOAD_BASE ;
> >
> > + _text = .;
> > +
> > /* _s_kernel_ro must be page aligned */
> > . = ALIGN(PAGE_SIZE);
> > _s_kernel_ro = .;
> > @@ -66,6 +68,7 @@ SECTIONS
> > * fixup is definitely necessary
> > */
> >
> > + _data = .;
>
> This change is not mentioned in the patch description.
> Is it required? Does it fix something different?

Good point.

I was just adding what I saw as missing in others. Also what I read in
include/asm-generic/sections.h. However, when I read a bit closer it
mentions its only optional.

I will remove, it does not fix anything.

-Stafford

> > _sdata = .;
> >
> > /* Page alignment required for RO_DATA_SECTION */
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds

2016-12-14 15:32:56

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [OpenRISC] [PATCH] openrisc: Add _text symbol to fix ksym build error

Hi Stafford,

On Wed, Dec 14, 2016 at 1:55 PM, Stafford Horne <[email protected]> wrote:
> The build report reports:
>
> .tmp_kallsyms1.o: In function `kallsyms_relative_base':
>>> (.rodata+0x8a18): undefined reference to `_text'
>
> This is when using 'make alldefconfig'. Adding this _text symbol to mark
> the start of the kernel as in other architecture fixes this.
>
> Signed-off-by: Stafford Horne <[email protected]>
> ---
> arch/openrisc/kernel/vmlinux.lds.S | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S
> index ef31fc2..58eaca0 100644
> --- a/arch/openrisc/kernel/vmlinux.lds.S
> +++ b/arch/openrisc/kernel/vmlinux.lds.S
> @@ -44,6 +44,8 @@ SECTIONS
> /* Read-only sections, merged into text segment: */
> . = LOAD_BASE ;
>
> + _text = .;
> +
> /* _s_kernel_ro must be page aligned */
> . = ALIGN(PAGE_SIZE);
> _s_kernel_ro = .;
> @@ -66,6 +68,7 @@ SECTIONS
> * fixup is definitely necessary
> */
>
> + _data = .;

This change is not mentioned in the patch description.
Is it required? Does it fix something different?

> _sdata = .;
>
> /* Page alignment required for RO_DATA_SECTION */

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds