summaryrefslogtreecommitdiff
path: root/rts/linker
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-04-21 09:16:48 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-28 22:35:04 -0400
commit945c45ad50ed31e3acb96fdaafb21640c4669f12 (patch)
treeae2e59ba8d3a49bbd3c3dcece39d53aef691ed44 /rts/linker
parente5b3492f23c2296d0d8221e1787ee585331f726e (diff)
downloadhaskell-945c45ad50ed31e3acb96fdaafb21640c4669f12.tar.gz
Prefer #if defined to #ifdef
Our new CPP linter enforces this.
Diffstat (limited to 'rts/linker')
-rw-r--r--rts/linker/LoadArchive.c2
-rw-r--r--rts/linker/M32Alloc.h2
-rw-r--r--rts/linker/MachO.c22
-rw-r--r--rts/linker/MachO.h2
-rw-r--r--rts/linker/PEi386.c6
-rw-r--r--rts/linker/PEi386.h2
-rw-r--r--rts/linker/SymbolExtras.c8
-rw-r--r--rts/linker/SymbolExtras.h2
8 files changed, 23 insertions, 23 deletions
diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c
index 006d63d3b5..97546c2457 100644
--- a/rts/linker/LoadArchive.c
+++ b/rts/linker/LoadArchive.c
@@ -537,7 +537,7 @@ static HsInt loadArchive_ (pathchar *path)
oc = mkOc(path, image, memberSize, false, archiveMemberName
, misalignment);
-#ifdef OBJFORMAT_MACHO
+#if defined(OBJFORMAT_MACHO)
ocInit_MachO( oc );
#endif
diff --git a/rts/linker/M32Alloc.h b/rts/linker/M32Alloc.h
index e71f500e08..645f6b2422 100644
--- a/rts/linker/M32Alloc.h
+++ b/rts/linker/M32Alloc.h
@@ -12,7 +12,7 @@
#include <fcntl.h>
#include <sys/mman.h>
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c
index 9f2cb0edba..55ca853456 100644
--- a/rts/linker/MachO.c
+++ b/rts/linker/MachO.c
@@ -784,7 +784,7 @@ relocateAddress(
#endif /* aarch64_HOST_ARCH */
-#ifndef aarch64_HOST_ARCH
+#if !defined(aarch64_HOST_ARCH)
static int
relocateSection(
ObjectCode* oc,
@@ -813,7 +813,7 @@ relocateSection(
for(i = 0; i < n; i++)
{
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
MachORelocationInfo *reloc = &relocs[i];
char *thingPtr = image + sect->offset + reloc->r_address;
@@ -1042,7 +1042,7 @@ relocateSection(
scat->r_value)
- scat->r_value;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if(scat->r_type == PPC_RELOC_SECTDIFF
|| scat->r_type == PPC_RELOC_LO16_SECTDIFF
|| scat->r_type == PPC_RELOC_HI16_SECTDIFF
@@ -1066,7 +1066,7 @@ relocateSection(
- relocateAddress(oc, nSections, sections, pair->r_value));
i++;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if(scat->r_type == PPC_RELOC_HI16
|| scat->r_type == PPC_RELOC_LO16
|| scat->r_type == PPC_RELOC_HA16
@@ -1119,7 +1119,7 @@ relocateSection(
return 0;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
if(scat->r_type == GENERIC_RELOC_VANILLA
|| scat->r_type == PPC_RELOC_SECTDIFF)
#else /* powerpc_HOST_ARCH */
@@ -1130,7 +1130,7 @@ relocateSection(
{
*wordPtr = word;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if (scat->r_type == PPC_RELOC_LO16_SECTDIFF
|| scat->r_type == PPC_RELOC_LO16)
{
@@ -1184,7 +1184,7 @@ relocateSection(
if (reloc->r_length == 2) {
unsigned long word = 0;
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
unsigned long jumpIsland = 0;
long offsetToJumpIsland = 0xBADBAD42; // initialise to bad value
// to avoid warning and to catch
@@ -1200,7 +1200,7 @@ relocateSection(
if (reloc->r_type == GENERIC_RELOC_VANILLA) {
word = *wordPtr;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if (reloc->r_type == PPC_RELOC_LO16) {
word = ((unsigned short*) wordPtr)[1];
word |= ((unsigned long) relocs[i+1].r_address & 0xFFFF) << 16;
@@ -1246,7 +1246,7 @@ relocateSection(
}
if (reloc->r_pcrel) {
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
// In the .o file, this should be a relative jump to NULL
// and we'll change it to a relative jump to the symbol
ASSERT(word + reloc->r_address == 0);
@@ -1272,7 +1272,7 @@ relocateSection(
*wordPtr = word;
continue;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
else if(reloc->r_type == PPC_RELOC_LO16)
{
((unsigned short*) wordPtr)[1] = word & 0xFFFF;
@@ -1860,7 +1860,7 @@ ocRunInit_MachO ( ObjectCode *oc )
return 1;
}
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
/*
* The Mach-O object format uses leading underscores. But not everywhere.
* There is a small number of runtime support functions defined in
diff --git a/rts/linker/MachO.h b/rts/linker/MachO.h
index c07e2944a1..b495c2b9b1 100644
--- a/rts/linker/MachO.h
+++ b/rts/linker/MachO.h
@@ -15,7 +15,7 @@ int ocRunInit_MachO ( ObjectCode* oc );
int machoGetMisalignment( FILE * );
int ocAllocateSymbolExtras_MachO ( ObjectCode* oc );
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
void machoInitSymbolsWithoutUnderscore( void );
#endif
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index c27dd31c01..809840028e 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -51,7 +51,7 @@
#define USED_IF_x86_64_HOST_ARCH STG_UNUSED
#endif
-#ifdef mingw32_HOST_OS
+#if defined(mingw32_HOST_OS)
#include "RtsUtils.h"
#include "RtsSymbolInfo.h"
@@ -669,7 +669,7 @@ cstring_from_section_name (uint8_t* name, uint8_t* strtab)
}
/* See Note [mingw-w64 name decoration scheme] */
-#ifndef x86_64_HOST_ARCH
+#if !defined(x86_64_HOST_ARCH)
static void
zapTrailingAtSign ( uint8_t* sym )
{
@@ -1557,7 +1557,7 @@ SymbolAddr *lookupSymbol_PEi386(SymbolName *lbl)
SymbolAddr* sym;
/* See Note [mingw-w64 name decoration scheme] */
-#ifndef x86_64_HOST_ARCH
+#if !defined(x86_64_HOST_ARCH)
zapTrailingAtSign ( (unsigned char*)lbl );
#endif
sym = lookupSymbolInDLLs((unsigned char*)lbl);
diff --git a/rts/linker/PEi386.h b/rts/linker/PEi386.h
index b034d6c7c9..29ef6ec906 100644
--- a/rts/linker/PEi386.h
+++ b/rts/linker/PEi386.h
@@ -82,7 +82,7 @@ struct _IndirectAddr {
} IndirectAddr;
/* See Note [mingw-w64 name decoration scheme] */
-#ifndef x86_64_HOST_ARCH
+#if !defined(x86_64_HOST_ARCH)
#define STRIP_LEADING_UNDERSCORE 1
#else
#define STRIP_LEADING_UNDERSCORE 0
diff --git a/rts/linker/SymbolExtras.c b/rts/linker/SymbolExtras.c
index 07000331ef..20591fe20c 100644
--- a/rts/linker/SymbolExtras.c
+++ b/rts/linker/SymbolExtras.c
@@ -102,7 +102,7 @@ int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first )
}
-#ifndef arm_HOST_ARCH
+#if !defined(arm_HOST_ARCH)
SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
unsigned long symbolNumber,
unsigned long target )
@@ -114,7 +114,7 @@ SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
extra = &oc->symbol_extras[symbolNumber - oc->first_symbol_extra];
-#ifdef powerpc_HOST_ARCH
+#if defined(powerpc_HOST_ARCH)
// lis r12, hi16(target)
extra->jumpIsland.lis_r12 = 0x3d80;
extra->jumpIsland.hi_addr = target >> 16;
@@ -129,7 +129,7 @@ SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
// bctr
extra->jumpIsland.bctr = 0x4e800420;
#endif /* powerpc_HOST_ARCH */
-#ifdef x86_64_HOST_ARCH
+#if defined(x86_64_HOST_ARCH)
// jmp *-14(%rip)
static uint8_t jmp[] = { 0xFF, 0x25, 0xF2, 0xFF, 0xFF, 0xFF };
extra->addr = target;
@@ -140,7 +140,7 @@ SymbolExtra* makeSymbolExtra( ObjectCode const* oc,
}
#endif
-#ifdef arm_HOST_ARCH
+#if defined(arm_HOST_ARCH)
/*
Note [The ARM/Thumb Story]
~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/rts/linker/SymbolExtras.h b/rts/linker/SymbolExtras.h
index d28baf49df..4974c06e7d 100644
--- a/rts/linker/SymbolExtras.h
+++ b/rts/linker/SymbolExtras.h
@@ -9,7 +9,7 @@
int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first );
-#ifdef arm_HOST_ARCH
+#if defined(arm_HOST_ARCH)
SymbolExtra* makeArmSymbolExtra( ObjectCode const* oc,
unsigned long symbolNumber,
unsigned long target,