u-boot/cpu
Shinya Kuribayashi 49387dba91 [MIPS] cpu/mips/cache.S: Fix build warning
Some old GNU assemblers, such as v2.14 (ELDK 3.1.1), v2.16 (ELDK 4.1.0),
warns illegal global symbol references by bal (and jal also) instruction.
This does not happen with the latest binutils v2.18.

Here's an example on gth2_config:

mips_4KC-gcc  -D__ASSEMBLY__ -g  -Os   -D__KERNEL__ -DTEXT_BASE=0x90000000 -I/home/skuribay/devel/u-boot.git/include -fno-builtin -ffreestanding -nostdinc -isy
stem /opt/eldk311/usr/bin/../lib/gcc-lib/mips-linux/3.3.3/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -pipe -msoft-float -march=4kc -mtune=4k
c -EB -c -o cache.o cache.S
cache.S: Assembler messages:
cache.S:243: Warning: Pretending global symbol used as branch target is local.
cache.S:250: Warning: Pretending global symbol used as branch target is local.

In principle, gas might be sensitive to global symbol references in PIC
code because they should be processed through GOT (global offset table).
But if `bal' instruction is used, it results in PC-based offset jump.
This is the cause of this warning.

In practice, we know it doesn't matter whether PC-based reference or GOT-
based. As for this case, both will work before/after relocation. But let's
fix the code.

This patch explicitly sets up a target address, then jump there.
Here's an example of disassembled code with/without this patch.

 90000668:       1485ffef        bne     a0,a1,90000628 <mips_cache_reset+0x20>
 9000066c:       ac80fffc        sw      zero,-4(a0)
 90000670:       01402821        move    a1,t2
-90000674:       0411ffba        bal     90000560 <mips_init_icache>
-90000678:       01803021        move    a2,t4
-9000067c:       01602821        move    a1,t3
-90000680:       0411ffcc        bal     900005b4 <mips_init_dcache>
-90000684:       01a03021        move    a2,t5
-90000688:       03000008        jr      t8
-9000068c:       00000000        nop
+90000674:       01803021        move    a2,t4
+90000678:       8f8f83ec        lw      t7,-31764(gp)
+9000067c:       01e0f809        jalr    t7
+90000680:       00000000        nop
+90000684:       01602821        move    a1,t3
+90000688:       01a03021        move    a2,t5
+9000068c:       8f8f81e0        lw      t7,-32288(gp)
+90000690:       01e0f809        jalr    t7
+90000694:       00000000        nop
+90000698:       03000008        jr      t8
+9000069c:       00000000        nop

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
2008-05-06 13:22:52 +09:00
..
74xx_7xx PPC: Use r2 instead of r29 as global data pointer 2008-02-14 22:43:22 +01:00
arm720t ARM: cleanup duplicated exception handlingcode 2008-02-14 09:38:21 +00:00
arm920t USB: fix more GCC 4.2.x aliasing warnings 2008-04-25 12:44:08 +02:00
arm925t ARM: cleanup duplicated exception handlingcode 2008-02-14 09:38:21 +00:00
arm926ejs ARM: Davinci: Fix DM644x timer overflow handling and cleanup 2008-04-22 23:12:01 +02:00
arm946es ARM: cleanup duplicated exception handlingcode 2008-02-14 09:38:21 +00:00
arm1136 core support for Freescale mx31 2008-04-13 14:20:47 -07:00
arm_intcm ARM: cleanup duplicated exception handlingcode 2008-02-14 09:38:21 +00:00
at32ap AVR32: Make SDRAM refresh rate configurable 2008-02-05 12:14:27 +01:00
blackfin Blackfin: unify cpu and boot modes 2008-03-30 15:50:19 -04:00
i386 cpu/ rtc/ include/: Remove lingering references to CFG_CMD_* symbols. 2007-07-10 10:27:39 -05:00
ixp ARM: cleanup duplicated exception handlingcode 2008-02-14 09:38:21 +00:00
leon2 Coding Style cleanup; update CHANGELOG 2008-04-13 09:59:26 -07:00
leon3 Coding Style cleanup; update CHANGELOG 2008-04-13 09:59:26 -07:00
lh7a40x ARM: cleanup duplicated exception handlingcode 2008-02-14 09:38:21 +00:00
mcf52x2 Revert "ColdFire: Get information from the correct GCC" 2008-05-03 23:07:15 +02:00
mcf523x Revert "ColdFire: Get information from the correct GCC" 2008-05-03 23:07:15 +02:00
mcf532x Revert "ColdFire: Get information from the correct GCC" 2008-05-03 23:07:15 +02:00
mcf547x_8x Revert "ColdFire: Get information from the correct GCC" 2008-05-03 23:07:15 +02:00
mcf5227x Revert "ColdFire: Get information from the correct GCC" 2008-05-03 23:07:15 +02:00
mcf5445x Revert "ColdFire: Get information from the correct GCC" 2008-05-03 23:07:15 +02:00
microblaze [PATCH] Add support for design without interrupt controller 2007-09-24 00:21:19 +02:00
mips [MIPS] cpu/mips/cache.S: Fix build warning 2008-05-06 13:22:52 +09:00
mpc5xx Remove all the search paths from the .lds files. 2008-04-17 23:57:32 -07:00
mpc5xxx USB: fix more GCC 4.2.x aliasing warnings 2008-04-25 12:44:08 +02:00
mpc8xx MPC8xx: Fix libfdt support introduced in commit 77ff7b74 2008-04-02 11:07:20 -04:00
mpc83xx mpc83xx: remove the unused CPM's stuff 2008-04-25 09:34:21 -05:00
mpc85xx 85xx: Add -mno-spe to e500/85xx builds 2008-04-29 20:08:43 +02:00
mpc86xx Fix calculation of I2C clock for some 86xx chips 2008-04-30 22:52:35 +02:00
mpc512x MPC5121e ADS PCI support take 3 2008-03-02 21:44:59 +01:00
mpc824x Remove all the search paths from the .lds files. 2008-04-17 23:57:32 -07:00
mpc8220 Remove all the search paths from the .lds files. 2008-04-17 23:57:32 -07:00
mpc8260 Remove all the search paths from the .lds files. 2008-04-17 23:57:32 -07:00
nios Minor alignment of output, 2nd try. 2007-08-12 21:34:34 +02:00
nios2 cpu/[7a-ln-z]*: Remove obsolete references to CONFIG_COMMANDS 2007-07-09 18:57:22 -05:00
ppc4xx ppc4xx: Fix problem with DIMMs with 8 banks in 44x_spd_ddr2.c 2008-04-30 14:50:04 +02:00
pxa pxa: fix previous definition on cpu init 2008-05-03 20:56:22 +02:00
s3c44b0 LWMON5: POST RTC fix 2008-03-20 21:48:46 +01:00
sa1100 ARM: cleanup duplicated exception handlingcode 2008-02-14 09:38:21 +00:00
sh3 sh: Add support SH3 and SH7720 2008-01-15 23:30:40 +09:00
sh4 sh: Add support SH4 cache control 2008-03-28 14:16:13 +09:00