Andes Workshop
http://forum.andestech.com/

Turn off relax optimization
http://forum.andestech.com/viewtopic.php?f=25&t=851
Page 1 of 1

Author:  cindy [ Thu Jun 12, 2014 3:42 pm ]
Post subject:  Turn off relax optimization

Turn off relax optimization
Linker Option: -mno-relax
Attachment:
-mno-relax.png
-mno-relax.png [ 45.39 KiB | Viewed 3683 times ]


nds32le-elf-gcc -O0 -nostartfiles -static -mno-relax -Toutput/.nds32le-elf-mculib-v3_start0x0.x -Xlinker -defsym -Xlinker _stack=0x1000 -o "mem_test2.adx" ./src/mem_test2.o

Attachment:
mem_test2.zip [58.29 KiB]
Downloaded 255 times


No relax:
Code:
00000000 <main>:
   0:   46 01 23 45    sethi $r0,#0x12345
   4:   58 00 06 78    ori $r0,$r0,#0x678
   8:   46 f0 00 00    sethi $r15,#0x0
   c:   14 07 80 1a    swi $r0,[$r15+#0x68]
  10:   46 f0 00 00    sethi $r15,#0x0
  14:   04 07 80 1a    lwi $r0,[$r15+#0x68]
  18:   46 f0 00 00    sethi $r15,#0x0
  1c:   14 07 80 1c    swi $r0,[$r15+#0x70]
  20:   46 08 76 54    sethi $r0,#0x87654
  24:   58 00 03 21    ori $r0,$r0,#0x321
  28:   46 f0 00 00    sethi $r15,#0x0
  2c:   14 07 80 1b    swi $r0,[$r15+#0x6c]
  30:   46 f0 00 00    sethi $r15,#0x0
  34:   04 07 80 1b    lwi $r0,[$r15+#0x6c]
  38:   46 f0 00 00    sethi $r15,#0x0
  3c:   14 07 80 1c    swi $r0,[$r15+#0x70]
  40:   d5 e0          j8 0 <main>


If you us the relax function

Code:
00000000 <main>:
   0:   46 01 23 45    sethi $r0,#0x12345
   4:   58 00 06 78    ori $r0,$r0,#0x678
   8:   3c 0f ff fe    swi.gp $r0,[+#-8]
   c:   3c 0d ff fe    lwi.gp $r0,[+#-8]
  10:   3c 0e 00 00    swi.gp $r0,[+#0]
  14:   46 08 76 54    sethi $r0,#0x87654
  18:   58 00 03 21    ori $r0,$r0,#0x321
  1c:   3c 0f ff ff    swi.gp $r0,[+#-4]
  20:   3c 0d ff ff    lwi.gp $r0,[+#-4]
  24:   3c 0e 00 00    swi.gp $r0,[+#0]
  28:   d5 ec          j8 0 <main>



Sample code:
Attachment:
mem_test2.zip [58.29 KiB]
Downloaded 255 times

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/