| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This required some fiddling around with the location of forward
declarations since the C sources generated by GHC's C backend only
includes Stg.h.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- No need to distinguish between gcc-llvm and clang. First of all,
gcc-llvm is quite old and surely unmaintained by now. Second of all,
none of the code actually care about that distinction!
Now, it does make sense to consider C multiple frontends for LLVMs in
the form of clang vs clang-cl (same clang, yes, but tweaked
interface). But this is better handled in terms of "gccish vs
mvscish" and "is LLVM", yielding 4 combinations. Therefore, I don't
think it is useful saving the existing code for that.
- Get the remaining CC_LLVM_BACKEND, and also TABLES_NEXT_TO_CODE in
mk/config.h the normal way, rather than hacking it post-hoc. No point
keeping these special cases around for now reason.
- Get rid of hand-rolled `die` function and just use `AC_MSG_ERROR`.
- Abstract check + flag override for unregisterised and tables next to
code.
Oh, and as part of the above I also renamed/combined some variables
where it felt appropriate.
- GccIsClang -> CcLlvmBackend. This is for `AC_SUBST`, like the other
Camal case ones. It was never about gcc-llvm, or Apple's renamed clang,
to be clear.
- llvm_CC_FLAVOR -> CC_LLVM_BACKEND. This is for `AC_DEFINE`, like the
other all-caps snake case ones. llvm_CC_FLAVOR was just silly
indirection *and* an odd name to boot.
|
|
|
|
|
|
|
| |
Until 0472f0f6a92395d478e9644c0dbd12948518099f there was a meaningful
host vs target distinction (though it wasn't used right, in genapply).
After that, they did not differ in meaningful ways, so it's best to just
only keep one.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This moves all URL references to Trac Wiki to their corresponding
GitLab counterparts.
This substitution is classified as follows:
1. Automated substitution using sed with Ben's mapping rule [1]
Old: ghc.haskell.org/trac/ghc/wiki/XxxYyy...
New: gitlab.haskell.org/ghc/ghc/wikis/xxx-yyy...
2. Manual substitution for URLs containing `#` index
Old: ghc.haskell.org/trac/ghc/wiki/XxxYyy...#Zzz
New: gitlab.haskell.org/ghc/ghc/wikis/xxx-yyy...#zzz
3. Manual substitution for strings starting with `Commentary`
Old: Commentary/XxxYyy...
New: commentary/xxx-yyy...
See also !539
[1]: https://gitlab.haskell.org/bgamari/gitlab-migration/blob/master/wiki-mapping.json
|
|
|
|
|
| |
This moves all URL references to Trac tickets to their corresponding
GitLab counterparts.
|
|
|
|
|
|
| |
Apparently clang doesn't enable implicitly fallthrough warnings by default
http://llvm.org/viewvc/llvm-project?revision=167655&view=revision when compiling
C and the attribute cause warnings of their own (#16019).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of using the GCC `/* fallthrough */` syntax we now use the
`__attribute__((fallthrough))`, which Phyx says should be more portable
than the former.
Also adds a missing fallthrough annotation in the MachO linker,
fixing #14613.
Reviewers: erikd, simonmar
Reviewed By: simonmar
Subscribers: rwbarton, carter
GHC Trac Issues: #14613
Differential Revision: https://phabricator.haskell.org/D5292
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Fixes #14784. Note that C++11 is quite conservative; we could likely accept
C++03 as well.
Test Plan:
```
$ cat >hi.c <<EOF
#include <Rts.h>
EOF
$ g++ -std=c++11 hi.c
```
Reviewers: simonmar, hvr
Subscribers: rwbarton, carter
GHC Trac Issues: #14784
Differential Revision: https://phabricator.haskell.org/D5244
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: Validate
Reviewers: simonmar
Reviewed By: simonmar
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D5000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Windows we use the function `win32AllocStack` to do stack
allocations in 4k blocks and insert a stack check afterwards
to ensure the allocation returned a valid block.
The problem is this function does something that by C semantics
is pointless. The stack allocated value can never escape the
function, and the stack isn't used so the compiler just optimizes
away the entire function body.
After considering a bunch of other possibilities I think the simplest
fix is to just disable optimizations for the function.
Alternatively inline assembly is an option but the stack check function
doesn't have a very portable name as it relies on e.g. `libgcc`.
Thanks to Sergey Vinokurov for helping diagnose and test.
Test Plan: ./validate
Reviewers: bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #14669
Differential Revision: https://phabricator.haskell.org/D4343
|
|
|
|
| |
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
| |
Our new CPP linter enforces this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The C code in the RTS now gets built with `-Wundef` and the Haskell code
(stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever
`#if` is used on undefined identifiers.
Test Plan: Validate on Linux and Windows
Reviewers: austin, angerman, simonmar, bgamari, Phyx
Reviewed By: bgamari
Subscribers: thomie, snowleopard
Differential Revision: https://phabricator.haskell.org/D3278
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider one-line module
module B (v) where v = "hello"
in -fvia-C mode it generates code like
static char gibberish_str[] = "hello";
It resides in data section (precious resource on ia64!).
The patch switches genrator to emit:
static const char gibberish_str[] = "hello";
Other types if symbols that gained 'const' qualifier are:
- info tables (from haskell and CMM)
- static reference tables (from haskell and CMM)
Cleanups along the way:
- fixed info tables defined in .cmm to reside in .rodata
- split out closure declaration into 'IC_' / 'EC_'
- added label declaration (based on label type) right before
each label definition (based on section type) so that C
compiler could check if declaration and definition matches
at definition site.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: ran testsuite on unregisterised x86_64 compiler
Reviewers: simonmar, ezyang, austin, bgamari, erikd
Reviewed By: bgamari, erikd
Subscribers: rwbarton, thomie
GHC Trac Issues: #8996
Differential Revision: https://phabricator.haskell.org/D3481
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This both says what we mean and silences a bunch of spurious CPP linting
warnings. This pragma is supported by all CPP implementations which we
support.
Reviewers: austin, erikd, simonmar, hvr
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3482
|
|
|
|
| |
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
| |
This is causing too much platform dependent breakage at the moment. We
will need a more rigorous testing strategy before this can be
merged again.
This reverts commit 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The C code in the RTS now gets built with `-Wundef` and the Haskell code
(stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever
`#if` is used on undefined identifiers.
Test Plan: Validate on Linux and Windows
Reviewers: austin, angerman, simonmar, bgamari, Phyx
Reviewed By: bgamari
Subscribers: thomie, snowleopard
Differential Revision: https://phabricator.haskell.org/D3278
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When toplevel literals don't have a way to be exported
from module GHC infers their labels as static.
Example from GHC.Arr:
static char rdVA_bytes[] = " out of range ";
When this label is used in module internally
we also need to provide it's forward declaration.
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Typical UNREG build failure looks like that:
ghc-unreg/includes/Stg.h:226:46: error:
note: in definition of macro 'EI_'
#define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
^
|
226 | #define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
| ^
/tmp/ghc10489_0/ghc_3.hc:1754:6: error:
note: previous definition of 'ghczmprim_GHCziTypes_zdtcTyCon2_bytes' was here
char ghczmprim_GHCziTypes_zdtcTyCon2_bytes[] = "TyCon";
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
1754 | char ghczmprim_GHCziTypes_zdtcTyCon2_bytes[] = "TyCon";
| ^
As we see here "_bytes" string literals are defined as 'char []'
array, not 'StgWord []'.
The change special-cases "_bytes" string literals to have
correct declaration type.
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the first phase of addressing #11757 which aims to make C99
support a base-line requirement for GHC and clean up the code-base to
use C99 facilities when sensible.
This patch exploits the logic/heuristic used by `AC_PROG_CC_C99` to
determine the flags needed in case the C compiler isn't able to compile
C99 code in its current mode. We can't use `AC_PROG_CC_C99` directly
though because GHC's build-system expects CC to contain a filename
without any flags, while `AC_PROG_CC_C99` would e.g. result in
`CC="gcc -std=gnu99"`. Morever, we support different `CC`s for
stage0/1/2, so we need a version of `AC_PROG_CC_C99` for which we can
specify the `CC`/`CFLAGS` variables to operate on. This is what
`FP_SET_CFLAGS_C99` does.
Note that Clang has been defaulting to C99+ for a long time, while GCC 5
defaults to C99+ as well. So this has mostly an affect on older GCCs
versions prior to 5.0 and possibly compilers other than GCC/Clang (which
are not officially supported for building GHC anyway).
Reviewers: kgardas, erikd, bgamari, austin
Reviewed By: erikd
Differential Revision: https://phabricator.haskell.org/D2045
|
|
|
|
|
|
|
|
|
| |
At some point there may have been a reason for the
`INLINE_ME` macro, but not anymore...
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D2041
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turns out the current macros for gnu90-style inline
semantics stopped working with GCC 5
(and possibly also with Apple's GCC) which switched on
`__GNUC_STDC_INLINE__` by default falling back to using the
suboptimal `static inline` mode.
However, C99 supports an equivalent (as far as our
use-case is concerned) `extern inline` mode.
See also
http://www.greenend.org.uk/rjk/tech/inline.html
for a write-up of gnu90 vs C99 semantics.
This patch also removes the MSVC case as VS2015 is supposed
to finally catch up to C99 (and C11), so we don't need any
special care for MSVC anymore.
Reviewed By: erikd, austin
Differential Revision: https://phabricator.haskell.org/D2039
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before the patch both Cmm and C symbols were declared
with 'EF_' macro:
#define EF_(f) extern StgFunPtr f()
but for Cmm symbols we know exact prototypes.
The patch splits there prototypes in to:
#define EFF_(f) void f() /* See Note [External function prototypes] */
#define EF_(f) StgFunPtr f(void)
Cmm functions are 'EF_' (External Functions),
C functions are 'EFF_' (External Foreign Functions).
While at it changed external C function prototype
to return 'void' to workaround ghc bug on m68k.
Described in detail in Trac #11395.
This makes simple tests work on m68k-linux target!
Thanks to Michael Karcher for awesome analysis
happening in Trac #11395.
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Test Plan: ran "hello world" on m68k successfully
Reviewers: simonmar, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1975
GHC Trac Issues: #11395
|
|
|
|
|
| |
As otherwise <math.h> includes <stdlib.h> which breaks compilation
of .hc files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
_BSD_SOURCE we are using for 'gamma()' and friends
was deprecated in glibc-2.20 in favour of '_DEFAULT_SOURCE'.
gcc says:
In file included from /usr/include/math.h:26:0:
0,
from includes/Stg.h:69,
from /tmp/ghc19488_0/ghc19488_2.hc:3:
/usr/include/features.h:148:3:
warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^
Patch fixes testsuite failures on UNREG
(stderr are not cluttered by warnings anymore).
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Commit reverts never used addition in cbd29e0a23bb8e15033edae123d6c8fbe9740c97
I think it might make sense to take advantage of TSO/RMO/PSO models
tome day. But it's highly architecture/model-dependent thus it better
be implemented in per-arch Native CodeGen.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: build-tested on UNREG-amd64
Reviewers: simonmar, austin
Reviewed By: austin
Subscribers: simonmar, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D186
|
|
|
|
|
|
|
| |
No need to emit (now empty) those special markers.
Markers were needed only in registerised -fvia-C mode.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GHC's generated C code uses dummy prototypes for foreign imports. At the
moment these all claim to be (void), i.e. functions of zero arguments. On
most platforms this doesn't matter very much: calls to these functions put
the parameters in the usual places anyway, and (with the exception of
varargs) things just work.
However, the ELFv2 ABI on ppc64 optimises stack allocation
(http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html): a call to a
function that has a prototype, is not varargs, and receives all parameters
in registers rather than on the stack does not require the caller to
allocate an argument save area. The incorrect prototypes cause GCC to
believe that all functions declared this way can be called without an
argument save area, but if the callee has sufficiently many arguments then
it will expect that area to be present, and will thus corrupt the caller's
stack. This happens in particular with calls to runInteractiveProcess in
libraries/process/cbits/runProcess.c.
The simplest fix appears to be to declare these external functions with an
unspecified argument list rather than a void argument list. This is no
worse for platforms that don't care either way, and allows a successful
bootstrap of GHC 7.8 on little-endian Linux ppc64 (which uses the ELFv2
ABI).
Fixes #8965
Signed-off-by: Colin Watson <cjwatson@debian.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes most of implicit function declarations emitted
C codegen in UNREG mode. Found by adding the following to
mk/build.mk:
SRC_CC_OPTS += -Werror=implicit-function-declaration
SRC_HC_OPTS += -optc-Werror=implicit-function-declaration
Issue #8748
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
| |
|
|
|
|
| |
it was only needed for registerised compilation.
|
|
|
|
| |
No functional differences yet
|
|
|
|
|
| |
We were comparing ALIGNMENT_DOUBLE to ALIGNMENT_LONG, but really
we cared about W_ values, and sizeof(long) /= sizeof(void *) on Win64
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
LLVM does not support the __thread attribute for thread
local storage and may generate incorrect code for global
register variables. We want to allow building the runtime with
LLVM-based compilers such as llvm-gcc and clang,
particularly for MacOS.
This patch changes the gct variable used by the garbage
collector to use pthread_getspecific() for thread local
storage when an llvm based compiler is used to build the
runtime.
|
|/ |
|
|
|
|
|
|
|
| |
When the bootstrap compiler does not include this patch, you must add this line
to mk/build.mk, otherwise the ARM architecture cannot be detected due to a
-undef option given to the C pre-processor.
SRC_HC_OPTS = -pgmP 'gcc -E -traditional'
|
| |
|
| |
|
|
|
|
|
|
|
| |
I've updated the wiki page about the RTS headers
http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
to reflect the new layout and explain some of the rationale. All the
header files now point to this page.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The first phase of this tidyup is focussed on the header files, and in
particular making sure we are exposinng publicly exactly what we need
to, and no more.
- Rts.h now includes everything that the RTS exposes publicly,
rather than a random subset of it.
- Most of the public header files have moved into subdirectories, and
many of them have been renamed. But clients should not need to
include any of the other headers directly, just #include the main
public headers: Rts.h, HsFFI.h, RtsAPI.h.
- All the headers needed for via-C compilation have moved into the
stg subdirectory, which is self-contained. Most of the headers for
the rest of the RTS APIs have moved into the rts subdirectory.
- I left MachDeps.h where it is, because it is so widely used in
Haskell code.
- I left a deprecated stub for RtsFlags.h in place. The flag
structures are now exposed by Rts.h.
- Various internal APIs are no longer exposed by public header files.
- Various bits of dead code and declarations have been removed
- More gcc warnings are turned on, and the RTS code is more
warning-clean.
- More source files #include "PosixSource.h", and hence only use
standard POSIX (1003.1c-1995) interfaces.
There is a lot more tidying up still to do, this is just the first
pass. I also intend to standardise the names for external RTS APIs
(e.g use the rts_ prefix consistently), and declare the internal APIs
as hidden for shared libraries.
|
|
|
|
|
| |
This means that, on Linux, we get functions like gamma defined when we
#include math.h
|
| |
|
| |
|