diff options
author | Zejun Wu <watashi@fb.com> | 2018-12-28 20:37:13 -0800 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-01-30 10:06:32 -0500 |
commit | e29b1ee72d77d5a06ac949f9dcc80108243a25c0 (patch) | |
tree | 3c2104b52c52d77b130c98d3cd486eb47ed2f347 /rts/RtsFlags.c | |
parent | 4bf35da4fccd2a21153a1c19bfa80006e99e02a1 (diff) | |
download | haskell-e29b1ee72d77d5a06ac949f9dcc80108243a25c0.tar.gz |
Add a RTS option -xp to load PIC object anywhere in address space
Summary:
This re-applies {D5195} with fixes for i386:
* Fix unused label warnings, see {D5230} or {D5273}
* Fix a silly bug introduced by moving `#if`
{P190}
Add a RTS option -xp to load PIC object anywhere in address space. We do
this by relaxing the requirement of <0x80000000 result of
`mmapForLinker` and implying USE_CONTIGUOUS_MMAP.
We also need to change calls to `ocInit` and `ocGetNames` to avoid
dangling pointers when the address of `oc->image` is changed by
`ocAllocateSymbolExtra`.
Test Plan:
See {D5195}, also test under i386:
```
$ uname -a
Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28
20:45:30 CEST 2018 i686 GNU/Linux
$ cd testsuite/tests/th/ && make test
...
```
will run `./validate` on stacked diff.
Reviewers: simonmar, bgamari, alpmestan, trommler, hvr, erikd
Reviewed By: simonmar
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5289
Diffstat (limited to 'rts/RtsFlags.c')
-rw-r--r-- | rts/RtsFlags.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index ff9635ab24..37eafa5c55 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -236,6 +236,7 @@ void initRtsFlagsDefaults(void) RtsFlags.MiscFlags.generate_dump_file = false; RtsFlags.MiscFlags.machineReadable = false; RtsFlags.MiscFlags.internalCounters = false; + RtsFlags.MiscFlags.linkerAlwaysPic = DEFAULT_LINKER_ALWAYS_PIC; RtsFlags.MiscFlags.linkerMemBase = 0; #if defined(THREADED_RTS) @@ -457,6 +458,11 @@ usage_text[] = { " -e<n> Maximum number of outstanding local sparks (default: 4096)", #endif #if defined(x86_64_HOST_ARCH) +#if !DEFAULT_LINKER_ALWAYS_PIC +" -xp Assume that all object files were compiled with -fPIC", +" -fexternal-dynamic-refs and load them anywhere in the address", +" space", +#endif " -xm Base address to mmap memory in the GHCi linker", " (hex; must be <80000000)", #endif @@ -1502,6 +1508,11 @@ error = true; break; #if defined(x86_64_HOST_ARCH) + case 'p': /* linkerAlwaysPic */ + OPTION_UNSAFE; + RtsFlags.MiscFlags.linkerAlwaysPic = true; + break; + case 'm': /* linkerMemBase */ OPTION_UNSAFE; if (rts_argv[arg][3] != '\0') { |