Skip to contentSkip to conversation

ColdFire: Assign version_string as data section in start.S

PATCH New Tsi-Chung Liew 2 participants 6 messages Mar 26, 2008 – Mar 28, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ColdFire: Assign version_string as data section in start.S

The compiler does not place the .ascii in start.S to data section, instead it put in under text section. This is an issue where it never gets notice and causes error until an update for tools/setlocalversion has been applied. A label of .data before .globl version_string will force to put under data section.

---
 cpu/mcf5227x/start.S   |    4 ++--
 cpu/mcf523x/start.S    |    4 ++--
 cpu/mcf52x2/start.S    |    4 ++--
 cpu/mcf5445x/start.S   |    4 ++--
 cpu/mcf547x_8x/start.S |    4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)
cpu/mcf5227x/start.S +2 -2
index 0e2db12..454251a 100644
@@ -22,7 +22,7 @@
  */
 
 #include <config.h>
-#include "version.h"
+#include <version.h>
 
 #ifndef	 CONFIG_IDENT_STRING
 #define	 CONFIG_IDENT_STRING ""
@@ -348,7 +348,7 @@ dcache_status:
 	rts
 
 /*------------------------------------------------------------------------------*/
-
+	.data
 	.globl	version_string
 version_string:
 	.ascii U_BOOT_VERSION
cpu/mcf523x/start.S +2 -2
index 2bd603d..30c1b50 100644
@@ -22,7 +22,7 @@
  */
 
 #include <config.h>
-#include "version.h"
+#include <version.h>
 
 #ifndef	 CONFIG_IDENT_STRING
 #define	 CONFIG_IDENT_STRING ""
@@ -332,7 +332,7 @@ dcache_status:
 	rts
 
 /*------------------------------------------------------------------------------*/
-
+	.data
 	.globl	version_string
 version_string:
 	.ascii U_BOOT_VERSION
cpu/mcf52x2/start.S +2 -2
index 9e496a4..c11d0cb 100644
@@ -22,7 +22,7 @@
  */
 
 #include <config.h>
-#include "version.h"
+#include <version.h>
 
 #ifndef	 CONFIG_IDENT_STRING
 #define	 CONFIG_IDENT_STRING ""
@@ -470,7 +470,7 @@ dcache_status:
 	rts
 
 /*------------------------------------------------------------------------------*/
-
+	.data
 	.globl	version_string
 version_string:
 	.ascii U_BOOT_VERSION
cpu/mcf5445x/start.S +2 -2
index d64c5af..7532490 100644
@@ -22,7 +22,7 @@
  */
 
 #include <config.h>
-#include "version.h"
+#include <version.h>
 
 #ifndef	 CONFIG_IDENT_STRING
 #define	 CONFIG_IDENT_STRING ""
@@ -373,7 +373,7 @@ dcache_status:
 	rts
 
 /*------------------------------------------------------------------------------*/
-
+	.data
 	.globl	version_string
 version_string:
 	.ascii U_BOOT_VERSION
cpu/mcf547x_8x/start.S +2 -2
index 442665f..c516341 100644
@@ -22,7 +22,7 @@
  */
 
 #include <config.h>
-#include "version.h"
+#include <version.h>
 
 #ifndef	 CONFIG_IDENT_STRING
 #define	 CONFIG_IDENT_STRING ""
@@ -353,7 +353,7 @@ dcache_status:
 	rts
 
 /*------------------------------------------------------------------------------*/
-
+	.data
 	.globl	version_string
 version_string:
 	.ascii U_BOOT_VERSION
Signature · 1 line
1.5.4.1
#1 lore raw

PATCH 1/1 ColdFire: Assign version_string as data section in start.S

Quoted 2 lines · In message <[email protected]>…

The compiler does not place the .ascii in start.S to data section, instead it put in under text section. This is an issue where it

This is intentional on most architectures. What exactly is your problem?

Quoted 3 lines

never gets notice and causes error until an update for tools/setlocalversion has been applied. A label of .data before .globl version_string will force to put under data section.

Can you please explain which exact bug this is supposed to fix?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Uncontrolled power will turn even saints into savages. And we can all
be counted on to live down to our lowest impulses.
	-- Parmen, "Plato's Stepchildren", stardate 5784.3
#2 lore raw

