* [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
@ 2022-10-09 19:37 Pali Rohár
2022-10-10 13:54 ` Tom Rini
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Pali Rohár @ 2022-10-09 19:37 UTC (permalink / raw)
To: u-boot, maemo-leste
For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
from Debian Buster) cannot compile following code from located in file
board/nokia/rx51/lowlevel_init.S:
kernoffs:
.word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
error which is even without line number:
AS board/nokia/rx51/lowlevel_init.o
{standard input}: Assembler messages:
{standard input}: Error: attempt to get value of unresolved symbol `L0'
make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1
I have no idea about this error and my experiments showed that ARM GNU
assembler is happy with negation of that number. So changing code to:
kernoffs:
.word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
and then replacing mathematical addition by substraction of "kernoffs"
value (so calculation of address does not change) compiles assembler file
without any error now.
There should be not any functional change.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
Btw, is somebody understanding that compile error message? Is there (or
was there) some real issue in the code, so assembler refuse to compile
it? Or have I triggered bug in GNU assembler?
---
board/nokia/rx51/lowlevel_init.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S
index 1cf8f8d8b2f7..4b66e0a86140 100644
--- a/board/nokia/rx51/lowlevel_init.S
+++ b/board/nokia/rx51/lowlevel_init.S
@@ -7,7 +7,7 @@
#include <config.h>
kernoffs: /* offset of kernel image from this address */
- .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
+ .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
kernaddr: /* address of kernel after copying */
.word KERNEL_ADDRESS
@@ -49,7 +49,7 @@ save_boot_params:
/* r0 - start of kernel before */
adr r0, kernoffs /* r0 - current address of kernoffs section */
ldr r1, kernoffs /* r1 - offset of kernel image from kernoffs section */
- add r0, r0, r1
+ sub r0, r0, r1
/* r3 - start of kernel after */
ldr r3, kernaddr
--
2.20.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
2022-10-09 19:37 [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE Pali Rohár
@ 2022-10-10 13:54 ` Tom Rini
2022-10-10 16:18 ` Pali Rohár
2022-10-14 16:46 ` Tom Rini
2022-10-18 22:16 ` Tom Rini
2 siblings, 1 reply; 7+ messages in thread
From: Tom Rini @ 2022-10-10 13:54 UTC (permalink / raw)
To: Pali Rohár; +Cc: u-boot, maemo-leste
[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]
On Sun, Oct 09, 2022 at 09:37:13PM +0200, Pali Rohár wrote:
> For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
> from Debian Buster) cannot compile following code from located in file
> board/nokia/rx51/lowlevel_init.S:
>
> kernoffs:
> .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
>
> when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
> error which is even without line number:
>
> AS board/nokia/rx51/lowlevel_init.o
> {standard input}: Assembler messages:
> {standard input}: Error: attempt to get value of unresolved symbol `L0'
> make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1
>
> I have no idea about this error and my experiments showed that ARM GNU
> assembler is happy with negation of that number. So changing code to:
>
> kernoffs:
> .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
>
> and then replacing mathematical addition by substraction of "kernoffs"
> value (so calculation of address does not change) compiles assembler file
> without any error now.
>
> There should be not any functional change.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> Btw, is somebody understanding that compile error message? Is there (or
> was there) some real issue in the code, so assembler refuse to compile
> it? Or have I triggered bug in GNU assembler?
I would suggest filing a bug with upstream GNU assembler and seeing what
they say.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
2022-10-10 13:54 ` Tom Rini
@ 2022-10-10 16:18 ` Pali Rohár
2022-10-10 16:21 ` Tom Rini
0 siblings, 1 reply; 7+ messages in thread
From: Pali Rohár @ 2022-10-10 16:18 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot, maemo-leste
On Monday 10 October 2022 09:54:02 Tom Rini wrote:
> On Sun, Oct 09, 2022 at 09:37:13PM +0200, Pali Rohár wrote:
>
> > For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
> > from Debian Buster) cannot compile following code from located in file
> > board/nokia/rx51/lowlevel_init.S:
> >
> > kernoffs:
> > .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
> >
> > when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
> > error which is even without line number:
> >
> > AS board/nokia/rx51/lowlevel_init.o
> > {standard input}: Assembler messages:
> > {standard input}: Error: attempt to get value of unresolved symbol `L0'
> > make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1
> >
> > I have no idea about this error and my experiments showed that ARM GNU
> > assembler is happy with negation of that number. So changing code to:
> >
> > kernoffs:
> > .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
> >
> > and then replacing mathematical addition by substraction of "kernoffs"
> > value (so calculation of address does not change) compiles assembler file
> > without any error now.
> >
> > There should be not any functional change.
> >
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> > Btw, is somebody understanding that compile error message? Is there (or
> > was there) some real issue in the code, so assembler refuse to compile
> > it? Or have I triggered bug in GNU assembler?
>
> I would suggest filing a bug with upstream GNU assembler and seeing what
> they say.
And it is really a bug? Is not that issue in current code?
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
2022-10-10 16:18 ` Pali Rohár
@ 2022-10-10 16:21 ` Tom Rini
2022-10-10 17:21 ` Pali Rohár
0 siblings, 1 reply; 7+ messages in thread
From: Tom Rini @ 2022-10-10 16:21 UTC (permalink / raw)
To: Pali Rohár; +Cc: u-boot, maemo-leste
[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]
On Mon, Oct 10, 2022 at 06:18:08PM +0200, Pali Rohár wrote:
> On Monday 10 October 2022 09:54:02 Tom Rini wrote:
> > On Sun, Oct 09, 2022 at 09:37:13PM +0200, Pali Rohár wrote:
> >
> > > For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
> > > from Debian Buster) cannot compile following code from located in file
> > > board/nokia/rx51/lowlevel_init.S:
> > >
> > > kernoffs:
> > > .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
> > >
> > > when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
> > > error which is even without line number:
> > >
> > > AS board/nokia/rx51/lowlevel_init.o
> > > {standard input}: Assembler messages:
> > > {standard input}: Error: attempt to get value of unresolved symbol `L0'
> > > make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1
> > >
> > > I have no idea about this error and my experiments showed that ARM GNU
> > > assembler is happy with negation of that number. So changing code to:
> > >
> > > kernoffs:
> > > .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
> > >
> > > and then replacing mathematical addition by substraction of "kernoffs"
> > > value (so calculation of address does not change) compiles assembler file
> > > without any error now.
> > >
> > > There should be not any functional change.
> > >
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > ---
> > > Btw, is somebody understanding that compile error message? Is there (or
> > > was there) some real issue in the code, so assembler refuse to compile
> > > it? Or have I triggered bug in GNU assembler?
> >
> > I would suggest filing a bug with upstream GNU assembler and seeing what
> > they say.
>
> And it is really a bug? Is not that issue in current code?
I think filing an issue is the best way to find out if we were relying
on something undocumented that worked or if it's a regression in the
tooling.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
2022-10-10 16:21 ` Tom Rini
@ 2022-10-10 17:21 ` Pali Rohár
0 siblings, 0 replies; 7+ messages in thread
From: Pali Rohár @ 2022-10-10 17:21 UTC (permalink / raw)
To: Tom Rini; +Cc: u-boot, maemo-leste
On Monday 10 October 2022 12:21:56 Tom Rini wrote:
> On Mon, Oct 10, 2022 at 06:18:08PM +0200, Pali Rohár wrote:
> > On Monday 10 October 2022 09:54:02 Tom Rini wrote:
> > > On Sun, Oct 09, 2022 at 09:37:13PM +0200, Pali Rohár wrote:
> > >
> > > > For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
> > > > from Debian Buster) cannot compile following code from located in file
> > > > board/nokia/rx51/lowlevel_init.S:
> > > >
> > > > kernoffs:
> > > > .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
> > > >
> > > > when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
> > > > error which is even without line number:
> > > >
> > > > AS board/nokia/rx51/lowlevel_init.o
> > > > {standard input}: Assembler messages:
> > > > {standard input}: Error: attempt to get value of unresolved symbol `L0'
> > > > make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1
> > > >
> > > > I have no idea about this error and my experiments showed that ARM GNU
> > > > assembler is happy with negation of that number. So changing code to:
> > > >
> > > > kernoffs:
> > > > .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
> > > >
> > > > and then replacing mathematical addition by substraction of "kernoffs"
> > > > value (so calculation of address does not change) compiles assembler file
> > > > without any error now.
> > > >
> > > > There should be not any functional change.
> > > >
> > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > ---
> > > > Btw, is somebody understanding that compile error message? Is there (or
> > > > was there) some real issue in the code, so assembler refuse to compile
> > > > it? Or have I triggered bug in GNU assembler?
> > >
> > > I would suggest filing a bug with upstream GNU assembler and seeing what
> > > they say.
> >
> > And it is really a bug? Is not that issue in current code?
>
> I think filing an issue is the best way to find out if we were relying
> on something undocumented that worked or if it's a regression in the
> tooling.
>
> --
> Tom
Ok, I sent email to binutils and gcc mailing list about this issue:
https://sourceware.org/pipermail/binutils/2022-October/123472.html
https://gcc.gnu.org/pipermail/gcc/2022-October/239588.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
2022-10-09 19:37 [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE Pali Rohár
2022-10-10 13:54 ` Tom Rini
@ 2022-10-14 16:46 ` Tom Rini
2022-10-18 22:16 ` Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2022-10-14 16:46 UTC (permalink / raw)
To: Pali Rohár; +Cc: u-boot, maemo-leste
[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]
On Sun, Oct 09, 2022 at 09:37:13PM +0200, Pali Rohár wrote:
> For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
> from Debian Buster) cannot compile following code from located in file
> board/nokia/rx51/lowlevel_init.S:
>
> kernoffs:
> .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
>
> when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
> error which is even without line number:
>
> AS board/nokia/rx51/lowlevel_init.o
> {standard input}: Assembler messages:
> {standard input}: Error: attempt to get value of unresolved symbol `L0'
> make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1
>
> I have no idea about this error and my experiments showed that ARM GNU
> assembler is happy with negation of that number. So changing code to:
>
> kernoffs:
> .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
>
> and then replacing mathematical addition by substraction of "kernoffs"
> value (so calculation of address does not change) compiles assembler file
> without any error now.
>
> There should be not any functional change.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
Thanks for following up with upstream here. I see they didn't answer
your final question, but my read of the series is that what you're doing
here should always work.
Reviewed-by: Tom Rini <trini@konsulko.com>
Link: https://sourceware.org/pipermail/binutils/2022-October/123472.html
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
2022-10-09 19:37 [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE Pali Rohár
2022-10-10 13:54 ` Tom Rini
2022-10-14 16:46 ` Tom Rini
@ 2022-10-18 22:16 ` Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2022-10-18 22:16 UTC (permalink / raw)
To: Pali Rohár; +Cc: u-boot, maemo-leste
[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]
On Sun, Oct 09, 2022 at 09:37:13PM +0200, Pali Rohár wrote:
> For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
> from Debian Buster) cannot compile following code from located in file
> board/nokia/rx51/lowlevel_init.S:
>
> kernoffs:
> .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)
>
> when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
> error which is even without line number:
>
> AS board/nokia/rx51/lowlevel_init.o
> {standard input}: Assembler messages:
> {standard input}: Error: attempt to get value of unresolved symbol `L0'
> make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1
>
> I have no idea about this error and my experiments showed that ARM GNU
> assembler is happy with negation of that number. So changing code to:
>
> kernoffs:
> .word . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET
>
> and then replacing mathematical addition by substraction of "kernoffs"
> value (so calculation of address does not change) compiles assembler file
> without any error now.
>
> There should be not any functional change.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-10-18 22:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-09 19:37 [PATCH] Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE Pali Rohár
2022-10-10 13:54 ` Tom Rini
2022-10-10 16:18 ` Pali Rohár
2022-10-10 16:21 ` Tom Rini
2022-10-10 17:21 ` Pali Rohár
2022-10-14 16:46 ` Tom Rini
2022-10-18 22:16 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox