projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LLVM: Fix #4995, llvm mangler broken for large compiles
[ghc-hetmet.git]
/
rts
/
Linker.c
diff --git
a/rts/Linker.c
b/rts/Linker.c
index
0bbd869
..
2a45aac
100644
(file)
--- a/
rts/Linker.c
+++ b/
rts/Linker.c
@@
-13,8
+13,8
@@
/* Linux needs _GNU_SOURCE to get RTLD_DEFAULT from <dlfcn.h> and
MREMAP_MAYMOVE from <sys/mman.h>.
*/
/* Linux needs _GNU_SOURCE to get RTLD_DEFAULT from <dlfcn.h> and
MREMAP_MAYMOVE from <sys/mman.h>.
*/
-#ifdef __linux__
-#define _GNU_SOURCE
+#if defined(__linux__) || defined(__GLIBC__)
+#define _GNU_SOURCE 1
#endif
#include "Rts.h"
#endif
#include "Rts.h"
@@
-40,6
+40,7
@@
#include <sys/types.h>
#endif
#include <sys/types.h>
#endif
+#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@
-72,7
+73,8
@@
#if defined(linux_HOST_OS ) || defined(freebsd_HOST_OS) || \
defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \
defined(openbsd_HOST_OS ) || \
#if defined(linux_HOST_OS ) || defined(freebsd_HOST_OS) || \
defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \
defined(openbsd_HOST_OS ) || \
- ( defined(darwin_HOST_OS ) && !defined(powerpc_HOST_ARCH) )
+ ( defined(darwin_HOST_OS ) && !defined(powerpc_HOST_ARCH) ) || \
+ defined(kfreebsdgnu_HOST_OS)
/* Don't use mmap on powerpc-apple-darwin as mmap doesn't support
* reallocating but we need to allocate jump islands just after each
* object images. Otherwise relative branches to jump islands can fail
/* Don't use mmap on powerpc-apple-darwin as mmap doesn't support
* reallocating but we need to allocate jump islands just after each
* object images. Otherwise relative branches to jump islands can fail
@@
-88,7
+90,7
@@
#endif
#endif
-#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
+#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
# define OBJFORMAT_ELF
# include <regex.h> // regex is already used by dlopen() so this is OK
// to use here without requiring an additional lib
# define OBJFORMAT_ELF
# include <regex.h> // regex is already used by dlopen() so this is OK
// to use here without requiring an additional lib
@@
-979,7
+981,7
@@
typedef struct _RtsSymbolVal {
SymI_HasProto(stg_yieldzh) \
SymI_NeedsProto(stg_interp_constr_entry) \
SymI_HasProto(stg_arg_bitmaps) \
SymI_HasProto(stg_yieldzh) \
SymI_NeedsProto(stg_interp_constr_entry) \
SymI_HasProto(stg_arg_bitmaps) \
- SymI_HasProto(alloc_blocks_lim) \
+ SymI_HasProto(large_alloc_lim) \
SymI_HasProto(g0) \
SymI_HasProto(allocate) \
SymI_HasProto(allocateExec) \
SymI_HasProto(g0) \
SymI_HasProto(allocate) \
SymI_HasProto(allocateExec) \
@@
-1589,7
+1591,7
@@
mmap_again:
} else {
if ((W_)result > 0x80000000) {
// oops, we were given memory over 2Gb
} else {
if ((W_)result > 0x80000000) {
// oops, we were given memory over 2Gb
-#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)
+#if defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS)
// Some platforms require MAP_FIXED. This is normally
// a bad idea, because MAP_FIXED will overwrite
// existing mappings.
// Some platforms require MAP_FIXED. This is normally
// a bad idea, because MAP_FIXED will overwrite
// existing mappings.
@@
-4651,8
+4653,8
@@
static int relocateSection(
}
IF_DEBUG(linker,
}
IF_DEBUG(linker,
- debugBelch("relocateSection: length = %d, thing = %d, baseValue = %p\n",
- reloc->r_length, thing, baseValue));
+ debugBelch("relocateSection: length = %d, thing = %" PRId64 ", baseValue = %p\n",
+ reloc->r_length, thing, (char *)baseValue));
if (type == X86_64_RELOC_GOT
|| type == X86_64_RELOC_GOT_LOAD)
if (type == X86_64_RELOC_GOT
|| type == X86_64_RELOC_GOT_LOAD)
@@
-4688,9
+4690,12
@@
static int relocateSection(
}
else
{
}
else
{
- value = sections[reloc->r_symbolnum-1].offset
- - sections[reloc->r_symbolnum-1].addr
- + (uint64_t) image;
+ // If the relocation is not through the global offset table
+ // or external, then set the value to the baseValue. This
+ // will leave displacements into the __const section
+ // unchanged (as they ought to be).
+
+ value = baseValue;
}
IF_DEBUG(linker, debugBelch("relocateSection: value = %p\n", (void *)value));
}
IF_DEBUG(linker, debugBelch("relocateSection: value = %p\n", (void *)value));