Unverified Commit 07d54dc5 authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

Merge pull request #12115 from oranagra/update_jemalloc_5_3_0

Upgrade to jemalloc 5.3.0 hoping to resolve a potential for deadlock in a fork child
see https://github.com/jemalloc/jemalloc/issues/2402

steps:
* Upgrade subtree according to the instructions in deps/README
* update iget_defrag_hint by following changes to arena_dalloc_no_tcache
parents 42dd98ec 0897c8af
...@@ -106,7 +106,7 @@ endif ...@@ -106,7 +106,7 @@ endif
jemalloc: .make-prerequisites jemalloc: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
cd jemalloc && ./configure --disable-cxx --with-version=5.2.1-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" $(JEMALLOC_CONFIGURE_OPTS) cd jemalloc && ./configure --disable-cxx --with-version=5.3.0-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" $(JEMALLOC_CONFIGURE_OPTS)
cd jemalloc && $(MAKE) lib/libjemalloc.a cd jemalloc && $(MAKE) lib/libjemalloc.a
.PHONY: jemalloc .PHONY: jemalloc
...@@ -31,7 +31,6 @@ install: ...@@ -31,7 +31,6 @@ install:
- set PATH=c:\msys64\%MSYSTEM%\bin;c:\msys64\usr\bin;%PATH% - set PATH=c:\msys64\%MSYSTEM%\bin;c:\msys64\usr\bin;%PATH%
- if defined MSVC call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %MSVC% - if defined MSVC call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %MSVC%
- if defined MSVC pacman --noconfirm -Rsc mingw-w64-%CPU%-gcc gcc - if defined MSVC pacman --noconfirm -Rsc mingw-w64-%CPU%-gcc gcc
- pacman --noconfirm -Suy mingw-w64-%CPU%-make
build_script: build_script:
- bash -c "autoconf" - bash -c "autoconf"
......
...@@ -3,18 +3,43 @@ env: ...@@ -3,18 +3,43 @@ env:
ARCH: amd64 ARCH: amd64
task: task:
matrix:
env:
DEBUG_CONFIG: --enable-debug
env:
DEBUG_CONFIG: --disable-debug
matrix:
- env:
PROF_CONFIG: --enable-prof
- env:
PROF_CONFIG: --disable-prof
matrix:
- name: 64-bit
env:
CC:
CXX:
- name: 32-bit
env:
CC: cc -m32
CXX: c++ -m32
matrix:
- env:
UNCOMMON_CONFIG:
- env:
UNCOMMON_CONFIG: --with-lg-page=16 --with-malloc-conf=tcache:false
freebsd_instance: freebsd_instance:
matrix: matrix:
image: freebsd-12-0-release-amd64 image: freebsd-12-3-release-amd64
image: freebsd-11-2-release-amd64
install_script: install_script:
- sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf - sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
- pkg upgrade -y - pkg upgrade -y
- pkg install -y autoconf gmake - pkg install -y autoconf gmake
script: script:
- autoconf - autoconf
#- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS" } $CONFIGURE_FLAGS # We don't perfectly track freebsd stdlib.h definitions. This is fine when
- ./configure # we count as a system header, but breaks otherwise, like during these
# tests.
- ./configure --with-jemalloc-prefix=ci_ ${DEBUG_CONFIG} ${PROF_CONFIG} ${UNCOMMON_CONFIG}
- export JFLAG=`sysctl -n kern.smp.cpus` - export JFLAG=`sysctl -n kern.smp.cpus`
- gmake -j${JFLAG} - gmake -j${JFLAG}
- gmake -j${JFLAG} tests - gmake -j${JFLAG} tests
......
# jemalloc targets clang-format version 8. We include every option it supports
# here, but comment out the ones that aren't relevant for us.
---
# AccessModifierOffset: -2
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakBeforeMultilineStrings: true
# AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
# BreakAfterJavaFieldAnnotations: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
# BreakConstructorInitializers: BeforeColon
# BreakInheritanceList: BeforeColon
BreakStringLiterals: false
ColumnLimit: 80
# CommentPragmas: ''
# CompactNamespaces: true
# ConstructorInitializerAllOnOneLineOrOnePerLine: true
# ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ ql_foreach, qr_foreach, ]
# IncludeBlocks: Preserve
# IncludeCategories:
# - Regex: '^<.*\.h(pp)?>'
# Priority: 1
# IncludeIsMainRegex: ''
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
# JavaImportGroups: []
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: True
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
# NamespaceIndentation: None
# ObjCBinPackProtocolList: Auto
# ObjCBlockIndentWidth: 2
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
# RawStringFormats:
# - Language: TextProto
# Delimiters:
# - 'pb'
# - 'proto'
# EnclosingFunctions:
# - 'PARSE_TEXT_PROTO'
# BasedOnStyle: google
# - Language: Cpp
# Delimiters:
# - 'cc'
# - 'cpp'
# BasedOnStyle: llvm
# CanonicalDelimiter: 'cc'
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: false
# SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
# SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
# SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
# SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
# Standard: Cpp11
# This is nominally supported in clang-format version 8, but not in the build
# used by some of the core jemalloc developers.
# StatementMacros: []
TabWidth: 8
UseTab: Never
...
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
/doc/jemalloc.html /doc/jemalloc.html
/doc/jemalloc.3 /doc/jemalloc.3
/doc_internal/PROFILING_INTERNALS.pdf
/jemalloc.pc /jemalloc.pc
/lib/ /lib/
...@@ -50,6 +52,7 @@ test/include/test/jemalloc_test.h ...@@ -50,6 +52,7 @@ test/include/test/jemalloc_test.h
test/include/test/jemalloc_test_defs.h test/include/test/jemalloc_test_defs.h
/test/integration/[A-Za-z]* /test/integration/[A-Za-z]*
!/test/integration/cpp/
!/test/integration/[A-Za-z]*.* !/test/integration/[A-Za-z]*.*
/test/integration/*.[od] /test/integration/*.[od]
/test/integration/*.out /test/integration/*.out
...@@ -71,6 +74,11 @@ test/include/test/jemalloc_test_defs.h ...@@ -71,6 +74,11 @@ test/include/test/jemalloc_test_defs.h
/test/unit/*.[od] /test/unit/*.[od]
/test/unit/*.out /test/unit/*.out
/test/analyze/[A-Za-z]*
!/test/analyze/[A-Za-z]*.*
/test/analyze/*.[od]
/test/analyze/*.out
/VERSION /VERSION
*.pdb *.pdb
......
language: generic # This config file is generated by ./scripts/gen_travis.py.
dist: precise # Do not edit by hand.
matrix: # We use 'minimal', because 'generic' makes Windows VMs hang at startup. Also
# the software provided by 'generic' is simply not needed for our tests.
# Differences are explained here:
# https://docs.travis-ci.com/user/languages/minimal-and-generic/
language: minimal
dist: focal
jobs:
include: include:
- os: windows
arch: amd64
env: CC=gcc CXX=g++ EXTRA_CFLAGS="-fcommon"
- os: windows
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-fcommon"
- os: windows
arch: amd64
env: CC=cl.exe CXX=cl.exe
- os: windows
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes EXTRA_CFLAGS="-fcommon"
- os: windows
arch: amd64
env: CC=cl.exe CXX=cl.exe CONFIGURE_FLAGS="--enable-debug"
- os: windows
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-fcommon"
- os: windows
arch: amd64
env: CC=cl.exe CXX=cl.exe CROSS_COMPILE_32BIT=yes
- os: windows
arch: amd64
env: CC=cl.exe CXX=cl.exe CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--enable-debug"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --enable-prof-libunwind"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-lg-page=16 --with-malloc-conf=tcache:false"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --enable-prof --enable-prof-libunwind"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --with-lg-page=16 --with-malloc-conf=tcache:false"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--enable-debug"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --enable-prof-libunwind --with-lg-page=16 --with-malloc-conf=tcache:false"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--enable-prof --enable-prof-libunwind"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--with-lg-page=16 --with-malloc-conf=tcache:false"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --enable-prof --enable-prof-libunwind --with-lg-page=16 --with-malloc-conf=tcache:false"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--enable-debug --enable-prof --enable-prof-libunwind"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--enable-debug --with-lg-page=16 --with-malloc-conf=tcache:false"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--enable-prof --enable-prof-libunwind --with-lg-page=16 --with-malloc-conf=tcache:false"
- os: freebsd
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes CONFIGURE_FLAGS="--enable-debug --enable-prof --enable-prof-libunwind --with-lg-page=16 --with-malloc-conf=tcache:false"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=clang CXX=clang++ EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: amd64
env: CC=clang CXX=clang++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux
arch: amd64
env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux
arch: amd64
env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
- os: osx env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: &gcc_multilib env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
apt:
packages:
- gcc-multilib
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=clang CXX=clang++ CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
- os: osx env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" - os: linux
- os: osx arch: amd64
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: osx - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
- os: osx env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds" - os: linux
- os: osx arch: amd64
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds" env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: osx - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
- os: osx env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
addons: *gcc_multilib env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats --with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl --with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-opt-safety-checks --with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-lg-page=16 --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-lg-page=16 --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-lg-page=16 --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-lg-page=16 --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=tcache:false,dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=tcache:false,percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=tcache:false,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=dss:primary,percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=dss:primary,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: ppc64le
env: CC=gcc CXX=g++ EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false,dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false,percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary,percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds" arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: linux
arch: ppc64le
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
- os: osx
arch: amd64
env: CC=gcc CXX=g++ EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
- os: osx
arch: amd64
env: CC=gcc CXX=g++ CROSS_COMPILE_32BIT=yes EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
- os: osx
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
- os: osx
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
- os: osx
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
- os: osx
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
- os: osx
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
- os: osx
arch: amd64
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
# Development build # Development build
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-cache-oblivious --enable-stats --enable-log --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds" env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --disable-cache-oblivious --enable-stats --enable-log --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
# --enable-expermental-smallocx: # --enable-expermental-smallocx:
- os: linux - os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-experimental-smallocx --enable-stats --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds" env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --enable-experimental-smallocx --enable-stats --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
# Valgrind
- os: linux
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" JEMALLOC_TEST_PREFIX="valgrind"
addons:
apt:
packages:
- valgrind
before_install:
- |-
if test -f "./scripts/$TRAVIS_OS_NAME/before_install.sh"; then
source ./scripts/$TRAVIS_OS_NAME/before_install.sh
fi
before_script: before_script:
- autoconf - |-
- scripts/gen_travis.py > travis_script && diff .travis.yml travis_script if test -f "./scripts/$TRAVIS_OS_NAME/before_script.sh"; then
- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS" } $CONFIGURE_FLAGS source ./scripts/$TRAVIS_OS_NAME/before_script.sh
- make -j3 else
- make -j3 tests scripts/gen_travis.py > travis_script && diff .travis.yml travis_script
autoconf
# If COMPILER_FLAGS are not empty, add them to CC and CXX
./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS"} $CONFIGURE_FLAGS
make -j3
make -j3 tests
fi
script: script:
- make check - |-
if test -f "./scripts/$TRAVIS_OS_NAME/script.sh"; then
source ./scripts/$TRAVIS_OS_NAME/script.sh
else
make check
fi
...@@ -4,6 +4,106 @@ brevity. Much more detail can be found in the git revision history: ...@@ -4,6 +4,106 @@ brevity. Much more detail can be found in the git revision history:
https://github.com/jemalloc/jemalloc https://github.com/jemalloc/jemalloc
* 5.3.0 (May 6, 2022)
This release contains many speed and space optimizations, from micro
optimizations on common paths to rework of internal data structures and
locking schemes, and many more too detailed to list below. Multiple percent
of system level metric improvements were measured in tested production
workloads. The release has gone through large-scale production testing.
New features:
- Add the thread.idle mallctl which hints that the calling thread will be
idle for a nontrivial period of time. (@davidtgoldblatt)
- Allow small size classes to be the maximum size class to cache in the
thread-specific cache, through the opt.[lg_]tcache_max option. (@interwq,
@jordalgo)
- Make the behavior of realloc(ptr, 0) configurable with opt.zero_realloc.
(@davidtgoldblatt)
- Add 'make uninstall' support. (@sangshuduo, @Lapenkov)
- Support C++17 over-aligned allocation. (@marksantaniello)
- Add the thread.peak mallctl for approximate per-thread peak memory tracking.
(@davidtgoldblatt)
- Add interval-based stats output opt.stats_interval. (@interwq)
- Add prof.prefix to override filename prefixes for dumps. (@zhxchen17)
- Add high resolution timestamp support for profiling. (@tyroguru)
- Add the --collapsed flag to jeprof for flamegraph generation.
(@igorwwwwwwwwwwwwwwwwwwww)
- Add the --debug-syms-by-id option to jeprof for debug symbols discovery.
(@DeannaGelbart)
- Add the opt.prof_leak_error option to exit with error code when leak is
detected using opt.prof_final. (@yunxuo)
- Add opt.cache_oblivious as an runtime alternative to config.cache_oblivious.
(@interwq)
- Add mallctl interfaces:
+ opt.zero_realloc (@davidtgoldblatt)
+ opt.cache_oblivious (@interwq)
+ opt.prof_leak_error (@yunxuo)
+ opt.stats_interval (@interwq)
+ opt.stats_interval_opts (@interwq)
+ opt.tcache_max (@interwq)
+ opt.trust_madvise (@azat)
+ prof.prefix (@zhxchen17)
+ stats.zero_reallocs (@davidtgoldblatt)
+ thread.idle (@davidtgoldblatt)
+ thread.peak.{read,reset} (@davidtgoldblatt)
Bug fixes:
- Fix the synchronization around explicit tcache creation which could cause
invalid tcache identifiers. This regression was first released in 5.0.0.
(@yoshinorim, @davidtgoldblatt)
- Fix a profiling biasing issue which could cause incorrect heap usage and
object counts. This issue existed in all previous releases with the heap
profiling feature. (@davidtgoldblatt)
- Fix the order of stats counter updating on large realloc which could cause
failed assertions. This regression was first released in 5.0.0. (@azat)
- Fix the locking on the arena destroy mallctl, which could cause concurrent
arena creations to fail. This functionality was first introduced in 5.0.0.
(@interwq)
Portability improvements:
- Remove nothrow from system function declarations on macOS and FreeBSD.
(@davidtgoldblatt, @fredemmott, @leres)
- Improve overcommit and page alignment settings on NetBSD. (@zoulasc)
- Improve CPU affinity support on BSD platforms. (@devnexen)
- Improve utrace detection and support. (@devnexen)
- Improve QEMU support with MADV_DONTNEED zeroed pages detection. (@azat)
- Add memcntl support on Solaris / illumos. (@devnexen)
- Improve CPU_SPINWAIT on ARM. (@AWSjswinney)
- Improve TSD cleanup on FreeBSD. (@Lapenkov)
- Disable percpu_arena if the CPU count cannot be reliably detected. (@azat)
- Add malloc_size(3) override support. (@devnexen)
- Add mmap VM_MAKE_TAG support. (@devnexen)
- Add support for MADV_[NO]CORE. (@devnexen)
- Add support for DragonFlyBSD. (@devnexen)
- Fix the QUANTUM setting on MIPS64. (@brooksdavis)
- Add the QUANTUM setting for ARC. (@vineetgarc)
- Add the QUANTUM setting for LoongArch. (@wangjl-uos)
- Add QNX support. (@jqian-aurora)
- Avoid atexit(3) calls unless the relevant profiling features are enabled.
(@BusyJay, @laiwei-rice, @interwq)
- Fix unknown option detection when using Clang. (@Lapenkov)
- Fix symbol conflict with musl libc. (@georgthegreat)
- Add -Wimplicit-fallthrough checks. (@nickdesaulniers)
- Add __forceinline support on MSVC. (@santagada)
- Improve FreeBSD and Windows CI support. (@Lapenkov)
- Add CI support for PPC64LE architecture. (@ezeeyahoo)
Incompatible changes:
- Maximum size class allowed in tcache (opt.[lg_]tcache_max) now has an upper
bound of 8MiB. (@interwq)
Optimizations and refactors (@davidtgoldblatt, @Lapenkov, @interwq):
- Optimize the common cases of the thread cache operations.
- Optimize internal data structures, including RB tree and pairing heap.
- Optimize the internal locking on extent management.
- Extract and refactor the internal page allocator and interface modules.
Documentation:
- Fix doc build with --with-install-suffix. (@lawmurray, @interwq)
- Add PROFILING_INTERNALS.md. (@davidtgoldblatt)
- Ensure the proper order of doc building and installation. (@Mingli-Yu)
* 5.2.1 (August 5, 2019) * 5.2.1 (August 5, 2019)
This release is primarily about Windows. A critical virtual memory leak is This release is primarily about Windows. A critical virtual memory leak is
......
...@@ -9,14 +9,17 @@ If building from unpackaged developer sources, the simplest command sequence ...@@ -9,14 +9,17 @@ If building from unpackaged developer sources, the simplest command sequence
that might work is: that might work is:
./autogen.sh ./autogen.sh
make dist
make make
make install make install
Note that documentation is not built by the default target because doing so You can uninstall the installed build artifacts like this:
would create a dependency on xsltproc in packaged releases, hence the
requirement to either run 'make dist' or avoid installing docs via the various make uninstall
install_* targets documented below.
Notes:
- "autoconf" needs to be installed
- Documentation is built by the default target only when xsltproc is
available. Build will warn but not stop if the dependency is missing.
## Advanced configuration ## Advanced configuration
...@@ -188,13 +191,13 @@ any of the following arguments (not a definitive list) to 'configure': ...@@ -188,13 +191,13 @@ any of the following arguments (not a definitive list) to 'configure':
* `--disable-cache-oblivious` * `--disable-cache-oblivious`
Disable cache-oblivious large allocation alignment for large allocation Disable cache-oblivious large allocation alignment by default, for large
requests with no alignment constraints. If this feature is disabled, all allocation requests with no alignment constraints. If this feature is
large allocations are page-aligned as an implementation artifact, which can disabled, all large allocations are page-aligned as an implementation
severely harm CPU cache utilization. However, the cache-oblivious layout artifact, which can severely harm CPU cache utilization. However, the
comes at the cost of one extra page per large allocation, which in the cache-oblivious layout comes at the cost of one extra page per large
most extreme case increases physical memory usage for the 16 KiB size class allocation, which in the most extreme case increases physical memory usage
to 20 KiB. for the 16 KiB size class to 20 KiB.
* `--disable-syscall` * `--disable-syscall`
......
...@@ -99,31 +99,60 @@ C_SRCS := $(srcroot)src/jemalloc.c \ ...@@ -99,31 +99,60 @@ C_SRCS := $(srcroot)src/jemalloc.c \
$(srcroot)src/background_thread.c \ $(srcroot)src/background_thread.c \
$(srcroot)src/base.c \ $(srcroot)src/base.c \
$(srcroot)src/bin.c \ $(srcroot)src/bin.c \
$(srcroot)src/bin_info.c \
$(srcroot)src/bitmap.c \ $(srcroot)src/bitmap.c \
$(srcroot)src/buf_writer.c \
$(srcroot)src/cache_bin.c \
$(srcroot)src/ckh.c \ $(srcroot)src/ckh.c \
$(srcroot)src/counter.c \
$(srcroot)src/ctl.c \ $(srcroot)src/ctl.c \
$(srcroot)src/decay.c \
$(srcroot)src/div.c \ $(srcroot)src/div.c \
$(srcroot)src/ecache.c \
$(srcroot)src/edata.c \
$(srcroot)src/edata_cache.c \
$(srcroot)src/ehooks.c \
$(srcroot)src/emap.c \
$(srcroot)src/eset.c \
$(srcroot)src/exp_grow.c \
$(srcroot)src/extent.c \ $(srcroot)src/extent.c \
$(srcroot)src/extent_dss.c \ $(srcroot)src/extent_dss.c \
$(srcroot)src/extent_mmap.c \ $(srcroot)src/extent_mmap.c \
$(srcroot)src/hash.c \ $(srcroot)src/fxp.c \
$(srcroot)src/san.c \
$(srcroot)src/san_bump.c \
$(srcroot)src/hook.c \ $(srcroot)src/hook.c \
$(srcroot)src/hpa.c \
$(srcroot)src/hpa_hooks.c \
$(srcroot)src/hpdata.c \
$(srcroot)src/inspect.c \
$(srcroot)src/large.c \ $(srcroot)src/large.c \
$(srcroot)src/log.c \ $(srcroot)src/log.c \
$(srcroot)src/malloc_io.c \ $(srcroot)src/malloc_io.c \
$(srcroot)src/mutex.c \ $(srcroot)src/mutex.c \
$(srcroot)src/mutex_pool.c \
$(srcroot)src/nstime.c \ $(srcroot)src/nstime.c \
$(srcroot)src/pa.c \
$(srcroot)src/pa_extra.c \
$(srcroot)src/pai.c \
$(srcroot)src/pac.c \
$(srcroot)src/pages.c \ $(srcroot)src/pages.c \
$(srcroot)src/prng.c \ $(srcroot)src/peak_event.c \
$(srcroot)src/prof.c \ $(srcroot)src/prof.c \
$(srcroot)src/prof_data.c \
$(srcroot)src/prof_log.c \
$(srcroot)src/prof_recent.c \
$(srcroot)src/prof_stats.c \
$(srcroot)src/prof_sys.c \
$(srcroot)src/psset.c \
$(srcroot)src/rtree.c \ $(srcroot)src/rtree.c \
$(srcroot)src/safety_check.c \ $(srcroot)src/safety_check.c \
$(srcroot)src/stats.c \
$(srcroot)src/sc.c \ $(srcroot)src/sc.c \
$(srcroot)src/sec.c \
$(srcroot)src/stats.c \
$(srcroot)src/sz.c \ $(srcroot)src/sz.c \
$(srcroot)src/tcache.c \ $(srcroot)src/tcache.c \
$(srcroot)src/test_hooks.c \ $(srcroot)src/test_hooks.c \
$(srcroot)src/thread_event.c \
$(srcroot)src/ticker.c \ $(srcroot)src/ticker.c \
$(srcroot)src/tsd.c \ $(srcroot)src/tsd.c \
$(srcroot)src/witness.c $(srcroot)src/witness.c
...@@ -148,88 +177,124 @@ else ...@@ -148,88 +177,124 @@ else
LJEMALLOC := $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) LJEMALLOC := $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
endif endif
PC := $(objroot)jemalloc.pc PC := $(objroot)jemalloc.pc
MAN3 := $(objroot)doc/jemalloc$(install_suffix).3
DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml
DOCS_HTML := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.html) DOCS_HTML := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.html)
DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.3) DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.3)
DOCS := $(DOCS_HTML) $(DOCS_MAN3) DOCS := $(DOCS_HTML) $(DOCS_MAN3)
C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \ C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \
$(srcroot)test/src/btalloc_1.c $(srcroot)test/src/math.c \ $(srcroot)test/src/btalloc_1.c $(srcroot)test/src/math.c \
$(srcroot)test/src/mtx.c $(srcroot)test/src/mq.c \ $(srcroot)test/src/mtx.c $(srcroot)test/src/sleep.c \
$(srcroot)test/src/SFMT.c $(srcroot)test/src/test.c \ $(srcroot)test/src/SFMT.c $(srcroot)test/src/test.c \
$(srcroot)test/src/thd.c $(srcroot)test/src/timer.c $(srcroot)test/src/thd.c $(srcroot)test/src/timer.c
ifeq (1, $(link_whole_archive)) ifeq (1, $(link_whole_archive))
C_UTIL_INTEGRATION_SRCS := C_UTIL_INTEGRATION_SRCS :=
C_UTIL_CPP_SRCS := C_UTIL_CPP_SRCS :=
else else
C_UTIL_INTEGRATION_SRCS := $(srcroot)src/nstime.c $(srcroot)src/malloc_io.c C_UTIL_INTEGRATION_SRCS := $(srcroot)src/nstime.c $(srcroot)src/malloc_io.c \
$(srcroot)src/ticker.c
C_UTIL_CPP_SRCS := $(srcroot)src/nstime.c $(srcroot)src/malloc_io.c C_UTIL_CPP_SRCS := $(srcroot)src/nstime.c $(srcroot)src/malloc_io.c
endif endif
TESTS_UNIT := \ TESTS_UNIT := \
$(srcroot)test/unit/a0.c \ $(srcroot)test/unit/a0.c \
$(srcroot)test/unit/arena_decay.c \
$(srcroot)test/unit/arena_reset.c \ $(srcroot)test/unit/arena_reset.c \
$(srcroot)test/unit/atomic.c \ $(srcroot)test/unit/atomic.c \
$(srcroot)test/unit/background_thread.c \ $(srcroot)test/unit/background_thread.c \
$(srcroot)test/unit/background_thread_enable.c \ $(srcroot)test/unit/background_thread_enable.c \
$(srcroot)test/unit/base.c \ $(srcroot)test/unit/base.c \
$(srcroot)test/unit/batch_alloc.c \
$(srcroot)test/unit/binshard.c \
$(srcroot)test/unit/bitmap.c \ $(srcroot)test/unit/bitmap.c \
$(srcroot)test/unit/bit_util.c \ $(srcroot)test/unit/bit_util.c \
$(srcroot)test/unit/binshard.c \ $(srcroot)test/unit/buf_writer.c \
$(srcroot)test/unit/cache_bin.c \
$(srcroot)test/unit/ckh.c \ $(srcroot)test/unit/ckh.c \
$(srcroot)test/unit/counter.c \
$(srcroot)test/unit/decay.c \ $(srcroot)test/unit/decay.c \
$(srcroot)test/unit/div.c \ $(srcroot)test/unit/div.c \
$(srcroot)test/unit/double_free.c \
$(srcroot)test/unit/edata_cache.c \
$(srcroot)test/unit/emitter.c \ $(srcroot)test/unit/emitter.c \
$(srcroot)test/unit/extent_quantize.c \ $(srcroot)test/unit/extent_quantize.c \
$(srcroot)test/unit/extent_util.c \ ${srcroot}test/unit/fb.c \
$(srcroot)test/unit/fork.c \ $(srcroot)test/unit/fork.c \
${srcroot}test/unit/fxp.c \
${srcroot}test/unit/san.c \
${srcroot}test/unit/san_bump.c \
$(srcroot)test/unit/hash.c \ $(srcroot)test/unit/hash.c \
$(srcroot)test/unit/hook.c \ $(srcroot)test/unit/hook.c \
$(srcroot)test/unit/hpa.c \
$(srcroot)test/unit/hpa_background_thread.c \
$(srcroot)test/unit/hpdata.c \
$(srcroot)test/unit/huge.c \ $(srcroot)test/unit/huge.c \
$(srcroot)test/unit/inspect.c \
$(srcroot)test/unit/junk.c \ $(srcroot)test/unit/junk.c \
$(srcroot)test/unit/junk_alloc.c \ $(srcroot)test/unit/junk_alloc.c \
$(srcroot)test/unit/junk_free.c \ $(srcroot)test/unit/junk_free.c \
$(srcroot)test/unit/log.c \ $(srcroot)test/unit/log.c \
$(srcroot)test/unit/mallctl.c \ $(srcroot)test/unit/mallctl.c \
$(srcroot)test/unit/malloc_conf_2.c \
$(srcroot)test/unit/malloc_io.c \ $(srcroot)test/unit/malloc_io.c \
$(srcroot)test/unit/math.c \ $(srcroot)test/unit/math.c \
$(srcroot)test/unit/mpsc_queue.c \
$(srcroot)test/unit/mq.c \ $(srcroot)test/unit/mq.c \
$(srcroot)test/unit/mtx.c \ $(srcroot)test/unit/mtx.c \
$(srcroot)test/unit/nstime.c \
$(srcroot)test/unit/oversize_threshold.c \
$(srcroot)test/unit/pa.c \
$(srcroot)test/unit/pack.c \ $(srcroot)test/unit/pack.c \
$(srcroot)test/unit/pages.c \ $(srcroot)test/unit/pages.c \
$(srcroot)test/unit/peak.c \
$(srcroot)test/unit/ph.c \ $(srcroot)test/unit/ph.c \
$(srcroot)test/unit/prng.c \ $(srcroot)test/unit/prng.c \
$(srcroot)test/unit/prof_accum.c \ $(srcroot)test/unit/prof_accum.c \
$(srcroot)test/unit/prof_active.c \ $(srcroot)test/unit/prof_active.c \
$(srcroot)test/unit/prof_gdump.c \ $(srcroot)test/unit/prof_gdump.c \
$(srcroot)test/unit/prof_hook.c \
$(srcroot)test/unit/prof_idump.c \ $(srcroot)test/unit/prof_idump.c \
$(srcroot)test/unit/prof_log.c \ $(srcroot)test/unit/prof_log.c \
$(srcroot)test/unit/prof_mdump.c \
$(srcroot)test/unit/prof_recent.c \
$(srcroot)test/unit/prof_reset.c \ $(srcroot)test/unit/prof_reset.c \
$(srcroot)test/unit/prof_stats.c \
$(srcroot)test/unit/prof_tctx.c \ $(srcroot)test/unit/prof_tctx.c \
$(srcroot)test/unit/prof_thread_name.c \ $(srcroot)test/unit/prof_thread_name.c \
$(srcroot)test/unit/prof_sys_thread_name.c \
$(srcroot)test/unit/psset.c \
$(srcroot)test/unit/ql.c \ $(srcroot)test/unit/ql.c \
$(srcroot)test/unit/qr.c \ $(srcroot)test/unit/qr.c \
$(srcroot)test/unit/rb.c \ $(srcroot)test/unit/rb.c \
$(srcroot)test/unit/retained.c \ $(srcroot)test/unit/retained.c \
$(srcroot)test/unit/rtree.c \ $(srcroot)test/unit/rtree.c \
$(srcroot)test/unit/safety_check.c \ $(srcroot)test/unit/safety_check.c \
$(srcroot)test/unit/sc.c \
$(srcroot)test/unit/sec.c \
$(srcroot)test/unit/seq.c \ $(srcroot)test/unit/seq.c \
$(srcroot)test/unit/SFMT.c \ $(srcroot)test/unit/SFMT.c \
$(srcroot)test/unit/sc.c \ $(srcroot)test/unit/size_check.c \
$(srcroot)test/unit/size_classes.c \ $(srcroot)test/unit/size_classes.c \
$(srcroot)test/unit/slab.c \ $(srcroot)test/unit/slab.c \
$(srcroot)test/unit/smoothstep.c \ $(srcroot)test/unit/smoothstep.c \
$(srcroot)test/unit/spin.c \ $(srcroot)test/unit/spin.c \
$(srcroot)test/unit/stats.c \ $(srcroot)test/unit/stats.c \
$(srcroot)test/unit/stats_print.c \ $(srcroot)test/unit/stats_print.c \
$(srcroot)test/unit/sz.c \
$(srcroot)test/unit/tcache_max.c \
$(srcroot)test/unit/test_hooks.c \ $(srcroot)test/unit/test_hooks.c \
$(srcroot)test/unit/thread_event.c \
$(srcroot)test/unit/ticker.c \ $(srcroot)test/unit/ticker.c \
$(srcroot)test/unit/nstime.c \
$(srcroot)test/unit/tsd.c \ $(srcroot)test/unit/tsd.c \
$(srcroot)test/unit/uaf.c \
$(srcroot)test/unit/witness.c \ $(srcroot)test/unit/witness.c \
$(srcroot)test/unit/zero.c $(srcroot)test/unit/zero.c \
$(srcroot)test/unit/zero_realloc_abort.c \
$(srcroot)test/unit/zero_realloc_free.c \
$(srcroot)test/unit/zero_realloc_alloc.c \
$(srcroot)test/unit/zero_reallocs.c
ifeq (@enable_prof@, 1) ifeq (@enable_prof@, 1)
TESTS_UNIT += \ TESTS_UNIT += \
$(srcroot)test/unit/arena_reset_prof.c $(srcroot)test/unit/arena_reset_prof.c \
$(srcroot)test/unit/batch_alloc_prof.c
endif endif
TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \ TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
$(srcroot)test/integration/allocated.c \ $(srcroot)test/integration/allocated.c \
...@@ -251,16 +316,26 @@ TESTS_INTEGRATION += \ ...@@ -251,16 +316,26 @@ TESTS_INTEGRATION += \
endif endif
ifeq (@enable_cxx@, 1) ifeq (@enable_cxx@, 1)
CPP_SRCS := $(srcroot)src/jemalloc_cpp.cpp CPP_SRCS := $(srcroot)src/jemalloc_cpp.cpp
TESTS_INTEGRATION_CPP := $(srcroot)test/integration/cpp/basic.cpp TESTS_INTEGRATION_CPP := $(srcroot)test/integration/cpp/basic.cpp \
$(srcroot)test/integration/cpp/infallible_new_true.cpp \
$(srcroot)test/integration/cpp/infallible_new_false.cpp
else else
CPP_SRCS := CPP_SRCS :=
TESTS_INTEGRATION_CPP := TESTS_INTEGRATION_CPP :=
endif endif
TESTS_STRESS := $(srcroot)test/stress/microbench.c \ TESTS_ANALYZE := $(srcroot)test/analyze/prof_bias.c \
$(srcroot)test/stress/hookbench.c $(srcroot)test/analyze/rand.c \
$(srcroot)test/analyze/sizes.c
TESTS_STRESS := $(srcroot)test/stress/batch_alloc.c \
$(srcroot)test/stress/fill_flush.c \
$(srcroot)test/stress/hookbench.c \
$(srcroot)test/stress/large_microbench.c \
$(srcroot)test/stress/mallctl.c \
$(srcroot)test/stress/microbench.c
TESTS := $(TESTS_UNIT) $(TESTS_INTEGRATION) $(TESTS_INTEGRATION_CPP) $(TESTS_STRESS) TESTS := $(TESTS_UNIT) $(TESTS_INTEGRATION) $(TESTS_INTEGRATION_CPP) \
$(TESTS_ANALYZE) $(TESTS_STRESS)
PRIVATE_NAMESPACE_HDRS := $(objroot)include/jemalloc/internal/private_namespace.h $(objroot)include/jemalloc/internal/private_namespace_jet.h PRIVATE_NAMESPACE_HDRS := $(objroot)include/jemalloc/internal/private_namespace.h $(objroot)include/jemalloc/internal/private_namespace_jet.h
PRIVATE_NAMESPACE_GEN_HDRS := $(PRIVATE_NAMESPACE_HDRS:%.h=%.gen.h) PRIVATE_NAMESPACE_GEN_HDRS := $(PRIVATE_NAMESPACE_HDRS:%.h=%.gen.h)
...@@ -276,14 +351,19 @@ C_JET_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.$(O)) ...@@ -276,14 +351,19 @@ C_JET_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.$(O))
C_TESTLIB_UNIT_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.unit.$(O)) C_TESTLIB_UNIT_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.unit.$(O))
C_TESTLIB_INTEGRATION_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O)) C_TESTLIB_INTEGRATION_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
C_UTIL_INTEGRATION_OBJS := $(C_UTIL_INTEGRATION_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O)) C_UTIL_INTEGRATION_OBJS := $(C_UTIL_INTEGRATION_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
C_TESTLIB_ANALYZE_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.analyze.$(O))
C_TESTLIB_STRESS_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.stress.$(O)) C_TESTLIB_STRESS_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.stress.$(O))
C_TESTLIB_OBJS := $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(C_TESTLIB_STRESS_OBJS) C_TESTLIB_OBJS := $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) \
$(C_UTIL_INTEGRATION_OBJS) $(C_TESTLIB_ANALYZE_OBJS) \
$(C_TESTLIB_STRESS_OBJS)
TESTS_UNIT_OBJS := $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%.$(O)) TESTS_UNIT_OBJS := $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%.$(O))
TESTS_INTEGRATION_OBJS := $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%.$(O)) TESTS_INTEGRATION_OBJS := $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%.$(O))
TESTS_INTEGRATION_CPP_OBJS := $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%.$(O)) TESTS_INTEGRATION_CPP_OBJS := $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%.$(O))
TESTS_ANALYZE_OBJS := $(TESTS_ANALYZE:$(srcroot)%.c=$(objroot)%.$(O))
TESTS_STRESS_OBJS := $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%.$(O)) TESTS_STRESS_OBJS := $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%.$(O))
TESTS_OBJS := $(TESTS_UNIT_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_STRESS_OBJS) TESTS_OBJS := $(TESTS_UNIT_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_ANALYZE_OBJS) \
$(TESTS_STRESS_OBJS)
TESTS_CPP_OBJS := $(TESTS_INTEGRATION_CPP_OBJS) TESTS_CPP_OBJS := $(TESTS_INTEGRATION_CPP_OBJS)
.PHONY: all dist build_doc_html build_doc_man build_doc .PHONY: all dist build_doc_html build_doc_man build_doc
...@@ -298,7 +378,7 @@ all: build_lib ...@@ -298,7 +378,7 @@ all: build_lib
dist: build_doc dist: build_doc
$(objroot)doc/%.html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl $(objroot)doc/%$(install_suffix).html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl
ifneq ($(XSLROOT),) ifneq ($(XSLROOT),)
$(XSLTPROC) -o $@ $(objroot)doc/html.xsl $< $(XSLTPROC) -o $@ $(objroot)doc/html.xsl $<
else else
...@@ -308,9 +388,16 @@ endif ...@@ -308,9 +388,16 @@ endif
@echo "Missing xsltproc. "$@" not (re)built." @echo "Missing xsltproc. "$@" not (re)built."
endif endif
$(objroot)doc/%.3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl $(objroot)doc/%$(install_suffix).3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl
ifneq ($(XSLROOT),) ifneq ($(XSLROOT),)
$(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $< $(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $<
# The -o option (output filename) of xsltproc may not work (it uses the
# <refname> in the .xml file). Manually add the suffix if so.
ifneq ($(install_suffix),)
@if [ -f $(objroot)doc/jemalloc.3 ]; then \
mv $(objroot)doc/jemalloc.3 $(objroot)doc/jemalloc$(install_suffix).3 ; \
fi
endif
else else
ifeq ($(wildcard $(DOCS_MAN3)),) ifeq ($(wildcard $(DOCS_MAN3)),)
@echo "Missing xsltproc. Doc not built." > $@ @echo "Missing xsltproc. Doc not built." > $@
...@@ -357,12 +444,15 @@ $(C_TESTLIB_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST ...@@ -357,12 +444,15 @@ $(C_TESTLIB_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
$(C_TESTLIB_INTEGRATION_OBJS): $(objroot)test/src/%.integration.$(O): $(srcroot)test/src/%.c $(C_TESTLIB_INTEGRATION_OBJS): $(objroot)test/src/%.integration.$(O): $(srcroot)test/src/%.c
$(C_TESTLIB_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST $(C_TESTLIB_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
$(C_UTIL_INTEGRATION_OBJS): $(objroot)src/%.integration.$(O): $(srcroot)src/%.c $(C_UTIL_INTEGRATION_OBJS): $(objroot)src/%.integration.$(O): $(srcroot)src/%.c
$(C_TESTLIB_ANALYZE_OBJS): $(objroot)test/src/%.analyze.$(O): $(srcroot)test/src/%.c
$(C_TESTLIB_ANALYZE_OBJS): CPPFLAGS += -DJEMALLOC_ANALYZE_TEST
$(C_TESTLIB_STRESS_OBJS): $(objroot)test/src/%.stress.$(O): $(srcroot)test/src/%.c $(C_TESTLIB_STRESS_OBJS): $(objroot)test/src/%.stress.$(O): $(srcroot)test/src/%.c
$(C_TESTLIB_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST -DJEMALLOC_STRESS_TESTLIB $(C_TESTLIB_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST -DJEMALLOC_STRESS_TESTLIB
$(C_TESTLIB_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include $(C_TESTLIB_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
$(TESTS_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST $(TESTS_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
$(TESTS_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST $(TESTS_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
$(TESTS_INTEGRATION_CPP_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_CPP_TEST $(TESTS_INTEGRATION_CPP_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_CPP_TEST
$(TESTS_ANALYZE_OBJS): CPPFLAGS += -DJEMALLOC_ANALYZE_TEST
$(TESTS_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST $(TESTS_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST
$(TESTS_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c $(TESTS_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c
$(TESTS_CPP_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.cpp $(TESTS_CPP_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.cpp
...@@ -382,7 +472,7 @@ $(TESTS_OBJS) $(TESTS_CPP_OBJS): $(objroot)test/include/test/jemalloc_test.h ...@@ -382,7 +472,7 @@ $(TESTS_OBJS) $(TESTS_CPP_OBJS): $(objroot)test/include/test/jemalloc_test.h
endif endif
$(C_OBJS) $(CPP_OBJS) $(C_PIC_OBJS) $(CPP_PIC_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_INTEGRATION_CPP_OBJS): $(objroot)include/jemalloc/internal/private_namespace.h $(C_OBJS) $(CPP_OBJS) $(C_PIC_OBJS) $(CPP_PIC_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_INTEGRATION_CPP_OBJS): $(objroot)include/jemalloc/internal/private_namespace.h
$(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_STRESS_OBJS) $(TESTS_UNIT_OBJS) $(TESTS_STRESS_OBJS): $(objroot)include/jemalloc/internal/private_namespace_jet.h $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_ANALYZE_OBJS) $(C_TESTLIB_STRESS_OBJS) $(TESTS_UNIT_OBJS) $(TESTS_ANALYZE_OBJS) $(TESTS_STRESS_OBJS): $(objroot)include/jemalloc/internal/private_namespace_jet.h
$(C_SYM_OBJS) $(C_OBJS) $(C_PIC_OBJS) $(C_JET_SYM_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS): %.$(O): $(C_SYM_OBJS) $(C_OBJS) $(C_PIC_OBJS) $(C_JET_SYM_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS): %.$(O):
@mkdir -p $(@D) @mkdir -p $(@D)
...@@ -406,7 +496,7 @@ $(objroot)include/jemalloc/internal/private_namespace_jet.gen.h: $(C_JET_SYMS) ...@@ -406,7 +496,7 @@ $(objroot)include/jemalloc/internal/private_namespace_jet.gen.h: $(C_JET_SYMS)
$(SHELL) $(srcroot)include/jemalloc/internal/private_namespace.sh $^ > $@ $(SHELL) $(srcroot)include/jemalloc/internal/private_namespace.sh $^ > $@
%.h: %.gen.h %.h: %.gen.h
@if ! `cmp -s $< $@` ; then echo "cp $< $<"; cp $< $@ ; fi @if ! `cmp -s $< $@` ; then echo "cp $< $@"; cp $< $@ ; fi
$(CPP_OBJS) $(CPP_PIC_OBJS) $(TESTS_CPP_OBJS): %.$(O): $(CPP_OBJS) $(CPP_PIC_OBJS) $(TESTS_CPP_OBJS): %.$(O):
@mkdir -p $(@D) @mkdir -p $(@D)
...@@ -445,6 +535,10 @@ $(objroot)test/integration/cpp/%$(EXE): $(objroot)test/integration/cpp/%.$(O) $( ...@@ -445,6 +535,10 @@ $(objroot)test/integration/cpp/%$(EXE): $(objroot)test/integration/cpp/%.$(O) $(
@mkdir -p $(@D) @mkdir -p $(@D)
$(CXX) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) -lm $(EXTRA_LDFLAGS) $(CXX) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) -lm $(EXTRA_LDFLAGS)
$(objroot)test/analyze/%$(EXE): $(objroot)test/analyze/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_ANALYZE_OBJS)
@mkdir -p $(@D)
$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
$(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS) $(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
...@@ -461,20 +555,18 @@ endif ...@@ -461,20 +555,18 @@ endif
install_bin: install_bin:
$(INSTALL) -d $(BINDIR) $(INSTALL) -d $(BINDIR)
@for b in $(BINS); do \ @for b in $(BINS); do \
echo "$(INSTALL) -m 755 $$b $(BINDIR)"; \ $(INSTALL) -v -m 755 $$b $(BINDIR); \
$(INSTALL) -m 755 $$b $(BINDIR); \
done done
install_include: install_include:
$(INSTALL) -d $(INCLUDEDIR)/jemalloc $(INSTALL) -d $(INCLUDEDIR)/jemalloc
@for h in $(C_HDRS); do \ @for h in $(C_HDRS); do \
echo "$(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc"; \ $(INSTALL) -v -m 644 $$h $(INCLUDEDIR)/jemalloc; \
$(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc; \
done done
install_lib_shared: $(DSOS) install_lib_shared: $(DSOS)
$(INSTALL) -d $(LIBDIR) $(INSTALL) -d $(LIBDIR)
$(INSTALL) -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR) $(INSTALL) -v -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)
ifneq ($(SOREV),$(SO)) ifneq ($(SOREV),$(SO))
ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO) ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO)
endif endif
...@@ -482,15 +574,13 @@ endif ...@@ -482,15 +574,13 @@ endif
install_lib_static: $(STATIC_LIBS) install_lib_static: $(STATIC_LIBS)
$(INSTALL) -d $(LIBDIR) $(INSTALL) -d $(LIBDIR)
@for l in $(STATIC_LIBS); do \ @for l in $(STATIC_LIBS); do \
echo "$(INSTALL) -m 755 $$l $(LIBDIR)"; \ $(INSTALL) -v -m 755 $$l $(LIBDIR); \
$(INSTALL) -m 755 $$l $(LIBDIR); \
done done
install_lib_pc: $(PC) install_lib_pc: $(PC)
$(INSTALL) -d $(LIBDIR)/pkgconfig $(INSTALL) -d $(LIBDIR)/pkgconfig
@for l in $(PC); do \ @for l in $(PC); do \
echo "$(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig"; \ $(INSTALL) -v -m 644 $$l $(LIBDIR)/pkgconfig; \
$(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig; \
done done
ifeq ($(enable_shared), 1) ifeq ($(enable_shared), 1)
...@@ -501,21 +591,19 @@ install_lib: install_lib_static ...@@ -501,21 +591,19 @@ install_lib: install_lib_static
endif endif
install_lib: install_lib_pc install_lib: install_lib_pc
install_doc_html: install_doc_html: build_doc_html
$(INSTALL) -d $(DATADIR)/doc/jemalloc$(install_suffix) $(INSTALL) -d $(DATADIR)/doc/jemalloc$(install_suffix)
@for d in $(DOCS_HTML); do \ @for d in $(DOCS_HTML); do \
echo "$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \ $(INSTALL) -v -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
done done
install_doc_man: install_doc_man: build_doc_man
$(INSTALL) -d $(MANDIR)/man3 $(INSTALL) -d $(MANDIR)/man3
@for d in $(DOCS_MAN3); do \ @for d in $(DOCS_MAN3); do \
echo "$(INSTALL) -m 644 $$d $(MANDIR)/man3"; \ $(INSTALL) -v -m 644 $$d $(MANDIR)/man3; \
$(INSTALL) -m 644 $$d $(MANDIR)/man3; \
done done
install_doc: build_doc install_doc_html install_doc_man install_doc: install_doc_html install_doc_man
install: install_bin install_include install_lib install: install_bin install_include install_lib
...@@ -523,15 +611,60 @@ ifeq ($(enable_doc), 1) ...@@ -523,15 +611,60 @@ ifeq ($(enable_doc), 1)
install: install_doc install: install_doc
endif endif
uninstall_bin:
$(RM) -v $(foreach b,$(notdir $(BINS)),$(BINDIR)/$(b))
uninstall_include:
$(RM) -v $(foreach h,$(notdir $(C_HDRS)),$(INCLUDEDIR)/jemalloc/$(h))
rmdir -v $(INCLUDEDIR)/jemalloc
uninstall_lib_shared:
$(RM) -v $(LIBDIR)/$(LIBJEMALLOC).$(SOREV)
ifneq ($(SOREV),$(SO))
$(RM) -v $(LIBDIR)/$(LIBJEMALLOC).$(SO)
endif
uninstall_lib_static:
$(RM) -v $(foreach l,$(notdir $(STATIC_LIBS)),$(LIBDIR)/$(l))
uninstall_lib_pc:
$(RM) -v $(foreach p,$(notdir $(PC)),$(LIBDIR)/pkgconfig/$(p))
ifeq ($(enable_shared), 1)
uninstall_lib: uninstall_lib_shared
endif
ifeq ($(enable_static), 1)
uninstall_lib: uninstall_lib_static
endif
uninstall_lib: uninstall_lib_pc
uninstall_doc_html:
$(RM) -v $(foreach d,$(notdir $(DOCS_HTML)),$(DATADIR)/doc/jemalloc$(install_suffix)/$(d))
rmdir -v $(DATADIR)/doc/jemalloc$(install_suffix)
uninstall_doc_man:
$(RM) -v $(foreach d,$(notdir $(DOCS_MAN3)),$(MANDIR)/man3/$(d))
uninstall_doc: uninstall_doc_html uninstall_doc_man
uninstall: uninstall_bin uninstall_include uninstall_lib
ifeq ($(enable_doc), 1)
uninstall: uninstall_doc
endif
tests_unit: $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%$(EXE)) tests_unit: $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%$(EXE))
tests_integration: $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%$(EXE)) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%$(EXE)) tests_integration: $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%$(EXE)) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%$(EXE))
tests_analyze: $(TESTS_ANALYZE:$(srcroot)%.c=$(objroot)%$(EXE))
tests_stress: $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%$(EXE)) tests_stress: $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%$(EXE))
tests: tests_unit tests_integration tests_stress tests: tests_unit tests_integration tests_analyze tests_stress
check_unit_dir: check_unit_dir:
@mkdir -p $(objroot)test/unit @mkdir -p $(objroot)test/unit
check_integration_dir: check_integration_dir:
@mkdir -p $(objroot)test/integration @mkdir -p $(objroot)test/integration
analyze_dir:
@mkdir -p $(objroot)test/analyze
stress_dir: stress_dir:
@mkdir -p $(objroot)test/stress @mkdir -p $(objroot)test/stress
check_dir: check_unit_dir check_integration_dir check_dir: check_unit_dir check_integration_dir
...@@ -548,6 +681,12 @@ check_integration_decay: tests_integration check_integration_dir ...@@ -548,6 +681,12 @@ check_integration_decay: tests_integration check_integration_dir
$(MALLOC_CONF)="dirty_decay_ms:0,muzzy_decay_ms:0" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%) $(MALLOC_CONF)="dirty_decay_ms:0,muzzy_decay_ms:0" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
check_integration: tests_integration check_integration_dir check_integration: tests_integration check_integration_dir
$(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%) $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
analyze: tests_analyze analyze_dir
ifeq ($(enable_prof), 1)
$(MALLOC_CONF)="prof:true" $(SHELL) $(objroot)test/test.sh $(TESTS_ANALYZE:$(srcroot)%.c=$(objroot)%)
else
$(SHELL) $(objroot)test/test.sh $(TESTS_ANALYZE:$(srcroot)%.c=$(objroot)%)
endif
stress: tests_stress stress_dir stress: tests_stress stress_dir
$(SHELL) $(objroot)test/test.sh $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%) $(SHELL) $(objroot)test/test.sh $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%)
check: check_unit check_integration check_integration_decay check_integration_prof check: check_unit check_integration check_integration_decay check_integration_prof
......
This document summarizes the common approaches for performance fine tuning with This document summarizes the common approaches for performance fine tuning with
jemalloc (as of 5.1.0). The default configuration of jemalloc tends to work jemalloc (as of 5.3.0). The default configuration of jemalloc tends to work
reasonably well in practice, and most applications should not have to tune any reasonably well in practice, and most applications should not have to tune any
options. However, in order to cover a wide range of applications and avoid options. However, in order to cover a wide range of applications and avoid
pathological cases, the default setting is sometimes kept conservative and pathological cases, the default setting is sometimes kept conservative and
...@@ -76,14 +76,14 @@ Examples: ...@@ -76,14 +76,14 @@ Examples:
* High resource consumption application, prioritizing memory usage: * High resource consumption application, prioritizing memory usage:
`background_thread:true` combined with shorter decay time (decreased `background_thread:true,tcache_max:4096` combined with shorter decay time
`dirty_decay_ms` and / or `muzzy_decay_ms`, (decreased `dirty_decay_ms` and / or `muzzy_decay_ms`,
e.g. `dirty_decay_ms:5000,muzzy_decay_ms:5000`), and lower arena count e.g. `dirty_decay_ms:5000,muzzy_decay_ms:5000`), and lower arena count
(e.g. number of CPUs). (e.g. number of CPUs).
* Low resource consumption application: * Low resource consumption application:
`narenas:1,lg_tcache_max:13` combined with shorter decay time (decreased `narenas:1,tcache_max:1024` combined with shorter decay time (decreased
`dirty_decay_ms` and / or `muzzy_decay_ms`,e.g. `dirty_decay_ms` and / or `muzzy_decay_ms`,e.g.
`dirty_decay_ms:1000,muzzy_decay_ms:0`). `dirty_decay_ms:1000,muzzy_decay_ms:0`).
......
...@@ -205,6 +205,8 @@ Output type: ...@@ -205,6 +205,8 @@ Output type:
--svg Generate SVG to stdout --svg Generate SVG to stdout
--gif Generate GIF to stdout --gif Generate GIF to stdout
--raw Generate symbolized jeprof data (useful with remote fetch) --raw Generate symbolized jeprof data (useful with remote fetch)
--collapsed Generate collapsed stacks for building flame graphs
(see http://www.brendangregg.com/flamegraphs.html)
Heap-Profile Options: Heap-Profile Options:
--inuse_space Display in-use (mega)bytes [default] --inuse_space Display in-use (mega)bytes [default]
...@@ -238,6 +240,7 @@ Miscellaneous: ...@@ -238,6 +240,7 @@ Miscellaneous:
--test Run unit tests --test Run unit tests
--help This message --help This message
--version Version information --version Version information
--debug-syms-by-id (Linux only) Find debug symbol files by build ID as well as by name
Environment Variables: Environment Variables:
JEPROF_TMPDIR Profiles directory. Defaults to \$HOME/jeprof JEPROF_TMPDIR Profiles directory. Defaults to \$HOME/jeprof
...@@ -332,6 +335,7 @@ sub Init() { ...@@ -332,6 +335,7 @@ sub Init() {
$main::opt_gif = 0; $main::opt_gif = 0;
$main::opt_svg = 0; $main::opt_svg = 0;
$main::opt_raw = 0; $main::opt_raw = 0;
$main::opt_collapsed = 0;
$main::opt_nodecount = 80; $main::opt_nodecount = 80;
$main::opt_nodefraction = 0.005; $main::opt_nodefraction = 0.005;
...@@ -362,6 +366,7 @@ sub Init() { ...@@ -362,6 +366,7 @@ sub Init() {
$main::opt_tools = ""; $main::opt_tools = "";
$main::opt_debug = 0; $main::opt_debug = 0;
$main::opt_test = 0; $main::opt_test = 0;
$main::opt_debug_syms_by_id = 0;
# These are undocumented flags used only by unittests. # These are undocumented flags used only by unittests.
$main::opt_test_stride = 0; $main::opt_test_stride = 0;
...@@ -405,6 +410,7 @@ sub Init() { ...@@ -405,6 +410,7 @@ sub Init() {
"svg!" => \$main::opt_svg, "svg!" => \$main::opt_svg,
"gif!" => \$main::opt_gif, "gif!" => \$main::opt_gif,
"raw!" => \$main::opt_raw, "raw!" => \$main::opt_raw,
"collapsed!" => \$main::opt_collapsed,
"interactive!" => \$main::opt_interactive, "interactive!" => \$main::opt_interactive,
"nodecount=i" => \$main::opt_nodecount, "nodecount=i" => \$main::opt_nodecount,
"nodefraction=f" => \$main::opt_nodefraction, "nodefraction=f" => \$main::opt_nodefraction,
...@@ -429,6 +435,7 @@ sub Init() { ...@@ -429,6 +435,7 @@ sub Init() {
"tools=s" => \$main::opt_tools, "tools=s" => \$main::opt_tools,
"test!" => \$main::opt_test, "test!" => \$main::opt_test,
"debug!" => \$main::opt_debug, "debug!" => \$main::opt_debug,
"debug-syms-by-id!" => \$main::opt_debug_syms_by_id,
# Undocumented flags used only by unittests: # Undocumented flags used only by unittests:
"test_stride=i" => \$main::opt_test_stride, "test_stride=i" => \$main::opt_test_stride,
) || usage("Invalid option(s)"); ) || usage("Invalid option(s)");
...@@ -490,6 +497,7 @@ sub Init() { ...@@ -490,6 +497,7 @@ sub Init() {
$main::opt_svg + $main::opt_svg +
$main::opt_gif + $main::opt_gif +
$main::opt_raw + $main::opt_raw +
$main::opt_collapsed +
$main::opt_interactive + $main::opt_interactive +
0; 0;
if ($modes > 1) { if ($modes > 1) {
...@@ -572,6 +580,11 @@ sub Init() { ...@@ -572,6 +580,11 @@ sub Init() {
foreach (@prefix_list) { foreach (@prefix_list) {
s|/+$||; s|/+$||;
} }
# Flag to prevent us from trying over and over to use
# elfutils if it's not installed (used only with
# --debug-syms-by-id option).
$main::gave_up_on_elfutils = 0;
} }
sub FilterAndPrint { sub FilterAndPrint {
...@@ -621,6 +634,8 @@ sub FilterAndPrint { ...@@ -621,6 +634,8 @@ sub FilterAndPrint {
PrintText($symbols, $flat, $cumulative, -1); PrintText($symbols, $flat, $cumulative, -1);
} elsif ($main::opt_raw) { } elsif ($main::opt_raw) {
PrintSymbolizedProfile($symbols, $profile, $main::prog); PrintSymbolizedProfile($symbols, $profile, $main::prog);
} elsif ($main::opt_collapsed) {
PrintCollapsedStacks($symbols, $profile);
} elsif ($main::opt_callgrind) { } elsif ($main::opt_callgrind) {
PrintCallgrind($calls); PrintCallgrind($calls);
} else { } else {
...@@ -2810,6 +2825,40 @@ sub IsSecondPcAlwaysTheSame { ...@@ -2810,6 +2825,40 @@ sub IsSecondPcAlwaysTheSame {
return $second_pc; return $second_pc;
} }
sub ExtractSymbolNameInlineStack {
my $symbols = shift;
my $address = shift;
my @stack = ();
if (exists $symbols->{$address}) {
my @localinlinestack = @{$symbols->{$address}};
for (my $i = $#localinlinestack; $i > 0; $i-=3) {
my $file = $localinlinestack[$i-1];
my $fn = $localinlinestack[$i-0];
if ($file eq "?" || $file eq ":0") {
$file = "??:0";
}
if ($fn eq '??') {
# If we can't get the symbol name, at least use the file information.
$fn = $file;
}
my $suffix = "[inline]";
if ($i == 2) {
$suffix = "";
}
push (@stack, $fn.$suffix);
}
}
else {
# If we can't get a symbol name, at least fill in the address.
push (@stack, $address);
}
return @stack;
}
sub ExtractSymbolLocation { sub ExtractSymbolLocation {
my $symbols = shift; my $symbols = shift;
my $address = shift; my $address = shift;
...@@ -2884,6 +2933,17 @@ sub FilterFrames { ...@@ -2884,6 +2933,17 @@ sub FilterFrames {
return $result; return $result;
} }
sub PrintCollapsedStacks {
my $symbols = shift;
my $profile = shift;
while (my ($stack_trace, $count) = each %$profile) {
my @address = split(/\n/, $stack_trace);
my @names = reverse ( map { ExtractSymbolNameInlineStack($symbols, $_) } @address );
printf("%s %d\n", join(";", @names), $count);
}
}
sub RemoveUninterestingFrames { sub RemoveUninterestingFrames {
my $symbols = shift; my $symbols = shift;
my $profile = shift; my $profile = shift;
...@@ -4440,16 +4500,54 @@ sub FindLibrary { ...@@ -4440,16 +4500,54 @@ sub FindLibrary {
# For libc libraries, the copy in /usr/lib/debug contains debugging symbols # For libc libraries, the copy in /usr/lib/debug contains debugging symbols
sub DebuggingLibrary { sub DebuggingLibrary {
my $file = shift; my $file = shift;
if ($file =~ m|^/|) {
if (-f "/usr/lib/debug$file") { if ($file !~ m|^/|) {
return "/usr/lib/debug$file"; return undef;
} elsif (-f "/usr/lib/debug$file.debug") { }
return "/usr/lib/debug$file.debug";
# Find debug symbol file if it's named after the library's name.
if (-f "/usr/lib/debug$file") {
if($main::opt_debug) { print STDERR "found debug info for $file in /usr/lib/debug$file\n"; }
return "/usr/lib/debug$file";
} elsif (-f "/usr/lib/debug$file.debug") {
if($main::opt_debug) { print STDERR "found debug info for $file in /usr/lib/debug$file.debug\n"; }
return "/usr/lib/debug$file.debug";
}
if(!$main::opt_debug_syms_by_id) {
if($main::opt_debug) { print STDERR "no debug symbols found for $file\n" };
return undef;
}
# Find debug file if it's named after the library's build ID.
my $readelf = '';
if (!$main::gave_up_on_elfutils) {
$readelf = qx/eu-readelf -n ${file}/;
if ($?) {
print STDERR "Cannot run eu-readelf. To use --debug-syms-by-id you must be on Linux, with elfutils installed.\n";
$main::gave_up_on_elfutils = 1;
return undef;
}
my $buildID = $1 if $readelf =~ /Build ID: ([A-Fa-f0-9]+)/s;
if (defined $buildID && length $buildID > 0) {
my $symbolFile = '/usr/lib/debug/.build-id/' . substr($buildID, 0, 2) . '/' . substr($buildID, 2) . '.debug';
if (-e $symbolFile) {
if($main::opt_debug) { print STDERR "found debug symbol file $symbolFile for $file\n" };
return $symbolFile;
} else {
if($main::opt_debug) { print STDERR "no debug symbol file found for $file, build ID: $buildID\n" };
return undef;
} }
}
} }
if($main::opt_debug) { print STDERR "no debug symbols found for $file, build ID unknown\n" };
return undef; return undef;
} }
# Parse text section header of a library using objdump # Parse text section header of a library using objdump
sub ParseTextSectionHeaderFromObjdump { sub ParseTextSectionHeaderFromObjdump {
my $lib = shift; my $lib = shift;
...@@ -4987,7 +5085,7 @@ sub MapToSymbols { ...@@ -4987,7 +5085,7 @@ sub MapToSymbols {
} else { } else {
# MapSymbolsWithNM tags each routine with its starting address, # MapSymbolsWithNM tags each routine with its starting address,
# useful in case the image has multiple occurrences of this # useful in case the image has multiple occurrences of this
# routine. (It uses a syntax that resembles template paramters, # routine. (It uses a syntax that resembles template parameters,
# that are automatically stripped out by ShortFunctionName().) # that are automatically stripped out by ShortFunctionName().)
# addr2line does not provide the same information. So we check # addr2line does not provide the same information. So we check
# if nm disambiguated our symbol, and if so take the annotated # if nm disambiguated our symbol, and if so take the annotated
...@@ -5339,7 +5437,7 @@ sub GetProcedureBoundaries { ...@@ -5339,7 +5437,7 @@ sub GetProcedureBoundaries {
# "nm -f $image" is supposed to fail on GNU nm, but if: # "nm -f $image" is supposed to fail on GNU nm, but if:
# #
# a. $image starts with [BbSsPp] (for example, bin/foo/bar), AND # a. $image starts with [BbSsPp] (for example, bin/foo/bar), AND
# b. you have a.out in your current directory (a not uncommon occurence) # b. you have a.out in your current directory (a not uncommon occurrence)
# #
# then "nm -f $image" succeeds because -f only looks at the first letter of # then "nm -f $image" succeeds because -f only looks at the first letter of
# the argument, which looks valid because it's [BbSsPp], and then since # the argument, which looks valid because it's [BbSsPp], and then since
......
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright 1992-2016 Free Software Foundation, Inc. # Copyright 1992-2021 Free Software Foundation, Inc.
timestamp='2016-10-02' timestamp='2021-01-01'
# This file is free software; you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by
...@@ -15,7 +15,7 @@ timestamp='2016-10-02' ...@@ -15,7 +15,7 @@ timestamp='2016-10-02'
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <https://www.gnu.org/licenses/>.
# #
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
...@@ -27,19 +27,19 @@ timestamp='2016-10-02' ...@@ -27,19 +27,19 @@ timestamp='2016-10-02'
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
# #
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
# #
# Please send patches to <config-patches@gnu.org>. # Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'` me=$(echo "$0" | sed -e 's,.*/,,')
usage="\ usage="\
Usage: $0 [OPTION] Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on. Output the configuration name of the system \`$me' is run on.
Operation modes: Options:
-h, --help print this help, then exit -h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit -t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit -v, --version print version number, then exit
...@@ -50,7 +50,7 @@ version="\ ...@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright 1992-2016 Free Software Foundation, Inc. Copyright 1992-2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
...@@ -84,8 +84,6 @@ if test $# != 0; then ...@@ -84,8 +84,6 @@ if test $# != 0; then
exit 1 exit 1
fi fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a # 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 # 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 # temporary files to be created and, as you can see below, it is a
...@@ -96,66 +94,89 @@ trap 'exit 1' 1 2 15 ...@@ -96,66 +94,89 @@ trap 'exit 1' 1 2 15
# Portable tmp directory creation inspired by the Autoconf team. # Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build=' tmp=
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; # shellcheck disable=SC2172
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || set_cc_for_build() {
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || # prevent multiple calls if $tmp is already set
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || test "$tmp" && return 0
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; : "${TMPDIR=/tmp}"
dummy=$tmp/dummy ; # shellcheck disable=SC2039
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } ||
case $CC_FOR_BUILD,$HOST_CC,$CC in { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
,,) echo "int x;" > $dummy.c ; { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
for c in cc gcc c89 c99 ; do { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then dummy=$tmp/dummy
CC_FOR_BUILD="$c"; break ; case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
fi ; ,,) echo "int x;" > "$dummy.c"
done ; for driver in cc gcc c89 c99 ; do
if test x"$CC_FOR_BUILD" = x ; then if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD=no_compiler_found ; CC_FOR_BUILD="$driver"
fi break
;; fi
,,*) CC_FOR_BUILD=$CC ;; done
,*,*) CC_FOR_BUILD=$HOST_CC ;; if test x"$CC_FOR_BUILD" = x ; then
esac ; set_cc_for_build= ;' 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. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24) # (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then if test -f /.attbin/uname ; then
PATH=$PATH:/.attbin ; export PATH PATH=$PATH:/.attbin ; export PATH
fi fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in case "$UNAME_SYSTEM" in
Linux|GNU|GNU/*) Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc. LIBC=unknown
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build set_cc_for_build
cat <<-EOF > $dummy.c cat <<-EOF > "$dummy.c"
#include <features.h> #include <features.h>
#if defined(__UCLIBC__) #if defined(__UCLIBC__)
LIBC=uclibc LIBC=uclibc
#elif defined(__dietlibc__) #elif defined(__dietlibc__)
LIBC=dietlibc LIBC=dietlibc
#else #elif defined(__GLIBC__)
LIBC=gnu LIBC=gnu
#else
#include <stdarg.h>
/* First heuristic to detect musl libc. */
#ifdef __DEFINED_va_list
LIBC=musl
#endif
#endif #endif
EOF EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')"
# 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 esac
# Note: order is significant - the case branches are not exclusive. # Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
*:NetBSD:*:*) *:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or # NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
...@@ -168,31 +189,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -168,31 +189,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor # Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown". # portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch" sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \
echo unknown)` echo unknown))
case "${UNAME_MACHINE_ARCH}" in case "$UNAME_MACHINE_ARCH" in
aarch64eb) machine=aarch64_be-unknown ;;
armeb) machine=armeb-unknown ;; armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;; arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;; sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;; sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;; sh5el) machine=sh5le-unknown ;;
earmv*) earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,')
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p')
machine=${arch}${endian}-unknown machine="${arch}${endian}"-unknown
;; ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
esac esac
# The Operating System including object format, if it has switched # The Operating System including object format, if it has switched
# to ELF recently (or will in the future) and ABI. # to ELF recently (or will in the future) and ABI.
case "${UNAME_MACHINE_ARCH}" in case "$UNAME_MACHINE_ARCH" in
earm*) earm*)
os=netbsdelf os=netbsdelf
;; ;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax) arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__ | grep -q __ELF__
then then
...@@ -208,10 +230,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -208,10 +230,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
;; ;;
esac esac
# Determine ABI tags. # Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in case "$UNAME_MACHINE_ARCH" in
earm*) earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//' expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr")
;; ;;
esac esac
# The OS release # The OS release
...@@ -219,60 +241,75 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -219,60 +241,75 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# thus, need a distinct triplet. However, they do not need # thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a # kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu. # suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in case "$UNAME_VERSION" in
Debian*) Debian*)
release='-gnu' release='-gnu'
;; ;;
*) *)
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2)
;; ;;
esac esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form: # contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}${abi}" echo "$machine-${os}${release}${abi-}"
exit ;; exit ;;
*:Bitrig:*:*) *:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//')
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
exit ;; exit ;;
*:OpenBSD:*:*) *:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//')
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
exit ;; exit ;;
*:LibertyBSD:*:*) *:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//')
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
exit ;;
*:MidnightBSD:*:*)
echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
exit ;; exit ;;
*:ekkoBSD:*:*) *:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
exit ;; exit ;;
*:SolidBSD:*:*) *:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
exit ;;
*:OS108:*:*)
echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
exit ;; exit ;;
macppc:MirBSD:*:*) macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd${UNAME_RELEASE} echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
exit ;; exit ;;
*:MirBSD:*:*) *:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
exit ;; exit ;;
*:Sortix:*:*) *:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix echo "$UNAME_MACHINE"-unknown-sortix
exit ;;
*:Twizzler:*:*)
echo "$UNAME_MACHINE"-unknown-twizzler
exit ;;
*:Redox:*:*)
echo "$UNAME_MACHINE"-unknown-redox
exit ;;
mips:OSF1:*.*)
echo mips-dec-osf1
exit ;; exit ;;
alpha:OSF1:*:*) alpha:OSF1:*:*)
case $UNAME_RELEASE in case $UNAME_RELEASE in
*4.0) *4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}')
;; ;;
*5.*) *5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}')
;; ;;
esac esac
# According to Compaq, /usr/sbin/psrinfo has been available on # According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that # OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU # covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0. # 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` ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1)
case "$ALPHA_CPU_TYPE" in case "$ALPHA_CPU_TYPE" in
"EV4 (21064)") "EV4 (21064)")
UNAME_MACHINE=alpha ;; UNAME_MACHINE=alpha ;;
...@@ -310,28 +347,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -310,28 +347,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Tn.n version is a released field test version. # A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"
# Reset EXIT trap before exiting to avoid spurious non-zero exit code. # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$? exitcode=$?
trap '' 0 trap '' 0
exit $exitcode ;; exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
Amiga*:UNIX_System_V:4.0:*) Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4 echo m68k-unknown-sysv4
exit ;; exit ;;
*:[Aa]miga[Oo][Ss]:*:*) *:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos echo "$UNAME_MACHINE"-unknown-amigaos
exit ;; exit ;;
*:[Mm]orph[Oo][Ss]:*:*) *:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos echo "$UNAME_MACHINE"-unknown-morphos
exit ;; exit ;;
*:OS/390:*:*) *:OS/390:*:*)
echo i370-ibm-openedition echo i370-ibm-openedition
...@@ -343,7 +371,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -343,7 +371,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo powerpc-ibm-os400 echo powerpc-ibm-os400
exit ;; exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE} echo arm-acorn-riscix"$UNAME_RELEASE"
exit ;; exit ;;
arm*:riscos:*:*|arm*:RISCOS:*:*) arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos echo arm-unknown-riscos
...@@ -353,7 +381,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -353,7 +381,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;; exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then if test "$( (/bin/universe) 2>/dev/null)" = att ; then
echo pyramid-pyramid-sysv3 echo pyramid-pyramid-sysv3
else else
echo pyramid-pyramid-bsd echo pyramid-pyramid-bsd
...@@ -366,28 +394,28 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -366,28 +394,28 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo sparc-icl-nx6 echo sparc-icl-nx6
exit ;; exit ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in case $(/usr/bin/uname -p) in
sparc) echo sparc-icl-nx7; exit ;; sparc) echo sparc-icl-nx7; exit ;;
esac ;; esac ;;
s390x:SunOS:*:*) s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
exit ;; exit ;;
sun4H:SunOS:5.*:*) sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
exit ;; exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
exit ;; exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE} echo i386-pc-auroraux"$UNAME_RELEASE"
exit ;; exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build set_cc_for_build
SUN_ARCH=i386 SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects. # 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. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers. # This test works for both compilers.
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null grep IS_64BIT_ARCH >/dev/null
...@@ -395,40 +423,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -395,40 +423,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
SUN_ARCH=x86_64 SUN_ARCH=x86_64
fi fi
fi fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
exit ;; exit ;;
sun4*:SunOS:6*:*) sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize # According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but # SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4. # it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
exit ;; exit ;;
sun4*:SunOS:*:*) sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in case "$(/usr/bin/arch -k)" in
Series*|S4*) Series*|S4*)
UNAME_RELEASE=`uname -v` UNAME_RELEASE=$(uname -v)
;; ;;
esac esac
# Japanese Language versions have a version number like `4.1.3-JL'. # Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"
exit ;; exit ;;
sun3*:SunOS:*:*) sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE} echo m68k-sun-sunos"$UNAME_RELEASE"
exit ;; exit ;;
sun*:*:4.2BSD:*) sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null)
test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
case "`/bin/arch`" in case "$(/bin/arch)" in
sun3) sun3)
echo m68k-sun-sunos${UNAME_RELEASE} echo m68k-sun-sunos"$UNAME_RELEASE"
;; ;;
sun4) sun4)
echo sparc-sun-sunos${UNAME_RELEASE} echo sparc-sun-sunos"$UNAME_RELEASE"
;; ;;
esac esac
exit ;; exit ;;
aushp:SunOS:*:*) aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE} echo sparc-auspex-sunos"$UNAME_RELEASE"
exit ;; exit ;;
# The situation for MiNT is a little confusing. The machine name # The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not # can be virtually everything (everything which is not
...@@ -439,44 +467,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -439,44 +467,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should # MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem. # be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE} echo m68k-atari-mint"$UNAME_RELEASE"
exit ;; exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE} echo m68k-atari-mint"$UNAME_RELEASE"
exit ;; exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE} echo m68k-atari-mint"$UNAME_RELEASE"
exit ;; exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE} echo m68k-milan-mint"$UNAME_RELEASE"
exit ;; exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE} echo m68k-hades-mint"$UNAME_RELEASE"
exit ;; exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE} echo m68k-unknown-mint"$UNAME_RELEASE"
exit ;; exit ;;
m68k:machten:*:*) m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE} echo m68k-apple-machten"$UNAME_RELEASE"
exit ;; exit ;;
powerpc:machten:*:*) powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE} echo powerpc-apple-machten"$UNAME_RELEASE"
exit ;; exit ;;
RISC*:Mach:*:*) RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3 echo mips-dec-mach_bsd4.3
exit ;; exit ;;
RISC*:ULTRIX:*:*) RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE} echo mips-dec-ultrix"$UNAME_RELEASE"
exit ;; exit ;;
VAX*:ULTRIX*:*:*) VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE} echo vax-dec-ultrix"$UNAME_RELEASE"
exit ;; exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*) 2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE} echo clipper-intergraph-clix"$UNAME_RELEASE"
exit ;; exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos) mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF > "$dummy.c"
#ifdef __cplusplus #ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */ #include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
...@@ -485,23 +513,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ...@@ -485,23 +513,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#endif #endif
#if defined (host_mips) && defined (MIPSEB) #if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV) #if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
#endif #endif
#if defined (SYSTYPE_SVR4) #if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
#endif #endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
#endif #endif
#endif #endif
exit (-1); exit (-1);
} }
EOF EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&
SYSTEM_NAME=`$dummy $dummyarg` && SYSTEM_NAME=$("$dummy" "$dummyarg") &&
{ echo "$SYSTEM_NAME"; exit; } { echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE} echo mips-mips-riscos"$UNAME_RELEASE"
exit ;; exit ;;
Motorola:PowerMAX_OS:*:*) Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax echo powerpc-motorola-powermax
...@@ -526,18 +554,18 @@ EOF ...@@ -526,18 +554,18 @@ EOF
exit ;; exit ;;
AViiON:dgux:*:*) AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures # DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p` UNAME_PROCESSOR=$(/usr/bin/uname -p)
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
then then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
[ ${TARGET_BINARY_INTERFACE}x = x ] test "$TARGET_BINARY_INTERFACE"x = x
then then
echo m88k-dg-dgux${UNAME_RELEASE} echo m88k-dg-dgux"$UNAME_RELEASE"
else else
echo m88k-dg-dguxbcs${UNAME_RELEASE} echo m88k-dg-dguxbcs"$UNAME_RELEASE"
fi fi
else else
echo i586-dg-dgux${UNAME_RELEASE} echo i586-dg-dgux"$UNAME_RELEASE"
fi fi
exit ;; exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3) M88*:DolphinOS:*:*) # DolphinOS (SVR3)
...@@ -554,26 +582,26 @@ EOF ...@@ -554,26 +582,26 @@ EOF
echo m68k-tektronix-bsd echo m68k-tektronix-bsd
exit ;; exit ;;
*:IRIX*:*:*) *:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"
exit ;; exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX '
i*86:AIX:*:*) i*86:AIX:*:*)
echo i386-ibm-aix echo i386-ibm-aix
exit ;; exit ;;
ia64:AIX:*:*) ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then if test -x /usr/bin/oslevel ; then
IBM_REV=`/usr/bin/oslevel` IBM_REV=$(/usr/bin/oslevel)
else else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
fi fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
exit ;; exit ;;
*:AIX:2:3) *:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h> #include <sys/systemcfg.h>
main() main()
...@@ -584,7 +612,7 @@ EOF ...@@ -584,7 +612,7 @@ EOF
exit(0); exit(0);
} }
EOF EOF
if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy")
then then
echo "$SYSTEM_NAME" echo "$SYSTEM_NAME"
else else
...@@ -597,28 +625,28 @@ EOF ...@@ -597,28 +625,28 @@ EOF
fi fi
exit ;; exit ;;
*:AIX:*:[4567]) *:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` 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 if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000 IBM_ARCH=rs6000
else else
IBM_ARCH=powerpc IBM_ARCH=powerpc
fi fi
if [ -x /usr/bin/lslpp ] ; then if test -x /usr/bin/lslpp ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` awk -F: '{ print $3 }' | sed s/[0-9]*$/0/)
else else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
fi fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV} echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
exit ;; exit ;;
*:AIX:*:*) *:AIX:*:*)
echo rs6000-ibm-aix echo rs6000-ibm-aix
exit ;; exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*) ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
echo romp-ibm-bsd4.4 echo romp-ibm-bsd4.4
exit ;; exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to
exit ;; # report: romp-ibm BSD 4.3 exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*) *:BOSX:*:*)
echo rs6000-bull-bosx echo rs6000-bull-bosx
...@@ -633,28 +661,28 @@ EOF ...@@ -633,28 +661,28 @@ EOF
echo m68k-hp-bsd4.4 echo m68k-hp-bsd4.4
exit ;; exit ;;
9000/[34678]??:HP-UX:*:*) 9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
case "${UNAME_MACHINE}" in case "$UNAME_MACHINE" in
9000/31? ) HP_ARCH=m68000 ;; 9000/31?) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;; 9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9]) 9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then if test -x /usr/bin/getconf; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null)
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null)
case "${sc_cpu_version}" in case "$sc_cpu_version" in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0 532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in case "$sc_kernel_bits" in
32) HP_ARCH=hppa2.0n ;; 32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;; 64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;; esac ;;
esac esac
fi fi
if [ "${HP_ARCH}" = "" ]; then if test "$HP_ARCH" = ""; then
eval $set_cc_for_build set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF > "$dummy.c"
#define _HPUX_SOURCE #define _HPUX_SOURCE
#include <stdlib.h> #include <stdlib.h>
...@@ -687,13 +715,13 @@ EOF ...@@ -687,13 +715,13 @@ EOF
exit (0); exit (0);
} }
EOF EOF
(CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy")
test -z "$HP_ARCH" && HP_ARCH=hppa test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;; fi ;;
esac esac
if [ ${HP_ARCH} = hppa2.0w ] if test "$HP_ARCH" = hppa2.0w
then then
eval $set_cc_for_build set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 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 # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
...@@ -712,15 +740,15 @@ EOF ...@@ -712,15 +740,15 @@ EOF
HP_ARCH=hppa64 HP_ARCH=hppa64
fi fi
fi fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV} echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
exit ;; exit ;;
ia64:HP-UX:*:*) ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
echo ia64-hp-hpux${HPUX_REV} echo ia64-hp-hpux"$HPUX_REV"
exit ;; exit ;;
3050*:HI-UX:*:*) 3050*:HI-UX:*:*)
eval $set_cc_for_build set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF > "$dummy.c"
#include <unistd.h> #include <unistd.h>
int int
main () main ()
...@@ -745,11 +773,11 @@ EOF ...@@ -745,11 +773,11 @@ EOF
exit (0); exit (0);
} }
EOF EOF
$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&
{ echo "$SYSTEM_NAME"; exit; } { echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2 echo unknown-hitachi-hiuxwe2
exit ;; exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
echo hppa1.1-hp-bsd echo hppa1.1-hp-bsd
exit ;; exit ;;
9000/8??:4.3bsd:*:*) 9000/8??:4.3bsd:*:*)
...@@ -758,17 +786,17 @@ EOF ...@@ -758,17 +786,17 @@ EOF
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix echo hppa1.0-hp-mpeix
exit ;; exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
echo hppa1.1-hp-osf echo hppa1.1-hp-osf
exit ;; exit ;;
hp8??:OSF1:*:*) hp8??:OSF1:*:*)
echo hppa1.0-hp-osf echo hppa1.0-hp-osf
exit ;; exit ;;
i*86:OSF1:*:*) i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then if test -x /usr/sbin/sysversion ; then
echo ${UNAME_MACHINE}-unknown-osf1mk echo "$UNAME_MACHINE"-unknown-osf1mk
else else
echo ${UNAME_MACHINE}-unknown-osf1 echo "$UNAME_MACHINE"-unknown-osf1
fi fi
exit ;; exit ;;
parisc*:Lites*:*:*) parisc*:Lites*:*:*)
...@@ -793,130 +821,123 @@ EOF ...@@ -793,130 +821,123 @@ EOF
echo c4-convex-bsd echo c4-convex-bsd
exit ;; exit ;;
CRAY*Y-MP:*:*:*) CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;; exit ;;
CRAY*[A-Z]90:*:*:*) CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/' -e 's/\.[^.]*$/.X/'
exit ;; exit ;;
CRAY*TS:*:*:*) CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;; exit ;;
CRAY*T3E:*:*:*) CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;; exit ;;
CRAY*SV1:*:*:*) CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;; exit ;;
*:UNICOS/mp:*:*) *:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;; exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/')
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;; exit ;;
5000:UNIX_System_V:4.*:*) 5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/')
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;; exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
exit ;; exit ;;
sparc*:BSD/OS:*:*) sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE} echo sparc-unknown-bsdi"$UNAME_RELEASE"
exit ;; exit ;;
*:BSD/OS:*:*) *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
exit ;;
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
echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi
else
echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf
fi
exit ;; exit ;;
*:FreeBSD:*:*) *:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p` UNAME_PROCESSOR=$(/usr/bin/uname -p)
case ${UNAME_PROCESSOR} in case "$UNAME_PROCESSOR" in
amd64) amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; UNAME_PROCESSOR=x86_64 ;;
*) i386)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; UNAME_PROCESSOR=i586 ;;
esac esac
echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
exit ;; exit ;;
i*:CYGWIN*:*) i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin echo "$UNAME_MACHINE"-pc-cygwin
exit ;; exit ;;
*:MINGW64*:*) *:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64 echo "$UNAME_MACHINE"-pc-mingw64
exit ;; exit ;;
*:MINGW*:*) *:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32 echo "$UNAME_MACHINE"-pc-mingw32
exit ;; exit ;;
*:MSYS*:*) *:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys echo "$UNAME_MACHINE"-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;; exit ;;
i*:PW*:*) i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32 echo "$UNAME_MACHINE"-pc-pw32
exit ;; exit ;;
*:Interix*:*) *:Interix*:*)
case ${UNAME_MACHINE} in case "$UNAME_MACHINE" in
x86) x86)
echo i586-pc-interix${UNAME_RELEASE} echo i586-pc-interix"$UNAME_RELEASE"
exit ;; exit ;;
authenticamd | genuineintel | EM64T) authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE} echo x86_64-unknown-interix"$UNAME_RELEASE"
exit ;; exit ;;
IA64) IA64)
echo ia64-unknown-interix${UNAME_RELEASE} echo ia64-unknown-interix"$UNAME_RELEASE"
exit ;; exit ;;
esac ;; esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*) i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin echo "$UNAME_MACHINE"-pc-uwin
exit ;; exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin echo x86_64-pc-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;; exit ;;
prep*:SunOS:5.*:*) prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
exit ;; exit ;;
*:GNU:*:*) *:GNU:*:*)
# the GNU system # the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')"
exit ;; exit ;;
*:GNU/*:*:*) *:GNU/*:*:*)
# other systems with GNU libc and userland # other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC"
exit ;; exit ;;
i*86:Minix:*:*) *:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo "$UNAME_MACHINE"-unknown-minix
exit ;; exit ;;
aarch64:Linux:*:*) aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
aarch64_be:Linux:*:*) aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
alpha:Linux:*:*) alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
EV5) UNAME_MACHINE=alphaev5 ;; EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;; EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;; PCA56) UNAME_MACHINE=alphapca56 ;;
...@@ -927,140 +948,181 @@ EOF ...@@ -927,140 +948,181 @@ EOF
esac esac
objdump --private-headers /bin/sh | grep -q ld.so.1 objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
arc:Linux:*:* | arceb:Linux:*:*) arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
arm*:Linux:*:*) arm*:Linux:*:*)
eval $set_cc_for_build set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__ | grep -q __ARM_EABI__
then then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
else else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP | grep -q __ARM_PCS_VFP
then then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
else else
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
fi fi
fi fi
exit ;; exit ;;
avr32*:Linux:*:*) avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
cris:Linux:*:*) cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC} echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
exit ;; exit ;;
crisv32:Linux:*:*) crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC} echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
exit ;; exit ;;
e2k:Linux:*:*) e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
frv:Linux:*:*) frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
hexagon:Linux:*:*) hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
i*86:Linux:*:*) i*86:Linux:*:*)
echo ${UNAME_MACHINE}-pc-linux-${LIBC} echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
exit ;; exit ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
k1om:Linux:*:*) k1om:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
m32r*:Linux:*:*) m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
m68*:Linux:*:*) m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
mips:Linux:*:* | mips64:Linux:*:*) mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build set_cc_for_build
sed 's/^ //' << EOF >$dummy.c IS_GLIBC=0
test x"${LIBC}" = xgnu && IS_GLIBC=1
sed 's/^ //' << EOF > "$dummy.c"
#undef CPU #undef CPU
#undef ${UNAME_MACHINE} #undef mips
#undef ${UNAME_MACHINE}el #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) #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el MIPS_ENDIAN=el
#else #else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE} MIPS_ENDIAN=
#else #else
CPU= MIPS_ENDIAN=
#endif #endif
#endif #endif
EOF EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
;; ;;
mips64el:Linux:*:*) mips64el:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
openrisc*:Linux:*:*) openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC} echo or1k-unknown-linux-"$LIBC"
exit ;; exit ;;
or32:Linux:*:* | or1k*:Linux:*:*) or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
padre:Linux:*:*) padre:Linux:*:*)
echo sparc-unknown-linux-${LIBC} echo sparc-unknown-linux-"$LIBC"
exit ;; exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*) parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-${LIBC} echo hppa64-unknown-linux-"$LIBC"
exit ;; exit ;;
parisc:Linux:*:* | hppa:Linux:*:*) parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level # Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
*) echo hppa-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-"$LIBC" ;;
esac esac
exit ;; exit ;;
ppc64:Linux:*:*) ppc64:Linux:*:*)
echo powerpc64-unknown-linux-${LIBC} echo powerpc64-unknown-linux-"$LIBC"
exit ;; exit ;;
ppc:Linux:*:*) ppc:Linux:*:*)
echo powerpc-unknown-linux-${LIBC} echo powerpc-unknown-linux-"$LIBC"
exit ;; exit ;;
ppc64le:Linux:*:*) ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC} echo powerpc64le-unknown-linux-"$LIBC"
exit ;; exit ;;
ppcle:Linux:*:*) ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC} echo powerpcle-unknown-linux-"$LIBC"
exit ;; exit ;;
riscv32:Linux:*:* | riscv64:Linux:*:*) riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
s390:Linux:*:* | s390x:Linux:*:*) s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC} echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
exit ;; exit ;;
sh64*:Linux:*:*) sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
sh*:Linux:*:*) sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*) sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
tile*:Linux:*:*) tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
vax:Linux:*:*) vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-${LIBC} echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
exit ;; exit ;;
x86_64:Linux:*:*) x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-pc-linux-${LIBC} set_cc_for_build
LIBCABI=$LIBC
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_X32 >/dev/null
then
LIBCABI="$LIBC"x32
fi
fi
echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
exit ;; exit ;;
xtensa*:Linux:*:*) xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC} echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
i*86:DYNIX/ptx:4*:*) i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
...@@ -1074,51 +1136,51 @@ EOF ...@@ -1074,51 +1136,51 @@ EOF
# I am not positive that other SVR4 systems won't match this, # I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms. # I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it. # Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
exit ;; exit ;;
i*86:OS/2:*:*) i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility # If we were able to find `uname', then EMX Unix compatibility
# is probably installed. # is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx echo "$UNAME_MACHINE"-pc-os2-emx
exit ;; exit ;;
i*86:XTS-300:*:STOP) i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop echo "$UNAME_MACHINE"-unknown-stop
exit ;; exit ;;
i*86:atheos:*:*) i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos echo "$UNAME_MACHINE"-unknown-atheos
exit ;; exit ;;
i*86:syllable:*:*) i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable echo "$UNAME_MACHINE"-pc-syllable
exit ;; exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE} echo i386-unknown-lynxos"$UNAME_RELEASE"
exit ;; exit ;;
i*86:*DOS:*:*) i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp echo "$UNAME_MACHINE"-pc-msdosdjgpp
exit ;; exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) i*86:*:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//')
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
else else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
fi fi
exit ;; exit ;;
i*86:*:5:[678]*) i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6. # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in case $(/bin/uname -X | grep "^Machine") in
*486*) UNAME_MACHINE=i486 ;; *486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;; *Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
exit ;; exit ;;
i*86:*:3.2:*) i*86:*:3.2:*)
if test -f /usr/options/cb.name; then if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` UNAME_REL=$(sed -n 's/.*Version //p' </usr/options/cb.name)
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
elif /bin/uname -X 2>/dev/null >/dev/null ; then elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //'))
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586 && UNAME_MACHINE=i586
...@@ -1126,9 +1188,9 @@ EOF ...@@ -1126,9 +1188,9 @@ EOF
&& UNAME_MACHINE=i686 && UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686 && UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
else else
echo ${UNAME_MACHINE}-pc-sysv32 echo "$UNAME_MACHINE"-pc-sysv32
fi fi
exit ;; exit ;;
pc:*:*:*) pc:*:*:*)
...@@ -1148,9 +1210,9 @@ EOF ...@@ -1148,9 +1210,9 @@ EOF
exit ;; exit ;;
i860:*:4.*:*) # i860-SVR4 i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered. else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4
fi fi
exit ;; exit ;;
mini*:CTIX:SYS*5:*) mini*:CTIX:SYS*5:*)
...@@ -1168,41 +1230,41 @@ EOF ...@@ -1168,41 +1230,41 @@ EOF
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) 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='' OS_REL=''
test -r /etc/.relid \ test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /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 \ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; } && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;; && { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*) NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3' OS_REL='.3'
test -r /etc/.relid \ test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /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 \ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; } && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE} echo m68k-unknown-lynxos"$UNAME_RELEASE"
exit ;; exit ;;
mc68030:UNIX_System_V:4.*:*) mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4 echo m68k-atari-sysv4
exit ;; exit ;;
TSUNAMI:LynxOS:2.*:*) TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE} echo sparc-unknown-lynxos"$UNAME_RELEASE"
exit ;; exit ;;
rs6000:LynxOS:2.*:*) rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE} echo rs6000-unknown-lynxos"$UNAME_RELEASE"
exit ;; exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE} echo powerpc-unknown-lynxos"$UNAME_RELEASE"
exit ;; exit ;;
SM[BE]S:UNIX_SV:*:*) SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE} echo mips-dde-sysv"$UNAME_RELEASE"
exit ;; exit ;;
RM*:ReliantUNIX-*:*:*) RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4 echo mips-sni-sysv4
...@@ -1212,8 +1274,8 @@ EOF ...@@ -1212,8 +1274,8 @@ EOF
exit ;; exit ;;
*:SINIX-*:*:*) *:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null` UNAME_MACHINE=$( (uname -p) 2>/dev/null)
echo ${UNAME_MACHINE}-sni-sysv4 echo "$UNAME_MACHINE"-sni-sysv4
else else
echo ns32k-sni-sysv echo ns32k-sni-sysv
fi fi
...@@ -1233,23 +1295,23 @@ EOF ...@@ -1233,23 +1295,23 @@ EOF
exit ;; exit ;;
i*86:VOS:*:*) i*86:VOS:*:*)
# From Paul.Green@stratus.com. # From Paul.Green@stratus.com.
echo ${UNAME_MACHINE}-stratus-vos echo "$UNAME_MACHINE"-stratus-vos
exit ;; exit ;;
*:VOS:*:*) *:VOS:*:*)
# From Paul.Green@stratus.com. # From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos echo hppa1.1-stratus-vos
exit ;; exit ;;
mc68*:A/UX:*:*) mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE} echo m68k-apple-aux"$UNAME_RELEASE"
exit ;; exit ;;
news*:NEWS-OS:6*:*) news*:NEWS-OS:6*:*)
echo mips-sony-newsos6 echo mips-sony-newsos6
exit ;; exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then if test -d /usr/nec; then
echo mips-nec-sysv${UNAME_RELEASE} echo mips-nec-sysv"$UNAME_RELEASE"
else else
echo mips-unknown-sysv${UNAME_RELEASE} echo mips-unknown-sysv"$UNAME_RELEASE"
fi fi
exit ;; exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
...@@ -1268,80 +1330,97 @@ EOF ...@@ -1268,80 +1330,97 @@ EOF
echo x86_64-unknown-haiku echo x86_64-unknown-haiku
exit ;; exit ;;
SX-4:SUPER-UX:*:*) SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE} echo sx4-nec-superux"$UNAME_RELEASE"
exit ;; exit ;;
SX-5:SUPER-UX:*:*) SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE} echo sx5-nec-superux"$UNAME_RELEASE"
exit ;; exit ;;
SX-6:SUPER-UX:*:*) SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE} echo sx6-nec-superux"$UNAME_RELEASE"
exit ;; exit ;;
SX-7:SUPER-UX:*:*) SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE} echo sx7-nec-superux"$UNAME_RELEASE"
exit ;; exit ;;
SX-8:SUPER-UX:*:*) SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE} echo sx8-nec-superux"$UNAME_RELEASE"
exit ;; exit ;;
SX-8R:SUPER-UX:*:*) SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE} echo sx8r-nec-superux"$UNAME_RELEASE"
exit ;; exit ;;
SX-ACE:SUPER-UX:*:*) SX-ACE:SUPER-UX:*:*)
echo sxace-nec-superux${UNAME_RELEASE} echo sxace-nec-superux"$UNAME_RELEASE"
exit ;; exit ;;
Power*:Rhapsody:*:*) Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE} echo powerpc-apple-rhapsody"$UNAME_RELEASE"
exit ;; exit ;;
*:Rhapsody:*:*) *:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
exit ;;
arm64:Darwin:*:*)
echo aarch64-apple-darwin"$UNAME_RELEASE"
exit ;; exit ;;
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=$(uname -p)
eval $set_cc_for_build case $UNAME_PROCESSOR in
if test "$UNAME_PROCESSOR" = unknown ; then unknown) UNAME_PROCESSOR=powerpc ;;
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 fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if test "$CC_FOR_BUILD" != no_compiler_found; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null
grep IS_64BIT_ARCH >/dev/null then
then case $UNAME_PROCESSOR in
case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;;
i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;; esac
esac fi
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 fi
elif test "$UNAME_PROCESSOR" = i386 ; then elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub # uname -m returns i386 or x86_64
# that puts up a graphical alert prompting to install UNAME_PROCESSOR=$UNAME_MACHINE
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
exit ;; exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*) *:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p` UNAME_PROCESSOR=$(uname -p)
if test "$UNAME_PROCESSOR" = x86; then if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386 UNAME_PROCESSOR=i386
UNAME_MACHINE=pc UNAME_MACHINE=pc
fi fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
exit ;; exit ;;
*:QNX:*:4*) *:QNX:*:4*)
echo i386-pc-qnx echo i386-pc-qnx
exit ;; exit ;;
NEO-?:NONSTOP_KERNEL:*:*) NEO-*:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE} echo neo-tandem-nsk"$UNAME_RELEASE"
exit ;; exit ;;
NSE-*:NONSTOP_KERNEL:*:*) NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE} echo nse-tandem-nsk"$UNAME_RELEASE"
exit ;;
NSR-*:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk"$UNAME_RELEASE"
exit ;;
NSV-*:NONSTOP_KERNEL:*:*)
echo nsv-tandem-nsk"$UNAME_RELEASE"
exit ;; exit ;;
NSR-?:NONSTOP_KERNEL:*:*) NSX-*:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE} echo nsx-tandem-nsk"$UNAME_RELEASE"
exit ;; exit ;;
*:NonStop-UX:*:*) *:NonStop-UX:*:*)
echo mips-compaq-nonstopux echo mips-compaq-nonstopux
...@@ -1350,18 +1429,19 @@ EOF ...@@ -1350,18 +1429,19 @@ EOF
echo bs2000-siemens-sysv echo bs2000-siemens-sysv
exit ;; exit ;;
DS/*:UNIX_System_V:*:*) DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
exit ;; exit ;;
*:Plan9:*:*) *:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386 # "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86 # is converted to i386 for consistency with other x86
# operating systems. # operating systems.
# shellcheck disable=SC2154
if test "$cputype" = 386; then if test "$cputype" = 386; then
UNAME_MACHINE=i386 UNAME_MACHINE=i386
else else
UNAME_MACHINE="$cputype" UNAME_MACHINE="$cputype"
fi fi
echo ${UNAME_MACHINE}-unknown-plan9 echo "$UNAME_MACHINE"-unknown-plan9
exit ;; exit ;;
*:TOPS-10:*:*) *:TOPS-10:*:*)
echo pdp10-unknown-tops10 echo pdp10-unknown-tops10
...@@ -1382,14 +1462,14 @@ EOF ...@@ -1382,14 +1462,14 @@ EOF
echo pdp10-unknown-its echo pdp10-unknown-its
exit ;; exit ;;
SEI:*:*:SEIUX) SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE} echo mips-sei-seiux"$UNAME_RELEASE"
exit ;; exit ;;
*:DragonFly:*:*) *:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
exit ;; exit ;;
*:*VMS:*:*) *:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null` UNAME_MACHINE=$( (uname -p) 2>/dev/null)
case "${UNAME_MACHINE}" in case "$UNAME_MACHINE" in
A*) echo alpha-dec-vms ; exit ;; A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;;
V*) echo vax-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;;
...@@ -1398,32 +1478,190 @@ EOF ...@@ -1398,32 +1478,190 @@ EOF
echo i386-pc-xenix echo i386-pc-xenix
exit ;; exit ;;
i*86:skyos:*:*) i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')"
exit ;; exit ;;
i*86:rdos:*:*) i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos echo "$UNAME_MACHINE"-pc-rdos
exit ;; exit ;;
i*86:AROS:*:*) i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros echo "$UNAME_MACHINE"-pc-aros
exit ;; exit ;;
x86_64:VMkernel:*:*) x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx echo "$UNAME_MACHINE"-unknown-esx
exit ;; exit ;;
amd64:Isilon\ OneFS:*:*) amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs echo x86_64-unknown-onefs
exit ;; exit ;;
*:Unleashed:*:*)
echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
exit ;;
esac
# 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 esac
cat >&2 <<EOF cat >&2 <<EOF
$0: unable to guess system type
This script (version $timestamp), has failed to recognize the This script (version $timestamp), has failed to recognize the
operating system you are using. If your script is old, overwrite operating system you are using. If your script is old, overwrite *all*
config.guess and config.sub with the latest versions from: copies of config.guess and config.sub with the latest versions from:
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
and and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
EOF
year=$(echo $timestamp | sed 's,-.*,,')
# shellcheck disable=SC2003
if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then
cat >&2 <<EOF
If $0 has already been updated, send the following data and any If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to information you think might be pertinent to config-patches@gnu.org to
...@@ -1431,31 +1669,32 @@ provide the necessary information to handle your system. ...@@ -1431,31 +1669,32 @@ provide the necessary information to handle your system.
config.guess timestamp = $timestamp config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -m = $( (uname -m) 2>/dev/null || echo unknown)
uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -r = $( (uname -r) 2>/dev/null || echo unknown)
uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -s = $( (uname -s) 2>/dev/null || echo unknown)
uname -v = `(uname -v) 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` /usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null)
/bin/uname -X = `(/bin/uname -X) 2>/dev/null` /bin/uname -X = $( (/bin/uname -X) 2>/dev/null)
hostinfo = `(hostinfo) 2>/dev/null` hostinfo = $( (hostinfo) 2>/dev/null)
/bin/universe = `(/bin/universe) 2>/dev/null` /bin/universe = $( (/bin/universe) 2>/dev/null)
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null)
/bin/arch = `(/bin/arch) 2>/dev/null` /bin/arch = $( (/bin/arch) 2>/dev/null)
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null)
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` /usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null)
UNAME_MACHINE = ${UNAME_MACHINE} UNAME_MACHINE = "$UNAME_MACHINE"
UNAME_RELEASE = ${UNAME_RELEASE} UNAME_RELEASE = "$UNAME_RELEASE"
UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_SYSTEM = "$UNAME_SYSTEM"
UNAME_VERSION = ${UNAME_VERSION} UNAME_VERSION = "$UNAME_VERSION"
EOF EOF
fi
exit 1 exit 1
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='" # time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d" # time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'" # time-stamp-end: "'"
......
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2016 Free Software Foundation, Inc. # Copyright 1992-2021 Free Software Foundation, Inc.
timestamp='2016-11-04' timestamp='2021-01-07'
# This file is free software; you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by
...@@ -15,7 +15,7 @@ timestamp='2016-11-04' ...@@ -15,7 +15,7 @@ timestamp='2016-11-04'
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>. # along with this program; if not, see <https://www.gnu.org/licenses/>.
# #
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
...@@ -33,7 +33,7 @@ timestamp='2016-11-04' ...@@ -33,7 +33,7 @@ timestamp='2016-11-04'
# Otherwise, we print the canonical config type on stdout and succeed. # Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
# This file is supposed to be the same for all GNU packages # This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases # and recognize all the CPU types, system types and aliases
...@@ -50,14 +50,14 @@ timestamp='2016-11-04' ...@@ -50,14 +50,14 @@ timestamp='2016-11-04'
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification. # It is wrong to echo any other type of specification.
me=`echo "$0" | sed -e 's,.*/,,'` me=$(echo "$0" | sed -e 's,.*/,,')
usage="\ usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name. Canonicalize a configuration name.
Operation modes: Options:
-h, --help print this help, then exit -h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit -t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit -v, --version print version number, then exit
...@@ -67,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>." ...@@ -67,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright 1992-2016 Free Software Foundation, Inc. Copyright 1992-2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
...@@ -89,12 +89,12 @@ while test $# -gt 0 ; do ...@@ -89,12 +89,12 @@ while test $# -gt 0 ; do
- ) # Use stdin as input. - ) # Use stdin as input.
break ;; break ;;
-* ) -* )
echo "$me: invalid option $1$help" echo "$me: invalid option $1$help" >&2
exit 1 ;; exit 1 ;;
*local*) *local*)
# First pass through any local machine types. # First pass through any local machine types.
echo $1 echo "$1"
exit ;; exit ;;
* ) * )
...@@ -110,1244 +110,1169 @@ case $# in ...@@ -110,1244 +110,1169 @@ case $# in
exit 1;; exit 1;;
esac esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Split fields of configuration type
# Here we must recognize all the valid KERNEL-OS combinations. # shellcheck disable=SC2162
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` IFS="-" read field1 field2 field3 field4 <<EOF
case $maybe_os in $1
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ EOF
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so # Separate into logical components for further validation
### that things like config.sub decstation-3100 work. We also case $1 in
### recognize some manufacturers as not being operating systems, so we *-*-*-*-*)
### can provide default operating systems below. echo Invalid configuration \`"$1"\': more than four components >&2
case $os in exit 1
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -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*)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-chorusos*)
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*)
os=-lynxos
;; ;;
-ptx*) *-*-*-*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` basic_machine=$field1-$field2
basic_os=$field3-$field4
;; ;;
-windowsnt*) *-*-*)
os=`echo $os | sed -e 's/windowsnt/winnt/'` # 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*)
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
;; ;;
-psos*) *-*)
os=-psos # 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
;;
# 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
;; ;;
-mint | -mint[0-9]*) *)
basic_machine=m68k-atari # Convert single-component short-hands not valid as part of
os=-mint # 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 esac
# Decode aliases for certain CPU-COMPANY combinations. # Decode 1-component or ad-hoc basic machines
case $basic_machine in case $basic_machine in
# Recognize the basic CPU types without company name. # Here we handle the default manufacturer of certain CPU types. It is in
# Some are omitted here because they have special meanings below. # some cases the only manufacturer, in others, it is the most popular.
1750a | 580 \ w89k)
| a29k \ cpu=hppa1.1
| aarch64 | aarch64_be \ vendor=winbond
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pru \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;; ;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) op50n)
cpu=hppa1.1
vendor=oki
;; ;;
ms1) op60c)
basic_machine=mt-unknown cpu=hppa1.1
vendor=oki
;; ;;
ibm*)
strongarm | thumb | xscale) cpu=i370
basic_machine=arm-unknown vendor=ibm
;; ;;
xgate) orion105)
basic_machine=$basic_machine-unknown cpu=clipper
os=-none vendor=highlevel
;; ;;
xscaleeb) mac | mpw | mac-mpw)
basic_machine=armeb-unknown cpu=m68k
vendor=apple
;; ;;
pmac | pmac-mpw)
xscaleel) cpu=powerpc
basic_machine=armel-unknown vendor=apple
;; ;;
# 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)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pru-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand # Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS. # for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att cpu=m68000
vendor=att
;; ;;
3b*) 3b*)
basic_machine=we32k-att cpu=we32k
;; vendor=att
a29khif)
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-unknown
;;
amigaos | amigados)
basic_machine=m68k-unknown
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;; ;;
bluegene*) bluegene*)
basic_machine=powerpc-ibm cpu=powerpc
os=-cnk vendor=ibm
;; basic_os=cnk
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | j90)
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;; ;;
decsystem10* | dec10*) decsystem10* | dec10*)
basic_machine=pdp10-dec cpu=pdp10
os=-tops10 vendor=dec
basic_os=tops10
;; ;;
decsystem20* | dec20*) decsystem20* | dec20*)
basic_machine=pdp10-dec cpu=pdp10
os=-tops20 vendor=dec
basic_os=tops20
;; ;;
delta | 3300 | motorola-3300 | motorola-delta \ delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola) | 3300-motorola | delta-motorola)
basic_machine=m68k-motorola cpu=m68k
;; vendor=motorola
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;; ;;
dpx20 | dpx20-*) dpx2*)
basic_machine=rs6000-bull cpu=m68k
os=-bosx vendor=bull
;; basic_os=sysv3
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
e500v[12])
basic_machine=powerpc-unknown
os=$os"spe"
;;
e500v[12]-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;; ;;
encore | umax | mmax) encore | umax | mmax)
basic_machine=ns32k-encore cpu=ns32k
vendor=encore
;; ;;
es1800 | OSE68k | ose68k | ose | OSE) elxsi)
basic_machine=m68k-ericsson cpu=elxsi
os=-ose vendor=elxsi
basic_os=${basic_os:-bsd}
;; ;;
fx2800) fx2800)
basic_machine=i860-alliant cpu=i860
vendor=alliant
;; ;;
genix) genix)
basic_machine=ns32k-ns cpu=ns32k
;; vendor=ns
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
go32)
basic_machine=i386-pc
os=-go32
;; ;;
h3050r* | hiux*) h3050r* | hiux*)
basic_machine=hppa1.1-hitachi cpu=hppa1.1
os=-hiuxwe2 vendor=hitachi
;; basic_os=hiuxwe2
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;; ;;
hp3k9[0-9][0-9] | hp9[0-9][0-9]) hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp cpu=hppa1.0
vendor=hp
;; ;;
hp9k2[0-9][0-9] | hp9k31[0-9]) hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp cpu=m68000
vendor=hp
;; ;;
hp9k3[2-9][0-9]) hp9k3[2-9][0-9])
basic_machine=m68k-hp cpu=m68k
vendor=hp
;; ;;
hp9k6[0-9][0-9] | hp6[0-9][0-9]) hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp cpu=hppa1.0
vendor=hp
;; ;;
hp9k7[0-79][0-9] | hp7[0-79][0-9]) hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp cpu=hppa1.1
vendor=hp
;; ;;
hp9k78[0-9] | hp78[0-9]) hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp # FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp cpu=hppa1.1
vendor=hp
;; ;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp # FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp cpu=hppa1.1
vendor=hp
;; ;;
hp9k8[0-9][13679] | hp8[0-9][13679]) hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp cpu=hppa1.1
vendor=hp
;; ;;
hp9k8[0-9][0-9] | hp8[0-9][0-9]) hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp cpu=hppa1.0
;; vendor=hp
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
;; ;;
i*86v32) i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` cpu=$(echo "$1" | sed -e 's/86.*/86/')
os=-sysv32 vendor=pc
basic_os=sysv32
;; ;;
i*86v4*) i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` cpu=$(echo "$1" | sed -e 's/86.*/86/')
os=-sysv4 vendor=pc
basic_os=sysv4
;; ;;
i*86v) i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` cpu=$(echo "$1" | sed -e 's/86.*/86/')
os=-sysv vendor=pc
basic_os=sysv
;; ;;
i*86sol2) i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` cpu=$(echo "$1" | sed -e 's/86.*/86/')
os=-solaris2 vendor=pc
;; basic_os=solaris2
i386mach)
basic_machine=i386-mach
os=-mach
;; ;;
i386-vsta | vsta) j90 | j90-cray)
basic_machine=i386-unknown cpu=j90
os=-vsta vendor=cray
basic_os=${basic_os:-unicos}
;; ;;
iris | iris4d) iris | iris4d)
basic_machine=mips-sgi cpu=mips
case $os in vendor=sgi
-irix*) case $basic_os in
irix*)
;; ;;
*) *)
os=-irix4 basic_os=irix4
;; ;;
esac esac
;; ;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32)
basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe) miniframe)
basic_machine=m68000-convergent cpu=m68000
vendor=convergent
;; ;;
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari cpu=m68k
os=-mint vendor=atari
;; basic_os=mint
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos)
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i686-pc
os=-msys
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder)
basic_machine=armv4l-rebel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;; ;;
news-3600 | risc-news) news-3600 | risc-news)
basic_machine=mips-sony cpu=mips
os=-newsos vendor=sony
;; basic_os=newsos
necv70) ;;
basic_machine=v70-nec next | m*-next)
os=-sysv cpu=m68k
;; vendor=next
next | m*-next ) case $basic_os in
basic_machine=m68k-next openstep*)
case $os in ;;
-nextstep* ) nextstep*)
;; ;;
-ns2*) ns2*)
os=-nextstep2 basic_os=nextstep2
;; ;;
*) *)
os=-nextstep3 basic_os=nextstep3
;; ;;
esac esac
;; ;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
nonstopux)
basic_machine=mips-compaq
os=-nonstopux
;;
np1) np1)
basic_machine=np1-gould cpu=np1
;; vendor=gould
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;; ;;
op50n-* | op60c-*) op50n-* | op60c-*)
basic_machine=hppa1.1-oki cpu=hppa1.1
os=-proelf vendor=oki
;; basic_os=proelf
openrisc | openrisc-*)
basic_machine=or32-unknown
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;; ;;
pa-hitachi) pa-hitachi)
basic_machine=hppa1.1-hitachi cpu=hppa1.1
os=-hiuxwe2 vendor=hitachi
;; basic_os=hiuxwe2
paragon)
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;; ;;
pbd) pbd)
basic_machine=sparc-tti cpu=sparc
vendor=tti
;; ;;
pbb) pbb)
basic_machine=m68k-tti cpu=m68k
;; vendor=tti
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
pentiumpro-* | p6-* | 6x86-* | athlon-*) pc532)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` cpu=ns32k
;; vendor=pc532
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
pn) pn)
basic_machine=pn-gould cpu=pn
;; vendor=gould
power) basic_machine=power-ibm
;;
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
;; ;;
ppc64le-* | powerpc64little-*) power)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` cpu=power
vendor=ibm
;; ;;
ps2) ps2)
basic_machine=i386-ibm cpu=i386
;; vendor=ibm
pw32)
basic_machine=i586-unknown
os=-pw32
;;
rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
;; ;;
rm[46]00) rm[46]00)
basic_machine=mips-siemens cpu=mips
vendor=siemens
;; ;;
rtpc | rtpc-*) rtpc | rtpc-*)
basic_machine=romp-ibm cpu=romp
;; vendor=ibm
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;; ;;
sa29200) sde)
basic_machine=a29k-amd cpu=mipsisa32
os=-udi vendor=sde
;; basic_os=${basic_os:-elf}
sb1)
basic_machine=mipsisa64sb1-unknown
;; ;;
sb1el) simso-wrs)
basic_machine=mipsisa64sb1el-unknown cpu=sparclite
vendor=wrs
basic_os=vxworks
;; ;;
sde) tower | tower-32)
basic_machine=mipsisa32-sde cpu=m68k
os=-elf vendor=ncr
;; ;;
sei) vpp*|vx|vx-*)
basic_machine=mips-sei cpu=f301
os=-seiux vendor=fujitsu
;; ;;
sequent) w65)
basic_machine=i386-sequent cpu=w65
vendor=wdc
;; ;;
sh) w89k-*)
basic_machine=sh-hitachi cpu=hppa1.1
os=-hms vendor=winbond
basic_os=proelf
;; ;;
sh5el) none)
basic_machine=sh5le-unknown cpu=none
vendor=none
;; ;;
sh64) leon|leon[3-9])
basic_machine=sh64-unknown cpu=sparc
vendor=$basic_machine
;; ;;
sparclite-wrs | simso-wrs) leon-*|leon[3-9]-*)
basic_machine=sparclite-wrs cpu=sparc
os=-vxworks vendor=$(echo "$basic_machine" | sed 's/-.*//')
;; ;;
sps7)
basic_machine=m68k-bull *-*)
os=-sysv2 # shellcheck disable=SC2162
IFS="-" read cpu vendor <<EOF
$basic_machine
EOF
;; ;;
spur) # We use `pc' rather than `unknown'
basic_machine=spur-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
;; ;;
st2000) # These rules are duplicated from below for sake of the special case above;
basic_machine=m68k-tandem # i.e. things that normalized to x86 arches should also default to "pc"
pc98)
cpu=i386
vendor=pc
;; ;;
stratus) x64 | amd64)
basic_machine=i860-stratus cpu=x86_64
os=-sysv4 vendor=pc
;; ;;
strongarm-* | thumb-*) # Recognize the basic CPU types without company name.
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` *)
cpu=$basic_machine
vendor=unknown
;; ;;
sun2) esac
basic_machine=m68000-sun
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}
;; ;;
sun2os3) c90-unknown | c90-cray)
basic_machine=m68000-sun vendor=cray
os=-sunos3 basic_os=${Basic_os:-unicos}
;; ;;
sun2os4) fx80-unknown)
basic_machine=m68000-sun vendor=alliant
os=-sunos4
;; ;;
sun3os3) romp-unknown)
basic_machine=m68k-sun vendor=ibm
os=-sunos3
;; ;;
sun3os4) mmix-unknown)
basic_machine=m68k-sun vendor=knuth
os=-sunos4
;; ;;
sun4os3) microblaze-unknown | microblazeel-unknown)
basic_machine=sparc-sun vendor=xilinx
os=-sunos3
;; ;;
sun4os4) rs6000-unknown)
basic_machine=sparc-sun vendor=ibm
os=-sunos4
;; ;;
sun4sol2) vax-unknown)
basic_machine=sparc-sun vendor=dec
os=-solaris2
;; ;;
sun3 | sun3-*) pdp11-unknown)
basic_machine=m68k-sun vendor=dec
;; ;;
sun4) we32k-unknown)
basic_machine=sparc-sun vendor=att
;; ;;
sun386 | sun386i | roadrunner) cydra-unknown)
basic_machine=i386-sun vendor=cydrome
;; ;;
sv1) i370-ibm*)
basic_machine=sv1-cray vendor=ibm
os=-unicos
;; ;;
symmetry) orion-unknown)
basic_machine=i386-sequent vendor=highlevel
os=-dynix
;; ;;
t3e) xps-unknown | xps100-unknown)
basic_machine=alphaev5-cray cpu=xps100
os=-unicos vendor=honeywell
;; ;;
t90)
basic_machine=t90-cray # Here we normalize CPU types with a missing or matching vendor
os=-unicos dpx20-unknown | dpx20-bull)
cpu=rs6000
vendor=bull
basic_os=${basic_os:-bosx}
;; ;;
tile*)
basic_machine=$basic_machine-unknown # Here we normalize CPU types irrespective of the vendor
os=-linux-gnu amd64-*)
cpu=x86_64
;; ;;
tx39) blackfin-*)
basic_machine=mipstx39-unknown cpu=bfin
basic_os=linux
;; ;;
tx39el) c54x-*)
basic_machine=mipstx39el-unknown cpu=tic54x
;; ;;
toad1) c55x-*)
basic_machine=pdp10-xkl cpu=tic55x
os=-tops20
;; ;;
tower | tower-32) c6x-*)
basic_machine=m68k-ncr cpu=tic6x
;; ;;
tpf) e500v[12]-*)
basic_machine=s390x-ibm cpu=powerpc
os=-tpf basic_os=${basic_os}"spe"
;; ;;
udi29k) mips3*-*)
basic_machine=a29k-amd cpu=mips64
os=-udi
;; ;;
ultra3) ms1-*)
basic_machine=a29k-nyu cpu=mt
os=-sym1
;; ;;
v810 | necv810) m68knommu-*)
basic_machine=v810-nec cpu=m68k
os=-none basic_os=linux
;; ;;
vaxv) m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
basic_machine=vax-dec cpu=s12z
os=-sysv
;; ;;
vms) openrisc-*)
basic_machine=vax-dec cpu=or32
os=-vms
;; ;;
vpp*|vx|vx-*) parisc-*)
basic_machine=f301-fujitsu cpu=hppa
basic_os=linux
;; ;;
vxworks960) pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i960-wrs cpu=i586
os=-vxworks
;; ;;
vxworks68) pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
basic_machine=m68k-wrs cpu=i686
os=-vxworks
;; ;;
vxworks29k) pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=a29k-wrs cpu=i686
os=-vxworks
;; ;;
w65*) pentium4-*)
basic_machine=w65-wdc cpu=i786
os=-none
;; ;;
w89k-*) pc98-*)
basic_machine=hppa1.1-winbond cpu=i386
os=-proelf
;; ;;
xbox) ppc-* | ppcbe-*)
basic_machine=i686-pc cpu=powerpc
os=-mingw32
;; ;;
xps | xps100) ppcle-* | powerpclittle-*)
basic_machine=xps100-honeywell cpu=powerpcle
;; ;;
xscale-* | xscalee[bl]-*) ppc64-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` cpu=powerpc64
;; ;;
ymp) ppc64le-* | powerpc64little-*)
basic_machine=ymp-cray cpu=powerpc64le
os=-unicos
;; ;;
z8k-*-coff) sb1-*)
basic_machine=z8k-unknown cpu=mipsisa64sb1
os=-sim
;; ;;
z80-*-coff) sb1el-*)
basic_machine=z80-unknown cpu=mipsisa64sb1el
os=-sim
;; ;;
none) sh5e[lb]-*)
basic_machine=none-none cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/')
os=-none
;; ;;
spur-*)
# Here we handle the default manufacturer of certain CPU types. It is in cpu=spur
# some cases the only manufacturer, in others, it is the most popular.
w89k)
basic_machine=hppa1.1-winbond
;; ;;
op50n) strongarm-* | thumb-*)
basic_machine=hppa1.1-oki cpu=arm
;; ;;
op60c) tx39-*)
basic_machine=hppa1.1-oki cpu=mipstx39
;; ;;
romp) tx39el-*)
basic_machine=romp-ibm cpu=mipstx39el
;; ;;
mmix) x64-*)
basic_machine=mmix-knuth cpu=x86_64
;; ;;
rs6000) xscale-* | xscalee[bl]-*)
basic_machine=rs6000-ibm cpu=$(echo "$cpu" | sed 's/^xscale/arm/')
;; ;;
vax) arm64-*)
basic_machine=vax-dec cpu=aarch64
;; ;;
pdp10)
# there are many clones, so DEC is not a safe bet # Recognize the canonical CPU Types that limit and/or modify the
basic_machine=pdp10-unknown # company names they are paired with.
cr16-*)
basic_os=${basic_os:-elf}
;; ;;
pdp11) crisv32-* | etraxfs*-*)
basic_machine=pdp11-dec cpu=crisv32
vendor=axis
;; ;;
we32k) cris-* | etrax*-*)
basic_machine=we32k-att cpu=cris
vendor=axis
;; ;;
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) crx-*)
basic_machine=sh-unknown basic_os=${basic_os:-elf}
;; ;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) neo-tandem)
basic_machine=sparc-sun cpu=neo
vendor=tandem
;; ;;
cydra) nse-tandem)
basic_machine=cydra-cydrome cpu=nse
vendor=tandem
;; ;;
orion) nsr-tandem)
basic_machine=orion-highlevel cpu=nsr
vendor=tandem
;; ;;
orion105) nsv-tandem)
basic_machine=clipper-highlevel cpu=nsv
vendor=tandem
;; ;;
mac | mpw | mac-mpw) nsx-tandem)
basic_machine=m68k-apple cpu=nsx
vendor=tandem
;; ;;
pmac | pmac-mpw) mipsallegrexel-sony)
basic_machine=powerpc-apple cpu=mipsallegrexel
vendor=sony
;; ;;
*-unknown) tile*-*)
# Make sure to match an already-canonicalized machine name. basic_os=${basic_os:-linux-gnu}
;; ;;
*) *)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 # Recognize the canonical CPU types that are allowed with any
exit 1 # company name.
case $cpu in
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| 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 \
| 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 \
| h8300 | h8500 \
| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i*86 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| loongarch32 | loongarch64 | loongarchx32 \
| 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 | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64eb | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mmix \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| 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 \
| 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 esac
# Here we canonicalize certain aliases for manufacturers. # Here we canonicalize certain aliases for manufacturers.
case $basic_machine in case $vendor in
*-digital*) digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` vendor=dec
;; ;;
*-commodore*) commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` vendor=cbm
;; ;;
*) *)
;; ;;
...@@ -1355,203 +1280,213 @@ esac ...@@ -1355,203 +1280,213 @@ esac
# Decode manufacturer-specific aliases for certain operating systems. # Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ] if test x$basic_os != x
then then
case $os in
# First match some system type aliases # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
# that might get confused with valid system types. # set os.
# -solaris* is a basic system type, with this one exception. case $basic_os in
-auroraux) gnu/linux*)
os=-auroraux 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
IFS="-" read kernel os <<EOF
$basic_os
EOF
;;
# 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|')
;; ;;
-solaris1 | -solaris1.*) *)
os=`echo $os | sed -e 's|solaris1|sunos4|'` 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
;; ;;
-solaris) bluegene*)
os=-solaris2 os=cnk
;; ;;
-svr4*) solaris1 | solaris1.*)
os=-sysv4 os=$(echo $os | sed -e 's|solaris1|sunos4|')
;; ;;
-unixware*) solaris)
os=-sysv4.2uw os=solaris2
;; ;;
-gnu/linux*) unixware*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` os=sysv4.2uw
;; ;;
# First accept the basic system types. # es1800 is here to avoid being matched by es* (a different OS)
# The portable systems comes first. es1800*)
# Each alternative MUST END IN A *, to match a version number. os=ose
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
| -onefs* | -tirtos* | -phoenix* | -fuchsia*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
case $basic_machine in
x86-* | i*86-*)
;;
*)
os=-nto$os
;;
esac
;; ;;
-nto-qnx*) # Some version numbers need modification
chorusos*)
os=chorusos
;; ;;
-nto*) isc)
os=`echo $os | sed -e 's|nto|nto-qnx|'` os=isc2.2
;; ;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ sco6)
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ os=sco5v6
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;; ;;
-mac*) sco5)
os=`echo $os | sed -e 's|mac|macos|'` os=sco3.2v5
;; ;;
-linux-dietlibc) sco4)
os=-linux-dietlibc os=sco3.2v4
;; ;;
-linux*) sco3.2.[4-9]*)
os=`echo $os | sed -e 's|linux|linux-gnu|'` os=$(echo $os | sed -e 's/sco3.2./sco3.2v/')
;; ;;
-sunos5*) sco*v* | scout)
os=`echo $os | sed -e 's|sunos5|solaris2|'` # Don't match below
;; ;;
-sunos6*) sco*)
os=`echo $os | sed -e 's|sunos6|solaris3|'` os=sco3.2v2
;; ;;
-opened*) psos*)
os=-openedition os=psos
;; ;;
-os400*) qnx*)
os=-os400 os=qnx
;; ;;
-wince*) hiux*)
os=-wince os=hiuxwe2
;; ;;
-osfrose*) lynx*178)
os=-osfrose os=lynxos178
;; ;;
-osf*) lynx*5)
os=-osf os=lynxos5
;; ;;
-utek*) lynxos*)
os=-bsd # don't get caught up in next wildcard
;; ;;
-dynix*) lynx*)
os=-bsd os=lynxos
;; ;;
-acis*) mac[0-9]*)
os=-aos os=$(echo "$os" | sed -e 's|mac|macos|')
;; ;;
-atheos*) opened*)
os=-atheos os=openedition
;; ;;
-syllable*) os400*)
os=-syllable os=os400
;; ;;
-386bsd) sunos5*)
os=-bsd os=$(echo "$os" | sed -e 's|sunos5|solaris2|')
;; ;;
-ctix* | -uts*) sunos6*)
os=-sysv os=$(echo "$os" | sed -e 's|sunos6|solaris3|')
;; ;;
-nova*) wince*)
os=-rtmk-nova os=wince
;; ;;
-ns2 ) utek*)
os=-nextstep2 os=bsd
;; ;;
-nsk*) dynix*)
os=-nsk os=bsd
;; ;;
# Preserve the version number of sinix5. acis*)
-sinix5.*) os=aos
os=`echo $os | sed -e 's|sinix|sysv|'`
;; ;;
-sinix*) atheos*)
os=-sysv4 os=atheos
;; ;;
-tpf*) syllable*)
os=-tpf os=syllable
;; ;;
-triton*) 386bsd)
os=-sysv3 os=bsd
;; ;;
-oss*) ctix* | uts*)
os=-sysv3 os=sysv
;; ;;
-svr4) nova*)
os=-sysv4 os=rtmk-nova
;; ;;
-svr3) ns2)
os=-sysv3 os=nextstep2
;; ;;
-sysvr4) # Preserve the version number of sinix5.
os=-sysv4 sinix5.*)
os=$(echo $os | sed -e 's|sinix|sysv|')
;; ;;
# This must come after -sysvr4. sinix*)
-sysv*) os=sysv4
;; ;;
-ose*) tpf*)
os=-ose os=tpf
;; ;;
-es1800*) triton*)
os=-ose os=sysv3
;; ;;
-xenix) oss*)
os=-xenix os=sysv3
;; ;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) svr4*)
os=-mint os=sysv4
;; ;;
-aros*) svr3)
os=-aros os=sysv3
;; ;;
-zvmoe) sysvr4)
os=-zvmoe os=sysv4
;; ;;
-dicos*) ose*)
os=-dicos os=ose
;; ;;
-nacl*) *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
os=mint
;; ;;
-ios) dicos*)
os=dicos
;; ;;
-none) 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=elf
;;
esac
;; ;;
*) *)
# Get rid of the `-' at the beginning of $os. # No normalization, but not necessarily accepted, that comes below.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;; ;;
esac esac
else else
# Here we handle the default operating systems that come with various machines. # Here we handle the default operating systems that come with various machines.
...@@ -1564,261 +1499,356 @@ else ...@@ -1564,261 +1499,356 @@ else
# will signal an error saying that MANUFACTURER isn't an operating # will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point. # system, and we'll never get to this point.
case $basic_machine in kernel=
case $cpu-$vendor in
score-*) score-*)
os=-elf os=elf
;; ;;
spu-*) spu-*)
os=-elf os=elf
;; ;;
*-acorn) *-acorn)
os=-riscix1.2 os=riscix1.2
;; ;;
arm*-rebel) arm*-rebel)
os=-linux kernel=linux
os=gnu
;; ;;
arm*-semi) arm*-semi)
os=-aout os=aout
;; ;;
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=coff
;; ;;
c8051-*) c8051-*)
os=-elf os=elf
;;
clipper-intergraph)
os=clix
;; ;;
hexagon-*) hexagon-*)
os=-elf os=elf
;; ;;
tic54x-*) tic54x-*)
os=-coff os=coff
;; ;;
tic55x-*) tic55x-*)
os=-coff os=coff
;; ;;
tic6x-*) tic6x-*)
os=-coff os=coff
;; ;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
os=-tops20 os=tops20
;; ;;
pdp11-*) pdp11-*)
os=-none os=none
;; ;;
*-dec | vax-*) *-dec | vax-*)
os=-ultrix4.2 os=ultrix4.2
;; ;;
m68*-apollo) m68*-apollo)
os=-domain os=domain
;; ;;
i386-sun) i386-sun)
os=-sunos4.0.2 os=sunos4.0.2
;; ;;
m68000-sun) m68000-sun)
os=-sunos3 os=sunos3
;; ;;
m68*-cisco) m68*-cisco)
os=-aout os=aout
;; ;;
mep-*) mep-*)
os=-elf os=elf
;; ;;
mips*-cisco) mips*-cisco)
os=-elf os=elf
;; ;;
mips*-*) mips*-*)
os=-elf os=elf
;; ;;
or32-*) or32-*)
os=-coff os=coff
;; ;;
*-tti) # must be before sparc entry or we get the wrong os. *-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3 os=sysv3
;; ;;
sparc-* | *-sun) sparc-* | *-sun)
os=-sunos4.1.1 os=sunos4.1.1
;; ;;
*-be) pru-*)
os=-beos os=elf
;; ;;
*-haiku) *-be)
os=-haiku os=beos
;; ;;
*-ibm) *-ibm)
os=-aix os=aix
;; ;;
*-knuth) *-knuth)
os=-mmixware os=mmixware
;; ;;
*-wec) *-wec)
os=-proelf os=proelf
;; ;;
*-winbond) *-winbond)
os=-proelf os=proelf
;; ;;
*-oki) *-oki)
os=-proelf os=proelf
;; ;;
*-hp) *-hp)
os=-hpux os=hpux
;; ;;
*-hitachi) *-hitachi)
os=-hiux os=hiux
;; ;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv os=sysv
;; ;;
*-cbm) *-cbm)
os=-amigaos os=amigaos
;; ;;
*-dg) *-dg)
os=-dgux os=dgux
;; ;;
*-dolphin) *-dolphin)
os=-sysv3 os=sysv3
;; ;;
m68k-ccur) m68k-ccur)
os=-rtu os=rtu
;; ;;
m88k-omron*) m88k-omron*)
os=-luna os=luna
;; ;;
*-next ) *-next)
os=-nextstep os=nextstep
;; ;;
*-sequent) *-sequent)
os=-ptx os=ptx
;; ;;
*-crds) *-crds)
os=-unos os=unos
;; ;;
*-ns) *-ns)
os=-genix os=genix
;; ;;
i370-*) i370-*)
os=-mvs os=mvs
;;
*-next)
os=-nextstep3
;; ;;
*-gould) *-gould)
os=-sysv os=sysv
;; ;;
*-highlevel) *-highlevel)
os=-bsd os=bsd
;; ;;
*-encore) *-encore)
os=-bsd os=bsd
;; ;;
*-sgi) *-sgi)
os=-irix os=irix
;; ;;
*-siemens) *-siemens)
os=-sysv4 os=sysv4
;; ;;
*-masscomp) *-masscomp)
os=-rtu os=rtu
;; ;;
f30[01]-fujitsu | f700-fujitsu) f30[01]-fujitsu | f700-fujitsu)
os=-uxpv os=uxpv
;; ;;
*-rom68k) *-rom68k)
os=-coff os=coff
;; ;;
*-*bug) *-*bug)
os=-coff os=coff
;; ;;
*-apple) *-apple)
os=-macos os=macos
;; ;;
*-atari*) *-atari*)
os=-mint os=mint
;;
*-wrs)
os=vxworks
;; ;;
*) *)
os=-none os=none
;; ;;
esac esac
fi fi
# Now, validate our (potentially fixed-up) OS.
case $os in
# Sometimes we do "kernel-abi", so those need to count as OSes.
musl* | newlib* | uclibc*)
;;
# Likewise for "kernel-libc"
eabi* | gnueabi*)
;;
# 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* \
| 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* | solidbsd* | libertybsd* | os108* \
| ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
| bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
| ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
| udi* | lites* | ieee* | go32* | aux* | hcos* \
| chorusrdb* | cegcc* | glidix* \
| cygwin* | msys* | pe* | 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*)
;;
# 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.
;;
none)
;;
*)
echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 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 in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
;;
uclinux-uclibc* )
;;
-dietlibc* | -newlib* | -musl* | -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
;;
kfreebsd*-gnu* | kopensolaris*-gnu*)
;;
nto-qnx*)
;;
os2-emx)
;;
*-eabi* | *-gnueabi*)
;;
-*)
# Blank kernel with real OS 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 # Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer. # manufacturer. We pick the logical manufacturer.
vendor=unknown case $vendor in
case $basic_machine in unknown)
*-unknown) case $cpu-$os in
case $os in *-riscix*)
-riscix*)
vendor=acorn vendor=acorn
;; ;;
-sunos*) *-sunos*)
vendor=sun vendor=sun
;; ;;
-cnk*|-aix*) *-cnk* | *-aix*)
vendor=ibm vendor=ibm
;; ;;
-beos*) *-beos*)
vendor=be vendor=be
;; ;;
-hpux*) *-hpux*)
vendor=hp vendor=hp
;; ;;
-mpeix*) *-mpeix*)
vendor=hp vendor=hp
;; ;;
-hiux*) *-hiux*)
vendor=hitachi vendor=hitachi
;; ;;
-unos*) *-unos*)
vendor=crds vendor=crds
;; ;;
-dgux*) *-dgux*)
vendor=dg vendor=dg
;; ;;
-luna*) *-luna*)
vendor=omron vendor=omron
;; ;;
-genix*) *-genix*)
vendor=ns vendor=ns
;; ;;
-mvs* | -opened*) *-clix*)
vendor=intergraph
;;
*-mvs* | *-opened*)
vendor=ibm
;;
*-os400*)
vendor=ibm vendor=ibm
;; ;;
-os400*) s390-* | s390x-*)
vendor=ibm vendor=ibm
;; ;;
-ptx*) *-ptx*)
vendor=sequent vendor=sequent
;; ;;
-tpf*) *-tpf*)
vendor=ibm vendor=ibm
;; ;;
-vxsim* | -vxworks* | -windiss*) *-vxsim* | *-vxworks* | *-windiss*)
vendor=wrs vendor=wrs
;; ;;
-aux*) *-aux*)
vendor=apple vendor=apple
;; ;;
-hms*) *-hms*)
vendor=hitachi vendor=hitachi
;; ;;
-mpw* | -macos*) *-mpw* | *-macos*)
vendor=apple vendor=apple
;; ;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
vendor=atari vendor=atari
;; ;;
-vos*) *-vos*)
vendor=stratus vendor=stratus
;; ;;
esac esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;; ;;
esac esac
echo $basic_machine$os echo "$cpu-$vendor-${kernel:+$kernel-}$os"
exit exit
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='" # time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d" # time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'" # time-stamp-end: "'"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -131,12 +131,14 @@ abs_objroot="`pwd`/" ...@@ -131,12 +131,14 @@ abs_objroot="`pwd`/"
AC_SUBST([abs_objroot]) AC_SUBST([abs_objroot])
dnl Munge install path variables. dnl Munge install path variables.
if test "x$prefix" = "xNONE" ; then case "$prefix" in
prefix="/usr/local" *\ * ) AC_MSG_ERROR([Prefix should not contain spaces]) ;;
fi "NONE" ) prefix="/usr/local" ;;
if test "x$exec_prefix" = "xNONE" ; then esac
exec_prefix=$prefix case "$exec_prefix" in
fi *\ * ) AC_MSG_ERROR([Exec prefix should not contain spaces]) ;;
"NONE" ) exec_prefix=$prefix ;;
esac
PREFIX=$prefix PREFIX=$prefix
AC_SUBST([PREFIX]) AC_SUBST([PREFIX])
BINDIR=`eval echo $bindir` BINDIR=`eval echo $bindir`
...@@ -237,19 +239,29 @@ fi ...@@ -237,19 +239,29 @@ fi
if test "x$GCC" = "xyes" ; then if test "x$GCC" = "xyes" ; then
JE_CFLAGS_ADD([-std=gnu11]) JE_CFLAGS_ADD([-std=gnu11])
if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then if test "x$je_cv_cflags_added" = "x-std=gnu11" ; then
AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT], [ ], [ ])
else else
JE_CFLAGS_ADD([-std=gnu99]) JE_CFLAGS_ADD([-std=gnu99])
if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then if test "x$je_cv_cflags_added" = "x-std=gnu99" ; then
AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT]) AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT], [ ], [ ])
fi fi
fi fi
JE_CFLAGS_ADD([-Werror=unknown-warning-option])
JE_CFLAGS_ADD([-Wall]) JE_CFLAGS_ADD([-Wall])
JE_CFLAGS_ADD([-Wextra]) JE_CFLAGS_ADD([-Wextra])
JE_CFLAGS_ADD([-Wshorten-64-to-32]) JE_CFLAGS_ADD([-Wshorten-64-to-32])
JE_CFLAGS_ADD([-Wsign-compare]) JE_CFLAGS_ADD([-Wsign-compare])
JE_CFLAGS_ADD([-Wundef]) JE_CFLAGS_ADD([-Wundef])
JE_CFLAGS_ADD([-Wno-format-zero-length]) JE_CFLAGS_ADD([-Wno-format-zero-length])
JE_CFLAGS_ADD([-Wpointer-arith])
dnl This warning triggers on the use of the universal zero initializer, which
dnl is a very handy idiom for things like the tcache static initializer (which
dnl has lots of nested structs). See the discussion at.
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
JE_CFLAGS_ADD([-Wno-missing-braces])
dnl This one too.
JE_CFLAGS_ADD([-Wno-missing-field-initializers])
JE_CFLAGS_ADD([-Wno-missing-attributes])
JE_CFLAGS_ADD([-pipe]) JE_CFLAGS_ADD([-pipe])
JE_CFLAGS_ADD([-g3]) JE_CFLAGS_ADD([-g3])
elif test "x$je_cv_msvc" = "xyes" ; then elif test "x$je_cv_msvc" = "xyes" ; then
...@@ -290,8 +302,11 @@ if test "x$enable_cxx" = "x1" ; then ...@@ -290,8 +302,11 @@ if test "x$enable_cxx" = "x1" ; then
dnl Require at least c++14, which is the first version to support sized dnl Require at least c++14, which is the first version to support sized
dnl deallocation. C++ support is not compiled otherwise. dnl deallocation. C++ support is not compiled otherwise.
m4_include([m4/ax_cxx_compile_stdcxx.m4]) m4_include([m4/ax_cxx_compile_stdcxx.m4])
AX_CXX_COMPILE_STDCXX([14], [noext], [optional]) AX_CXX_COMPILE_STDCXX([17], [noext], [optional])
if test "x${HAVE_CXX14}" = "x1" ; then if test "x${HAVE_CXX17}" != "x1"; then
AX_CXX_COMPILE_STDCXX([14], [noext], [optional])
fi
if test "x${HAVE_CXX14}" = "x1" -o "x${HAVE_CXX17}" = "x1"; then
JE_CXXFLAGS_ADD([-Wall]) JE_CXXFLAGS_ADD([-Wall])
JE_CXXFLAGS_ADD([-Wextra]) JE_CXXFLAGS_ADD([-Wextra])
JE_CXXFLAGS_ADD([-g3]) JE_CXXFLAGS_ADD([-g3])
...@@ -312,6 +327,9 @@ if test "x$enable_cxx" = "x1" ; then ...@@ -312,6 +327,9 @@ if test "x$enable_cxx" = "x1" ; then
enable_cxx="0" enable_cxx="0"
fi fi
fi fi
if test "x$enable_cxx" = "x1"; then
AC_DEFINE([JEMALLOC_ENABLE_CXX], [ ], [ ])
fi
AC_SUBST([enable_cxx]) AC_SUBST([enable_cxx])
AC_SUBST([CONFIGURE_CXXFLAGS]) AC_SUBST([CONFIGURE_CXXFLAGS])
AC_SUBST([SPECIFIED_CXXFLAGS]) AC_SUBST([SPECIFIED_CXXFLAGS])
...@@ -319,7 +337,7 @@ AC_SUBST([EXTRA_CXXFLAGS]) ...@@ -319,7 +337,7 @@ AC_SUBST([EXTRA_CXXFLAGS])
AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0]) AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
if test "x${ac_cv_big_endian}" = "x1" ; then if test "x${ac_cv_big_endian}" = "x1" ; then
AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ]) AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ], [ ])
fi fi
if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
...@@ -339,7 +357,7 @@ else ...@@ -339,7 +357,7 @@ else
AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}]) AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
fi fi
fi fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR]) AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR], [ ])
AC_CHECK_SIZEOF([int]) AC_CHECK_SIZEOF([int])
if test "x${ac_cv_sizeof_int}" = "x8" ; then if test "x${ac_cv_sizeof_int}" = "x8" ; then
...@@ -349,7 +367,7 @@ elif test "x${ac_cv_sizeof_int}" = "x4" ; then ...@@ -349,7 +367,7 @@ elif test "x${ac_cv_sizeof_int}" = "x4" ; then
else else
AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}]) AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
fi fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT]) AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT], [ ])
AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([long])
if test "x${ac_cv_sizeof_long}" = "x8" ; then if test "x${ac_cv_sizeof_long}" = "x8" ; then
...@@ -359,7 +377,7 @@ elif test "x${ac_cv_sizeof_long}" = "x4" ; then ...@@ -359,7 +377,7 @@ elif test "x${ac_cv_sizeof_long}" = "x4" ; then
else else
AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}]) AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}])
fi fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG]) AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG], [ ])
AC_CHECK_SIZEOF([long long]) AC_CHECK_SIZEOF([long long])
if test "x${ac_cv_sizeof_long_long}" = "x8" ; then if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
...@@ -369,7 +387,7 @@ elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then ...@@ -369,7 +387,7 @@ elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
else else
AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}]) AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}])
fi fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG]) AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG], [ ])
AC_CHECK_SIZEOF([intmax_t]) AC_CHECK_SIZEOF([intmax_t])
if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
...@@ -381,7 +399,7 @@ elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then ...@@ -381,7 +399,7 @@ elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
else else
AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}]) AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
fi fi
AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T]) AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T], [ ])
AC_CANONICAL_HOST AC_CANONICAL_HOST
dnl CPU-specific settings. dnl CPU-specific settings.
...@@ -407,12 +425,23 @@ case "${host_cpu}" in ...@@ -407,12 +425,23 @@ case "${host_cpu}" in
fi fi
fi fi
;; ;;
aarch64|arm*)
HAVE_CPU_SPINWAIT=1
dnl isb is a better equivalent to the pause instruction on x86.
AC_CACHE_VAL([je_cv_isb],
[JE_COMPILABLE([isb instruction], [],
[[__asm__ volatile("isb"); return 0;]],
[je_cv_isb])])
if test "x${je_cv_isb}" = "xyes" ; then
CPU_SPINWAIT='__asm__ volatile("isb")'
fi
;;
*) *)
HAVE_CPU_SPINWAIT=0 HAVE_CPU_SPINWAIT=0
;; ;;
esac esac
AC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT]) AC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT], [ ])
AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT]) AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT], [ ])
AC_ARG_WITH([lg_vaddr], AC_ARG_WITH([lg_vaddr],
[AS_HELP_STRING([--with-lg-vaddr=<lg-vaddr>], [Number of significant virtual address bits])], [AS_HELP_STRING([--with-lg-vaddr=<lg-vaddr>], [Number of significant virtual address bits])],
...@@ -477,7 +506,7 @@ typedef unsigned __int32 uint32_t; ...@@ -477,7 +506,7 @@ typedef unsigned __int32 uint32_t;
LG_VADDR="${je_cv_lg_vaddr}" LG_VADDR="${je_cv_lg_vaddr}"
fi fi
if test "x${LG_VADDR}" != "xerror" ; then if test "x${LG_VADDR}" != "xerror" ; then
AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR]) AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR], [ ])
else else
AC_MSG_ERROR([cannot determine number of significant virtual address bits]) AC_MSG_ERROR([cannot determine number of significant virtual address bits])
fi fi
...@@ -499,7 +528,7 @@ typedef unsigned __int32 uint32_t; ...@@ -499,7 +528,7 @@ typedef unsigned __int32 uint32_t;
fi fi
;; ;;
esac esac
AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR]) AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR], [ ])
LD_PRELOAD_VAR="LD_PRELOAD" LD_PRELOAD_VAR="LD_PRELOAD"
so="so" so="so"
...@@ -583,7 +612,7 @@ if test ! -e "${objroot}VERSION" ; then ...@@ -583,7 +612,7 @@ if test ! -e "${objroot}VERSION" ; then
if test ! -e "${srcroot}VERSION" ; then if test ! -e "${srcroot}VERSION" ; then
AC_MSG_RESULT( AC_MSG_RESULT(
[Missing VERSION file, and unable to generate it; creating bogus VERSION]) [Missing VERSION file, and unable to generate it; creating bogus VERSION])
echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION" echo "0.0.0-0-g000000missing_version_try_git_fetch_tags" > "${objroot}VERSION"
else else
cp ${srcroot}VERSION ${objroot}VERSION cp ${srcroot}VERSION ${objroot}VERSION
fi fi
...@@ -609,6 +638,7 @@ dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the ...@@ -609,6 +638,7 @@ dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
dnl definitions need to be seen before any headers are included, which is a pain dnl definitions need to be seen before any headers are included, which is a pain
dnl to make happen otherwise. dnl to make happen otherwise.
default_retain="0" default_retain="0"
zero_realloc_default_free="0"
maps_coalesce="1" maps_coalesce="1"
DUMP_SYMS="${NM} -a" DUMP_SYMS="${NM} -a"
SYM_PREFIX="" SYM_PREFIX=""
...@@ -626,8 +656,9 @@ case "${host}" in ...@@ -626,8 +656,9 @@ case "${host}" in
SYM_PREFIX="_" SYM_PREFIX="_"
;; ;;
*-*-freebsd*) *-*-freebsd*)
JE_APPEND_VS(CPPFLAGS, -D_BSD_SOURCE)
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ]) AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ], [ ])
force_lazy_lock="1" force_lazy_lock="1"
;; ;;
*-*-dragonfly*) *-*-dragonfly*)
...@@ -640,41 +671,45 @@ case "${host}" in ...@@ -640,41 +671,45 @@ case "${host}" in
*-*-bitrig*) *-*-bitrig*)
abi="elf" abi="elf"
;; ;;
*-*-linux-android) *-*-linux-android*)
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ]) glibc="0"
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ], [ ])
AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ])
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ], [ ])
AC_DEFINE([JEMALLOC_C11_ATOMICS]) AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ])
AC_DEFINE([JEMALLOC_C11_ATOMICS], [ ], [ ])
force_tls="0" force_tls="0"
if test "${LG_SIZEOF_PTR}" = "3"; then if test "${LG_SIZEOF_PTR}" = "3"; then
default_retain="1" default_retain="1"
fi fi
zero_realloc_default_free="1"
;; ;;
*-*-linux*) *-*-linux*)
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ]) glibc="1"
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS], [ ], [ ])
AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ])
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ], [ ])
AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ])
AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ], [ ])
if test "${LG_SIZEOF_PTR}" = "3"; then if test "${LG_SIZEOF_PTR}" = "3"; then
default_retain="1" default_retain="1"
fi fi
zero_realloc_default_free="1"
;; ;;
*-*-kfreebsd*) *-*-kfreebsd*)
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE) JE_APPEND_VS(CPPFLAGS, -D_GNU_SOURCE)
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H]) AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ])
AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ]) AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ], [ ])
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) AC_DEFINE([JEMALLOC_THREADED_INIT], [ ], [ ])
AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ], [ ])
;; ;;
*-*-netbsd*) *-*-netbsd*)
AC_MSG_CHECKING([ABI]) AC_MSG_CHECKING([ABI])
...@@ -741,6 +776,12 @@ case "${host}" in ...@@ -741,6 +776,12 @@ case "${host}" in
if test "${LG_SIZEOF_PTR}" = "3"; then if test "${LG_SIZEOF_PTR}" = "3"; then
default_retain="1" default_retain="1"
fi fi
zero_realloc_default_free="1"
;;
*-*-nto-qnx)
abi="elf"
force_tls="0"
AC_DEFINE([JEMALLOC_HAS_ALLOCA_H], [ ], [ ])
;; ;;
*) *)
AC_MSG_RESULT([Unsupported operating system: ${host}]) AC_MSG_RESULT([Unsupported operating system: ${host}])
...@@ -763,7 +804,7 @@ AC_CHECK_HEADERS([malloc.h], [ ...@@ -763,7 +804,7 @@ AC_CHECK_HEADERS([malloc.h], [
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
]) ])
]) ])
AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST]) AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST], [ ])
AC_SUBST([abi]) AC_SUBST([abi])
AC_SUBST([RPATH]) AC_SUBST([RPATH])
AC_SUBST([LD_PRELOAD_VAR]) AC_SUBST([LD_PRELOAD_VAR])
...@@ -801,7 +842,7 @@ JE_COMPILABLE([__attribute__ syntax], ...@@ -801,7 +842,7 @@ JE_COMPILABLE([__attribute__ syntax],
[], [],
[je_cv_attribute]) [je_cv_attribute])
if test "x${je_cv_attribute}" = "xyes" ; then if test "x${je_cv_attribute}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ]) AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ], [ ])
if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
JE_CFLAGS_ADD([-fvisibility=hidden]) JE_CFLAGS_ADD([-fvisibility=hidden])
JE_CXXFLAGS_ADD([-fvisibility=hidden]) JE_CXXFLAGS_ADD([-fvisibility=hidden])
...@@ -829,7 +870,7 @@ JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>], ...@@ -829,7 +870,7 @@ JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>],
[je_cv_alloc_size]) [je_cv_alloc_size])
JE_CFLAGS_RESTORE() JE_CFLAGS_RESTORE()
if test "x${je_cv_alloc_size}" = "xyes" ; then if test "x${je_cv_alloc_size}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ]) AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ], [ ])
fi fi
dnl Check for format(gnu_printf, ...) attribute support. dnl Check for format(gnu_printf, ...) attribute support.
JE_CFLAGS_SAVE() JE_CFLAGS_SAVE()
...@@ -840,7 +881,7 @@ JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>], ...@@ -840,7 +881,7 @@ JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>],
[je_cv_format_gnu_printf]) [je_cv_format_gnu_printf])
JE_CFLAGS_RESTORE() JE_CFLAGS_RESTORE()
if test "x${je_cv_format_gnu_printf}" = "xyes" ; then if test "x${je_cv_format_gnu_printf}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ]) AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ], [ ])
fi fi
dnl Check for format(printf, ...) attribute support. dnl Check for format(printf, ...) attribute support.
JE_CFLAGS_SAVE() JE_CFLAGS_SAVE()
...@@ -851,7 +892,7 @@ JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], ...@@ -851,7 +892,7 @@ JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
[je_cv_format_printf]) [je_cv_format_printf])
JE_CFLAGS_RESTORE() JE_CFLAGS_RESTORE()
if test "x${je_cv_format_printf}" = "xyes" ; then if test "x${je_cv_format_printf}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ]) AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ], [ ])
fi fi
dnl Check for format_arg(...) attribute support. dnl Check for format_arg(...) attribute support.
...@@ -863,7 +904,51 @@ JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>], ...@@ -863,7 +904,51 @@ JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
[je_cv_format_arg]) [je_cv_format_arg])
JE_CFLAGS_RESTORE() JE_CFLAGS_RESTORE()
if test "x${je_cv_format_arg}" = "xyes" ; then if test "x${je_cv_format_arg}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_ARG], [ ]) AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_ARG], [ ], [ ])
fi
dnl Check for fallthrough attribute support.
JE_CFLAGS_SAVE()
JE_CFLAGS_ADD([-Wimplicit-fallthrough])
JE_COMPILABLE([fallthrough attribute],
[#if !__has_attribute(fallthrough)
#error "foo"
#endif],
[int x = 0;
switch (x) {
case 0: __attribute__((__fallthrough__));
case 1: return 1;
}],
[je_cv_fallthrough])
JE_CFLAGS_RESTORE()
if test "x${je_cv_fallthrough}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_ATTR_FALLTHROUGH], [ ], [ ])
JE_CFLAGS_ADD([-Wimplicit-fallthrough])
JE_CXXFLAGS_ADD([-Wimplicit-fallthrough])
fi
dnl Check for cold attribute support.
JE_CFLAGS_SAVE()
JE_CFLAGS_ADD([-Werror])
JE_CFLAGS_ADD([-herror_on_warning])
JE_COMPILABLE([cold attribute], [],
[__attribute__((__cold__)) void foo();],
[je_cv_cold])
JE_CFLAGS_RESTORE()
if test "x${je_cv_cold}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_ATTR_COLD], [ ], [ ])
fi
dnl Check for VM_MAKE_TAG for mmap support.
JE_COMPILABLE([vm_make_tag],
[#include <sys/mman.h>
#include <mach/vm_statistics.h>],
[void *p;
p = mmap(0, 16, PROT_READ, MAP_ANON|MAP_PRIVATE, VM_MAKE_TAG(1), 0);
munmap(p, 16);],
[je_cv_vm_make_tag])
if test "x${je_cv_vm_make_tag}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_VM_MAKE_TAG], [ ], [ ])
fi fi
dnl Support optional additions to rpath. dnl Support optional additions to rpath.
...@@ -898,7 +983,7 @@ AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH]) ...@@ -898,7 +983,7 @@ AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
dnl Enable documentation dnl Enable documentation
AC_ARG_ENABLE([doc], AC_ARG_ENABLE([doc],
[AS_HELP_STRING([--enable-documentation], [Build documentation])], [AS_HELP_STRING([--enable-doc], [Build documentation])],
if test "x$enable_doc" = "xno" ; then if test "x$enable_doc" = "xno" ; then
enable_doc="0" enable_doc="0"
else else
...@@ -955,11 +1040,11 @@ else ...@@ -955,11 +1040,11 @@ else
fi] fi]
) )
if test "x$JEMALLOC_PREFIX" = "x" ; then if test "x$JEMALLOC_PREFIX" = "x" ; then
AC_DEFINE([JEMALLOC_IS_MALLOC]) AC_DEFINE([JEMALLOC_IS_MALLOC], [ ], [ ])
else else
JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"` JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"]) AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"], [ ])
AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"]) AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"], [ ])
fi fi
AC_SUBST([JEMALLOC_PREFIX]) AC_SUBST([JEMALLOC_PREFIX])
AC_SUBST([JEMALLOC_CPREFIX]) AC_SUBST([JEMALLOC_CPREFIX])
...@@ -967,42 +1052,45 @@ AC_SUBST([JEMALLOC_CPREFIX]) ...@@ -967,42 +1052,45 @@ AC_SUBST([JEMALLOC_CPREFIX])
AC_ARG_WITH([export], AC_ARG_WITH([export],
[AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])], [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
[if test "x$with_export" = "xno"; then [if test "x$with_export" = "xno"; then
AC_DEFINE([JEMALLOC_EXPORT],[]) AC_DEFINE([JEMALLOC_EXPORT],[], [ ])
fi] fi]
) )
public_syms="aligned_alloc calloc dallocx free mallctl mallctlbymib mallctlnametomib malloc malloc_conf malloc_message malloc_stats_print malloc_usable_size mallocx smallocx_${jemalloc_version_gid} nallocx posix_memalign rallocx realloc sallocx sdallocx xallocx" public_syms="aligned_alloc calloc dallocx free mallctl mallctlbymib mallctlnametomib malloc malloc_conf malloc_conf_2_conf_harder malloc_message malloc_stats_print malloc_usable_size mallocx smallocx_${jemalloc_version_gid} nallocx posix_memalign rallocx realloc sallocx sdallocx xallocx"
dnl Check for additional platform-specific public API functions. dnl Check for additional platform-specific public API functions.
AC_CHECK_FUNC([memalign], AC_CHECK_FUNC([memalign],
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ], [ ])
public_syms="${public_syms} memalign"]) public_syms="${public_syms} memalign"])
AC_CHECK_FUNC([valloc], AC_CHECK_FUNC([valloc],
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ], [ ])
public_syms="${public_syms} valloc"]) public_syms="${public_syms} valloc"])
AC_CHECK_FUNC([malloc_size],
[AC_DEFINE([JEMALLOC_HAVE_MALLOC_SIZE], [ ], [ ])
public_syms="${public_syms} malloc_size"])
dnl Check for allocator-related functions that should be wrapped. dnl Check for allocator-related functions that should be wrapped.
wrap_syms= wrap_syms=
if test "x${JEMALLOC_PREFIX}" = "x" ; then if test "x${JEMALLOC_PREFIX}" = "x" ; then
AC_CHECK_FUNC([__libc_calloc], AC_CHECK_FUNC([__libc_calloc],
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_CALLOC], [ ], [ ])
wrap_syms="${wrap_syms} __libc_calloc"]) wrap_syms="${wrap_syms} __libc_calloc"])
AC_CHECK_FUNC([__libc_free], AC_CHECK_FUNC([__libc_free],
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_FREE], [ ], [ ])
wrap_syms="${wrap_syms} __libc_free"]) wrap_syms="${wrap_syms} __libc_free"])
AC_CHECK_FUNC([__libc_malloc], AC_CHECK_FUNC([__libc_malloc],
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MALLOC], [ ], [ ])
wrap_syms="${wrap_syms} __libc_malloc"]) wrap_syms="${wrap_syms} __libc_malloc"])
AC_CHECK_FUNC([__libc_memalign], AC_CHECK_FUNC([__libc_memalign],
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_MEMALIGN], [ ], [ ])
wrap_syms="${wrap_syms} __libc_memalign"]) wrap_syms="${wrap_syms} __libc_memalign"])
AC_CHECK_FUNC([__libc_realloc], AC_CHECK_FUNC([__libc_realloc],
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_REALLOC], [ ], [ ])
wrap_syms="${wrap_syms} __libc_realloc"]) wrap_syms="${wrap_syms} __libc_realloc"])
AC_CHECK_FUNC([__libc_valloc], AC_CHECK_FUNC([__libc_valloc],
[AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE___LIBC_VALLOC], [ ], [ ])
wrap_syms="${wrap_syms} __libc_valloc"]) wrap_syms="${wrap_syms} __libc_valloc"])
AC_CHECK_FUNC([__posix_memalign], AC_CHECK_FUNC([__posix_memalign],
[AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ]) [AC_DEFINE([JEMALLOC_OVERRIDE___POSIX_MEMALIGN], [ ], [ ])
wrap_syms="${wrap_syms} __posix_memalign"]) wrap_syms="${wrap_syms} __posix_memalign"])
fi fi
...@@ -1020,14 +1108,17 @@ AC_ARG_WITH([private_namespace], ...@@ -1020,14 +1108,17 @@ AC_ARG_WITH([private_namespace],
[JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"], [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"],
[JEMALLOC_PRIVATE_NAMESPACE="je_"] [JEMALLOC_PRIVATE_NAMESPACE="je_"]
) )
AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE]) AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE], [ ])
private_namespace="$JEMALLOC_PRIVATE_NAMESPACE" private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
AC_SUBST([private_namespace]) AC_SUBST([private_namespace])
dnl Do not add suffix to installed files by default. dnl Do not add suffix to installed files by default.
AC_ARG_WITH([install_suffix], AC_ARG_WITH([install_suffix],
[AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])], [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
[INSTALL_SUFFIX="$with_install_suffix"], [case "$with_install_suffix" in
*\ * ) AC_MSG_ERROR([Install suffix should not contain spaces]) ;;
* ) INSTALL_SUFFIX="$with_install_suffix" ;;
esac],
[INSTALL_SUFFIX=] [INSTALL_SUFFIX=]
) )
install_suffix="$INSTALL_SUFFIX" install_suffix="$INSTALL_SUFFIX"
...@@ -1040,7 +1131,7 @@ AC_ARG_WITH([malloc_conf], ...@@ -1040,7 +1131,7 @@ AC_ARG_WITH([malloc_conf],
[JEMALLOC_CONFIG_MALLOC_CONF=""] [JEMALLOC_CONFIG_MALLOC_CONF=""]
) )
config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF" config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"]) AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"], [ ])
dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
dnl jemalloc_protos_jet.h easy. dnl jemalloc_protos_jet.h easy.
...@@ -1129,10 +1220,7 @@ fi ...@@ -1129,10 +1220,7 @@ fi
[enable_debug="0"] [enable_debug="0"]
) )
if test "x$enable_debug" = "x1" ; then if test "x$enable_debug" = "x1" ; then
AC_DEFINE([JEMALLOC_DEBUG], [ ]) AC_DEFINE([JEMALLOC_DEBUG], [ ], [ ])
fi
if test "x$enable_debug" = "x1" ; then
AC_DEFINE([JEMALLOC_DEBUG], [ ])
fi fi
AC_SUBST([enable_debug]) AC_SUBST([enable_debug])
...@@ -1164,7 +1252,7 @@ fi ...@@ -1164,7 +1252,7 @@ fi
[enable_stats="1"] [enable_stats="1"]
) )
if test "x$enable_stats" = "x1" ; then if test "x$enable_stats" = "x1" ; then
AC_DEFINE([JEMALLOC_STATS], [ ]) AC_DEFINE([JEMALLOC_STATS], [ ], [ ])
fi fi
AC_SUBST([enable_stats]) AC_SUBST([enable_stats])
...@@ -1180,7 +1268,7 @@ fi ...@@ -1180,7 +1268,7 @@ fi
[enable_experimental_smallocx="0"] [enable_experimental_smallocx="0"]
) )
if test "x$enable_experimental_smallocx" = "x1" ; then if test "x$enable_experimental_smallocx" = "x1" ; then
AC_DEFINE([JEMALLOC_EXPERIMENTAL_SMALLOCX_API]) AC_DEFINE([JEMALLOC_EXPERIMENTAL_SMALLOCX_API], [ ], [ ])
fi fi
AC_SUBST([enable_experimental_smallocx]) AC_SUBST([enable_experimental_smallocx])
...@@ -1207,6 +1295,9 @@ AC_ARG_ENABLE([prof-libunwind], ...@@ -1207,6 +1295,9 @@ AC_ARG_ENABLE([prof-libunwind],
enable_prof_libunwind="0" enable_prof_libunwind="0"
else else
enable_prof_libunwind="1" enable_prof_libunwind="1"
if test "x$enable_prof" = "x0" ; then
AC_MSG_ERROR([--enable-prof-libunwind should only be used with --enable-prof])
fi
fi fi
], ],
[enable_prof_libunwind="0"] [enable_prof_libunwind="0"]
...@@ -1234,7 +1325,7 @@ if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then ...@@ -1234,7 +1325,7 @@ if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
fi fi
if test "x${enable_prof_libunwind}" = "x1" ; then if test "x${enable_prof_libunwind}" = "x1" ; then
backtrace_method="libunwind" backtrace_method="libunwind"
AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ]) AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ], [ ])
fi fi
fi fi
...@@ -1257,7 +1348,7 @@ if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ ...@@ -1257,7 +1348,7 @@ if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
fi fi
if test "x${enable_prof_libgcc}" = "x1" ; then if test "x${enable_prof_libgcc}" = "x1" ; then
backtrace_method="libgcc" backtrace_method="libgcc"
AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ]) AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ], [ ])
fi fi
else else
enable_prof_libgcc="0" enable_prof_libgcc="0"
...@@ -1278,7 +1369,7 @@ if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \ ...@@ -1278,7 +1369,7 @@ if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
-a "x$GCC" = "xyes" ; then -a "x$GCC" = "xyes" ; then
JE_CFLAGS_ADD([-fno-omit-frame-pointer]) JE_CFLAGS_ADD([-fno-omit-frame-pointer])
backtrace_method="gcc intrinsics" backtrace_method="gcc intrinsics"
AC_DEFINE([JEMALLOC_PROF_GCC], [ ]) AC_DEFINE([JEMALLOC_PROF_GCC], [ ], [ ])
else else
enable_prof_gcc="0" enable_prof_gcc="0"
fi fi
...@@ -1293,19 +1384,24 @@ if test "x$enable_prof" = "x1" ; then ...@@ -1293,19 +1384,24 @@ if test "x$enable_prof" = "x1" ; then
dnl Heap profiling uses the log(3) function. dnl Heap profiling uses the log(3) function.
JE_APPEND_VS(LIBS, $LM) JE_APPEND_VS(LIBS, $LM)
AC_DEFINE([JEMALLOC_PROF], [ ]) AC_DEFINE([JEMALLOC_PROF], [ ], [ ])
fi fi
AC_SUBST([enable_prof]) AC_SUBST([enable_prof])
dnl Indicate whether adjacent virtual memory mappings automatically coalesce dnl Indicate whether adjacent virtual memory mappings automatically coalesce
dnl (and fragment on demand). dnl (and fragment on demand).
if test "x${maps_coalesce}" = "x1" ; then if test "x${maps_coalesce}" = "x1" ; then
AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ]) AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ], [ ])
fi fi
dnl Indicate whether to retain memory (rather than using munmap()) by default. dnl Indicate whether to retain memory (rather than using munmap()) by default.
if test "x$default_retain" = "x1" ; then if test "x$default_retain" = "x1" ; then
AC_DEFINE([JEMALLOC_RETAIN], [ ]) AC_DEFINE([JEMALLOC_RETAIN], [ ], [ ])
fi
dnl Indicate whether realloc(ptr, 0) defaults to the "alloc" behavior.
if test "x$zero_realloc_default_free" = "x1" ; then
AC_DEFINE([JEMALLOC_ZERO_REALLOC_DEFAULT_FREE], [ ], [ ])
fi fi
dnl Enable allocation from DSS if supported by the OS. dnl Enable allocation from DSS if supported by the OS.
...@@ -1322,7 +1418,7 @@ else ...@@ -1322,7 +1418,7 @@ else
fi fi
if test "x$have_dss" = "x1" ; then if test "x$have_dss" = "x1" ; then
AC_DEFINE([JEMALLOC_DSS], [ ]) AC_DEFINE([JEMALLOC_DSS], [ ], [ ])
fi fi
dnl Support the junk/zero filling option by default. dnl Support the junk/zero filling option by default.
...@@ -1337,7 +1433,7 @@ fi ...@@ -1337,7 +1433,7 @@ fi
[enable_fill="1"] [enable_fill="1"]
) )
if test "x$enable_fill" = "x1" ; then if test "x$enable_fill" = "x1" ; then
AC_DEFINE([JEMALLOC_FILL], [ ]) AC_DEFINE([JEMALLOC_FILL], [ ], [ ])
fi fi
AC_SUBST([enable_fill]) AC_SUBST([enable_fill])
...@@ -1362,10 +1458,25 @@ JE_COMPILABLE([utrace(2)], [ ...@@ -1362,10 +1458,25 @@ JE_COMPILABLE([utrace(2)], [
utrace((void *)0, 0); utrace((void *)0, 0);
], [je_cv_utrace]) ], [je_cv_utrace])
if test "x${je_cv_utrace}" = "xno" ; then if test "x${je_cv_utrace}" = "xno" ; then
enable_utrace="0" JE_COMPILABLE([utrace(2) with label], [
fi #include <sys/types.h>
if test "x$enable_utrace" = "x1" ; then #include <sys/param.h>
AC_DEFINE([JEMALLOC_UTRACE], [ ]) #include <sys/time.h>
#include <sys/uio.h>
#include <sys/ktrace.h>
], [
utrace((void *)0, (void *)0, 0);
], [je_cv_utrace_label])
if test "x${je_cv_utrace_label}" = "xno"; then
enable_utrace="0"
fi
if test "x$enable_utrace" = "x1" ; then
AC_DEFINE([JEMALLOC_UTRACE_LABEL], [ ], [ ])
fi
else
if test "x$enable_utrace" = "x1" ; then
AC_DEFINE([JEMALLOC_UTRACE], [ ], [ ])
fi
fi fi
AC_SUBST([enable_utrace]) AC_SUBST([enable_utrace])
...@@ -1381,7 +1492,7 @@ fi ...@@ -1381,7 +1492,7 @@ fi
[enable_xmalloc="0"] [enable_xmalloc="0"]
) )
if test "x$enable_xmalloc" = "x1" ; then if test "x$enable_xmalloc" = "x1" ; then
AC_DEFINE([JEMALLOC_XMALLOC], [ ]) AC_DEFINE([JEMALLOC_XMALLOC], [ ], [ ])
fi fi
AC_SUBST([enable_xmalloc]) AC_SUBST([enable_xmalloc])
...@@ -1398,7 +1509,7 @@ fi ...@@ -1398,7 +1509,7 @@ fi
[enable_cache_oblivious="1"] [enable_cache_oblivious="1"]
) )
if test "x$enable_cache_oblivious" = "x1" ; then if test "x$enable_cache_oblivious" = "x1" ; then
AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ]) AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ], [ ])
fi fi
AC_SUBST([enable_cache_oblivious]) AC_SUBST([enable_cache_oblivious])
...@@ -1414,7 +1525,7 @@ fi ...@@ -1414,7 +1525,7 @@ fi
[enable_log="0"] [enable_log="0"]
) )
if test "x$enable_log" = "x1" ; then if test "x$enable_log" = "x1" ; then
AC_DEFINE([JEMALLOC_LOG], [ ]) AC_DEFINE([JEMALLOC_LOG], [ ], [ ])
fi fi
AC_SUBST([enable_log]) AC_SUBST([enable_log])
...@@ -1430,7 +1541,7 @@ fi ...@@ -1430,7 +1541,7 @@ fi
[enable_readlinkat="0"] [enable_readlinkat="0"]
) )
if test "x$enable_readlinkat" = "x1" ; then if test "x$enable_readlinkat" = "x1" ; then
AC_DEFINE([JEMALLOC_READLINKAT], [ ]) AC_DEFINE([JEMALLOC_READLINKAT], [ ], [ ])
fi fi
AC_SUBST([enable_readlinkat]) AC_SUBST([enable_readlinkat])
...@@ -1447,10 +1558,44 @@ fi ...@@ -1447,10 +1558,44 @@ fi
[enable_opt_safety_checks="0"] [enable_opt_safety_checks="0"]
) )
if test "x$enable_opt_safety_checks" = "x1" ; then if test "x$enable_opt_safety_checks" = "x1" ; then
AC_DEFINE([JEMALLOC_OPT_SAFETY_CHECKS], [ ]) AC_DEFINE([JEMALLOC_OPT_SAFETY_CHECKS], [ ], [ ])
fi fi
AC_SUBST([enable_opt_safety_checks]) AC_SUBST([enable_opt_safety_checks])
dnl Look for sized-deallocation bugs while otherwise being in opt mode.
AC_ARG_ENABLE([opt-size-checks],
[AS_HELP_STRING([--enable-opt-size-checks],
[Perform sized-deallocation argument checks, even in opt mode])],
[if test "x$enable_opt_size_checks" = "xno" ; then
enable_opt_size_checks="0"
else
enable_opt_size_checks="1"
fi
],
[enable_opt_size_checks="0"]
)
if test "x$enable_opt_size_checks" = "x1" ; then
AC_DEFINE([JEMALLOC_OPT_SIZE_CHECKS], [ ], [ ])
fi
AC_SUBST([enable_opt_size_checks])
dnl Do not check for use-after-free by default.
AC_ARG_ENABLE([uaf-detection],
[AS_HELP_STRING([--enable-uaf-detection],
[Allow sampled junk-filling on deallocation to detect use-after-free])],
[if test "x$enable_uaf_detection" = "xno" ; then
enable_uaf_detection="0"
else
enable_uaf_detection="1"
fi
],
[enable_uaf_detection="0"]
)
if test "x$enable_uaf_detection" = "x1" ; then
AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ])
fi
AC_SUBST([enable_uaf_detection])
JE_COMPILABLE([a program using __builtin_unreachable], [ JE_COMPILABLE([a program using __builtin_unreachable], [
void foo (void) { void foo (void) {
__builtin_unreachable(); __builtin_unreachable();
...@@ -1461,9 +1606,9 @@ void foo (void) { ...@@ -1461,9 +1606,9 @@ void foo (void) {
} }
], [je_cv_gcc_builtin_unreachable]) ], [je_cv_gcc_builtin_unreachable])
if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable]) AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable], [ ])
else else
AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort]) AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -1483,9 +1628,9 @@ JE_COMPILABLE([a program using __builtin_ffsl], [ ...@@ -1483,9 +1628,9 @@ JE_COMPILABLE([a program using __builtin_ffsl], [
} }
], [je_cv_gcc_builtin_ffsl]) ], [je_cv_gcc_builtin_ffsl])
if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll]) AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll], [ ])
AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl]) AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl], [ ])
AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs]) AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs], [ ])
else else
JE_COMPILABLE([a program using ffsl], [ JE_COMPILABLE([a program using ffsl], [
#include <stdio.h> #include <stdio.h>
...@@ -1498,9 +1643,9 @@ else ...@@ -1498,9 +1643,9 @@ else
} }
], [je_cv_function_ffsl]) ], [je_cv_function_ffsl])
if test "x${je_cv_function_ffsl}" = "xyes" ; then if test "x${je_cv_function_ffsl}" = "xyes" ; then
AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll]) AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll], [ ])
AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl]) AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl], [ ])
AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs]) AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs], [ ])
else else
AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()]) AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
fi fi
...@@ -1517,22 +1662,39 @@ JE_COMPILABLE([a program using __builtin_popcountl], [ ...@@ -1517,22 +1662,39 @@ JE_COMPILABLE([a program using __builtin_popcountl], [
} }
], [je_cv_gcc_builtin_popcountl]) ], [je_cv_gcc_builtin_popcountl])
if test "x${je_cv_gcc_builtin_popcountl}" = "xyes" ; then if test "x${je_cv_gcc_builtin_popcountl}" = "xyes" ; then
AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNT], [__builtin_popcount]) AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNT], [__builtin_popcount], [ ])
AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTL], [__builtin_popcountl]) AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTL], [__builtin_popcountl], [ ])
AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTLL], [__builtin_popcountll], [ ])
fi fi
AC_ARG_WITH([lg_quantum], AC_ARG_WITH([lg_quantum],
[AS_HELP_STRING([--with-lg-quantum=<lg-quantum>], [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
[Base 2 log of minimum allocation alignment])], [Base 2 log of minimum allocation alignment])])
[LG_QUANTA="$with_lg_quantum"],
[LG_QUANTA="3 4"])
if test "x$with_lg_quantum" != "x" ; then if test "x$with_lg_quantum" != "x" ; then
AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum]) AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum], [ ])
fi
AC_ARG_WITH([lg_slab_maxregs],
[AS_HELP_STRING([--with-lg-slab-maxregs=<lg-slab-maxregs>],
[Base 2 log of maximum number of regions in a slab (used with malloc_conf slab_sizes)])],
[CONFIG_LG_SLAB_MAXREGS="with_lg_slab_maxregs"],
[CONFIG_LG_SLAB_MAXREGS=""])
if test "x$with_lg_slab_maxregs" != "x" ; then
AC_DEFINE_UNQUOTED([CONFIG_LG_SLAB_MAXREGS], [$with_lg_slab_maxregs], [ ])
fi fi
AC_ARG_WITH([lg_page], AC_ARG_WITH([lg_page],
[AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])], [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])],
[LG_PAGE="$with_lg_page"], [LG_PAGE="detect"]) [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"])
case "${host}" in
aarch64-apple-darwin*)
dnl When cross-compile for Apple M1 and no page size specified, use the
dnl default and skip detecting the page size (which is likely incorrect).
if test "x${host}" != "x${build}" -a "x$LG_PAGE" = "xdetect"; then
LG_PAGE=14
fi
;;
esac
if test "x$LG_PAGE" = "xdetect"; then if test "x$LG_PAGE" = "xdetect"; then
AC_CACHE_CHECK([LG_PAGE], AC_CACHE_CHECK([LG_PAGE],
[je_cv_lg_page], [je_cv_lg_page],
...@@ -1579,7 +1741,7 @@ if test "x${je_cv_lg_page}" != "x" ; then ...@@ -1579,7 +1741,7 @@ if test "x${je_cv_lg_page}" != "x" ; then
LG_PAGE="${je_cv_lg_page}" LG_PAGE="${je_cv_lg_page}"
fi fi
if test "x${LG_PAGE}" != "xundefined" ; then if test "x${LG_PAGE}" != "xundefined" ; then
AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE]) AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE], [ ])
else else
AC_MSG_ERROR([cannot determine value for LG_PAGE]) AC_MSG_ERROR([cannot determine value for LG_PAGE])
fi fi
...@@ -1616,7 +1778,7 @@ if test "x${LG_PAGE}" != "xundefined" -a \ ...@@ -1616,7 +1778,7 @@ if test "x${LG_PAGE}" != "xundefined" -a \
"${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then "${je_cv_lg_hugepage}" -lt "${LG_PAGE}" ; then
AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})]) AC_MSG_ERROR([Huge page size (2^${je_cv_lg_hugepage}) must be at least page size (2^${LG_PAGE})])
fi fi
AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}]) AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}], [ ])
dnl ============================================================================ dnl ============================================================================
dnl Enable libdl by default. dnl Enable libdl by default.
...@@ -1637,7 +1799,7 @@ dnl ============================================================================ ...@@ -1637,7 +1799,7 @@ dnl ============================================================================
dnl Configure pthreads. dnl Configure pthreads.
if test "x$abi" != "xpecoff" ; then if test "x$abi" != "xpecoff" ; then
AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ]) AC_DEFINE([JEMALLOC_HAVE_PTHREAD], [ ], [ ])
AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
dnl Some systems may embed pthreads functionality in libc; check for libpthread dnl Some systems may embed pthreads functionality in libc; check for libpthread
dnl first, but try libc too before failing. dnl first, but try libc too before failing.
...@@ -1655,7 +1817,7 @@ dnl Check if we have dlsym support. ...@@ -1655,7 +1817,7 @@ dnl Check if we have dlsym support.
[AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]), [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]),
[have_dlsym="0"]) [have_dlsym="0"])
if test "x$have_dlsym" = "x1" ; then if test "x$have_dlsym" = "x1" ; then
AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ]) AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ], [ ])
fi fi
else else
have_dlsym="0" have_dlsym="0"
...@@ -1667,7 +1829,7 @@ dnl Check if we have dlsym support. ...@@ -1667,7 +1829,7 @@ dnl Check if we have dlsym support.
pthread_atfork((void *)0, (void *)0, (void *)0); pthread_atfork((void *)0, (void *)0, (void *)0);
], [je_cv_pthread_atfork]) ], [je_cv_pthread_atfork])
if test "x${je_cv_pthread_atfork}" = "xyes" ; then if test "x${je_cv_pthread_atfork}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ]) AC_DEFINE([JEMALLOC_HAVE_PTHREAD_ATFORK], [ ], [ ])
fi fi
dnl Check if pthread_setname_np is available with the expected API. dnl Check if pthread_setname_np is available with the expected API.
JE_COMPILABLE([pthread_setname_np(3)], [ JE_COMPILABLE([pthread_setname_np(3)], [
...@@ -1676,7 +1838,38 @@ dnl Check if we have dlsym support. ...@@ -1676,7 +1838,38 @@ dnl Check if we have dlsym support.
pthread_setname_np(pthread_self(), "setname_test"); pthread_setname_np(pthread_self(), "setname_test");
], [je_cv_pthread_setname_np]) ], [je_cv_pthread_setname_np])
if test "x${je_cv_pthread_setname_np}" = "xyes" ; then if test "x${je_cv_pthread_setname_np}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ]) AC_DEFINE([JEMALLOC_HAVE_PTHREAD_SETNAME_NP], [ ], [ ])
fi
dnl Check if pthread_getname_np is not necessarily present despite
dnl the pthread_setname_np counterpart
JE_COMPILABLE([pthread_getname_np(3)], [
#include <pthread.h>
#include <stdlib.h>
], [
{
char *name = malloc(16);
pthread_getname_np(pthread_self(), name, 16);
free(name);
}
], [je_cv_pthread_getname_np])
if test "x${je_cv_pthread_getname_np}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_GETNAME_NP], [ ], [ ])
fi
dnl Check if pthread_get_name_np is not necessarily present despite
dnl the pthread_set_name_np counterpart
JE_COMPILABLE([pthread_get_name_np(3)], [
#include <pthread.h>
#include <pthread_np.h>
#include <stdlib.h>
], [
{
char *name = malloc(16);
pthread_get_name_np(pthread_self(), name, 16);
free(name);
}
], [je_cv_pthread_get_name_np])
if test "x${je_cv_pthread_get_name_np}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_GET_NAME_NP], [ ], [ ])
fi fi
fi fi
...@@ -1708,7 +1901,7 @@ JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [ ...@@ -1708,7 +1901,7 @@ JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [
clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
], [je_cv_clock_monotonic_coarse]) ], [je_cv_clock_monotonic_coarse])
if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE]) AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE], [ ], [ ])
fi fi
dnl check for CLOCK_MONOTONIC. dnl check for CLOCK_MONOTONIC.
...@@ -1724,7 +1917,7 @@ JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [ ...@@ -1724,7 +1917,7 @@ JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [
#endif #endif
], [je_cv_clock_monotonic]) ], [je_cv_clock_monotonic])
if test "x${je_cv_clock_monotonic}" = "xyes" ; then if test "x${je_cv_clock_monotonic}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC]) AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC], [ ], [ ])
fi fi
dnl Check for mach_absolute_time(). dnl Check for mach_absolute_time().
...@@ -1734,7 +1927,19 @@ JE_COMPILABLE([mach_absolute_time()], [ ...@@ -1734,7 +1927,19 @@ JE_COMPILABLE([mach_absolute_time()], [
mach_absolute_time(); mach_absolute_time();
], [je_cv_mach_absolute_time]) ], [je_cv_mach_absolute_time])
if test "x${je_cv_mach_absolute_time}" = "xyes" ; then if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME]) AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME], [ ], [ ])
fi
dnl check for CLOCK_REALTIME (always should be available on Linux)
JE_COMPILABLE([clock_gettime(CLOCK_REALTIME, ...)], [
#include <time.h>
], [
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
], [je_cv_clock_realtime])
if test "x${je_cv_clock_realtime}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_CLOCK_REALTIME], [ ], [ ])
fi fi
dnl Use syscall(2) (if available) by default. dnl Use syscall(2) (if available) by default.
...@@ -1762,7 +1967,7 @@ if test "x$enable_syscall" = "x1" ; then ...@@ -1762,7 +1967,7 @@ if test "x$enable_syscall" = "x1" ; then
[je_cv_syscall]) [je_cv_syscall])
JE_CFLAGS_RESTORE() JE_CFLAGS_RESTORE()
if test "x$je_cv_syscall" = "xyes" ; then if test "x$je_cv_syscall" = "xyes" ; then
AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ]) AC_DEFINE([JEMALLOC_USE_SYSCALL], [ ], [ ])
fi fi
fi fi
...@@ -1772,7 +1977,7 @@ AC_CHECK_FUNC([secure_getenv], ...@@ -1772,7 +1977,7 @@ AC_CHECK_FUNC([secure_getenv],
[have_secure_getenv="0"] [have_secure_getenv="0"]
) )
if test "x$have_secure_getenv" = "x1" ; then if test "x$have_secure_getenv" = "x1" ; then
AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ]) AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ], [ ])
fi fi
dnl Check if the GNU-specific sched_getcpu function exists. dnl Check if the GNU-specific sched_getcpu function exists.
...@@ -1781,7 +1986,7 @@ AC_CHECK_FUNC([sched_getcpu], ...@@ -1781,7 +1986,7 @@ AC_CHECK_FUNC([sched_getcpu],
[have_sched_getcpu="0"] [have_sched_getcpu="0"]
) )
if test "x$have_sched_getcpu" = "x1" ; then if test "x$have_sched_getcpu" = "x1" ; then
AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ]) AC_DEFINE([JEMALLOC_HAVE_SCHED_GETCPU], [ ], [ ])
fi fi
dnl Check if the GNU-specific sched_setaffinity function exists. dnl Check if the GNU-specific sched_setaffinity function exists.
...@@ -1790,7 +1995,7 @@ AC_CHECK_FUNC([sched_setaffinity], ...@@ -1790,7 +1995,7 @@ AC_CHECK_FUNC([sched_setaffinity],
[have_sched_setaffinity="0"] [have_sched_setaffinity="0"]
) )
if test "x$have_sched_setaffinity" = "x1" ; then if test "x$have_sched_setaffinity" = "x1" ; then
AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ]) AC_DEFINE([JEMALLOC_HAVE_SCHED_SETAFFINITY], [ ], [ ])
fi fi
dnl Check if the Solaris/BSD issetugid function exists. dnl Check if the Solaris/BSD issetugid function exists.
...@@ -1799,7 +2004,7 @@ AC_CHECK_FUNC([issetugid], ...@@ -1799,7 +2004,7 @@ AC_CHECK_FUNC([issetugid],
[have_issetugid="0"] [have_issetugid="0"]
) )
if test "x$have_issetugid" = "x1" ; then if test "x$have_issetugid" = "x1" ; then
AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ]) AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ], [ ])
fi fi
dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
...@@ -1811,8 +2016,8 @@ AC_CHECK_FUNC([_malloc_thread_cleanup], ...@@ -1811,8 +2016,8 @@ AC_CHECK_FUNC([_malloc_thread_cleanup],
[have__malloc_thread_cleanup="0"] [have__malloc_thread_cleanup="0"]
) )
if test "x$have__malloc_thread_cleanup" = "x1" ; then if test "x$have__malloc_thread_cleanup" = "x1" ; then
AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ]) AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ], [ ])
wrap_syms="${wrap_syms} _malloc_thread_cleanup" wrap_syms="${wrap_syms} _malloc_thread_cleanup _malloc_tsd_cleanup_register"
force_tls="1" force_tls="1"
fi fi
...@@ -1824,10 +2029,18 @@ AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb], ...@@ -1824,10 +2029,18 @@ AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
[have__pthread_mutex_init_calloc_cb="0"] [have__pthread_mutex_init_calloc_cb="0"]
) )
if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
AC_DEFINE([JEMALLOC_MUTEX_INIT_CB]) AC_DEFINE([JEMALLOC_MUTEX_INIT_CB], [ ], [ ])
wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork" wrap_syms="${wrap_syms} _malloc_prefork _malloc_postfork"
fi fi
AC_CHECK_FUNC([memcntl],
[have_memcntl="1"],
[have_memcntl="0"],
)
if test "x$have_memcntl" = "x1" ; then
AC_DEFINE([JEMALLOC_HAVE_MEMCNTL], [ ], [ ])
fi
dnl Disable lazy locking by default. dnl Disable lazy locking by default.
AC_ARG_ENABLE([lazy_lock], AC_ARG_ENABLE([lazy_lock],
[AS_HELP_STRING([--enable-lazy-lock], [AS_HELP_STRING([--enable-lazy-lock],
...@@ -1854,7 +2067,7 @@ if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then ...@@ -1854,7 +2067,7 @@ if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
fi fi
if test "x$enable_lazy_lock" = "x1" ; then if test "x$enable_lazy_lock" = "x1" ; then
if test "x$have_dlsym" = "x1" ; then if test "x$have_dlsym" = "x1" ; then
AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ]) AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ], [ ])
else else
AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.]) AC_MSG_ERROR([Missing dlsym support: lazy-lock cannot be enabled.])
fi fi
...@@ -1887,7 +2100,7 @@ else ...@@ -1887,7 +2100,7 @@ else
fi fi
AC_SUBST([enable_tls]) AC_SUBST([enable_tls])
if test "x${enable_tls}" = "x1" ; then if test "x${enable_tls}" = "x1" ; then
AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ]) AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -1908,7 +2121,7 @@ JE_COMPILABLE([C11 atomics], [ ...@@ -1908,7 +2121,7 @@ JE_COMPILABLE([C11 atomics], [
return r == 0; return r == 0;
], [je_cv_c11_atomics]) ], [je_cv_c11_atomics])
if test "x${je_cv_c11_atomics}" = "xyes" ; then if test "x${je_cv_c11_atomics}" = "xyes" ; then
AC_DEFINE([JEMALLOC_C11_ATOMICS]) AC_DEFINE([JEMALLOC_C11_ATOMICS], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -1923,7 +2136,7 @@ JE_COMPILABLE([GCC __atomic atomics], [ ...@@ -1923,7 +2136,7 @@ JE_COMPILABLE([GCC __atomic atomics], [
return after_add == 1; return after_add == 1;
], [je_cv_gcc_atomic_atomics]) ], [je_cv_gcc_atomic_atomics])
if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then
AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS]) AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS], [ ], [ ])
dnl check for 8-bit atomic support dnl check for 8-bit atomic support
JE_COMPILABLE([GCC 8-bit __atomic atomics], [ JE_COMPILABLE([GCC 8-bit __atomic atomics], [
...@@ -1935,7 +2148,7 @@ if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then ...@@ -1935,7 +2148,7 @@ if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then
return after_add == 1; return after_add == 1;
], [je_cv_gcc_u8_atomic_atomics]) ], [je_cv_gcc_u8_atomic_atomics])
if test "x${je_cv_gcc_u8_atomic_atomics}" = "xyes" ; then if test "x${je_cv_gcc_u8_atomic_atomics}" = "xyes" ; then
AC_DEFINE([JEMALLOC_GCC_U8_ATOMIC_ATOMICS]) AC_DEFINE([JEMALLOC_GCC_U8_ATOMIC_ATOMICS], [ ], [ ])
fi fi
fi fi
...@@ -1950,7 +2163,7 @@ JE_COMPILABLE([GCC __sync atomics], [ ...@@ -1950,7 +2163,7 @@ JE_COMPILABLE([GCC __sync atomics], [
return (before_add == 0) && (after_add == 1); return (before_add == 0) && (after_add == 1);
], [je_cv_gcc_sync_atomics]) ], [je_cv_gcc_sync_atomics])
if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then
AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS]) AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS], [ ], [ ])
dnl check for 8-bit atomic support dnl check for 8-bit atomic support
JE_COMPILABLE([GCC 8-bit __sync atomics], [ JE_COMPILABLE([GCC 8-bit __sync atomics], [
...@@ -1961,7 +2174,7 @@ if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then ...@@ -1961,7 +2174,7 @@ if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then
return (before_add == 0) && (after_add == 1); return (before_add == 0) && (after_add == 1);
], [je_cv_gcc_u8_sync_atomics]) ], [je_cv_gcc_u8_sync_atomics])
if test "x${je_cv_gcc_u8_sync_atomics}" = "xyes" ; then if test "x${je_cv_gcc_u8_sync_atomics}" = "xyes" ; then
AC_DEFINE([JEMALLOC_GCC_U8_SYNC_ATOMICS]) AC_DEFINE([JEMALLOC_GCC_U8_SYNC_ATOMICS], [ ], [ ])
fi fi
fi fi
...@@ -1986,7 +2199,7 @@ JE_COMPILABLE([Darwin OSAtomic*()], [ ...@@ -1986,7 +2199,7 @@ JE_COMPILABLE([Darwin OSAtomic*()], [
} }
], [je_cv_osatomic]) ], [je_cv_osatomic])
if test "x${je_cv_osatomic}" = "xyes" ; then if test "x${je_cv_osatomic}" = "xyes" ; then
AC_DEFINE([JEMALLOC_OSATOMIC], [ ]) AC_DEFINE([JEMALLOC_OSATOMIC], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -1998,7 +2211,7 @@ JE_COMPILABLE([madvise(2)], [ ...@@ -1998,7 +2211,7 @@ JE_COMPILABLE([madvise(2)], [
madvise((void *)0, 0, 0); madvise((void *)0, 0, 0);
], [je_cv_madvise]) ], [je_cv_madvise])
if test "x${je_cv_madvise}" = "xyes" ; then if test "x${je_cv_madvise}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ]) AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ], [ ])
dnl Check for madvise(..., MADV_FREE). dnl Check for madvise(..., MADV_FREE).
JE_COMPILABLE([madvise(..., MADV_FREE)], [ JE_COMPILABLE([madvise(..., MADV_FREE)], [
...@@ -2007,12 +2220,12 @@ if test "x${je_cv_madvise}" = "xyes" ; then ...@@ -2007,12 +2220,12 @@ if test "x${je_cv_madvise}" = "xyes" ; then
madvise((void *)0, 0, MADV_FREE); madvise((void *)0, 0, MADV_FREE);
], [je_cv_madv_free]) ], [je_cv_madv_free])
if test "x${je_cv_madv_free}" = "xyes" ; then if test "x${je_cv_madv_free}" = "xyes" ; then
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ], [ ])
elif test "x${je_cv_madvise}" = "xyes" ; then elif test "x${je_cv_madvise}" = "xyes" ; then
case "${host_cpu}" in i686|x86_64) case "${host_cpu}" in i686|x86_64)
case "${host}" in *-*-linux*) case "${host}" in *-*-linux*)
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ], [ ])
AC_DEFINE([JEMALLOC_DEFINE_MADVISE_FREE], [ ]) AC_DEFINE([JEMALLOC_DEFINE_MADVISE_FREE], [ ], [ ])
;; ;;
esac esac
;; ;;
...@@ -2026,7 +2239,7 @@ if test "x${je_cv_madvise}" = "xyes" ; then ...@@ -2026,7 +2239,7 @@ if test "x${je_cv_madvise}" = "xyes" ; then
madvise((void *)0, 0, MADV_DONTNEED); madvise((void *)0, 0, MADV_DONTNEED);
], [je_cv_madv_dontneed]) ], [je_cv_madv_dontneed])
if test "x${je_cv_madv_dontneed}" = "xyes" ; then if test "x${je_cv_madv_dontneed}" = "xyes" ; then
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ], [ ])
fi fi
dnl Check for madvise(..., MADV_DO[NT]DUMP). dnl Check for madvise(..., MADV_DO[NT]DUMP).
...@@ -2037,7 +2250,7 @@ if test "x${je_cv_madvise}" = "xyes" ; then ...@@ -2037,7 +2250,7 @@ if test "x${je_cv_madvise}" = "xyes" ; then
madvise((void *)0, 0, MADV_DODUMP); madvise((void *)0, 0, MADV_DODUMP);
], [je_cv_madv_dontdump]) ], [je_cv_madv_dontdump])
if test "x${je_cv_madv_dontdump}" = "xyes" ; then if test "x${je_cv_madv_dontdump}" = "xyes" ; then
AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ]) AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ], [ ])
fi fi
dnl Check for madvise(..., MADV_[NO]HUGEPAGE). dnl Check for madvise(..., MADV_[NO]HUGEPAGE).
...@@ -2047,19 +2260,61 @@ if test "x${je_cv_madvise}" = "xyes" ; then ...@@ -2047,19 +2260,61 @@ if test "x${je_cv_madvise}" = "xyes" ; then
madvise((void *)0, 0, MADV_HUGEPAGE); madvise((void *)0, 0, MADV_HUGEPAGE);
madvise((void *)0, 0, MADV_NOHUGEPAGE); madvise((void *)0, 0, MADV_NOHUGEPAGE);
], [je_cv_thp]) ], [je_cv_thp])
dnl Check for madvise(..., MADV_[NO]CORE).
JE_COMPILABLE([madvise(..., MADV_[[NO]]CORE)], [
#include <sys/mman.h>
], [
madvise((void *)0, 0, MADV_NOCORE);
madvise((void *)0, 0, MADV_CORE);
], [je_cv_madv_nocore])
if test "x${je_cv_madv_nocore}" = "xyes" ; then
AC_DEFINE([JEMALLOC_MADVISE_NOCORE], [ ], [ ])
fi
case "${host_cpu}" in case "${host_cpu}" in
arm*) arm*)
;; ;;
*) *)
if test "x${je_cv_thp}" = "xyes" ; then if test "x${je_cv_thp}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ]) AC_DEFINE([JEMALLOC_HAVE_MADVISE_HUGE], [ ], [ ])
fi fi
;; ;;
esac esac
else
dnl Check for posix_madvise.
JE_COMPILABLE([posix_madvise], [
#include <sys/mman.h>
], [
posix_madvise((void *)0, 0, 0);
], [je_cv_posix_madvise])
if test "x${je_cv_posix_madvise}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_POSIX_MADVISE], [ ], [ ])
dnl Check for posix_madvise(..., POSIX_MADV_DONTNEED).
JE_COMPILABLE([posix_madvise(..., POSIX_MADV_DONTNEED)], [
#include <sys/mman.h>
], [
posix_madvise((void *)0, 0, POSIX_MADV_DONTNEED);
], [je_cv_posix_madv_dontneed])
if test "x${je_cv_posix_madv_dontneed}" = "xyes" ; then
AC_DEFINE([JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED], [ ], [ ])
fi
fi
fi fi
dnl ============================================================================ dnl ============================================================================
dnl Check for __builtin_clz() and __builtin_clzl(). dnl Check for mprotect(2).
JE_COMPILABLE([mprotect(2)], [
#include <sys/mman.h>
], [
mprotect((void *)0, 0, PROT_NONE);
], [je_cv_mprotect])
if test "x${je_cv_mprotect}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_MPROTECT], [ ], [ ])
fi
dnl ============================================================================
dnl Check for __builtin_clz(), __builtin_clzl(), and __builtin_clzll().
AC_CACHE_CHECK([for __builtin_clz], AC_CACHE_CHECK([for __builtin_clz],
[je_cv_builtin_clz], [je_cv_builtin_clz],
...@@ -2073,12 +2328,16 @@ AC_CACHE_CHECK([for __builtin_clz], ...@@ -2073,12 +2328,16 @@ AC_CACHE_CHECK([for __builtin_clz],
unsigned long x = 0; unsigned long x = 0;
int y = __builtin_clzl(x); int y = __builtin_clzl(x);
} }
{
unsigned long long x = 0;
int y = __builtin_clzll(x);
}
])], ])],
[je_cv_builtin_clz=yes], [je_cv_builtin_clz=yes],
[je_cv_builtin_clz=no])]) [je_cv_builtin_clz=no])])
if test "x${je_cv_builtin_clz}" = "xyes" ; then if test "x${je_cv_builtin_clz}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ]) AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -2097,7 +2356,7 @@ JE_COMPILABLE([Darwin os_unfair_lock_*()], [ ...@@ -2097,7 +2356,7 @@ JE_COMPILABLE([Darwin os_unfair_lock_*()], [
#endif #endif
], [je_cv_os_unfair_lock]) ], [je_cv_os_unfair_lock])
if test "x${je_cv_os_unfair_lock}" = "xyes" ; then if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ]) AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -2123,7 +2382,7 @@ if test "x${enable_zone_allocator}" = "x1" ; then ...@@ -2123,7 +2382,7 @@ if test "x${enable_zone_allocator}" = "x1" ; then
if test "x${abi}" != "xmacho"; then if test "x${abi}" != "xmacho"; then
AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin]) AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
fi fi
AC_DEFINE([JEMALLOC_ZONE], [ ]) AC_DEFINE([JEMALLOC_ZONE], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -2144,52 +2403,56 @@ AC_SUBST([enable_initial_exec_tls]) ...@@ -2144,52 +2403,56 @@ AC_SUBST([enable_initial_exec_tls])
if test "x${je_cv_tls_model}" = "xyes" -a \ if test "x${je_cv_tls_model}" = "xyes" -a \
"x${enable_initial_exec_tls}" = "x1" ; then "x${enable_initial_exec_tls}" = "x1" ; then
AC_DEFINE([JEMALLOC_TLS_MODEL], AC_DEFINE([JEMALLOC_TLS_MODEL],
[__attribute__((tls_model("initial-exec")))]) [__attribute__((tls_model("initial-exec")))],
[ ])
else else
AC_DEFINE([JEMALLOC_TLS_MODEL], [ ]) AC_DEFINE([JEMALLOC_TLS_MODEL], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
dnl Enable background threads if possible. dnl Enable background threads if possible.
if test "x${have_pthread}" = "x1" -a "x${je_cv_os_unfair_lock}" != "xyes" ; then if test "x${have_pthread}" = "x1" -a "x${je_cv_os_unfair_lock}" != "xyes" -a \
AC_DEFINE([JEMALLOC_BACKGROUND_THREAD]) "x${abi}" != "xmacho" ; then
AC_DEFINE([JEMALLOC_BACKGROUND_THREAD], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
dnl Check for glibc malloc hooks dnl Check for glibc malloc hooks
JE_COMPILABLE([glibc malloc hook], [ if test "x$glibc" = "x1" ; then
#include <stddef.h> JE_COMPILABLE([glibc malloc hook], [
#include <stddef.h>
extern void (* __free_hook)(void *ptr); extern void (* __free_hook)(void *ptr);
extern void *(* __malloc_hook)(size_t size); extern void *(* __malloc_hook)(size_t size);
extern void *(* __realloc_hook)(void *ptr, size_t size); extern void *(* __realloc_hook)(void *ptr, size_t size);
], [ ], [
void *ptr = 0L; void *ptr = 0L;
if (__malloc_hook) ptr = __malloc_hook(1); if (__malloc_hook) ptr = __malloc_hook(1);
if (__realloc_hook) ptr = __realloc_hook(ptr, 2); if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
if (__free_hook && ptr) __free_hook(ptr); if (__free_hook && ptr) __free_hook(ptr);
], [je_cv_glibc_malloc_hook]) ], [je_cv_glibc_malloc_hook])
if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
if test "x${JEMALLOC_PREFIX}" = "x" ; then if test "x${JEMALLOC_PREFIX}" = "x" ; then
AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ]) AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ], [ ])
wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook" wrap_syms="${wrap_syms} __free_hook __malloc_hook __realloc_hook"
fi
fi fi
fi
JE_COMPILABLE([glibc memalign hook], [ JE_COMPILABLE([glibc memalign hook], [
#include <stddef.h> #include <stddef.h>
extern void *(* __memalign_hook)(size_t alignment, size_t size); extern void *(* __memalign_hook)(size_t alignment, size_t size);
], [ ], [
void *ptr = 0L; void *ptr = 0L;
if (__memalign_hook) ptr = __memalign_hook(16, 7); if (__memalign_hook) ptr = __memalign_hook(16, 7);
], [je_cv_glibc_memalign_hook]) ], [je_cv_glibc_memalign_hook])
if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
if test "x${JEMALLOC_PREFIX}" = "x" ; then if test "x${JEMALLOC_PREFIX}" = "x" ; then
AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ]) AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ], [ ])
wrap_syms="${wrap_syms} __memalign_hook" wrap_syms="${wrap_syms} __memalign_hook"
fi
fi fi
fi fi
...@@ -2202,7 +2465,7 @@ JE_COMPILABLE([pthreads adaptive mutexes], [ ...@@ -2202,7 +2465,7 @@ JE_COMPILABLE([pthreads adaptive mutexes], [
pthread_mutexattr_destroy(&attr); pthread_mutexattr_destroy(&attr);
], [je_cv_pthread_mutex_adaptive_np]) ], [je_cv_pthread_mutex_adaptive_np])
if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ]) AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ], [ ])
fi fi
JE_CFLAGS_SAVE() JE_CFLAGS_SAVE()
...@@ -2221,7 +2484,7 @@ JE_COMPILABLE([strerror_r returns char with gnu source], [ ...@@ -2221,7 +2484,7 @@ JE_COMPILABLE([strerror_r returns char with gnu source], [
], [je_cv_strerror_r_returns_char_with_gnu_source]) ], [je_cv_strerror_r_returns_char_with_gnu_source])
JE_CFLAGS_RESTORE() JE_CFLAGS_RESTORE()
if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then
AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ]) AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
...@@ -2391,7 +2654,7 @@ AC_MSG_RESULT([static libs : ${enable_static}]) ...@@ -2391,7 +2654,7 @@ AC_MSG_RESULT([static libs : ${enable_static}])
AC_MSG_RESULT([autogen : ${enable_autogen}]) AC_MSG_RESULT([autogen : ${enable_autogen}])
AC_MSG_RESULT([debug : ${enable_debug}]) AC_MSG_RESULT([debug : ${enable_debug}])
AC_MSG_RESULT([stats : ${enable_stats}]) AC_MSG_RESULT([stats : ${enable_stats}])
AC_MSG_RESULT([experimetal_smallocx : ${enable_experimental_smallocx}]) AC_MSG_RESULT([experimental_smallocx : ${enable_experimental_smallocx}])
AC_MSG_RESULT([prof : ${enable_prof}]) AC_MSG_RESULT([prof : ${enable_prof}])
AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}]) AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}]) AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
......
...@@ -630,7 +630,7 @@ for (i = 0; i < nbins; i++) { ...@@ -630,7 +630,7 @@ for (i = 0; i < nbins; i++) {
</row> </row>
<row> <row>
<entry>8 KiB</entry> <entry>8 KiB</entry>
<entry>[40 KiB, 48 KiB, 54 KiB, 64 KiB]</entry> <entry>[40 KiB, 48 KiB, 56 KiB, 64 KiB]</entry>
</row> </row>
<row> <row>
<entry>16 KiB</entry> <entry>16 KiB</entry>
...@@ -936,6 +936,22 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay", ...@@ -936,6 +936,22 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.cache_oblivious">
<term>
<mallctl>opt.cache_oblivious</mallctl>
(<type>bool</type>)
<literal>r-</literal>
</term>
<listitem><para>Enable / Disable cache-oblivious large allocation
alignment, for large requests with no alignment constraints. If this
feature is disabled, all large allocations are page-aligned as an
implementation artifact, which can severely harm CPU cache utilization.
However, the cache-oblivious layout comes at the cost of one extra page
per large allocation, which in the most extreme case increases physical
memory usage for the 16 KiB size class to 20 KiB. This option is enabled
by default.</para></listitem>
</varlistentry>
<varlistentry id="opt.metadata_thp"> <varlistentry id="opt.metadata_thp">
<term> <term>
<mallctl>opt.metadata_thp</mallctl> <mallctl>opt.metadata_thp</mallctl>
...@@ -950,6 +966,17 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay", ...@@ -950,6 +966,17 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
is <quote>disabled</quote>.</para></listitem> is <quote>disabled</quote>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.trust_madvise">
<term>
<mallctl>opt.trust_madvise</mallctl>
(<type>bool</type>)
<literal>r-</literal>
</term>
<listitem><para>If true, do not perform runtime check for MADV_DONTNEED,
to check that it actually zeros pages. The default is disabled on Linux
and enabled elsewhere.</para></listitem>
</varlistentry>
<varlistentry id="opt.retain"> <varlistentry id="opt.retain">
<term> <term>
<mallctl>opt.retain</mallctl> <mallctl>opt.retain</mallctl>
...@@ -1185,6 +1212,41 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay", ...@@ -1185,6 +1212,41 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
enabled. The default is <quote></quote>.</para></listitem> enabled. The default is <quote></quote>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.stats_interval">
<term>
<mallctl>opt.stats_interval</mallctl>
(<type>int64_t</type>)
<literal>r-</literal>
</term>
<listitem><para>Average interval between statistics outputs, as measured
in bytes of allocation activity. The actual interval may be sporadic
because decentralized event counters are used to avoid synchronization
bottlenecks. The output may be triggered on any thread, which then
calls <function>malloc_stats_print()</function>. <link
linkend="opt.stats_interval_opts"><mallctl>opt.stats_interval_opts</mallctl></link>
can be combined to specify output options. By default,
interval-triggered stats output is disabled (encoded as
-1).</para></listitem>
</varlistentry>
<varlistentry id="opt.stats_interval_opts">
<term>
<mallctl>opt.stats_interval_opts</mallctl>
(<type>const char *</type>)
<literal>r-</literal>
</term>
<listitem><para>Options (the <parameter>opts</parameter> string) to pass
to the <function>malloc_stats_print()</function> for interval based
statistics printing (enabled
through <link
linkend="opt.stats_interval"><mallctl>opt.stats_interval</mallctl></link>). See
available options in <link
linkend="malloc_stats_print_opts"><function>malloc_stats_print()</function></link>.
Has no effect unless <link
linkend="opt.stats_interval"><mallctl>opt.stats_interval</mallctl></link> is
enabled. The default is <quote></quote>.</para></listitem>
</varlistentry>
<varlistentry id="opt.junk"> <varlistentry id="opt.junk">
<term> <term>
<mallctl>opt.junk</mallctl> <mallctl>opt.junk</mallctl>
...@@ -1266,21 +1328,23 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1266,21 +1328,23 @@ malloc_conf = "xmalloc:true";]]></programlisting>
a certain size. Thread-specific caching allows many allocations to be a certain size. Thread-specific caching allows many allocations to be
satisfied without performing any thread synchronization, at the cost of satisfied without performing any thread synchronization, at the cost of
increased memory use. See the <link increased memory use. See the <link
linkend="opt.lg_tcache_max"><mallctl>opt.lg_tcache_max</mallctl></link> linkend="opt.tcache_max"><mallctl>opt.tcache_max</mallctl></link>
option for related tuning information. This option is enabled by option for related tuning information. This option is enabled by
default.</para></listitem> default.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.lg_tcache_max"> <varlistentry id="opt.tcache_max">
<term> <term>
<mallctl>opt.lg_tcache_max</mallctl> <mallctl>opt.tcache_max</mallctl>
(<type>size_t</type>) (<type>size_t</type>)
<literal>r-</literal> <literal>r-</literal>
</term> </term>
<listitem><para>Maximum size class (log base 2) to cache in the <listitem><para>Maximum size class to cache in the thread-specific cache
thread-specific cache (tcache). At a minimum, all small size classes (tcache). At a minimum, the first size class is cached; and at a
are cached, and at a maximum all large size classes are cached. The maximum, size classes up to 8 MiB can be cached. The default maximum is
default maximum is 32 KiB (2^15).</para></listitem> 32 KiB (2^15). As a convenience, this may also be set by specifying
lg_tcache_max, which will be taken to be the base-2 logarithm of the
setting of tcache_max.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.thp"> <varlistentry id="opt.thp">
...@@ -1344,7 +1408,9 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1344,7 +1408,9 @@ malloc_conf = "xmalloc:true";]]></programlisting>
set to the empty string, no automatic dumps will occur; this is set to the empty string, no automatic dumps will occur; this is
primarily useful for disabling the automatic final heap dump (which primarily useful for disabling the automatic final heap dump (which
also disables leak reporting, if enabled). The default prefix is also disables leak reporting, if enabled). The default prefix is
<filename>jeprof</filename>.</para></listitem> <filename>jeprof</filename>. This prefix value can be overridden by
<link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link>.
</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="opt.prof_active"> <varlistentry id="opt.prof_active">
...@@ -1423,8 +1489,9 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1423,8 +1489,9 @@ malloc_conf = "xmalloc:true";]]></programlisting>
<filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.i&lt;iseq&gt;.heap</filename>, <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.i&lt;iseq&gt;.heap</filename>,
where <literal>&lt;prefix&gt;</literal> is controlled by the where <literal>&lt;prefix&gt;</literal> is controlled by the
<link <link
linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> and
option. By default, interval-triggered profile dumping is disabled <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link>
options. By default, interval-triggered profile dumping is disabled
(encoded as -1). (encoded as -1).
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
...@@ -1456,8 +1523,9 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1456,8 +1523,9 @@ malloc_conf = "xmalloc:true";]]></programlisting>
usage to a file named according to the pattern usage to a file named according to the pattern
<filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.f.heap</filename>, <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.f.heap</filename>,
where <literal>&lt;prefix&gt;</literal> is controlled by the <link where <literal>&lt;prefix&gt;</literal> is controlled by the <link
linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> and
option. Note that <function>atexit()</function> may allocate <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link>
options. Note that <function>atexit()</function> may allocate
memory during application initialization and then deadlock internally memory during application initialization and then deadlock internally
when jemalloc in turn calls <function>atexit()</function>, so when jemalloc in turn calls <function>atexit()</function>, so
this option is not universally usable (though the application can this option is not universally usable (though the application can
...@@ -1478,8 +1546,57 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1478,8 +1546,57 @@ malloc_conf = "xmalloc:true";]]></programlisting>
<manvolnum>3</manvolnum></citerefentry> function to report memory leaks <manvolnum>3</manvolnum></citerefentry> function to report memory leaks
detected by allocation sampling. See the detected by allocation sampling. See the
<link linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option for <link linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option for
information on analyzing heap profile output. This option is disabled information on analyzing heap profile output. Works only when combined
by default.</para></listitem> with <link linkend="opt.prof_final"><mallctl>opt.prof_final</mallctl>
</link>, otherwise does nothing. This option is disabled by default.
</para></listitem>
</varlistentry>
<varlistentry id="opt.prof_leak_error">
<term>
<mallctl>opt.prof_leak_error</mallctl>
(<type>bool</type>)
<literal>r-</literal>
[<option>--enable-prof</option>]
</term>
<listitem><para>Similar to <link linkend="opt.prof_leak"><mallctl>
opt.prof_leak</mallctl></link>, but makes the process exit with error
code 1 if a memory leak is detected. This option supersedes
<link linkend="opt.prof_leak"><mallctl>opt.prof_leak</mallctl></link>,
meaning that if both are specified, this option takes precedence. When
enabled, also enables <link linkend="opt.prof_leak"><mallctl>
opt.prof_leak</mallctl></link>. Works only when combined with
<link linkend="opt.prof_final"><mallctl>opt.prof_final</mallctl></link>,
otherwise does nothing. This option is disabled by default.
</para></listitem>
</varlistentry>
<varlistentry id="opt.zero_realloc">
<term>
<mallctl>opt.zero_realloc</mallctl>
(<type>const char *</type>)
<literal>r-</literal>
</term>
<listitem><para> Determines the behavior of
<function>realloc()</function> when passed a value of zero for the new
size. <quote>alloc</quote> treats this as an allocation of size zero
(and returns a non-null result except in case of resource exhaustion).
<quote>free</quote> treats this as a deallocation of the pointer, and
returns <constant>NULL</constant> without setting
<varname>errno</varname>. <quote>abort</quote> aborts the process if
zero is passed. The default is <quote>free</quote> on Linux and
Windows, and <quote>alloc</quote> elsewhere.</para>
<para>There is considerable divergence of behaviors across
implementations in handling this case. Many have the behavior of
<quote>free</quote>. This can introduce security vulnerabilities, since
a <constant>NULL</constant> return value indicates failure, and the
continued validity of the passed-in pointer (per POSIX and C11).
<quote>alloc</quote> is safe, but can cause leaks in programs that
expect the common behavior. Programs intended to be portable and
leak-free cannot assume either behavior, and must therefore never call
realloc with a size of 0. The <quote>abort</quote> option enables these
testing this behavior.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="thread.arena"> <varlistentry id="thread.arena">
...@@ -1520,7 +1637,8 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1520,7 +1637,8 @@ malloc_conf = "xmalloc:true";]]></programlisting>
<link <link
linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link> linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link>
mallctl. This is useful for avoiding the overhead of repeated mallctl. This is useful for avoiding the overhead of repeated
<function>mallctl*()</function> calls.</para></listitem> <function>mallctl*()</function> calls. Note that the underlying counter
should not be modified by the application.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="thread.deallocated"> <varlistentry id="thread.deallocated">
...@@ -1547,7 +1665,44 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1547,7 +1665,44 @@ malloc_conf = "xmalloc:true";]]></programlisting>
<link <link
linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link> linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link>
mallctl. This is useful for avoiding the overhead of repeated mallctl. This is useful for avoiding the overhead of repeated
<function>mallctl*()</function> calls.</para></listitem> <function>mallctl*()</function> calls. Note that the underlying counter
should not be modified by the application.</para></listitem>
</varlistentry>
<varlistentry id="thread.peak.read">
<term>
<mallctl>thread.peak.read</mallctl>
(<type>uint64_t</type>)
<literal>r-</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Get an approximation of the maximum value of the
difference between the number of bytes allocated and the number of bytes
deallocated by the calling thread since the last call to <link
linkend="thread.peak.reset"><mallctl>thread.peak.reset</mallctl></link>,
or since the thread's creation if it has not called <link
linkend="thread.peak.reset"><mallctl>thread.peak.reset</mallctl></link>.
No guarantees are made about the quality of the approximation, but
jemalloc currently endeavors to maintain accuracy to within one hundred
kilobytes.
</para></listitem>
</varlistentry>
<varlistentry id="thread.peak.reset">
<term>
<mallctl>thread.peak.reset</mallctl>
(<type>void</type>)
<literal>--</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Resets the counter for net bytes allocated in the calling
thread to zero. This affects subsequent calls to <link
linkend="thread.peak.read"><mallctl>thread.peak.read</mallctl></link>,
but not the values returned by <link
linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link>
or <link
linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link>.
</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="thread.tcache.enabled"> <varlistentry id="thread.tcache.enabled">
...@@ -1618,6 +1773,28 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1618,6 +1773,28 @@ malloc_conf = "xmalloc:true";]]></programlisting>
default.</para></listitem> default.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="thread.idle">
<term>
<mallctl>thread.idle</mallctl>
(<type>void</type>)
<literal>--</literal>
</term>
<listitem><para>Hints to jemalloc that the calling thread will be idle
for some nontrivial period of time (say, on the order of seconds), and
that doing some cleanup operations may be beneficial. There are no
guarantees as to what specific operations will be performed; currently
this flushes the caller's tcache and may (according to some heuristic)
purge its associated arena.</para>
<para>This is not intended to be a general-purpose background activity
mechanism, and threads should not wake up multiple times solely to call
it. Rather, a thread waiting for a task should do a timed wait first,
call <link linkend="thread.idle"><mallctl>thread.idle</mallctl></link>
if no task appears in the timeout interval, and then do an untimed wait.
For such a background activity mechanism, see
<link linkend="background_thread"><mallctl>background_thread</mallctl></link>.
</para></listitem>
</varlistentry>
<varlistentry id="tcache.create"> <varlistentry id="tcache.create">
<term> <term>
<mallctl>tcache.create</mallctl> <mallctl>tcache.create</mallctl>
...@@ -1631,7 +1808,16 @@ malloc_conf = "xmalloc:true";]]></programlisting> ...@@ -1631,7 +1808,16 @@ malloc_conf = "xmalloc:true";]]></programlisting>
automatically managed one that is used by default. Each explicit cache automatically managed one that is used by default. Each explicit cache
can be used by only one thread at a time; the application must assure can be used by only one thread at a time; the application must assure
that this constraint holds. that this constraint holds.
</para>
<para>If the amount of space supplied for storing the thread-specific
cache identifier does not equal
<code language="C">sizeof(<type>unsigned</type>)</code>, no
thread-specific cache will be created, no data will be written to the
space pointed by <parameter>oldp</parameter>, and
<parameter>*oldlenp</parameter> will be set to 0.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="tcache.flush"> <varlistentry id="tcache.flush">
...@@ -2171,7 +2357,14 @@ struct extent_hooks_s { ...@@ -2171,7 +2357,14 @@ struct extent_hooks_s {
</term> </term>
<listitem><para>Explicitly create a new arena outside the range of <listitem><para>Explicitly create a new arena outside the range of
automatically managed arenas, with optionally specified extent hooks, automatically managed arenas, with optionally specified extent hooks,
and return the new arena index.</para></listitem> and return the new arena index.</para>
<para>If the amount of space supplied for storing the arena index does
not equal <code language="C">sizeof(<type>unsigned</type>)</code>, no
arena will be created, no data will be written to the space pointed by
<parameter>oldp</parameter>, and <parameter>*oldlenp</parameter> will
be set to 0.
</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="arenas.lookup"> <varlistentry id="arenas.lookup">
...@@ -2223,9 +2416,24 @@ struct extent_hooks_s { ...@@ -2223,9 +2416,24 @@ struct extent_hooks_s {
is specified, to a file according to the pattern is specified, to a file according to the pattern
<filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.m&lt;mseq&gt;.heap</filename>, <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.m&lt;mseq&gt;.heap</filename>,
where <literal>&lt;prefix&gt;</literal> is controlled by the where <literal>&lt;prefix&gt;</literal> is controlled by the
<link linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
and <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link>
options.</para></listitem>
</varlistentry>
<varlistentry id="prof.prefix">
<term>
<mallctl>prof.prefix</mallctl>
(<type>const char *</type>)
<literal>-w</literal>
[<option>--enable-prof</option>]
</term>
<listitem><para>Set the filename prefix for profile dumps. See
<link <link
linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
option.</para></listitem> for the default setting. This can be useful to differentiate profile
dumps such as from forked processes.
</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="prof.gdump"> <varlistentry id="prof.gdump">
...@@ -2240,8 +2448,9 @@ struct extent_hooks_s { ...@@ -2240,8 +2448,9 @@ struct extent_hooks_s {
dumped to files named according to the pattern dumped to files named according to the pattern
<filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.u&lt;useq&gt;.heap</filename>, <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.u&lt;useq&gt;.heap</filename>,
where <literal>&lt;prefix&gt;</literal> is controlled by the <link where <literal>&lt;prefix&gt;</literal> is controlled by the <link
linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link> and
option.</para></listitem> <link linkend="prof.prefix"><mallctl>prof.prefix</mallctl></link>
options.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="prof.reset"> <varlistentry id="prof.reset">
...@@ -2398,6 +2607,21 @@ struct extent_hooks_s { ...@@ -2398,6 +2607,21 @@ struct extent_hooks_s {
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="stats.zero_reallocs">
<term>
<mallctl>stats.zero_reallocs</mallctl>
(<type>size_t</type>)
<literal>r-</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Number of times that the <function>realloc()</function>
was called with a non-<constant>NULL</constant> pointer argument and a
<constant>0</constant> size argument. This is a fundamentally unsafe
pattern in portable programs; see <link linkend="opt.zero_realloc">
<mallctl>opt.zero_realloc</mallctl></link> for details.
</para></listitem>
</varlistentry>
<varlistentry id="stats.background_thread.num_threads"> <varlistentry id="stats.background_thread.num_threads">
<term> <term>
<mallctl>stats.background_thread.num_threads</mallctl> <mallctl>stats.background_thread.num_threads</mallctl>
...@@ -2509,6 +2733,30 @@ struct extent_hooks_s { ...@@ -2509,6 +2733,30 @@ struct extent_hooks_s {
counters</link>.</para></listitem> counters</link>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry id="stats.mutexes.prof_thds_data">
<term>
<mallctl>stats.mutexes.prof_thds_data.{counter}</mallctl>
(<type>counter specific type</type>) <literal>r-</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Statistics on <varname>prof</varname> threads data mutex
(global scope; profiling related). <mallctl>{counter}</mallctl> is one
of the counters in <link linkend="mutex_counters">mutex profiling
counters</link>.</para></listitem>
</varlistentry>
<varlistentry id="stats.mutexes.prof_dump">
<term>
<mallctl>stats.mutexes.prof_dump.{counter}</mallctl>
(<type>counter specific type</type>) <literal>r-</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Statistics on <varname>prof</varname> dumping mutex
(global scope; profiling related). <mallctl>{counter}</mallctl> is one
of the counters in <link linkend="mutex_counters">mutex profiling
counters</link>.</para></listitem>
</varlistentry>
<varlistentry id="stats.mutexes.reset"> <varlistentry id="stats.mutexes.reset">
<term> <term>
<mallctl>stats.mutexes.reset</mallctl> <mallctl>stats.mutexes.reset</mallctl>
...@@ -3250,7 +3498,7 @@ heap_v2/524288 ...@@ -3250,7 +3498,7 @@ heap_v2/524288
[...] [...]
@ 0x5f86da8 0x5f5a1dc [...] 0x29e4d4e 0xa200316 0xabb2988 [...] @ 0x5f86da8 0x5f5a1dc [...] 0x29e4d4e 0xa200316 0xabb2988 [...]
t*: 13: 6688 [0: 0] t*: 13: 6688 [0: 0]
t3: 12: 6496 [0: ] t3: 12: 6496 [0: 0]
t99: 1: 192 [0: 0] t99: 1: 192 [0: 0]
[...] [...]
...@@ -3261,9 +3509,9 @@ descriptions of the corresponding fields. <programlisting><![CDATA[ ...@@ -3261,9 +3509,9 @@ descriptions of the corresponding fields. <programlisting><![CDATA[
<heap_profile_format_version>/<mean_sample_interval> <heap_profile_format_version>/<mean_sample_interval>
<aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] <aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
[...] [...]
<thread_3_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>] <thread_3_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
[...] [...]
<thread_99_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>] <thread_99_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
[...] [...]
@ <top_frame> <frame> [...] <frame> <frame> <frame> [...] @ <top_frame> <frame> [...] <frame> <frame> <frame> [...]
<backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>] <backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
...@@ -3420,8 +3668,10 @@ MAPPED_LIBRARIES: ...@@ -3420,8 +3668,10 @@ MAPPED_LIBRARIES:
<listitem><para><parameter>newp</parameter> is not <listitem><para><parameter>newp</parameter> is not
<constant>NULL</constant>, and <parameter>newlen</parameter> is too <constant>NULL</constant>, and <parameter>newlen</parameter> is too
large or too small. Alternatively, <parameter>*oldlenp</parameter> large or too small. Alternatively, <parameter>*oldlenp</parameter>
is too large or too small; in this case as much data as possible is too large or too small; when it happens, except for a very few
are read despite the error.</para></listitem> cases explicitly documented otherwise, as much data as possible
are read despite the error, with the amount of data read being
recorded in <parameter>*oldlenp</parameter>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><errorname>ENOENT</errorname></term> <term><errorname>ENOENT</errorname></term>
......
# jemalloc profiling
This describes the mathematical basis behind jemalloc's profiling implementation, as well as the implementation tricks that make it effective. Historically, the jemalloc profiling design simply copied tcmalloc's. The implementation has since diverged, due to both the desire to record additional information, and to correct some biasing bugs.
Note: this document is markdown with embedded LaTeX; different markdown renderers may not produce the expected output. Viewing with `pandoc -s PROFILING_INTERNALS.md -o PROFILING_INTERNALS.pdf` is recommended.
## Some tricks in our implementation toolbag
### Sampling
Recording our metadata is quite expensive; we need to walk up the stack to get a stack trace. On top of that, we need to allocate storage to record that stack trace, and stick it somewhere where a profile-dumping call can find it. That call might happen on another thread, so we'll probably need to take a lock to do so. These costs are quite large compared to the average cost of an allocation. To manage this, we'll only sample some fraction of allocations. This will miss some of them, so our data will be incomplete, but we'll try to make up for it. We can tune our sampling rate to balance accuracy and performance.
### Fast Bernoulli sampling
Compared to our fast paths, even a `coinflip(p)` function can be quite expensive. Having to do a random-number generation and some floating point operations would be a sizeable relative cost. However (as pointed out in [[Vitter, 1987](https://dl.acm.org/doi/10.1145/23002.23003)]), if we can orchestrate our algorithm so that many of our `coinflip` calls share their parameter value, we can do better. We can sample from the geometric distribution, and initialize a counter with the result. When the counter hits 0, the `coinflip` function returns true (and reinitializes its internal counter).
This can let us do a random-number generation once per (logical) coinflip that comes up heads, rather than once per (logical) coinflip. Since we expect to sample relatively rarely, this can be a large win.
### Fast-path / slow-path thinking
Most programs have a skewed distribution of allocations. Smaller allocations are much more frequent than large ones, but shorter lived and less common as a fraction of program memory. "Small" and "large" are necessarily sort of fuzzy terms, but if we define "small" as "allocations jemalloc puts into slabs" and "large" as the others, then it's not uncommon for small allocations to be hundreds of times more frequent than large ones, but take up around half the amount of heap space as large ones. Moreover, small allocations tend to be much cheaper than large ones (often by a factor of 20-30): they're more likely to hit in thread caches, less likely to have to do an mmap, and cheaper to fill (by the user) once the allocation has been returned.
## An unbiased estimator of space consumption from (almost) arbitrary sampling strategies
Suppose we have a sampling strategy that meets the following criteria:
- One allocation being sampled is independent of other allocations being sampled.
- Each allocation has a non-zero probability of being sampled.
We can then estimate the bytes in live allocations through some particular stack trace as:
$$ \sum_i S_i I_i \frac{1}{\mathrm{E}[I_i]} $$
where the sum ranges over some index variable of live allocations from that stack, $S_i$ is the size of the $i$'th allocation, and $I_i$ is an indicator random variable for whether or not the $i'th$ allocation is sampled. $S_i$ and $\mathrm{E}[I_i]$ are constants (the program allocations are fixed; the random variables are the sampling decisions), so taking the expectation we get
$$ \sum_i S_i \mathrm{E}[I_i] \frac{1}{\mathrm{E}[I_i]}.$$
This is of course $\sum_i S_i$, as we want (and, a similar calculation could be done for allocation counts as well).
This is a fairly general strategy; note that while we require that sampling decisions be independent of one another's outcomes, they don't have to be independent of previous allocations, total bytes allocated, etc. You can imagine strategies that:
- Sample allocations at program startup at a higher rate than subsequent allocations
- Sample even-indexed allocations more frequently than odd-indexed ones (so long as no allocation has zero sampling probability)
- Let threads declare themselves as high-sampling-priority, and sample their allocations at an increased rate.
These can all be fit into this framework to give an unbiased estimator.
## Evaluating sampling strategies
Not all strategies for picking allocations to sample are equally good, of course. Among unbiased estimators, the lower the variance, the lower the mean squared error. Using the estimator above, the variance is:
$$
\begin{aligned}
& \mathrm{Var}[\sum_i S_i I_i \frac{1}{\mathrm{E}[I_i]}] \\
=& \sum_i \mathrm{Var}[S_i I_i \frac{1}{\mathrm{E}[I_i]}] \\
=& \sum_i \frac{S_i^2}{\mathrm{E}[I_i]^2} \mathrm{Var}[I_i] \\
=& \sum_i \frac{S_i^2}{\mathrm{E}[I_i]^2} \mathrm{Var}[I_i] \\
=& \sum_i \frac{S_i^2}{\mathrm{E}[I_i]^2} \mathrm{E}[I_i](1 - \mathrm{E}[I_i]) \\
=& \sum_i S_i^2 \frac{1 - \mathrm{E}[I_i]}{\mathrm{E}[I_i]}.
\end{aligned}
$$
We can use this formula to compare various strategy choices. All else being equal, lower-variance strategies are better.
## Possible sampling strategies
Because of the desire to avoid the fast-path costs, we'd like to use our Bernoulli trick if possible. There are two obvious counters to use: a coinflip per allocation, and a coinflip per byte allocated.
### Bernoulli sampling per-allocation
An obvious strategy is to pick some large $N$, and give each allocation a $1/N$ chance of being sampled. This would let us use our Bernoulli-via-Geometric trick. Using the formula from above, we can compute the variance as:
$$ \sum_i S_i^2 \frac{1 - \frac{1}{N}}{\frac{1}{N}} = (N-1) \sum_i S_i^2.$$
That is, an allocation of size $Z$ contributes a term of $(N-1)Z^2$ to the variance.
### Bernoulli sampling per-byte
Another option we have is to pick some rate $R$, and give each byte a $1/R$ chance of being picked for sampling (at which point we would sample its contained allocation). The chance of an allocation of size $Z$ being sampled, then, is
$$1-(1-\frac{1}{R})^{Z}$$
and an allocation of size $Z$ contributes a term of
$$Z^2 \frac{(1-\frac{1}{R})^{Z}}{1-(1-\frac{1}{R})^{Z}}.$$
In practical settings, $R$ is large, and so this is well-approximated by
$$Z^2 \frac{e^{-Z/R}}{1 - e^{-Z/R}} .$$
Just to get a sense of the dynamics here, let's look at the behavior for various values of $Z$. When $Z$ is small relative to $R$, we can use $e^z \approx 1 + x$, and conclude that the variance contributed by a small-$Z$ allocation is around
$$Z^2 \frac{1-Z/R}{Z/R} \approx RZ.$$
When $Z$ is comparable to $R$, the variance term is near $Z^2$ (we have $\frac{e^{-Z/R}}{1 - e^{-Z/R}} = 1$ when $Z/R = \ln 2 \approx 0.693$). When $Z$ is large relative to $R$, the variance term goes to zero.
## Picking a sampling strategy
The fast-path/slow-path dynamics of allocation patterns point us towards the per-byte sampling approach:
- The quadratic increase in variance per allocation in the first approach is quite costly when heaps have a non-negligible portion of their bytes in those allocations, which is practically often the case.
- The Bernoulli-per-byte approach shifts more of its samples towards large allocations, which are already a slow-path.
- We drive several tickers (e.g. tcache gc) by bytes allocated, and report bytes-allocated as a user-visible statistic, so we have to do all the necessary bookkeeping anyways.
Indeed, this is the approach we use in jemalloc. Our heap dumps record the size of the allocation and the sampling rate $R$, and jeprof unbiases by dividing by $1 - e^{-Z/R}$. The framework above would suggest dividing by $1-(1-1/R)^Z$; instead, we use the fact that $R$ is large in practical situations, and so $e^{-Z/R}$ is a good approximation (and faster to compute). (Equivalently, we may also see this as the factor that falls out from viewing sampling as a Poisson process directly).
## Consequences for heap dump consumers
Using this approach means that there are a few things users need to be aware of.
### Stack counts are not proportional to allocation frequencies
If one stack appears twice as often as another, this by itself does not imply that it allocates twice as often. Consider the case in which there are only two types of allocating call stacks in a program. Stack A allocates 8 bytes, and occurs a million times in a program. Stack B allocates 8 MB, and occurs just once in a program. If our sampling rate $R$ is about 1MB, we expect stack A to show up about 8 times, and stack B to show up once. Stack A isn't 8 times more frequent than stack B, though; it's a million times more frequent.
### Aggregation must be done after unbiasing samples
Some tools manually parse heap dump output, and aggregate across stacks (or across program runs) to provide wider-scale data analyses. When doing this aggregation, though, it's important to unbias-and-then-sum, rather than sum-and-then-unbias. Reusing our example from the previous section: suppose we collect heap dumps of the program from a million machines. We then have 8 million occurs of stack A (each of 8 bytes), and a million occurrences of stack B (each of 8 MB). If we sum first, we'll attribute 64 MB to stack A, and 8 TB to stack B. Unbiasing changes these numbers by an infinitesimal amount, so that sum-then-unbias dramatically underreports the amount of memory allocated by stack A.
## An avenue for future exploration
While the framework we laid out above is pretty general, as an engineering decision we're only interested in fairly simple approaches (i.e. ones for which the chance of an allocation being sampled depends only on its size). Our job is then: for each size class $Z$, pick a probability $p_Z$ that an allocation of that size will be sampled. We made some handwave-y references to statistical distributions to justify our choices, but there's no reason we need to pick them that way. Any set of non-zero probabilities is a valid choice.
The real limiting factor in our ability to reduce estimator variance is that fact that sampling is expensive; we want to make sure we only do it on a small fraction of allocations. Our goal, then, is to pick the $p_Z$ to minimize variance given some maximum sampling rate $P$. If we define $a_Z$ to be the fraction of allocations of size $Z$, and $l_Z$ to be the fraction of allocations of size $Z$ still alive at the time of a heap dump, then we can phrase this as an optimization problem over the choices of $p_Z$:
Minimize
$$ \sum_Z Z^2 l_Z \frac{1-p_Z}{p_Z} $$
subject to
$$ \sum_Z a_Z p_Z \leq P $$
Ignoring a term that doesn't depend on $p_Z$, the objective is minimized whenever
$$ \sum_Z Z^2 l_Z \frac{1}{p_Z} $$
is. For a particular program, $l_Z$ and $a_Z$ are just numbers that can be obtained (exactly) from existing stats introspection facilities, and we have a fairly tractable convex optimization problem (it can be framed as a second-order cone program). It would be interesting to evaluate, for various common allocation patterns, how well our current strategy adapts. Do our actual choices for $p_Z$ closely correspond to the optimal ones? How close is the variance of our choices to the variance of the optimal strategy?
You can imagine an implementation that actually goes all the way, and makes $p_Z$ selections a tuning parameter. I don't think this is a good use of development time for the foreseeable future; but I do wonder about the answers to some of these questions.
## Implementation realities
The nice story above is at least partially a lie. Initially, jeprof (copying its logic from pprof) had the sum-then-unbias error described above. The current version of jemalloc does the unbiasing step on a per-allocation basis internally, so that we're always tracking what the unbiased numbers "should" be. The problem is, actually surfacing those unbiased numbers would require a breaking change to jeprof (and the various already-deployed tools that have copied its logic). Instead, we use a little bit more trickery. Since we know at dump time the numbers we want jeprof to report, we simply choose the values we'll output so that the jeprof numbers will match the true numbers. The math is described in `src/prof_data.c` (where the only cleverness is a change of variables that lets the exponentials fall out).
This has the effect of making the output of jeprof (and related tools) correct, while making its inputs incorrect. This can be annoying to human readers of raw profiling dump output.
<svg id="Layer_3" data-name="Layer 3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 499 184.27"><defs><style>.cls-1,.cls-3{fill:none;}.cls-2{clip-path:url(#clip-path);}.cls-3{stroke:#262262;stroke-linecap:round;stroke-linejoin:round;stroke-width:4px;}</style><clipPath id="clip-path" transform="translate(-100.66 -259.87)"><path class="cls-1" d="M144.57,396c0,18.2-9.37,27.83-37.33,23.55V400.1c11.11,2.14,12.18-.27,12.18-11.5V324.11h25Zm-12.71-78.66c-9,0-15.52-1.48-15.52-12.71S122.9,292,131.86,292s15.52,1.2,15.52,12.58C147.38,315.55,141,317.29,131.86,317.29Zm50.57,76.39c-30.64,0-35.85-18.86-35.85-35.59s5.61-35.32,35.72-35.32c35.32,0,33.44,28,33.44,40.67H170.12c.54,9.5,4,14.05,11.37,14.05,6.83,0,9.64-3.34,10-7.89l24.75.13C215.48,383.38,205.84,393.68,182.43,393.68Zm-1.47-55c-6.69,0-10,2.81-10.84,12h21.41C190.73,341.9,188.18,338.69,181,338.69Zm112.78,53.65V351.4c0-4.15-1.33-8.16-6-8.16-5,0-6,3.75-6,8.16v40.94H256.42V351.4c0-4.15-.81-8.16-5.89-8.16s-6.29,3.75-6.29,8.16v40.94H219.09V324.11h14l4.15,8c2.67-4.69,10.56-9.37,18.86-9.37,7.36,0,16.19,2.14,21,9.1,3.48-5.22,11.11-9.1,20.21-9.1,19.13,0,21.54,11.37,21.54,27.16v42.41Zm83.09,0L372.41,383c-5.48,7.22-13.11,10.7-24.35,10.7-14.85,0-26.75-6-26.75-19.93,0-15.26,12.44-20.88,44.28-23,0-9.5-1.61-12.57-8.83-12.57-6.69,0-8.56,3.48-8.56,9.9H323.45c0-12.85,6.82-25.29,32.64-25.29,30,0,34.65,14.45,34.65,31.17v38.4Zm-21.54-28.63c-6.29.94-8.3,4.28-8.3,7.36,0,4.28,2.41,6.69,8.3,6.69s10.17-4.82,10.17-15.12ZM396,392.34V297.75h24.75v94.59Zm30.77,0V297.75h24.75v94.59Zm62.21,1.34c-28.09,0-34.11-18.6-34.11-35.32s6.29-35.59,34.38-35.59c27.7,0,34.12,19,34.12,35.59C523.33,375.22,516.91,393.68,488.94,393.68Zm.27-50.84c-7.89,0-11.37,4.82-11.37,15.52s3.61,15.39,11.1,15.39c7.9,0,11.38-4.42,11.38-15.39C500.32,347.79,497.24,342.84,489.21,342.84Zm69.17,50.84c-28.9,0-34.52-18.6-34.52-35.32s5.76-35.59,34.12-35.59c21.14,0,34.52,10.84,34.52,31.17H568.42c0-9.23-5.49-11.23-10.17-11.23-7,0-11.11,4.54-11.11,15.38s4,15.52,11.11,15.52c4.81,0,10-2.41,10-10.57H592.5C592.5,383.38,579,393.68,558.38,393.68Z"/></clipPath></defs><title>jemalloc Final Logo</title><g class="cls-2"><line class="cls-3" x1="345" y1="182.27" x2="345" y2="2"/><line class="cls-3" x1="225" y1="182.27" x2="225" y2="2"/><line class="cls-3" x1="105" y1="182.27" x2="105" y2="2"/><line class="cls-3" x1="43" y1="182.27" x2="43" y2="2"/><line class="cls-3" x1="475" y1="182.27" x2="475" y2="2"/><line class="cls-3" x1="195" y1="182.27" x2="195" y2="2"/><line class="cls-3" x1="75" y1="182.27" x2="75" y2="2"/><line class="cls-3" x1="337" y1="182.27" x2="337" y2="2"/><line class="cls-3" x1="215" y1="182.27" x2="215" y2="2"/><line class="cls-3" x1="95" y1="182.27" x2="95" y2="2"/><line class="cls-3" x1="415" y1="182.27" x2="415" y2="2"/><line class="cls-3" x1="385" y1="182.27" x2="385" y2="2"/><line class="cls-3" x1="183" y1="182.27" x2="183" y2="2"/><line class="cls-3" x1="65" y1="182.27" x2="65" y2="2"/><line class="cls-3" x1="173" y1="182.27" x2="173" y2="2"/><line class="cls-3" x1="145" y1="182.27" x2="145" y2="2"/><line class="cls-3" x1="163" y1="182.27" x2="163" y2="2"/><line class="cls-3" x1="460" y1="182.27" x2="460" y2="2"/><line class="cls-3" x1="281" y1="182.27" x2="281" y2="2"/><line class="cls-3" x1="313" y1="182.27" x2="313" y2="2"/><line class="cls-3" x1="252" y1="182.27" x2="252" y2="2"/><line class="cls-3" x1="450" y1="182.27" x2="450" y2="2"/><line class="cls-3" x1="271" y1="182.27" x2="271" y2="2"/><line class="cls-3" x1="332" y1="182.27" x2="332" y2="2"/><line class="cls-3" x1="203" y1="182.27" x2="203" y2="2"/><line class="cls-3" x1="13" y1="182.27" x2="13" y2="2"/><line class="cls-3" x1="373" y1="182.27" x2="373" y2="2"/><line class="cls-3" x1="354" y1="182.27" x2="354" y2="2"/><line class="cls-3" x1="235" y1="182.27" x2="235" y2="2"/><line class="cls-3" x1="115" y1="182.27" x2="115" y2="2"/><line class="cls-3" x1="53" y1="182.27" x2="53" y2="2"/><line class="cls-3" x1="484" y1="182.27" x2="484" y2="2"/><line class="cls-3" x1="405" y1="182.27" x2="405" y2="2"/><line class="cls-3" x1="85" y1="182.27" x2="85" y2="2"/><line class="cls-3" x1="225" y1="182.27" x2="225" y2="2"/><line class="cls-3" x1="105" y1="182.27" x2="105" y2="2"/><line class="cls-3" x1="43" y1="182.27" x2="43" y2="2"/><line class="cls-3" x1="435" y1="182.27" x2="435" y2="2"/><line class="cls-3" x1="123" y1="182.27" x2="123" y2="2"/><line class="cls-3" x1="75" y1="182.27" x2="75" y2="2"/><line class="cls-3" x1="183" y1="182.27" x2="183" y2="2"/><line class="cls-3" x1="155" y1="182.27" x2="155" y2="2"/><line class="cls-3" x1="173" y1="182.27" x2="173" y2="2"/><line class="cls-3" x1="145" y1="182.27" x2="145" y2="2"/><line class="cls-3" x1="470" y1="182.27" x2="470" y2="2"/><line class="cls-3" x1="292" y1="182.27" x2="292" y2="2"/><line class="cls-3" x1="262" y1="182.27" x2="262" y2="2"/><line class="cls-3" x1="460" y1="182.27" x2="460" y2="2"/><line class="cls-3" x1="281" y1="182.27" x2="281" y2="2"/><line class="cls-3" x1="313" y1="182.27" x2="313" y2="2"/><line class="cls-3" x1="243" y1="182.27" x2="243" y2="2"/><line class="cls-3" x1="22" y1="182.27" x2="22" y2="2"/><line class="cls-3" x1="383" y1="182.27" x2="383" y2="2"/><line class="cls-3" x1="5" y1="182.27" x2="5" y2="2"/><line class="cls-3" x1="133" y1="182.27" x2="133" y2="2"/><line class="cls-3" x1="362" y1="182.27" x2="362" y2="2"/><line class="cls-3" x1="288" y1="182.27" x2="288" y2="2"/><line class="cls-3" x1="298" y1="182.27" x2="298" y2="2"/><line class="cls-3" x1="423" y1="182.27" x2="423" y2="2"/><line class="cls-3" x1="369" y1="182.27" x2="369" y2="2"/><line class="cls-3" x1="490" y1="182.27" x2="490" y2="2"/><line class="cls-3" x1="2" y1="182.27" x2="2" y2="2"/><line class="cls-3" x1="493" y1="182.27" x2="493" y2="2"/><line class="cls-3" x1="225" y1="182.27" x2="225" y2="2"/><line class="cls-3" x1="105" y1="182.27" x2="105" y2="2"/><line class="cls-3" x1="43" y1="182.27" x2="43" y2="2"/><line class="cls-3" x1="475" y1="182.27" x2="475" y2="2"/><line class="cls-3" x1="195" y1="182.27" x2="195" y2="2"/><line class="cls-3" x1="75" y1="182.27" x2="75" y2="2"/><line class="cls-3" x1="337" y1="182.27" x2="337" y2="2"/><line class="cls-3" x1="215" y1="182.27" x2="215" y2="2"/><line class="cls-3" x1="95" y1="182.27" x2="95" y2="2"/><line class="cls-3" x1="415" y1="182.27" x2="415" y2="2"/><line class="cls-3" x1="385" y1="182.27" x2="385" y2="2"/><line class="cls-3" x1="183" y1="182.27" x2="183" y2="2"/><line class="cls-3" x1="65" y1="182.27" x2="65" y2="2"/><line class="cls-3" x1="173" y1="182.27" x2="173" y2="2"/><line class="cls-3" x1="145" y1="182.27" x2="145" y2="2"/><line class="cls-3" x1="163" y1="182.27" x2="163" y2="2"/><line class="cls-3" x1="460" y1="182.27" x2="460" y2="2"/><line class="cls-3" x1="281" y1="182.27" x2="281" y2="2"/><line class="cls-3" x1="313" y1="182.27" x2="313" y2="2"/><line class="cls-3" x1="252" y1="182.27" x2="252" y2="2"/><line class="cls-3" x1="450" y1="182.27" x2="450" y2="2"/><line class="cls-3" x1="271" y1="182.27" x2="271" y2="2"/><line class="cls-3" x1="306" y1="182.27" x2="306" y2="2"/><line class="cls-3" x1="203" y1="182.27" x2="203" y2="2"/><line class="cls-3" x1="13" y1="182.27" x2="13" y2="2"/><line class="cls-3" x1="373" y1="182.27" x2="373" y2="2"/><line class="cls-3" x1="354" y1="182.27" x2="354" y2="2"/><line class="cls-3" x1="235" y1="182.27" x2="235" y2="2"/><line class="cls-3" x1="115" y1="182.27" x2="115" y2="2"/><line class="cls-3" x1="53" y1="182.27" x2="53" y2="2"/><line class="cls-3" x1="484" y1="182.27" x2="484" y2="2"/><line class="cls-3" x1="405" y1="182.27" x2="405" y2="2"/><line class="cls-3" x1="85" y1="182.27" x2="85" y2="2"/><line class="cls-3" x1="225" y1="182.27" x2="225" y2="2"/><line class="cls-3" x1="105" y1="182.27" x2="105" y2="2"/><line class="cls-3" x1="43" y1="182.27" x2="43" y2="2"/><line class="cls-3" x1="435" y1="182.27" x2="435" y2="2"/><line class="cls-3" x1="123" y1="182.27" x2="123" y2="2"/><line class="cls-3" x1="75" y1="182.27" x2="75" y2="2"/><line class="cls-3" x1="183" y1="182.27" x2="183" y2="2"/><line class="cls-3" x1="155" y1="182.27" x2="155" y2="2"/><line class="cls-3" x1="173" y1="182.27" x2="173" y2="2"/><line class="cls-3" x1="145" y1="182.27" x2="145" y2="2"/><line class="cls-3" x1="470" y1="182.27" x2="470" y2="2"/><line class="cls-3" x1="292" y1="182.27" x2="292" y2="2"/><line class="cls-3" x1="262" y1="182.27" x2="262" y2="2"/><line class="cls-3" x1="460" y1="182.27" x2="460" y2="2"/><line class="cls-3" x1="281" y1="182.27" x2="281" y2="2"/><line class="cls-3" x1="328" y1="182.27" x2="328" y2="2"/><line class="cls-3" x1="243" y1="182.27" x2="243" y2="2"/><line class="cls-3" x1="22" y1="182.27" x2="22" y2="2"/><line class="cls-3" x1="383" y1="182.27" x2="383" y2="2"/><line class="cls-3" x1="5" y1="182.27" x2="5" y2="2"/><line class="cls-3" x1="32" y1="182.27" x2="32" y2="2"/><line class="cls-3" x1="133" y1="182.27" x2="133" y2="2"/><line class="cls-3" x1="362" y1="182.27" x2="362" y2="2"/><line class="cls-3" x1="288" y1="182.27" x2="288" y2="2"/><line class="cls-3" x1="298" y1="182.27" x2="298" y2="2"/><line class="cls-3" x1="423" y1="182.27" x2="423" y2="2"/><line class="cls-3" x1="369" y1="182.27" x2="369" y2="2"/><line class="cls-3" x1="490" y1="182.27" x2="490" y2="2"/><line class="cls-3" x1="2" y1="182.27" x2="2" y2="2"/><line class="cls-3" x1="493" y1="182.27" x2="493" y2="2"/><line class="cls-3" x1="349" y1="182.27" x2="349" y2="2"/><line class="cls-3" x1="229" y1="182.27" x2="229" y2="2"/><line class="cls-3" x1="109" y1="182.27" x2="109" y2="2"/><line class="cls-3" x1="47" y1="182.27" x2="47" y2="2"/><line class="cls-3" x1="479" y1="182.27" x2="479" y2="2"/><line class="cls-3" x1="399" y1="182.27" x2="399" y2="2"/><line class="cls-3" x1="199" y1="182.27" x2="199" y2="2"/><line class="cls-3" x1="79" y1="182.27" x2="79" y2="2"/><line class="cls-3" x1="341" y1="182.27" x2="341" y2="2"/><line class="cls-3" x1="219" y1="182.27" x2="219" y2="2"/><line class="cls-3" x1="99" y1="182.27" x2="99" y2="2"/><line class="cls-3" x1="41" y1="182.27" x2="41" y2="2"/><line class="cls-3" x1="419" y1="182.27" x2="419" y2="2"/><line class="cls-3" x1="389" y1="182.27" x2="389" y2="2"/><line class="cls-3" x1="187" y1="182.27" x2="187" y2="2"/><line class="cls-3" x1="69" y1="182.27" x2="69" y2="2"/><line class="cls-3" x1="177" y1="182.27" x2="177" y2="2"/><line class="cls-3" x1="149" y1="182.27" x2="149" y2="2"/><line class="cls-3" x1="464" y1="182.27" x2="464" y2="2"/><line class="cls-3" x1="285" y1="182.27" x2="285" y2="2"/><line class="cls-3" x1="317" y1="182.27" x2="317" y2="2"/><line class="cls-3" x1="454" y1="182.27" x2="454" y2="2"/><line class="cls-3" x1="275" y1="182.27" x2="275" y2="2"/><line class="cls-3" x1="308" y1="182.27" x2="308" y2="2"/><line class="cls-3" x1="207" y1="182.27" x2="207" y2="2"/><line class="cls-3" x1="17" y1="182.27" x2="17" y2="2"/><line class="cls-3" x1="377" y1="182.27" x2="377" y2="2"/><line class="cls-3" x1="358" y1="182.27" x2="358" y2="2"/><line class="cls-3" x1="238" y1="182.27" x2="238" y2="2"/><line class="cls-3" x1="119" y1="182.27" x2="119" y2="2"/><line class="cls-3" x1="488" y1="182.27" x2="488" y2="2"/><line class="cls-3" x1="409" y1="182.27" x2="409" y2="2"/><line class="cls-3" x1="229" y1="182.27" x2="229" y2="2"/><line class="cls-3" x1="109" y1="182.27" x2="109" y2="2"/><line class="cls-3" x1="47" y1="182.27" x2="47" y2="2"/><line class="cls-3" x1="439" y1="182.27" x2="439" y2="2"/><line class="cls-3" x1="399" y1="182.27" x2="399" y2="2"/><line class="cls-3" x1="127" y1="182.27" x2="127" y2="2"/><line class="cls-3" x1="79" y1="182.27" x2="79" y2="2"/><line class="cls-3" x1="187" y1="182.27" x2="187" y2="2"/><line class="cls-3" x1="159" y1="182.27" x2="159" y2="2"/><line class="cls-3" x1="177" y1="182.27" x2="177" y2="2"/><line class="cls-3" x1="149" y1="182.27" x2="149" y2="2"/><line class="cls-3" x1="474" y1="182.27" x2="474" y2="2"/><line class="cls-3" x1="266" y1="182.27" x2="266" y2="2"/><line class="cls-3" x1="464" y1="182.27" x2="464" y2="2"/><line class="cls-3" x1="285" y1="182.27" x2="285" y2="2"/><line class="cls-3" x1="317" y1="182.27" x2="317" y2="2"/><line class="cls-3" x1="247" y1="182.27" x2="247" y2="2"/><line class="cls-3" x1="26" y1="182.27" x2="26" y2="2"/><line class="cls-3" x1="387" y1="182.27" x2="387" y2="2"/><line class="cls-3" x1="9" y1="182.27" x2="9" y2="2"/><line class="cls-3" x1="137" y1="182.27" x2="137" y2="2"/><line class="cls-3" x1="292" y1="182.27" x2="292" y2="2"/><line class="cls-3" x1="373" y1="182.27" x2="373" y2="2"/><line class="cls-3" x1="56" y1="182.27" x2="56" y2="2"/><line class="cls-3" x1="494" y1="182.27" x2="494" y2="2"/><line class="cls-3" x1="497" y1="182.27" x2="497" y2="2"/><line class="cls-3" x1="349" y1="182.27" x2="349" y2="2"/><line class="cls-3" x1="229" y1="182.27" x2="229" y2="2"/><line class="cls-3" x1="109" y1="182.27" x2="109" y2="2"/><line class="cls-3" x1="47" y1="182.27" x2="47" y2="2"/><line class="cls-3" x1="479" y1="182.27" x2="479" y2="2"/><line class="cls-3" x1="399" y1="182.27" x2="399" y2="2"/><line class="cls-3" x1="199" y1="182.27" x2="199" y2="2"/><line class="cls-3" x1="79" y1="182.27" x2="79" y2="2"/><line class="cls-3" x1="341" y1="182.27" x2="341" y2="2"/><line class="cls-3" x1="219" y1="182.27" x2="219" y2="2"/><line class="cls-3" x1="99" y1="182.27" x2="99" y2="2"/><line class="cls-3" x1="41" y1="182.27" x2="41" y2="2"/><line class="cls-3" x1="419" y1="182.27" x2="419" y2="2"/><line class="cls-3" x1="389" y1="182.27" x2="389" y2="2"/><line class="cls-3" x1="187" y1="182.27" x2="187" y2="2"/><line class="cls-3" x1="69" y1="182.27" x2="69" y2="2"/><line class="cls-3" x1="177" y1="182.27" x2="177" y2="2"/><line class="cls-3" x1="149" y1="182.27" x2="149" y2="2"/><line class="cls-3" x1="141" y1="182.27" x2="141" y2="2"/><line class="cls-3" x1="464" y1="182.27" x2="464" y2="2"/><line class="cls-3" x1="285" y1="182.27" x2="285" y2="2"/><line class="cls-3" x1="317" y1="182.27" x2="317" y2="2"/><line class="cls-3" x1="454" y1="182.27" x2="454" y2="2"/><line class="cls-3" x1="275" y1="182.27" x2="275" y2="2"/><line class="cls-3" x1="308" y1="182.27" x2="308" y2="2"/><line class="cls-3" x1="207" y1="182.27" x2="207" y2="2"/><line class="cls-3" x1="17" y1="182.27" x2="17" y2="2"/><line class="cls-3" x1="377" y1="182.27" x2="377" y2="2"/><line class="cls-3" x1="119" y1="182.27" x2="119" y2="2"/><line class="cls-3" x1="488" y1="182.27" x2="488" y2="2"/><line class="cls-3" x1="409" y1="182.27" x2="409" y2="2"/><line class="cls-3" x1="229" y1="182.27" x2="229" y2="2"/><line class="cls-3" x1="109" y1="182.27" x2="109" y2="2"/><line class="cls-3" x1="47" y1="182.27" x2="47" y2="2"/><line class="cls-3" x1="439" y1="182.27" x2="439" y2="2"/><line class="cls-3" x1="399" y1="182.27" x2="399" y2="2"/><line class="cls-3" x1="127" y1="182.27" x2="127" y2="2"/><line class="cls-3" x1="79" y1="182.27" x2="79" y2="2"/><line class="cls-3" x1="187" y1="182.27" x2="187" y2="2"/><line class="cls-3" x1="159" y1="182.27" x2="159" y2="2"/><line class="cls-3" x1="177" y1="182.27" x2="177" y2="2"/><line class="cls-3" x1="149" y1="182.27" x2="149" y2="2"/><line class="cls-3" x1="474" y1="182.27" x2="474" y2="2"/><line class="cls-3" x1="295" y1="182.27" x2="295" y2="2"/><line class="cls-3" x1="266" y1="182.27" x2="266" y2="2"/><line class="cls-3" x1="464" y1="182.27" x2="464" y2="2"/><line class="cls-3" x1="285" y1="182.27" x2="285" y2="2"/><line class="cls-3" x1="317" y1="182.27" x2="317" y2="2"/><line class="cls-3" x1="247" y1="182.27" x2="247" y2="2"/><line class="cls-3" x1="58" y1="182.27" x2="58" y2="2"/><line class="cls-3" x1="387" y1="182.27" x2="387" y2="2"/><line class="cls-3" x1="9" y1="182.27" x2="9" y2="2"/><line class="cls-3" x1="292" y1="182.27" x2="292" y2="2"/><line class="cls-3" x1="301" y1="182.27" x2="301" y2="2"/><line class="cls-3" x1="428" y1="182.27" x2="428" y2="2"/><line class="cls-3" x1="373" y1="182.27" x2="373" y2="2"/><line class="cls-3" x1="56" y1="182.27" x2="56" y2="2"/><line class="cls-3" x1="494" y1="182.27" x2="494" y2="2"/><line class="cls-3" x1="497" y1="182.27" x2="497" y2="2"/></g></svg>
\ No newline at end of file
#ifndef JEMALLOC_INTERNAL_ACTIVITY_CALLBACK_H
#define JEMALLOC_INTERNAL_ACTIVITY_CALLBACK_H
/*
* The callback to be executed "periodically", in response to some amount of
* allocator activity.
*
* This callback need not be computing any sort of peak (although that's the
* intended first use case), but we drive it from the peak counter, so it's
* keeps things tidy to keep it here.
*
* The calls to this thunk get driven by the peak_event module.
*/
#define ACTIVITY_CALLBACK_THUNK_INITIALIZER {NULL, NULL}
typedef void (*activity_callback_t)(void *uctx, uint64_t allocated,
uint64_t deallocated);
typedef struct activity_callback_thunk_s activity_callback_thunk_t;
struct activity_callback_thunk_s {
activity_callback_t callback;
void *uctx;
};
#endif /* JEMALLOC_INTERNAL_ACTIVITY_CALLBACK_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment