Skip to contentSkip to conversation

Fix DECLARE_GLOBAL_DATA_PTR and make gd global

PATCH New Dirk Behme 2 participants 4 messages Sep 15, 2007

lore
Share & tools
lore

Dirk Behme

author
#0 lore raw

PATCH 1/1 Fix DECLARE_GLOBAL_DATA_PTR and make gd global

Some users [1] with (some?) ARM toolchains report issues with

#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")

in include/asm-arm/global_data.h

The issue seems to be [2]

-- cut --
The gcc documentation [3] clearly states that local register variables are not guaranteed to contain the values you think they do, except in certain circumstances. In particular: "Stores into local register variables may be deleted when they appear to be dead according to dataflow analysis."
-- cut --

This patch makes DECLARE_GLOBAL_DATA_PTR empty, so no local register variable any more, and makes gd global.

Original patch by Paul Brook <[email protected]>

[1]
http://linux.omap.com/pipermail/davinci-linux-open-source/2007-September/004068.html
http://www.codesourcery.com/archives/arm-gnu/msg00736.html

[2]
http://www.codesourcery.com/archives/arm-gnu/msg00741.html
http://linux.omap.com/pipermail/davinci-linux-open-source/2007-September/004072.html

[3]
http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Local-Reg-Vars.html#Local-Reg-Vars

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: arm_global_data_pointer_patch.txt
Url: http://lists.denx.de/pipermail/u-boot/attachments/20070915/f342351a/attachment.txt

#1 lore raw

PATCH 1/1 Fix DECLARE_GLOBAL_DATA_PTR and make gd global

Quoted 5 lines · In message <[email protected]> you wrote:

Some users [1] with (some?) ARM toolchains report issues with
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
in include/asm-arm/global_data.h
The issue seems to be [2]

Can you please point out specific boards that show this problem?

Quoted 2 lines

This patch makes DECLARE_GLOBAL_DATA_PTR empty, so no local register variable any more, and makes gd global.

Actually this should not be needed any more as all use of the DECLARE_GLOBAL_DATA_PTR (should) have been moved outside function bodies, so we already use a global definition. If there are remaining places where this has been forgotten I'd rather fix these.

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
Youth doesn't excuse everything.
	-- Dr. Janice Lester (in Kirk's body), "Turnabout Intruder",
	   stardate 5928.5.
author
#2 lore raw

PATCH 1/1 Fix DECLARE_GLOBAL_DATA_PTR and make gd global

Quoted 8 lines · Wolfgang Denk
Quoted 4 lines · In message <[email protected]> you wrote:

Some users [1] with (some?) ARM toolchains report issues with
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
in include/asm-arm/global_data.h
The issue seems to be [2]

Can you please point out specific boards that show this problem?

[1] was on unknown board with CodeSourcery ARM toolchain 2006q1-3

[2] was on TI DaVinci board with MontaVista ARM toolchain 3.4.3-25.0.104.0600975 2006-07-06

Quoted 7 lines
Quoted 2 lines

This patch makes DECLARE_GLOBAL_DATA_PTR empty, so no local register variable any more, and makes gd global.

Actually this should not be needed any more as all use of the DECLARE_GLOBAL_DATA_PTR (should) have been moved outside function bodies, so we already use a global definition. If there are remaining places where this has been forgotten I'd rather fix these.

Thanks for the hint! I scanned for in-function DECLARE_GLOBAL_DATA_PTR and got following files

./cpu/bf537/i2c.c
./cpu/bf537/serial.c
./cpu/bf561/serial.c
./cpu/mcf532x/cpu.c
./cpu/mcf532x/speed.c
./cpu/mpc86xx/cpu_init.c
./cpu/mpc86xx/speed.c
./cpu/mpc86xx/traps.c
./cpu/arm720t/serial.c
./lib_blackfin/post.c.
./lib_blackfin/board.c
./board/mpl/vcma9/cmd_vcma9.c
./board/amcc/yucca/yucca.c
./board/amcc/taishan/taishan.c
./board/amcc/katmai/katmai.c
./board/davinci/schmoogie/dv_board.c
./board/davinci/dv-evm/dv_board.c
./board/davinci/sonata/dv_board.c
./board/sbc2410x/sbc2410x.c
./board/bf561-ezkit/bf561-ezkit.c
./board/bf537-stamp/bf537-stamp.c
./board/mpc7448hpc2/tsi108_init.c
./board/mpc7448hpc2/mpc7448hpc2.c
./board/siemens/SMN42/smn42.c
./board/freescale/mpc8313erdb/sdram.c
./board/bf533-ezkit/bf533-ezkit.c
./board/bf533-stamp/bf533-stamp.c
./board/lpc2292sodimm/lpc2292sodimm.c
./drivers/qe/qe.c

See below as well. Patch for DaVinci follows.

Cheers

Dirk

[1] http://www.codesourcery.com/archives/arm-gnu/msg00736.html

[2]
http://linux.omap.com/pipermail/davinci-linux-open-source/2007-September/004068.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: function_local_global_data_ptr.txt
Url: http://lists.denx.de/pipermail/u-boot/attachments/20070915/e22839a3/attachment.txt

#3 lore raw

PATCH 1/1 Fix DECLARE_GLOBAL_DATA_PTR and make gd global

Dear Dirk,

Quoted 8 lines · in message <[email protected]> you wrote:
Quoted 5 lines

Actually this should not be needed any more as all use of the DECLARE_GLOBAL_DATA_PTR (should) have been moved outside function bodies, so we already use a global definition. If there are remaining places where this has been forgotten I'd rather fix these.

Thanks for the hint! I scanned for in-function DECLARE_GLOBAL_DATA_PTR and got following files

Argh... Thanks for bringing this to my attention. Seems some cleanup is needed ...

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
Where people stand is not as important as which way they face.
        - Terry Pratchett & Stephen Briggs, _The Discworld Companion_