diff --git a/.envrc b/.envrc new file mode 100644 index 00000000000..665d43906d7 --- /dev/null +++ b/.envrc @@ -0,0 +1,7 @@ +# Check if nix-direnv is already loaded; if not, source it +if ! has nix_direnv_reload; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.0/direnvrc" "sha256-+IuxtJIDzJIlHDAxyzr7M2S3FD +zSd/BNfZe+ntXje0=" +fi + +# Use the specified flake to enter the Nix development environment +use flake github:input-output-hk/devx#ghc98-minimal-ghc \ No newline at end of file diff --git a/.github/workflows/ci-cabal-install.yml b/.github/workflows/ci-cabal-install.yml new file mode 100644 index 00000000000..313d7aa5dbb --- /dev/null +++ b/.github/workflows/ci-cabal-install.yml @@ -0,0 +1,120 @@ +name: CI mostly cabal-install + +# Trigger the workflow on push or pull request, but only for the master branch +on: + pull_request: + types: + - opened + - synchronize + push: + branches: + - master + +jobs: + cabal: + name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + ghc: + - '9.8.4' # bootstrapping compiler + + steps: + - uses: actions/checkout@v4 + with: + submodules: "recursive" + + - id: ghc-path + name: Set GHC install directory + run: | + DIR=${{ github.workspace }}/ghc-${{ matrix.ghc }} + echo "path=$DIR" >> $GITHUB_OUTPUT + echo "$DIR/bin" >> $GITHUB_PATH + + - id: cache-ghc + name: Restore bootstrap compiler + uses: actions/cache/restore@v4 + with: + key: ${{ matrix.os }}-ghc-${{ matrix.ghc }} + path: ${{ steps.ghc-path.outputs.path }} + + - if: steps.cache-ghc.outputs.cache-hit != 'true' + name: Install ghcup + uses: haskell/ghcup-setup@v1 + + - if: steps.cache-ghc.outputs.cache-hit != 'true' + name: Install bootstrap compiler + run: | + ghcup install ghc ${{ matrix.ghc }} --isolate ${{ steps.ghc-path.output.path }} + ghcup install cabal latest --isolate ${{ steps.ghc-path.outputs.path }}/bin + + - id: cabal-paths + run: | + cabal user-config init + echo "store=$(cabal path --store-dir)" >> $GITHUB_OUTPUT + echo "remote-repo-cache=$(cabal path --remote-repo-cache)" >> $GITHUB_OUTPUT + + - name: Restore Hackage index and source packages + uses: actions/cache/restore@v4 + with: + key: hackage-${{ github.run_id }} + restore-keys: hackage- + path: ${{ steps.cabal-paths.outputs.remote-repo-cache }} + + - name: Restore cabal store + uses: actions/cache/restore@v4 + with: + key: store-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }} + restore-keys: store-${{ matrix.os }}-${{ matrix.ghc }}- + path: ${{ steps.cabal-paths.outputs.store }} + + - name: Restore build artifacts + uses: actions/cache/restore@v4 + with: + key: build-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }} + restore-keys: build-${{ matrix.os }}-${{ matrix.ghc }}- + path: _build _stage0 _stage1 _stage1-rts _stage1-boot + + - name: Update Hackage index + run: cabal update + + - name: Build + run: make + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: stage1 + path: _stage1 + + - name: Save build artifacts + uses: actions/cache/save@v4 + if: always() + with: + key: build-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }} + path: _build _stage0 _stage1 _stage1-rts _stage1-boot + + - name: Save cabal store + uses: actions/cache/save@v4 + if: always() + with: + key: store-${{ matrix.os }}-${{ matrix.ghc }}-${{ github.run_id }} + path: ${{ steps.cabal-paths.outputs.store }} + + - name: Save Hackage index and source packages + uses: actions/cache/save@v4 + if: always() + with: + key: hackage-${{ github.run_id }} + path: ${{ steps.cabal-paths.outputs.remote-repo-cache }} + + - name: Save bootstrap compiler + uses: actions/cache/save@v4 + if: steps.cache-ghc.outputs.cache-hit != 'true' + with: + key: ${{ matrix.os }}-ghc-${{ matrix.ghc }} + path: ${{ steps.ghc-path.outputs.path }} + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 0c8875257dc..00000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: CI - -# Trigger the workflow on push or pull request, but only for the master branch -on: - pull_request: - types: - - opened - - synchronize - push: - branches: [master] - -jobs: - cabal: - name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - ghc: ['9.8.4'] # bootstrapping compiler - - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - - uses: haskell-actions/setup@v2 - id: setup - name: Setup Haskell tools - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: "latest" - cabal-update: true - - - name: Configure the build - run: ./boot - - - name: Build patched cabal - run: make cabal - - - name: Build the bindist - env: - CC: gcc - CXX: g++ - run: make - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: bindist - path: _build/bindist - - - name: Run the testsuite - run: make test - - - name: Upload test results - uses: actions/upload-artifact@v4 - if: ${{ !cancelled() }} # upload test results even if the testsuite failed to pass - with: - name: testsuite-results - path: | - _build/test-perf.csv - _build/test-summary.txt - _build/test-junit.xml diff --git a/.github/workflows/nix-based.yml b/.github/workflows/nix-based.yml new file mode 100644 index 00000000000..d6329800bcf --- /dev/null +++ b/.github/workflows/nix-based.yml @@ -0,0 +1,48 @@ +name: CI (with nix) + +# Trigger the workflow on push or pull request, but only for the master branch +on: + pull_request: + types: + - opened + - synchronize + push: + branches: [master] + +defaults: + run: + shell: devx {0} + +jobs: + cabal: + name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + ghc: + - ghc98 # bootstrapping compiler + + steps: + - uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Build + uses: input-output-hk/actions/devx@latest + with: + platform: ${{ matrix.os == 'ubuntu-latest' && 'x86_64-linux' || 'aarch64-darwin' }} + compiler-nix-name: ${{ matrix.ghc }} + minimal: true + ghc: true + + - run: cabal update + + - name: Build stage1 + run: make stage1 + + - name: Build stage1-rts + run: make stage1-rts diff --git a/.gitignore b/.gitignore index a96f6c05bb1..efaf03e6306 100644 --- a/.gitignore +++ b/.gitignore @@ -116,8 +116,6 @@ _darcs/ /compiler/MachRegs.h /compiler/MachRegs /compiler/GHC/CmmToLlvm/Version/Bounds.hs -/compiler/ghc.cabal -/compiler/ghc.cabal.old /distrib/configure.ac /distrib/ghc.iss /docs/index.html @@ -138,7 +136,6 @@ _darcs/ /docs/users_guide/utils.pyc /driver/ghci/ghc-pkg-inplace /driver/ghci/ghci-inplace -/driver/ghci/ghci-wrapper.cabal /driver/ghci/ghci.res /driver/ghci/cwrapper.c /driver/ghci/cwrapper.h @@ -150,7 +147,6 @@ _darcs/ /driver/package.conf.inplace.old /settings /ghc.spec -/ghc/ghc-bin.cabal /index.html /inplace/ /libffi/build/ @@ -165,29 +161,19 @@ _darcs/ /libraries/doc-index*.html /libraries/frames.html /libraries/ghc-boot/GNUmakefile -/libraries/ghc-boot/ghc-boot.cabal /libraries/ghc-boot-th/GNUmakefile -/libraries/ghc-boot-th/ghc-boot-th.cabal -/libraries/ghc-boot-th-next/ghc-boot-th-next.cabal /libraries/ghc-boot-th/ghc.mk -/libraries/ghc-heap/ghc-heap.cabal -/libraries/ghc-internal/ghc-internal.cabal -/libraries/ghc-experimental/ghc-experimental.cabal -/libraries/base/base.cabal /libraries/ghci/GNUmakefile -/libraries/ghci/ghci.cabal /libraries/ghci/ghc.mk /libraries/haddock-util.js /libraries/hslogo-16.png /libraries/index-frames.html /libraries/index.html -/libraries/libiserv/libiserv.cabal /libraries/minus.gif /libraries/ocean.css /libraries/plus.gif /libraries/synopsis.png /libraries/stamp/ -/libraries/template-haskell/template-haskell.cabal /linter.log /mk/are-validating.mk /mk/build.mk @@ -202,13 +188,6 @@ _darcs/ /testsuite_summary*.txt /testsuite*.xml /testlog* -/utils/iserv/iserv.cabal -/utils/iserv-proxy/iserv-proxy.cabal -/utils/remote-iserv/remote-iserv.cabal -/utils/mkUserGuidePart/mkUserGuidePart.cabal -/utils/runghc/runghc.cabal -/utils/gen-dll/gen-dll.cabal -/utils/ghc-pkg/ghc-pkg.cabal utils/unlit/fs.* libraries/ghc-internal/include/fs.h libraries/ghc-internal/cbits/fs.c diff --git a/.gitmodules b/.gitmodules index 9c72ac9d884..349bb6cd7e9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -103,15 +103,20 @@ [submodule "gmp-tarballs"] path = libraries/ghc-internal/gmp/gmp-tarballs url = https://gitlab.haskell.org/ghc/gmp-tarballs.git + ignore = untracked [submodule "libraries/exceptions"] path = libraries/exceptions url = https://gitlab.haskell.org/ghc/packages/exceptions.git + ignore = untracked [submodule "utils/hpc"] path = utils/hpc url = https://gitlab.haskell.org/hpc/hpc-bin.git + ignore = untracked [submodule "libraries/os-string"] path = libraries/os-string - url = https://gitlab.haskell.org/ghc/packages/os-string + url = https://gitlab.haskell.org/ghc/packages/os-string.git + ignore = untracked [submodule "libraries/file-io"] path = libraries/file-io url = https://gitlab.haskell.org/ghc/packages/file-io.git + ignore = untracked diff --git a/Build.hs b/Build.hs index 694f67abb01..c2dfa6a95a1 100755 --- a/Build.hs +++ b/Build.hs @@ -129,7 +129,7 @@ buildGhcStage2 = buildGhcStage False buildGhcStage :: Bool -> GhcBuildOptions -> Cabal -> Ghc -> FilePath -> IO () buildGhcStage booting opts cabal ghc0 dst = do let src = dst </> "src" - prepareGhcSources opts src + prepareGhcSources src msg " - Building GHC and utility programs..." @@ -173,6 +173,8 @@ buildGhcStage booting opts cabal ghc0 dst = do , " " ++ src </> "libraries/ghci" , " " ++ src </> "libraries/os-string/" , " " ++ src </> "libraries/process/" + , " " ++ src </> "libraries/rts-fs/" + , " " ++ src </> "libraries/rts-headers/" , " " ++ src </> "libraries/semaphore-compat" , " " ++ src </> "libraries/time" , " " ++ src </> "libraries/unix/" @@ -354,8 +356,8 @@ buildGhcStage booting opts cabal ghc0 dst = do -- | Prepare GHC sources in the given directory -prepareGhcSources :: GhcBuildOptions -> FilePath -> IO () -prepareGhcSources opts dst = do +prepareGhcSources :: FilePath -> IO () +prepareGhcSources dst = do msg $ " - Preparing sources in " ++ dst ++ "..." createDirectoryIfMissing True dst createDirectoryIfMissing True (dst </> "libraries/ghc/MachRegs") @@ -363,93 +365,22 @@ prepareGhcSources opts dst = do cp "./libraries" dst cp "./compiler/*" (dst </> "libraries/ghc/") cp "./rts" (dst </> "libraries/") + cp "./rts-fs" (dst </> "libraries/") + cp "./rts-headers" (dst </> "libraries/") cp "./ghc" (dst </> "ghc-bin") cp "./utils" dst cp "./config.sub" (dst </> "libraries/rts/") cp "./config.guess" (dst </> "libraries/rts/") - -- These needs to shared - cp "rts/include/rts/Bytecodes.h" (dst </> "libraries/ghc/") - cp "rts/include/rts/storage/ClosureTypes.h" (dst </> "libraries/ghc/") - cp "rts/include/rts/storage/FunTypes.h" (dst </> "libraries/ghc/") - cp "rts/include/stg/MachRegs.h" (dst </> "libraries/ghc/") - cp "rts/include/stg/MachRegs/*.h" (dst </> "libraries/ghc/MachRegs/") - - -- shared among ghc-internal rts and unlit - cp "utils/fs/fs.h" (dst </> "libraries/ghc-internal/include") - cp "utils/fs/fs.c" (dst </> "libraries/ghc-internal/cbits") - cp "utils/fs/fs.*" (dst </> "libraries/rts/") - cp "utils/fs/fs.*" (dst </> "utils/unlit/") - - python <- findExecutable "python" >>= \case - Nothing -> error "Couldn't find 'python'" - Just r -> pure r - - void $ readCreateProcess (proc python - [ "rts/gen_event_types.py" - , "--event-types-defines" - , dst </> "libraries/rts/include/rts/EventLogConstants.h" - ]) "" - - void $ readCreateProcess (proc python - [ "rts/gen_event_types.py" - , "--event-types-array" - , dst </> "libraries/rts/include/rts/EventTypes.h" - ]) "" - - -- substitute variables in files - let subst fin fout rs = do - t <- Text.readFile fin - Text.writeFile fout (List.foldl' (\v (needle,rep) -> Text.replace needle rep v) t rs) - let subst_in f = subst (f <.> "in") f - let common_substs = - [ (,) "@ProjectVersion@" (gboVersion opts) - , (,) "@ProjectVersionMunged@" (gboVersionMunged opts) - , (,) "@ProjectVersionForLib@" (gboVersionForLib opts) - , (,) "@ProjectPatchLevel1@" (gboVersionPatchLevel1 opts) - , (,) "@ProjectPatchLevel2@" (gboVersionPatchLevel2 opts) - , (,) "@ProjectVersionInt@" (gboVersionInt opts) - ] - llvm_substs = - [ (,) "@LlvmMinVersion@" (gboLlvmMinVersion opts) - , (,) "@LlvmMaxVersion@" (gboLlvmMaxVersion opts) - ] - boot_th_substs = - [ (,) "@Suffix@" "" - , (,) "@SourceRoot@" "." - ] - - subst_in (dst </> "ghc-bin/ghc-bin.cabal") common_substs - subst_in (dst </> "libraries/ghc/ghc.cabal") common_substs - subst_in (dst </> "libraries/ghc-boot/ghc-boot.cabal") common_substs - subst_in (dst </> "libraries/ghc-boot-th/ghc-boot-th.cabal") (common_substs ++ boot_th_substs) - subst_in (dst </> "libraries/ghc-heap/ghc-heap.cabal") common_substs - subst_in (dst </> "libraries/template-haskell/template-haskell.cabal") common_substs - subst_in (dst </> "libraries/ghci/ghci.cabal") common_substs - - -- This is only used for a warning message. Nuke the check! - subst_in (dst </> "libraries/ghc/GHC/CmmToLlvm/Version/Bounds.hs") llvm_substs - - subst_in (dst </> "utils/ghc-pkg/ghc-pkg.cabal") common_substs - subst_in (dst </> "utils/iserv/iserv.cabal") common_substs - subst_in (dst </> "utils/runghc/runghc.cabal") common_substs - - subst_in (dst </> "libraries/ghc-internal/ghc-internal.cabal") common_substs - subst_in (dst </> "libraries/ghc-experimental/ghc-experimental.cabal") common_substs - subst_in (dst </> "libraries/base/base.cabal") common_substs - subst_in (dst </> "libraries/rts/include/ghcversion.h") common_substs - - buildBootLibraries :: Cabal -> Ghc -> GhcPkg -> DeriveConstants -> GenApply -> GenPrimop -> GhcBuildOptions -> FilePath -> IO () buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts dst = do src <- makeAbsolute (dst </> "src") - prepareGhcSources opts src + prepareGhcSources src -- Build the RTS src_rts <- makeAbsolute (src </> "libraries/rts") build_dir <- makeAbsolute (dst </> "cabal") - ghcversionh <- makeAbsolute (src_rts </> "include/ghcversion.h") -- FIXME: could we build a cross compiler, simply by not reading this from the boot compiler, but passing it in? target_triple <- ghcTargetTriple ghc @@ -507,6 +438,8 @@ buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts dst , "" , "packages:" , " " ++ src </> "libraries/rts" + , " " ++ src </> "libraries/rts-fs" + , " " ++ src </> "libraries/rts-headers" , "" , "benchmarks: False" , "tests: False" @@ -528,7 +461,6 @@ buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts dst , "rts" , "--with-compiler=" ++ ghcPath ghc , "--with-hc-pkg=" ++ ghcPkgPath ghcpkg - , "--ghc-options=\"-ghcversion-file=" ++ ghcversionh ++ "\"" , "--builddir=" ++ build_dir ] @@ -695,7 +627,6 @@ buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts dst , "--project-file=" ++ cabal_project_bootlibs_path , "--with-compiler=" ++ ghcPath ghc , "--with-hc-pkg=" ++ ghcPkgPath ghcpkg - , "--ghc-options=\"-ghcversion-file=" ++ ghcversionh ++ "\"" , "--builddir=" ++ build_dir , "-j" diff --git a/HADRIAN_SETTINGS b/HADRIAN_SETTINGS new file mode 100644 index 00000000000..5256177d6c0 --- /dev/null +++ b/HADRIAN_SETTINGS @@ -0,0 +1,9 @@ +[ ("hostPlatformArch", "ArchAArch64") +, ("hostPlatformOS", "OSDarwin") +, ("cProjectGitCommitId", "0000000000000000000000000000000000000000") +, ("cProjectVersion", "9.13") +, ("cProjectVersionInt", "913") +, ("cProjectPatchLevel", "0") +, ("cProjectPatchLevel1", "0") +, ("cProjectPatchLevel2", "0") +] \ No newline at end of file diff --git a/Makefile b/Makefile index d07edfae6fe..5560f1fc869 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,84 @@ -export CABAL := $(shell cabal update 2>&1 >/dev/null && cabal list-bin -v0 --project-dir libraries/Cabal cabal-install:exe:cabal) +SHELL := bash +.ONESHELL: +.SHELLFLAGS := -eu -o pipefail -c +.DELETE_ON_ERROR: +MAKEFLAGS += --warn-undefined-variables --no-builtin-rules -CPUS=$(shell mk/detect-cpu-count.sh) +# Default target +all: stage2 -# Use CPU cores + 1 if not already set -THREADS=${THREADS:-$((CPUS + 1))} +CABAL ?= cabal +GHC0 ?= ghc -all: $(CABAL) ./booted - GHC=ghc-9.8.4 ./Build.hs +define LIB = +BOLD_RED='\033[1;31m' +RESET='\033[0m' -cabal: $(CABAL) +log() { + echo -e "$${BOLD_RED}+$${RESET} $$@" >&2 + "$$@" +} +endef -$(CABAL): - cabal build --project-dir libraries/Cabal cabal-install:exe:cabal +%/configure : %/configure.ac + @$(LIB) + log autoreconf $(@D) -./booted: - ./boot - touch $@ +CABAL_FLAGS += --store-dir $(abspath _build/store) --logs-dir $(abspath _build/logs) -j --ghc-option=-fhide-source-paths --ghc-option=-j +CABAL_BUILD_FLAGS += --builddir $(abspath _build/build) --with-compiler $(GHC) --with-hc-pkg $(GHC)-pkg --with-build-compiler $(GHC0) --with-build-hc-pkg $(GHC0)-pkg +CABAL_INSTALL_FLAGS += --installdir $(OUT)/bin --overwrite-policy=always --install-method=copy --write-ghc-environment-files=never +CABAL_BUILD = $(CABAL) $(CABAL_FLAGS) build $(CABAL_BUILD_FLAGS) +CABAL_INSTALL = $(CABAL) $(CABAL_FLAGS) install $(CABAL_BUILD_FLAGS) $(CABAL_INSTALL_FLAGS) + +STAGE1_EXE = ghc ghc-pkg ghc-toolchain-bin +STAGE1_BIN = $(addprefix _stage1/bin/,$(STAGE1_EXE)) + +STAGE2_EXE = ghc ghc-pkg +STAGE2_BIN = $(addprefix _stage2/bin/,$(STAGE2_EXE)) + +TARGET := $(shell cc -dumpmachine) + +# Stage 1 +$(STAGE1_BIN) &: OUT ?= $(abspath _stage1) +$(STAGE1_BIN) &: override GHC=$(GHC0) +$(STAGE1_BIN) &: + @$(LIB) + log mkdir -p $(@D) + log export HADRIAN_SETTINGS="$$(cat ./HADRIAN_SETTINGS)" + log $(CABAL_INSTALL) --project-file cabal.project.stage1 $(addprefix exe:,$(STAGE1_EXE)) + +%/settings: _stage1/bin/ghc-toolchain-bin + @$(LIB) + mkdir -p $(@D) + log _stage1/bin/ghc-toolchain-bin --cc=cc --cxx=c++ --install-name-tool=install_name_tool --otool=otool --output-settings -t $(TARGET) -o $@ + +_stage1/lib/package.conf.d: + @$(LIB) + mkdir -p _stage1/lib _stage2/lib + log _stage1/bin/ghc-pkg init $(abspath _build/store)/$$(_stage1/bin/ghc --info | grep "Project Unit Id" | cut -d'"' -f4)/package.db + log ln -sf $(abspath _build/store)/$$(_stage1/bin/ghc --info | grep "Project Unit Id" | cut -d'"' -f4)/package.db _stage1/lib/package.conf.d + log ln -sf $(abspath _build/store)/$$(_stage1/bin/ghc --info | grep "Project Unit Id" | cut -d'"' -f4)/package.db _stage2/lib/package.conf.d + +stage1: $(STAGE1_BIN) _stage1/lib/settings _stage1/lib/package.conf.d + +# Stage 2 +$(STAGE2_BIN) &: OUT ?= $(abspath _stage2) +$(STAGE2_BIN) &: GHC = $(abspath _stage1/bin/ghc) +$(STAGE2_BIN) &: GHC0 = $(shell which ghc) +$(STAGE2_BIN) &: _stage1/bin/ghc _stage1/lib/settings rts/configure libraries/ghc-internal/configure _stage1/lib/package.conf.d + @$(LIB) + log mkdir -p $(@D) + log export HADRIAN_SETTINGS="$$(cat ./HADRIAN_SETTINGS)" + log $(CABAL_INSTALL) --package-db=$(abspath _stage1/lib/package.conf.d) --project-file cabal.project.stage2 $(addprefix exe:,$(STAGE2_EXE)) + +stage2: stage1 _stage2/lib/settings $(STAGE2_BIN) + +# Clean up clean: - rm -f ./booted - rm -rf _build - -test: all - echo "using THREADS=${THREADS}" >&2 - TEST_HC=`pwd`/_build/bindist/bin/ghc \ - METRICS_FILE=`pwd`/_build/test-perf.csv \ - SUMMARY_FILE=`pwd`/_build/test-summary.txt \ - JUNIT_FILE=`pwd`/_build/test-junit.xml \ - make -C testsuite/tests test THREADS=${THREADS} + rm -rf _stage1 _stage2 + +# Usage instructions +# 1. make clean +# 2. make stage1 +# 3. make stage2 \ No newline at end of file diff --git a/boot b/boot deleted file mode 100755 index c73ed3a430b..00000000000 --- a/boot +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python3 - -import glob -import os -import os.path -import sys -from textwrap import dedent -import subprocess -import re -import shutil - -# Packages whose libraries aren't in the submodule root -EXCEPTIONS = { - 'libraries/containers/': 'libraries/containers/containers/' -} - -def print_err(s): - print(dedent(s), file=sys.stderr) - -def die(mesg): - print_err(mesg) - sys.exit(1) - -def check_boot_packages(): - # Check that we have all boot packages. - for l in open('packages', 'r'): - if l.startswith('#'): - continue - - parts = [part for part in l.split(' ') if part] - if len(parts) != 4: - die("Error: Bad line in packages file: " + l) - - dir_ = parts[0] - tag = parts[1] - - # If tag is not "-" then it is an optional repository, so its - # absence isn't an error. - if tag == '-': - # We would like to just check for a .git directory here, - # but in an lndir tree we avoid making .git directories, - # so it doesn't exist. We therefore require that every repo - # has a LICENSE file instead. - license_path = os.path.join(EXCEPTIONS.get(dir_+'/', dir_), 'LICENSE') - if not os.path.isfile(license_path): - die("""\ - Error: %s doesn't exist - Maybe you haven't run 'git submodule update --init'? - """ % license_path) - -def autoreconf(): - # Run autoreconf on everything that needs it. - processes = {} - if os.name == 'nt': - # Get the normalized ACLOCAL_PATH for Windows - # This is necessary since on Windows this will be a Windows - # path, which autoreconf doesn't know doesn't know how to handle. - ac_local = os.getenv('ACLOCAL_PATH', '') - ac_local_arg = re.sub(r';', r':', ac_local) - ac_local_arg = re.sub(r'\\', r'/', ac_local_arg) - ac_local_arg = re.sub(r'(\w):/', r'/\1/', ac_local_arg) - reconf_cmd = 'ACLOCAL_PATH=%s autoreconf' % ac_local_arg - else: - reconf_cmd = 'autoreconf' - - for dir_ in ['.', 'rts'] + glob.glob('libraries/*/'): - if os.path.isfile(os.path.join(dir_, 'configure.ac')): - print("Booting %s" % dir_) - processes[dir_] = subprocess.Popen(['sh', '-c', reconf_cmd], cwd=dir_) - - # Wait for all child processes to finish. - fail = False - for k,v in processes.items(): - code = v.wait() - if code != 0: - print_err('autoreconf in %s failed with exit code %d' % (k, code)) - fail = True - - if fail: - sys.exit(1) - -check_boot_packages() -autoreconf() diff --git a/cabal.project.stage1 b/cabal.project.stage1 new file mode 100644 index 00000000000..20a3691723d --- /dev/null +++ b/cabal.project.stage1 @@ -0,0 +1,62 @@ +packages: + ./compiler + ./ghc + ./rts-headers + ./rts-fs + https://hackage.haskell.org/package/directory-1.3.9.0/directory-1.3.9.0.tar.gz + ./libraries/file-io + ./libraries/filepath + ./libraries/ghc-platform + ./libraries/ghc-boot + ./libraries/ghc-boot-th + ./libraries/ghc-heap + ./libraries/ghci + https://hackage.haskell.org/package/os-string-2.0.7/os-string-2.0.7.tar.gz + https://hackage.haskell.org/package/process-1.6.25.0/process-1.6.25.0.tar.gz + ./libraries/semaphore-compat + https://hackage.haskell.org/package/time-1.14/time-1.14.tar.gz + https://hackage.haskell.org/package/unix-2.8.6.0/unix-2.8.6.0.tar.gz + ./libraries/Win32 + ./utils/ghc-pkg + ./utils/hsc2hs + ./utils/unlit + ./utils/genprimopcode + ./utils/genapply + ./utils/deriveConstants + ./utils/ghc-toolchain + ./utils/ghc-toolchain/exe + -- we need these here, as we'll need them for the setup.hs for the RTS, and + -- other packages. Once Cabal upstream is recent enough, we can drop them. + ./libraries/Cabal/Cabal + ./libraries/Cabal/Cabal-syntax + ./libraries/Cabal/Cabal-hooks + +benchmarks: False +tests: False +profiling: False + +allow-boot-library-installs: True + +package * + library-vanilla: True + shared: True + -- executable-profiling: False + -- executable-dynamic: False + -- executable-static: True + +package ghc-boot-th + flags: +bootstrap + +package hsc2hs + -- FIXME: What's this for? + flags: +in-ghc-tree + +-- allow template-haskell with newer ghc-boot-th +allow-newer: ghc-boot-th + +constraints: +-- FIXME: template-haskell 2.23 is too recent when booting with 9.8.4 + template-haskell <= 2.22 + +package * + ghc-options: -fhide-source-paths -j diff --git a/cabal.project.stage2 b/cabal.project.stage2 new file mode 100644 index 00000000000..8f048962834 --- /dev/null +++ b/cabal.project.stage2 @@ -0,0 +1,114 @@ +allow-boot-library-installs: True +active-repositories: :none + +benchmarks: False +tests: False + +build-packages: + https://hackage.haskell.org/package/alex-3.5.2.0/alex-3.5.2.0.tar.gz + https://hackage.haskell.org/package/happy-2.1.5/happy-2.1.5.tar.gz + https://hackage.haskell.org/package/happy-lib-2.1.5/happy-lib-2.1.5.tar.gz + ./utils/deriveConstants + ./utils/genprimopcode + ./utils/genapply + +packages: + ./compiler + ./ghc + ./libraries/array + ./libraries/base + ./libraries/binary + ./libraries/bytestring + ./libraries/Cabal/Cabal + ./libraries/Cabal/Cabal-syntax + ./libraries/containers/containers + ./libraries/deepseq + ./libraries/directory + ./libraries/exceptions + ./libraries/file-io + ./libraries/filepath + ./libraries/ghc-bignum + ./libraries/ghc-boot + ./libraries/ghc-boot-th + ./libraries/ghc-compact + ./libraries/ghc-experimental + ./libraries/ghc-heap + ./libraries/ghci + ./libraries/ghc-internal + ./libraries/ghc-platform + ./libraries/ghc-prim + ./libraries/haskeline + ./libraries/hpc + ./libraries/integer-gmp + ./libraries/mtl + ./libraries/os-string + ./libraries/parsec + ./libraries/pretty + ./libraries/process + ./libraries/semaphore-compat + ./libraries/stm + -- ./libraries/system-cxx-std-lib + ./libraries/template-haskell + ./libraries/terminfo + ./libraries/text + ./libraries/time + ./libraries/transformers + ./libraries/unix + ./libraries/Win32 + ./libraries/xhtml + ./utils/ghc-pkg + ./utils/ghc-toolchain + ./utils/hsc2hs + ./utils/unlit + -- https://hackage.haskell.org/package/alex-3.5.2.0/alex-3.5.2.0.tar.gz + -- https://hackage.haskell.org/package/happy-2.1.5/happy-2.1.5.tar.gz + -- https://hackage.haskell.org/package/happy-lib-2.1.5/happy-lib-2.1.5.tar.gz + -- https://hackage.haskell.org/package/os-string-2.0.7/os-string-2.0.7.tar.gz + -- https://hackage.haskell.org/package/process-1.6.25.0/process-1.6.25.0.tar.gz + -- https://hackage.haskell.org/package/time-1.14/time-1.14.tar.gz + -- https://hackage.haskell.org/package/unix-2.8.6.0/unix-2.8.6.0.tar.gz + rts + rts-fs + rts-headers + +-- When building the rts{-headers,-fs} we do not have the ghcversion.h yet. +-- We basically have a bare ghc with no packages yet. To avoid the forced +-- need of ghcversion.h, we pass -no-ghcversion-header to ghc, to prevent it +-- from trying to pass `-include ghcversion.h`. + +package rts-headers + ghc-options: -no-ghcversion-header + +package rts-fs + ghc-options: -no-ghcversion-header + +package rts + flags: +table-next-to-code +leading-underscore + ghc-options: -no-ghcversion-header + +package hsc2hs + flags: +in-ghc-tree + +package ghc + -- internal-interpreter: otherwise our compiler has the internal + -- interpreter but not the boot library we install + -- FIXME: we should really install the lib we used to build stage2 + flags: +internal-interpreter + +package ghci + flags: +internal-interpreter + +package ghc-internal + -- FIXME: make our life easier for now by using the native bignum backend + flags: +bignum-native + +package ghc-bin + -- FIXME: we don't have the threaded RTS yet. + flags: -threaded +internal-interpreter + +package text + -- FIXME: avoid having to deal with system-cxx-std-lib fake package for now + flags: -simdutf + +package * + ghc-options: -fhide-source-paths -j diff --git a/compiler/CodeGen.Platform.h b/compiler/CodeGen.Platform.h index 78a712072d5..417347c06ad 100644 --- a/compiler/CodeGen.Platform.h +++ b/compiler/CodeGen.Platform.h @@ -7,7 +7,7 @@ import GHC.Utils.Panic.Plain #endif import GHC.Platform.Reg -#include "MachRegs.h" +#include "stg/MachRegs.h" #if defined(MACHREGS_i386) || defined(MACHREGS_x86_64) diff --git a/compiler/GHC/Builtin/PrimOps.hs b/compiler/GHC/Builtin/PrimOps.hs index d4d98242759..2273d34f9c3 100644 --- a/compiler/GHC/Builtin/PrimOps.hs +++ b/compiler/GHC/Builtin/PrimOps.hs @@ -25,7 +25,9 @@ module GHC.Builtin.PrimOps ( getPrimOpResultInfo, isComparisonPrimOp, PrimOpResultInfo(..), - PrimCall(..) + PrimCall(..), + + primOpPrimModule, primOpWrappersModule ) where import GHC.Prelude @@ -171,6 +173,12 @@ primOpDocs :: [(FastString, String)] primOpDeprecations :: [(OccName, FastString)] #include "primop-deprecations.hs-incl" +primOpPrimModule :: String +#include "primop-prim-module.hs-incl" + +primOpWrappersModule :: String +#include "primop-wrappers-module.hs-incl" + {- ************************************************************************ * * diff --git a/compiler/GHC/ByteCode/Asm.hs b/compiler/GHC/ByteCode/Asm.hs index 237919058f7..36f20125f59 100644 --- a/compiler/GHC/ByteCode/Asm.hs +++ b/compiler/GHC/ByteCode/Asm.hs @@ -365,7 +365,7 @@ inspectAsm platform long_jumps initial_offset count (IOp _) = if largeOps then largeArg16s platform else 1 -- Bring in all the bci_ bytecode constants. -#include "Bytecodes.h" +#include "rts/Bytecodes.h" largeArgInstr :: Word16 -> Word16 largeArgInstr bci = bci_FLAG_LARGE_ARGS .|. bci diff --git a/compiler/GHC/CmmToLlvm.hs b/compiler/GHC/CmmToLlvm.hs index 72a3161dec3..b85d620433b 100644 --- a/compiler/GHC/CmmToLlvm.hs +++ b/compiler/GHC/CmmToLlvm.hs @@ -38,8 +38,8 @@ import GHC.Utils.Panic import GHC.Utils.Logger import qualified GHC.Data.Stream as Stream -import Control.Monad ( when, forM_ ) -import Data.Maybe ( fromMaybe, catMaybes, isNothing ) +import Control.Monad ( forM_ ) +import Data.Maybe ( catMaybes ) import System.IO -- ----------------------------------------------------------------------------- @@ -57,36 +57,8 @@ llvmCodeGen logger cfg h dus cmm_stream -- Pass header showPass logger "LLVM CodeGen" - -- get llvm version, cache for later use - let mb_ver = llvmCgLlvmVersion cfg - - -- warn if unsupported - forM_ mb_ver $ \ver -> do - debugTraceMsg logger 2 - (text "Using LLVM version:" <+> text (llvmVersionStr ver)) - let doWarn = llvmCgDoWarn cfg - when (not (llvmVersionSupported ver) && doWarn) $ putMsg logger $ - "You are using an unsupported version of LLVM!" $$ - "Currently only" <+> text (llvmVersionStr supportedLlvmVersionLowerBound) <+> - "up to" <+> text (llvmVersionStr supportedLlvmVersionUpperBound) <+> "(non inclusive) is supported." <+> - "System LLVM version: " <> text (llvmVersionStr ver) $$ - "We will try though..." - - when (isNothing mb_ver) $ do - let doWarn = llvmCgDoWarn cfg - when doWarn $ putMsg logger $ - "Failed to detect LLVM version!" $$ - "Make sure LLVM is installed correctly." $$ - "We will try though..." - - -- HACK: the Nothing case here is potentially wrong here but we - -- currently don't use the LLVM version to guide code generation - -- so this is okay. - let llvm_ver :: LlvmVersion - llvm_ver = fromMaybe supportedLlvmVersionLowerBound mb_ver - -- run code generation - (a, _) <- runLlvm logger cfg llvm_ver bufh dus $ + (a, _) <- runLlvm logger cfg bufh dus $ llvmCodeGen' cfg cmm_stream bFlush bufh diff --git a/compiler/GHC/CmmToLlvm/Base.hs b/compiler/GHC/CmmToLlvm/Base.hs index 3a7abc911e2..3532de66c82 100644 --- a/compiler/GHC/CmmToLlvm/Base.hs +++ b/compiler/GHC/CmmToLlvm/Base.hs @@ -18,7 +18,7 @@ module GHC.CmmToLlvm.Base ( LlvmM, runLlvm, withClearVars, varLookup, varInsert, markStackReg, checkStackReg, - funLookup, funInsert, getLlvmVer, + funLookup, funInsert, dumpIfSetLlvm, renderLlvm, markUsedVar, getUsedVars, ghcInternalFunctions, getPlatform, getConfig, @@ -277,8 +277,7 @@ llvmPtrBits platform = widthInBits $ typeWidth $ gcWord platform -- data LlvmEnv = LlvmEnv - { envVersion :: LlvmVersion -- ^ LLVM version - , envConfig :: !LlvmCgConfig -- ^ Configuration for LLVM code gen + { envConfig :: !LlvmCgConfig -- ^ Configuration for LLVM code gen , envLogger :: !Logger -- ^ Logger , envOutput :: BufHandle -- ^ Output buffer , envTag :: !Char -- ^ Tag for creating unique values @@ -331,8 +330,8 @@ liftUDSMT m = LlvmM $ \env -> do x <- m return (x, env) -- | Get initial Llvm environment. -runLlvm :: Logger -> LlvmCgConfig -> LlvmVersion -> BufHandle -> DSM.DUniqSupply -> LlvmM a -> IO (a, DSM.DUniqSupply) -runLlvm logger cfg ver out us m = do +runLlvm :: Logger -> LlvmCgConfig -> BufHandle -> DSM.DUniqSupply -> LlvmM a -> IO (a, DSM.DUniqSupply) +runLlvm logger cfg out us m = do ((a, _), us') <- DSM.runUDSMT us $ runLlvmM m env return (a, us') where env = LlvmEnv { envFunMap = emptyUFM @@ -340,7 +339,6 @@ runLlvm logger cfg ver out us m = do , envStackRegs = [] , envUsedVars = [] , envAliases = emptyUniqSet - , envVersion = ver , envConfig = cfg , envLogger = logger , envOutput = out @@ -386,10 +384,6 @@ getMetaUniqueId :: LlvmM MetaId getMetaUniqueId = LlvmM $ \env -> return (envFreshMeta env, env { envFreshMeta = succ $ envFreshMeta env }) --- | Get the LLVM version we are generating code for -getLlvmVer :: LlvmM LlvmVersion -getLlvmVer = getEnv envVersion - -- | Dumps the document if the corresponding flag has been set by the user dumpIfSetLlvm :: DumpFlag -> String -> DumpFormat -> Outp.SDoc -> LlvmM () dumpIfSetLlvm flag hdr fmt doc = do diff --git a/compiler/GHC/CmmToLlvm/Config.hs b/compiler/GHC/CmmToLlvm/Config.hs index 1e7e04144f9..e1ef61a52a2 100644 --- a/compiler/GHC/CmmToLlvm/Config.hs +++ b/compiler/GHC/CmmToLlvm/Config.hs @@ -25,7 +25,6 @@ data LlvmCgConfig = LlvmCgConfig , llvmCgAvxEnabled :: !Bool , llvmCgBmiVersion :: Maybe BmiVersion -- ^ (x86) BMI instructions , llvmCgLlvmVersion :: Maybe LlvmVersion -- ^ version of Llvm we're using - , llvmCgDoWarn :: !Bool -- ^ True ==> warn unsupported Llvm version , llvmCgLlvmTarget :: !String -- ^ target triple passed to LLVM , llvmCgLlvmConfig :: !LlvmConfig -- ^ Supported LLVM configurations. -- see Note [LLVM configuration] diff --git a/compiler/GHC/CmmToLlvm/Version.hs b/compiler/GHC/CmmToLlvm/Version.hs index 9c3412f9316..a77977e47c4 100644 --- a/compiler/GHC/CmmToLlvm/Version.hs +++ b/compiler/GHC/CmmToLlvm/Version.hs @@ -1,9 +1,6 @@ module GHC.CmmToLlvm.Version ( LlvmVersion(..) - , supportedLlvmVersionLowerBound - , supportedLlvmVersionUpperBound , parseLlvmVersion - , llvmVersionSupported , llvmVersionStr , llvmVersionList ) @@ -12,7 +9,6 @@ where import GHC.Prelude import GHC.CmmToLlvm.Version.Type -import GHC.CmmToLlvm.Version.Bounds import Data.Char (isDigit) import Data.List (intercalate) @@ -32,10 +28,6 @@ parseLlvmVersion = where (ver_str, rest) = span isDigit s -llvmVersionSupported :: LlvmVersion -> Bool -llvmVersionSupported v = - v >= supportedLlvmVersionLowerBound && v < supportedLlvmVersionUpperBound - llvmVersionStr :: LlvmVersion -> String llvmVersionStr = intercalate "." . map show . llvmVersionList diff --git a/compiler/GHC/CmmToLlvm/Version/Bounds.hs.in b/compiler/GHC/CmmToLlvm/Version/Bounds.hs.in deleted file mode 100644 index 19f4e4d37a9..00000000000 --- a/compiler/GHC/CmmToLlvm/Version/Bounds.hs.in +++ /dev/null @@ -1,19 +0,0 @@ -module GHC.CmmToLlvm.Version.Bounds - ( supportedLlvmVersionLowerBound - , supportedLlvmVersionUpperBound - ) -where - -import GHC.Prelude () - -import GHC.CmmToLlvm.Version.Type - -import qualified Data.List.NonEmpty as NE - --- | The (inclusive) lower bound on the LLVM Version that is currently supported. -supportedLlvmVersionLowerBound :: LlvmVersion -supportedLlvmVersionLowerBound = LlvmVersion (@LlvmMinVersion@ NE.:| []) - --- | The (not-inclusive) upper bound bound on the LLVM Version that is currently supported. -supportedLlvmVersionUpperBound :: LlvmVersion -supportedLlvmVersionUpperBound = LlvmVersion (@LlvmMaxVersion@ NE.:| []) diff --git a/compiler/GHC/Driver/Config/CmmToLlvm.hs b/compiler/GHC/Driver/Config/CmmToLlvm.hs index c0a21c9cb1f..666e4342250 100644 --- a/compiler/GHC/Driver/Config/CmmToLlvm.hs +++ b/compiler/GHC/Driver/Config/CmmToLlvm.hs @@ -29,7 +29,6 @@ initLlvmCgConfig logger config_cache dflags = do ArchX86 -> bmiVersion dflags _ -> Nothing , llvmCgLlvmVersion = version - , llvmCgDoWarn = wopt Opt_WarnUnsupportedLlvmVersion dflags , llvmCgLlvmTarget = platformMisc_llvmTarget $! platformMisc dflags , llvmCgLlvmConfig = llvm_config } diff --git a/compiler/GHC/Driver/Errors/Ppr.hs b/compiler/GHC/Driver/Errors/Ppr.hs index 32977fc97f4..f414f6ca70e 100644 --- a/compiler/GHC/Driver/Errors/Ppr.hs +++ b/compiler/GHC/Driver/Errors/Ppr.hs @@ -35,7 +35,6 @@ import GHC.HsToCore.Errors.Types (DsMessage) import GHC.Iface.Errors.Types import GHC.Tc.Errors.Ppr () -- instance Diagnostic TcRnMessage import GHC.Iface.Errors.Ppr () -- instance Diagnostic IfaceMessage -import GHC.CmmToLlvm.Version (llvmVersionStr, supportedLlvmVersionLowerBound, supportedLlvmVersionUpperBound) -- -- Suggestions @@ -272,12 +271,7 @@ instance Diagnostic DriverMessage where , nest 2 $ ppr node ] DriverNoConfiguredLLVMToolchain -> mkSimpleDecorated $ - text "GHC was not configured with a supported LLVM toolchain" $$ - text ("Make sure you have installed LLVM between [" - ++ llvmVersionStr supportedLlvmVersionLowerBound - ++ " and " - ++ llvmVersionStr supportedLlvmVersionUpperBound - ++ ") and reinstall GHC to make -fllvm work") + text "GHC was not configured with a supported LLVM toolchain" diagnosticReason = \case DriverUnknownMessage m diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index 45b32fd8d1f..37b17d7beee 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -716,6 +716,7 @@ data GeneralFlag | Opt_EagerBlackHoling | Opt_OrigThunkInfo | Opt_NoHsMain + | Opt_NoGhcVersionH | Opt_SplitSections | Opt_StgStats | Opt_HideAllPackages @@ -1018,7 +1019,6 @@ data WarningFlag = | Opt_WarnMissedSpecs | Opt_WarnAllMissedSpecs | Opt_WarnUnsupportedCallingConventions - | Opt_WarnUnsupportedLlvmVersion | Opt_WarnMissedExtraSharedLib | Opt_WarnInlineRuleShadowing | Opt_WarnTypedHoles @@ -1144,7 +1144,6 @@ warnFlagNames wflag = case wflag of Opt_WarnMisplacedPragmas -> "misplaced-pragmas" :| [] Opt_WarnUnsafe -> "unsafe" :| [] Opt_WarnUnsupportedCallingConventions -> "unsupported-calling-conventions" :| [] - Opt_WarnUnsupportedLlvmVersion -> "unsupported-llvm-version" :| [] Opt_WarnMissedExtraSharedLib -> "missed-extra-shared-lib" :| [] Opt_WarnUntickedPromotedConstructors -> "unticked-promoted-constructors" :| [] Opt_WarnUnusedDoBind -> "unused-do-bind" :| [] @@ -1314,7 +1313,6 @@ standardWarnings -- see Note [Documenting warning flags] Opt_WarnDodgyForeignImports, Opt_WarnInlineRuleShadowing, Opt_WarnAlternativeLayoutRuleTransitional, - Opt_WarnUnsupportedLlvmVersion, Opt_WarnMissedExtraSharedLib, Opt_WarnTabs, Opt_WarnUnrecognisedWarningFlags, diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs index 4f72eff1b73..cd92aa6e718 100644 --- a/compiler/GHC/Driver/Pipeline/Execute.hs +++ b/compiler/GHC/Driver/Pipeline/Execute.hs @@ -478,7 +478,7 @@ runCcPhase cc_phase pipe_env hsc_env location input_fn = do -- very weakly typed, being derived from C--. ["-fno-strict-aliasing"] - include_ghcVersionH <- getGhcVersionIncludeFlags dflags unit_env + include_ghcVersionH <- getGhcVersionIncludeFlags dflags logger tmpfs withAtomicRename output_fn $ \temp_outputFilename -> GHC.SysTools.runCc (phaseForeignLanguage cc_phase) logger tmpfs dflags ( @@ -523,7 +523,9 @@ runCcPhase cc_phase pipe_env hsc_env location input_fn = do else []) ++ verbFlags ++ cc_opt - ++ include_ghcVersionH + ++ (if gopt Opt_NoGhcVersionH dflags + then [] + else include_ghcVersionH) ++ framework_paths ++ include_paths ++ pkg_extra_cc_opts diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index bf1db99c3b3..c33419e4594 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -1303,6 +1303,8 @@ dynamic_flags_deps = [ (NoArg (unSetGeneralFlag Opt_AutoLinkPackages)) , make_ord_flag defGhcFlag "no-hs-main" (NoArg (setGeneralFlag Opt_NoHsMain)) + , make_ord_flag defGhcFlag "no-ghcversion-header" + (NoArg (setGeneralFlag Opt_NoGhcVersionH)) , make_ord_flag defGhcFlag "fno-state-hack" (NoArg (setGeneralFlag Opt_G_NoStateHack)) , make_ord_flag defGhcFlag "fno-opt-coercion" @@ -2310,7 +2312,6 @@ wWarningFlagsDeps = [minBound..maxBound] >>= \x -> case x of Opt_WarnMisplacedPragmas -> warnSpec x Opt_WarnUnsafe -> warnSpec' x setWarnUnsafe Opt_WarnUnsupportedCallingConventions -> warnSpec x - Opt_WarnUnsupportedLlvmVersion -> warnSpec x Opt_WarnMissedExtraSharedLib -> warnSpec x Opt_WarnUntickedPromotedConstructors -> warnSpec x Opt_WarnUnusedDoBind -> warnSpec x diff --git a/compiler/GHC/Linker/ExtraObj.hs b/compiler/GHC/Linker/ExtraObj.hs index a26a31eed7c..db0fe4f2ab1 100644 --- a/compiler/GHC/Linker/ExtraObj.hs +++ b/compiler/GHC/Linker/ExtraObj.hs @@ -63,8 +63,17 @@ mkExtraObj logger tmpfs dflags unit_state extn xs -- we're compiling C or assembler. When compiling C, we pass the usual -- set of include directories and PIC flags. cOpts = map Option (picCCOpts dflags) - ++ map (FileOption "-I" . ST.unpack) - (unitIncludeDirs $ unsafeLookupUnit unit_state rtsUnit) + ++ map (FileOption "-I") + (collectIncludeDirs $ depClosure unit_state [unsafeLookupUnit unit_state rtsUnit]) + depClosure :: UnitState -> [UnitInfo] -> [UnitInfo] + depClosure us initial = go [] initial + where + go seen [] = seen + go seen (ui:uis) + | ui `elem` seen = go seen uis + | otherwise = + let deps = map (unsafeLookupUnitId us) (unitDepends ui) + in go (ui:seen) (deps ++ uis) -- When linking a binary, we need to create a C main() function that -- starts everything off. This used to be compiled statically as part diff --git a/compiler/GHC/Runtime/Heap/Layout.hs b/compiler/GHC/Runtime/Heap/Layout.hs index 73e2ff9e410..e0956185a59 100644 --- a/compiler/GHC/Runtime/Heap/Layout.hs +++ b/compiler/GHC/Runtime/Heap/Layout.hs @@ -438,8 +438,8 @@ cardTableSizeW platform elems = ----------------------------------------------------------------------------- -- deriving the RTS closure type from an SMRep -#include "ClosureTypes.h" -#include "FunTypes.h" +#include "rts/storage/ClosureTypes.h" +#include "rts/storage/FunTypes.h" -- Defines CONSTR, CONSTR_1_0 etc -- | Derives the RTS closure type from an 'SMRep' diff --git a/compiler/GHC/StgToCmm/Layout.hs b/compiler/GHC/StgToCmm/Layout.hs index f5e8fdd63b0..fa7270f8f38 100644 --- a/compiler/GHC/StgToCmm/Layout.hs +++ b/compiler/GHC/StgToCmm/Layout.hs @@ -547,7 +547,7 @@ mkVirtConstrSizes profile field_reps ------------------------------------------------------------------------- -- bring in ARG_P, ARG_N, etc. -#include "FunTypes.h" +#include "rts/storage/FunTypes.h" mkArgDescr :: Platform -> [Id] -> ArgDescr mkArgDescr platform args diff --git a/compiler/GHC/StgToCmm/TagCheck.hs b/compiler/GHC/StgToCmm/TagCheck.hs index c2476b84905..c4299b30e55 100644 --- a/compiler/GHC/StgToCmm/TagCheck.hs +++ b/compiler/GHC/StgToCmm/TagCheck.hs @@ -12,7 +12,7 @@ module GHC.StgToCmm.TagCheck ( emitTagAssertion, emitArgTagCheck, checkArg, whenCheckTags, checkArgStatic, checkFunctionArgTags,checkConArgsStatic,checkConArgsDyn) where -#include "ClosureTypes.h" +#include "rts/storage/ClosureTypes.h" import GHC.Prelude diff --git a/compiler/GHC/SysTools/Cpp.hs b/compiler/GHC/SysTools/Cpp.hs index 2f7f60afb92..571f690380e 100644 --- a/compiler/GHC/SysTools/Cpp.hs +++ b/compiler/GHC/SysTools/Cpp.hs @@ -6,7 +6,6 @@ module GHC.SysTools.Cpp ( doCpp , CppOpts(..) - , getGhcVersionPathName , getGhcVersionIncludeFlags , applyCDefs , offsetIncludePaths @@ -39,6 +38,7 @@ import Control.Monad import System.Directory import System.FilePath +import GHC.Settings.Config (cProjectVersionInt, cProjectPatchLevel1, cProjectVersion, cProjectPatchLevel2) data CppOpts = CppOpts { sourceCodePreprocessor :: !SourceCodePreprocessor @@ -125,10 +125,10 @@ doCpp logger tmpfs dflags unit_env opts input_fn output_fn = do [homeUnitEnv_dflags . ue_findHomeUnitEnv uid $ unit_env | uid <- ue_transitiveHomeDeps (ue_currentUnit unit_env) unit_env] dep_pkg_extra_inputs = [offsetIncludePaths fs (includePaths fs) | fs <- home_pkg_deps] - let include_paths_global = foldr (\ x xs -> ("-I" ++ x) : xs) [] + let include_paths_global = map ("-I" ++) (includePathsGlobal cmdline_include_paths ++ pkg_include_dirs ++ concatMap includePathsGlobal dep_pkg_extra_inputs) - let include_paths_quote = foldr (\ x xs -> ("-iquote" ++ x) : xs) [] + let include_paths_quote = map ("-iquote" ++) (includePathsQuote cmdline_include_paths ++ includePathsQuoteImplicit cmdline_include_paths) let include_paths = include_paths_quote ++ include_paths_global @@ -176,7 +176,7 @@ doCpp logger tmpfs dflags unit_env opts input_fn output_fn = do let asserts_def = [ "-D__GLASGOW_HASKELL_ASSERTS_IGNORED__" | gopt Opt_IgnoreAsserts dflags] -- Default CPP defines in Haskell source - hsSourceCppOpts <- getGhcVersionIncludeFlags dflags unit_env + hsSourceCppOpts <- getGhcVersionIncludeFlags dflags logger tmpfs -- MIN_VERSION macros let uids = explicitUnits unit_state @@ -262,40 +262,24 @@ generateMacros prefix name version = _ -> error "take3" (major1,major2,minor) = take3 $ map show (versionBranch version) ++ repeat "0" -getGhcVersionIncludeFlags :: DynFlags -> UnitEnv -> IO [String] -getGhcVersionIncludeFlags dflags unit_env = do - mghcversionh <- getGhcVersionPathName dflags unit_env - pure $ case mghcversionh of - Nothing -> [] - Just p -> ["-include", p] - --- | Find out path to @ghcversion.h@ file -getGhcVersionPathName :: DynFlags -> UnitEnv -> IO (Maybe FilePath) -getGhcVersionPathName dflags unit_env = do +getGhcVersionIncludeFlags :: DynFlags -> Logger -> TmpFs -> IO [String] +getGhcVersionIncludeFlags dflags logger tmpfs = do case ghcVersionFile dflags of - -- the user has provided an explicit `ghcversion.h` file to use. - Just path -> doesFileExist path >>= \case - True -> pure (Just path) - False -> throwGhcExceptionIO (InstallationError - ("ghcversion.h missing; tried user-supplied path: " ++ path)) - -- otherwise, try to find it in the rts' include-dirs. - -- Note: only in the RTS include-dirs! not all preload units less we may - -- use a wrong file. See #25106 where a globally installed - -- /usr/include/ghcversion.h file was used instead of the one provided - -- by the rts. - Nothing -> case lookupUnitId (ue_homeUnitState unit_env) rtsUnitId of - Nothing -> do - -- print warning and return nothing - putStrLn "Couldn't find ghcversion.h file: no rts unit available and -ghcversion-file flag not passed" - pure Nothing - Just info -> do - let candidates = (</> "ghcversion.h") <$> collectIncludeDirs [info] - found <- filterM doesFileExist candidates - case found of - [] -> throwGhcExceptionIO (InstallationError - ("ghcversion.h missing; tried: " - ++ intercalate ", " candidates)) - (x:_) -> return (Just x) + -- the user has provided an explicit `ghcversion.h` file to use. + Just path -> do + found <- doesFileExist path + unless found $ + throwGhcExceptionIO (InstallationError ("ghcversion.h missing; tried: " ++ path)) + return ["-include", path] + Nothing -> do + return $ ["-include", "ghcversion.h"] + ++ map (\(k, v) -> "-D" ++ k ++ "=" ++ v) + [ ("__GLASGOW_HASKELL__", cProjectVersionInt) + -- The cProjectVersion needs to be quoted! + , ("__GLASGOW_HASKELL_FULL_VERSION__", "\"" ++ cProjectVersion ++ "\"") + , ("__GLASGOW_HASKELL_PATCHLEVEL1__", cProjectPatchLevel1) + , ("__GLASGOW_HASKELL_PATCHLEVEL2__", cProjectPatchLevel2) + ] applyCDefs :: DefunctionalizedCDefs -> Logger -> DynFlags -> IO [String] applyCDefs NoCDefs _ _ = return [] diff --git a/compiler/GHC/SysTools/Tasks.hs b/compiler/GHC/SysTools/Tasks.hs index 8f424a6d6e7..d96046c8efc 100644 --- a/compiler/GHC/SysTools/Tasks.hs +++ b/compiler/GHC/SysTools/Tasks.hs @@ -12,7 +12,7 @@ module GHC.SysTools.Tasks where import GHC.Prelude import GHC.ForeignSrcLang -import GHC.CmmToLlvm.Version (LlvmVersion, llvmVersionStr, supportedLlvmVersionUpperBound, parseLlvmVersion, supportedLlvmVersionLowerBound) +import GHC.CmmToLlvm.Version (LlvmVersion, parseLlvmVersion) import GHC.Settings @@ -327,14 +327,10 @@ figureLlvmVersion logger dflags = traceSystoolCommand logger "llc" $ do debugTraceMsg logger 2 (text "Error (figuring out LLVM version):" <+> text (show err)) + -- TODO: review this errorMsg logger $ vcat [ text "Warning:", nest 9 $ - text "Couldn't figure out LLVM version!" $$ - text ("Make sure you have installed LLVM between [" - ++ llvmVersionStr supportedLlvmVersionLowerBound - ++ " and " - ++ llvmVersionStr supportedLlvmVersionUpperBound - ++ ")") ] + text "Couldn't figure out LLVM version!" ] return Nothing) -- See Note [Merging object files for GHCi] in GHC.Driver.Pipeline. diff --git a/compiler/Setup.hs b/compiler/Setup.hs index 23d233877e8..1614cd0227f 100644 --- a/compiler/Setup.hs +++ b/compiler/Setup.hs @@ -57,6 +57,8 @@ primopIncls = , ("primop-vector-tycons.hs-incl" , "--primop-vector-tycons") , ("primop-docs.hs-incl" , "--wired-in-docs") , ("primop-deprecations.hs-incl" , "--wired-in-deprecations") + , ("primop-prim-module.hs-incl" , "--prim-module") + , ("primop-wrappers-module.hs-incl" , "--wrappers-module") ] ghcAutogen :: Verbosity -> LocalBuildInfo -> IO () diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal similarity index 96% rename from compiler/ghc.cabal.in rename to compiler/ghc.cabal index 55083b5cdb3..2023a3af2fc 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal @@ -1,9 +1,7 @@ Cabal-Version: 2.2 --- WARNING: ghc.cabal is automatically generated from ghc.cabal.in by --- ./configure. Make sure you are editing ghc.cabal.in, not ghc.cabal. - Name: ghc -Version: @ProjectVersionMunged@ +-- ProjectVersionMunged +Version: 9.13 License: BSD-3-Clause License-File: LICENSE Author: The GHC Team @@ -32,22 +30,6 @@ extra-source-files: GHC/Builtin/primops.txt.pp Unique.h CodeGen.Platform.h - -- Shared with rts via hard-link at configure time. This is safer - -- for Windows, where symlinks don't work out of the box, so we - -- can't just commit some in git. - Bytecodes.h - ClosureTypes.h - FunTypes.h - MachRegs.h - MachRegs/arm32.h - MachRegs/arm64.h - MachRegs/loongarch64.h - MachRegs/ppc.h - MachRegs/riscv64.h - MachRegs/s390x.h - MachRegs/wasm32.h - MachRegs/x86.h - custom-setup setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.16, directory, process, filepath, containers @@ -95,12 +77,8 @@ Flag bootstrap Library Default-Language: GHC2021 Exposed: False + Includes: Unique.h - -- CodeGen.Platform.h -- invalid as C, skip - -- shared with rts via symlink - Bytecodes.h - ClosureTypes.h - FunTypes.h if flag(build-tool-depends) build-tool-depends: alex:alex >= 3.2.6, happy:happy >= 1.20.0, genprimopcode:genprimopcode, deriveConstants:deriveConstants @@ -132,16 +110,20 @@ Library semaphore-compat, stm, rts, - ghc-boot == @ProjectVersionMunged@, - ghc-heap == @ProjectVersionMunged@, - ghci == @ProjectVersionMunged@ + rts-headers, + -- ProjectVersionMunged + ghc-boot == 9.13, + ghc-heap == 9.13, + ghci == 9.13 if flag(bootstrap) Build-Depends: - ghc-boot-th-next == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghc-boot-th-next == 9.13 else Build-Depends: - ghc-boot-th == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghc-boot-th == 9.13 if os(windows) Build-Depends: Win32 >= 2.3 && < 2.15 @@ -344,7 +326,6 @@ Library GHC.CmmToLlvm.Ppr GHC.CmmToLlvm.Regs GHC.CmmToLlvm.Version - GHC.CmmToLlvm.Version.Bounds GHC.CmmToLlvm.Version.Type GHC.Cmm.Dominators GHC.Cmm.Reducibility diff --git a/configure.ac b/configure.ac index 6a39c3495f6..4236d25b151 100644 --- a/configure.ac +++ b/configure.ac @@ -19,24 +19,25 @@ AC_INIT([The Glorious Glasgow Haskell Compilation System], [9.13], [glasgow-hask # (X.Y.Z) on stable branches (e.g. ghc-9.2) to ensure that pre-releases are # versioned correctly. +dnl TODO add here anything relevant from ./packages. Arguably this should be +dnl the source of truth and the rest should be generated by autoconf. +AC_CONFIG_SUBDIRS([ + distrib + libraries/directory + libraries/ghc-bignum + libraries/ghc-internal + libraries/process + libraries/terminfo + libraries/time + libraries/unix + rts +]) + AC_CONFIG_MACRO_DIRS([m4]) # Set this to YES for a released version, otherwise NO : ${RELEASE=NO} -# The primary version (e.g. 7.5, 7.4.1) is set in the AC_INIT line -# above. If this is not a released version, then we will append the -# date to the version number (e.g. 7.4.20111220). The date is -# constructed by finding the date of the most recent patch in the -# git repository. If this is a source distribution (not a git -# checkout), then we ship a file 'VERSION' containing the full version -# when the source distribution was created. - -if test ! -f rts/ghcautoconf.h.autoconf.in; then - echo "rts/ghcautoconf.h.autoconf.in doesn't exist: perhaps you haven't run 'python3 boot'?" - exit 1 -fi - dnl this makes sure `./configure --target=<cross-compile-target>` dnl works as expected, since we're slightly modifying how Autoconf dnl interprets build/host/target and how this interacts with $CC tests @@ -445,10 +446,12 @@ AC_SUBST([CmmCPPCmd]) AC_SUBST([CmmCPPArgs]) AC_SUBST([CmmCPPSupportsG0]) -FP_SET_CFLAGS_C99([CC],[CFLAGS],[CPPFLAGS]) -FP_SET_CFLAGS_C99([CC_STAGE0],[CONF_CC_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0]) -FP_SET_CFLAGS_C99([CC],[CONF_CC_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1]) -FP_SET_CFLAGS_C99([CC],[CONF_CC_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2]) +AC_PROG_CC + +dnl Autoconf will configure the latest standard. We require at least c99. +AS_CASE([$ac_prog_cc_stdc], + [c89], [AC_MSG_ERROR([C99-compatible compiler needed])] +) dnl ** Do we have a compatible emsdk version? dnl -------------------------------------------------------------- @@ -943,10 +946,6 @@ AC_SUBST(BUILD_MAN) AC_SUBST(BUILD_SPHINX_HTML) AC_SUBST(BUILD_SPHINX_PDF) -if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then - AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them]) -fi - # We got caught by # http://savannah.gnu.org/bugs/index.php?1516 # $(eval ...) inside conditionals causes errors diff --git a/driver/ghci/ghci-wrapper.cabal.in b/driver/ghci/ghci-wrapper.cabal similarity index 68% rename from driver/ghci/ghci-wrapper.cabal.in rename to driver/ghci/ghci-wrapper.cabal index 2857e47a9da..cd644175cb8 100644 --- a/driver/ghci/ghci-wrapper.cabal.in +++ b/driver/ghci/ghci-wrapper.cabal @@ -1,20 +1,14 @@ --- WARNING: ghci-wrapper.cabal is automatically generated from ghci-wrapper.cabal.in by --- ./configure. Make sure you are editing ghci-wrapper.cabal.in, not ghci-wrapper.cabal. - +cabal-version: 3.0 Name: ghci-wrapper -Version: @ProjectVersion@ -Copyright: XXX -License: BSD3 --- XXX License-File: LICENSE -Author: XXX -Maintainer: XXX +-- ProjectVersion +Version: 9.13 +License: BSD-3-Clause Synopsis: A wrapper around GHCi allowing convenient execution of scripts Description: @ghci@ is a small wrapper program around GHC used on Windows to ensure that console setup is performed correctly. Category: Development build-type: Simple -cabal-version: >=1.10 Executable ghci Default-Language: Haskell2010 @@ -26,7 +20,10 @@ Executable ghci C-Sources: -- the following get copied from ../utils by hadrian getLocation.c isMinTTY.c cwrapper.c + -- We need to call the versioned ghc executable because the unversioned -- GHC executable is a wrapper that doesn't call FreeConsole and so -- breaks an interactive process like GHCi. See #21889, #14150 and #13411 - cc-options: -DEXE_PATH="ghc-@ProjectVersion@" + + -- ProjectVersion + cc-options: -DEXE_PATH="ghc-9.13" diff --git a/ghc/Main.hs b/ghc/Main.hs index 87dbef1d89e..9cee8ca7490 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -38,6 +38,8 @@ import GHC.Platform import GHC.Platform.Ways import GHC.Platform.Host +import GHC.Builtin.PrimOps (primOpPrimModule, primOpWrappersModule) + #if defined(HAVE_INTERNAL_INTERPRETER) import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings ) #endif @@ -147,6 +149,8 @@ main = do ShowVersion -> showVersion ShowNumVersion -> putStrLn cProjectVersion ShowOptions isInteractive -> showOptions isInteractive + PrintPrimModule -> liftIO $ putStrLn primOpPrimModule + PrintPrimWrappersModule -> liftIO $ putStrLn primOpWrappersModule Right postStartupMode -> -- start our GHC session GHC.runGhc mbMinusB $ do @@ -451,12 +455,16 @@ data PreStartupMode | ShowNumVersion -- ghc --numeric-version | ShowSupportedExtensions -- ghc --supported-extensions | ShowOptions Bool {- isInteractive -} -- ghc --show-options + | PrintPrimModule -- ghc --print-prim-module + | PrintPrimWrappersModule -- ghc --print-prim-wrappers-module -showVersionMode, showNumVersionMode, showSupportedExtensionsMode, showOptionsMode :: Mode +showVersionMode, showNumVersionMode, showSupportedExtensionsMode, showOptionsMode, printPrimModule, printPrimWrappersModule :: Mode showVersionMode = mkPreStartupMode ShowVersion showNumVersionMode = mkPreStartupMode ShowNumVersion showSupportedExtensionsMode = mkPreStartupMode ShowSupportedExtensions showOptionsMode = mkPreStartupMode (ShowOptions False) +printPrimModule = mkPreStartupMode PrintPrimModule +printPrimWrappersModule = mkPreStartupMode PrintPrimWrappersModule mkPreStartupMode :: PreStartupMode -> Mode mkPreStartupMode = Left @@ -622,6 +630,8 @@ mode_flags = , defFlag "-numeric-version" (PassFlag (setMode showNumVersionMode)) , defFlag "-info" (PassFlag (setMode showInfoMode)) , defFlag "-show-options" (PassFlag (setMode showOptionsMode)) + , defFlag "-print-prim-module" (PassFlag (setMode printPrimModule)) + , defFlag "-print-prim-wrappers-module" (PassFlag (setMode printPrimWrappersModule)) , defFlag "-supported-languages" (PassFlag (setMode showSupportedExtensionsMode)) , defFlag "-supported-extensions" (PassFlag (setMode showSupportedExtensionsMode)) , defFlag "-show-packages" (PassFlag (setMode showUnitsMode)) diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal similarity index 85% rename from ghc/ghc-bin.cabal.in rename to ghc/ghc-bin.cabal index 5aafb0c3577..7ae83829a9a 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal @@ -1,12 +1,7 @@ --- WARNING: ghc-bin.cabal is automatically generated from ghc-bin.cabal.in by --- ./configure. Make sure you are editing ghc-bin.cabal.in, not ghc-bin.cabal. - +Cabal-Version: 3.0 Name: ghc-bin -Version: @ProjectVersion@ -Copyright: XXX --- License: XXX --- License-File: XXX -Author: XXX +-- ProjectVersion +Version: 9.13 Maintainer: glasgow-haskell-users@haskell.org Homepage: http://www.haskell.org/ghc/ Synopsis: The Glorious Glasgow Haskell Compiler. @@ -15,7 +10,6 @@ Description: to the Glasgow Haskell Compiler. Category: Development Build-Type: Simple -Cabal-Version: >=1.10 Flag internal-interpreter Description: Build with internal interpreter support. @@ -39,8 +33,9 @@ Executable ghc filepath >= 1.5 && < 1.6, containers >= 0.5 && < 0.8, transformers >= 0.5 && < 0.7, - ghc-boot == @ProjectVersionMunged@, - ghc == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghc-boot == 9.13, + ghc == 9.13, if os(windows) Build-Depends: Win32 >= 2.3 && < 2.15 @@ -58,7 +53,8 @@ Executable ghc Build-depends: deepseq >= 1.4 && < 1.6, ghc-prim >= 0.5.0 && < 0.14, - ghci == @ProjectVersionMunged@, + -- ProjectVersionMunged + ghci == 9.13, haskeline == 0.8.*, exceptions == 0.10.*, time >= 1.8 && < 1.15 diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs index 1a0177d8cfc..2a9ce973caa 100644 --- a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs +++ b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs @@ -126,8 +126,9 @@ biModules pd = go [ comp | comp@(bi,_,_,_) <- -- -- Put another way, while Hadrian knows these are generated, Cabal -- should just think they are regular source files. +-- TODO: Review if this is necessary extraPreConfigureDeps :: [String] -extraPreConfigureDeps = ["compiler/GHC/CmmToLlvm/Version/Bounds.hs"] +extraPreConfigureDeps = [] -- TODO: Track command line arguments and package configuration flags. -- | Configure a package using the Cabal library by collecting all the command diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index 1479f2e618a..f0469a81af4 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -77,9 +77,6 @@ rtsDependencies = do compilerDependencies :: Expr [FilePath] compilerDependencies = do - let fixed = ("compiler" -/-) <$> - [ "GHC/CmmToLlvm/Version/Bounds.hs" - ] stage <- getStage ghcPath <- expr $ buildPath (vanillaContext stage compiler) let buildSpecific = (ghcPath -/-) <$> @@ -101,10 +98,12 @@ compilerDependencies = do , "primop-vector-uniques.hs-incl" , "primop-docs.hs-incl" , "primop-deprecations.hs-incl" + , "primop-prim-module.hs-incl" + , "primop-wrappers-module.hs-incl" , "GHC/Platform/Constants.hs" , "GHC/Settings/Config.hs" ] - pure $ fixed ++ buildSpecific + pure buildSpecific generatedDependencies :: Expr [FilePath] generatedDependencies = do @@ -388,10 +387,6 @@ templateRules = do , interpolateSetting "LlvmMinVersion" LlvmMinVersion , interpolateSetting "LlvmMaxVersion" LlvmMaxVersion ] - templateRule "compiler/GHC/CmmToLlvm/Version/Bounds.hs" $ mconcat - [ interpolateVar "LlvmMinVersion" $ replaceEq '.' ',' <$> setting LlvmMinVersion - , interpolateVar "LlvmMaxVersion" $ replaceEq '.' ',' <$> setting LlvmMaxVersion - ] bindistRules bindistRules :: Rules () diff --git a/hadrian/src/Rules/Lint.hs b/hadrian/src/Rules/Lint.hs index a8b1660556a..65b703685cd 100644 --- a/hadrian/src/Rules/Lint.hs +++ b/hadrian/src/Rules/Lint.hs @@ -91,8 +91,7 @@ compiler = do let compilerDir = "compiler" let ghcautoconf = stage1RtsInc </> "ghcautoconf.h" let ghcplatform = stage1RtsInc </> "ghcplatform.h" - let ghcLlvmVersion = compilerDir </> "GHC/CmmToLlvm/Version/Bounds.hs" - need $ mconcat [[ghcautoconf, ghcplatform, ghcLlvmVersion], hsIncls stage1Compiler, [machDeps]] + need $ mconcat [[ghcautoconf, ghcplatform], hsIncls stage1Compiler, [machDeps]] let includeDirs = [ stage1RtsInc , compilerDir diff --git a/hadrian/src/Settings/Builders/GenPrimopCode.hs b/hadrian/src/Settings/Builders/GenPrimopCode.hs index d38dcf30385..625fadeba5b 100644 --- a/hadrian/src/Settings/Builders/GenPrimopCode.hs +++ b/hadrian/src/Settings/Builders/GenPrimopCode.hs @@ -24,4 +24,6 @@ genPrimopCodeBuilderArgs = builder GenPrimopCode ? mconcat , output "//primop-vector-tycons.hs-incl" ? arg "--primop-vector-tycons" , output "//primop-docs.hs-incl" ? arg "--wired-in-docs" , output "//primop-deprecations.hs-incl" ? arg "--wired-in-deprecations" + , output "//primop-prim-module.hs-incl" ? arg "--prim-module" + , output "//primop-wrappers-module.hs-incl" ? arg "--wrappers-module" , output "//primop-usage.hs-incl" ? arg "--usage" ] diff --git a/hie.yaml b/hie.yaml index b666fd0f051..b80d4d764cb 100644 --- a/hie.yaml +++ b/hie.yaml @@ -7,11 +7,24 @@ # The format is documented here - https://github.com/mpickering/hie-bios cradle: multi: - - path: Build.hs + - path: ./Build.hs config: cradle: direct: arguments: [] - - path: "*" + - path: ./rts/Setup.hs + config: + cradle: + direct: + arguments: + - -clear-package-db + - -global-package-db + - -package-db _stage0/store/ghc-9.8.4-6626/package.db + # - -package base + # - -package Cabal + # - -package Cabal-syntax + # - -package mtl + # - -package transformers + - path: . config: cradle: {bios: {program: "./hadrian/hie-bios"}} diff --git a/libraries/Cabal b/libraries/Cabal index 98242d4d81e..367c5c61c36 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 98242d4d81e38dd591e212f3a9df7f04215ad1c7 +Subproject commit 367c5c61c361bf4b4d814eeff494d322840e64cb diff --git a/libraries/base/base.cabal.in b/libraries/base/base.cabal similarity index 97% rename from libraries/base/base.cabal.in rename to libraries/base/base.cabal index 8ffd310d451..9e4152e1037 100644 --- a/libraries/base/base.cabal.in +++ b/libraries/base/base.cabal @@ -1,8 +1,4 @@ cabal-version: 3.0 - --- WARNING: ghc-experimental.cabal is automatically generated from ghc-experimental.cabal.in --- Make sure you are editing ghc-experimental.cabal.in, not ghc-experimental.cabal - name: base version: 4.21.0.0 -- NOTE: Don't forget to update ./changelog.md @@ -30,7 +26,8 @@ Library default-language: Haskell2010 default-extensions: NoImplicitPrelude build-depends: - ghc-internal == @ProjectVersionForLib@.*, + -- ProjectVersionForLib + ghc-internal == 9.1300, ghc-prim, exposed-modules: diff --git a/libraries/defineTOP.mk b/libraries/defineTOP.mk deleted file mode 100644 index 5d8adee9e44..00000000000 --- a/libraries/defineTOP.mk +++ /dev/null @@ -1,3 +0,0 @@ - -TOP = ../.. - diff --git a/libraries/ghc-boot-th/ghc-boot-th.cabal.in b/libraries/ghc-boot-th/ghc-boot-th.cabal similarity index 83% rename from libraries/ghc-boot-th/ghc-boot-th.cabal.in rename to libraries/ghc-boot-th/ghc-boot-th.cabal index 3c2cfca509d..93544978d48 100644 --- a/libraries/ghc-boot-th/ghc-boot-th.cabal.in +++ b/libraries/ghc-boot-th/ghc-boot-th.cabal @@ -1,10 +1,8 @@ --- WARNING: ghc-boot-th@Suffix@.cabal is automatically generated from --- ghc-boot-th@Suffix@.cabal.in by ../../configure. Make sure you are editing --- ghc-boot-th@Suffix@.cabal.in, not ghc-boot-th@Suffix@.cabal. - -name: ghc-boot-th@Suffix@ -version: @ProjectVersionMunged@ -license: BSD3 +cabal-version: 3.0 +name: ghc-boot-th +-- ProjectVersionMunged +version: 9.13 +license: BSD-3-Clause license-file: LICENSE category: GHC maintainer: ghc-devs@haskell.org @@ -17,7 +15,6 @@ description: This library contains various bits shared between the @ghc@ and This package exists to ensure that @template-haskell@ has a minimal set of transitive dependencies, since it is intended to be depended upon by user code. -cabal-version: >=1.10 build-type: Simple extra-source-files: changelog.md @@ -56,7 +53,7 @@ Library cpp-options: -DBOOTSTRAP_TH build-depends: ghc-prim - hs-source-dirs: @SourceRoot@ ../ghc-internal/src + hs-source-dirs: . ../ghc-internal/src exposed-modules: GHC.Internal.TH.Lib GHC.Internal.TH.Syntax @@ -65,7 +62,7 @@ Library GHC.Internal.LanguageExtensions GHC.Internal.Lexeme else - hs-source-dirs: @SourceRoot@ + hs-source-dirs: . build-depends: ghc-internal reexported-modules: diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal similarity index 90% rename from libraries/ghc-boot/ghc-boot.cabal.in rename to libraries/ghc-boot/ghc-boot.cabal index 992c7834739..8ca9dbad8af 100644 --- a/libraries/ghc-boot/ghc-boot.cabal.in +++ b/libraries/ghc-boot/ghc-boot.cabal @@ -1,11 +1,7 @@ cabal-version: 3.0 - --- WARNING: ghc-boot.cabal is automatically generated from ghc-boot.cabal.in by --- ../../configure. Make sure you are editing ghc-boot.cabal.in, not --- ghc-boot.cabal. - name: ghc-boot -version: @ProjectVersionMunged@ +-- ProjectVersionMunged +version: 9.13 license: BSD-3-Clause license-file: LICENSE category: GHC @@ -94,10 +90,12 @@ Library if flag(bootstrap) build-depends: - ghc-boot-th-next == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghc-boot-th-next == 9.13 else build-depends: - ghc-boot-th == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghc-boot-th == 9.13 if !os(windows) build-depends: diff --git a/libraries/ghc-experimental/ghc-experimental.cabal.in b/libraries/ghc-experimental/ghc-experimental.cabal similarity index 73% rename from libraries/ghc-experimental/ghc-experimental.cabal.in rename to libraries/ghc-experimental/ghc-experimental.cabal index 07a0052a50b..ffc55fe4de3 100644 --- a/libraries/ghc-experimental/ghc-experimental.cabal.in +++ b/libraries/ghc-experimental/ghc-experimental.cabal @@ -1,12 +1,7 @@ cabal-version: 3.0 - --- WARNING: ghc-experimental.cabal is automatically generated from ghc-experimental.cabal.in --- Make sure you are editing ghc-experimental.cabal.in, not ghc-experimental.cabal - name: ghc-experimental --- The project is ghc's version plus ghc-experimental's version suffix. --- For example, for ghc=9.10.1, ghc-experimental's version will be 9.1001.0. -version: @ProjectVersionForLib@.0 +-- ProjectVersionForLib +version: 9.1300.0 synopsis: Experimental features of GHC's standard library description: This package is where experimental GHC standard library interfaces start @@ -42,6 +37,7 @@ library exposed-modules: GHC.Wasm.Prim other-extensions: build-depends: base >=4.20 && < 4.22, - ghc-internal == @ProjectVersionForLib@.* + -- ProjectVersionForLib + ghc-internal == 9.1300.*, hs-source-dirs: src default-language: Haskell2010 diff --git a/libraries/ghc-heap/ghc-heap.cabal.in b/libraries/ghc-heap/ghc-heap.cabal similarity index 93% rename from libraries/ghc-heap/ghc-heap.cabal.in rename to libraries/ghc-heap/ghc-heap.cabal index d3430642e47..e1bb956a747 100644 --- a/libraries/ghc-heap/ghc-heap.cabal.in +++ b/libraries/ghc-heap/ghc-heap.cabal @@ -1,6 +1,7 @@ cabal-version: 3.0 name: ghc-heap -version: @ProjectVersionMunged@ +-- ProjectVersionMunged +version: 9.13 license: BSD-3-Clause license-file: LICENSE maintainer: libraries@haskell.org @@ -28,7 +29,8 @@ library , containers >= 0.6.2.1 && < 0.8 if impl(ghc >= 9.9) - build-depends: ghc-internal >= 9.900 && < @ProjectVersionForLib@.99999 + -- ProjectVersionForLib + build-depends: ghc-internal >= 9.900 && < 9.1300.99999 ghc-options: -Wall if !os(ghcjs) diff --git a/libraries/ghc-internal/Setup.hs b/libraries/ghc-internal/Setup.hs index 54f57d6f118..540558fa583 100644 --- a/libraries/ghc-internal/Setup.hs +++ b/libraries/ghc-internal/Setup.hs @@ -1,6 +1,72 @@ -module Main (main) where +{-# LANGUAGE CPP #-} +module Main where import Distribution.Simple +import Distribution.Simple.BuildPaths +import Distribution.Types.ComponentLocalBuildInfo +import Distribution.Types.ComponentName (ComponentName(CLibName)) +import Distribution.Types.LocalBuildInfo +import Distribution.Types.LibraryName (LibraryName(LMainLibName)) +import Distribution.Verbosity +import Distribution.Simple.Program +import Distribution.Simple.Utils +import Distribution.Simple.Setup +#if MIN_VERSION_Cabal(3,14,0) +import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI) +#endif + +import System.IO +import System.Process +import System.Directory +import System.FilePath +import Control.Monad +import Data.Char +import qualified Data.Map as Map +import GHC.ResponseFile +import System.Environment main :: IO () -main = defaultMainWithHooks autoconfUserHooks +main = defaultMainWithHooks ghcHooks + where + ghcHooks = autoconfUserHooks + { postConf = \args cfg pd lbi -> do + let verbosity = fromFlagOrDefault minBound (configVerbosity cfg) + ghcAutogen verbosity lbi + postConf autoconfUserHooks args cfg pd lbi + } + +ghcAutogen :: Verbosity -> LocalBuildInfo -> IO () +ghcAutogen verbosity lbi = do + +#if MIN_VERSION_Cabal(3,14,0) + let fromSymPath = interpretSymbolicPathLBI lbi +#else + let fromSymPath = id +#endif + notice verbosity "Running ghc-internal pre-build hook: Generating Prim modules..." + + -- Get GHC path from LocalBuildInfo + let compilerInfo = compiler lbi + -- ghcPath <- case compilerFlavor compilerInfo of + -- GHC -> return $ compilerPath compilerInfo + -- _ -> fail "This setup script requires GHC." + + (ghc ,withPrograms) <- requireProgram normal ghcProgram (withPrograms lbi) + + -- Get autogen directory + let autogenDir = fromSymPath (autogenPackageModulesDir lbi) + let internalDir = autogenDir </> "GHC" </> "Internal" + + -- Ensure target directory exists + createDirectoryIfMissing True internalDir + + -- Define output file paths + let primHsPath = internalDir </> "Prim.hs" + let primWrappersHsPath = internalDir </> "PrimopWrappers.hs" + + -- Run GHC commands + notice verbosity $ "Generating " ++ primHsPath + getProgramOutput normal ghc ["--print-prim-module"] >>= rewriteFileEx verbosity primHsPath + + notice verbosity $ "Generating " ++ primWrappersHsPath + getProgramOutput normal ghc ["--print-prim-wrappers-module"] >>= rewriteFileEx verbosity primWrappersHsPath diff --git a/libraries/ghc-internal/ghc-internal.cabal.in b/libraries/ghc-internal/ghc-internal.cabal similarity index 97% rename from libraries/ghc-internal/ghc-internal.cabal.in rename to libraries/ghc-internal/ghc-internal.cabal index a35b5707853..3ad2fc72cfc 100644 --- a/libraries/ghc-internal/ghc-internal.cabal.in +++ b/libraries/ghc-internal/ghc-internal.cabal @@ -1,24 +1,20 @@ cabal-version: 3.0 --- WARNING: ghc-internal.cabal is automatically generated from ghc-internal.cabal.in by --- the top-level ./configure script. Make sure you are editing ghc-internal.cabal.in, not ghc-internal.cabal. name: ghc-internal --- The project is ghc's version plus ghc-internal's version suffix. --- For example, for ghc=9.10.1, ghc-internal's version will be 9.1001.0. -version: @ProjectVersionForLib@.0 +-- ProjectVersionForLib +version: 9.1300 license: BSD-3-Clause license-file: LICENSE maintainer: The GHC Developers <ghc-devs@haskell.org> bug-reports: https://gitlab.haskell.org/ghc/ghc/-/issues/new synopsis: Basic libraries category: Prelude -build-type: Configure +build-type: Custom description: This package contains the implementation of GHC's standard libraries and is not intended for use by end-users. . Users should instead use either the @base@ or @ghc-experimental@ packages - extra-tmp-files: autom4te.cache ghc-internal.buildinfo @@ -39,12 +35,14 @@ extra-source-files: include/HsBaseConfig.h.in include/ieee-flpt.h include/md5.h - include/fs.h include/winio_structs.h include/WordSize.h include/HsIntegerGmp.h.in install-sh +custom-setup + setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.16, directory, process, filepath, containers + source-repository head type: git location: https://gitlab.haskell.org/ghc/ghc.git @@ -119,7 +117,8 @@ Library Unsafe build-depends: - rts == 1.0.* + rts == 1.0.*, + rts-fs == 1.0.* exposed-modules: GHC.Internal.ClosureTypes @@ -345,9 +344,9 @@ Library -- Cabal expects autogen modules to be some specific directories, not in the -- source dirs... - -- autogen-modules: - -- GHC.Internal.Prim - -- GHC.Internal.PrimopWrappers + autogen-modules: + GHC.Internal.Prim + GHC.Internal.PrimopWrappers other-modules: GHC.Internal.Data.Typeable.Internal @@ -434,7 +433,6 @@ Library cbits/md5.c cbits/primFloat.c cbits/sysconf.c - cbits/fs.c cbits/strerror.c cbits/atomic.c cbits/bswap.c diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal similarity index 85% rename from libraries/ghci/ghci.cabal.in rename to libraries/ghci/ghci.cabal index 726b6d68267..5fb32220304 100644 --- a/libraries/ghci/ghci.cabal.in +++ b/libraries/ghci/ghci.cabal @@ -1,9 +1,7 @@ --- WARNING: ghci.cabal is automatically generated from ghci.cabal.in by --- ../../configure. Make sure you are editing ghci.cabal.in, not ghci.cabal. - +cabal-version: 3.0 name: ghci -version: @ProjectVersionMunged@ -license: BSD3 +version: 9.13 +license: BSD-3-Clause license-file: LICENSE category: GHC maintainer: ghc-devs@haskell.org @@ -13,7 +11,6 @@ description: This library offers interfaces which mediate interactions between the @ghci@ interactive shell and @iserv@, GHC's out-of-process interpreter backend. -cabal-version: >=1.10 build-type: Simple extra-source-files: changelog.md @@ -96,19 +93,23 @@ library containers >= 0.5 && < 0.8, deepseq >= 1.4 && < 1.6, filepath >= 1.4 && < 1.6, - ghc-boot == @ProjectVersionMunged@, - ghc-heap == @ProjectVersionMunged@, + -- ProjectVersionMunged + ghc-boot == 9.13, + ghc-heap == 9.13, transformers >= 0.5 && < 0.7 if flag(bootstrap) build-depends: - ghc-boot-th-next == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghc-boot-th-next == 9.13 else build-depends: - ghc-boot-th == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghc-boot-th == 9.13 if !os(windows) Build-Depends: unix >= 2.7 && < 2.9 if arch(wasm32) - build-depends: ghc-experimental == @ProjectVersionForLib@.0 + -- ProjectVersionForLib + build-depends: ghc-experimental == 9.1300.0 diff --git a/libraries/template-haskell/template-haskell.cabal.in b/libraries/template-haskell/template-haskell.cabal similarity index 84% rename from libraries/template-haskell/template-haskell.cabal.in rename to libraries/template-haskell/template-haskell.cabal index f2269b3173b..adfb0f95391 100644 --- a/libraries/template-haskell/template-haskell.cabal.in +++ b/libraries/template-haskell/template-haskell.cabal @@ -1,18 +1,14 @@ --- WARNING: template-haskell.cabal is automatically generated from template-haskell.cabal.in by --- ../../configure. Make sure you are editing template-haskell.cabal.in, not --- template-haskell.cabal. - +cabal-Version: 3.0 name: template-haskell version: 2.23.0.0 -- NOTE: Don't forget to update ./changelog.md -license: BSD3 +license: BSD-3-Clause license-file: LICENSE category: Template Haskell maintainer: libraries@haskell.org bug-reports: https://gitlab.haskell.org/ghc/ghc/issues/new synopsis: Support library for Template Haskell build-type: Simple -Cabal-Version: >= 1.10 description: This package provides modules containing facilities for manipulating Haskell source code using Template Haskell. @@ -53,7 +49,8 @@ Library build-depends: base >= 4.11 && < 4.22, - ghc-boot-th == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghc-boot-th == 9.13 other-modules: System.FilePath diff --git a/m4/fp_check_timer_create.m4 b/m4/fp_check_timer_create.m4 deleted file mode 100644 index 957772ba456..00000000000 --- a/m4/fp_check_timer_create.m4 +++ /dev/null @@ -1,110 +0,0 @@ -# Check for a working timer_create(). We need a pretty detailed check -# here, because there exist partially-working implementations of -# timer_create() in certain versions of Linux (see bug #1933). -# -AC_DEFUN([FP_CHECK_TIMER_CREATE],[ -AC_CHECK_FUNC([timer_create],[HAVE_timer_create=yes],[HAVE_timer_create=no]) - -if test "$HAVE_timer_create" = "yes" -then - if test "$cross_compiling" = "yes" - then - # We can't test timer_create when we're cross-compiling, so we - # optimistiaclly assume that it actually works properly. - AC_DEFINE([USE_TIMER_CREATE], 1, [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]) - else - AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], - [fptools_cv_timer_create_works], - [AC_TRY_RUN([ -#include <stdio.h> -#if defined(HAVE_STDLIB_H) -#include <stdlib.h> -#endif -#include <time.h> -#if defined(HAVE_SIGNAL_H) -#include <signal.h> -#endif -#if defined(HAVE_UNISTD_H) -#include <unistd.h> -#endif - -static volatile int tock = 0; -static void handler(int i) -{ - tock = 1; -} - -static void timeout(int i) -{ - // timer_settime() has been known to hang, so just in case - // we install a 1-second timeout (see #2257) - exit(99); -} - -int main(int argc, char *argv[]) -{ - - struct sigevent ev; - timer_t timer; - struct itimerspec it; - struct sigaction action; - int m,n,count = 0; - - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGVTALRM; - - action.sa_handler = handler; - action.sa_flags = 0; - sigemptyset(&action.sa_mask); - if (sigaction(SIGVTALRM, &action, NULL) == -1) { - fprintf(stderr,"SIGVTALRM problem\n"); - exit(3); - } - - action.sa_handler = timeout; - action.sa_flags = 0; - sigemptyset(&action.sa_mask); - if (sigaction(SIGALRM, &action, NULL) == -1) { - fprintf(stderr,"SIGALRM problem\n"); - exit(3); - } - alarm(1); - - if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) { - fprintf(stderr,"No CLOCK_REALTIME timer\n"); - exit(2); - } - - tock = 0; - - it.it_value.tv_sec = 0; - it.it_value.tv_nsec = 1000000; // 1ms - it.it_interval = it.it_value; - if (timer_settime(timer, 0, &it, NULL) != 0) { - fprintf(stderr,"settime problem\n"); - exit(4); - } - - // some environments have coarse scheduler/timer granularity of ~10ms and worse - usleep(100000); // 100ms - - if (!tock) { - fprintf(stderr,"no CLOCK_REALTIME signal\n"); - exit(5); - } - - timer_delete(timer); - - exit(0); -} - ], - [fptools_cv_timer_create_works=yes], - [fptools_cv_timer_create_works=no]) - ]) -case $fptools_cv_timer_create_works in - yes) AC_DEFINE([USE_TIMER_CREATE], 1, - [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; -esac - fi -fi -]) diff --git a/m4/fp_set_cflags_c99.m4 b/m4/fp_set_cflags_c99.m4 deleted file mode 100644 index b9644efe661..00000000000 --- a/m4/fp_set_cflags_c99.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# FP_SET_CFLAGS_C99 -# ---------------------------------- -# figure out which CFLAGS are needed to place the compiler into C99 mode -# $1 is name of CC variable (unmodified) -# $2 is name of CC flags variable (augmented if needed) -# $3 is name of CPP flags variable (augmented if needed) -AC_DEFUN([FP_SET_CFLAGS_C99], -[ - dnl save current state of AC_PROG_CC_C99 - FP_COPY_SHELLVAR([CC],[fp_save_CC]) - FP_COPY_SHELLVAR([CFLAGS],[fp_save_CFLAGS]) - FP_COPY_SHELLVAR([CPPFLAGS],[fp_save_CPPFLAGS]) - FP_COPY_SHELLVAR([ac_cv_prog_cc_c99],[fp_save_cc_c99]) - dnl set local state - CC="$$1" - CFLAGS="$$2" - CPPFLAGS="$$3" - unset ac_cv_prog_cc_c99 - dnl perform detection - AC_PROG_CC_C99 - fp_cc_c99="$ac_cv_prog_cc_c99" - case "x$ac_cv_prog_cc_c99" in - x) ;; # noop - xno) AC_MSG_ERROR([C99-compatible compiler needed]) ;; - *) $2="$$2 $ac_cv_prog_cc_c99" - $3="$$3 $ac_cv_prog_cc_c99" - ;; - esac - dnl restore saved state - FP_COPY_SHELLVAR([fp_save_CC],[CC]) - FP_COPY_SHELLVAR([fp_save_CFLAGS],[CFLAGS]) - FP_COPY_SHELLVAR([fp_save_CPPFLAGS],[CPPFLAGS]) - FP_COPY_SHELLVAR([fp_save_cc_c99],[ac_cv_prog_cc_c99]) - dnl cleanup - unset fp_save_CC - unset fp_save_CFLAGS - unset fp_save_cc_c99 -]) diff --git a/utils/fs/README b/rts-fs/README similarity index 68% rename from utils/fs/README rename to rts-fs/README index 5011939a381..446f95e9ece 100644 --- a/utils/fs/README +++ b/rts-fs/README @@ -1,4 +1,2 @@ This "fs" library, used by various ghc utilities is used to share some common I/O filesystem functions with different packages. - -This file is copied across the build-system by configure. diff --git a/utils/fs/fs.c b/rts-fs/fs.c similarity index 100% rename from utils/fs/fs.c rename to rts-fs/fs.c diff --git a/utils/fs/fs.h b/rts-fs/fs.h similarity index 100% rename from utils/fs/fs.h rename to rts-fs/fs.h diff --git a/rts-fs/rts-fs.cabal b/rts-fs/rts-fs.cabal new file mode 100644 index 00000000000..f2ebc8aab30 --- /dev/null +++ b/rts-fs/rts-fs.cabal @@ -0,0 +1,15 @@ +cabal-version: 3.0 +name: rts-fs +version: 1.0.0.0 +license: NONE +author: Andrea Bedini +maintainer: andrea@andreabedini.com +build-type: Simple +extra-doc-files: README +extra-source-files: fs.h + +library + c-sources: fs.c + include-dirs: . + install-includes: fs.h + default-language: Haskell2010 diff --git a/rts-headers/include/ghcversion.h b/rts-headers/include/ghcversion.h new file mode 100644 index 00000000000..6ac210f7e35 --- /dev/null +++ b/rts-headers/include/ghcversion.h @@ -0,0 +1,9 @@ +#pragma once + +#define MIN_VERSION_GLASGOW_HASKELL(ma, mi, pl1, pl2) ( \ + ((ma)*100+(mi)) < __GLASGOW_HASKELL__ || \ + ((ma)*100+(mi)) == __GLASGOW_HASKELL__ \ + && (pl1) < __GLASGOW_HASKELL_PATCHLEVEL1__ || \ + ((ma)*100+(mi)) == __GLASGOW_HASKELL__ \ + && (pl1) == __GLASGOW_HASKELL_PATCHLEVEL1__ \ + && (pl2) <= __GLASGOW_HASKELL_PATCHLEVEL2__ ) \ No newline at end of file diff --git a/rts/include/rts/Bytecodes.h b/rts-headers/include/rts/Bytecodes.h similarity index 100% rename from rts/include/rts/Bytecodes.h rename to rts-headers/include/rts/Bytecodes.h diff --git a/rts/include/rts/storage/ClosureTypes.h b/rts-headers/include/rts/storage/ClosureTypes.h similarity index 100% rename from rts/include/rts/storage/ClosureTypes.h rename to rts-headers/include/rts/storage/ClosureTypes.h diff --git a/rts/include/rts/storage/FunTypes.h b/rts-headers/include/rts/storage/FunTypes.h similarity index 100% rename from rts/include/rts/storage/FunTypes.h rename to rts-headers/include/rts/storage/FunTypes.h diff --git a/rts/include/stg/MachRegs.h b/rts-headers/include/stg/MachRegs.h similarity index 100% rename from rts/include/stg/MachRegs.h rename to rts-headers/include/stg/MachRegs.h diff --git a/rts/include/stg/MachRegs/arm32.h b/rts-headers/include/stg/MachRegs/arm32.h similarity index 100% rename from rts/include/stg/MachRegs/arm32.h rename to rts-headers/include/stg/MachRegs/arm32.h diff --git a/rts/include/stg/MachRegs/arm64.h b/rts-headers/include/stg/MachRegs/arm64.h similarity index 100% rename from rts/include/stg/MachRegs/arm64.h rename to rts-headers/include/stg/MachRegs/arm64.h diff --git a/rts/include/stg/MachRegs/loongarch64.h b/rts-headers/include/stg/MachRegs/loongarch64.h similarity index 100% rename from rts/include/stg/MachRegs/loongarch64.h rename to rts-headers/include/stg/MachRegs/loongarch64.h diff --git a/rts/include/stg/MachRegs/ppc.h b/rts-headers/include/stg/MachRegs/ppc.h similarity index 100% rename from rts/include/stg/MachRegs/ppc.h rename to rts-headers/include/stg/MachRegs/ppc.h diff --git a/rts/include/stg/MachRegs/riscv64.h b/rts-headers/include/stg/MachRegs/riscv64.h similarity index 100% rename from rts/include/stg/MachRegs/riscv64.h rename to rts-headers/include/stg/MachRegs/riscv64.h diff --git a/rts/include/stg/MachRegs/s390x.h b/rts-headers/include/stg/MachRegs/s390x.h similarity index 100% rename from rts/include/stg/MachRegs/s390x.h rename to rts-headers/include/stg/MachRegs/s390x.h diff --git a/rts/include/stg/MachRegs/wasm32.h b/rts-headers/include/stg/MachRegs/wasm32.h similarity index 100% rename from rts/include/stg/MachRegs/wasm32.h rename to rts-headers/include/stg/MachRegs/wasm32.h diff --git a/rts/include/stg/MachRegs/x86.h b/rts-headers/include/stg/MachRegs/x86.h similarity index 100% rename from rts/include/stg/MachRegs/x86.h rename to rts-headers/include/stg/MachRegs/x86.h diff --git a/rts-headers/rts-headers.cabal b/rts-headers/rts-headers.cabal new file mode 100644 index 00000000000..4058c6ab453 --- /dev/null +++ b/rts-headers/rts-headers.cabal @@ -0,0 +1,32 @@ +cabal-version: 3.4 +name: rts-headers +version: 1.0.3 +synopsis: The GHC runtime system +description: + The GHC runtime system. + + Code produced by GHC links this library to provide missing functionality + that cannot be written in Haskell itself. +license: BSD-3-Clause +maintainer: glasgow-haskell-users@haskell.org +build-type: Simple + + +library + include-dirs: + include + + install-includes: + ghcversion.h + rts/Bytecodes.h + rts/storage/ClosureTypes.h + rts/storage/FunTypes.h + stg/MachRegs.h + stg/MachRegs/arm32.h + stg/MachRegs/arm64.h + stg/MachRegs/loongarch64.h + stg/MachRegs/ppc.h + stg/MachRegs/riscv64.h + stg/MachRegs/s390x.h + stg/MachRegs/wasm32.h + stg/MachRegs/x86.h diff --git a/rts/.gitignore b/rts/.gitignore index 179d62d55cf..f8ae0bde052 100644 --- a/rts/.gitignore +++ b/rts/.gitignore @@ -3,12 +3,12 @@ /dist-*/ /include/ghcversion.h +/include/ghcautoconf.h /package.conf.inplace /package.conf.inplace.raw /package.conf.install /package.conf.install.raw -/fs.* /aclocal.m4 /autom4te.cache/ @@ -17,6 +17,3 @@ /configure /external-symbols.list -/ghcautoconf.h.autoconf.in -/ghcautoconf.h.autoconf -/include/ghcautoconf.h diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm index 5461f15c7a7..8c0f407967f 100644 --- a/rts/HeapStackCheck.cmm +++ b/rts/HeapStackCheck.cmm @@ -458,7 +458,7 @@ __stg_gc_fun /* explicit stack */ size = BITMAP_SIZE(StgFunInfoExtra_bitmap(info)); } else { if (type == ARG_GEN_BIG) { -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE // bitmap field holds an offset size = StgLargeBitmap_size( TO_W_(StgFunInfoExtraRev_bitmap_offset(info)) diff --git a/rts/Makefile b/rts/Makefile deleted file mode 100644 index d6a9db37574..00000000000 --- a/rts/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -dir = rts -TOP = .. -include $(TOP)/mk/sub-makefile.mk - -FAST_MAKE_OPTS += stage=none diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index d678a1f761f..981f0aba73a 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -279,7 +279,7 @@ extern char **environ; SymE_NeedsDataProto(ffi_type_uint8) \ SymE_NeedsDataProto(ffi_type_pointer) -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define RTS_RET_SYMBOLS /* nothing */ #else #define RTS_RET_SYMBOLS \ diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index 7640d7cca81..c5705f292f1 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -378,8 +378,8 @@ void printRtsInfo(const RtsConfig rts_config) { // say the target is <ABI adj>, unless we are talking about the host // platform of the compiler / ABI used by a compiler plugin. This is *not* // that, so I think a rename is in order to avoid confusion. - mkRtsInfoPair("Compiler unregisterised", GhcUnregisterised); - mkRtsInfoPair("Tables next to code", TablesNextToCode); + mkRtsInfoPair("Compiler unregisterised", GhcUnregisterised ? "yes" : "no"); + mkRtsInfoPair("Tables next to code", TABLES_NEXT_TO_CODE ? "yes" : "no"); mkRtsInfoPair("Flag -with-rtsopts", /* See #15261 */ rts_config.rts_opts != NULL ? rts_config.rts_opts : ""); selectIOManager(); /* resolve the io-manager, accounting for flags */ diff --git a/rts/Setup.hs b/rts/Setup.hs new file mode 100644 index 00000000000..8e10a7bbb32 --- /dev/null +++ b/rts/Setup.hs @@ -0,0 +1,97 @@ +{-# OPTIONS_GHC -Wall #-} + +import Data.Map.Strict qualified as Map +import Distribution.Simple +import Distribution.Simple.LocalBuildInfo +import Distribution.Simple.PackageIndex +import Distribution.Simple.Program (Program, gccProgram, programPath, requireProgram, runProgram, getProgramOutput, simpleProgram) +import Distribution.Simple.Setup +import Distribution.Types.BuildInfo as BI +import Distribution.Types.InstalledPackageInfo as IPI +import Distribution.Types.Library +import Distribution.Types.PackageDescription +import Distribution.Utils.Path (interpretSymbolicPathCWD, (</>), makeRelativePathEx) +import Distribution.Verbosity (normal) +import System.Directory (getCurrentDirectory) +import System.Info (os) + +nmProgram :: Program +nmProgram = simpleProgram "nm" + +objdumpProgram :: Program +objdumpProgram = simpleProgram "objdump" + +deriveConstantsProgram :: Program +deriveConstantsProgram = simpleProgram "deriveConstants" + +genapplyProgram :: Program +genapplyProgram = simpleProgram "genapply" + +main :: IO () +main = + defaultMainWithHooks + autoconfUserHooks + { postConf = \args flags pd lbi -> do + postConf autoconfUserHooks args flags pd lbi + + let verbosity = fromFlagOrDefault normal (configVerbosity flags) + progdb = withPrograms lbi + + (nm, _progdb) <- requireProgram verbosity nmProgram progdb + (objdump, _progdb) <- requireProgram verbosity objdumpProgram progdb + (gcc, _progdb) <- requireProgram verbosity gccProgram progdb + (deriveConstants, _progdb) <- requireProgram verbosity deriveConstantsProgram progdb + (genapply, _progdb) <- requireProgram verbosity genapplyProgram progdb + + -- Include dirs for this package + let thisIncDirs = foldMap (BI.includeDirs . libBuildInfo) (allLibraries pd) + + -- \^ Include dirs for dependencies + let depsIncDirs = + [ incdir + | Just clbis <- [Map.lookup (CLibName defaultLibName) (componentNameMap lbi)] + , clbi <- clbis + , (unitId, _) <- componentPackageDeps clbi + , Just ipi <- [lookupUnitId (installedPkgs lbi) unitId] + , incdir <- IPI.includeDirs ipi + ] + + let derivedConstantsH = interpretSymbolicPathCWD (buildDir lbi </> makeRelativePathEx "include/DerivedConstants.h") + + -- The fact that we can't just run some pre-gen shell script is really annoying. + -- why does everything need to be haskell? + getCurrentDirectory >>= putStrLn + runProgram verbosity deriveConstants $ + [ "--gen-header" + , "-o" + , derivedConstantsH + , "--target-os" + , os + , "--gcc-program" + , programPath gcc + , "--nm-program" + , programPath nm + , "--objdump-program" + , programPath objdump + , "--tmpdir" + , interpretSymbolicPathCWD (buildDir lbi) + , "--gcc-flag" + , "-I" ++ interpretSymbolicPathCWD (buildDir lbi </> makeRelativePathEx "include") + -- pass `-fcommon` to force symbols into the common section. If they + -- end up in the ro data section `nm` won't list their size, and thus + -- derivedConstants will fail. Recent clang (e.g. 16) will by default + -- use `-fno-common`. + , "--gcc-flag", "-fcommon" + ] + ++ foldMap ((\i -> ["--gcc-flag", "-I" ++ i]) . interpretSymbolicPathCWD) thisIncDirs + ++ foldMap (\incdir -> ["--gcc-flag", "-I" ++ incdir]) depsIncDirs + getProgramOutput verbosity genapply [derivedConstantsH] + >>= writeFile (interpretSymbolicPathCWD (buildDir lbi </> makeRelativePathEx "AutoApply.cmm")) + getProgramOutput verbosity genapply [derivedConstantsH, "-V16"] + >>= writeFile (interpretSymbolicPathCWD (buildDir lbi </> makeRelativePathEx "AutoApply_V16.cmm")) + getProgramOutput verbosity genapply [derivedConstantsH, "-V32"] + >>= writeFile (interpretSymbolicPathCWD (buildDir lbi </> makeRelativePathEx "AutoApply_V32.cmm")) + getProgramOutput verbosity genapply [derivedConstantsH, "-V64"] + >>= writeFile (interpretSymbolicPathCWD (buildDir lbi </> makeRelativePathEx "AutoApply_V64.cmm")) + + } diff --git a/rts/TraverseHeapTest.c b/rts/TraverseHeapTest.c index fe92bbdc5be..518edc21b78 100644 --- a/rts/TraverseHeapTest.c +++ b/rts/TraverseHeapTest.c @@ -26,7 +26,7 @@ struct node { }; // See INFO_PTR_TO_STRUCT in ClosureMacros.h -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define INFO(ptr) ((StgInfoTable *)ptr + 1) #else #define INFO(ptr) ((StgInfoTable *)ptr) diff --git a/rts/config.guess b/rts/config.guess new file mode 100755 index 00000000000..f9c22a043af --- /dev/null +++ b/rts/config.guess @@ -0,0 +1,1812 @@ +#!/usr/bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2024 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see <https://www.gnu.org/licenses/>. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to <config-patches@gnu.org>. + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system '$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2024 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try '$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# Just in case it came from the environment. +GUESS= + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still +# use 'HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #if defined(__ANDROID__) + LIBC=android + #else + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #elif defined(__LLVM_LIBC__) + LIBC=llvm + #else + #include <stdarg.h> + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + sun4*:SunOS:*:*) + case `/usr/bin/arch -k` in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like '4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in + sun3) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if test -x /usr/bin/getconf; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + GUESS=i386-sequent-sysv4 + ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find 'uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "${cputype-}" = 386; then + UNAME_MACHINE=i386 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; + *:Ironclad:*:*) + GUESS=$UNAME_MACHINE-unknown-ironclad + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" <<EOF +#ifdef _SEQUENT_ +#include <sys/types.h> +#include <sys/utsname.h> +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include <signal.h> +#if defined(_SIZE_T_) || defined(SIGLOST) +#include <sys/utsname.h> +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include <sys/param.h> +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <<EOF + +NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize +the system type. Please install a C compiler and try again. +EOF + ;; +esac + +cat >&2 <<EOF + +This script (version $timestamp), has failed to recognize the +operating system you are using. If your script is old, overwrite *all* +copies of config.guess and config.sub with the latest versions from: + + https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +and + https://git.savannah.gnu.org/cgit/config.git/plain/config.sub +EOF + +our_year=`echo $timestamp | sed 's,-.*,,'` +thisyear=`date +%Y` +# shellcheck disable=SC2003 +script_age=`expr "$thisyear" - "$our_year"` +if test "$script_age" -lt 3 ; then + cat >&2 <<EOF + +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/rts/config.sub b/rts/config.sub new file mode 100755 index 00000000000..df5f563de2f --- /dev/null +++ b/rts/config.sub @@ -0,0 +1,1971 @@ +#!/usr/bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2024 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see <https://www.gnu.org/licenses/>. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to <config-patches@gnu.org>. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2024 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try '$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <<EOF +$1 +EOF +IFS=$saved_IFS + +# Separate into logical components for further validation +case $1 in + *-*-*-*-*) + echo "Invalid configuration '$1': more than four components" >&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ + | windows-* ) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <<EOF +$basic_machine +EOF + IFS=$saved_IFS + ;; + # We use 'pc' rather than 'unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + cpu=$basic_machine + vendor=pc + ;; + # These rules are duplicated from below for sake of the special case above; + # i.e. things that normalized to x86 arches should also default to "pc" + pc98) + cpu=i386 + vendor=pc + ;; + x64 | amd64) + cpu=x86_64 + vendor=pc + ;; + # Recognize the basic CPU types without company name. + *) + cpu=$basic_machine + vendor=unknown + ;; +esac + +unset -v basic_machine + +# Decode basic machines in the full and proper CPU-Company form. +case $cpu-$vendor in + # Here we handle the default manufacturer of certain CPU types in canonical form. It is in + # some cases the only manufacturer, in others, it is the most popular. + craynv-unknown) + vendor=cray + basic_os=${basic_os:-unicosmp} + ;; + c90-unknown | c90-cray) + vendor=cray + basic_os=${Basic_os:-unicos} + ;; + fx80-unknown) + vendor=alliant + ;; + romp-unknown) + vendor=ibm + ;; + mmix-unknown) + vendor=knuth + ;; + microblaze-unknown | microblazeel-unknown) + vendor=xilinx + ;; + rs6000-unknown) + vendor=ibm + ;; + vax-unknown) + vendor=dec + ;; + pdp11-unknown) + vendor=dec + ;; + we32k-unknown) + vendor=att + ;; + cydra-unknown) + vendor=cydrome + ;; + i370-ibm*) + vendor=ibm + ;; + orion-unknown) + vendor=highlevel + ;; + xps-unknown | xps100-unknown) + cpu=xps100 + vendor=honeywell + ;; + + # Here we normalize CPU types with a missing or matching vendor + armh-unknown | armh-alt) + cpu=armv7l + vendor=alt + basic_os=${basic_os:-linux-gnueabihf} + ;; + dpx20-unknown | dpx20-bull) + cpu=rs6000 + vendor=bull + basic_os=${basic_os:-bosx} + ;; + + # Here we normalize CPU types irrespective of the vendor + amd64-*) + cpu=x86_64 + ;; + blackfin-*) + cpu=bfin + basic_os=linux + ;; + c54x-*) + cpu=tic54x + ;; + c55x-*) + cpu=tic55x + ;; + c6x-*) + cpu=tic6x + ;; + e500v[12]-*) + cpu=powerpc + basic_os=${basic_os}"spe" + ;; + mips3*-*) + cpu=mips64 + ;; + ms1-*) + cpu=mt + ;; + m68knommu-*) + cpu=m68k + basic_os=linux + ;; + m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) + cpu=s12z + ;; + openrisc-*) + cpu=or32 + ;; + parisc-*) + cpu=hppa + basic_os=linux + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + cpu=i586 + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) + cpu=i686 + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + cpu=i686 + ;; + pentium4-*) + cpu=i786 + ;; + pc98-*) + cpu=i386 + ;; + ppc-* | ppcbe-*) + cpu=powerpc + ;; + ppcle-* | powerpclittle-*) + cpu=powerpcle + ;; + ppc64-*) + cpu=powerpc64 + ;; + ppc64le-* | powerpc64little-*) + cpu=powerpc64le + ;; + sb1-*) + cpu=mipsisa64sb1 + ;; + sb1el-*) + cpu=mipsisa64sb1el + ;; + sh5e[lb]-*) + cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` + ;; + spur-*) + cpu=spur + ;; + strongarm-* | thumb-*) + cpu=arm + ;; + tx39-*) + cpu=mipstx39 + ;; + tx39el-*) + cpu=mipstx39el + ;; + x64-*) + cpu=x86_64 + ;; + xscale-* | xscalee[bl]-*) + cpu=`echo "$cpu" | sed 's/^xscale/arm/'` + ;; + arm64-* | aarch64le-*) + cpu=aarch64 + ;; + + # Recognize the canonical CPU Types that limit and/or modify the + # company names they are paired with. + cr16-*) + basic_os=${basic_os:-elf} + ;; + crisv32-* | etraxfs*-*) + cpu=crisv32 + vendor=axis + ;; + cris-* | etrax*-*) + cpu=cris + vendor=axis + ;; + crx-*) + basic_os=${basic_os:-elf} + ;; + neo-tandem) + cpu=neo + vendor=tandem + ;; + nse-tandem) + cpu=nse + vendor=tandem + ;; + nsr-tandem) + cpu=nsr + vendor=tandem + ;; + nsv-tandem) + cpu=nsv + vendor=tandem + ;; + nsx-tandem) + cpu=nsx + vendor=tandem + ;; + mipsallegrexel-sony) + cpu=mipsallegrexel + vendor=sony + ;; + tile*-*) + basic_os=${basic_os:-linux-gnu} + ;; + + *) + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be | aarch64c | arm64ec \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb | arc32 | arc64 \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | javascript \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | kvx \ + | le32 | le64 \ + | lm32 \ + | loongarch32 | loongarch64 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips* \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nanomips* \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | vc4 \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x"$basic_os" != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +obj= +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <<EOF +$basic_os +EOF + IFS=$saved_IFS + ;; + # Default OS when just kernel was specified + nto*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto|qnx|'` + ;; + linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|linux|gnu|'` + ;; + managarm*) + kernel=managarm + os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` + ;; + *) + kernel= + os=$basic_os + ;; +esac + +# Now, normalize the OS (knowing we just have one component, it's not a kernel, +# etc.) +case $os in + # First match some system type aliases that might get confused + # with valid system types. + # solaris* is a basic system type, with this one exception. + auroraux) + os=auroraux + ;; + bluegene*) + os=cnk + ;; + solaris1 | solaris1.*) + os=`echo "$os" | sed -e 's|solaris1|sunos4|'` + ;; + solaris) + os=solaris2 + ;; + unixware*) + os=sysv4.2uw + ;; + # es1800 is here to avoid being matched by es* (a different OS) + es1800*) + os=ose + ;; + # Some version numbers need modification + chorusos*) + os=chorusos + ;; + isc) + os=isc2.2 + ;; + sco6) + os=sco5v6 + ;; + sco5) + os=sco3.2v5 + ;; + sco4) + os=sco3.2v4 + ;; + sco3.2.[4-9]*) + os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` + ;; + sco*v* | scout) + # Don't match below + ;; + sco*) + os=sco3.2v2 + ;; + psos*) + os=psos + ;; + qnx*) + os=qnx + ;; + hiux*) + os=hiuxwe2 + ;; + lynx*178) + os=lynxos178 + ;; + lynx*5) + os=lynxos5 + ;; + lynxos*) + # don't get caught up in next wildcard + ;; + lynx*) + os=lynxos + ;; + mac[0-9]*) + os=`echo "$os" | sed -e 's|mac|macos|'` + ;; + opened*) + os=openedition + ;; + os400*) + os=os400 + ;; + sunos5*) + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` + ;; + sunos6*) + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` + ;; + wince*) + os=wince + ;; + utek*) + os=bsd + ;; + dynix*) + os=bsd + ;; + acis*) + os=aos + ;; + atheos*) + os=atheos + ;; + syllable*) + os=syllable + ;; + 386bsd) + os=bsd + ;; + ctix* | uts*) + os=sysv + ;; + nova*) + os=rtmk-nova + ;; + ns2) + os=nextstep2 + ;; + # Preserve the version number of sinix5. + sinix5.*) + os=`echo "$os" | sed -e 's|sinix|sysv|'` + ;; + sinix*) + os=sysv4 + ;; + tpf*) + os=tpf + ;; + triton*) + os=sysv3 + ;; + oss*) + os=sysv3 + ;; + svr4*) + os=sysv4 + ;; + svr3) + os=sysv3 + ;; + sysvr4) + os=sysv4 + ;; + ose*) + os=ose + ;; + *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + os=mint + ;; + dicos*) + os=dicos + ;; + pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $cpu in + arm*) + os=eabi + ;; + *) + os= + obj=elf + ;; + esac + ;; + aout* | coff* | elf* | pe*) + # These are machine code file formats, not OSes + obj=$os + os= + ;; + *) + # No normalization, but not necessarily accepted, that comes below. + ;; +esac + +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +kernel= +obj= +case $cpu-$vendor in + score-*) + os= + obj=elf + ;; + spu-*) + os= + obj=elf + ;; + *-acorn) + os=riscix1.2 + ;; + arm*-rebel) + kernel=linux + os=gnu + ;; + arm*-semi) + os= + obj=aout + ;; + c4x-* | tic4x-*) + os= + obj=coff + ;; + c8051-*) + os= + obj=elf + ;; + clipper-intergraph) + os=clix + ;; + hexagon-*) + os= + obj=elf + ;; + tic54x-*) + os= + obj=coff + ;; + tic55x-*) + os= + obj=coff + ;; + tic6x-*) + os= + obj=coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=tops20 + ;; + pdp11-*) + os=none + ;; + *-dec | vax-*) + os=ultrix4.2 + ;; + m68*-apollo) + os=domain + ;; + i386-sun) + os=sunos4.0.2 + ;; + m68000-sun) + os=sunos3 + ;; + m68*-cisco) + os= + obj=aout + ;; + mep-*) + os= + obj=elf + ;; + mips*-cisco) + os= + obj=elf + ;; + mips*-*|nanomips*-*) + os= + obj=elf + ;; + or32-*) + os= + obj=coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=sysv3 + ;; + sparc-* | *-sun) + os=sunos4.1.1 + ;; + pru-*) + os= + obj=elf + ;; + *-be) + os=beos + ;; + *-ibm) + os=aix + ;; + *-knuth) + os=mmixware + ;; + *-wec) + os=proelf + ;; + *-winbond) + os=proelf + ;; + *-oki) + os=proelf + ;; + *-hp) + os=hpux + ;; + *-hitachi) + os=hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=sysv + ;; + *-cbm) + os=amigaos + ;; + *-dg) + os=dgux + ;; + *-dolphin) + os=sysv3 + ;; + m68k-ccur) + os=rtu + ;; + m88k-omron*) + os=luna + ;; + *-next) + os=nextstep + ;; + *-sequent) + os=ptx + ;; + *-crds) + os=unos + ;; + *-ns) + os=genix + ;; + i370-*) + os=mvs + ;; + *-gould) + os=sysv + ;; + *-highlevel) + os=bsd + ;; + *-encore) + os=bsd + ;; + *-sgi) + os=irix + ;; + *-siemens) + os=sysv4 + ;; + *-masscomp) + os=rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=uxpv + ;; + *-rom68k) + os= + obj=coff + ;; + *-*bug) + os= + obj=coff + ;; + *-apple) + os=macos + ;; + *-atari*) + os=mint + ;; + *-wrs) + os=vxworks + ;; + *) + os=none + ;; +esac + +fi + +# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). + +case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. + llvm* | musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) + ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; + # See `case $cpu-$os` validation below + ghcjs) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* | tvos* | watchos* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | oabi* \ + | ptx* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ + | cygwin* | msys* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ + | fiwix* | mlibc* | cos* | mbr* | ironclad* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + # This refers to builds using the UEFI calling convention + # (which depends on the architecture) and PE file format. + # Note that this is both a different calling convention and + # different file format than that of GNU-EFI + # (x86_64-w64-mingw32). + uefi) + ;; + none) + ;; + kernel* | msvc* ) + # Restricted further below + ;; + '') + if test x"$obj" = x + then + echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 + fi + ;; + *) + echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 + exit 1 + ;; +esac + +case $obj in + aout* | coff* | elf* | pe*) + ;; + '') + # empty is fine + ;; + *) + echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 + exit 1 + ;; +esac + +# Here we handle the constraint that a (synthetic) cpu and os are +# valid only in combination with each other and nowhere else. +case $cpu-$os in + # The "javascript-unknown-ghcjs" triple is used by GHC; we + # accept it here in order to tolerate that, but reject any + # variations. + javascript-ghcjs) + ;; + javascript-* | *-ghcjs) + echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os-$obj in + linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ + | linux-mlibc*- | linux-musl*- | linux-newlib*- \ + | linux-relibc*- | linux-uclibc*- ) + ;; + uclinux-uclibc*- ) + ;; + managarm-mlibc*- | managarm-kernel*- ) + ;; + windows*-msvc*-) + ;; + -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ + | -uclibc*- ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + -kernel*- ) + echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel*- ) + echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + exit 1 + ;; + *-msvc*- ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu*- | kopensolaris*-gnu*-) + ;; + vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) + ;; + nto-qnx*-) + ;; + os2-emx-) + ;; + *-eabi*- | *-gnueabi*-) + ;; + none--*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an machine code file format + ;; + -*-) + # Blank kernel with real OS is always fine. + ;; + --*) + # Blank kernel and OS with real machine code file format is always fine. + ;; + *-*-*) + echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/rts/configure.ac b/rts/configure.ac index e9181aaf552..dd571759fe7 100644 --- a/rts/configure.ac +++ b/rts/configure.ac @@ -10,8 +10,8 @@ AC_INIT([GHC run-time system], [1.0.2], [libraries@haskell.org], [rts]) AC_CONFIG_MACRO_DIRS([../m4]) -# Safety check: Ensure that we are in the correct source directory. -AC_CONFIG_SRCDIR([include/rts/Constants.h]) +# Ensure that we are in the correct source directory. +AC_CONFIG_SRCDIR([rts.cabal]) dnl * We require autoconf version 2.69 due to dnl https://bugs.ruby-lang.org/issues/8179. Also see #14910. @@ -22,9 +22,50 @@ dnl #define SIZEOF_CHAR 0 dnl recently. AC_PREREQ([2.69]) -AC_CONFIG_FILES([ghcplatform.h.top]) +AC_CONFIG_FILES([include/ghcplatform.h]) +AC_CONFIG_FILES([rts.buildinfo]) +AC_CONFIG_HEADERS([include/ghcautoconf.h]) + +AC_PROG_AWK + +AC_ARG_WITH([compiler], + [AS_HELP_STRING([--with-compiler=PATH], + [Use a particular compiler available at PATH (default: ghc)])], + [ + GHC="$withval" + dnl If a name was provided (not an absolute path), resolve it in PATH + case "$withval" in + /*) AC_PATH_PROG([GHC], [`basename -- "$withval"`], [], [`dirname -- "$withval"`]) + ;; # It's already an absolute path, do nothing + *) AC_PATH_PROG([GHC], [$GHC], [], [$PATH]) ;; # Resolve it in PATH + esac + ], + [AC_PATH_PROG([GHC], [ghc])] +) + +dnl Verify that the resolved GHC is valid +if test -z "$GHC"; then + AC_MSG_ERROR([No valid GHC compiler found. Please install GHC or specify one with --with-compiler=.]) +elif test ! -x "$GHC"; then + AC_MSG_ERROR([The specified compiler ($GHC) is not executable.]) +fi + +dnl Check if it's actually GHC +GHC_VERSION=`$GHC --numeric-version 2>/dev/null` +if test -z "$GHC_VERSION"; then + AC_MSG_ERROR([The specified compiler ($GHC) does not appear to be a valid GHC.]) +fi -AC_CONFIG_HEADERS([ghcautoconf.h.autoconf]) +dnl NOTE: This is relative to what is being used to compile the rts, +dnl even if this is a new rts to be included in a new compiler version. +dnl tl;dr: this is going to be wrong in stage1 but will be correct in stage2. +AC_DEFINE_UNQUOTED([ProjectVersion], ["$GHC_VERSION"], [Version of GHC used to build this RTS]) + +dnl ** Rts way +dnl -------------------------------------------------------------- + +dnl FIXME Only used for display? +AC_DEFINE_UNQUOTED([RtsWay], ["FIXME"], [RtsWay]) AC_ARG_ENABLE(asserts-all-ways, [AS_HELP_STRING([--enable-asserts-all-ways], @@ -45,9 +86,7 @@ AC_CANONICAL_HOST dnl ** Do a build with tables next to code? dnl -------------------------------------------------------------- -AS_IF( - [test "$CABAL_FLAG_tables_next_to_code" = 1], - [AC_DEFINE([TABLES_NEXT_TO_CODE], [1], [Define to 1 if info tables are laid out next to code])]) +AC_DEFINE_UNQUOTED([TABLES_NEXT_TO_CODE], [$CABAL_FLAG_tables_next_to_code], [Define to 1 if info tables are laid out next to code]) dnl detect compiler (prefer gcc over clang) and set $CC (unless CC already set), dnl later CC is copied to CC_STAGE{1,2,3} @@ -74,10 +113,20 @@ GHC_CONVERT_PLATFORM_PARTS([build], [Build]) FPTOOLS_SET_PLATFORM_VARS([build],[Build]) FPTOOLS_SET_HASKELL_PLATFORM_VARS([Build]) +AC_DEFINE_UNQUOTED([BuildPlatform],["$BuildPlatform_CPP"],[BuildPlatform]) +AC_DEFINE_UNQUOTED([BuildArch],["$BuildArch_CPP"],[BuildArch]) +AC_DEFINE_UNQUOTED([BuildOS],["$BuildOS_CPP"],[BuildOS]) +AC_DEFINE_UNQUOTED([BuildVendor],["$BuildVendor_CPP"],[BuildVendor]) + GHC_CONVERT_PLATFORM_PARTS([host], [Host]) FPTOOLS_SET_PLATFORM_VARS([host], [Host]) FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host]) +AC_DEFINE_UNQUOTED([HostPlatform],["$HostPlatform"],[HostPlatform]) +AC_DEFINE_UNQUOTED([HostArch],["$HostArch_CPP"],[HostArch]) +AC_DEFINE_UNQUOTED([HostOS],["$HostOS_CPP"],[HostOS]) +AC_DEFINE_UNQUOTED([HostVendor],["$HostVendor_CPP"],[HostVendor]) + GHC_SUBSECTIONS_VIA_SYMBOLS AS_IF([test x"${TargetHasSubsectionsViaSymbols}" = x"YES"], [AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1], @@ -139,7 +188,6 @@ FP_CHECK_SIZEOF_AND_ALIGNMENT(uint32_t) FP_CHECK_SIZEOF_AND_ALIGNMENT(int64_t) FP_CHECK_SIZEOF_AND_ALIGNMENT(uint64_t) - FP_CHECK_FUNC([WinExec], [@%:@include <windows.h>], [WinExec("",0)]) @@ -210,7 +258,8 @@ FP_MUSTTAIL dnl ** check for librt AC_CHECK_FUNCS(clock_gettime timer_settime) -FP_CHECK_TIMER_CREATE + +AC_CHECK_FUNC([timer_create],[HAVE_timer_create=yes],[HAVE_timer_create=no]) dnl ** check for Apple's "interesting" long double compatibility scheme AC_MSG_CHECKING(for printf\$LDBLStub) @@ -345,6 +394,11 @@ AS_IF( [test "$CABAL_FLAG_libnuma" = 1], [AC_CHECK_HEADERS([numa.h numaif.h])]) +dnl ** Is this an unregisterised build? +dnl -------------------------------------------------------------- + +dnl Only used for printing information +AC_DEFINE_UNQUOTED([GhcUnregisterised], [$CABAL_FLAG_unregisterised], [Is this an unregistered build?]) dnl ** I/O managers dnl -------------------------------------------------------------- @@ -431,92 +485,34 @@ GHC_IOMANAGER_DEFAULT_AC_DEFINE([IOManagerThreadedDefault], [threaded], GHC_IOMANAGER_DEFAULT_AC_DEFINE([IOManagerThreadedDefault], [threaded], [winio], [IOMGR_DEFAULT_THREADED_WINIO]) - -dnl ** Write config files -dnl -------------------------------------------------------------- - -AC_OUTPUT - -dnl ###################################################################### -dnl Generate ghcplatform.h -dnl ###################################################################### - -[ -mkdir -p include - -touch include/ghcplatform.h -> include/ghcplatform.h - -cat ghcplatform.h.top >> include/ghcplatform.h -] - -dnl ** Do an unregisterised build? -dnl -------------------------------------------------------------- -AS_IF( - [test "$CABAL_FLAG_unregisterised" = 1], - [echo "#define UnregisterisedCompiler 1" >> include/ghcplatform.h]) - -[ -cat $srcdir/ghcplatform.h.bottom >> include/ghcplatform.h -] - -dnl ###################################################################### -dnl Generate ghcautoconf.h -dnl ###################################################################### - -[ -touch include/ghcautoconf.h -> include/ghcautoconf.h - -echo "#if !defined(__GHCAUTOCONF_H__)" >> include/ghcautoconf.h -echo "#define __GHCAUTOCONF_H__" >> include/ghcautoconf.h -# Copy the contents of ghcautoconf.h.autoconf, turning '#define PACKAGE_FOO -# "blah"' into '/* #undef PACKAGE_FOO */' to avoid clashes. -cat ghcautoconf.h.autoconf | sed \ - -e 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$,\1/* #undef \2 */,' \ - -e '/__GLASGOW_HASKELL/d' \ - -e '/REMOVE ME/d' \ - >> include/ghcautoconf.h -echo "#endif /* __GHCAUTOCONF_H__ */" >> include/ghcautoconf.h -] - dnl ###################################################################### dnl Generate external symbol flags (-Wl,-u...) dnl ###################################################################### dnl See Note [Undefined symbols in the RTS] -[ -symbolExtraDefs='' -if [ "$CABAL_FLAG_find_ptr" = 1 ]; then - symbolExtraDefs+=' -DFIND_PTR' +TEMP_FILE=`mktemp conftest.XXXXXX` || exit 1 + +cp $srcdir/external-symbols.list "$TEMP_FILE" + +if test "$CABAL_FLAG_find_ptr" = 1; then + echo findPtr >> "$TEMP_FILE" fi -cat $srcdir/external-symbols.list.in \ - | "$CC" $symbolExtraDefs -E -P -traditional -Iinclude - -o - \ - | sed -e '/^ *$/d' \ - > external-symbols.list \ - || exit 1 +if test "$HostOS_CPP" = "mingw32"; then + echo ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure >> "$TEMP_FILE" +fi -if [ "$CABAL_FLAG_leading_underscore" = 1 ]; then - sedExpr='s/^(.*)$/ "-Wl,-u,_\1"/' +if test "$CABAL_FLAGS_leading_underscore" = 1; then + LDFLAGS="$LDFLAGS `echo; $AWK '{ print " -Wl,-u,_" $0 }' "$TEMP_FILE"`" else - sedExpr='s/^(.*)$/ "-Wl,-u,\1"/' + LDFLAGS="$LDFLAGS `echo; $AWK '{ print " -Wl,-u," $0 }' "$TEMP_FILE"`" fi -sed -E -e "${sedExpr}" external-symbols.list > external-symbols.flags -unset sedExpr -rm -f external-symbols.list -] -dnl ###################################################################### -dnl Generate build-info -dnl ###################################################################### +rm -rf "$TEMP_FILE" -[ -cat $srcdir/rts.buildinfo.in \ - | "$CC" -E -P -traditional - -o - \ - | sed -e '/^ *$/d' \ - > rts.buildinfo \ - || exit 1 -rm -f external-symbols.flags -] +dnl -------------------------------------------------------------- +dnl ** Write config files +dnl -------------------------------------------------------------- + +AC_OUTPUT diff --git a/rts/external-symbols.list.in b/rts/external-symbols.list similarity index 93% rename from rts/external-symbols.list.in rename to rts/external-symbols.list index 5afab9f4df5..1a8e5f59b93 100644 --- a/rts/external-symbols.list.in +++ b/rts/external-symbols.list @@ -1,97 +1,83 @@ -#include "ghcautoconf.h" - -#if 0 -See Note [Undefined symbols in the RTS] -#endif - -#if mingw32_HOST_OS -ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure -#endif - -#if FIND_PTR -findPtr -#endif - -ghczminternal_GHCziInternalziTopHandler_runIO_closure -ghczminternal_GHCziInternalziTopHandler_runNonIO_closure -ghczminternal_GHCziInternalziTuple_Z0T_closure -ghczminternal_GHCziInternalziTypes_True_closure -ghczminternal_GHCziInternalziTypes_False_closure -ghczminternal_GHCziInternalziPack_unpackCString_closure -ghczminternal_GHCziInternalziWeakziFinalizze_runFinalizzerBatch_closure -ghczminternal_GHCziInternalziIOziException_stackOverflow_closure -ghczminternal_GHCziInternalziIOziException_heapOverflow_closure +ghczminternal_GHCziInternalziConcziIO_ensureIOManagerIsRunning_closure +ghczminternal_GHCziInternalziConcziIO_interruptIOManager_closure +ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure +ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure +ghczminternal_GHCziInternalziConcziSync_runSparks_closure +ghczminternal_GHCziInternalziControlziExceptionziBase_nestedAtomically_closure +ghczminternal_GHCziInternalziControlziExceptionziBase_nonTermination_closure +ghczminternal_GHCziInternalziEventziThread_blockedOnBadFD_closure +ghczminternal_GHCziInternalziIOPort_doubleReadException_closure ghczminternal_GHCziInternalziIOziException_allocationLimitExceeded_closure ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnMVar_closure ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnSTM_closure ghczminternal_GHCziInternalziIOziException_cannotCompactFunction_closure -ghczminternal_GHCziInternalziIOziException_cannotCompactPinned_closure ghczminternal_GHCziInternalziIOziException_cannotCompactMutable_closure -ghczminternal_GHCziInternalziIOPort_doubleReadException_closure -ghczminternal_GHCziInternalziControlziExceptionziBase_nonTermination_closure -ghczminternal_GHCziInternalziControlziExceptionziBase_nestedAtomically_closure -ghczminternal_GHCziInternalziEventziThread_blockedOnBadFD_closure -ghczminternal_GHCziInternalziConcziSync_runSparks_closure -ghczminternal_GHCziInternalziConcziIO_ensureIOManagerIsRunning_closure -ghczminternal_GHCziInternalziConcziIO_interruptIOManager_closure -ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure -ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure +ghczminternal_GHCziInternalziIOziException_cannotCompactPinned_closure +ghczminternal_GHCziInternalziIOziException_heapOverflow_closure +ghczminternal_GHCziInternalziIOziException_stackOverflow_closure +ghczminternal_GHCziInternalziInt_I16zh_con_info +ghczminternal_GHCziInternalziInt_I32zh_con_info +ghczminternal_GHCziInternalziInt_I64zh_con_info +ghczminternal_GHCziInternalziInt_I8zh_con_info +ghczminternal_GHCziInternalziPack_unpackCString_closure +ghczminternal_GHCziInternalziPtr_FunPtr_con_info +ghczminternal_GHCziInternalziPtr_Ptr_con_info +ghczminternal_GHCziInternalziStable_StablePtr_con_info +ghczminternal_GHCziInternalziStackziCloneStack_StackSnapshot_closure ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure +ghczminternal_GHCziInternalziTopHandler_runIO_closure ghczminternal_GHCziInternalziTopHandler_runMainIO_closure +ghczminternal_GHCziInternalziTopHandler_runNonIO_closure +ghczminternal_GHCziInternalziTuple_Z0T_closure ghczminternal_GHCziInternalziTypes_Czh_con_info -ghczminternal_GHCziInternalziTypes_Izh_con_info -ghczminternal_GHCziInternalziTypes_Fzh_con_info ghczminternal_GHCziInternalziTypes_Dzh_con_info +ghczminternal_GHCziInternalziTypes_False_closure +ghczminternal_GHCziInternalziTypes_Fzh_con_info +ghczminternal_GHCziInternalziTypes_Izh_con_info +ghczminternal_GHCziInternalziTypes_True_closure ghczminternal_GHCziInternalziTypes_Wzh_con_info -ghczminternal_GHCziInternalziPtr_Ptr_con_info -ghczminternal_GHCziInternalziPtr_FunPtr_con_info -ghczminternal_GHCziInternalziInt_I8zh_con_info -ghczminternal_GHCziInternalziInt_I16zh_con_info -ghczminternal_GHCziInternalziInt_I32zh_con_info -ghczminternal_GHCziInternalziInt_I64zh_con_info -ghczminternal_GHCziInternalziWord_W8zh_con_info +ghczminternal_GHCziInternalziWeakziFinalizze_runFinalizzerBatch_closure ghczminternal_GHCziInternalziWord_W16zh_con_info ghczminternal_GHCziInternalziWord_W32zh_con_info ghczminternal_GHCziInternalziWord_W64zh_con_info -ghczminternal_GHCziInternalziStable_StablePtr_con_info -hs_atomic_add8 +ghczminternal_GHCziInternalziWord_W8zh_con_info hs_atomic_add16 hs_atomic_add32 hs_atomic_add64 -hs_atomic_sub8 -hs_atomic_sub16 -hs_atomic_sub32 -hs_atomic_sub64 -hs_atomic_and8 +hs_atomic_add8 hs_atomic_and16 hs_atomic_and32 hs_atomic_and64 -hs_atomic_nand8 +hs_atomic_and8 hs_atomic_nand16 hs_atomic_nand32 hs_atomic_nand64 -hs_atomic_or8 +hs_atomic_nand8 hs_atomic_or16 hs_atomic_or32 hs_atomic_or64 -hs_atomic_xor8 +hs_atomic_or8 +hs_atomic_sub16 +hs_atomic_sub32 +hs_atomic_sub64 +hs_atomic_sub8 hs_atomic_xor16 hs_atomic_xor32 hs_atomic_xor64 -hs_cmpxchg8 -hs_cmpxchg16 -hs_cmpxchg32 -hs_cmpxchg64 -hs_xchg8 -hs_xchg16 -hs_xchg32 -hs_xchg64 -hs_atomicread8 +hs_atomic_xor8 hs_atomicread16 hs_atomicread32 hs_atomicread64 -hs_atomicwrite8 +hs_atomicread8 hs_atomicwrite16 hs_atomicwrite32 hs_atomicwrite64 -ghczminternal_GHCziInternalziStackziCloneStack_StackSnapshot_closure +hs_atomicwrite8 +hs_cmpxchg16 +hs_cmpxchg32 +hs_cmpxchg64 +hs_cmpxchg8 +hs_xchg16 +hs_xchg32 +hs_xchg64 +hs_xchg8 diff --git a/rts/gen_event_types.py b/rts/gen_event_types.py deleted file mode 100755 index a8dcc527947..00000000000 --- a/rts/gen_event_types.py +++ /dev/null @@ -1,214 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from typing import List, Union, Dict -from collections import namedtuple - -class FieldType: - def __init__(self, c_type: str): - self.c_type = c_type - -VariableLength = None -ThreadId = FieldType('EventThreadID') -KernelThreadId = FieldType('EventKernelThreadId') -CapNo = FieldType('EventCapNo') -CapsetType = FieldType('EventCapsetType') -Timestamp = FieldType('EventTimestamp') -CapsetId = FieldType('EventCapsetID') -TaskId = FieldType('EventTaskId') - -Word8 = FieldType('StgWord8') -Word16 = FieldType('StgWord16') -Word32 = FieldType('StgWord32') -Word64 = FieldType('StgWord64') - -class EventType: - def __init__(self, - n: int, - name: str, - fields: Union[VariableLength, List[FieldType]], - description: str): - self.n = n - self.name = name - self.fields = fields - self.description = description - - def __str__(self): - return '(n={n}, name={name})'.format(n=self.n, name=self.name) - -# When adding a new event type used by GHC you should also update -# NUM_GHC_EVENT_TAGS in rts/include/rts/EventLogFormat.h. -event_types = [ - EventType( 0, 'CREATE_THREAD', [ThreadId], 'Create thread'), - EventType( 1, 'RUN_THREAD', [ThreadId], 'Run thread'), - EventType( 2, 'STOP_THREAD', [ThreadId, Word16, ThreadId], 'Stop thread'), - EventType( 3, 'THREAD_RUNNABLE', [ThreadId], 'Thread runnable'), - EventType( 4, 'MIGRATE_THREAD', [ThreadId, CapNo], 'Migrate thread'), - # 5, 6, 7 deprecated - EventType( 8, 'THREAD_WAKEUP', [ThreadId, CapNo], 'Wakeup thread'), - EventType( 9, 'GC_START', [], 'Starting GC'), - EventType(10, 'GC_END', [], 'Finished GC'), - EventType(11, 'REQUEST_SEQ_GC', [], 'Request sequential GC'), - EventType(12, 'REQUEST_PAR_GC', [], 'Request parallel GC'), - # 13, 14 deprecated - EventType(15, 'CREATE_SPARK_THREAD', [ThreadId], 'Create spark thread'), - EventType(16, 'LOG_MSG', VariableLength, 'Log message'), - # 17 deprecated - EventType(18, 'BLOCK_MARKER', [Word32, Timestamp, CapNo], 'Block marker'), - EventType(19, 'USER_MSG', VariableLength, 'User message'), - EventType(20, 'GC_IDLE', [], 'GC idle'), - EventType(21, 'GC_WORK', [], 'GC working'), - EventType(22, 'GC_DONE', [], 'GC done'), - # 23, 24 used by eden - EventType(25, 'CAPSET_CREATE', [CapsetId, CapsetType], 'Create capability set'), - EventType(26, 'CAPSET_DELETE', [CapsetId], 'Delete capability set'), - EventType(27, 'CAPSET_ASSIGN_CAP',[CapsetId, CapNo], 'Add capability to capability set'), - EventType(28, 'CAPSET_REMOVE_CAP',[CapsetId, CapNo], 'Remove capability from capability set'), - EventType(29, 'RTS_IDENTIFIER', VariableLength, 'RTS name and version'), - EventType(30, 'PROGRAM_ARGS', VariableLength, 'Program arguments'), - EventType(31, 'PROGRAM_ENV', VariableLength, 'Program environment variables'), - EventType(32, 'OSPROCESS_PID', [CapsetId, Word32], 'Process ID'), - EventType(33, 'OSPROCESS_PPID', [CapsetId, Word32], 'Parent process ID'), - EventType(34, 'SPARK_COUNTERS', 7*[Word64], 'Spark counters'), - EventType(35, 'SPARK_CREATE', [], 'Spark create'), - EventType(36, 'SPARK_DUD', [], 'Spark dud'), - EventType(37, 'SPARK_OVERFLOW', [], 'Spark overflow'), - EventType(38, 'SPARK_RUN', [], 'Spark run'), - EventType(39, 'SPARK_STEAL', [CapNo], 'Spark steal'), - EventType(40, 'SPARK_FIZZLE', [], 'Spark fizzle'), - EventType(41, 'SPARK_GC', [], 'Spark GC'), - EventType(42, 'INTERN_STRING', VariableLength, 'Intern string'), - EventType(43, 'WALL_CLOCK_TIME', [CapsetId, Word64, Word32], 'Wall clock time'), - EventType(44, 'THREAD_LABEL', VariableLength, 'Thread label'), - EventType(45, 'CAP_CREATE', [CapNo], 'Create capability'), - EventType(46, 'CAP_DELETE', [CapNo], 'Delete capability'), - EventType(47, 'CAP_DISABLE', [CapNo], 'Disable capability'), - EventType(48, 'CAP_ENABLE', [CapNo], 'Enable capability'), - EventType(49, 'HEAP_ALLOCATED', [CapsetId, Word64], 'Total heap memory ever allocated'), - EventType(50, 'HEAP_SIZE', [CapsetId, Word64], 'Current heap size (number of allocated mblocks)'), - EventType(51, 'HEAP_LIVE', [CapsetId, Word64], 'Current heap live data'), - EventType(52, 'HEAP_INFO_GHC', [CapsetId, Word16] + 4*[Word64], 'Heap static parameters'), - EventType(53, 'GC_STATS_GHC', [CapsetId, Word16] + 3*[Word64] + [Word32] + 3*[Word64], 'GC statistics'), - EventType(54, 'GC_GLOBAL_SYNC', [], 'Synchronise stop-the-world GC'), - EventType(55, 'TASK_CREATE', [TaskId, CapNo, KernelThreadId], 'Task create'), - EventType(56, 'TASK_MIGRATE', [TaskId, CapNo, CapNo], 'Task migrate'), - EventType(57, 'TASK_DELETE', [TaskId], 'Task delete'), - EventType(58, 'USER_MARKER', VariableLength, 'User marker'), - EventType(59, 'HACK_BUG_T9003', [], 'Empty event for bug #9003'), - - # Range 60 - 80 is used by eden for parallel tracing. - # See http://www.mathematik.uni-marburg.de/~eden/ - - EventType(90, 'MEM_RETURN', [CapsetId, Word32, Word32, Word32], 'The RTS attempted to return heap memory to the OS'), - EventType(91, 'BLOCKS_SIZE', [CapsetId, Word64], 'Report the size of the heap in blocks'), - - # Range 100 - 139 is reserved for Mercury. - - # Range 140 - 159 is reserved for Perf events. - - # Range 160 - 180 is reserved for cost-centre heap profiling events. - - # Cost-centre profiler - EventType(160, 'HEAP_PROF_BEGIN', VariableLength, 'Start of heap profile'), - EventType(161, 'HEAP_PROF_COST_CENTRE', VariableLength, 'Cost-centre definition'), - EventType(162, 'HEAP_PROF_SAMPLE_BEGIN', [Word64], 'Start of heap profile sample'), - EventType(163, 'HEAP_PROF_SAMPLE_COST_CENTRE', VariableLength, 'Heap profile cost-centre sample'), - EventType(164, 'HEAP_PROF_SAMPLE_STRING', VariableLength, 'Heap profile string sample'), - EventType(165, 'HEAP_PROF_SAMPLE_END', [Word64], 'End of heap profile sample'), - EventType(166, 'HEAP_BIO_PROF_SAMPLE_BEGIN', [Word64, Word64], 'Start of heap profile (biographical) sample'), - - EventType(167, 'PROF_SAMPLE_COST_CENTRE', VariableLength, 'Time profile cost-centre stack'), - EventType(168, 'PROF_BEGIN', [Word64], 'Start of a time profile'), - EventType(169, 'IPE', VariableLength, 'An IPE entry'), - - EventType(181, 'USER_BINARY_MSG', VariableLength, 'User binary message'), - - # Non-moving GC - EventType(200, 'CONC_MARK_BEGIN', [], 'Begin concurrent mark phase'), - EventType(201, 'CONC_MARK_END', [Word32], 'End concurrent mark phase'), - EventType(202, 'CONC_SYNC_BEGIN', [], 'Begin concurrent GC synchronisation'), - EventType(203, 'CONC_SYNC_END', [], 'End concurrent mark synchronisation'), - EventType(204, 'CONC_SWEEP_BEGIN', [], 'Begin concurrent sweep phase'), - EventType(205, 'CONC_SWEEP_END', [], 'End concurrent sweep phase'), - EventType(206, 'CONC_UPD_REM_SET_FLUSH', [CapNo], 'Update remembered set flushed'), - EventType(207, 'NONMOVING_HEAP_CENSUS', [Word16, Word32, Word32, Word32], 'Nonmoving heap census'), - EventType(208, 'NONMOVING_PRUNED_SEGMENTS', [Word32, Word32], 'Report the amount of segments pruned and remaining on the free list.'), - - # Ticky-ticky profiling - EventType(210, 'TICKY_COUNTER_DEF', VariableLength, 'Ticky-ticky entry counter definition'), - EventType(211, 'TICKY_COUNTER_SAMPLE', 4*[Word64], 'Ticky-ticky entry counter sample'), - EventType(212, 'TICKY_COUNTER_BEGIN_SAMPLE', [], 'Ticky-ticky entry counter begin sample'), -] - -def check_events() -> Dict[int, EventType]: - seen_ids = {} - for ty in event_types: - if ty.n in seen_ids: - print('Duplicate event type {n}:'.format(n=ty.n)) - print(' {name}'.format(name=ty.name)) - print(' {seen}'.format(seen=seen_ids[ty.n].name)) - assert False - - seen_ids[ty.n] = ty - - return seen_ids - -def generate_event_types_array() -> str: - x = [] - pr = lambda s: x.append(s) - - pr('/*') - pr(' * Do not edit: This file is generated by gen_event_types.py') - pr(' */') - pr('') - pr('EventType eventTypes[] = {') - for ty in event_types: - if ty.fields is VariableLength: - length = '0xffff' - elif len(ty.fields) == 0: - length = '0' - else: - length = ' + '.join('sizeof({c_type})'.format(c_type=field.c_type) - for field in ty.fields) - - pr(' [EVENT_{}] = {{'.format(ty.name)) - pr(' .etNum = {},'.format(ty.n)) - pr(' .size = {},'.format(length)) - pr(' .desc = "{}"'.format(ty.description)) - pr(' },') - - pr('};') - return '\n'.join(x) - -def generate_event_types_defines() -> str: - x = [] - pr = lambda s: x.append(s) - - pr('/*') - pr(' * Do not edit: This file is generated by gen_event_types.py') - pr(' */') - pr('') - pr('#pragma once') - pr('') - for ty in event_types: - pr('#define EVENT_{name} {n}'.format(name=ty.name, n=ty.n)) - - return '\n'.join(x) - -def main() -> None: - import argparse - parser = argparse.ArgumentParser() - parser.add_argument('--event-types-array', type=argparse.FileType('w'), metavar='FILE') - parser.add_argument('--event-types-defines', type=argparse.FileType('w'), metavar='FILE') - args = parser.parse_args() - - check_events() - - if args.event_types_array: - args.event_types_array.write(generate_event_types_array()) - - if args.event_types_defines: - args.event_types_defines.write(generate_event_types_defines()) - -if __name__ == '__main__': - main() diff --git a/rts/ghcplatform.h.bottom b/rts/ghcplatform.h.bottom deleted file mode 100644 index 77c4b776533..00000000000 --- a/rts/ghcplatform.h.bottom +++ /dev/null @@ -1,2 +0,0 @@ - -#endif /* __GHCPLATFORM_H__ */ diff --git a/rts/include/Cmm.h b/rts/include/Cmm.h index 2f42889bdea..8f9468ac7dd 100644 --- a/rts/include/Cmm.h +++ b/rts/include/Cmm.h @@ -121,13 +121,13 @@ name : bits8[] str; \ } \ -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define RET_LBL(f) f##_info #else #define RET_LBL(f) f##_ret #endif -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define ENTRY_LBL(f) f##_info #else #define ENTRY_LBL(f) f##_entry @@ -637,7 +637,7 @@ * depending on TABLES_NEXT_TO_CODE. So we define field access * macros which use the appropriate version here: */ -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE /* * when TABLES_NEXT_TO_CODE, slow_apply is stored as an offset * instead of the normal pointer. diff --git a/rts/include/ghcautoconf.h.in b/rts/include/ghcautoconf.h.in new file mode 100644 index 00000000000..306a20c29c9 --- /dev/null +++ b/rts/include/ghcautoconf.h.in @@ -0,0 +1,680 @@ +/* include/ghcautoconf.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* The alignment of a `char'. */ +#undef ALIGNMENT_CHAR + +/* The alignment of a `double'. */ +#undef ALIGNMENT_DOUBLE + +/* The alignment of a `float'. */ +#undef ALIGNMENT_FLOAT + +/* The alignment of a `int'. */ +#undef ALIGNMENT_INT + +/* The alignment of a `int16_t'. */ +#undef ALIGNMENT_INT16_T + +/* The alignment of a `int32_t'. */ +#undef ALIGNMENT_INT32_T + +/* The alignment of a `int64_t'. */ +#undef ALIGNMENT_INT64_T + +/* The alignment of a `int8_t'. */ +#undef ALIGNMENT_INT8_T + +/* The alignment of a `long'. */ +#undef ALIGNMENT_LONG + +/* The alignment of a `long long'. */ +#undef ALIGNMENT_LONG_LONG + +/* The alignment of a `short'. */ +#undef ALIGNMENT_SHORT + +/* The alignment of a `uint16_t'. */ +#undef ALIGNMENT_UINT16_T + +/* The alignment of a `uint32_t'. */ +#undef ALIGNMENT_UINT32_T + +/* The alignment of a `uint64_t'. */ +#undef ALIGNMENT_UINT64_T + +/* The alignment of a `uint8_t'. */ +#undef ALIGNMENT_UINT8_T + +/* The alignment of a `unsigned char'. */ +#undef ALIGNMENT_UNSIGNED_CHAR + +/* The alignment of a `unsigned int'. */ +#undef ALIGNMENT_UNSIGNED_INT + +/* The alignment of a `unsigned long'. */ +#undef ALIGNMENT_UNSIGNED_LONG + +/* The alignment of a `unsigned long long'. */ +#undef ALIGNMENT_UNSIGNED_LONG_LONG + +/* The alignment of a `unsigned short'. */ +#undef ALIGNMENT_UNSIGNED_SHORT + +/* The alignment of a `void *'. */ +#undef ALIGNMENT_VOID_P + +/* BuildArch */ +#undef BuildArch + +/* BuildOS */ +#undef BuildOS + +/* BuildPlatform */ +#undef BuildPlatform + +/* BuildVendor */ +#undef BuildVendor + +/* Define (to 1) if C compiler has an LLVM back end */ +#undef CC_LLVM_BACKEND + +/* Define to 1 if __thread is supported */ +#undef CC_SUPPORTS_TLS + +/* Define to 1 if using 'alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if your processor stores words of floats with the most + significant byte first */ +#undef FLOAT_WORDS_BIGENDIAN + +/* Is this an unregistered build? */ +#undef GhcUnregisterised + +/* Has musttail */ +#undef HAS_MUSTTAIL + +/* Has visibility hidden */ +#undef HAS_VISIBILITY_HIDDEN + +/* Define to 1 if you have 'alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if <alloca.h> works. */ +#undef HAVE_ALLOCA_H + +/* Does the toolchain use ARMv8 outline atomics */ +#undef HAVE_ARM_OUTLINE_ATOMICS + +/* Define to 1 if you have the <bfd.h> header file. */ +#undef HAVE_BFD_H + +/* Define to 1 if you have the 'clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 if you have the 'ctime_r' function. */ +#undef HAVE_CTIME_R + +/* Define to 1 if you have the <ctype.h> header file. */ +#undef HAVE_CTYPE_H + +/* Define to 1 if you have the declaration of 'ctime_r', and to 0 if you + don't. */ +#undef HAVE_DECL_CTIME_R + +/* Define to 1 if you have the declaration of 'environ', and to 0 if you + don't. */ +#undef HAVE_DECL_ENVIRON + +/* Define to 1 if you have the declaration of 'MADV_DONTNEED', and to 0 if you + don't. */ +#undef HAVE_DECL_MADV_DONTNEED + +/* Define to 1 if you have the declaration of 'MADV_FREE', and to 0 if you + don't. */ +#undef HAVE_DECL_MADV_FREE + +/* Define to 1 if you have the declaration of 'MAP_NORESERVE', and to 0 if you + don't. */ +#undef HAVE_DECL_MAP_NORESERVE + +/* Define to 1 if you have the declaration of 'program_invocation_short_name', + and to 0 if you don't. */ +#undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME + +/* Define to 1 if you have the <dirent.h> header file. */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the 'dlinfo' function. */ +#undef HAVE_DLINFO + +/* Define to 1 if you have the <errno.h> header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the 'eventfd' function. */ +#undef HAVE_EVENTFD + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the 'fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the 'getclock' function. */ +#undef HAVE_GETCLOCK + +/* Define to 1 if you have the `GetModuleFileName' function. */ +#undef HAVE_GETMODULEFILENAME + +/* Define to 1 if you have the 'getpid' function. */ +#undef HAVE_GETPID + +/* Define to 1 if you have the 'getrusage' function. */ +#undef HAVE_GETRUSAGE + +/* Define to 1 if you have the 'gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the 'getuid' function. */ +#undef HAVE_GETUID + +/* Define (to 1) if GNU-style non-executable stack note is supported */ +#undef HAVE_GNU_NONEXEC_STACK + +/* Define to 1 if you have the <grp.h> header file. */ +#undef HAVE_GRP_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the 'bfd' library (-lbfd). */ +#undef HAVE_LIBBFD + +/* Define to 1 if you have the 'dl' library (-ldl). */ +#undef HAVE_LIBDL + +/* Define to 1 if you have the 'iberty' library (-liberty). */ +#undef HAVE_LIBIBERTY + +/* Define to 1 if you need to link with libm */ +#undef HAVE_LIBM + +/* Define to 1 if you have libnuma */ +#undef HAVE_LIBNUMA + +/* Define to 1 if you have the 'pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Define to 1 if you wish to compress IPE data in compiler results (requires + libzstd) */ +#undef HAVE_LIBZSTD + +/* Define to 1 if you have the <limits.h> header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the <locale.h> header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if the system has the type 'long long'. */ +#undef HAVE_LONG_LONG + +/* Define to 1 if you have the <minix/config.h> header file. */ +#undef HAVE_MINIX_CONFIG_H + +/* Define to 1 if you have the <nlist.h> header file. */ +#undef HAVE_NLIST_H + +/* Define to 1 if you have the <numaif.h> header file. */ +#undef HAVE_NUMAIF_H + +/* Define to 1 if you have the <numa.h> header file. */ +#undef HAVE_NUMA_H + +/* Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC). */ +#undef HAVE_PRINTF_LDBLSTUB + +/* Define to 1 if you have the 'pthread_condattr_setclock' function. */ +#undef HAVE_PTHREAD_CONDATTR_SETCLOCK + +/* Define to 1 if you have the <pthread.h> header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the <pthread_np.h> header file. */ +#undef HAVE_PTHREAD_NP_H + +/* Define to 1 if you have the glibc version of pthread_setname_np */ +#undef HAVE_PTHREAD_SETNAME_NP + +/* Define to 1 if you have the Darwin version of pthread_setname_np */ +#undef HAVE_PTHREAD_SETNAME_NP_DARWIN + +/* Define to 1 if you have the NetBSD version of pthread_setname_np */ +#undef HAVE_PTHREAD_SETNAME_NP_NETBSD + +/* Define to 1 if you have pthread_set_name_np */ +#undef HAVE_PTHREAD_SET_NAME_NP + +/* Define to 1 if you have the <pwd.h> header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the 'raise' function. */ +#undef HAVE_RAISE + +/* Define to 1 if you have the 'sched_getaffinity' function. */ +#undef HAVE_SCHED_GETAFFINITY + +/* Define to 1 if you have the <sched.h> header file. */ +#undef HAVE_SCHED_H + +/* Define to 1 if you have the 'sched_setaffinity' function. */ +#undef HAVE_SCHED_SETAFFINITY + +/* Define to 1 if you have the 'setitimer' function. */ +#undef HAVE_SETITIMER + +/* Define to 1 if you have the 'setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the 'siginterrupt' function. */ +#undef HAVE_SIGINTERRUPT + +/* Define to 1 if you have the <signal.h> header file. */ +#undef HAVE_SIGNAL_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if Apple-style dead-stripping is supported. */ +#undef HAVE_SUBSECTIONS_VIA_SYMBOLS + +/* Define to 1 if you have the 'sysconf' function. */ +#undef HAVE_SYSCONF + +/* Define to 1 if you have the <sys/cpuset.h> header file. */ +#undef HAVE_SYS_CPUSET_H + +/* Define to 1 if you have the <sys/eventfd.h> header file. */ +#undef HAVE_SYS_EVENTFD_H + +/* Define to 1 if you have the <sys/mman.h> header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the <sys/select.h> header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/timeb.h> header file. */ +#undef HAVE_SYS_TIMEB_H + +/* Define to 1 if you have the <sys/timerfd.h> header file. */ +#undef HAVE_SYS_TIMERFD_H + +/* Define to 1 if you have the <sys/timers.h> header file. */ +#undef HAVE_SYS_TIMERS_H + +/* Define to 1 if you have the <sys/times.h> header file. */ +#undef HAVE_SYS_TIMES_H + +/* Define to 1 if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <sys/utsname.h> header file. */ +#undef HAVE_SYS_UTSNAME_H + +/* Define to 1 if you have the <sys/wait.h> header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the <termios.h> header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the 'timer_settime' function. */ +#undef HAVE_TIMER_SETTIME + +/* Define to 1 if you have the 'times' function. */ +#undef HAVE_TIMES + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the 'uselocale' function. */ +#undef HAVE_USELOCALE + +/* Define to 1 if you have the <utime.h> header file. */ +#undef HAVE_UTIME_H + +/* Define to 1 if you have the 'vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the <vfork.h> header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the <wchar.h> header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if you have the <windows.h> header file. */ +#undef HAVE_WINDOWS_H + +/* Define to 1 if you have the `WinExec' function. */ +#undef HAVE_WINEXEC + +/* Define to 1 if you have the <winsock.h> header file. */ +#undef HAVE_WINSOCK_H + +/* Define to 1 if 'fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if 'vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* HostArch */ +#undef HostArch + +/* HostOS */ +#undef HostOS + +/* HostPlatform */ +#undef HostPlatform + +/* HostVendor */ +#undef HostVendor + +/* Define to 1 if the mio I/O manager should be built */ +#undef IOMGR_BUILD_MIO + +/* Define to 1 if the select I/O manager should be built */ +#undef IOMGR_BUILD_SELECT + +/* Define to 1 if the win32-legacy I/O manager should be built */ +#undef IOMGR_BUILD_WIN32_LEGACY + +/* Define to 1 if the winio I/O manager should be built */ +#undef IOMGR_BUILD_WINIO + +/* Define to 1 if the select I/O manager is the default for the non-threaded + RTS */ +#undef IOMGR_DEFAULT_NON_THREADED_SELECT + +/* Define to 1 if the win32-legacy I/O manager is the default for the + non-threaded RTS */ +#undef IOMGR_DEFAULT_NON_THREADED_WIN32_LEGACY + +/* Define to 1 if the winio I/O manager is the default for the non-threaded + RTS */ +#undef IOMGR_DEFAULT_NON_THREADED_WINIO + +/* Define to 1 if the mio I/O manager is the default for the threaded RTS */ +#undef IOMGR_DEFAULT_THREADED_MIO + +/* Define to 1 if the winio I/O manager is the default for the threaded RTS */ +#undef IOMGR_DEFAULT_THREADED_WINIO + +/* Define to 1 if C symbols have a leading underscore added by the compiler. + */ +#undef LEADING_UNDERSCORE + +/* Define to 1 if we need -latomic for sub-word atomic operations. */ +#undef NEED_ATOMIC_LIB + +/* Version of GHC used to build this RTS */ +#undef ProjectVersion + +/* Use mmap in the runtime linker */ +#undef RTS_LINKER_USE_MMAP + +/* RtsWay */ +#undef RtsWay + +/* The size of 'char', as computed by sizeof. */ +#undef SIZEOF_CHAR + +/* The size of 'double', as computed by sizeof. */ +#undef SIZEOF_DOUBLE + +/* The size of 'float', as computed by sizeof. */ +#undef SIZEOF_FLOAT + +/* The size of 'int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of 'int16_t', as computed by sizeof. */ +#undef SIZEOF_INT16_T + +/* The size of 'int32_t', as computed by sizeof. */ +#undef SIZEOF_INT32_T + +/* The size of 'int64_t', as computed by sizeof. */ +#undef SIZEOF_INT64_T + +/* The size of 'int8_t', as computed by sizeof. */ +#undef SIZEOF_INT8_T + +/* The size of 'long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of 'long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of 'short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of 'uint16_t', as computed by sizeof. */ +#undef SIZEOF_UINT16_T + +/* The size of 'uint32_t', as computed by sizeof. */ +#undef SIZEOF_UINT32_T + +/* The size of 'uint64_t', as computed by sizeof. */ +#undef SIZEOF_UINT64_T + +/* The size of 'uint8_t', as computed by sizeof. */ +#undef SIZEOF_UINT8_T + +/* The size of 'unsigned char', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_CHAR + +/* The size of 'unsigned int', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_INT + +/* The size of 'unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + +/* The size of 'unsigned long long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG_LONG + +/* The size of 'unsigned short', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_SHORT + +/* The size of 'void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you wish to statically link the libzstd compression library + in the compiler (requires libzstd) */ +#undef STATIC_LIBZSTD + +/* Define to 1 if all of the C89 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Define to 1 if info tables are laid out next to code */ +#undef TABLES_NEXT_TO_CODE + +/* Compile-in ASSERTs in all ways. */ +#undef USE_ASSERTS_ALL_WAYS + +/* Enable single heap address space support */ +#undef USE_LARGE_ADDRESS_SPACE + +/* Set to 1 to use libdw */ +#undef USE_LIBDW + +/* Enable extensions on AIX, Interix, z/OS. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by C23 Annex F. */ +#ifndef __STDC_WANT_IEC_60559_EXT__ +# undef __STDC_WANT_IEC_60559_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define to 1 on platforms where this makes off_t a 64-bit type. */ +#undef _LARGE_FILES + +/* Number of bits in time_t, on hosts where this is settable. */ +#undef _TIME_BITS + +/* Define to 1 on platforms where this makes time_t a 64-bit type. */ +#undef __MINGW_USE_VC2005_COMPAT + +/* ARM pre v6 */ +#undef arm_HOST_ARCH_PRE_ARMv6 + +/* ARM pre v7 */ +#undef arm_HOST_ARCH_PRE_ARMv7 + +/* Define to empty if 'const' does not conform to ANSI C. */ +#undef const + +/* Define as a signed integer type capable of holding a process identifier. */ +#undef pid_t + +/* Define as 'unsigned int' if <stddef.h> doesn't define. */ +#undef size_t + +/* Define as 'fork' if 'vfork' does not work. */ +#undef vfork diff --git a/rts/ghcplatform.h.top.in b/rts/include/ghcplatform.h.in similarity index 87% rename from rts/ghcplatform.h.top.in rename to rts/include/ghcplatform.h.in index ebb1961a1f1..125645554d8 100644 --- a/rts/ghcplatform.h.top.in +++ b/rts/include/ghcplatform.h.in @@ -21,3 +21,7 @@ #define @HostVendor_CPP@_HOST_VENDOR 1 #define BUILD_VENDOR "@BuildVendor_CPP@" #define HOST_VENDOR "@HostVendor_CPP@" + +#define UnregisterisedCompiler @CABAL_FLAG_unregisterised@ + +#endif /* __GHCPLATFORM_H__ */ diff --git a/rts/include/ghcversion.h.in b/rts/include/ghcversion.h.in deleted file mode 100644 index dc700a4fbbf..00000000000 --- a/rts/include/ghcversion.h.in +++ /dev/null @@ -1,18 +0,0 @@ -#if !defined(__GHCVERSION_H__) -#define __GHCVERSION_H__ - -#define __GLASGOW_HASKELL__ @ProjectVersionInt@ -#define __GLASGOW_HASKELL_FULL_VERSION__ "@ProjectVersion@" - -#define __GLASGOW_HASKELL_PATCHLEVEL1__ @ProjectPatchLevel1@ -#define __GLASGOW_HASKELL_PATCHLEVEL2__ @ProjectPatchLevel2@ - -#define MIN_VERSION_GLASGOW_HASKELL(ma,mi,pl1,pl2) ( \ - ((ma)*100+(mi)) < __GLASGOW_HASKELL__ || \ - ((ma)*100+(mi)) == __GLASGOW_HASKELL__ \ - && (pl1) < __GLASGOW_HASKELL_PATCHLEVEL1__ || \ - ((ma)*100+(mi)) == __GLASGOW_HASKELL__ \ - && (pl1) == __GLASGOW_HASKELL_PATCHLEVEL1__ \ - && (pl2) <= __GLASGOW_HASKELL_PATCHLEVEL2__ ) - -#endif /* __GHCVERSION_H__ */ diff --git a/rts/include/rts/EventLogConstants.h b/rts/include/rts/EventLogConstants.h new file mode 100644 index 00000000000..44956698c93 --- /dev/null +++ b/rts/include/rts/EventLogConstants.h @@ -0,0 +1,82 @@ +#pragma once + +// When adding a new event type used by GHC you should also update +// NUM_GHC_EVENT_TAGS in include/rts/EventLogFormat.h. + +#define EVENT_CREATE_THREAD 0 +#define EVENT_RUN_THREAD 1 +#define EVENT_STOP_THREAD 2 +#define EVENT_THREAD_RUNNABLE 3 +#define EVENT_MIGRATE_THREAD 4 +#define EVENT_THREAD_WAKEUP 8 +#define EVENT_GC_START 9 +#define EVENT_GC_END 10 +#define EVENT_REQUEST_SEQ_GC 11 +#define EVENT_REQUEST_PAR_GC 12 +#define EVENT_CREATE_SPARK_THREAD 15 +#define EVENT_LOG_MSG 16 +#define EVENT_BLOCK_MARKER 18 +#define EVENT_USER_MSG 19 +#define EVENT_GC_IDLE 20 +#define EVENT_GC_WORK 21 +#define EVENT_GC_DONE 22 +#define EVENT_CAPSET_CREATE 25 +#define EVENT_CAPSET_DELETE 26 +#define EVENT_CAPSET_ASSIGN_CAP 27 +#define EVENT_CAPSET_REMOVE_CAP 28 +#define EVENT_RTS_IDENTIFIER 29 +#define EVENT_PROGRAM_ARGS 30 +#define EVENT_PROGRAM_ENV 31 +#define EVENT_OSPROCESS_PID 32 +#define EVENT_OSPROCESS_PPID 33 +#define EVENT_SPARK_COUNTERS 34 +#define EVENT_SPARK_CREATE 35 +#define EVENT_SPARK_DUD 36 +#define EVENT_SPARK_OVERFLOW 37 +#define EVENT_SPARK_RUN 38 +#define EVENT_SPARK_STEAL 39 +#define EVENT_SPARK_FIZZLE 40 +#define EVENT_SPARK_GC 41 +#define EVENT_INTERN_STRING 42 +#define EVENT_WALL_CLOCK_TIME 43 +#define EVENT_THREAD_LABEL 44 +#define EVENT_CAP_CREATE 45 +#define EVENT_CAP_DELETE 46 +#define EVENT_CAP_DISABLE 47 +#define EVENT_CAP_ENABLE 48 +#define EVENT_HEAP_ALLOCATED 49 +#define EVENT_HEAP_SIZE 50 +#define EVENT_HEAP_LIVE 51 +#define EVENT_HEAP_INFO_GHC 52 +#define EVENT_GC_STATS_GHC 53 +#define EVENT_GC_GLOBAL_SYNC 54 +#define EVENT_TASK_CREATE 55 +#define EVENT_TASK_MIGRATE 56 +#define EVENT_TASK_DELETE 57 +#define EVENT_USER_MARKER 58 +#define EVENT_HACK_BUG_T9003 59 +#define EVENT_MEM_RETURN 90 +#define EVENT_BLOCKS_SIZE 91 +#define EVENT_HEAP_PROF_BEGIN 160 +#define EVENT_HEAP_PROF_COST_CENTRE 161 +#define EVENT_HEAP_PROF_SAMPLE_BEGIN 162 +#define EVENT_HEAP_PROF_SAMPLE_COST_CENTRE 163 +#define EVENT_HEAP_PROF_SAMPLE_STRING 164 +#define EVENT_HEAP_PROF_SAMPLE_END 165 +#define EVENT_HEAP_BIO_PROF_SAMPLE_BEGIN 166 +#define EVENT_PROF_SAMPLE_COST_CENTRE 167 +#define EVENT_PROF_BEGIN 168 +#define EVENT_IPE 169 +#define EVENT_USER_BINARY_MSG 181 +#define EVENT_CONC_MARK_BEGIN 200 +#define EVENT_CONC_MARK_END 201 +#define EVENT_CONC_SYNC_BEGIN 202 +#define EVENT_CONC_SYNC_END 203 +#define EVENT_CONC_SWEEP_BEGIN 204 +#define EVENT_CONC_SWEEP_END 205 +#define EVENT_CONC_UPD_REM_SET_FLUSH 206 +#define EVENT_NONMOVING_HEAP_CENSUS 207 +#define EVENT_NONMOVING_PRUNED_SEGMENTS 208 +#define EVENT_TICKY_COUNTER_DEF 210 +#define EVENT_TICKY_COUNTER_SAMPLE 211 +#define EVENT_TICKY_COUNTER_BEGIN_SAMPLE 212 diff --git a/rts/include/rts/EventTypes.h b/rts/include/rts/EventTypes.h new file mode 100644 index 00000000000..4cf4acda8da --- /dev/null +++ b/rts/include/rts/EventTypes.h @@ -0,0 +1,392 @@ +#pragma once + +// When adding a new event type used by GHC you should also update +// NUM_GHC_EVENT_TAGS in include/rts/EventLogFormat.h. + +EventType eventTypes[] = { + [EVENT_CREATE_THREAD] = { + .etNum = EVENT_CREATE_THREAD, + .size = sizeof(EventThreadID), + .desc = "Create thread" + }, + [EVENT_RUN_THREAD] = { + .etNum = EVENT_RUN_THREAD, + .size = sizeof(EventThreadID), + .desc = "Run thread" + }, + [EVENT_STOP_THREAD] = { + .etNum = EVENT_STOP_THREAD, + .size = sizeof(EventThreadID) + sizeof(StgWord16) + sizeof(EventThreadID), + .desc = "Stop thread" + }, + [EVENT_THREAD_RUNNABLE] = { + .etNum = EVENT_THREAD_RUNNABLE, + .size = sizeof(EventThreadID), + .desc = "Thread runnable" + }, + [EVENT_MIGRATE_THREAD] = { + .etNum = EVENT_MIGRATE_THREAD, + .size = sizeof(EventThreadID) + sizeof(EventCapNo), + .desc = "Migrate thread" + }, + [EVENT_THREAD_WAKEUP] = { + .etNum = EVENT_THREAD_WAKEUP, + .size = sizeof(EventThreadID) + sizeof(EventCapNo), + .desc = "Wakeup thread" + }, + [EVENT_GC_START] = { + .etNum = EVENT_GC_START, + .size = 0, + .desc = "Starting GC" + }, + [EVENT_GC_END] = { + .etNum = EVENT_GC_END , + .size = 0, + .desc = "Finished GC" + }, + [EVENT_REQUEST_SEQ_GC] = { + .etNum = EVENT_REQUEST_SEQ_GC , + .size = 0, + .desc = "Request sequential GC" + }, + [EVENT_REQUEST_PAR_GC] = { + .etNum = EVENT_REQUEST_PAR_GC , + .size = 0, + .desc = "Request parallel GC" + }, + [EVENT_CREATE_SPARK_THREAD] = { + .etNum = EVENT_CREATE_SPARK_THREAD , + .size = sizeof(EventThreadID), + .desc = "Create spark thread" + }, + [EVENT_LOG_MSG] = { + .etNum = EVENT_LOG_MSG , + .size = 0xffff, + .desc = "Log message" + }, + [EVENT_BLOCK_MARKER] = { + .etNum = EVENT_BLOCK_MARKER , + .size = sizeof(StgWord32) + sizeof(EventTimestamp) + sizeof(EventCapNo), + .desc = "Block marker" + }, + [EVENT_USER_MSG] = { + .etNum = EVENT_USER_MSG , + .size = 0xffff, + .desc = "User message" + }, + [EVENT_GC_IDLE] = { + .etNum = EVENT_GC_IDLE , + .size = 0, + .desc = "GC idle" + }, + [EVENT_GC_WORK] = { + .etNum = EVENT_GC_WORK , + .size = 0, + .desc = "GC working" + }, + [EVENT_GC_DONE] = { + .etNum = EVENT_GC_DONE , + .size = 0, + .desc = "GC done" + }, + [EVENT_CAPSET_CREATE] = { + .etNum = EVENT_CAPSET_CREATE , + .size = sizeof(EventCapsetID) + sizeof(EventCapsetType), + .desc = "Create capability set" + }, + [EVENT_CAPSET_DELETE] = { + .etNum = EVENT_CAPSET_DELETE , + .size = sizeof(EventCapsetID), + .desc = "Delete capability set" + }, + [EVENT_CAPSET_ASSIGN_CAP] = { + .etNum = EVENT_CAPSET_ASSIGN_CAP , + .size = sizeof(EventCapsetID) + sizeof(EventCapNo), + .desc = "Add capability to capability set" + }, + [EVENT_CAPSET_REMOVE_CAP] = { + .etNum = EVENT_CAPSET_REMOVE_CAP , + .size = sizeof(EventCapsetID) + sizeof(EventCapNo), + .desc = "Remove capability from capability set" + }, + [EVENT_RTS_IDENTIFIER] = { + .etNum = EVENT_RTS_IDENTIFIER , + .size = 0xffff, + .desc = "RTS name and version" + }, + [EVENT_PROGRAM_ARGS] = { + .etNum = EVENT_PROGRAM_ARGS , + .size = 0xffff, + .desc = "Program arguments" + }, + [EVENT_PROGRAM_ENV] = { + .etNum = EVENT_PROGRAM_ENV , + .size = 0xffff, + .desc = "Program environment variables" + }, + [EVENT_OSPROCESS_PID] = { + .etNum = EVENT_OSPROCESS_PID , + .size = sizeof(EventCapsetID) + sizeof(StgWord32), + .desc = "Process ID" + }, + [EVENT_OSPROCESS_PPID] = { + .etNum = EVENT_OSPROCESS_PPID , + .size = sizeof(EventCapsetID) + sizeof(StgWord32), + .desc = "Parent process ID" + }, + [EVENT_SPARK_COUNTERS] = { + .etNum = EVENT_SPARK_COUNTERS , + .size = sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64), + .desc = "Spark counters" + }, + [EVENT_SPARK_CREATE] = { + .etNum = EVENT_SPARK_CREATE , + .size = 0, + .desc = "Spark create" + }, + [EVENT_SPARK_DUD] = { + .etNum = EVENT_SPARK_DUD , + .size = 0, + .desc = "Spark dud" + }, + [EVENT_SPARK_OVERFLOW] = { + .etNum = EVENT_SPARK_OVERFLOW , + .size = 0, + .desc = "Spark overflow" + }, + [EVENT_SPARK_RUN] = { + .etNum = EVENT_SPARK_RUN , + .size = 0, + .desc = "Spark run" + }, + [EVENT_SPARK_STEAL] = { + .etNum = EVENT_SPARK_STEAL , + .size = sizeof(EventCapNo), + .desc = "Spark steal" + }, + [EVENT_SPARK_FIZZLE] = { + .etNum = EVENT_SPARK_FIZZLE , + .size = 0, + .desc = "Spark fizzle" + }, + [EVENT_SPARK_GC] = { + .etNum = EVENT_SPARK_GC , + .size = 0, + .desc = "Spark GC" + }, + [EVENT_INTERN_STRING] = { + .etNum = EVENT_INTERN_STRING , + .size = 0xffff, + .desc = "Intern string" + }, + [EVENT_WALL_CLOCK_TIME] = { + .etNum = EVENT_WALL_CLOCK_TIME , + .size = sizeof(EventCapsetID) + sizeof(StgWord64) + sizeof(StgWord32), + .desc = "Wall clock time" + }, + [EVENT_THREAD_LABEL] = { + .etNum = EVENT_THREAD_LABEL , + .size = 0xffff, + .desc = "Thread label" + }, + [EVENT_CAP_CREATE] = { + .etNum = EVENT_CAP_CREATE , + .size = sizeof(EventCapNo), + .desc = "Create capability" + }, + [EVENT_CAP_DELETE] = { + .etNum = EVENT_CAP_DELETE , + .size = sizeof(EventCapNo), + .desc = "Delete capability" + }, + [EVENT_CAP_DISABLE] = { + .etNum = EVENT_CAP_DISABLE , + .size = sizeof(EventCapNo), + .desc = "Disable capability" + }, + [EVENT_CAP_ENABLE] = { + .etNum = EVENT_CAP_ENABLE , + .size = sizeof(EventCapNo), + .desc = "Enable capability" + }, + [EVENT_HEAP_ALLOCATED] = { + .etNum = EVENT_HEAP_ALLOCATED , + .size = sizeof(EventCapsetID) + sizeof(StgWord64), + .desc = "Total heap memory ever allocated" + }, + [EVENT_HEAP_SIZE] = { + .etNum = EVENT_HEAP_SIZE , + .size = sizeof(EventCapsetID) + sizeof(StgWord64), + .desc = "Current heap size (number of allocated mblocks)" + }, + [EVENT_HEAP_LIVE] = { + .etNum = EVENT_HEAP_LIVE , + .size = sizeof(EventCapsetID) + sizeof(StgWord64), + .desc = "Current heap live data" + }, + [EVENT_HEAP_INFO_GHC] = { + .etNum = EVENT_HEAP_INFO_GHC , + .size = sizeof(EventCapsetID) + sizeof(StgWord16) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64), + .desc = "Heap static parameters" + }, + [EVENT_GC_STATS_GHC] = { + .etNum = EVENT_GC_STATS_GHC , + .size = sizeof(EventCapsetID) + sizeof(StgWord16) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord32) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64), + .desc = "GC statistics" + }, + [EVENT_GC_GLOBAL_SYNC] = { + .etNum = EVENT_GC_GLOBAL_SYNC , + .size = 0, + .desc = "Synchronise stop-the-world GC" + }, + [EVENT_TASK_CREATE] = { + .etNum = EVENT_TASK_CREATE , + .size = sizeof(EventTaskId) + sizeof(EventCapNo) + sizeof(EventKernelThreadId), + .desc = "Task create" + }, + [EVENT_TASK_MIGRATE] = { + .etNum = EVENT_TASK_MIGRATE , + .size = sizeof(EventTaskId) + sizeof(EventCapNo) + sizeof(EventCapNo), + .desc = "Task migrate" + }, + [EVENT_TASK_DELETE] = { + .etNum = EVENT_TASK_DELETE , + .size = sizeof(EventTaskId), + .desc = "Task delete" + }, + [EVENT_USER_MARKER] = { + .etNum = EVENT_USER_MARKER , + .size = 0xffff, + .desc = "User marker" + }, + [EVENT_HACK_BUG_T9003] = { + .etNum = EVENT_HACK_BUG_T9003 , + .size = 0, + .desc = "Empty event for bug #9003" + }, + [EVENT_MEM_RETURN] = { + .etNum = EVENT_MEM_RETURN , + .size = sizeof(EventCapsetID) + sizeof(StgWord32) + sizeof(StgWord32) + sizeof(StgWord32), + .desc = "The RTS attempted to return heap memory to the OS" + }, + [EVENT_BLOCKS_SIZE] = { + .etNum = EVENT_BLOCKS_SIZE , + .size = sizeof(EventCapsetID) + sizeof(StgWord64), + .desc = "Report the size of the heap in blocks" + }, + [EVENT_HEAP_PROF_BEGIN] = { + .etNum = EVENT_HEAP_PROF_BEGIN, + .size = 0xffff, + .desc = "Start of heap profile" + }, + [EVENT_HEAP_PROF_COST_CENTRE] = { + .etNum = EVENT_HEAP_PROF_COST_CENTRE, + .size = 0xffff, + .desc = "Cost-centre definition" + }, + [EVENT_HEAP_PROF_SAMPLE_BEGIN] = { + .etNum = EVENT_HEAP_PROF_SAMPLE_BEGIN, + .size = sizeof(StgWord64), + .desc = "Start of heap profile sample" + }, + [EVENT_HEAP_PROF_SAMPLE_COST_CENTRE] = { + .etNum = EVENT_HEAP_PROF_SAMPLE_COST_CENTRE, + .size = 0xffff, + .desc = "Heap profile cost-centre sample" + }, + [EVENT_HEAP_PROF_SAMPLE_STRING] = { + .etNum = EVENT_HEAP_PROF_SAMPLE_STRING, + .size = 0xffff, + .desc = "Heap profile string sample" + }, + [EVENT_HEAP_PROF_SAMPLE_END] = { + .etNum = EVENT_HEAP_PROF_SAMPLE_END, + .size = sizeof(StgWord64), + .desc = "End of heap profile sample" + }, + [EVENT_HEAP_BIO_PROF_SAMPLE_BEGIN] = { + .etNum = EVENT_HEAP_BIO_PROF_SAMPLE_BEGIN, + .size = sizeof(StgWord64) + sizeof(StgWord64), + .desc = "Start of heap profile (biographical) sample" + }, + [EVENT_PROF_SAMPLE_COST_CENTRE] = { + .etNum = EVENT_PROF_SAMPLE_COST_CENTRE, + .size = 0xffff, + .desc = "Time profile cost-centre stack" + }, + [EVENT_PROF_BEGIN] = { + .etNum = EVENT_PROF_BEGIN, + .size = sizeof(StgWord64), + .desc = "Start of a time profile" + }, + [EVENT_IPE] = { + .etNum = EVENT_IPE, + .size = 0xffff, + .desc = "An IPE entry" + }, + [EVENT_USER_BINARY_MSG] = { + .etNum = EVENT_USER_BINARY_MSG, + .size = 0xffff, + .desc = "User binary message" + }, + [EVENT_CONC_MARK_BEGIN] = { + .etNum = EVENT_CONC_MARK_BEGIN, + .size = 0, + .desc = "Begin concurrent mark phase" + }, + [EVENT_CONC_MARK_END] = { + .etNum = EVENT_CONC_MARK_END, + .size = sizeof(StgWord32), + .desc = "End concurrent mark phase" + }, + [EVENT_CONC_SYNC_BEGIN] = { + .etNum = EVENT_CONC_SYNC_BEGIN, + .size = 0, + .desc = "Begin concurrent GC synchronisation" + }, + [EVENT_CONC_SYNC_END] = { + .etNum = EVENT_CONC_SYNC_END, + .size = 0, + .desc = "End concurrent mark synchronisation" + }, + [EVENT_CONC_SWEEP_BEGIN] = { + .etNum = EVENT_CONC_SWEEP_BEGIN, + .size = 0, + .desc = "Begin concurrent sweep phase" + }, + [EVENT_CONC_SWEEP_END] = { + .etNum = EVENT_CONC_SWEEP_END, + .size = 0, + .desc = "End concurrent sweep phase" + }, + [EVENT_CONC_UPD_REM_SET_FLUSH] = { + .etNum = EVENT_CONC_UPD_REM_SET_FLUSH, + .size = sizeof(EventCapNo), + .desc = "Update remembered set flushed" + }, + [EVENT_NONMOVING_HEAP_CENSUS] = { + .etNum = EVENT_NONMOVING_HEAP_CENSUS, + .size = sizeof(StgWord16) + sizeof(StgWord32) + sizeof(StgWord32) + sizeof(StgWord32), + .desc = "Nonmoving heap census" + }, + [EVENT_NONMOVING_PRUNED_SEGMENTS] = { + .etNum = EVENT_NONMOVING_PRUNED_SEGMENTS, + .size = sizeof(StgWord32) + sizeof(StgWord32), + .desc = "Report the amount of segments pruned and remaining on the free list." + }, + [EVENT_TICKY_COUNTER_DEF] = { + .etNum = EVENT_TICKY_COUNTER_DEF, + .size = 0xffff, + .desc = "Ticky-ticky entry counter definition" + }, + [EVENT_TICKY_COUNTER_SAMPLE] = { + .etNum = EVENT_TICKY_COUNTER_SAMPLE, + .size = sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64) + sizeof(StgWord64), + .desc = "Ticky-ticky entry counter sample" + }, + [EVENT_TICKY_COUNTER_BEGIN_SAMPLE] = { + .etNum = EVENT_TICKY_COUNTER_BEGIN_SAMPLE, + .size = 0, + .desc = "Ticky-ticky entry counter begin sample" + }, +}; diff --git a/rts/include/rts/storage/ClosureMacros.h b/rts/include/rts/storage/ClosureMacros.h index 1dcba95dd9a..3f1785bb96e 100644 --- a/rts/include/rts/storage/ClosureMacros.h +++ b/rts/include/rts/storage/ClosureMacros.h @@ -74,7 +74,7 @@ EXTERN_INLINE StgRetInfoTable *itbl_to_ret_itbl (const StgInfoTable *i); EXTERN_INLINE StgThunkInfoTable *itbl_to_thunk_itbl (const StgInfoTable *i); EXTERN_INLINE StgConInfoTable *itbl_to_con_itbl (const StgInfoTable *i); -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE NO_WARN(-Warray-bounds, EXTERN_INLINE StgInfoTable *INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgInfoTable *)info - 1;} EXTERN_INLINE StgRetInfoTable *RET_INFO_PTR_TO_STRUCT(const StgInfoTable *info) {return (StgRetInfoTable *)info - 1;} diff --git a/rts/include/rts/storage/InfoTables.h b/rts/include/rts/storage/InfoTables.h index 4f4ad6c1635..3681a53448b 100644 --- a/rts/include/rts/storage/InfoTables.h +++ b/rts/include/rts/storage/InfoTables.h @@ -39,7 +39,7 @@ -------------------------------------------------------------------------- */ typedef struct { -#if !defined(TABLES_NEXT_TO_CODE) +#if !TABLES_NEXT_TO_CODE char *closure_type; char *closure_desc; #else @@ -145,7 +145,7 @@ typedef union { StgWord bitmap; /* word-sized bit pattern describing */ /* a stack frame: see below */ -#if !defined(TABLES_NEXT_TO_CODE) +#if !TABLES_NEXT_TO_CODE StgLargeBitmap* large_bitmap; /* pointer to large bitmap structure */ #else OFFSET_FIELD(large_bitmap_offset); /* offset from info table to large bitmap structure */ @@ -161,12 +161,12 @@ typedef union { // Note [SRTs] in GHC.Cmm.Info.Build. // // Specifically we define one of the following: -#if WORD_SIZE_IN_BITS == 64 && defined(TABLES_NEXT_TO_CODE) +#if WORD_SIZE_IN_BITS == 64 && TABLES_NEXT_TO_CODE // On 64-bit platforms using the small memory model we can fit a pointer // offset in half a word, so put the SRT offset in the info->srt field // directly. #define USE_INLINE_SRT_FIELD -#elif defined(TABLES_NEXT_TO_CODE) +#elif TABLES_NEXT_TO_CODE // Otherwise use the srt_offset field... #define USE_SRT_OFFSET #else @@ -188,7 +188,7 @@ typedef StgHalfWord StgSRTField; */ typedef struct StgInfoTable_ { -#if !defined(TABLES_NEXT_TO_CODE) +#if !TABLES_NEXT_TO_CODE StgFunPtr entry; /* pointer to the entry code */ #endif @@ -209,7 +209,7 @@ typedef struct StgInfoTable_ { - non-zero if there is an SRT, offset is in srt_offset */ -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE StgCode code[]; #endif } *StgInfoTablePtr; // StgInfoTable defined in rts/Types.h @@ -266,7 +266,7 @@ typedef struct StgFunInfoExtraFwd_ { } StgFunInfoExtraFwd; typedef struct { -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE StgFunInfoExtraRev f; StgInfoTable i; #else @@ -325,18 +325,18 @@ typedef struct StgThunkInfoTable_ { -------------------------------------------------------------------------- */ typedef struct StgConInfoTable_ { -#if !defined(TABLES_NEXT_TO_CODE) +#if !TABLES_NEXT_TO_CODE StgInfoTable i; #endif -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE OFFSET_FIELD(con_desc); // the name of the data constructor // as: Package:Module.Name #else char *con_desc; #endif -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE StgInfoTable i; #endif } StgConInfoTable; @@ -364,7 +364,7 @@ typedef struct StgConInfoTable_ { * GET_CON_DESC(info) * info must be a StgConInfoTable*. */ -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define GET_CON_DESC(info) \ ((const char *)((StgWord)((info)+1) + ((info)->con_desc))) #else @@ -385,14 +385,14 @@ typedef struct StgConInfoTable_ { #define GET_FUN_SRT(info) ((info)->f.srt) #endif -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define GET_LARGE_BITMAP(info) ((StgLargeBitmap*) (((StgWord) ((info)+1)) \ + (info)->layout.large_bitmap_offset)) #else #define GET_LARGE_BITMAP(info) ((info)->layout.large_bitmap) #endif -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define GET_FUN_LARGE_BITMAP(info) ((StgLargeBitmap*) (((StgWord) ((info)+1)) \ + (info)->f.b.bitmap_offset)) #else @@ -402,12 +402,12 @@ typedef struct StgConInfoTable_ { /* * GET_PROF_TYPE, GET_PROF_DESC */ -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define GET_PROF_TYPE(info) ((char *)((StgWord)((info)+1) + (info->prof.closure_type_off))) #else #define GET_PROF_TYPE(info) ((info)->prof.closure_type) #endif -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE #define GET_PROF_DESC(info) ((char *)((StgWord)((info)+1) + (info->prof.closure_desc_off))) #else #define GET_PROF_DESC(info) ((info)->prof.closure_desc) diff --git a/rts/include/stg/MachRegsForHost.h b/rts/include/stg/MachRegsForHost.h index 7c045c0214b..cd28215ea0f 100644 --- a/rts/include/stg/MachRegsForHost.h +++ b/rts/include/stg/MachRegsForHost.h @@ -84,4 +84,4 @@ #endif -#include "MachRegs.h" +#include "stg/MachRegs.h" diff --git a/rts/include/stg/MiscClosures.h b/rts/include/stg/MiscClosures.h index 799b1ecb2c4..b02cf9dfba6 100644 --- a/rts/include/stg/MiscClosures.h +++ b/rts/include/stg/MiscClosures.h @@ -35,7 +35,7 @@ # define RTS_FUN_DECL(f) extern DLL_IMPORT_RTS StgFunPtr f(void) #endif -#if defined(TABLES_NEXT_TO_CODE) +#if TABLES_NEXT_TO_CODE # define RTS_RET(f) RTS_INFO(f##_info) # define RTS_ENTRY(f) RTS_INFO(f##_info) # define RTS_FUN(f) RTS_FUN_INFO(f##_info) diff --git a/rts/posix/Ticker.c b/rts/posix/Ticker.c index 18bf1179dde..d6ebfbd4a21 100644 --- a/rts/posix/Ticker.c +++ b/rts/posix/Ticker.c @@ -88,21 +88,10 @@ #endif #if defined(solaris2_HOST_OS) -/* USE_TIMER_CREATE is usually disabled for Solaris. In fact it is - supported well on this OS, but requires additional privilege. When - user does not have it, then the testing configure program fails - which results in USE_TIMER_CREATE not defined. - On the other hand when we cross-compile, then we optimistically - assume usage of timer_create function. The problem is that if we - cross compile for example from i386-solaris2 to x86_64-solaris2, - then the build fails with error like this: - -ghc-stage2: timer_create: Not owner - - which happens on first ghc-stage2 invocation. So to support - cross-compilation to Solaris we manually undefine USE_TIMER_CREATE +/* While timer_create is supported well on Solaris, it requires + additional privilege. So we manually undefine HAVE_TIMER_CREATE here */ -#undef USE_TIMER_CREATE +#undef HAVE_TIMER_CREATE #endif /* solaris2_HOST_OS */ // Select the variant to use @@ -110,7 +99,7 @@ ghc-stage2: timer_create: Not owner #include "ticker/TimerFd.c" #elif defined(USE_PTHREAD_FOR_ITIMER) #include "ticker/Pthread.c" -#elif defined(USE_TIMER_CREATE) +#elif defined(HAVE_TIMER_CREATE) #include "ticker/TimerCreate.c" #else #include "ticker/Setitimer.c" diff --git a/rts/rts.buildinfo.in b/rts/rts.buildinfo.in index 4e8c9e540ab..6128f5eb11f 100644 --- a/rts/rts.buildinfo.in +++ b/rts/rts.buildinfo.in @@ -1,3 +1,2 @@ --- External symbols referenced by the RTS -ld-options: -#include "external-symbols.flags" +ld-options: @LDFLAGS@ +cc-options: @CPPFLAGS@ @CFLAGS@ diff --git a/rts/rts.cabal b/rts/rts.cabal index 612eae6bb27..5981039678f 100644 --- a/rts/rts.cabal +++ b/rts/rts.cabal @@ -1,4 +1,4 @@ -cabal-version: 3.4 +cabal-version: 3.14 name: rts version: 1.0.3 synopsis: The GHC runtime system @@ -9,17 +9,14 @@ description: that cannot be written in Haskell itself. license: BSD-3-Clause maintainer: glasgow-haskell-users@haskell.org -build-type: Configure +build-type: Custom extra-source-files: configure config.guess config.sub - ghcplatform.h.top.in - ghcplatform.h.bottom - ghcautoconf.h.autoconf.in configure.ac - external-symbols.list.in + external-symbols.list rts.buildinfo.in linker/ELFRelocs/AArch64.def linker/ELFRelocs/ARM.def @@ -55,20 +52,20 @@ extra-source-files: FileLock.h ForeignExports.h fs_rts.h - fs.h GetEnv.h GetTime.h Globals.h Hash.h hooks/Hooks.h include/Cmm.h + include/ghcautoconf.h.in + include/ghcplatform.h.in include/ghcconfig.h include/HsFFI.h include/MachDeps.h include/rts/Adjustor.h include/RtsAPI.h include/rts/BlockSignals.h - include/rts/Bytecodes.h include/rts/Config.h include/rts/Constants.h include/rts/EventLogFormat.h @@ -105,9 +102,6 @@ extra-source-files: include/rts/StaticPtrTable.h include/rts/storage/Block.h include/rts/storage/ClosureMacros.h - include/rts/storage/Closures.h - include/rts/storage/ClosureTypes.h - include/rts/storage/FunTypes.h include/rts/storage/GC.h include/rts/storage/HeapAlloc.h include/rts/storage/Heap.h @@ -124,16 +118,7 @@ extra-source-files: include/rts/Utils.h include/stg/DLL.h include/Stg.h - include/stg/MachRegs/arm32.h - include/stg/MachRegs/arm64.h include/stg/MachRegsForHost.h - include/stg/MachRegs.h - include/stg/MachRegs/loongarch64.h - include/stg/MachRegs/ppc.h - include/stg/MachRegs/riscv64.h - include/stg/MachRegs/s390x.h - include/stg/MachRegs/wasm32.h - include/stg/MachRegs/x86.h include/stg/MiscClosures.h include/stg/Prim.h include/stg/Regs.h @@ -301,13 +286,13 @@ flag static-libzstd default: False manual: True flag leading-underscore - default: False + default: True manual: True flag unregisterised default: False manual: True flag tables-next-to-code - default: False + default: True manual: True flag smp default: True @@ -340,6 +325,10 @@ flag thread-sanitizer default: False manual: True +custom-setup + setup-depends: + base, Cabal > 3.14.0.0, Cabal-syntax >= 3.15.0.0, mtl, transformers, containers, directory + library -- rts is a wired in package and -- expects the unit-id to be @@ -347,9 +336,22 @@ library ghc-options: -this-unit-id rts cmm-options: -this-unit-id rts + build-tool-depends: genapply:genapply, deriveConstants:deriveConstants + exposed: True exposed-modules: + autogen-includes: + ghcautoconf.h + ghcplatform.h + DerivedConstants.h + + install-includes: + ghcautoconf.h + ghcplatform.h + DerivedConstants.h + stg/MachRegsForHost.h + if arch(javascript) include-dirs: include @@ -384,18 +386,7 @@ library js/time.js install-includes: HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h - ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h - DerivedConstants.h - stg/MachRegs.h - stg/MachRegs/arm32.h - stg/MachRegs/arm64.h - stg/MachRegs/loongarch64.h - stg/MachRegs/ppc.h - stg/MachRegs/riscv64.h - stg/MachRegs/s390x.h - stg/MachRegs/wasm32.h - stg/MachRegs/x86.h - stg/MachRegsForHost.h + ghcconfig.h ghcplatform.h stg/Types.h else @@ -496,11 +487,9 @@ library -- TODO: move internal headers into include/private? include-dirs: . includes: Rts.h - autogen-includes: ghcautoconf.h ghcplatform.h install-includes: Cmm.h HsFFI.h MachDeps.h Jumps.h Rts.h RtsAPI.h RtsSymbols.h Stg.h - ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h + ghcconfig.h ghcplatform.h -- ^ from include - DerivedConstants.h rts/EventLogConstants.h rts/EventTypes.h -- ^ generated @@ -508,7 +497,6 @@ library rts/Adjustor.h rts/ExecPage.h rts/BlockSignals.h - rts/Bytecodes.h rts/Config.h rts/Constants.h rts/EventLogFormat.h @@ -550,9 +538,7 @@ library rts/prof/LDV.h rts/storage/Block.h rts/storage/ClosureMacros.h - rts/storage/ClosureTypes.h rts/storage/Closures.h - rts/storage/FunTypes.h rts/storage/Heap.h rts/storage/HeapAlloc.h rts/storage/GC.h @@ -560,16 +546,6 @@ library rts/storage/MBlock.h rts/storage/TSO.h stg/DLL.h - stg/MachRegs.h - stg/MachRegs/arm32.h - stg/MachRegs/arm64.h - stg/MachRegs/loongarch64.h - stg/MachRegs/ppc.h - stg/MachRegs/riscv64.h - stg/MachRegs/s390x.h - stg/MachRegs/wasm32.h - stg/MachRegs/x86.h - stg/MachRegsForHost.h stg/MiscClosures.h stg/Prim.h stg/Regs.h @@ -584,34 +560,38 @@ library if !arch(x86_64) && !arch(aarch64) ld-options: -read_only_relocs warning - cmm-sources: Apply.cmm - Compact.cmm - ContinuationOps.cmm - Exception.cmm - HeapStackCheck.cmm - Jumps_D.cmm - Jumps_V16.cmm - PrimOps.cmm - StgMiscClosures.cmm - StgStartup.cmm - StgStdThunks.cmm - Updates.cmm - -- AutoApply is generated - AutoApply.cmm - AutoApply_V16.cmm + cmm-sources: + Apply.cmm + Compact.cmm + ContinuationOps.cmm + Exception.cmm + HeapStackCheck.cmm + Jumps_D.cmm + Jumps_V16.cmm + PrimOps.cmm + StgMiscClosures.cmm + StgStartup.cmm + StgStdThunks.cmm + Updates.cmm + + autogen-cmm-sources: + AutoApply.cmm + AutoApply_V16.cmm if arch(x86_64) cmm-sources: - AutoApply_V32.cmm (-mavx2) - AutoApply_V64.cmm (-mavx512f) Jumps_V32.cmm (-mavx2) Jumps_V64.cmm (-mavx512f) + autogen-cmm-sources: + AutoApply_V32.cmm (-mavx2) + AutoApply_V64.cmm (-mavx512f) else cmm-sources: - AutoApply_V32.cmm - AutoApply_V64.cmm Jumps_V32.cmm Jumps_V64.cmm + autogen-cmm-sources: + AutoApply_V32.cmm + AutoApply_V64.cmm -- we always link against libffi, even without libffi-adjustors extra-libraries: ffi @@ -766,7 +746,6 @@ library sm/Scav_thr.c sm/Storage.c sm/Sweep.c - fs.c -- I wish we had wildcards..., this would be: -- *.c hooks/**/*.c sm/**/*.c eventlog/**/*.c linker/**/*.c @@ -810,6 +789,10 @@ library -- We don't want to compile posix/ticker/*.c, these will be #included -- from Ticker.c + build-depends: + rts-headers, + rts-fs + -- Note [Undefined symbols in the RTS] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- The RTS is built with a number of `-u` flags. This is to handle cyclic diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index 604f1c55c16..2a3245a1fcb 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -198,6 +198,12 @@ main = getArgs >>= \args -> "--make-haskell-source" -> putStr (gen_hs_source p_o_specs) + "--wrappers-module" + -> putStr (gen_wrappers_module p_o_specs) + + "--prim-module" + -> putStr (gen_hs_source_module p_o_specs) + "--wired-in-docs" -> putStr (gen_wired_in_docs p_o_specs) @@ -229,13 +235,18 @@ known_args "--make-haskell-source", "--make-latex-doc", "--wired-in-docs", - "--wired-in-deprecations" + "--wired-in-deprecations", + "--wrappers-module", + "--prim-module" ] ------------------------------------------------------------------ -- Code generators ----------------------------------------------- ------------------------------------------------------------------ +gen_hs_source_module :: Info -> String +gen_hs_source_module info = "primOpPrimModule = " ++ show (gen_hs_source info) + gen_hs_source :: Info -> String gen_hs_source (Info defaults entries) = "{-\n" @@ -461,6 +472,9 @@ In PrimopWrappers we set some crucial GHC options a very simple module and there is no optimisation to be done -} +gen_wrappers_module :: Info -> String +gen_wrappers_module info = "primOpWrappersModule = " ++ show (gen_wrappers info) + gen_wrappers :: Info -> String gen_wrappers (Info _ entries) = "-- | Users should not import this module. It is GHC internal only.\n" diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 14684dc9649..3b62bbd6c8f 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -268,6 +268,10 @@ usageHeader prog = substProg prog $ " for input for the graphviz tools. For example, to generate a PDF\n" ++ " of the dependency graph: ghc-pkg dot | tred | dot -Tpdf >pkgs.pdf\n" ++ "\n" ++ + " $p mermaid\n" ++ + " Generate a graph of the package dependencies in Mermaid format\n" ++ + " suitable for embedding in Markdown files.\n" ++ + "\n" ++ " $p find-module {module}\n" ++ " List registered packages exposing module {module} in the global\n" ++ " database, and also the user database if --user is given.\n" ++ @@ -464,6 +468,8 @@ runit verbosity cli nonopts = do (Just (Substring pkgarg_str m)) Nothing ["dot"] -> do showPackageDot verbosity cli + ["mermaid"] -> do + showPackageMermaid verbosity cli ["find-module", mod_name] -> do let match = maybe (==mod_name) id (substringCheck mod_name) listPackages verbosity cli Nothing (Just match) @@ -1643,6 +1649,27 @@ showPackageDot verbosity myflags = do ] putStrLn "}" +showPackageMermaid :: Verbosity -> [Flag] -> IO () +showPackageMermaid verbosity myflags = do + (_, GhcPkg.DbOpenReadOnly, flag_db_stack) <- + getPkgDatabases verbosity GhcPkg.DbOpenReadOnly + False{-use user-} True{-use cache-} False{-expand vars-} myflags + + let all_pkgs = allPackagesInStack flag_db_stack + ipix = PackageIndex.fromList all_pkgs + + putStrLn "```mermaid" + putStrLn "graph TD" + mapM_ putStrLn [ " " ++ from ++ " --> " ++ to + | p <- all_pkgs, + let from = display (mungedId p), + key <- depends p, + Just dep <- [PackageIndex.lookupUnitId ipix key], + let to = display (mungedId dep) + ] + putStrLn "```" + + -- ----------------------------------------------------------------------------- -- Prints the highest (hidden or exposed) version of a package diff --git a/utils/ghc-pkg/ghc-pkg.cabal.in b/utils/ghc-pkg/ghc-pkg.cabal similarity index 86% rename from utils/ghc-pkg/ghc-pkg.cabal.in rename to utils/ghc-pkg/ghc-pkg.cabal index b40a6efe042..d42676ff859 100644 --- a/utils/ghc-pkg/ghc-pkg.cabal.in +++ b/utils/ghc-pkg/ghc-pkg.cabal @@ -1,10 +1,8 @@ +cabal-version: 3.0 Name: ghc-pkg --- XXX Version number -Version: @ProjectVersion@ -Copyright: XXX -License: BSD3 --- XXX License-File: LICENSE -Author: XXX +-- ProjectVersion +Version: 9.13 +License: BSD-3-Clause Maintainer: cvs-fptools@haskell.org Synopsis: A utility for querying and managing the GHC package database. Description: @@ -13,7 +11,6 @@ Description: usage information. Category: Development build-type: Simple -cabal-version: >=1.10 Executable ghc-pkg Default-Language: GHC2021 diff --git a/utils/ghc-toolchain/exe/Main.hs b/utils/ghc-toolchain/exe/Main.hs index 09f009f554a..0a036ae55a1 100644 --- a/utils/ghc-toolchain/exe/Main.hs +++ b/utils/ghc-toolchain/exe/Main.hs @@ -55,6 +55,8 @@ data Opts = Opts , optReadelf :: ProgOpt , optMergeObjs :: ProgOpt , optWindres :: ProgOpt + , optOtool :: ProgOpt + , optInstallNameTool :: ProgOpt -- Note we don't actually configure LD into anything but -- see #23857 and #22550 for the very unfortunate story. , optLd :: ProgOpt @@ -103,6 +105,8 @@ emptyOpts = Opts , optReadelf = po0 , optMergeObjs = po0 , optWindres = po0 + , optOtool = po0 + , optInstallNameTool = po0 , optLd = po0 , optUnregisterised = Nothing , optTablesNextToCode = Nothing @@ -131,6 +135,8 @@ _optNm = Lens optNm (\x o -> o {optNm=x}) _optReadelf = Lens optReadelf (\x o -> o {optReadelf=x}) _optMergeObjs = Lens optMergeObjs (\x o -> o {optMergeObjs=x}) _optWindres = Lens optWindres (\x o -> o {optWindres=x}) +_optOtool = Lens optOtool (\x o -> o {optOtool =x}) +_optInstallNameTool = Lens optInstallNameTool (\x o -> o {optInstallNameTool=x}) _optLd = Lens optLd (\x o -> o {optLd= x}) _optTriple :: Lens Opts (Maybe String) @@ -192,6 +198,8 @@ options = , progOpts "readelf" "readelf utility" _optReadelf , progOpts "merge-objs" "linker for merging objects" _optMergeObjs , progOpts "windres" "windres utility" _optWindres + , progOpts "otool" "otool utility" _optOtool + , progOpts "install-name-tool" "install_name_tool utility" _optInstallNameTool , progOpts "ld" "linker" _optLd ] where @@ -456,6 +464,20 @@ mkTarget opts = do return (Just windres) _ -> return Nothing + otool <- + case archOS_OS archOs of + OSDarwin -> do + otool <- findProgram "otool" (optOtool opts) ["otool"] + return (Just otool) + _ -> return Nothing + + install_name_tool <- + case archOS_OS archOs of + OSDarwin -> do + install_name_tool <- findProgram "install_name_tool" (optInstallNameTool opts) ["install_name_tool"] + return (Just install_name_tool) + _ -> return Nothing + -- various other properties of the platform tgtWordSize <- checkWordSize cc tgtEndianness <- checkEndianness cc @@ -493,6 +515,8 @@ mkTarget opts = do , tgtNm = nm , tgtMergeObjs = mergeObjs , tgtWindres = windres + , tgtOtool = otool + , tgtInstallNameTool = install_name_tool , tgtWordSize , tgtEndianness , tgtUnregisterised @@ -538,9 +562,9 @@ targetToSettings tgt@Target{..} = , ("ar supports at file", arSupportsAtFile') , ("ar supports -L", arSupportsDashL') , ("ranlib command", ranlibPath) - , ("otool command", otool_cmd) - , ("install_name_tool command", install_name_cmd) - , ("windres command", (maybe "/bin/false" prgPath tgtWindres)) -- TODO: /bin/false is not available on many distributions by default, but we keep it as it were before the ghc-toolchain patch. Fix-me. + , ("otool command", maybe "otool" prgPath tgtOtool) + , ("install_name_tool command", maybe "install_name_tool" prgPath tgtInstallNameTool) + , ("windres command", maybe "/bin/false" prgPath tgtWindres) -- TODO: /bin/false is not available on many distributions by default, but we keep it as it were before the ghc-toolchain patch. Fix-me. , ("unlit command", "$topdir/../bin/unlit") -- FIXME , ("cross compiling", yesNo False) -- FIXME: why do we need this settings at all? , ("target platform string", targetPlatformTriple tgt) @@ -566,7 +590,7 @@ targetToSettings tgt@Target{..} = , ("Leading underscore", (yesNo tgtSymbolsHaveLeadingUnderscore)) , ("Use LibFFI", yesNo tgtUseLibffiForAdjustors) , ("RTS expects libdw", yesNo False) -- FIXME - , ("Relative Global Package DB", "") + , ("Relative Global Package DB", "package.conf.d") , ("base unit-id", "") ] where @@ -576,8 +600,6 @@ targetToSettings tgt@Target{..} = wordSize = show (wordSize2Bytes tgtWordSize) isBigEndian = yesNo $ (\case BigEndian -> True; LittleEndian -> False) tgtEndianness - otool_cmd = "" -- FIXME - install_name_cmd = "" -- FIXME has_libm = "NO" -- FIXME llc_cmd = "llc" -- FIXME llvm_opt_cmd = "opt" -- FIXME diff --git a/utils/ghc-toolchain/src/GHC/Toolchain/Target.hs b/utils/ghc-toolchain/src/GHC/Toolchain/Target.hs index ec95db46f9d..e1ffd71c7b5 100644 --- a/utils/ghc-toolchain/src/GHC/Toolchain/Target.hs +++ b/utils/ghc-toolchain/src/GHC/Toolchain/Target.hs @@ -74,6 +74,10 @@ data Target = Target -- Windows-specific tools , tgtWindres :: Maybe Program + + -- Mac specific + , tgtOtool:: Maybe Program + , tgtInstallNameTool :: Maybe Program } deriving (Read, Eq, Ord) @@ -122,5 +126,7 @@ instance Show Target where , ", tgtNm = " ++ show tgtNm , ", tgtMergeObjs = " ++ show tgtMergeObjs , ", tgtWindres = " ++ show tgtWindres + , ", tgtOtool = " ++ show tgtOtool + , ", tgtInstallNameTool = " ++ show tgtInstallNameTool , "}" ] diff --git a/utils/iserv/iserv.cabal.in b/utils/iserv/iserv.cabal similarity index 77% rename from utils/iserv/iserv.cabal.in rename to utils/iserv/iserv.cabal index 0f5d77456ae..69f645d8735 100644 --- a/utils/iserv/iserv.cabal.in +++ b/utils/iserv/iserv.cabal @@ -1,12 +1,8 @@ --- WARNING: iserv.cabal is automatically generated from iserv.cabal.in by --- ../../configure. Make sure you are editing iserv.cabal.in, not --- iserv.cabal. - +cabal-version: 3.0 Name: iserv -Version: @ProjectVersion@ -Copyright: XXX -License: BSD3 --- XXX License-File: LICENSE +-- ProjectVersion +Version: 9.13 +License: BSD-3-Clause Author: XXX Maintainer: XXX Synopsis: iserv allows GHC to delegate Template Haskell computations @@ -21,7 +17,6 @@ Description: Category: Development build-type: Simple -cabal-version: >=1.10 Executable iserv Default-Language: Haskell2010 @@ -36,7 +31,8 @@ Executable iserv bytestring >= 0.10 && < 0.13, containers >= 0.5 && < 0.8, deepseq >= 1.4 && < 1.6, - ghci == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghci == 9.13 if os(windows) Cpp-Options: -DWINDOWS diff --git a/utils/remote-iserv/remote-iserv.cabal.in b/utils/remote-iserv/remote-iserv.cabal similarity index 64% rename from utils/remote-iserv/remote-iserv.cabal.in rename to utils/remote-iserv/remote-iserv.cabal index 24c5c99c748..fa2eb4f78b1 100644 --- a/utils/remote-iserv/remote-iserv.cabal.in +++ b/utils/remote-iserv/remote-iserv.cabal @@ -1,12 +1,8 @@ --- WARNING: iserv-proxy.cabal is automatically generated from remote-iserv.cabal.in by --- ../../configure. Make sure you are editing remote-iserv.cabal.in, not --- remote-iserv.cabal. - +cabal-version: 3.0 Name: remote-iserv -Version: @ProjectVersion@ -Copyright: XXX -License: BSD3 --- XXX License-File: LICENSE +-- ProjectVersion +Version: 9.13 +License: BSD-3-Clause Author: Moritz Angermann <moritz.angermann@gmail.com> Maintainer: Moritz Angermann <moritz.angermann@gmail.com> Synopsis: iserv allows GHC to delegate Template Haskell computations @@ -17,11 +13,11 @@ Description: then connect. Category: Development build-type: Simple -cabal-version: >=1.10 Executable remote-iserv Default-Language: Haskell2010 Main-Is: Cli.hs Hs-Source-Dirs: src Build-Depends: base >= 4 && < 5, - ghci == @ProjectVersionMunged@ + -- ProjectVersionMunged + ghci == 9.13 diff --git a/utils/runghc/runghc.cabal.in b/utils/runghc/runghc.cabal similarity index 84% rename from utils/runghc/runghc.cabal.in rename to utils/runghc/runghc.cabal index cf0d085a345..bdf6ec2df78 100644 --- a/utils/runghc/runghc.cabal.in +++ b/utils/runghc/runghc.cabal @@ -1,10 +1,8 @@ +cabal-version: 3.0 Name: runghc -Version: @ProjectVersion@ -Copyright: XXX -License: BSD3 --- XXX License-File: LICENSE -Author: XXX -Maintainer: XXX +-- ProjectVersion +Version: 9.13 +License: BSD-3-Clause Synopsis: A wrapper around GHC allowing convenient execution of scripts Description: @runghc@ is a small wrapper program around GHC which allows the compiler @@ -21,7 +19,6 @@ Description: @ Category: Development build-type: Simple -cabal-version: >=1.10 Executable runghc Default-Language: Haskell2010 diff --git a/utils/unlit/unlit.cabal b/utils/unlit/unlit.cabal index 0707d5d95ae..bbb157dc5d4 100644 --- a/utils/unlit/unlit.cabal +++ b/utils/unlit/unlit.cabal @@ -1,18 +1,13 @@ -cabal-version: 2.4 +cabal-version: 3.0 Name: unlit Version: 0.1 -Copyright: XXX License: BSD-3-Clause -Author: XXX -Maintainer: XXX Synopsis: Literate program filter -Description: XXX Category: Development build-type: Simple -extra-source-files: fs.h Executable unlit Default-Language: Haskell2010 Main-Is: unlit.c - C-Sources: fs.c - Includes: fs.h + build-depends: + rts-fs