[commit: ghc] master: rts/Linker.c: Convert #if/#else to if/else (3ed4b80)

git at git.haskell.org git at git.haskell.org
Sun Oct 25 03:29:19 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3ed4b804bebcb5b1b5420679b5371363bafdfc9f/ghc

>---------------------------------------------------------------

commit 3ed4b804bebcb5b1b5420679b5371363bafdfc9f
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Sat Oct 24 11:56:16 2015 +1100

    rts/Linker.c: Convert #if/#else to if/else
    
    Test Plan: validate
    
    Reviewers: austin, bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1366


>---------------------------------------------------------------

3ed4b804bebcb5b1b5420679b5371363bafdfc9f
 rts/Linker.c | 50 ++++++++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index a33b646..101e549 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -5216,15 +5216,17 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
 #else
           StgInt64 off = value - P;
           if (off >= 0x7fffffffL || off < -0x80000000L) {
-#if X86_64_ELF_NONPIC_HACK
-              StgInt64 pltAddress = (StgInt64) &makeSymbolExtra(oc, ELF_R_SYM(info), S)
+              if (X86_64_ELF_NONPIC_HACK) {
+                  StgInt64 pltAddress =
+                      (StgInt64) &makeSymbolExtra(oc, ELF_R_SYM(info), S)
                                                 -> jumpIsland;
-              off = pltAddress + A - P;
-#else
-              errorBelch("R_X86_64_PC32 relocation out of range: %s = %p\nRecompile %s with -fPIC.",
-                         symbol, off, oc->fileName );
-              return 0;
-#endif
+                  off = pltAddress + A - P;
+              } else {
+                  errorBelch("R_X86_64_PC32 relocation out of range: %s = %"
+                             PRId64 "d\nRecompile %s with -fPIC.",
+                             symbol, off, oc->fileName );
+                  return 0;
+              }
           }
           *(Elf64_Word *)P = (Elf64_Word)off;
 #endif
@@ -5243,15 +5245,17 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
           barf("R_X86_64_32 relocation, but ALWAYS_PIC.");
 #else
           if (value >= 0x7fffffffL) {
-#if X86_64_ELF_NONPIC_HACK
-              StgInt64 pltAddress = (StgInt64) &makeSymbolExtra(oc, ELF_R_SYM(info), S)
+              if (X86_64_ELF_NONPIC_HACK) {
+                  StgInt64 pltAddress =
+                      (StgInt64) &makeSymbolExtra(oc, ELF_R_SYM(info), S)
                                                 -> jumpIsland;
-              value = pltAddress + A;
-#else
-              errorBelch("R_X86_64_32 relocation out of range: %s = %p\nRecompile %s with -fPIC.",
+                  value = pltAddress + A;
+              } else {
+                  errorBelch("R_X86_64_32 relocation out of range: %s = %"
+                         PRId64 "d\nRecompile %s with -fPIC.",
                          symbol, value, oc->fileName );
-              return 0;
-#endif
+                  return 0;
+              }
           }
           *(Elf64_Word *)P = (Elf64_Word)value;
 #endif
@@ -5262,15 +5266,17 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
           barf("R_X86_64_32S relocation, but ALWAYS_PIC.");
 #else
           if ((StgInt64)value > 0x7fffffffL || (StgInt64)value < -0x80000000L) {
-#if X86_64_ELF_NONPIC_HACK
-              StgInt64 pltAddress = (StgInt64) &makeSymbolExtra(oc, ELF_R_SYM(info), S)
+              if (X86_64_ELF_NONPIC_HACK) {
+                  StgInt64 pltAddress =
+                      (StgInt64) &makeSymbolExtra(oc, ELF_R_SYM(info), S)
                                                 -> jumpIsland;
-              value = pltAddress + A;
-#else
-              errorBelch("R_X86_64_32S relocation out of range: %s = %p\nRecompile %s with -fPIC.",
+                  value = pltAddress + A;
+              } else {
+                  errorBelch("R_X86_64_32S relocation out of range: %s = %"
+                         PRId64 "d\nRecompile %s with -fPIC.",
                          symbol, value, oc->fileName );
-              return 0;
-#endif
+                  return 0;
+              }
           }
           *(Elf64_Sword *)P = (Elf64_Sword)value;
 #endif



More information about the ghc-commits mailing list