Add flags for powerpc in order to avoid exceptions
PATCH 1/1 Add flags for powerpc in order to avoid exceptions
* conf/Makefile.common [COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add -msoft-float -mno-vsx -mno-altivec.
--- ChangeLog | 7 +++++++ conf/Makefile.common | 3 +++ 2 files changed, 10 insertions(+)
ChangeLog +7 -0
@@ -1,3 +1,10 @@ +2014-09-26 Paulo Flabiano Smorigo <[email protected]> + + Add flags for powerpc in order to avoid exceptions + + * conf/Makefile.common [COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add + -msoft-float -mno-vsx -mno-altivec. + 2014-09-25 Colin Watson <[email protected]> Fix in-tree --platform=none
conf/Makefile.common +3 -0
@@ -22,6 +22,9 @@ endif if COND_arm64 CFLAGS_PLATFORM += -mcmodel=large endif +if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -msoft-float -mno-vsx -mno-altivec +endif #FIXME: discover and check XEN headers CPPFLAGS_XEN = -I/usr/include
Signature · 6 lines
1.8.1.4 -- Paulo Flabiano Smorigo IBM Linux Technology Center
В Fri, 26 Sep 2014 16:29:40 -0300
Paulo Flabiano Smorigo <[email protected]> пишет:
Quoted 29 lines
* conf/Makefile.common [
COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add -msoft-float -mno-vsx -mno-altivec.--- ChangeLog | 7 +++++++ conf/Makefile.common | 3 +++ 2 files changed, 10 insertions(+)ChangeLog +7
-0@@ -1,3 +1,10 @@ +2014-09-26 Paulo Flabiano Smorigo <[email protected]> + + Add flags for powerpc in order to avoid exceptions + + * conf/Makefile.common [COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add + -msoft-float -mno-vsx -mno-altivec. + 2014-09-25 Colin Watson <[email protected]> Fix in-tree --platform=noneconf/Makefile.common +0
-0
conf/Makefile.common endif · line 30
Quoted 9 lines
conf/Makefile.common +3
-0@@ -22,6 +22,9 @@ endif if COND_arm64 CFLAGS_PLATFORM += -mcmodel=large endif +if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -msoft-float -mno-vsx -mno-altivec +endif #FIXME: discover and check XEN headers CPPFLAGS_XEN = -I/usr/include
Thank you! I confirm that this patch works and does not break grub on earlier CPU :)
There are still differences in generated code, so we probably need to tune some more flags. Here is difference between ppc64 and ppc64le:
-usr.ppc64/lib/grub2/powerpc-ieee1275/kernel.img: file format elf32-powerpc
+usr.ppc64le/lib/grub2/powerpc-ieee1275/kernel.img: file format elf32-powerpc
Disassembly of section .text:
@@ -1389,7 +1389,7 @@ Disassembly of section .text:
201594: 38 e0 00 00 li r7,0 201598: 48 00 02 11 bl 0x2017a8 20159c: 2f 83 00 00 cmpwi cr7,r3,0 - 2015a0: 41 bc 00 64 blt cr7,0x201604 + 2015a0: 41 fc 00 64 blt+ cr7,0x201604 2015a4: 4b ff ff c0 b 0x201564 2015a8: 3c 80 00 21 lis r4,33 2015ac: 7f e3 fb 78 mr r3,r31 @@ -2769,7 +2769,7 @@ Disassembly of section .text: 202b24: 48 00 80 75 bl 0x20ab98 202b28: 81 81 00 30 lwz r12,48(r1) 202b2c: 39 61 00 40 addi r11,r1,64 - 202b30: 7d 80 81 20 mtcrf 8,r12 + 202b30: 7d 90 81 20 mtocrf 8,r12 202b34: 4b ff d8 3c b 0x200370 202b38: 94 21 ff 90 stwu r1,-112(r1) 202b3c: 7c 08 02 a6 mflr r0 @@ -3387,7 +3387,7 @@ Disassembly of section .text: 2034cc: 7c 7d f8 ae lbzx r3,r29,r31 2034d0: 48 00 74 5d bl 0x20a92c 2034d4: 2f 83 00 00 cmpwi cr7,r3,0 - 2034d8: 41 9e 00 0c beq cr7,0x2034e4 + 2034d8: 41 de 00 0c beq- cr7,0x2034e4 2034dc: 3b ff 00 01 addi r31,r31,1 2034e0: 4b ff ff ec b 0x2034cc 2034e4: 38 80 00 3d li r4,61 @@ -3603,9 +3603,9 @@ Disassembly of section .text: 20382c: 7d 3e 52 14 add r9,r30,r10 203830: 7f 9e 40 40 cmplw cr7,r30,r8 203834: 7c 6a 1b 78 mr r10,r3 - 203838: 41 9d 00 0c bgt cr7,0x203844 + 203838: 41 dd 00 0c bgt- cr7,0x203844 20383c: 2f 9e ff ff cmpwi cr7,r30,-1 - 203840: 40 be 00 1c bne cr7,0x20385c + 203840: 40 fe 00 1c bne+ cr7,0x20385c 203844: 39 40 00 01 li r10,1 203848: 48 00 00 14 b 0x20385c 20384c: 89 09 00 00 lbz r8,0(r9) @@ -5519,14 +5519,14 @@ Disassembly of section .text: 20561c: 7c 7d 1b 78 mr r29,r3 205620: 4b ff f5 6d bl 0x204b8c 205624: 7f 83 e8 00 cmpw cr7,r3,r29 - 205628: 7c 60 00 26 mfcr r3 + 205628: 7c 70 10 26 mfocrf r3,1 20562c: 54 63 ef fe rlwinm r3,r3,29,31,31 205630: 4b ff fe e4 b 0x205514 205634: 4b ff f5 59 bl 0x204b8c 205638: 7c 7d 1b 78 mr r29,r3 20563c: 4b ff f5 51 bl 0x204b8c 205640: 7f 83 e8 00 cmpw cr7,r3,r29 - 205644: 7c 60 00 26 mfcr r3 + 205644: 7c 70 10 26 mfocrf r3,1 205648: 54 63 f7 fe rlwinm r3,r3,30,31,31 20564c: 4b ff fe c8 b 0x205514 205650: 4b ff f5 3d bl 0x204b8c @@ -5722,7 +5722,7 @@ Disassembly of section .text: 205948: 7f 07 c3 78 mr r7,r24 20594c: 48 00 12 99 bl 0x206be4 205950: 2c 03 00 00 cmpwi r3,0 - 205954: 40 a2 00 10 bne 0x205964 + 205954: 40 e2 00 10 bne+ 0x205964 205958: 7f e3 fb 78 mr r3,r31 20595c: 48 00 0e 99 bl 0x2067f4 205960: 48 00 00 2c b 0x20598c @@ -5765,7 +5765,7 @@ Disassembly of section .text: 2059f4: 38 63 00 18 addi r3,r3,24 2059f8: 4b ff ff e4 b 0x2059dc 2059fc: 2f 83 00 00 cmpwi cr7,r3,0 - 205a00: 4c be 00 20 bclr+ 4,4*cr7+eq + 205a00: 4c fe 00 20 bnelr+ cr7 205a04: 2b 84 00 68 cmplwi cr7,r4,104 205a08: 41 9e 00 24 beq cr7,0x205a2c 205a0c: 2b 84 00 75 cmplwi cr7,r4,117 @@ -6022,12 +6022,12 @@ Disassembly of section .text: 205df8: 39 29 d9 a8 addi r9,r9,-9816 205dfc: 7f 84 48 00 cmpw cr7,r4,r9 205e00: 90 01 00 14 stw r0,20(r1) - 205e04: 40 be 00 0c bne cr7,0x205e10 + 205e04: 40 fe 00 0c bne+ cr7,0x205e10 205e08: 4b ff ff 1d bl 0x205d24 205e0c: 48 00 00 14 b 0x205e20 205e10: 39 29 00 18 addi r9,r9,24 205e14: 7f 84 48 00 cmpw cr7,r4,r9 - 205e18: 40 be 00 10 bne cr7,0x205e28 + 205e18: 40 fe 00 10 bne+ cr7,0x205e28 205e1c: 4b ff fe 99 bl 0x205cb4 205e20: 38 60 ff ff li r3,-1 205e24: 48 00 00 70 b 0x205e94 @@ -6213,7 +6213,7 @@ Disassembly of section .text: 2060f4: 7e a5 ab 78 mr r5,r21 2060f8: 4b ff fa bd bl 0x205bb4 2060fc: 7c 7e 1b 79 mr. r30,r3 - 206100: 41 a2 ff d8 beq 0x2060d8 + 206100: 41 c2 ff d8 beq- 0x2060d8 206104: 2f 1d 00 00 cmpwi cr6,r29,0 206108: 2f 9e 00 00 cmpwi cr7,r30,0 20610c: 40 9a 00 3c bne cr6,0x206148 @@ -6442,7 +6442,7 @@ Disassembly of section .text: 206488: 7c 08 02 a6 mflr r0 20648c: 70 6a 00 0f andi. r10,r3,15 206490: 90 01 00 14 stw r0,20(r1) - 206494: 41 a2 00 10 beq 0x2064a4 + 206494: 41 e2 00 10 beq+ 0x2064a4 206498: 3c 60 00 21 lis r3,33 20649c: 38 63 db 20 addi r3,r3,-9440 2064a0: 48 00 00 50 b 0x2064f0 @@ -6496,7 +6496,7 @@ Disassembly of section .text: 206560: 90 01 00 54 stw r0,84(r1) 206564: 3a b5 00 01 addi r21,r21,1 206568: 2f 89 00 00 cmpwi cr7,r9,0 - 20656c: 41 9e 02 20 beq cr7,0x20678c + 20656c: 41 de 02 20 beq- cr7,0x20678c
206570: 54 74 e1 3f rlwinm. r20,r3,28,4,31
206574: 40 82 00 08 bne 0x20657c
206578: 3a 80 00 01 li r20,1
@@ -6528,13 +6528,13 @@ Disassembly of section .text:
2065e0: 7f ff b8 10 subfc r31,r31,r23 2065e4: 7f de b1 10 subfe r30,r30,r22 2065e8: 2f 84 00 00 cmpwi cr7,r4,0 - 2065ec: 40 be 00 10 bne cr7,0x2065fc + 2065ec: 40 fe 00 10 bne+ cr7,0x2065fc 2065f0: 3c 60 00 21 lis r3,33 2065f4: 38 63 db 80 addi r3,r3,-9344 2065f8: 48 00 57 79 bl 0x20bd70 2065fc: 80 a4 00 08 lwz r5,8(r4) 206600: 7f 85 90 00 cmpw cr7,r5,r18 - 206604: 41 be 00 10 beq cr7,0x206614 + 206604: 41 fe 00 10 beq+ cr7,0x206614 206608: 3c 60 00 21 lis r3,33 20660c: 38 63 db 91 addi r3,r3,-9327 206610: 48 00 57 61 bl 0x20bd70 @@ -6687,7 +6687,7 @@ Disassembly of section .text: 20685c: 41 9d 00 ac bgt cr7,0x206908 206860: 80 a4 00 08 lwz r5,8(r4) 206864: 7f 85 38 00 cmpw cr7,r5,r7 - 206868: 41 be 00 10 beq cr7,0x206878 + 206868: 41 fe 00 10 beq+ cr7,0x206878 20686c: 3c 60 00 21 lis r3,33 206870: 38 63 db 91 addi r3,r3,-9327 206874: 48 00 54 fd bl 0x20bd70 @@ -6976,7 +6976,7 @@ Disassembly of section .text: 206ce0: 38 60 00 00 li r3,0 206ce4: 81 81 00 14 lwz r12,20(r1) 206ce8: 39 61 00 30 addi r11,r1,48 - 206cec: 7d 80 81 20 mtcrf 8,r12 + 206cec: 7d 90 81 20 mtocrf 8,r12 206cf0: 4b ff 96 74 b 0x200364 206cf4: 94 21 ff f0 stwu r1,-16(r1) 206cf8: 7c 08 02 a6 mflr r0 @@ -7308,7 +7308,7 @@ Disassembly of section .text: 207210: 48 00 20 3d bl 0x20924c 207214: 7f e5 fb 78 mr r5,r31 207218: 7c 7e 1b 79 mr. r30,r3 - 20721c: 41 82 00 10 beq 0x20722c + 20721c: 41 c2 00 10 beq- 0x20722c 207220: 89 3e 00 00 lbz r9,0(r30) 207224: 2f 89 00 00 cmpwi cr7,r9,0 207228: 40 9e 00 1c bne cr7,0x207244 @@ -7763,7 +7763,7 @@ Disassembly of section .text: 20792c: 4b ff ee c9 bl 0x2067f4 207930: 48 00 00 0c b 0x20793c 207934: 2f 9d 00 00 cmpwi cr7,r29,0 - 207938: 40 be 00 40 bne cr7,0x207978 + 207938: 40 fe 00 40 bne+ cr7,0x207978 20793c: 81 39 00 20 lwz r9,32(r25) 207940: 3b a0 00 00 li r29,0 207944: 2f 89 00 00 cmpwi cr7,r9,0 @@ -7961,7 +7961,7 @@ Disassembly of section .text: 207c44: 38 84 dd 49 addi r4,r4,-8887 207c48: 48 00 18 55 bl 0x20949c 207c4c: 2f 9d 00 00 cmpwi cr7,r29,0 - 207c50: 41 9e 00 14 beq cr7,0x207c64 + 207c50: 41 de 00 14 beq- cr7,0x207c64 207c54: 7f 9d f0 40 cmplw cr7,r29,r30 207c58: 41 9e 00 0c beq cr7,0x207c64 207c5c: 7f a3 eb 78 mr r3,r29 @@ -8745,7 +8745,7 @@ Disassembly of section .text: 208884: 2f 88 00 00 cmpwi cr7,r8,0 208888: 7d 5f 52 14 add r10,r31,r10 20888c: 39 28 00 01 addi r9,r8,1 - 208890: 40 be 00 3c bne cr7,0x2088cc + 208890: 40 fe 00 3c bne+ cr7,0x2088cc 208894: 39 20 00 01 li r9,1 208898: 48 00 00 34 b 0x2088cc 20889c: 81 0a 00 20 lwz r8,32(r10) @@ -8857,7 +8857,7 @@ Disassembly of section .text: 208a44: 2f 87 00 00 cmpwi cr7,r7,0 208a48: 7d 3f 4a 14 add r9,r31,r9 208a4c: 39 47 00 01 addi r10,r7,1 - 208a50: 40 be 00 24 bne cr7,0x208a74 + 208a50: 40 fe 00 24 bne+ cr7,0x208a74 208a54: 39 40 00 01 li r10,1 208a58: 48 00 00 1c b 0x208a74 208a5c: 80 c9 00 04 lwz r6,4(r9) @@ -9792,7 +9792,7 @@ Disassembly of section .text: 2098e0: 38 80 00 29 li r4,41 2098e4: 48 00 10 01 bl 0x20a8e4 2098e8: 2c 03 00 00 cmpwi r3,0 - 2098ec: 41 a2 ff e8 beq 0x2098d4 + 2098ec: 41 c2 ff e8 beq- 0x2098d4 2098f0: 3b 83 00 01 addi r28,r3,1 2098f4: 7f e3 fb 78 mr r3,r31 2098f8: 4b ff d8 f5 bl 0x2071ec @@ -10444,7 +10444,7 @@ Disassembly of section .text: 20a310: 38 84 ff f8 addi r4,r4,-8 20a314: 4b ff eb 55 bl 0x208e68 20a318: 2f 83 00 00 cmpwi cr7,r3,0 - 20a31c: 40 be 00 18 bne cr7,0x20a334 + 20a31c: 40 fe 00 18 bne+ cr7,0x20a334 20a320: 3c 60 00 21 lis r3,33 20a324: 3c 80 00 21 lis r4,33 20a328: 38 63 d2 f2 addi r3,r3,-11534 @@ -10536,7 +10536,7 @@ Disassembly of section .text: 20a480: 48 00 07 19 bl 0x20ab98 20a484: 35 3d 00 01 addic. r9,r29,1 20a488: 7c 7f 1b 78 mr r31,r3 - 20a48c: 41 82 00 08 beq 0x20a494 + 20a48c: 41 c2 00 08 beq- 0x20a494 20a490: 7d 3e 4b 78 mr r30,r9 20a494: 89 3e 00 00 lbz r9,0(r30) 20a498: 3b a0 00 00 li r29,0 @@ -10546,7 +10546,7 @@ Disassembly of section .text: 20a4a8: 48 00 06 a1 bl 0x20ab48 20a4ac: 7c 7d 1b 78 mr r29,r3 20a4b0: 2f 9f 00 00 cmpwi cr7,r31,0 - 20a4b4: 40 be 00 18 bne cr7,0x20a4cc + 20a4b4: 40 fe 00 18 bne+ cr7,0x20a4cc 20a4b8: 48 00 00 08 b 0x20a4c0 20a4bc: 3b a0 00 00 li r29,0 20a4c0: 83 e1 00 0c lwz r31,12(r1) @@ -10589,7 +10589,7 @@ Disassembly of section .text: 20a554: 2f 83 00 00 cmpwi cr7,r3,0 20a558: 7c 69 1b 78 mr r9,r3 20a55c: 7c 6a 1b 78 mr r10,r3 - 20a560: 40 be 00 28 bne cr7,0x20a588 + 20a560: 40 fe 00 28 bne+ cr7,0x20a588 20a564: 39 40 00 01 li r10,1 20a568: 48 00 00 20 b 0x20a588 20a56c: 80 61 00 08 lwz r3,8(r1) @@ -11237,7 +11237,7 @@ Disassembly of section .text: 20af74: 89 49 00 01 lbz r10,1(r9) 20af78: 39 09 00 02 addi r8,r9,2 20af7c: 2b 8a 00 6c cmplwi cr7,r10,108 - 20af80: 40 9e 00 0c bne cr7,0x20af8c + 20af80: 40 de 00 0c bne- cr7,0x20af8c 20af84: 89 49 00 02 lbz r10,2(r9) 20af88: 39 09 00 03 addi r8,r9,3 20af8c: 2b 8a 00 70 cmplwi cr7,r10,112 @@ -11337,7 +11337,7 @@ Disassembly of section .text: 20b104: 48 00 00 28 b 0x20b12c 20b108: 89 3e 00 01 lbz r9,1(r30) 20b10c: 2b 89 00 6c cmplwi cr7,r9,108 - 20b110: 41 be 00 10 beq cr7,0x20b120 + 20b110: 41 fe 00 10 beq+ cr7,0x20b120 20b114: 3b 9e 00 02 addi r28,r30,2 20b118: 39 40 00 01 li r10,1 20b11c: 48 00 00 10 b 0x20b12c @@ -11563,7 +11563,7 @@ Disassembly of section .text: 20b48c: 91 21 00 30 stw r9,48(r1) 20b490: 89 2a 00 01 lbz r9,1(r10) 20b494: 2b 89 00 6c cmplwi cr7,r9,108 - 20b498: 40 9e 00 10 bne cr7,0x20b4a8 + 20b498: 40 de 00 10 bne- cr7,0x20b4a8 20b49c: 39 2a 00 03 addi r9,r10,3 20b4a0: 91 21 00 30 stw r9,48(r1) 20b4a4: 89 2a 00 02 lbz r9,2(r10) @@ -11659,7 +11659,7 @@ Disassembly of section .text: 20b60c: 3b ff 00 01 addi r31,r31,1 20b610: 39 00 ff 80 li r8,-128 20b614: 39 29 00 01 addi r9,r9,1 - 20b618: 40 bc 00 2c bge cr7,0x20b644 + 20b618: 40 fc 00 2c bge+ cr7,0x20b644 20b61c: 39 20 00 01 li r9,1 20b620: 48 00 00 24 b 0x20b644 20b624: 7f 9f e8 40 cmplw cr7,r31,r29 @@ -12450,7 +12450,7 @@ Disassembly of section .text: 20c268: 38 60 00 00 li r3,0 20c26c: 81 81 04 e8 lwz r12,1256(r1) 20c270: 39 61 05 10 addi r11,r1,1296 - 20c274: 7d 80 81 20 mtcrf 8,r12 + 20c274: 7d 90 81 20 mtocrf 8,r12 20c278: 4b ff 40 e0 b 0x200358 20c27c: 94 21 ff d0 stwu r1,-48(r1) 20c280: 7c 08 02 a6 mflr r0
В Sat, 27 Sep 2014 09:06:53 +0400
Andrei Borzenkov <[email protected]> пишет:
Quoted 39 lines
В Fri, 26 Sep 2014 16:29:40 -0300
Paulo Flabiano Smorigo <[email protected]> пишет:Quoted 36 lines
* conf/Makefile.common [
COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add -msoft-float -mno-vsx -mno-altivec.--- ChangeLog | 7 +++++++ conf/Makefile.common | 3 +++ 2 files changed, 10 insertions(+)ChangeLog +7
-0@@ -1,3 +1,10 @@ +2014-09-26 Paulo Flabiano Smorigo <[email protected]> + + Add flags for powerpc in order to avoid exceptions + + * conf/Makefile.common [COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add + -msoft-float -mno-vsx -mno-altivec. + 2014-09-25 Colin Watson <[email protected]> Fix in-tree --platform=noneconf/Makefile.common +3
-0@@ -22,6 +22,9 @@ endif if COND_arm64 CFLAGS_PLATFORM += -mcmodel=large endif +if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -msoft-float -mno-vsx -mno-altivec +endif
Quoted 8 lines
conf/Makefile.common endif · line 30
Quoted 2 lines
conf/Makefile.common +0
-0#FIXME: discover and check XEN headers CPPFLAGS_XEN = -I/usr/includeThank you! I confirm that this patch works and does not break grub on earlier CPU :)
There are still differences in generated code, so we probably need to tune some more flags.
I looked at compiler options for PowerPC and I think instead of trying to catch individual flags which may change with every release we should simply force the most common platform by
+if COND_powerpc_ieee1275
+ CFLAGS_PLATFORM += -mcpu=powerpc -mtune=powerpc +endif
This makes sure result is identical on every platform and provides most generic code that is expected to run on every(?) system.
WDYT?
Quoted 60 lines · Andrei Borzenkov
В Sat, 27 Sep 2014 09:06:53 +0400
Andrei Borzenkov <[email protected]> пишет:Quoted 39 lines
В Fri, 26 Sep 2014 16:29:40 -0300
Paulo Flabiano Smorigo <[email protected]> пишет:Quoted 36 lines
* conf/Makefile.common [
COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add -msoft-float -mno-vsx -mno-altivec.--- ChangeLog | 7 +++++++ conf/Makefile.common | 3 +++ 2 files changed, 10 insertions(+)ChangeLog +7
-0@@ -1,3 +1,10 @@ +2014-09-26 Paulo Flabiano Smorigo <[email protected]> + + Add flags for powerpc in order to avoid exceptions + + * conf/Makefile.common [COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add + -msoft-float -mno-vsx -mno-altivec. + 2014-09-25 Colin Watson <[email protected]> Fix in-tree --platform=noneconf/Makefile.common +3
-0@@ -22,6 +22,9 @@ endif if COND_arm64 CFLAGS_PLATFORM += -mcmodel=large endif +if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -msoft-float -mno-vsx -mno-altivec +endifQuoted 8 lines
conf/Makefile.common endif · line 30
Quoted 2 lines
conf/Makefile.common +0
-0#FIXME: discover and check XEN headers CPPFLAGS_XEN = -I/usr/includeThank you! I confirm that this patch works and does not break grub on earlier CPU :)
There are still differences in generated code, so we probably need to tune some more flags.
I looked at compiler options for PowerPC and I think instead of trying to catch individual flags which may change with every release we should simply force the most common platform by
conf/Makefile.common +3
-0+if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -mcpu=powerpc -mtune=powerpc +endif
Quoted 4 lines
This makes sure result is identical on every platform and provides most generic code that is expected to run on every(?) system.
WDYT?
Hi Andrei,
Sorry to take so long to answer your question.
After an internal discussion with some toolchain experts we found out that your approach is good. It works and it's more generic but we think that we should change it a little bit:
* skip -mtune, not really necessary
* add "-msoft-float" to be completly safe.
Something like:
+if COND_powerpc_ieee1275
+ CFLAGS_PLATFORM += -mcpu=powerpc -msoft-float
+endif
This approach is similar to what the linux kernel do.
In addition, they recomend to set FP MSR value to zero as well.
Andrei, Vladimir, agree?
Quoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Paulo Flabiano Smorigo IBM Linux Technology Center
В Wed, 8 Oct 2014 20:38:29 -0300
Paulo Flabiano Smorigo <[email protected]> пишет:
Quoted 68 lines
Quoted 60 lines · Andrei Borzenkov
В Sat, 27 Sep 2014 09:06:53 +0400
Andrei Borzenkov <[email protected]> пишет:Quoted 39 lines
В Fri, 26 Sep 2014 16:29:40 -0300
Paulo Flabiano Smorigo <[email protected]> пишет:Quoted 36 lines
* conf/Makefile.common [
COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add -msoft-float -mno-vsx -mno-altivec.--- ChangeLog | 7 +++++++ conf/Makefile.common | 3 +++ 2 files changed, 10 insertions(+)ChangeLog +7
-0@@ -1,3 +1,10 @@ +2014-09-26 Paulo Flabiano Smorigo <[email protected]> + + Add flags for powerpc in order to avoid exceptions + + * conf/Makefile.common [COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add + -msoft-float -mno-vsx -mno-altivec. + 2014-09-25 Colin Watson <[email protected]> Fix in-tree --platform=noneconf/Makefile.common +3
-0@@ -22,6 +22,9 @@ endif if COND_arm64 CFLAGS_PLATFORM += -mcmodel=large endif +if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -msoft-float -mno-vsx -mno-altivec +endifQuoted 8 lines
conf/Makefile.common endif · line 30
Quoted 2 lines
conf/Makefile.common +0
-0#FIXME: discover and check XEN headers CPPFLAGS_XEN = -I/usr/includeThank you! I confirm that this patch works and does not break grub on earlier CPU :)
There are still differences in generated code, so we probably need to tune some more flags.
I looked at compiler options for PowerPC and I think instead of trying to catch individual flags which may change with every release we should simply force the most common platform by
conf/Makefile.common +3
-0+if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -mcpu=powerpc -mtune=powerpc +endifQuoted 4 lines
This makes sure result is identical on every platform and provides most generic code that is expected to run on every(?) system.
WDYT?
Hi Andrei,
Quoted 7 lines
Sorry to take so long to answer your question.
After an internal discussion with some toolchain experts we found out that your approach is good. It works and it's more generic but we think that we should change it a little bit:
* skip -mtune, not really necessary
Fine if you say so.
Quoted 2 lines
* add "-msoft-float" to be completly safe.
Is it really necessary? I do not think grub is using floating point anywhere.
conf/Makefile.common endif · line 27
Quoted 6 lines
Something like:
conf/Makefile.common +3
-0+if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -mcpu=powerpc -msoft-float +endif
Should not we also add -mbig-endian here, and not in configure? This is really something we always use, not something we need to detect dynamically.
Quoted 6 lines
This approach is similar to what the linux kernel do.
In addition, they recomend to set FP MSR value to zero as well.
Andrei, Vladimir, agree?
Could you resend your patches as discussed and rebased to git master, so they are easier to review and comment?
Quoted 83 lines · Paulo Flabiano Smorigo
Quoted 60 lines · Andrei Borzenkov
В Sat, 27 Sep 2014 09:06:53 +0400
Andrei Borzenkov <[email protected]> пишет:Quoted 39 lines
В Fri, 26 Sep 2014 16:29:40 -0300
Paulo Flabiano Smorigo <[email protected]> пишет:Quoted 36 lines
* conf/Makefile.common [
COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add -msoft-float -mno-vsx -mno-altivec.--- ChangeLog | 7 +++++++ conf/Makefile.common | 3 +++ 2 files changed, 10 insertions(+)ChangeLog +7
-0@@ -1,3 +1,10 @@ +2014-09-26 Paulo Flabiano Smorigo <[email protected]> + + Add flags for powerpc in order to avoid exceptions + + * conf/Makefile.common [COND_powerpc_ieee1275] (CFLAGS_PLATFORM): Add + -msoft-float -mno-vsx -mno-altivec. + 2014-09-25 Colin Watson <[email protected]> Fix in-tree --platform=noneconf/Makefile.common +3
-0@@ -22,6 +22,9 @@ endif if COND_arm64 CFLAGS_PLATFORM += -mcmodel=large endif +if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -msoft-float -mno-vsx -mno-altivec +endifQuoted 8 lines
conf/Makefile.common endif · line 30
Quoted 2 lines
conf/Makefile.common +0
-0#FIXME: discover and check XEN headers CPPFLAGS_XEN = -I/usr/includeThank you! I confirm that this patch works and does not break grub on earlier CPU :)
There are still differences in generated code, so we probably need to tune some more flags.
I looked at compiler options for PowerPC and I think instead of trying to catch individual flags which may change with every release we should simply force the most common platform by
conf/Makefile.common +3
-0+if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -mcpu=powerpc -mtune=powerpc +endifQuoted 4 lines
This makes sure result is identical on every platform and provides most generic code that is expected to run on every(?) system.
WDYT?
Hi Andrei,
Sorry to take so long to answer your question.
After an internal discussion with some toolchain experts we found out that your approach is good. It works and it's more generic but we think that we should change it a little bit:
* skip -mtune, not really necessary
* add "-msoft-float" to be completly safe.Something like:
conf/Makefile.common +3
-0+if COND_powerpc_ieee1275 + CFLAGS_PLATFORM += -mcpu=powerpc -msoft-float +endif
Quoted 1 line
This approach is similar to what the linux kernel do.
Can you add -msoft-float to all archs? Other than that proposition looks good