Skip to content
Snippets Groups Projects
  1. Mar 28, 2016
    • Herbert Valerio Riedel's avatar
      Autoconf: detect and set CFLAGS/CPPFLAGS needed for C99 mode · afc48f89
      Herbert Valerio Riedel authored
      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
      afc48f89
  2. Mar 27, 2016
  3. Mar 25, 2016
    • Herbert Valerio Riedel's avatar
      RTS: Fix & refactor "portable inline" macros · 882179de
      Herbert Valerio Riedel authored
      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
      882179de
  4. Mar 08, 2016
    • Sergei Trofimovich's avatar
      Split external symbol prototypes (EF_) (Trac #11395) · 90e1e160
      Sergei Trofimovich authored
      
      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: default avatarSergei 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
      90e1e160
  5. Dec 04, 2015
  6. Nov 12, 2014
    • Sergei Trofimovich's avatar
      includes/Stg.h: define _DEFAULT_SOURCE for glibc-2.20 · c65221bd
      Sergei Trofimovich authored
      
      _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: default avatarSergei Trofimovich <slyfox@gentoo.org>
      c65221bd
  7. Sep 01, 2014
  8. Aug 28, 2014
  9. Aug 20, 2014
  10. Apr 24, 2014
  11. Apr 22, 2014
    • Colin Watson's avatar
      Be less untruthful about the prototypes of external functions · 5a31f231
      Colin Watson authored
      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: default avatarColin Watson <cjwatson@debian.org>
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      5a31f231
  12. Feb 17, 2014
  13. Oct 01, 2013
  14. Dec 13, 2012
  15. Aug 06, 2012
  16. Mar 23, 2012
    • Ian Lynagh's avatar
      Fix ASSIGN_DBL on Win64 · 1212145b
      Ian Lynagh authored
      We were comparing ALIGNMENT_DOUBLE to ALIGNMENT_LONG, but really
      we cared about W_ values, and sizeof(long) /= sizeof(void *) on Win64
      1212145b
  17. Mar 11, 2012
  18. Nov 22, 2011
  19. Oct 19, 2011
  20. Oct 07, 2011
    • dmp's avatar
      Enable pthread_getspecific() tls for LLVM compiler · dba72545
      dmp authored
      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.
      dba72545
  21. Aug 10, 2011
  22. Jan 27, 2010
  23. Sep 10, 2009
  24. Aug 25, 2009
  25. Aug 02, 2009
    • Simon Marlow's avatar
      RTS tidyup sweep, first phase · a2a67cd5
      Simon Marlow authored
      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.
      a2a67cd5
  26. Jun 09, 2009
  27. Jun 02, 2009
  28. Apr 26, 2009
  29. Dec 02, 2008
  30. Oct 06, 2008
  31. Sep 18, 2008
  32. Sep 16, 2008
  33. Sep 04, 2008
  34. Jun 19, 2008
    • Simon Marlow's avatar
      Fix up inlines for gcc 4.3 · 24ad9cf0
      Simon Marlow authored
      gcc 4.3 emits warnings for static inline functions that its heuristics
      decided not to inline.  The workaround is to either mark appropriate
      functions as "hot" (a new attribute in gcc 4.3), or sometimes to use
      "extern inline" instead.
      
      With this fix I can validate with gcc 4.3 on Fedora 9.
      24ad9cf0
  35. May 12, 2008
  36. Apr 25, 2008
  37. Apr 02, 2008
    • Simon Marlow's avatar
      Do not #include external header files when compiling via C · c245355e
      Simon Marlow authored
      This has several advantages:
      
       - -fvia-C is consistent with -fasm with respect to FFI declarations:
         both bind to the ABI, not the API.
      
       - foreign calls can now be inlined freely across module boundaries, since
         a header file is not required when compiling the call.
      
       - bootstrapping via C will be more reliable, because this difference
         in behavour between the two backends has been removed.
      
      There is one disadvantage:
      
       - we get no checking by the C compiler that the FFI declaration
         is correct.
      
      So now, the c-includes field in a .cabal file is always ignored by
      GHC, as are header files specified in an FFI declaration.  This was
      previously the case only for -fasm compilations, now it is also the
      case for -fvia-C too.
      c245355e
  38. Oct 24, 2006
    • Simon Marlow's avatar
      Split GC.c, and move storage manager into sm/ directory · ab0e778c
      Simon Marlow authored
      In preparation for parallel GC, split up the monolithic GC.c file into
      smaller parts.  Also in this patch (and difficult to separate,
      unfortunatley):
        
        - Don't include Stable.h in Rts.h, instead just include it where
          necessary.
        
        - consistently use STATIC_INLINE in source files, and INLINE_HEADER
          in header files.  STATIC_INLINE is now turned off when DEBUG is on,
          to make debugging easier.
        
        - The GC no longer takes the get_roots function as an argument.
          We weren't making use of this generalisation.
      ab0e778c
  39. Sep 28, 2006
  40. Sep 09, 2006
Loading