| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
On AIX, C system headers can redirect the token `stat` via
#define stat stat64
to provide large-file support. Simply avoiding the use of `stat` as an
identifier eschews macro-replacement.
Differential Revision: https://phabricator.haskell.org/D1566
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This takes care of setting feature test macros (i.e. let Autoconf decide when
those can be set safely) to allow subsequent Autoconf tests to better detect
available OS features.
This also includes a submodule update of unix which enables the use of
`AC_USE_SYSTEM_EXTENSIONS` in there as well.
Specifically, this takes care of setting `_GNU_SOURCE` (which allows to remove
two occurences where it's set manually) and `_ALL_SOURCE` (which fixes issues
on AIX).
See also
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Posix-Variants.html
for details.
At some point we may want to reconsider the purpose of "rts/PosixSource.h" and
rely more on Autoconf instead.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise we'll get link time failures as `base` always builds
`GHC.ExecutionStack`.
Test Plan: Validate
Reviewers: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1519
|
|
|
|
| |
Differential Revision: https://phabricator.haskell.org/D1198#40948
|
| |
|
| |
|
|
|
|
| |
RIP-relative addressing isn't available on i386.
|
|
|
|
|
|
| |
The casting here is a bit tricky since Dwarf_Addr is always 64-bits.
This means we first need to narrow to uintptr_t before casting to/from a
pointer for compatibility on 32-bit architectures.
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1509
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This hasn't been used for a very long time and will soon be superceded
by perf_events support.
Test Plan: validate
Reviewers: austin, simonmar
Reviewed By: austin, simonmar
Subscribers: thomie, erikd
Differential Revision: https://phabricator.haskell.org/D1493
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The runtime loader is unable to find archive files `.a` shipping
with the inplace `GCC`.
It seems the issue is caused by `findArchive` being unable to
find any archives that are shipped using the in-place `GCC`.
- It works on Linux because `findArchive` would search
the standard Linux include path.
- It works during compilation because `GCC` can find it's own libraries
(we explicitly tell it where to look for libraries using the `gcc`
wrapper around `realgcc`)
So fixing the issue means using `searchForLibUsingGcc` in `findArchive`
as well, which will then find the correct file.
The reason for the error as it is, is because if we can't locate the
library using any of the methods we have, we assume it is a system dll,
or something on the system search path. e.g. if trying to load
`kernel32.dll`.
There is a slight issue in that the `GHCi` code (incorrectly) favors
`static archives` over `dynamic` ones
```
findDll `orElse`
findArchive `orElse`
tryGcc `orElse`
tryGccPrefixed `orElse`
assumeDll
```
This has the unwanted effect of when `kernel32` is specified as a lib,
it will try to load `kernel32.a` instead of `kernel32.dll`.
To solve this I have added another search function that is able to
search the Windows search paths using `SearchPath` in order to find if
it is a dll on the system search path.
The new search order is:
```
findDll `orElse`
findSysDll `orElse`
tryGcc `orElse`
findArchive `orElse`
assumeDll
```
(`tryGccPrefixed` was rolled into `tryGcc` so it is no longer needed at
top level)
Test Plan: ./validate added new windows tests T3242
Reviewers: thomie, erikd, hvr, austin, bgamari
Reviewed By: thomie, erikd, bgamari
Differential Revision: https://phabricator.haskell.org/D1455
GHC Trac Issues: #3242
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was previously nearly impossible to read; now it's merely
difficult.
Ideally we would do a more thorough refactoring of the RTS command line
parser (#4243) but this is more effort than I have time for at the
moment.
Test Plan: Try using affected RTS flags
Reviewers: simonmar, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1476
GHC Trac Issues: #4243
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a flag -split-sections that does similar things to
-split-objs, but using sections in single object files instead of
relying on the Satanic Splitter and other abominations. This is very
similar to the GCC flags -ffunction-sections and -fdata-sections.
The --gc-sections linker flag, which allows unused sections to actually
be removed, is added to all link commands (if the linker supports it) so
that space savings from having base compiled with sections can be
realized.
Supported both in LLVM and the native code-gen, in theory for all
architectures, but really tested on x86 only.
In the GHC build, a new SplitSections variable enables -split-sections
for relevant parts of the build.
Test Plan: validate with both settings of SplitSections
Reviewers: dterei, Phyx, austin, simonmar, thomie, bgamari
Reviewed By: simonmar, thomie, bgamari
Subscribers: hsyl20, erikd, kgardas, thomie
Differential Revision: https://phabricator.haskell.org/D1242
GHC Trac Issues: #8405
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch fixes RTS Linker compilation issues on platforms
where SHN_XINDEX is not defined. Tested on OpenBSD. When SHN_XINDEX
is not defined, the code reverts to the old behavior, that means
behavior of the Linker before D1357 which added SHN_XINDEX based
functionality.
Reviewers: bgamari, austin, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1446
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds OpenBSD specific RTS symbols. The patch is taken from
the OpenBSD ports tree, provided by the OpenBSD community.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1445
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
GHCi does not correctly tell the Windows Loader how to handle dependencies to DLL's
that are not on the standard Windows load path:
1. The directory from which the application loaded.
2. The current directory.
3. The system directory. Use the GetSystemDirectory function to get the path of this directory.
4. The 16-bit system directory. There is no function that obtains the path of this directory,
but it is searched.
5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
6. The directories that are listed in the PATH environment variable.
Note that this does not include the per-application path specified by the
AppPaths registry key. The App Paths key is not used when computing the DLL search path.
So what this means is given two DLLs `A` and `B` and `B` depending on `A`.
If we put both DLLs into a new folder bin and then call GHC with:
`ghc -L$(PWD)/bin -lB`
the loading will fail as the Windows loader will try to load the dependency of `B` and fail
since it cannot find `A`.
*IMPORTANT* this patch drops XP Support.
The APIs being used were natively added to Windows 8+ and backported to Windows 7 and Vista
via a mandatory security patch (in 2011). This means that there is a chance that KB2533623 has
not been installed on certain machines. For those machines I display a warning and
temporarily expand the `PATH` to allow it to load.
This patch will make sure that paths provided by the user with `-L` *and* the folder in which a
DLL is found are added to the search path. It does so using one of two methods depending upon how
new of a Windows version we are running on:
- If the APIs are available it will use `addDllDirectory` and `removeDllDirectory`.
The order of which these directories are searched is nondeterministic.
- If the APIs are not available it means that we're running on a pretty old unpatched machine.
But if it's being used in an environment with no internet access it may be the case.
So if the APIs are not available we temporarily extend the `PATH` with the directories.
A warning is also displayed to the user informing them that the linking may fail,
and if it does, install the needed patch. The `PATH` variable has limitations.
Test Plan:
./validate
Added two new test T10955 and T10955dyn
Reviewers: erikd, bgamari, thomie, hvr, austin
Reviewed By: erikd, thomie
Subscribers: #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D1340
GHC Trac Issues: #10955
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Amazingly, there were zero changes to the byte code generator and very
few changes to the interpreter - mainly because we've used good
abstractions that hide the differences between profiling and
non-profiling. So that bit was pleasantly straightforward, but there
were a pile of other wibbles to get the whole test suite through.
Note that a compiler built with -prof is now like one built with
-dynamic, in that to use TH you have to build the code the same way.
For dynamic, we automatically enable -dynamic-too when TH is required,
but we don't have anything equivalent for profiling, so you have to
explicitly use -prof when building code that uses TH with a profiled
compiler. For this reason Cabal won't work with TH. We don't expect
to ship a profiled compiler, so I think that's OK.
Test Plan: validate with GhcProfiled=YES in validate.mk
Reviewers: goldfire, bgamari, rwbarton, austin, hvr, erikd, ezyang
Reviewed By: ezyang
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1407
GHC Trac Issues: #4837, #545
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan:
- Run tests on x86_64/linux and powerpc/linux
- Cross compile rts/Linker.c with the i686-w64-mingw32-gcc and
x86_64-w64-mingw32-gcc Linux to Windows cross-compilers.
Reviewers: bgamari, austin, hvr, Phyx
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1429
|
|
|
|
|
|
|
|
| |
This seems like an obvious place to apply `const`
Reviewed By: simonmar, austin
Differential Revision: https://phabricator.haskell.org/D1416
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
D1357 introduces usage of Elf32_Section/Elf64_Section in RTS linker
code. Unfortunately this is a non-portable Linux-ism and such types are not
defined anywhere except the Linux-land probably. I've checked Solaris 11.2,
Solaris 11.3, FreeBSD 10.1, NetBSD 6.1.5 and OpenBSD current. The fix
is easy to use `unsigned short' as this is also an underlying type
of those Elf*_Section defines in Linux.
Reviewers: olsner, austin, bgamari, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1419
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate
Reviewers: austin, simonmar
Reviewed By: simonmar
Subscribers: simonmar, thomie, scpmw
Differential Revision: https://phabricator.haskell.org/D1418
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the eventlog flush code would fail if `fwrite` wrote less
than the requested amount. Like all Unix stream I/O operations, however,
`fwrite` isn't guaranteed to write the entire buffer. Here we loop as
long as `fwrite` succeeds in writing anything.
Fixes #11041.
Test Plan: Validate with eventlog
Reviewers: austin, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1415
GHC Trac Issues: #11041
|
|
|
|
| |
RTS convention is to use camel-case.
|
|
|
|
|
| |
This is no longer necessary since this symbol can be unwound through
with its DWARF information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a bit ugly as we need to assume the structure of the C stack as
left by StgRun. Nevertheless, it allows us to unwind all the way back to
`_start` on my machine.
```
Stack trace:
set_initial_registers (rts/Libdw.c:272.0)
dwfl_thread_getframes
dwfl_getthreads
dwfl_getthread_frames
libdw_get_backtrace (rts/Libdw.c:243.0)
base_GHCziExecutionStack_getStackTrace1_info
(libraries/base/GHC/ExecutionStack.hs:43.1)
base_GHCziExecutionStack_showStackTrace1_info
(libraries/base/GHC/ExecutionStack.hs:47.1)
base_GHCziBase_bindIO1_info (libraries/base/GHC/Base.hs:1085.1)
base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
stg_catch_frame_info (rts/Exception.cmm:370.1)
stg_stop_thread_info (rts/StgStartup.cmm:42.1)
scheduleWaitThread (rts/Schedule.c:465.0)
hs_main (rts/RtsMain.c:65.0)
__libc_start_main (/tmp/buildd/glibc-2.19/csu/libc-start.c:321.0)
_start
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Need to use `uintptr_t` on PowerPC and possibly other 32 bit
architectures.
Test Plan: Validate on x86_64 and powerpc Linux
Reviewers: austin, hvr, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1412
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch enforces linkage with pthread library on OpenBSD. This is
done in order to avoid linker errors when linking with libffi which
requires POSIX threading but itself is not linked with libpthread
directly. So client binaries (of libffi) needs to link against
libpthread explicitly
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie, erikd
Differential Revision: https://phabricator.haskell.org/D1410
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the two-step allocator the RTS asks the kernel for a large upfront
mmap'd region of memory (on the order of terabytes). While we have no
expectation that this entire region will be backed by physical memory,
this scheme nevertheless fails on some systems with resource limits.
Here we use a back-off scheme to reduce our allocation request until we
find a size agreeable to the kernel. Fixes #10877.
This also fixes a latent bug wherein the heap reservation retry logic
would fail to free the previously reserved address space, which would
likely result in a heap allocation failure.
Test Plan:
set address space limit with `ulimit -v 67108864` and try running
a compiled program
Reviewers: simonmar, austin
Reviewed By: simonmar
Subscribers: thomie, RyanGlScott
Differential Revision: https://phabricator.haskell.org/D1405
GHC Trac Issues: #10877
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since some ELF fields ran out of range to represent that many sections,
they've been extended with magic numbers that indicate that the full
value is stored in another field.
This will be necessary for GHCi with -split-sections on ELF platforms
that don't use GNU ld.
Reviewers: austin, bgamari, simonmar, erikd
Reviewed By: bgamari, simonmar, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1357
GHC Trac Issues: #8405
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously this was introduced in D524 as a compile-time constant.
Sadly, this isn't flexible enough to allow for environments where
ulimits restrict the maximum address space size (see, for instance,
Consequently, we are forced to make this dynamic. In principle this
shouldn't be so terrible as we can place both the beginning and end
addresses within the same cache line, likely incurring only one or so
additional instruction in HEAP_ALLOCED.
Test Plan: validate
Reviewers: austin, simonmar
Reviewed By: simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1353
GHC Trac Issues: #10877
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate on powerpc/linux, x86_64/linux and x86_64/darwin
Reviewers: austin, bgamari, thomie
Reviewed By: thomie
Subscribers: Phyx, thomie
Differential Revision: https://phabricator.haskell.org/D1398
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was possible to read non-existent memory, if we try to read the
srt_offset field of an info table when there is no SRT, and the info
table is right at the start of the text section.
This actually happened to me, I'm not sure why it never happened
before.
Test Plan: validate
Reviewers: rwbarton, ezyang, austin, bgamari
Reviewed By: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1401
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code:
uint64_t c = __sync_sub_and_fetch((uint64_t*)addr, 1);
was causing GCC to emit atomic instructions for 64 bit values which
are not available on PowerPC. However, since PowerPC only has a 32
bit address space, use of a 64 bit value is superflous.
Switching the type from `uint64_t` to `uintptr_t` should simply do
the correct thing on all 32 and 64 bit architectures.
Reviewers: austin, bgamari, simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1399
GHC Trac Issues: #11036
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Drop support for old OS X (OS X 10.2 and earlier) dynamic linking.
10.3 was released in 2003.
Test Plan: Validate on OS X and Linux.
Reviewers: bgamari, thomie, austin
Reviewed By: thomie, austin
Differential Revision: https://phabricator.haskell.org/D1393
|
|
|
|
|
|
|
|
|
| |
LEADING_UNDERSCORE is defined in a header file, so we need to #include
that file where we use LEADING_UNDERSCORE.
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D1382
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Build system support for Cygwin was removed in b6be81b841.
Test Plan:
- Validate on x86_64/linux
- Cross-compile rts/RtsSymbols.c and rts/Linker.c to Windows using the
i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc cross compilers.
Reviewers: hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1371
|
|
|
|
|
|
|
|
| |
$ git grep -n "typedef struct LibDwSession_ "
rts/Libdw.c:63:typedef struct LibDwSession_ LibDwSession;
rts/Libdw.h:22:typedef struct LibDwSession_ LibDwSession;
This trips up (e.g.) GCC v4.4.7.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan:
- Build whole of GHC on Linux.
- Cross-compile rts/RtsSymbols.c and rts/Linker.c to Windows using the
i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc cross compilers.
Reviewers: bgamari, awson, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1365
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: validate
Reviewers: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1366
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pull the RtsSymbolVal typedef and rtsSyms[] array out into a separate
header and C file. No change in functionality.
Test Plan: validate
Reviewers: simonmar, austin, bgamari
Subscribers: Phyx, thomie
Differential Revision: https://phabricator.haskell.org/D1362
|
|
|
|
| |
Differential Revision: https://phabricator.haskell.org/D1348
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Spotted by @erikd
Test Plan: validate
Reviewers: austin, bgamari, erikd
Subscribers: thomie, erikd
Differential Revision: https://phabricator.haskell.org/D1345
|
|
|
|
|
|
|
|
| |
Reviewers: bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1341
|
|
|
|
| |
Even if libdw isn't available.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This uses the backtrace support introduced in D1196 to provide
backtraces from Haskell processes when SIGUSR2 is thrown.
Test Plan: Need to add a test.
Reviewers: scpmw, simonmar, Tarrasch, austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1197
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds basic support to the RTS for DWARF-assisted unwinding of the
Haskell and C stack via libdw. This only adds the infrastructure;
consumers of this functionality will be introduced in future diffs.
Currently we are carrying the initial register collection code in
Libdw.c but this will eventually make its way upstream to libdw.
Test Plan: See future patches
Reviewers: Tarrasch, scpmw, austin, simonmar
Reviewed By: austin, simonmar
Subscribers: simonmar, thomie, erikd
Differential Revision: https://phabricator.haskell.org/D1196
GHC Trac Issues: #10656
|