summaryrefslogtreecommitdiff
path: root/rts/Linker.c
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2016-06-27 04:54:47 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2016-06-27 04:54:48 +1000
commitda60e3e94ea3e737609444615f61649121782a1a (patch)
treec010dfa4a5703691dd771e8b7e518e1a4ca43e52 /rts/Linker.c
parent8c1ceddd50158f79f9ff103f8f34be9856d4da1d (diff)
downloadhaskell-da60e3e94ea3e737609444615f61649121782a1a.tar.gz
rts/Linker.c: Improve ugly C pre-processor hack
Test Plan: Build on x86_64/linux, x86_64/darwin and powerpc/linux Reviewers: Phyx, bgamari, simonmar, austin Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2364
Diffstat (limited to 'rts/Linker.c')
-rw-r--r--rts/Linker.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index dd36425e63..af87713c51 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -327,11 +327,16 @@ static void *lookupSymbolInDLLs ( unsigned char *lbl );
#ifndef x86_64_HOST_ARCH
static void zapTrailingAtSign ( unsigned char *sym );
#endif
+
+#if defined(x86_64_HOST_ARCH)
+#define ONLY_USED_x86_64_HOST_ARCH(x) (x)
+#else
+#define ONLY_USED_x86_64_HOST_ARCH(x) (x) GNUC3_ATTRIBUTE(__unused__)
+#endif
+
static char *allocateImageAndTrampolines (
pathchar* arch_name, char* member_name,
-#if defined(x86_64_HOST_ARCH)
FILE* f,
-#endif
int size,
int isThin);
#if defined(x86_64_HOST_ARCH)
@@ -2121,11 +2126,8 @@ static HsInt loadArchive_ (pathchar *path)
#if defined(mingw32_HOST_OS)
// TODO: We would like to use allocateExec here, but allocateExec
// cannot currently allocate blocks large enough.
- image = allocateImageAndTrampolines(path, fileName,
-#if defined(x86_64_HOST_ARCH)
- f,
-#endif
- memberSize, isThin);
+ image = allocateImageAndTrampolines(path, fileName, f, memberSize,
+ isThin);
#elif defined(darwin_HOST_OS)
if (RTS_LINKER_USE_MMAP)
image = mmapForLinker(memberSize, MAP_ANONYMOUS, -1, 0);
@@ -2354,11 +2356,8 @@ preloadObjectFile (pathchar *path)
// TODO: We would like to use allocateExec here, but allocateExec
// cannot currently allocate blocks large enough.
- image = allocateImageAndTrampolines(path, "itself",
-#if defined(x86_64_HOST_ARCH)
- f,
-#endif
- fileSize, HS_BOOL_FALSE);
+ image = allocateImageAndTrampolines(path, "itself", f, fileSize,
+ HS_BOOL_FALSE);
if (image == NULL) {
fclose(f);
return NULL;
@@ -3074,11 +3073,9 @@ static int verifyCOFFHeader ( COFF_header *hdr, pathchar *filename);
static char *
allocateImageAndTrampolines (
pathchar* arch_name, char* member_name,
-#if defined(x86_64_HOST_ARCH)
- FILE* f,
-#endif
+ FILE* ONLY_USED_x86_64_HOST_ARCH (f),
int size,
- int isThin)
+ int ONLY_USED_x86_64_HOST_ARCH (isThin))
{
char* image;
#if defined(x86_64_HOST_ARCH)