PATCH 1/1 ColdFire: Assign version_string as data section in start.S

Wolfgang,

In message <[email protected]> you

Quoted 5 lines · wrote:
Quoted 2 lines

The compiler does not place the .ascii in start.S to data section, instead it put in under text section. This is an issue where it

This is intentional on most architectures. What exactly is your problem?

Apparently, it is not the case in ColdFire compilers. The ColdFire compilers always put the version_string in text section if .data is not declared and shows build error in start.S - "unaligned opcodes detected in executable segment". The PowerPC compiler, however, will put the version_string in data section either with or without .data declared.

Unfortunately, I did not catch the error in the previous release (1.3.0
- 1.3.2), and probably based on luck that the u-boot version, date and time information was always 4-byte align when I retrieved and worked on the source. Until now, the version, date and time information was not 4-byte align. I agreed with you on previous email after I submitted the patch "Add brackets to if condition in tools/setlocalversion", there is nothing wrong with the Linux script.

Quoted 2 lines
Quoted 2 lines

never gets notice and causes error until an update for tools/setlocalversion has been applied. A label of .data before

.globl

Quoted 3 lines
Quoted 1 line

version_string will force to put under data section.

Can you please explain which exact bug this is supposed to fix?

I am going to re-state the patch to "Fix build error generates by CF compilers for all CF CPUs" or "Fix version_string not in data section generates by CF compilers". Will either one of these works for you?

Regards,
TsiChung

#3 lore raw

PATCH 1/1 ColdFire: Assign version_string as data section in start.S

Quoted 9 lines · In message <4791E710007FEB4BBF83775D787F462F06EAF585@az33exm22.fsl.freescale.ne…
Quoted 3 lines

This is intentional on most architectures. What exactly is your problem?

Apparently, it is not the case in ColdFire compilers. The ColdFire compilers always put the version_string in text section if .data is not declared and shows build error in start.S - "unaligned opcodes detected in executable segment". The PowerPC compiler, however, will put the version_string in data section either with or without .data declared.

No, that's not correct. See for example here:

"cpu/mpc8xx/start.S":

 85         .text
 86         .long   0x27051956              /* U-Boot Magic Number                  */
 87         .globl  version_string
 88 version_string:
 89         .ascii U_BOOT_VERSION
 90         .ascii " (", __DATE__, " - ", __TIME__, ")"
 91         .ascii CONFIG_IDENT_STRING, "\0"

92
93 . = EXC_OFF_SYS_RESET
94 .globl _start
95 _start:
96 lis r3, CFG_IMMR at h /* position IMMR */
...

Here we explicitely (and intentionally) place the version string in the text segment. It will NOT be put in the data segment.

Maybe just adding some ".align" directive helps?

Quoted 3 lines

I am going to re-state the patch to "Fix build error generates by CF compilers for all CF CPUs" or "Fix version_string not in data section generates by CF compilers". Will either one of these works for you?

I would like to understand the problem first. I feel you might just be missing some alignment... It has been working so far, hasn't it?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It seems intuitively obvious to me, which  means  that  it  might  be
wrong.                                                 -- Chris Torek
#4 lore raw

PATCH 1/1 ColdFire: Assign version_string as data section in start.S

Wolfgang,

Quoted 1 line

Maybe just adding some ".align" directive helps?

The example provided for 8xx or others, there is an offset alignment after CONFIG_IDENT_STRING - ". = EXC_OFF_SYS_RESET". In fact, it works after adding ".align 4" after CONFIG_IDENT_STRING.

Thanks.

Regards,
TsiChung

#5 lore raw

PATCH 1/1 ColdFire: Assign version_string as data section in start.S

Quoted 6 lines · In message <4791E710007FEB4BBF83775D787F462F06EAF645@az33exm22.fsl.freescale.ne…
Quoted 2 lines

Maybe just adding some ".align" directive helps?

The example provided for 8xx or others, there is an offset alignment after CONFIG_IDENT_STRING - ". =3D EXC_OFF_SYS_RESET". In fact, it works after adding ".align 4" after CONFIG_IDENT_STRING.

Ah, great! Now *that* patch will be merged really fast - promised!

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Quotation, n. The act of repeating erroneously the words of  another.
The  words  erroneously  repeated.
                            - Ambrose Bierce _The Devil's Dictionary_