[Git][ghc/ghc][wip/ghc-toolchain-fixes] 36 commits: JS: Improve compatibility with recent emsdk
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Wed Aug 9 11:08:09 UTC 2023
Matthew Pickering pushed to branch wip/ghc-toolchain-fixes at Glasgow Haskell Compiler / GHC
Commits:
aa07402e by Luite Stegeman at 2023-08-05T23:15:55+09:00
JS: Improve compatibility with recent emsdk
The JavaScript code in libraries/base/jsbits/base.js had some
hardcoded offsets for fields in structs, because we expected
the layout of the data structures to remain unchanged. Emsdk
3.1.42 changed the layout of the stat struct, breaking this
assumption, and causing code in .hsc files accessing the
stat struct to fail.
This patch improves compatibility with recent emsdk by
removing the assumption that data layouts stay unchanged:
1. offsets of fields in structs used by JavaScript code are
now computed by the configure script, so both the .js and
.hsc files will automatically use the new layout if anything
changes.
2. the distrib/configure script checks that the emsdk version
on a user's system is the same version that a bindist was
booted with, to avoid data layout inconsistencies
See #23641
- - - - -
b938950d by Luite Stegeman at 2023-08-07T06:27:51-04:00
JS: Fix missing local variable declarations
This fixes some missing local variable declarations that were
found by running the testsuite in strict mode.
Fixes #23775
- - - - -
6c0e2247 by sheaf at 2023-08-07T13:31:21-04:00
Update Haddock submodule to fix #23368
This submodule update adds the following three commits:
bbf1c8ae - Check for puns
0550694e - Remove fake exports for (~), List, and Tuple<n>
5877bceb - Fix pretty-printing of Solo and MkSolo
These commits fix the issues with Haddock HTML rendering reported in
ticket #23368.
Fixes #23368
- - - - -
5b5be3ea by Matthew Pickering at 2023-08-07T13:32:00-04:00
Revert "Bump bytestring submodule to 0.11.5.1"
This reverts commit 43578d60bfc478e7277dcd892463cec305400025.
Fixes #23789
- - - - -
01961be3 by Ben Gamari at 2023-08-08T02:47:14-04:00
configure: Derive library version from ghc-prim.cabal.in
Since ghc-prim.cabal is now generated by Hadrian, we cannot depend upon
it.
Closes #23726.
- - - - -
3b373838 by Ryan Scott at 2023-08-08T02:47:49-04:00
tcExpr: Push expected types for untyped TH splices inwards
In !10911, I deleted a `tcExpr` case for `HsUntypedSplice` in favor of a much
simpler case that simply delegates to `tcApp`. Although this passed the test
suite at the time, this was actually an error, as the previous `tcExpr` case
was critically pushing the expected type inwards. This actually matters for
programs like the one in #23796, which GHC would not accept with type inference
alone—we need full-blown type _checking_ to accept these.
I have added back the previous `tcExpr` case for `HsUntypedSplice` and now
explain why we have two different `HsUntypedSplice` cases (one in `tcExpr` and
another in `splitHsApps`) in `Note [Looking through Template Haskell splices in
splitHsApps]` in `GHC.Tc.Gen.Head`.
Fixes #23796.
- - - - -
0ef1d8ae by sheaf at 2023-08-08T21:26:51-04:00
Compute all emitted diagnostic codes
This commit introduces in GHC.Types.Error.Codes the function
constructorCodes :: forall diag. (...) => Map DiagnosticCode String
which computes a collection of all the diagnostic codes that correspond
to a particular type. In particular, we can compute the collection of
all diagnostic codes emitted by GHC using the invocation
constructorCodes @GhcMessage
We then make use of this functionality in the new "codes" test which
checks consistency and coverage of GHC diagnostic codes.
It performs three checks:
- check 1: all non-outdated GhcDiagnosticCode equations
are statically used.
- check 2: all outdated GhcDiagnosticCode equations
are statically unused.
- check 3: all statically used diagnostic codes are covered by
the testsuite (modulo accepted exceptions).
- - - - -
4bc7b1e5 by Fraser Tweedale at 2023-08-08T21:27:32-04:00
numberToRangedRational: fix edge cases for exp ≈ (maxBound :: Int)
Currently a negative exponent less than `minBound :: Int` results in
Infinity, which is very surprising and obviously wrong.
```
λ> read "1e-9223372036854775808" :: Double
0.0
λ> read "1e-9223372036854775809" :: Double
Infinity
```
There is a further edge case where the exponent can overflow when
increased by the number of tens places in the integer part, or
underflow when decreased by the number of leading zeros in the
fractional part if the integer part is zero:
```
λ> read "10e9223372036854775807" :: Double
0.0
λ> read "0.01e-9223372036854775808" :: Double
Infinity
```
To resolve both of these issues, perform all arithmetic and
comparisons involving the exponent in type `Integer`. This approach
also eliminates the need to explicitly check the exponent against
`maxBound :: Int` and `minBound :: Int`, because the allowed range
of the exponent (i.e. the result of `floatRange` for the target
floating point type) is certainly within those bounds.
This change implements CLC proposal 192:
https://github.com/haskell/core-libraries-committee/issues/192
- - - - -
6eab07b2 by Alan Zimmerman at 2023-08-08T21:28:10-04:00
EPA: Remove Location from WarningTxt source
This is not needed.
- - - - -
8670bb2a by Matthew Pickering at 2023-08-09T11:53:27+01:00
ghc-toolchain: Match CPP args with configure script
At the moment we need ghc-toolchain to precisely match the output as
provided by the normal configure script. The normal configure script
(FP_HSCPP_CMD_WITH_ARGS) branches on whether we are using clang or gcc
so we match that logic exactly in ghc-toolchain.
The old implementation (which checks if certain flags are supported) is
better but for now we have to match to catch any potential errors in the
configuration.
Ticket: #23720
- - - - -
6a81d0b3 by Matthew Pickering at 2023-08-09T11:53:29+01:00
configure: Fix `-Wl,--no-as-needed` check
The check was failing because the args supplied by $$1 were quoted which
failed because then the C compiler thought they were an input file.
Fixes #23720
- - - - -
6a17f85f by Matthew Pickering at 2023-08-09T11:53:29+01:00
configure: Add flag which turns ghc-toolchain check into error
We want to catch these errors in CI, but first we need to a flag which
turns this check into an error.
- - - - -
858e0068 by Matthew Pickering at 2023-08-09T11:53:29+01:00
ci: Enable --enable-strict-ghc-toolchain-check for all CI jobs
This will cause any CI job to fail if we have a mismatch between what
ghc-toolchain reports and what ./configure natively reports. Fixing
these kinds of issues is highest priority for 9.10 release.
- - - - -
ad7aeef2 by Rodrigo Mesquita at 2023-08-09T12:07:58+01:00
Pass user-specified options to ghc-toolchain
The current user interface to configuring target toolchains is `./configure`.
In !9263 we added a new tool to configure target toolchains called
`ghc-toolchain`, but the blessed way of creating these toolchains is
still through configure.
However, we were not passing the user-specified options given with the
`./configure` invocation to the ghc-toolchain tool.
This commit remedies that by storing the user options and environment
variables in USER_* variables, which then get passed to GHC-toolchain.
The exception to the rule is the windows bundled toolchain, which
overrides the USER_* variables with whatever flags the windows bundled
toolchain requires to work.
We consider the bundled toolchain to be effectively the user specifying
options, since the actual user delegated that configuration work.
Closes #23678
- - - - -
383e1e58 by Rodrigo Mesquita at 2023-08-09T12:07:58+01:00
ghc-toolchain: Parse javascript and ghcjs as a Arch and OS
- - - - -
5ef96812 by Rodrigo Mesquita at 2023-08-09T12:07:58+01:00
ghc-toolchain: Fix ranlib option
- - - - -
ad10bef4 by Rodrigo Mesquita at 2023-08-09T12:07:58+01:00
Check Link Works with -Werror
- - - - -
26bca870 by Matthew Pickering at 2023-08-09T12:07:58+01:00
Only check for no_compact_unwind support on darwin
While writing ghc-toolchain we noticed that the
FP_PROG_LD_NO_COMPACT_UNWIND check is subtly wrong. Specifically, we
pass -Wl,-no_compact_unwind to cc. However, ld.gold interprets this as
-n o_compact_unwind, which is a valid argument.
Fixes #23676
- - - - -
f8b70fc3 by Matthew Pickering at 2023-08-09T12:07:58+01:00
add some javascript special cases
- - - - -
362aafad by Matthew Pickering at 2023-08-09T12:07:58+01:00
check for emcc in gnu_LD check
- - - - -
4149661d by Matthew Pickering at 2023-08-09T12:07:58+01:00
Add ldOverrideWhitelist to only default to ldOverride on windows/linux
- - - - -
1f3b6fa7 by Matthew Pickering at 2023-08-09T12:07:58+01:00
Fix plaform glob in FPTOOLS_SET_C_LD_FLAGS
A normal triple may look like
x86_64-unknown-linux
but when cross-compiling you get $target set to a quad such as..
aarch64-unknown-linux-gnu
Which should also match this check.
- - - - -
2b57b9ff by Matthew Pickering at 2023-08-09T12:07:58+01:00
ghc-toolchain: Pass ld-override onto ghc-toolchain
- - - - -
c79b76ce by Matthew Pickering at 2023-08-09T12:07:58+01:00
ld override: Make whitelist override user given option
- - - - -
9eb5c55c by Matthew Pickering at 2023-08-09T12:07:58+01:00
ghc-toolchain: Add format mode to normalise differences before diffing.
The "format" mode takes an "--input" and "--ouput" target file and
formats it.
This is intended to be useful on windows where the
configure/ghc-toolchain target files can't be diffed very easily because
the path separators are different.
- - - - -
cbba91e5 by Matthew Pickering at 2023-08-09T12:07:58+01:00
ghc-toolchain: Bump ci-images commit to get new ghc-wasm-meta
We needed to remove -Wno-unused-command-line-argument from the arguments
passed in order for the configure check to report correctly.
See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10976#note_516335
- - - - -
b5ca80ac by Matthew Pickering at 2023-08-09T12:07:58+01:00
configure: MergeObjsCmd - distinguish between empty string and unset variable
If `MergeObjsCmd` is explicitly set to the empty string then we should
assume that MergeObjs is just not supported.
This is especially important for windows where we set MergeObjsCmd to ""
in m4/fp_setup_windows_toolchain.m4.
- - - - -
94aaac59 by Matthew Pickering at 2023-08-09T12:07:58+01:00
configure: Add proper check to see if object merging works
- - - - -
90316a02 by Matthew Pickering at 2023-08-09T12:07:58+01:00
ghc-toolchain: If MergeObjsCmd is not set, replace setting with Nothing
If the user explicitly chooses to not set a MergeObjsCmd then it is
correct to use Nothing for tgtMergeObjs field in the Target file.
- - - - -
0ec261f6 by Matthew Pickering at 2023-08-09T12:07:58+01:00
HsCppArgs: Augment the HsCppOptions
This is important when we pass -I when setting up the windows toolchain.
- - - - -
f40fa8f8 by Matthew Pickering at 2023-08-09T12:07:58+01:00
Set USER_CPP_ARGS when setting up windows toolchain
- - - - -
bf551e6f by Rodrigo Mesquita at 2023-08-09T12:07:58+01:00
Improve handling of Cc as a fallback
- - - - -
95701544 by Rodrigo Mesquita at 2023-08-09T12:07:58+01:00
ghc-toolchain: Configure Cpp and HsCpp correctly when user specifies flags
In ghc-toolchain, we were only /not/ configuring required flags when the
user specified any flags at all for the of the HsCpp and Cpp tools.
Otherwise, the linker takes into consideration the user specified flags
to determine whether to search for a better linker implementation, but
already configured the remaining GHC and platform-specific flags
regardless of the user options.
Other Tools consider the user options as a baseline for further
configuration (see `findProgram`), so #23689 is not applicable.
Closes #23689
- - - - -
1e68d6c8 by Matthew Pickering at 2023-08-09T12:07:58+01:00
CPP_ARGS: Put new options after user specified options
This matches up with the behaviour of ghc-toolchain, so that the output
of both matches.
- - - - -
80c28c20 by Matthew Pickering at 2023-08-09T12:07:58+01:00
HACK: remove dependency on hadrian-ghci job
- - - - -
0e16004b by Matthew Pickering at 2023-08-09T12:07:59+01:00
Print invocation
- - - - -
30 changed files:
- .gitlab-ci.yml
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/HsToCore/Errors/Ppr.hs
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/JS/Make.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/StgToJS/Expr.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Types/Error.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Unit/Module/Warnings.hs
- compiler/GHC/Utils/Binary.hs
- configure.ac
- distrib/configure.ac.in
- hadrian/cfg/default.target.in
- hadrian/src/Packages.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Warnings.hs
- libraries/base/System/Posix/Internals.hs
- libraries/base/Text/Read/Lex.hs
- libraries/base/aclocal.m4
- libraries/base/changelog.md
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eec5f14ea8c04d8997d6afe13f1019a18be451bd...0e16004b92166ad0f7003b868c4133299a72c7c1
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/eec5f14ea8c04d8997d6afe13f1019a18be451bd...0e16004b92166ad0f7003b868c4133299a72c7c1
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230809/6d762bed/attachment-0001.html>
More information about the ghc-commits
mailing list