1. 17 Nov, 2015 3 commits
    • Tamar Christina's avatar
      Fix archive loading on Windows by the runtime loader · acce37f3
      Tamar Christina authored
      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
      acce37f3
    • Adam Sandberg Eriksson's avatar
      Update Cabal submodule for new known extension · b3d6c0f7
      Adam Sandberg Eriksson authored
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1485
      b3d6c0f7
    • Ben Gamari's avatar
      T9181: Fix testsuite output · 4e74ef96
      Ben Gamari authored
      I'm not really sure how this one snuck through my local validation. Hmm.
      4e74ef96
  2. 16 Nov, 2015 4 commits
  3. 14 Nov, 2015 1 commit
  4. 13 Nov, 2015 3 commits
    • Simon Marlow's avatar
      Make 'error' include the CCS call stack when profiled · 8988be85
      Simon Marlow authored
      Summary:
      The idea here is that this gives a more detailed stack trace in two
      cases:
      
      1. With `-prof` and `-fprof-auto`
      2. In GHCi (see #11047)
      
      Example, with an error inserted in nofib/shootout/binary-trees:
      
      ```
      $ ./Main 3
      Main: z
      CallStack (from ImplicitParams):
        error, called at Main.hs:67:29 in main:Main
      CallStack (from -prof):
        Main.check' (Main.hs:(67,1)-(68,82))
        Main.check (Main.hs:63:1-21)
        Main.stretch (Main.hs:32:35-57)
        Main.main.c (Main.hs:32:9-57)
        Main.main (Main.hs:(27,1)-(43,42))
        Main.CAF (<entire-module>)
      ```
      
      This doesn't quite obsolete +RTS -xc, which also attempts to display
      more information in the case when the error is in a CAF, but I'm
      exploring other solutions to that.
      
      Includes submodule updates.
      
      Test Plan: validate
      
      Reviewers: simonpj, ezyang, gridaphobe, bgamari, hvr, austin
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1426
      8988be85
    • Joachim Breitner's avatar
      Give helpful advice when a fully qualified name is not in scope · e66f79df
      Joachim Breitner authored
      This implements #11071. It needs to thread through a GlobalRdrEnv
      corresponding to the export list of the module if its exports were not
      restricted.
      
      A refactoring of ImportedModsVal into a proper data type follows.
      
      Differential Revision: https://phabricator.haskell.org/D1462
      e66f79df
    • Alan Zimmerman's avatar
      APIAnnotations:add Locations in hsSyn for layout · 2290c8bd
      Alan Zimmerman authored
      Summary:
      At the moment ghc-exactprint, which uses the GHC API Annotations to
      provide a framework for roundtripping Haskell source code with optional
      AST edits, has to implement a horrible workaround to manage the points
      where layout needs to be captured.
      
      These are
      
          MatchGroup
          HsDo
          HsCmdDo
          HsLet
          LetStmt
          HsCmdLet
          GRHSs
      
      To provide a more natural representation, the contents subject to layout
      rules need to be wrapped in a SrcSpan.
      
      This commit does this.
      
      Trac ticket #10250
      
      Test Plan: ./validate
      
      Reviewers: hvr, goldfire, bgamari, austin, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1370
      
      GHC Trac Issues: #10250
      2290c8bd
  5. 12 Nov, 2015 4 commits
  6. 11 Nov, 2015 8 commits
    • Matthew Pickering's avatar
      Remove redundant test. · a038b724
      Matthew Pickering authored
      ExportSyntaxImport will fail if this test would have ever failed.
      a038b724
    • Matthew Pickering's avatar
      Rename bundled pattern synonym tests to reflect new terminology · 63cad5d4
      Matthew Pickering authored
      This also fixes a bug which causes intermittent test failures due to
      interdependent tests.
      63cad5d4
    • Peter Trommler's avatar
      nativeGen.PPC: Fix shift arith. right > 31 bits · fb0d5120
      Peter Trommler authored
      Arithmetic right shifts of more than 31 bits set all bits to
      the sign bit on PowerPC. iThe assembler does not allow shift
      amounts larger than 32 so do an arithemetic right shift of 31
      bit instead.
      
      Fixes #10870
      
      Test Plan: validate (especially on powerpc)
      
      Reviewers: austin, erikd, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1459
      
      GHC Trac Issues: #10870
      fb0d5120
    • Sylvain HENRY's avatar
      Detect invalid foreign imports in bytecode compiler · badf5d54
      Sylvain HENRY authored
      The bytecode compiler doesn't handle every foreign import calling
      convention. Instead of crashing during the generation of the foreign
      call, we display an error.
      
      Fix lint warnings
      
      Test Plan: prog014 ghci test added
      
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1458
      
      GHC Trac Issues: #10462
      badf5d54
    • niteria's avatar
      Put kind variables before type variables when specializing · 0f495083
      niteria authored
      When you reverse the order of uniques you get the core lint
      error from the testcase. The testcase is copied from
      tests/simplCore/should_compile/T10689a.hs.
      
      The problem is that we would put type and kind variables ordered by
      unique order, which happened to be the right order for this testcase to
      pass under normal conditions.
      
      I think it's enough to sort them with `sortQuantVars`, but I'm not
      really sure if some more sophisticated dependency analysis isn't needed.
      
      Test Plan: added a new testcase
      
      Reviewers: simonpj, goldfire, simonmar, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1457
      0f495083
    • Sylvain HENRY's avatar
      Systools: read ELF section without calling readelf · 109d7ce8
      Sylvain HENRY authored
      This patch tackles two issues:
      
      1) GHC stores a "link info" string into a ELF section. Initially a
      section with type "note" was used but GHC didn't follow the ELF
      specification which specifies a record-based format for these sections.
      With D1375 we switched to a "progbits" section type for which there
      isn't any format constraint. This is an issue for D1242 which use GCC's
      --gc-sections which collects "unused" sections, such as our section
      containing link info... In this patch, we fall back to a section with
      type "note" but we respect the specified format.
      
      2) Reading back the ELF section was done by parsing the result of a
      call to "readelf". Calling readelf is problematic because the program
      may not be available or it may be renamed on some platforms (see
      D1326). Moreover we have no garanty that its output layout will stay
      the same in future releases of readelf. Finally we would need to fix
      the parsing to support  "note" sections because of 1. Instead, this
      patch proposes to use Data.Binary.Get to directly read the "link info"
      note into its section. ELF has a specification, hence it should work on
      every conforming platform.
      
      This patch "reverts" D1375, hence it supersedes D1432. It makes D1326
      not necessary anymore.
      
      Test Plan:
      - recomp011 should pass (test that relinking is avoided when both "link
      info" match)
      - we should add a test for ELF objects with more than 0xff00 sections
      => added test "recomp015"
      - we should check that GAS generates 32-bit words with .int on every
      supported platform using ELF (or find a place where this is
      documented). harbomaster and I (@hsyl20) only tested on x86-64. On
      platforms where it is not true, it should make recomp011 fail. =>
      tested to work on Linux/amd64, Solaris/i386 and OpenBSD/amd64
      
      Reviewers: olsner, ony, thomie, kgardas, austin, bgamari
      
      Reviewed By: thomie, bgamari
      
      Subscribers: kgardas, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1381
      
      GHC Trac Issues: #10974, #11022
      109d7ce8
    • thomie's avatar
      OPTIONS_GHC compiler flags may contain spaces (#4931) · fbc2537c
      thomie authored
      When a .hsc contains `#define FOO "bar baz"`, hsc2hs emits:
      
          {-# OPTIONS_GHC -optc-DFOO="bar baz" #-}
      
      Make sure GHC can compile this, by tweaking `HeaderInfo.getOptions` a
      bit.
      
      Test Plan: driver/T4931
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Differential Revision: https://phabricator.haskell.org/D1452
      
      GHC Trac Issues: #4931
      fbc2537c
    • Matthew Pickering's avatar
      Associate pattern synonyms with types in module exports · 96621b1b
      Matthew Pickering authored
      This patch implements #10653.
      
      It adds the ability to bundle pattern synonyms with type constructors in
      export lists so that users can treat pattern synonyms more like data
      constructors.
      
      Updates haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: simonpj, gridaphobe, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1258
      
      GHC Trac Issues: #10653
      96621b1b
  7. 09 Nov, 2015 1 commit
  8. 08 Nov, 2015 1 commit
    • Tamar Christina's avatar
      Fix sporadic failing ghci/Linker/Dyn tests · f4056324
      Tamar Christina authored
      Summary:
      Multiple tests use the same source C file.
      GHC was previously writing the resulting .o files
      in the same folder as the source. When these tests
      are run in parallel, sometimes one of the calls would
      use the partial .o file and throw an error.
      
      The .o files are moved into different folders with this
      change.
      
      Test Plan: make test -C testsuite/tests/ghci/linking/dyn
      
      Reviewers: thomie, austin, bgamari
      
      Reviewed By: bgamari
      
      Differential Revision: https://phabricator.haskell.org/D1449
      f4056324
  9. 07 Nov, 2015 4 commits
    • thomie's avatar
      Parser: allow empty multi-line deprecation warnings · 8262c954
      thomie authored
      This should work,
      
          {-# DEPRECATED someFunction [] #-}
      
      Test Plan: parser/should_compile/T3303
      
      Reviewers: bgamari, austin
      
      Reviewed By: austin
      
      Subscribers: mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1433
      
      GHC Trac Issues: #11044
      8262c954
    • johnleo's avatar
      fix #10734 by adding braces to pretty-printing of let inside do · be885857
      johnleo authored
      Test Plan: validate
      
      Reviewers: bgamari, austin, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1448
      
      GHC Trac Issues: #10734
      be885857
    • Tamar Christina's avatar
      Allow the GHCi Linker to resolve related dependencies when loading DLLs · 6e6438e1
      Tamar Christina authored
      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
      6e6438e1
    • Simon Marlow's avatar
      Make GHCi & TH work when the compiler is built with -prof · ce1f1607
      Simon Marlow authored
      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
      ce1f1607
  10. 04 Nov, 2015 1 commit
  11. 01 Nov, 2015 5 commits
  12. 31 Oct, 2015 1 commit
  13. 30 Oct, 2015 4 commits