Bug 1412037 - Upgrade webdriver dependencies. r?jgraham draft
authorAndreas Tolfsen <ato@sny.no>
Mon, 30 Oct 2017 15:09:29 +0000
changeset 688746 0ba48b987e5a39f78c7d14a02e0ce4b9109fb395
parent 688745 8434385412504dfc6f253116f22f808ead66c246
child 688747 ef583718ec4e81794d1b7a78c8e279a5bf72b466
push id86836
push userbmo:ato@sny.no
push dateMon, 30 Oct 2017 15:47:33 +0000
reviewersjgraham
bugs1412037
milestone58.0a1
Bug 1412037 - Upgrade webdriver dependencies. r?jgraham MozReview-Commit-ID: GN9AldKK6uO
third_party/rust/backtrace-0.3.2/.cargo-checksum.json
third_party/rust/backtrace-0.3.2/.travis.yml
third_party/rust/backtrace-0.3.2/Cargo.toml
third_party/rust/backtrace-0.3.2/LICENSE-APACHE
third_party/rust/backtrace-0.3.2/LICENSE-MIT
third_party/rust/backtrace-0.3.2/README.md
third_party/rust/backtrace-0.3.2/appveyor.yml
third_party/rust/backtrace-0.3.2/examples/backtrace.rs
third_party/rust/backtrace-0.3.2/examples/raw.rs
third_party/rust/backtrace-0.3.2/src/backtrace/dbghelp.rs
third_party/rust/backtrace-0.3.2/src/backtrace/libunwind.rs
third_party/rust/backtrace-0.3.2/src/backtrace/mod.rs
third_party/rust/backtrace-0.3.2/src/backtrace/noop.rs
third_party/rust/backtrace-0.3.2/src/backtrace/unix_backtrace.rs
third_party/rust/backtrace-0.3.2/src/capture.rs
third_party/rust/backtrace-0.3.2/src/dylib.rs
third_party/rust/backtrace-0.3.2/src/lib.rs
third_party/rust/backtrace-0.3.2/src/symbolize/coresymbolication.rs
third_party/rust/backtrace-0.3.2/src/symbolize/dbghelp.rs
third_party/rust/backtrace-0.3.2/src/symbolize/dladdr.rs
third_party/rust/backtrace-0.3.2/src/symbolize/libbacktrace.rs
third_party/rust/backtrace-0.3.2/src/symbolize/mod.rs
third_party/rust/backtrace-0.3.2/src/symbolize/noop.rs
third_party/rust/backtrace-0.3.2/tests/smoke.rs
third_party/rust/backtrace-sys-0.1.10/.cargo-checksum.json
third_party/rust/backtrace-sys-0.1.10/Cargo.toml
third_party/rust/backtrace-sys-0.1.10/build.rs
third_party/rust/backtrace-sys-0.1.10/src/lib.rs
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/ChangeLog
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/ChangeLog.jit
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/Makefile.am
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/Makefile.in
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/README
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/aclocal.m4
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/alloc.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/ansidecl.h
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/atomic.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/backtrace-supported.h.in
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/backtrace.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/backtrace.h
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/btest.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/config.guess
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/config.h.in
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/config.sub
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/configure
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/configure.ac
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/dwarf.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/dwarf2.def
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/dwarf2.h
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/elf.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/fileline.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/filenames.h
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/filetype.awk
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/hashtab.h
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/install-sh
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/internal.h
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/ltmain.sh
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/missing
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/mmap.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/mmapio.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/nounwind.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/pecoff.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/posix.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/print.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/read.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/simple.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/sort.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/state.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/stest.c
third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/unknown.c
third_party/rust/backtrace-sys-0.1.10/symbol-map
third_party/rust/backtrace-sys/.cargo-checksum.json
third_party/rust/backtrace-sys/Cargo.toml
third_party/rust/backtrace-sys/build.rs
third_party/rust/backtrace/.cargo-checksum.json
third_party/rust/backtrace/.travis.yml
third_party/rust/backtrace/Cargo.toml
third_party/rust/backtrace/src/backtrace/mod.rs
third_party/rust/backtrace/src/backtrace/unix_backtrace.rs
third_party/rust/backtrace/src/capture.rs
third_party/rust/backtrace/src/lib.rs
third_party/rust/backtrace/src/symbolize/dbghelp.rs
third_party/rust/backtrace/src/symbolize/gimli.rs
third_party/rust/backtrace/src/symbolize/mod.rs
third_party/rust/backtrace/tests/long_fn_name.rs
third_party/rust/backtrace/tests/smoke.rs
third_party/rust/base64-0.5.2/.cargo-checksum.json
third_party/rust/base64-0.5.2/Cargo.toml
third_party/rust/base64-0.5.2/LICENSE-APACHE
third_party/rust/base64-0.5.2/LICENSE-MIT
third_party/rust/base64-0.5.2/README.md
third_party/rust/base64-0.5.2/benches/benchmarks.rs
third_party/rust/base64-0.5.2/examples/make_tables.rs
third_party/rust/base64-0.5.2/src/lib.rs
third_party/rust/base64-0.5.2/src/tables.rs
third_party/rust/base64-0.5.2/tests/tests.rs
third_party/rust/base64/.cargo-checksum.json
third_party/rust/base64/Cargo.toml
third_party/rust/base64/README.md
third_party/rust/base64/benches/benchmarks.rs
third_party/rust/base64/src/lib.rs
third_party/rust/base64/src/line_wrap.rs
third_party/rust/base64/src/tests.rs
third_party/rust/base64/tests/tests.rs
third_party/rust/byteorder-1.0.0/.cargo-checksum.json
third_party/rust/byteorder-1.0.0/.travis.yml
third_party/rust/byteorder-1.0.0/COPYING
third_party/rust/byteorder-1.0.0/Cargo.toml
third_party/rust/byteorder-1.0.0/LICENSE-MIT
third_party/rust/byteorder-1.0.0/README.md
third_party/rust/byteorder-1.0.0/UNLICENSE
third_party/rust/byteorder-1.0.0/benches/bench.rs
third_party/rust/byteorder-1.0.0/src/lib.rs
third_party/rust/byteorder-1.0.0/src/new.rs
third_party/rust/byteorder/.cargo-checksum.json
third_party/rust/byteorder/.travis.yml
third_party/rust/byteorder/CHANGELOG.md
third_party/rust/byteorder/Cargo.toml
third_party/rust/byteorder/benches/bench.rs
third_party/rust/byteorder/src/io.rs
third_party/rust/byteorder/src/lib.rs
third_party/rust/byteorder/src/new.rs
third_party/rust/cfg-if-0.1.1/.cargo-checksum.json
third_party/rust/cfg-if-0.1.1/.travis.yml
third_party/rust/cfg-if-0.1.1/Cargo.toml
third_party/rust/cfg-if-0.1.1/LICENSE-APACHE
third_party/rust/cfg-if-0.1.1/LICENSE-MIT
third_party/rust/cfg-if-0.1.1/README.md
third_party/rust/cfg-if-0.1.1/src/lib.rs
third_party/rust/cfg-if-0.1.1/tests/xcrate.rs
third_party/rust/cfg-if/.cargo-checksum.json
third_party/rust/cfg-if/Cargo.toml
third_party/rust/cfg-if/src/lib.rs
third_party/rust/gcc-0.3.51/.cargo-checksum.json
third_party/rust/gcc-0.3.51/.travis.yml
third_party/rust/gcc-0.3.51/Cargo.toml
third_party/rust/gcc-0.3.51/LICENSE-APACHE
third_party/rust/gcc-0.3.51/LICENSE-MIT
third_party/rust/gcc-0.3.51/README.md
third_party/rust/gcc-0.3.51/appveyor.yml
third_party/rust/gcc-0.3.51/src/bin/gcc-shim.rs
third_party/rust/gcc-0.3.51/src/com.rs
third_party/rust/gcc-0.3.51/src/lib.rs
third_party/rust/gcc-0.3.51/src/registry.rs
third_party/rust/gcc-0.3.51/src/setup_config.rs
third_party/rust/gcc-0.3.51/src/winapi.rs
third_party/rust/gcc-0.3.51/src/windows_registry.rs
third_party/rust/gcc-0.3.51/tests/cc_env.rs
third_party/rust/gcc-0.3.51/tests/support/mod.rs
third_party/rust/gcc-0.3.51/tests/test.rs
third_party/rust/gcc/.cargo-checksum.json
third_party/rust/gcc/.travis.yml
third_party/rust/gcc/Cargo.toml
third_party/rust/gcc/README.md
third_party/rust/gcc/appveyor.yml
third_party/rust/gcc/src/lib.rs
third_party/rust/gcc/src/windows_registry.rs
third_party/rust/gcc/tests/support/mod.rs
third_party/rust/gcc/tests/test.rs
third_party/rust/httparse-1.2.2/.cargo-checksum.json
third_party/rust/httparse-1.2.2/.travis.yml
third_party/rust/httparse-1.2.2/.travis_after.sh
third_party/rust/httparse-1.2.2/Cargo.toml
third_party/rust/httparse-1.2.2/LICENSE-APACHE
third_party/rust/httparse-1.2.2/LICENSE-MIT
third_party/rust/httparse-1.2.2/README.md
third_party/rust/httparse-1.2.2/benches/parse.rs
third_party/rust/httparse-1.2.2/src/iter.rs
third_party/rust/httparse-1.2.2/src/lib.rs
third_party/rust/httparse/.cargo-checksum.json
third_party/rust/httparse/.travis.yml
third_party/rust/httparse/.travis_after.sh
third_party/rust/httparse/Cargo.toml
third_party/rust/httparse/LICENSE-APACHE
third_party/rust/httparse/LICENSE-MIT
third_party/rust/httparse/README.md
third_party/rust/httparse/benches/parse.rs
third_party/rust/httparse/src/iter.rs
third_party/rust/httparse/src/lib.rs
third_party/rust/hyper-0.10.10/.cargo-checksum.json
third_party/rust/hyper-0.10.10/Cargo.toml
third_party/rust/hyper-0.10.10/LICENSE
third_party/rust/hyper-0.10.10/build.rs
third_party/rust/hyper-0.10.10/src/buffer.rs
third_party/rust/hyper-0.10.10/src/client/mod.rs
third_party/rust/hyper-0.10.10/src/client/pool.rs
third_party/rust/hyper-0.10.10/src/client/proxy.rs
third_party/rust/hyper-0.10.10/src/client/request.rs
third_party/rust/hyper-0.10.10/src/client/response.rs
third_party/rust/hyper-0.10.10/src/error.rs
third_party/rust/hyper-0.10.10/src/header/common/accept.rs
third_party/rust/hyper-0.10.10/src/header/common/accept_charset.rs
third_party/rust/hyper-0.10.10/src/header/common/accept_encoding.rs
third_party/rust/hyper-0.10.10/src/header/common/accept_language.rs
third_party/rust/hyper-0.10.10/src/header/common/accept_ranges.rs
third_party/rust/hyper-0.10.10/src/header/common/access_control_allow_credentials.rs
third_party/rust/hyper-0.10.10/src/header/common/access_control_allow_headers.rs
third_party/rust/hyper-0.10.10/src/header/common/access_control_allow_methods.rs
third_party/rust/hyper-0.10.10/src/header/common/access_control_allow_origin.rs
third_party/rust/hyper-0.10.10/src/header/common/access_control_expose_headers.rs
third_party/rust/hyper-0.10.10/src/header/common/access_control_max_age.rs
third_party/rust/hyper-0.10.10/src/header/common/access_control_request_headers.rs
third_party/rust/hyper-0.10.10/src/header/common/access_control_request_method.rs
third_party/rust/hyper-0.10.10/src/header/common/allow.rs
third_party/rust/hyper-0.10.10/src/header/common/authorization.rs
third_party/rust/hyper-0.10.10/src/header/common/cache_control.rs
third_party/rust/hyper-0.10.10/src/header/common/connection.rs
third_party/rust/hyper-0.10.10/src/header/common/content_disposition.rs
third_party/rust/hyper-0.10.10/src/header/common/content_encoding.rs
third_party/rust/hyper-0.10.10/src/header/common/content_language.rs
third_party/rust/hyper-0.10.10/src/header/common/content_length.rs
third_party/rust/hyper-0.10.10/src/header/common/content_range.rs
third_party/rust/hyper-0.10.10/src/header/common/content_type.rs
third_party/rust/hyper-0.10.10/src/header/common/cookie.rs
third_party/rust/hyper-0.10.10/src/header/common/date.rs
third_party/rust/hyper-0.10.10/src/header/common/etag.rs
third_party/rust/hyper-0.10.10/src/header/common/expect.rs
third_party/rust/hyper-0.10.10/src/header/common/expires.rs
third_party/rust/hyper-0.10.10/src/header/common/from.rs
third_party/rust/hyper-0.10.10/src/header/common/host.rs
third_party/rust/hyper-0.10.10/src/header/common/if_match.rs
third_party/rust/hyper-0.10.10/src/header/common/if_modified_since.rs
third_party/rust/hyper-0.10.10/src/header/common/if_none_match.rs
third_party/rust/hyper-0.10.10/src/header/common/if_range.rs
third_party/rust/hyper-0.10.10/src/header/common/if_unmodified_since.rs
third_party/rust/hyper-0.10.10/src/header/common/last-event-id.rs
third_party/rust/hyper-0.10.10/src/header/common/last_modified.rs
third_party/rust/hyper-0.10.10/src/header/common/location.rs
third_party/rust/hyper-0.10.10/src/header/common/mod.rs
third_party/rust/hyper-0.10.10/src/header/common/origin.rs
third_party/rust/hyper-0.10.10/src/header/common/pragma.rs
third_party/rust/hyper-0.10.10/src/header/common/prefer.rs
third_party/rust/hyper-0.10.10/src/header/common/preference_applied.rs
third_party/rust/hyper-0.10.10/src/header/common/range.rs
third_party/rust/hyper-0.10.10/src/header/common/referer.rs
third_party/rust/hyper-0.10.10/src/header/common/referrer_policy.rs
third_party/rust/hyper-0.10.10/src/header/common/server.rs
third_party/rust/hyper-0.10.10/src/header/common/set_cookie.rs
third_party/rust/hyper-0.10.10/src/header/common/strict_transport_security.rs
third_party/rust/hyper-0.10.10/src/header/common/transfer_encoding.rs
third_party/rust/hyper-0.10.10/src/header/common/upgrade.rs
third_party/rust/hyper-0.10.10/src/header/common/user_agent.rs
third_party/rust/hyper-0.10.10/src/header/common/vary.rs
third_party/rust/hyper-0.10.10/src/header/internals/cell.rs
third_party/rust/hyper-0.10.10/src/header/internals/item.rs
third_party/rust/hyper-0.10.10/src/header/internals/mod.rs
third_party/rust/hyper-0.10.10/src/header/internals/vec_map.rs
third_party/rust/hyper-0.10.10/src/header/mod.rs
third_party/rust/hyper-0.10.10/src/header/parsing.rs
third_party/rust/hyper-0.10.10/src/header/shared/charset.rs
third_party/rust/hyper-0.10.10/src/header/shared/encoding.rs
third_party/rust/hyper-0.10.10/src/header/shared/entity.rs
third_party/rust/hyper-0.10.10/src/header/shared/httpdate.rs
third_party/rust/hyper-0.10.10/src/header/shared/mod.rs
third_party/rust/hyper-0.10.10/src/header/shared/quality_item.rs
third_party/rust/hyper-0.10.10/src/http/h1.rs
third_party/rust/hyper-0.10.10/src/http/message.rs
third_party/rust/hyper-0.10.10/src/http/mod.rs
third_party/rust/hyper-0.10.10/src/lib.rs
third_party/rust/hyper-0.10.10/src/method.rs
third_party/rust/hyper-0.10.10/src/mock.rs
third_party/rust/hyper-0.10.10/src/net.rs
third_party/rust/hyper-0.10.10/src/server/listener.rs
third_party/rust/hyper-0.10.10/src/server/mod.rs
third_party/rust/hyper-0.10.10/src/server/request.rs
third_party/rust/hyper-0.10.10/src/server/response.rs
third_party/rust/hyper-0.10.10/src/status.rs
third_party/rust/hyper-0.10.10/src/uri.rs
third_party/rust/hyper-0.10.10/src/version.rs
third_party/rust/hyper/.cargo-checksum.json
third_party/rust/hyper/Cargo.toml
third_party/rust/hyper/build.rs
third_party/rust/hyper/src/buffer.rs
third_party/rust/hyper/src/client/mod.rs
third_party/rust/hyper/src/client/pool.rs
third_party/rust/hyper/src/client/response.rs
third_party/rust/hyper/src/header/common/authorization.rs
third_party/rust/hyper/src/header/common/link.rs
third_party/rust/hyper/src/header/common/mod.rs
third_party/rust/hyper/src/header/internals/cell.rs
third_party/rust/hyper/src/header/internals/vec_map.rs
third_party/rust/hyper/src/header/mod.rs
third_party/rust/hyper/src/http/h1.rs
third_party/rust/hyper/src/lib.rs
third_party/rust/hyper/src/mock.rs
third_party/rust/hyper/src/server/listener.rs
third_party/rust/hyper/src/server/mod.rs
third_party/rust/hyper/src/server/request.rs
third_party/rust/hyper/src/server/response.rs
third_party/rust/hyper/src/uri.rs
third_party/rust/hyper/src/version.rs
third_party/rust/libc-0.2.24/.cargo-checksum.json
third_party/rust/libc-0.2.24/.travis.yml
third_party/rust/libc-0.2.24/Cargo.toml
third_party/rust/libc-0.2.24/LICENSE-APACHE
third_party/rust/libc-0.2.24/LICENSE-MIT
third_party/rust/libc-0.2.24/README.md
third_party/rust/libc-0.2.24/appveyor.yml
third_party/rust/libc-0.2.24/ci/README.md
third_party/rust/libc-0.2.24/ci/android-accept-licenses.sh
third_party/rust/libc-0.2.24/ci/android-install-ndk.sh
third_party/rust/libc-0.2.24/ci/android-install-sdk.sh
third_party/rust/libc-0.2.24/ci/android-sysimage.sh
third_party/rust/libc-0.2.24/ci/docker/aarch64-linux-android/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/arm-linux-androideabi/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/i686-linux-android/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/i686-unknown-linux-gnu/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/i686-unknown-linux-musl/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/mips-unknown-linux-gnu/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/mips-unknown-linux-musl/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/mipsel-unknown-linux-musl/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/x86_64-linux-android/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/x86_64-rumprun-netbsd/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/x86_64-unknown-freebsd/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/x86_64-unknown-linux-musl/Dockerfile
third_party/rust/libc-0.2.24/ci/docker/x86_64-unknown-openbsd/Dockerfile
third_party/rust/libc-0.2.24/ci/dox.sh
third_party/rust/libc-0.2.24/ci/ios/deploy_and_run_on_ios_simulator.rs
third_party/rust/libc-0.2.24/ci/landing-page-footer.html
third_party/rust/libc-0.2.24/ci/landing-page-head.html
third_party/rust/libc-0.2.24/ci/run-docker.sh
third_party/rust/libc-0.2.24/ci/run-qemu.sh
third_party/rust/libc-0.2.24/ci/run.sh
third_party/rust/libc-0.2.24/ci/style.rs
third_party/rust/libc-0.2.24/src/dox.rs
third_party/rust/libc-0.2.24/src/lib.rs
third_party/rust/libc-0.2.24/src/macros.rs
third_party/rust/libc-0.2.24/src/redox.rs
third_party/rust/libc-0.2.24/src/unix/bsd/apple/b32.rs
third_party/rust/libc-0.2.24/src/unix/bsd/apple/b64.rs
third_party/rust/libc-0.2.24/src/unix/bsd/apple/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/dragonfly/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/freebsd/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/freebsd/x86.rs
third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/netbsd/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/netbsd/other/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs
third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs
third_party/rust/libc-0.2.24/src/unix/haiku/b32.rs
third_party/rust/libc-0.2.24/src/unix/haiku/b64.rs
third_party/rust/libc-0.2.24/src/unix/haiku/mod.rs
third_party/rust/libc-0.2.24/src/unix/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/android/b32/arm.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/android/b32/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/android/b32/x86.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/android/b64/aarch64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/android/b64/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/android/b64/x86_64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/android/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/mips/mips32.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/mips/mips64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/mips/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/arm.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/asmjs.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/mips.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/x86.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b64/aarch64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b64/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b64/powerpc64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b64/x86_64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b32/arm.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b32/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b32/powerpc.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b32/x86.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/aarch64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/powerpc64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/sparc64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/x86_64.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/mod.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/linux/s390x.rs
third_party/rust/libc-0.2.24/src/unix/notbsd/mod.rs
third_party/rust/libc-0.2.24/src/unix/solaris/mod.rs
third_party/rust/libc-0.2.24/src/unix/uclibc/mips/mips32.rs
third_party/rust/libc-0.2.24/src/unix/uclibc/mips/mips64.rs
third_party/rust/libc-0.2.24/src/unix/uclibc/mips/mod.rs
third_party/rust/libc-0.2.24/src/unix/uclibc/mod.rs
third_party/rust/libc-0.2.24/src/unix/uclibc/x86_64/mod.rs
third_party/rust/libc-0.2.24/src/windows.rs
third_party/rust/libc/.cargo-checksum.json
third_party/rust/libc/.travis.yml
third_party/rust/libc/Cargo.toml
third_party/rust/libc/README.md
third_party/rust/libc/appveyor.yml
third_party/rust/libc/ci/android-install-ndk.sh
third_party/rust/libc/ci/docker/aarch64-linux-android/Dockerfile
third_party/rust/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
third_party/rust/libc/ci/docker/arm-linux-androideabi/Dockerfile
third_party/rust/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
third_party/rust/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile
third_party/rust/libc/ci/docker/i686-linux-android/Dockerfile
third_party/rust/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile
third_party/rust/libc/ci/docker/i686-unknown-linux-musl/Dockerfile
third_party/rust/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile
third_party/rust/libc/ci/docker/mips-unknown-linux-musl/Dockerfile
third_party/rust/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
third_party/rust/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile
third_party/rust/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
third_party/rust/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
third_party/rust/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile
third_party/rust/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile
third_party/rust/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
third_party/rust/libc/ci/docker/x86_64-linux-android/Dockerfile
third_party/rust/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile
third_party/rust/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs
third_party/rust/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
third_party/rust/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile
third_party/rust/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile
third_party/rust/libc/ci/emscripten-entry.sh
third_party/rust/libc/ci/emscripten.sh
third_party/rust/libc/ci/run-docker.sh
third_party/rust/libc/ci/run.sh
third_party/rust/libc/ci/runtest-android.rs
third_party/rust/libc/src/lib.rs
third_party/rust/libc/src/macros.rs
third_party/rust/libc/src/redox.rs
third_party/rust/libc/src/unix/bsd/apple/b32.rs
third_party/rust/libc/src/unix/bsd/apple/b64.rs
third_party/rust/libc/src/unix/bsd/apple/mod.rs
third_party/rust/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
third_party/rust/libc/src/unix/bsd/freebsdlike/mod.rs
third_party/rust/libc/src/unix/bsd/mod.rs
third_party/rust/libc/src/unix/bsd/netbsdlike/mod.rs
third_party/rust/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
third_party/rust/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
third_party/rust/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
third_party/rust/libc/src/unix/haiku/mod.rs
third_party/rust/libc/src/unix/mod.rs
third_party/rust/libc/src/unix/newlib/arm/mod.rs
third_party/rust/libc/src/unix/newlib/mod.rs
third_party/rust/libc/src/unix/notbsd/android/b32/arm.rs
third_party/rust/libc/src/unix/notbsd/android/b32/mod.rs
third_party/rust/libc/src/unix/notbsd/android/b32/x86.rs
third_party/rust/libc/src/unix/notbsd/android/b64/aarch64.rs
third_party/rust/libc/src/unix/notbsd/android/b64/mod.rs
third_party/rust/libc/src/unix/notbsd/android/b64/x86_64.rs
third_party/rust/libc/src/unix/notbsd/android/mod.rs
third_party/rust/libc/src/unix/notbsd/emscripten.rs
third_party/rust/libc/src/unix/notbsd/linux/mips/mips32.rs
third_party/rust/libc/src/unix/notbsd/linux/mips/mips64.rs
third_party/rust/libc/src/unix/notbsd/linux/mips/mod.rs
third_party/rust/libc/src/unix/notbsd/linux/mod.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b32/arm.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b32/mips.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b32/mod.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b32/x86.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b64/mod.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs
third_party/rust/libc/src/unix/notbsd/linux/musl/mod.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b32/arm.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b32/mod.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b32/powerpc.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b32/x86.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b64/aarch64.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b64/mod.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b64/sparc64.rs
third_party/rust/libc/src/unix/notbsd/linux/other/b64/x86_64.rs
third_party/rust/libc/src/unix/notbsd/linux/other/mod.rs
third_party/rust/libc/src/unix/notbsd/linux/s390x.rs
third_party/rust/libc/src/unix/notbsd/mod.rs
third_party/rust/libc/src/unix/solaris/mod.rs
third_party/rust/libc/src/unix/uclibc/mod.rs
third_party/rust/libc/src/unix/uclibc/x86_64/l4re.rs
third_party/rust/libc/src/unix/uclibc/x86_64/mod.rs
third_party/rust/libc/src/windows.rs
third_party/rust/matches-0.1.4/.cargo-checksum.json
third_party/rust/matches-0.1.4/Cargo.toml
third_party/rust/matches-0.1.4/LICENSE
third_party/rust/matches-0.1.4/lib.rs
third_party/rust/matches/.cargo-checksum.json
third_party/rust/matches/Cargo.toml
third_party/rust/matches/lib.rs
third_party/rust/mime-0.2.4/.cargo-checksum.json
third_party/rust/mime-0.2.4/.travis.yml
third_party/rust/mime-0.2.4/Cargo.toml
third_party/rust/mime-0.2.4/LICENSE
third_party/rust/mime-0.2.4/README.md
third_party/rust/mime-0.2.4/src/lib.rs
third_party/rust/mime/.cargo-checksum.json
third_party/rust/mime/Cargo.toml
third_party/rust/mime/src/lib.rs
third_party/rust/num_cpus-1.6.0/.appveyor.yml
third_party/rust/num_cpus-1.6.0/.cargo-checksum.json
third_party/rust/num_cpus-1.6.0/.travis.yml
third_party/rust/num_cpus-1.6.0/Cargo.toml
third_party/rust/num_cpus-1.6.0/LICENSE-APACHE
third_party/rust/num_cpus-1.6.0/LICENSE-MIT
third_party/rust/num_cpus-1.6.0/README.md
third_party/rust/num_cpus-1.6.0/src/lib.rs
third_party/rust/num_cpus/.cargo-checksum.json
third_party/rust/num_cpus/Cargo.toml
third_party/rust/redox_syscall-0.1.16/.cargo-checksum.json
third_party/rust/redox_syscall-0.1.16/Cargo.toml
third_party/rust/redox_syscall-0.1.16/src/arch/arm.rs
third_party/rust/redox_syscall-0.1.16/src/arch/x86.rs
third_party/rust/redox_syscall-0.1.16/src/arch/x86_64.rs
third_party/rust/redox_syscall-0.1.16/src/call.rs
third_party/rust/redox_syscall-0.1.16/src/data.rs
third_party/rust/redox_syscall-0.1.16/src/error.rs
third_party/rust/redox_syscall-0.1.16/src/flag.rs
third_party/rust/redox_syscall-0.1.16/src/io/dma.rs
third_party/rust/redox_syscall-0.1.16/src/io/io.rs
third_party/rust/redox_syscall-0.1.16/src/io/mmio.rs
third_party/rust/redox_syscall-0.1.16/src/io/mod.rs
third_party/rust/redox_syscall-0.1.16/src/io/pio.rs
third_party/rust/redox_syscall-0.1.16/src/lib.rs
third_party/rust/redox_syscall-0.1.16/src/number.rs
third_party/rust/redox_syscall-0.1.16/src/scheme.rs
third_party/rust/redox_syscall/.cargo-checksum.json
third_party/rust/redox_syscall/Cargo.toml
third_party/rust/redox_syscall/LICENSE
third_party/rust/redox_syscall/README.md
third_party/rust/redox_syscall/src/arch/arm.rs
third_party/rust/redox_syscall/src/arch/x86.rs
third_party/rust/redox_syscall/src/arch/x86_64.rs
third_party/rust/redox_syscall/src/call.rs
third_party/rust/redox_syscall/src/data.rs
third_party/rust/redox_syscall/src/flag.rs
third_party/rust/redox_syscall/src/number.rs
third_party/rust/redox_syscall/src/scheme.rs
third_party/rust/rustc-demangle-0.1.4/.cargo-checksum.json
third_party/rust/rustc-demangle-0.1.4/.travis.yml
third_party/rust/rustc-demangle-0.1.4/Cargo.toml
third_party/rust/rustc-demangle-0.1.4/LICENSE-APACHE
third_party/rust/rustc-demangle-0.1.4/LICENSE-MIT
third_party/rust/rustc-demangle-0.1.4/README.md
third_party/rust/rustc-demangle-0.1.4/src/lib.rs
third_party/rust/rustc-demangle/.cargo-checksum.json
third_party/rust/rustc-demangle/Cargo.toml
third_party/rust/rustc-demangle/src/lib.rs
third_party/rust/safemem/.cargo-checksum.json
third_party/rust/safemem/.idea/runConfigurations/cargo_check.xml
third_party/rust/safemem/Cargo.toml
third_party/rust/safemem/LICENSE-APACHE
third_party/rust/safemem/LICENSE-MIT
third_party/rust/safemem/README.md
third_party/rust/safemem/src/lib.rs
third_party/rust/thread_local-0.3.3/.cargo-checksum.json
third_party/rust/thread_local-0.3.3/.travis.yml
third_party/rust/thread_local-0.3.3/Cargo.toml
third_party/rust/thread_local-0.3.3/LICENSE-APACHE
third_party/rust/thread_local-0.3.3/LICENSE-MIT
third_party/rust/thread_local-0.3.3/README.md
third_party/rust/thread_local-0.3.3/src/lib.rs
third_party/rust/thread_local/.cargo-checksum.json
third_party/rust/thread_local/.travis.yml
third_party/rust/thread_local/Cargo.toml
third_party/rust/thread_local/benches/thread_local.rs
third_party/rust/thread_local/src/lib.rs
third_party/rust/thread_local/src/thread_id.rs
third_party/rust/time-0.1.36/.cargo-checksum.json
third_party/rust/time-0.1.36/.travis.yml
third_party/rust/time-0.1.36/Cargo.toml
third_party/rust/time-0.1.36/LICENSE-APACHE
third_party/rust/time-0.1.36/LICENSE-MIT
third_party/rust/time-0.1.36/README.md
third_party/rust/time-0.1.36/appveyor.yml
third_party/rust/time-0.1.36/benches/precise_time_ns.rs
third_party/rust/time-0.1.36/src/display.rs
third_party/rust/time-0.1.36/src/duration.rs
third_party/rust/time-0.1.36/src/lib.rs
third_party/rust/time-0.1.36/src/parse.rs
third_party/rust/time-0.1.36/src/sys.rs
third_party/rust/time/.cargo-checksum.json
third_party/rust/time/Cargo.toml
third_party/rust/time/src/sys.rs
third_party/rust/unicase-1.4.0/.cargo-checksum.json
third_party/rust/unicase-1.4.0/.travis.yml
third_party/rust/unicase-1.4.0/Cargo.toml
third_party/rust/unicase-1.4.0/LICENSE
third_party/rust/unicase-1.4.0/README.md
third_party/rust/unicase-1.4.0/build.rs
third_party/rust/unicase-1.4.0/src/lib.rs
third_party/rust/unicase/.cargo-checksum.json
third_party/rust/unicase/.travis.yml
third_party/rust/unicase/Cargo.toml
third_party/rust/unicase/build.rs
third_party/rust/unicase/src/lib.rs
third_party/rust/unicode-bidi-0.3.3/.cargo-checksum.json
third_party/rust/unicode-bidi-0.3.3/.rustfmt.toml
third_party/rust/unicode-bidi-0.3.3/.travis.yml
third_party/rust/unicode-bidi-0.3.3/AUTHORS
third_party/rust/unicode-bidi-0.3.3/COPYRIGHT
third_party/rust/unicode-bidi-0.3.3/Cargo.toml
third_party/rust/unicode-bidi-0.3.3/LICENSE-APACHE
third_party/rust/unicode-bidi-0.3.3/LICENSE-MIT
third_party/rust/unicode-bidi-0.3.3/README.md
third_party/rust/unicode-bidi-0.3.3/benches/basic.rs
third_party/rust/unicode-bidi-0.3.3/benches/udhr.rs
third_party/rust/unicode-bidi-0.3.3/benches/udhr_data/README.md
third_party/rust/unicode-bidi-0.3.3/src/char_data/mod.rs
third_party/rust/unicode-bidi-0.3.3/src/char_data/tables.rs
third_party/rust/unicode-bidi-0.3.3/src/deprecated.rs
third_party/rust/unicode-bidi-0.3.3/src/explicit.rs
third_party/rust/unicode-bidi-0.3.3/src/format_chars.rs
third_party/rust/unicode-bidi-0.3.3/src/implicit.rs
third_party/rust/unicode-bidi-0.3.3/src/level.rs
third_party/rust/unicode-bidi-0.3.3/src/lib.rs
third_party/rust/unicode-bidi-0.3.3/src/prepare.rs
third_party/rust/unicode-bidi-0.3.3/tests/conformance_tests.rs
third_party/rust/unicode-bidi-0.3.3/tools/generate.py
third_party/rust/unicode-bidi/.appveyor.yml
third_party/rust/unicode-bidi/.cargo-checksum.json
third_party/rust/unicode-bidi/.travis.yml
third_party/rust/unicode-bidi/Cargo.toml
third_party/rust/unicode-bidi/README.md
third_party/rust/unicode-bidi/benches/basic.rs
third_party/rust/unicode-bidi/benches/udhr.rs
third_party/rust/unicode-bidi/benches/udhr_data/README.md
third_party/rust/unicode-bidi/src/char_data/mod.rs
third_party/rust/unicode-bidi/src/char_data/tables.rs
third_party/rust/unicode-bidi/src/deprecated.rs
third_party/rust/unicode-bidi/src/explicit.rs
third_party/rust/unicode-bidi/src/format_chars.rs
third_party/rust/unicode-bidi/src/implicit.rs
third_party/rust/unicode-bidi/src/level.rs
third_party/rust/unicode-bidi/src/lib.rs
third_party/rust/unicode-bidi/src/prepare.rs
third_party/rust/unicode-bidi/tests/conformance_tests.rs
third_party/rust/unicode-bidi/tools/generate.py
third_party/rust/unreachable-0.1.1/.cargo-checksum.json
third_party/rust/unreachable-0.1.1/.travis.yml
third_party/rust/unreachable-0.1.1/Cargo.toml
third_party/rust/unreachable-0.1.1/README.md
third_party/rust/unreachable-0.1.1/src/lib.rs
third_party/rust/unreachable/.cargo-checksum.json
third_party/rust/unreachable/Cargo.toml
third_party/rust/unreachable/LICENSE-APACHE
third_party/rust/unreachable/LICENSE-MIT
third_party/rust/unreachable/README.md
third_party/rust/version_check/.cargo-checksum.json
third_party/rust/version_check/Cargo.toml
third_party/rust/version_check/LICENSE
third_party/rust/version_check/README.md
third_party/rust/version_check/src/lib.rs
copy from third_party/rust/backtrace/.cargo-checksum.json
copy to third_party/rust/backtrace-0.3.2/.cargo-checksum.json
copy from third_party/rust/backtrace/.travis.yml
copy to third_party/rust/backtrace-0.3.2/.travis.yml
copy from third_party/rust/backtrace/Cargo.toml
copy to third_party/rust/backtrace-0.3.2/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 Alex Crichton
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/README.md
@@ -0,0 +1,82 @@
+# backtrace-rs
+
+[![Build Status](https://travis-ci.org/alexcrichton/backtrace-rs.svg?branch=master)](https://travis-ci.org/alexcrichton/backtrace-rs)
+[![Build status](https://ci.appveyor.com/api/projects/status/v4l9oj4aqbbgyx44?svg=true)](https://ci.appveyor.com/project/alexcrichton/backtrace-rs)
+
+[Documentation](http://alexcrichton.com/backtrace-rs)
+
+A library for acquiring backtraces at runtime for Rust. This library aims to
+enhance the support given by the standard library at `std::rt` by providing a
+more stable and programmatic interface.
+
+## Install
+
+```toml
+[dependencies]
+backtrace = "0.3"
+```
+
+```rust
+extern crate backtrace;
+```
+
+Note that this crate requires `make`, `objcopy`, and `ar` to be present on Linux
+systems.
+
+## Usage
+
+To simply capture a backtrace and defer dealing with it until a later time,
+you can use the top-level `Backtrace` type.
+
+```rust
+extern crate backtrace;
+
+use backtrace::Backtrace;
+
+fn main() {
+    let bt = Backtrace::new();
+
+    // do_some_work();
+
+    println!("{:?}", bt);
+}
+```
+
+If, however, you'd like more raw access to the actual tracing functionality, you
+can use the `trace` and `resolve` functions directly.
+
+```rust
+extern crate backtrace;
+
+fn main() {
+    backtrace::trace(|frame| {
+        let ip = frame.ip();
+        let symbol_address = frame.symbol_address();
+
+        // Resolve this instruction pointer to a symbol name
+        backtrace::resolve(ip, |symbol| {
+            if let Some(name) = symbol.name() {
+                // ...
+            }
+            if let Some(filename) = symbol.filename() {
+                // ...
+            }
+        });
+
+        true // keep going to the next frame
+    });
+}
+```
+
+## Platform Support
+
+This library currently supports OSX, Linux, and Windows. Support for other
+platforms is always welcome!
+
+## License
+
+`backtrace-rs` is primarily distributed under the terms of both the MIT license
+and the Apache License (Version 2.0), with portions covered by various BSD-like
+licenses.
+
+See LICENSE-APACHE, and LICENSE-MIT for details.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/appveyor.yml
@@ -0,0 +1,20 @@
+environment:
+  matrix:
+  - TARGET: x86_64-pc-windows-gnu
+    MSYS_BITS: 64
+  - TARGET: i686-pc-windows-gnu
+    MSYS_BITS: 32
+  - TARGET: x86_64-pc-windows-msvc
+  - TARGET: i686-pc-windows-msvc
+install:
+  - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe"
+  - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
+  - set PATH=%PATH%;C:\Program Files (x86)\Rust\bin
+  - if defined MSYS_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS_BITS%\bin
+  - rustc -V
+  - cargo -V
+
+build: false
+
+test_script:
+  - cargo test --target %TARGET%
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/examples/backtrace.rs
@@ -0,0 +1,7 @@
+extern crate backtrace;
+
+use backtrace::Backtrace;
+
+fn main() {
+    println!("{:?}", Backtrace::new());
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/examples/raw.rs
@@ -0,0 +1,48 @@
+extern crate backtrace;
+
+fn main() {
+    foo();
+}
+
+fn foo() { bar() }
+fn bar() { baz() }
+fn baz() { print() }
+
+#[cfg(target_pointer_width = "32")] const HEX_WIDTH: usize = 10;
+#[cfg(target_pointer_width = "64")] const HEX_WIDTH: usize = 20;
+
+fn print() {
+    let mut cnt = 0;
+    backtrace::trace(|frame| {
+        let ip = frame.ip();
+        print!("frame #{:<2} - {:#02$x}", cnt, ip as usize, HEX_WIDTH);
+        cnt += 1;
+
+        let mut resolved = false;
+        backtrace::resolve(frame.ip(), |symbol| {
+            if !resolved {
+                resolved = true;
+            } else {
+                print!("{}", vec![" "; 7 + 2 + 3 + HEX_WIDTH].join(""));
+            }
+
+            if let Some(name) = symbol.name() {
+                print!(" - {}", name);
+            } else {
+                print!(" - <unknown>");
+            }
+            if let Some(file) = symbol.filename() {
+                if let Some(l) = symbol.lineno() {
+                    print!("\n{:13}{:4$}@ {}:{}", "", "", file.display(), l,
+                           HEX_WIDTH);
+                }
+            }
+            println!("");
+
+        });
+        if !resolved {
+            println!(" - <no info>");
+        }
+        true // keep going
+    });
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/src/backtrace/dbghelp.rs
@@ -0,0 +1,99 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(bad_style)]
+
+use std::mem;
+use winapi::*;
+use kernel32;
+
+pub struct Frame {
+    inner: STACKFRAME64,
+}
+
+impl Frame {
+    pub fn ip(&self) -> *mut c_void {
+        self.inner.AddrPC.Offset as *mut _
+    }
+
+    pub fn symbol_address(&self) -> *mut c_void {
+        self.ip()
+    }
+}
+
+#[inline(always)]
+pub fn trace(cb: &mut FnMut(&super::Frame) -> bool) {
+    // According to windows documentation, all dbghelp functions are
+    // single-threaded.
+    let _g = ::lock::lock();
+
+    unsafe {
+        // Allocate necessary structures for doing the stack walk
+        let process = kernel32::GetCurrentProcess();
+        let thread = kernel32::GetCurrentThread();
+
+        // The CONTEXT structure needs to be aligned on a 16-byte boundary for
+        // 64-bit Windows, but currently we don't have a way to express that in
+        // Rust. Allocations are generally aligned to 16-bytes, though, so we
+        // box this up.
+        let mut context = Box::new(mem::zeroed::<CONTEXT>());
+        kernel32::RtlCaptureContext(&mut *context);
+        let mut frame = super::Frame {
+            inner: Frame { inner: mem::zeroed() },
+        };
+        let image = init_frame(&mut frame.inner.inner, &context);
+
+        // Initialize this process's symbols
+        let _c = ::dbghelp_init();
+
+        // And now that we're done with all the setup, do the stack walking!
+        while ::dbghelp::StackWalk64(image as DWORD,
+                                     process,
+                                     thread,
+                                     &mut frame.inner.inner,
+                                     &mut *context as *mut _ as *mut _,
+                                     None,
+                                     Some(::dbghelp::SymFunctionTableAccess64),
+                                     Some(::dbghelp::SymGetModuleBase64),
+                                     None) == TRUE {
+            if frame.inner.inner.AddrPC.Offset == frame.inner.inner.AddrReturn.Offset ||
+               frame.inner.inner.AddrPC.Offset == 0 ||
+               frame.inner.inner.AddrReturn.Offset == 0 {
+                break
+            }
+
+            if !cb(&frame) {
+                break
+            }
+        }
+    }
+}
+
+#[cfg(target_arch = "x86_64")]
+fn init_frame(frame: &mut STACKFRAME64, ctx: &CONTEXT) -> WORD {
+    frame.AddrPC.Offset = ctx.Rip as u64;
+    frame.AddrPC.Mode = AddrModeFlat;
+    frame.AddrStack.Offset = ctx.Rsp as u64;
+    frame.AddrStack.Mode = AddrModeFlat;
+    frame.AddrFrame.Offset = ctx.Rbp as u64;
+    frame.AddrFrame.Mode = AddrModeFlat;
+    IMAGE_FILE_MACHINE_AMD64
+}
+
+#[cfg(target_arch = "x86")]
+fn init_frame(frame: &mut STACKFRAME64, ctx: &CONTEXT) -> WORD {
+    frame.AddrPC.Offset = ctx.Eip as u64;
+    frame.AddrPC.Mode = AddrModeFlat;
+    frame.AddrStack.Offset = ctx.Esp as u64;
+    frame.AddrStack.Mode = AddrModeFlat;
+    frame.AddrFrame.Offset = ctx.Ebp as u64;
+    frame.AddrFrame.Mode = AddrModeFlat;
+    IMAGE_FILE_MACHINE_I386
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/src/backtrace/libunwind.rs
@@ -0,0 +1,200 @@
+// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::os::raw::c_void;
+
+pub struct Frame {
+    ctx: *mut uw::_Unwind_Context,
+}
+
+impl Frame {
+    pub fn ip(&self) -> *mut c_void {
+        let mut ip_before_insn = 0;
+        let mut ip = unsafe {
+            uw::_Unwind_GetIPInfo(self.ctx, &mut ip_before_insn) as *mut c_void
+        };
+        if !ip.is_null() && ip_before_insn == 0 {
+            // this is a non-signaling frame, so `ip` refers to the address
+            // after the calling instruction. account for that.
+            ip = (ip as usize - 1) as *mut _;
+        }
+        return ip
+    }
+
+    pub fn symbol_address(&self) -> *mut c_void {
+        // dladdr() on osx gets whiny when we use FindEnclosingFunction, and
+        // it appears to work fine without it, so we only use
+        // FindEnclosingFunction on non-osx platforms. In doing so, we get a
+        // slightly more accurate stack trace in the process.
+        //
+        // This is often because panic involves the last instruction of a
+        // function being "call std::rt::begin_unwind", with no ret
+        // instructions after it. This means that the return instruction
+        // pointer points *outside* of the calling function, and by
+        // unwinding it we go back to the original function.
+        if cfg!(target_os = "macos") || cfg!(target_os = "ios") {
+            self.ip()
+        } else {
+            unsafe { uw::_Unwind_FindEnclosingFunction(self.ip()) }
+        }
+    }
+}
+
+#[inline(always)]
+pub fn trace(mut cb: &mut FnMut(&super::Frame) -> bool) {
+    unsafe {
+        uw::_Unwind_Backtrace(trace_fn, &mut cb as *mut _ as *mut _);
+    }
+
+    extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
+                       arg: *mut c_void) -> uw::_Unwind_Reason_Code {
+        let cb = unsafe { &mut *(arg as *mut &mut FnMut(&super::Frame) -> bool) };
+        let cx = super::Frame {
+            inner: Frame { ctx: ctx },
+        };
+
+        let mut bomb = ::Bomb { enabled: true };
+        let keep_going = cb(&cx);
+        bomb.enabled = false;
+
+        if keep_going {
+            uw::_URC_NO_REASON
+        } else {
+            uw::_URC_FAILURE
+        }
+    }
+}
+
+/// Unwind library interface used for backtraces
+///
+/// Note that dead code is allowed as here are just bindings
+/// iOS doesn't use all of them it but adding more
+/// platform-specific configs pollutes the code too much
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[allow(dead_code)]
+mod uw {
+    pub use self::_Unwind_Reason_Code::*;
+
+    use libc;
+    use std::os::raw::{c_int, c_void};
+
+    #[repr(C)]
+    pub enum _Unwind_Reason_Code {
+        _URC_NO_REASON = 0,
+        _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
+        _URC_FATAL_PHASE2_ERROR = 2,
+        _URC_FATAL_PHASE1_ERROR = 3,
+        _URC_NORMAL_STOP = 4,
+        _URC_END_OF_STACK = 5,
+        _URC_HANDLER_FOUND = 6,
+        _URC_INSTALL_CONTEXT = 7,
+        _URC_CONTINUE_UNWIND = 8,
+        _URC_FAILURE = 9, // used only by ARM EABI
+    }
+
+    pub enum _Unwind_Context {}
+
+    pub type _Unwind_Trace_Fn =
+            extern fn(ctx: *mut _Unwind_Context,
+                      arg: *mut c_void) -> _Unwind_Reason_Code;
+
+    extern {
+        // No native _Unwind_Backtrace on iOS
+        #[cfg(not(all(target_os = "ios", target_arch = "arm")))]
+        pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
+                                 trace_argument: *mut c_void)
+                    -> _Unwind_Reason_Code;
+
+        // available since GCC 4.2.0, should be fine for our purpose
+        #[cfg(all(not(all(target_os = "android", target_arch = "arm")),
+                  not(all(target_os = "linux", target_arch = "arm"))))]
+        pub fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context,
+                                 ip_before_insn: *mut c_int)
+                    -> libc::uintptr_t;
+
+        #[cfg(all(not(target_os = "android"),
+                  not(all(target_os = "linux", target_arch = "arm"))))]
+        pub fn _Unwind_FindEnclosingFunction(pc: *mut c_void)
+            -> *mut c_void;
+    }
+
+    // On android, the function _Unwind_GetIP is a macro, and this is the
+    // expansion of the macro. This is all copy/pasted directly from the
+    // header file with the definition of _Unwind_GetIP.
+    #[cfg(any(all(target_os = "android", target_arch = "arm"),
+              all(target_os = "linux", target_arch = "arm")))]
+    pub unsafe fn _Unwind_GetIP(ctx: *mut _Unwind_Context) -> libc::uintptr_t {
+        #[repr(C)]
+        enum _Unwind_VRS_Result {
+            _UVRSR_OK = 0,
+            _UVRSR_NOT_IMPLEMENTED = 1,
+            _UVRSR_FAILED = 2,
+        }
+        #[repr(C)]
+        enum _Unwind_VRS_RegClass {
+            _UVRSC_CORE = 0,
+            _UVRSC_VFP = 1,
+            _UVRSC_FPA = 2,
+            _UVRSC_WMMXD = 3,
+            _UVRSC_WMMXC = 4,
+        }
+        #[repr(C)]
+        enum _Unwind_VRS_DataRepresentation {
+            _UVRSD_UINT32 = 0,
+            _UVRSD_VFPX = 1,
+            _UVRSD_FPAX = 2,
+            _UVRSD_UINT64 = 3,
+            _UVRSD_FLOAT = 4,
+            _UVRSD_DOUBLE = 5,
+        }
+
+        type _Unwind_Word = libc::c_uint;
+        extern {
+            fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context,
+                               klass: _Unwind_VRS_RegClass,
+                               word: _Unwind_Word,
+                               repr: _Unwind_VRS_DataRepresentation,
+                               data: *mut c_void)
+                -> _Unwind_VRS_Result;
+        }
+
+        let mut val: _Unwind_Word = 0;
+        let ptr = &mut val as *mut _Unwind_Word;
+        let _ = _Unwind_VRS_Get(ctx, _Unwind_VRS_RegClass::_UVRSC_CORE, 15,
+                                _Unwind_VRS_DataRepresentation::_UVRSD_UINT32,
+                                ptr as *mut c_void);
+        (val & !1) as libc::uintptr_t
+    }
+
+    // This function doesn't exist on Android or ARM/Linux, so make it same
+    // to _Unwind_GetIP
+    #[cfg(any(all(target_os = "android", target_arch = "arm"),
+              all(target_os = "linux", target_arch = "arm")))]
+    pub unsafe fn _Unwind_GetIPInfo(ctx: *mut _Unwind_Context,
+                                    ip_before_insn: *mut c_int)
+        -> libc::uintptr_t
+    {
+        *ip_before_insn = 0;
+        _Unwind_GetIP(ctx)
+    }
+
+    // This function also doesn't exist on Android or ARM/Linux, so make it
+    // a no-op
+    #[cfg(any(target_os = "android",
+              all(target_os = "linux", target_arch = "arm")))]
+    pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut c_void)
+        -> *mut c_void
+    {
+        pc
+    }
+}
+
+
copy from third_party/rust/backtrace/src/backtrace/mod.rs
copy to third_party/rust/backtrace-0.3.2/src/backtrace/mod.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/src/backtrace/noop.rs
@@ -0,0 +1,16 @@
+use std::os::raw::c_void;
+
+#[inline(always)]
+pub fn trace(_cb: &mut FnMut(&super::Frame) -> bool) {}
+
+pub struct Frame;
+
+impl Frame {
+    pub fn ip(&self) -> *mut c_void {
+        0 as *mut _
+    }
+
+    pub fn symbol_address(&self) -> *mut c_void {
+        0 as *mut _
+    }
+}
copy from third_party/rust/backtrace/src/backtrace/unix_backtrace.rs
copy to third_party/rust/backtrace-0.3.2/src/backtrace/unix_backtrace.rs
copy from third_party/rust/backtrace/src/capture.rs
copy to third_party/rust/backtrace-0.3.2/src/capture.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/src/dylib.rs
@@ -0,0 +1,70 @@
+use std::ffi::CString;
+use std::marker;
+use std::mem;
+use std::sync::atomic::{AtomicUsize, Ordering};
+
+use libc::{self, c_char, c_void};
+
+pub struct Dylib {
+    pub init: AtomicUsize,
+}
+
+pub struct Symbol<T> {
+    pub name: &'static str,
+    pub addr: AtomicUsize,
+    pub _marker: marker::PhantomData<T>,
+}
+
+impl Dylib {
+    pub unsafe fn get<'a, T>(&self, sym: &'a Symbol<T>) -> Option<&'a T> {
+        self.load().and_then(|handle| {
+            sym.get(handle)
+        })
+    }
+
+    pub unsafe fn init(&self, path: &str) -> bool {
+        if self.init.load(Ordering::SeqCst) != 0 {
+            return true
+        }
+        let name = CString::new(path).unwrap();
+        let ptr = libc::dlopen(name.as_ptr() as *const c_char, libc::RTLD_LAZY);
+        if ptr.is_null() {
+            return false
+        }
+        match self.init.compare_and_swap(0, ptr as usize, Ordering::SeqCst) {
+            0 => {}
+            _ => { libc::dlclose(ptr); }
+        }
+        return true
+    }
+
+    unsafe fn load(&self) -> Option<*mut c_void> {
+        match self.init.load(Ordering::SeqCst) {
+            0 => None,
+            n => Some(n as *mut c_void),
+        }
+    }
+}
+
+impl<T> Symbol<T> {
+    unsafe fn get(&self, handle: *mut c_void) -> Option<&T> {
+        assert_eq!(mem::size_of::<T>(), mem::size_of_val(&self.addr));
+        if self.addr.load(Ordering::SeqCst) == 0 {
+            self.addr.store(fetch(handle, self.name.as_ptr()), Ordering::SeqCst)
+        }
+        if self.addr.load(Ordering::SeqCst) == 1 {
+            None
+        } else {
+            mem::transmute::<&AtomicUsize, Option<&T>>(&self.addr)
+        }
+    }
+}
+
+unsafe fn fetch(handle: *mut c_void, name: *const u8) -> usize {
+    let ptr = libc::dlsym(handle, name as *const _);
+    if ptr.is_null() {
+        1
+    } else {
+        ptr as usize
+    }
+}
copy from third_party/rust/backtrace/src/lib.rs
copy to third_party/rust/backtrace-0.3.2/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/src/symbolize/coresymbolication.rs
@@ -0,0 +1,192 @@
+// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(bad_style)]
+
+use std::ffi::{CStr, OsStr};
+use std::mem;
+use std::os::raw::{c_void, c_char, c_int};
+use std::os::unix::prelude::*;
+use std::path::Path;
+use std::ptr;
+use std::sync::atomic::ATOMIC_USIZE_INIT;
+
+use libc::{self, Dl_info};
+
+use SymbolName;
+use dylib::Dylib;
+use dylib::Symbol as DylibSymbol;
+
+#[repr(C)]
+#[derive(Copy, Clone, PartialEq)]
+pub struct CSTypeRef {
+    cpp_data: *const c_void,
+    cpp_obj: *const c_void
+}
+
+const CS_NOW: u64 = 0x80000000;
+const CSREF_NULL: CSTypeRef = CSTypeRef {
+    cpp_data: 0 as *const c_void,
+    cpp_obj: 0 as *const c_void,
+};
+
+pub enum Symbol {
+    Core {
+        path: *const c_char,
+        lineno: u32,
+        name: *const c_char,
+        addr: *mut c_void,
+    },
+    Dladdr(Dl_info),
+}
+
+impl Symbol {
+    pub fn name(&self) -> Option<SymbolName> {
+        let name = match *self {
+            Symbol::Core { name, .. } => name,
+            Symbol::Dladdr(ref info) => info.dli_sname,
+        };
+        if name.is_null() {
+            None
+        } else {
+            Some(SymbolName::new(unsafe {
+                CStr::from_ptr(name).to_bytes()
+            }))
+        }
+    }
+
+    pub fn addr(&self) -> Option<*mut c_void> {
+        match *self {
+            Symbol::Core { addr, .. } => Some(addr),
+            Symbol::Dladdr(ref info) => Some(info.dli_saddr as *mut _),
+        }
+    }
+
+    pub fn filename(&self) -> Option<&Path> {
+        match *self {
+            Symbol::Core { path, .. } => {
+                if path.is_null() {
+                    None
+                } else {
+                    Some(Path::new(OsStr::from_bytes(unsafe {
+                        CStr::from_ptr(path).to_bytes()
+                    })))
+                }
+            }
+            Symbol::Dladdr(_) => None,
+        }
+    }
+
+    pub fn lineno(&self) -> Option<u32> {
+        match *self {
+            Symbol::Core { lineno: 0, .. } => None,
+            Symbol::Core { lineno, .. } => Some(lineno),
+            Symbol::Dladdr(_) => None,
+        }
+    }
+}
+
+static CORESYMBOLICATION: Dylib = Dylib { init: ATOMIC_USIZE_INIT };
+
+macro_rules! dlsym {
+    (extern {
+        $(fn $name:ident($($arg:ident: $t:ty),*) -> $ret:ty;)*
+    }) => ($(
+        static $name: ::dylib::Symbol<unsafe extern fn($($t),*) -> $ret> =
+            ::dylib::Symbol {
+                name: concat!(stringify!($name), "\0"),
+                addr: ::std::sync::atomic::ATOMIC_USIZE_INIT,
+                _marker: ::std::marker::PhantomData,
+            };
+    )*)
+}
+
+dlsym! {
+    extern {
+        fn CSSymbolicatorCreateWithPid(pid: c_int) -> CSTypeRef;
+        fn CSRelease(rf: CSTypeRef) -> c_void;
+        fn CSSymbolicatorGetSymbolWithAddressAtTime(
+            cs: CSTypeRef, addr: *const c_void, time: u64) -> CSTypeRef;
+        fn CSSymbolicatorGetSourceInfoWithAddressAtTime(
+            cs: CSTypeRef, addr: *const c_void, time: u64) -> CSTypeRef;
+        fn CSSourceInfoGetLineNumber(info: CSTypeRef) -> c_int;
+        fn CSSourceInfoGetPath(info: CSTypeRef) -> *const c_char;
+        fn CSSourceInfoGetSymbol(info: CSTypeRef) -> CSTypeRef;
+        fn CSSymbolGetName(sym: CSTypeRef) -> *const c_char;
+        fn CSSymbolGetSymbolOwner(sym: CSTypeRef) -> CSTypeRef;
+        fn CSSymbolOwnerGetBaseAddress(symowner: CSTypeRef) -> *mut c_void;
+    }
+}
+
+unsafe fn get<T>(sym: &DylibSymbol<T>) -> &T {
+    CORESYMBOLICATION.get(sym).unwrap()
+}
+
+unsafe fn try_resolve(addr: *mut c_void, cb: &mut FnMut(&super::Symbol)) -> bool {
+    let path = "/System/Library/PrivateFrameworks/CoreSymbolication.framework\
+                /Versions/A/CoreSymbolication";
+    if !CORESYMBOLICATION.init(path) {
+        return false;
+    }
+
+    let cs = get(&CSSymbolicatorCreateWithPid)(libc::getpid());
+    if cs == CSREF_NULL {
+        return false
+    }
+
+    let info = get(&CSSymbolicatorGetSourceInfoWithAddressAtTime)(
+        cs, addr, CS_NOW);
+    let sym = if info == CSREF_NULL {
+        get(&CSSymbolicatorGetSymbolWithAddressAtTime)(cs, addr, CS_NOW)
+    } else {
+        get(&CSSourceInfoGetSymbol)(info)
+    };
+
+    let mut rv = false;
+    if sym != CSREF_NULL {
+        let owner = get(&CSSymbolGetSymbolOwner)(sym);
+        if owner != CSREF_NULL {
+            cb(&super::Symbol {
+                inner: Symbol::Core {
+                    path: if info != CSREF_NULL {
+                        get(&CSSourceInfoGetPath)(info)
+                    } else {
+                        ptr::null()
+                    },
+                    lineno: if info != CSREF_NULL {
+                        get(&CSSourceInfoGetLineNumber)(info) as u32
+                    } else {
+                        0
+                    },
+                    name: get(&CSSymbolGetName)(sym),
+                    addr: get(&CSSymbolOwnerGetBaseAddress)(owner),
+                },
+            });
+            rv = true;
+        }
+    }
+    get(&CSRelease)(cs);
+
+    rv
+}
+
+pub fn resolve(addr: *mut c_void, cb: &mut FnMut(&super::Symbol)) {
+    unsafe {
+        if try_resolve(addr, cb) {
+            return
+        }
+        let mut info: Dl_info = mem::zeroed();
+        if libc::dladdr(addr as *mut _, &mut info) != 0 {
+            cb(&super::Symbol {
+                inner: Symbol::Dladdr(info),
+            });
+        }
+    }
+}
copy from third_party/rust/backtrace/src/symbolize/dbghelp.rs
copy to third_party/rust/backtrace-0.3.2/src/symbolize/dbghelp.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/src/symbolize/dladdr.rs
@@ -0,0 +1,59 @@
+// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::ffi::CStr;
+use std::mem;
+use std::os::raw::c_void;
+use std::path::Path;
+
+use libc::{self, Dl_info};
+
+use SymbolName;
+
+pub struct Symbol {
+    inner: Dl_info,
+}
+
+impl Symbol {
+    pub fn name(&self) -> Option<SymbolName> {
+        if self.inner.dli_sname.is_null() {
+            None
+        } else {
+            Some(SymbolName::new(unsafe {
+                CStr::from_ptr(self.inner.dli_sname).to_bytes()
+            }))
+        }
+    }
+
+    pub fn addr(&self) -> Option<*mut c_void> {
+        Some(self.inner.dli_saddr as *mut _)
+    }
+
+    pub fn filename(&self) -> Option<&Path> {
+        None
+    }
+
+    pub fn lineno(&self) -> Option<u32> {
+        None
+    }
+}
+
+pub fn resolve(addr: *mut c_void, cb: &mut FnMut(&super::Symbol)) {
+    unsafe {
+        let mut info: super::Symbol = super::Symbol {
+            inner: Symbol {
+                inner: mem::zeroed(),
+            },
+        };
+        if libc::dladdr(addr as *mut _, &mut info.inner.inner) != 0 {
+            cb(&info)
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/src/symbolize/libbacktrace.rs
@@ -0,0 +1,180 @@
+// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(bad_style)]
+
+extern crate backtrace_sys as bt;
+
+use libc::uintptr_t;
+use std::ffi::{CStr, OsStr};
+use std::os::raw::{c_void, c_char, c_int};
+use std::os::unix::prelude::*;
+use std::path::Path;
+use std::ptr;
+use std::sync::{ONCE_INIT, Once};
+
+use SymbolName;
+
+pub enum Symbol {
+    Syminfo {
+        pc: uintptr_t,
+        symname: *const c_char,
+    },
+    Pcinfo {
+        pc: uintptr_t,
+        filename: *const c_char,
+        lineno: c_int,
+        function: *const c_char,
+    },
+}
+
+impl Symbol {
+    pub fn name(&self) -> Option<SymbolName> {
+        let ptr = match *self {
+            Symbol::Syminfo { symname, .. } => symname,
+            Symbol::Pcinfo { function, .. } => function,
+        };
+        if ptr.is_null() {
+            None
+        } else {
+            Some(SymbolName::new(unsafe { CStr::from_ptr(ptr).to_bytes() }))
+        }
+    }
+
+    pub fn addr(&self) -> Option<*mut c_void> {
+        let pc = match *self {
+            Symbol::Syminfo { pc, .. } => pc,
+            Symbol::Pcinfo { pc, .. } => pc,
+        };
+        if pc == 0 {None} else {Some(pc as *mut _)}
+    }
+
+    pub fn filename(&self) -> Option<&Path> {
+        match *self {
+            Symbol::Syminfo { .. } => None,
+            Symbol::Pcinfo { filename, .. } => {
+                Some(Path::new(OsStr::from_bytes(unsafe {
+                    CStr::from_ptr(filename).to_bytes()
+                })))
+            }
+        }
+    }
+
+    pub fn lineno(&self) -> Option<u32> {
+        match *self {
+            Symbol::Syminfo { .. } => None,
+            Symbol::Pcinfo { lineno, .. } => Some(lineno as u32),
+        }
+    }
+}
+
+extern fn error_cb(_data: *mut c_void, _msg: *const c_char,
+                   _errnum: c_int) {
+    // do nothing for now
+}
+
+extern fn syminfo_cb(data: *mut c_void,
+                     pc: uintptr_t,
+                     symname: *const c_char,
+                     _symval: uintptr_t,
+                     _symsize: uintptr_t) {
+    unsafe {
+        call(data, &super::Symbol {
+            inner: Symbol::Syminfo {
+                pc: pc,
+                symname: symname,
+            },
+        });
+    }
+}
+
+extern fn pcinfo_cb(data: *mut c_void,
+                    pc: uintptr_t,
+                    filename: *const c_char,
+                    lineno: c_int,
+                    function: *const c_char) -> c_int {
+    unsafe {
+        if filename.is_null() || function.is_null() {
+            return -1
+        }
+        call(data, &super::Symbol {
+            inner: Symbol::Pcinfo {
+                pc: pc,
+                filename: filename,
+                lineno: lineno,
+                function: function,
+            },
+        });
+        return 0
+    }
+}
+
+unsafe fn call(data: *mut c_void, sym: &super::Symbol) {
+    let cb = data as *mut &mut FnMut(&super::Symbol);
+    let mut bomb = ::Bomb { enabled: true };
+    (*cb)(sym);
+    bomb.enabled = false;
+}
+
+// The libbacktrace API supports creating a state, but it does not
+// support destroying a state. I personally take this to mean that a
+// state is meant to be created and then live forever.
+//
+// I would love to register an at_exit() handler which cleans up this
+// state, but libbacktrace provides no way to do so.
+//
+// With these constraints, this function has a statically cached state
+// that is calculated the first time this is requested. Remember that
+// backtracing all happens serially (one global lock).
+//
+// Things don't work so well on not-Linux since libbacktrace can't track down
+// that executable this is. We at one point used env::current_exe but it turns
+// out that there are some serious security issues with that approach.
+//
+// Specifically, on certain platforms like BSDs, a malicious actor can cause an
+// arbitrary file to be placed at the path returned by current_exe. libbacktrace
+// does not behave defensively in the presence of ill-formed DWARF information,
+// and has been demonstrated to segfault in at least one case. There is no
+// evidence at the moment to suggest that a more carefully constructed file
+// can't cause arbitrary code execution. As a result of all of this, we don't
+// hint libbacktrace with the path to the current process.
+unsafe fn init_state() -> *mut bt::backtrace_state {
+    static mut STATE: *mut bt::backtrace_state = 0 as *mut _;
+    static INIT: Once = ONCE_INIT;
+    INIT.call_once(|| {
+        // Our libbacktrace may not have multithreading support, so
+        // set `threaded = 0` and synchronize ourselves.
+        STATE = bt::backtrace_create_state(ptr::null(), 0, error_cb,
+                                           ptr::null_mut());
+    });
+
+    STATE
+}
+
+pub fn resolve(symaddr: *mut c_void, mut cb: &mut FnMut(&super::Symbol)) {
+    let _guard = ::lock::lock();
+
+    // backtrace errors are currently swept under the rug
+    unsafe {
+        let state = init_state();
+        if state.is_null() {
+            return
+        }
+
+        let ret = bt::backtrace_pcinfo(state, symaddr as uintptr_t,
+                                       pcinfo_cb, error_cb,
+                                       &mut cb as *mut _ as *mut _);
+        if ret != 0 {
+            bt::backtrace_syminfo(state, symaddr as uintptr_t,
+                                  syminfo_cb, error_cb,
+                                  &mut cb as *mut _ as *mut _);
+        }
+    }
+}
copy from third_party/rust/backtrace/src/symbolize/mod.rs
copy to third_party/rust/backtrace-0.3.2/src/symbolize/mod.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-0.3.2/src/symbolize/noop.rs
@@ -0,0 +1,27 @@
+use std::path::Path;
+use std::os::raw::c_void;
+
+use SymbolName;
+
+pub fn resolve(_addr: *mut c_void, _cb: &mut FnMut(&super::Symbol)) {
+}
+
+pub struct Symbol;
+
+impl Symbol {
+    pub fn name(&self) -> Option<SymbolName> {
+        None
+    }
+
+    pub fn addr(&self) -> Option<*mut c_void> {
+        None
+    }
+
+    pub fn filename(&self) -> Option<&Path> {
+        None
+    }
+
+    pub fn lineno(&self) -> Option<u32> {
+        None
+    }
+}
copy from third_party/rust/backtrace/tests/smoke.rs
copy to third_party/rust/backtrace-0.3.2/tests/smoke.rs
copy from third_party/rust/backtrace-sys/.cargo-checksum.json
copy to third_party/rust/backtrace-sys-0.1.10/.cargo-checksum.json
copy from third_party/rust/backtrace-sys/Cargo.toml
copy to third_party/rust/backtrace-sys-0.1.10/Cargo.toml
copy from third_party/rust/backtrace-sys/build.rs
copy to third_party/rust/backtrace-sys-0.1.10/build.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/lib.rs
@@ -0,0 +1,44 @@
+#![allow(bad_style)]
+
+extern crate libc;
+
+use libc::uintptr_t;
+use std::os::raw::{c_void, c_char, c_int};
+
+pub type backtrace_syminfo_callback =
+    extern fn(data: *mut c_void,
+              pc: uintptr_t,
+              symname: *const c_char,
+              symval: uintptr_t,
+              symsize: uintptr_t);
+pub type backtrace_full_callback =
+    extern fn(data: *mut c_void,
+              pc: uintptr_t,
+              filename: *const c_char,
+              lineno: c_int,
+              function: *const c_char) -> c_int;
+pub type backtrace_error_callback =
+    extern fn(data: *mut c_void,
+              msg: *const c_char,
+              errnum: c_int);
+pub enum backtrace_state {}
+
+extern {
+    #[link_name = "__rbt_backtrace_create_state"]
+    pub fn backtrace_create_state(filename: *const c_char,
+                                  threaded: c_int,
+                                  error: backtrace_error_callback,
+                                  data: *mut c_void) -> *mut backtrace_state;
+    #[link_name = "__rbt_backtrace_syminfo"]
+    pub fn backtrace_syminfo(state: *mut backtrace_state,
+                             addr: uintptr_t,
+                             cb: backtrace_syminfo_callback,
+                             error: backtrace_error_callback,
+                             data: *mut c_void) -> c_int;
+    #[link_name = "__rbt_backtrace_pcinfo"]
+    pub fn backtrace_pcinfo(state: *mut backtrace_state,
+                            addr: uintptr_t,
+                            cb: backtrace_full_callback,
+                            error: backtrace_error_callback,
+                            data: *mut c_void) -> c_int;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/ChangeLog
@@ -0,0 +1,598 @@
+2016-11-15  Matthias Klose  <doko@ubuntu.com>
+
+	* configure: Regenerate.
+
+2016-09-11  Carlos Liam  <carlos@aarzee.me>
+
+	* all: Remove meaningless trailing whitespace.
+
+2016-05-18  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/71161
+	* elf.c (phdr_callback) [__i386__]: Add
+	__attribute__((__force_align_arg_pointer__)).
+
+2016-03-02  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>
+
+	* elf.c (backtrace_initialize): Properly initialize elf_fileline_fn to
+	avoid possible crash.
+	(elf_add): Don't set *fileline_fn to elf_nodebug value in case of
+	missing debug info anymore.
+
+2016-02-06  John David Anglin  <danglin@gcc.gnu.org>
+
+	* mmap.c (MAP_FAILED): Define if not defined.
+
+2016-01-04  Jakub Jelinek  <jakub@redhat.com>
+
+	Update copyright years.
+
+2015-12-18  Andris Pavenis  <andris.pavenis@iki.fi>
+
+	* configure.ac: Specify that DJGPP do not have mmap
+	even when sys/mman.h exists.
+	* configure: Regenerate
+
+2015-12-09  John David Anglin  <danglin@gcc.gnu.org>
+
+	PR libgfortran/68115
+	* configure.ac: Set libbacktrace_cv_sys_sync to no on hppa*-*-hpux*.
+	* configure: Regenerate.
+	* elf.c (backtrace_initialize): Cast __sync_bool_compare_and_swap call
+	to void.
+
+2015-09-17  Ian Lance Taylor  <iant@google.com>
+
+	* posix.c (backtrace_open): Cast second argument of open() to int.
+
+2015-09-11  Ian Lance Taylor  <iant@google.com>
+
+	* Makefile.am (backtrace.lo): Depend on internal.h.
+	(sort.lo, stest.lo): Add explicit dependencies.
+	* Makefile.in: Rebuild.
+
+2015-09-09  Hans-Peter Nilsson  <hp@axis.com>
+
+	* backtrace.c: #include <sys/types.h>.
+
+2015-09-08  Ian Lance Taylor  <iant@google.com>
+
+	PR other/67457
+	* backtrace.c: #include "internal.h".
+	(struct backtrace_data): Add can_alloc field.
+	(unwind): If can_alloc is false, don't try to get file/line
+	information.
+	(backtrace_full): Set can_alloc field in bdata.
+	* alloc.c (backtrace_alloc): Don't call error_callback if it is
+	NULL.
+	* mmap.c (backtrace_alloc): Likewise.
+	* internal.h: Update comments for backtrace_alloc and
+	backtrace_free.
+
+2015-09-08  Ian Lance Taylor  <iant@google.com>
+
+	PR other/67457
+	* mmap.c (backtrace_alloc): Correct test for mmap failure.
+
+2015-08-31  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+	* configure.ac: For spu-*-* targets, set have_fcntl to no.
+	* configure: Regenerate.
+
+2015-08-27  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+	* configure.ac: Remove [disable-shared] argument to LT_INIT.
+	Remove setting PIC_FLAG when building as target library.
+	* configure: Regenerate.
+
+2015-08-26  Hans-Peter Nilsson  <hp@axis.com>
+
+	* configure.ac: Only compile with -fPIC if the target
+	supports it.
+	* configure: Regenerate.
+
+2015-08-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+	* configure.ac: Set have_mmap to no on spu-*-* targets.
+	* configure: Regenerate.
+
+2015-08-13  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c (read_function_entry): Add vec_inlined parameter.
+	Change all callers.
+
+2015-06-11  Martin Sebor  <msebor@redhat.com>
+
+	PR sanitizer/65479
+	* dwarf.c (struct line): Add new field idx.
+	(line_compare): Use it.
+	(add_line): Set it.
+	(read_line_info): Reset it.
+
+2015-05-29  Tristan Gingold  <gingold@adacore.com>
+
+	* pecoff.c: New file.
+	* Makefile.am (FORMAT_FILES): Add pecoff.c and dependencies.
+	* Makefile.in: Regenerate.
+	* filetype.awk: Detect pecoff.
+	* configure.ac: Define BACKTRACE_SUPPORTS_DATA on elf platforms.
+	Add pecoff.
+	* btest.c (test5): Test enabled only if BACKTRACE_SUPPORTS_DATA is
+	true.
+	* backtrace-supported.h.in (BACKTRACE_SUPPORTS_DATA): Define.
+	* configure: Regenerate.
+	* pecoff.c: New file.
+
+2015-05-13  Michael Haubenwallner  <michael.haubenwallner@ssi-schaefer.com>
+
+	* Makefile.in: Regenerated with automake-1.11.6.
+	* aclocal.m4: Likewise.
+	* configure: Likewise.
+
+2015-01-24  Matthias Klose  <doko@ubuntu.com>
+
+	* configure.ac: Move AM_ENABLE_MULTILIB before AC_PROG_CC.
+	* configure: Regenerate.
+
+2015-01-05  Jakub Jelinek  <jakub@redhat.com>
+
+	Update copyright years.
+
+2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR bootstrap/63784
+	* configure: Regenerated.
+
+2014-11-11  David Malcolm  <dmalcolm@redhat.com>
+
+	* ChangeLog.jit: New.
+
+2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+	PR target/63610
+	* configure: Regenerate.
+
+2014-10-23  Ian Lance Taylor  <iant@google.com>
+
+	* internal.h (backtrace_atomic_load_pointer) [no atomic or sync]:
+	Fix to return void *.
+
+2014-05-08  Ian Lance Taylor  <iant@google.com>
+
+	* mmap.c (backtrace_free): If freeing a large aligned block of
+	memory, call munmap rather than holding onto it.
+	(backtrace_vector_grow): When growing a vector, double the number
+	of pages requested.  When releasing the old version of a grown
+	vector, pass the correct size to backtrace_free.
+
+2014-03-07  Ian Lance Taylor  <iant@google.com>
+
+	* sort.c (backtrace_qsort): Use middle element as pivot.
+
+2014-03-06  Ian Lance Taylor  <iant@google.com>
+
+	* sort.c: New file.
+	* stest.c: New file.
+	* internal.h (backtrace_qsort): Declare.
+	* dwarf.c (read_abbrevs): Call backtrace_qsort instead of qsort.
+	(read_line_info, read_function_entry): Likewise.
+	(read_function_info, build_dwarf_data): Likewise.
+	* elf.c (elf_initialize_syminfo): Likewise.
+	* Makefile.am (libbacktrace_la_SOURCES): Add sort.c.
+	(stest_SOURCES, stest_LDADD): Define.
+	(check_PROGRAMS): Add stest.
+
+2014-02-07  Misty De Meo  <misty@brew.sh>
+
+	PR target/58710
+	* configure.ac: Use AC_LINK_IFELSE in check for
+	_Unwind_GetIPInfo.
+	* configure: Regenerate.
+
+2014-01-02  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	Update copyright years
+
+2013-12-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf.c (ET_DYN): Undefine and define again.
+	(elf_add): Add exe argument, if true and ehdr.e_type is ET_DYN,
+	return early -1 without closing the descriptor.
+	(struct phdr_data): Add exe_descriptor.
+	(phdr_callback): If pd->exe_descriptor is not -1, for very first
+	call if dlpi_name is NULL just call elf_add with the exe_descriptor,
+	otherwise backtrace_close the exe_descriptor if not -1.  Adjust
+	call to elf_add.
+	(backtrace_initialize): Adjust call to elf_add.  If it returns
+	-1, set pd.exe_descriptor to descriptor, otherwise set it to -1.
+
+2013-12-05  Ian Lance Taylor  <iant@google.com>
+
+	* alloc.c (backtrace_vector_finish): Add error_callback and data
+	parameters.  Call backtrace_vector_release.  Return address base.
+	* mmap.c (backtrace_vector_finish): Add error_callback and data
+	parameters.  Return address base.
+	* dwarf.c (read_function_info): Get new address base from
+	backtrace_vector_finish.
+	* internal.h (backtrace_vector_finish): Update declaration.
+
+2013-11-27  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c (find_address_ranges): New static function, broken out
+	of build_address_map.
+	(build_address_map): Call it.
+	* btest.c (check): Check for missing filename or function, rather
+	than crashing.
+	(f3): Check that enough frames were returned.
+
+2013-11-19  Jakub Jelinek  <jakub@redhat.com>
+
+	* backtrace.h (backtrace_syminfo_callback): Add symsize argument.
+	* elf.c (elf_syminfo): Pass 0 or sym->size to the callback as
+	last argument.
+	* btest.c (struct symdata): Add size field.
+	(callback_three): Add symsize argument.  Copy it to the data->size
+	field.
+	(f23): Set symdata.size to 0.
+	(test5): Likewise.  If sizeof (int) > 1, lookup address of
+	((uintptr_t) &global) + 1.  Verify symdata.val and symdata.size
+	values.
+
+	* atomic.c: Include sys/types.h.
+
+2013-11-18  Ian Lance Taylor  <iant@google.com>
+
+	* configure.ac: Check for support of __atomic extensions.
+	* internal.h: Declare or #define atomic functions for use in
+	backtrace code.
+	* atomic.c: New file.
+	* dwarf.c (dwarf_lookup_pc): Use atomic functions.
+	(dwarf_fileline, backtrace_dwarf_add): Likewise.
+	* elf.c (elf_add_syminfo_data, elf_syminfo): Likewise.
+	(backtrace_initialize): Likewise.
+	* fileline.c (fileline_initialize): Likewise.
+	* Makefile.am (libbacktrace_la_SOURCES): Add atomic.c.
+	* configure, config.h.in, Makefile.in: Rebuild.
+
+2013-11-18  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf.c (SHN_UNDEF): Define.
+	(elf_initialize_syminfo): Add base_address argument.  Ignore symbols
+	with st_shndx == SHN_UNDEF.  Add base_address to address fields.
+	(elf_add): Adjust caller.
+
+	* elf.c (phdr_callback): Process info->dlpi_addr == 0 normally.
+
+2013-11-16  Ian Lance Taylor  <iant@google.com>
+
+	* backtrace.h (backtrace_create_state): Correct comment about
+	threading.
+
+2013-11-15  Ian Lance Taylor  <iant@google.com>
+
+	* backtrace.h (backtrace_syminfo): Update comment and parameter
+	name to take any address, not just a PC value.
+	* elf.c (STT_OBJECT): Define.
+	(elf_nosyms): Rename parameter pc to addr.
+	(elf_symbol_search): Rename local variable pc to addr.
+	(elf_initialize_syminfo): Add STT_OBJECT symbols to elf_symbols.
+	(elf_syminfo): Rename parameter pc to addr.
+	* btest.c (global): New global variable.
+	(test5): New test.
+	(main): Call test5.
+
+2013-10-17  Ian Lance Taylor  <iant@google.com>
+
+	* elf.c (elf_add): Don't get the wrong offsets if a debug section
+	is missing.
+
+2013-10-15  David Malcolm  <dmalcolm@redhat.com>
+
+	* configure.ac: Add --enable-host-shared, setting up
+	pre-existing PIC_FLAG variable within Makefile.am et al.
+	* configure: Regenerate.
+
+2013-09-20  Alan Modra  <amodra@gmail.com>
+
+	* configure: Regenerate.
+
+2013-07-23  Alexander Monakov  <amonakov@ispras.ru>
+
+	* elf.c (elf_syminfo): Loop over the elf_syminfo_data chain.
+
+2013-07-23  Alexander Monakov  <amonakov@ispras.ru>
+
+	* elf.c (backtrace_initialize): Pass elf_fileline_fn to
+	dl_iterate_phdr callbacks.
+
+2013-03-25  Ian Lance Taylor  <iant@google.com>
+
+	* alloc.c: #include <sys/types.h>.
+	* mmap.c: Likewise.
+
+2013-01-31  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c (read_function_info): Permit fvec parameter to be NULL.
+	(dwarf_lookup_pc): Don't use ddata->fvec if threaded.
+
+2013-01-25  Jakub Jelinek  <jakub@redhat.com>
+
+	PR other/56076
+	* dwarf.c (read_line_header): Don't crash if DW_AT_comp_dir
+	attribute was not seen.
+
+2013-01-16  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c (struct unit): Add filename and abs_filename fields.
+	(build_address_map): Set new fields when reading unit.
+	(dwarf_lookup_pc): If we don't find an entry in the line table,
+	just return the main file name.
+
+2013-01-14  Richard Sandiford  <rdsandiford@googlemail.com>
+
+	Update copyright years.
+
+2013-01-01  Ian Lance Taylor  <iant@google.com>
+
+	PR bootstrap/54834
+	* Makefile.am (AM_CPPFLAGS): Remove -I ../gcc/include and -I
+	$(MULTIBUILDTOP)/../../gcc/include.
+	* Makefile.in: Rebuild.
+
+2013-01-01  Ian Lance Taylor  <iant@google.com>
+
+	PR other/55536
+	* mmap.c (backtrace_alloc): Don't call sync functions if not
+	threaded.
+	(backtrace_free): Likewise.
+
+2012-12-12  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+	* mmapio.c: Define MAP_FAILED if not defined.
+
+2012-12-11  Jakub Jelinek  <jakub@redhat.com>
+
+	PR bootstrap/54926
+	* Makefile.am (AM_CFLAGS): Remove -frandom-seed=$@.
+	* configure.ac: If --with-target-subdir, add -frandom-seed=$@
+	to EXTRA_FLAGS unconditionally, otherwise check whether the compiler
+	accepts it.
+	* Makefile.in: Regenerated.
+	* configure: Regenerated.
+
+2012-12-07  Jakub Jelinek  <jakub@redhat.com>
+
+	PR bootstrap/54926
+	* Makefile.am (AM_CFLAGS): Add -frandom-seed=$@.
+	* Makefile.in: Regenerated.
+
+2012-11-20  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c (read_attribute): Always clear val.
+
+2012-11-13  Ian Lance Taylor  <iant@google.com>
+
+	PR other/55312
+	* configure.ac: Only add -Werror if building a target library.
+	* configure: Rebuild.
+
+2012-11-12  Ian Lance Taylor  <iant@google.com>
+	    Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+	    Gerald Pfeifer  <gerald@pfeifer.com>
+
+	* configure.ac: Check for getexecname.
+	* fileline.c: #include <errno.h>.  Define getexecname if not
+	available.
+	(fileline_initialize): Try to find the executable in a few
+	different ways.
+	* print.c (error_callback): Only print the filename if it came
+	from the backtrace state.
+	* configure, config.h.in: Rebuild.
+
+2012-10-29  Ian Lance Taylor  <iant@google.com>
+
+	* mmap.c (backtrace_vector_release): Correct last patch: add
+	aligned, not size.
+
+2012-10-29  Ian Lance Taylor  <iant@google.com>
+
+	* mmap.c (backtrace_vector_release): Make sure freed block is
+	aligned on 8-byte boundary.
+
+2012-10-26  Ian Lance Taylor  <iant@google.com>
+
+	PR other/55087
+	* posix.c (backtrace_open): Add does_not_exist parameter.
+	* elf.c (phdr_callback): Do not warn if shared library could not
+	be opened.
+	* fileline.c (fileline_initialize): Update calls to
+	backtrace_open.
+	* internal.h (backtrace_open): Update declaration.
+
+2012-10-26  Jack Howarth  <howarth@bromo.med.uc.edu>
+
+	PR target/55061
+	* configure.ac: Check for _Unwind_GetIPInfo function declaration.
+	* configure: Regenerate.
+
+2012-10-24  Ian Lance Taylor  <iant@google.com>
+
+	PR target/55061
+	* configure.ac: Check whether -funwind-tables option works.
+	* configure: Rebuild.
+
+2012-10-11  Ian Lance Taylor  <iant@google.com>
+
+	* configure.ac: Do not use dl_iterate_phdr on Solaris 10.
+	* configure: Rebuild.
+
+2012-10-10  Ian Lance Taylor  <iant@google.com>
+
+	* elf.c: Rename all Elf typedefs to start with b_elf, and be all
+	lower case.
+
+2012-10-10  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* elf.c (elf_add_syminfo_data): Add casts to avoid warning.
+
+2012-10-09  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c (dwarf_fileline): Add cast to avoid warning.
+	(backtrace_dwarf_add): Likewise.
+
+2012-10-09  Ian Lance Taylor  <iant@google.com>
+
+	Add support for tracing through shared libraries.
+	* configure.ac: Check for link.h and dl_iterate_phdr.
+	* elf.c: #include <link.h> if system has dl_iterate_phdr.  #undef
+	ELF macros before #defining them.
+	(dl_phdr_info, dl_iterate_phdr): Define if system does not have
+	dl_iterate_phdr.
+	(struct elf_syminfo_data): Add next field.
+	(elf_initialize_syminfo): Initialize next field.
+	(elf_add_syminfo_data): New static function.
+	(elf_add): New static function, broken out of
+	backtrace_initialize.  Call backtrace_dwarf_add instead of
+	backtrace_dwarf_initialize.
+	(struct phdr_data): Define.
+	(phdr_callback): New static function.
+	(backtrace_initialize): Call elf_add.
+	* dwarf.c (struct dwarf_data): Add next and base_address fields.
+	(add_unit_addr): Add base_address parameter.  Change all callers.
+	(add_unit_ranges, build_address_map): Likewise.
+	(add_line): Add ddata parameter.  Change all callers.
+	(read_line_program, add_function_range): Likewise.
+	(dwarf_lookup_pc): New static function, broken out of
+	dwarf_fileline.
+	(dwarf_fileline): Call dwarf_lookup_pc.
+	(build_dwarf_data): New static function.
+	(backtrace_dwarf_add): New function.
+	(backtrace_dwarf_initialize): Remove.
+	* internal.h (backtrace_dwarf_initialize): Don't declare.
+	(backtrace_dwarf_add): Declare.
+	* configure, config.h.in: Rebuild.
+
+2012-10-04  Gerald Pfeifer  <gerald@pfeifer.com>
+
+	* btest.c (f23): Avoid uninitialized variable warning.
+
+2012-10-04  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c: If the system header files do not declare strnlen,
+	provide our own version.
+
+2012-10-03  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c (read_uleb128): Fix overflow test.
+	(read_sleb128): Likewise.
+	(build_address_map): Don't change unit_buf.start.
+
+2012-10-02  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR other/54761
+	* configure.ac (EXTRA_FLAGS): New.
+	* Makefile.am (AM_FLAGS): Add $(EXTRA_FLAGS).
+	* configure, Makefile.in: Regenerate.
+
+2012-09-29  Ian Lance Taylor  <iant@google.com>
+
+	PR other/54749
+	* fileline.c (fileline_initialize): Pass errnum as -1 when
+	reporting that we could not read executable information after a
+	previous failure.
+
+2012-09-27  Ian Lance Taylor  <iant@google.com>
+
+	PR bootstrap/54732
+	* configure.ac: Add no-dependencies to AM_INIT_AUTOMAKE.
+	* Makefile.am: Add dependencies for all objects.
+	* configure, aclocal.m4, Makefile.in: Rebuild.
+
+2012-09-27  Ian Lance Taylor  <iant@google.com>
+
+	PR other/54726
+	* elf.c (backtrace_initialize): Set *fileln_fn, not
+	state->fileln_fn.
+
+2012-09-19  Ian Lance Taylor  <iant@google.com>
+
+	* configure.ac: Only use GCC_CHECK_UNWIND_GETIPINFO when compiled
+	as a target library.
+	* configure: Rebuild.
+
+2012-09-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+	    Ian Lance Taylor  <iant@google.com>
+
+        * configure.ac (GCC_HEADER_STDINT): Invoke.
+        * backtrace.h: If we can't find <stdint.h>, use "gstdint.h".
+        * btest.c: Don't include <stdint.h>.
+        * dwarf.c: Likewise.
+        * configure, aclocal.m4, Makefile.in, config.h.in: Rebuild.
+
+2012-09-18  Ian Lance Taylor  <iant@google.com>
+
+	PR bootstrap/54623
+	* Makefile.am (AM_CPPFLAGS): Define.
+	(AM_CFLAGS): Remove -I options.
+	* Makefile.in: Rebuild.
+
+2012-09-18  Ian Lance Taylor  <iant@google.com>
+
+	* posix.c (O_BINARY): Define if not defined.
+	(backtrace_open): Pass O_BINARY to open.  Only call fcntl if
+	HAVE_FCNTL is defined.
+	* configure.ac: Test for the fcntl function.
+	* configure, config.h.in: Rebuild.
+
+2012-09-18  Ian Lance Taylor  <iant@google.com>
+
+	* btest.c (test1, test2, test3, test4): Add the unused attribute.
+
+2012-09-18  Ian Lance Taylor  <iant@google.com>
+
+	* dwarf.c: Correct test of HAVE_DECL_STRNLEN.
+
+2012-09-18  Ian Lance Taylor  <iant@google.com>
+
+	* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS.
+	* mmapio.c: Don't define _GNU_SOURCE.
+	* configure, config.h.in: Rebuild.
+
+2012-09-18  Ian Lance Taylor  <iant@google.com>
+
+	* configure.ac: Check whether strnlen is declared.
+	* dwarf.c: Declare strnlen if not declared.
+	* configure, config.h.in: Rebuild.
+
+2012-09-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	* fileline.c: Include <stdlib.h>.
+	* mmap.c: Likewise.
+
+2012-09-17  Ian Lance Taylor  <iant@google.com>
+
+	PR bootstrap/54611
+	* nounwind.c (backtrace_full): Rename from backtrace.  Add state
+	parameter.
+
+2012-09-17  Gerald Pfeifer  <gerald@pfeifer.com>
+
+	PR bootstrap/54611
+	* nounwind.c (backtrace_simple): Add state parameter.
+
+2012-09-17  Ian Lance Taylor  <iant@google.com>
+
+	PR bootstrap/54609
+	* unknown.c (unknown_fileline): Add state parameter, remove
+	fileline_data parameter, name error_callback parameter.
+	(backtrace_initialize): Add state parameter.
+
+2012-09-17  Ian Lance Taylor  <iant@google.com>
+
+	* Initial implementation.
+
+Copyright (C) 2012-2016 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/ChangeLog.jit
@@ -0,0 +1,14 @@
+2014-09-24  David Malcolm  <dmalcolm@redhat.com>
+
+	* ChangeLog.jit: Add copyright footer.
+
+2013-10-03  David Malcolm  <dmalcolm@redhat.com>
+
+	* configure.ac: Add --enable-host-shared.
+	* configure: Regenerate.
+
+Copyright (C) 2013-2014 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/Makefile.am
@@ -0,0 +1,136 @@
+# Makefile.am -- Backtrace Makefile.
+# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+
+#     (1) Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+
+#     (2) Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+
+#     (3) The name of the author may not be used to
+#     endorse or promote products derived from this software without
+#     specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+ACLOCAL_AMFLAGS = -I .. -I ../config
+
+AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
+	-I ../libgcc
+
+AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
+
+noinst_LTLIBRARIES = libbacktrace.la
+
+libbacktrace_la_SOURCES = \
+	backtrace.h \
+	atomic.c \
+	dwarf.c \
+	fileline.c \
+	internal.h \
+	posix.c \
+	print.c \
+	sort.c \
+	state.c
+
+BACKTRACE_FILES = \
+	backtrace.c \
+	simple.c \
+	nounwind.c
+
+FORMAT_FILES = \
+	elf.c \
+	pecoff.c \
+	unknown.c
+
+VIEW_FILES = \
+	read.c \
+	mmapio.c
+
+ALLOC_FILES = \
+	alloc.c \
+	mmap.c
+
+EXTRA_libbacktrace_la_SOURCES = \
+	$(BACKTRACE_FILES) \
+	$(FORMAT_FILES) \
+	$(VIEW_FILES) \
+	$(ALLOC_FILES)
+
+libbacktrace_la_LIBADD = \
+	$(BACKTRACE_FILE) \
+	$(FORMAT_FILE) \
+	$(VIEW_FILE) \
+	$(ALLOC_FILE)
+
+libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
+
+# Testsuite.
+
+check_PROGRAMS =
+
+TESTS = $(check_PROGRAMS)
+
+if NATIVE
+
+btest_SOURCES = btest.c
+btest_CFLAGS = $(AM_CFLAGS) -g -O
+btest_LDADD = libbacktrace.la
+
+check_PROGRAMS += btest
+
+stest_SOURCES = stest.c
+stest_LDADD = libbacktrace.la
+
+check_PROGRAMS += stest
+
+endif NATIVE
+
+# We can't use automake's automatic dependency tracking, because it
+# breaks when using bootstrap-lean.  Automatic dependency tracking
+# with GCC bootstrap will cause some of the objects to depend on
+# header files in prev-gcc/include, e.g., stddef.h and stdarg.h.  When
+# using bootstrap-lean, prev-gcc is removed after each stage.  When
+# running "make install", those header files will be gone, causing the
+# library to be rebuilt at install time.  That may not succeed.
+
+# These manual dependencies do not include dependencies on unwind.h,
+# even though that is part of GCC, because where to find it depends on
+# whether we are being built as a host library or a target library.
+
+INCDIR = $(top_srcdir)/../include
+alloc.lo: config.h backtrace.h internal.h
+backtrace.lo: config.h backtrace.h internal.h
+btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h
+dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \
+	$(INCDIR)/filenames.h backtrace.h internal.h
+elf.lo: config.h backtrace.h internal.h
+fileline.lo: config.h backtrace.h internal.h
+mmap.lo: config.h backtrace.h internal.h
+mmapio.lo: config.h backtrace.h internal.h
+nounwind.lo: config.h internal.h
+pecoff.lo: config.h backtrace.h internal.h
+posix.lo: config.h backtrace.h internal.h
+print.lo: config.h backtrace.h internal.h
+read.lo: config.h backtrace.h internal.h
+simple.lo: config.h backtrace.h internal.h
+sort.lo: config.h backtrace.h internal.h
+stest.lo: config.h backtrace.h internal.h
+state.lo: config.h backtrace.h backtrace-supported.h internal.h
+unknown.lo: config.h backtrace.h internal.h
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/Makefile.in
@@ -0,0 +1,770 @@
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Makefile.am -- Backtrace Makefile.
+# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+
+#     (1) Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+
+#     (2) Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+
+#     (3) The name of the author may not be used to
+#     endorse or promote products derived from this software without
+#     specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+check_PROGRAMS = $(am__EXEEXT_1)
+@NATIVE_TRUE@am__append_1 = btest stest
+subdir = .
+DIST_COMMON = README ChangeLog $(srcdir)/Makefile.in \
+	$(srcdir)/Makefile.am $(top_srcdir)/configure \
+	$(am__configure_deps) $(srcdir)/config.h.in \
+	$(srcdir)/../mkinstalldirs $(srcdir)/backtrace-supported.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/lead-dot.m4 \
+	$(top_srcdir)/../config/multi.m4 \
+	$(top_srcdir)/../config/override.m4 \
+	$(top_srcdir)/../config/stdint.m4 \
+	$(top_srcdir)/../config/unwind_ipinfo.m4 \
+	$(top_srcdir)/../config/warnings.m4 \
+	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+	$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+	$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = backtrace-supported.h
+CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+am_libbacktrace_la_OBJECTS = atomic.lo dwarf.lo fileline.lo posix.lo \
+	print.lo sort.lo state.lo
+libbacktrace_la_OBJECTS = $(am_libbacktrace_la_OBJECTS)
+@NATIVE_TRUE@am__EXEEXT_1 = btest$(EXEEXT) stest$(EXEEXT)
+@NATIVE_TRUE@am_btest_OBJECTS = btest-btest.$(OBJEXT)
+btest_OBJECTS = $(am_btest_OBJECTS)
+@NATIVE_TRUE@btest_DEPENDENCIES = libbacktrace.la
+btest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(btest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+@NATIVE_TRUE@am_stest_OBJECTS = stest.$(OBJEXT)
+stest_OBJECTS = $(am_stest_OBJECTS)
+@NATIVE_TRUE@stest_DEPENDENCIES = libbacktrace.la
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \
+	$(btest_SOURCES) $(stest_SOURCES)
+MULTISRCTOP = 
+MULTIBUILDTOP = 
+MULTIDIRS = 
+MULTISUBDIR = 
+MULTIDO = true
+MULTICLEAN = true
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+ACLOCAL = @ACLOCAL@
+ALLOC_FILE = @ALLOC_FILE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BACKTRACE_FILE = @BACKTRACE_FILE@
+BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@
+BACKTRACE_SUPPORTS_DATA = @BACKTRACE_SUPPORTS_DATA@
+BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@
+BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXTRA_FLAGS = @EXTRA_FLAGS@
+FGREP = @FGREP@
+FORMAT_FILE = @FORMAT_FILE@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PIC_FLAG = @PIC_FLAG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+VIEW_FILE = @VIEW_FILE@
+WARN_FLAGS = @WARN_FLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+ACLOCAL_AMFLAGS = -I .. -I ../config
+AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
+	-I ../libgcc
+
+AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
+noinst_LTLIBRARIES = libbacktrace.la
+libbacktrace_la_SOURCES = \
+	backtrace.h \
+	atomic.c \
+	dwarf.c \
+	fileline.c \
+	internal.h \
+	posix.c \
+	print.c \
+	sort.c \
+	state.c
+
+BACKTRACE_FILES = \
+	backtrace.c \
+	simple.c \
+	nounwind.c
+
+FORMAT_FILES = \
+	elf.c \
+	pecoff.c \
+	unknown.c
+
+VIEW_FILES = \
+	read.c \
+	mmapio.c
+
+ALLOC_FILES = \
+	alloc.c \
+	mmap.c
+
+EXTRA_libbacktrace_la_SOURCES = \
+	$(BACKTRACE_FILES) \
+	$(FORMAT_FILES) \
+	$(VIEW_FILES) \
+	$(ALLOC_FILES)
+
+libbacktrace_la_LIBADD = \
+	$(BACKTRACE_FILE) \
+	$(FORMAT_FILE) \
+	$(VIEW_FILE) \
+	$(ALLOC_FILE)
+
+libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
+TESTS = $(check_PROGRAMS)
+@NATIVE_TRUE@btest_SOURCES = btest.c
+@NATIVE_TRUE@btest_CFLAGS = $(AM_CFLAGS) -g -O
+@NATIVE_TRUE@btest_LDADD = libbacktrace.la
+@NATIVE_TRUE@stest_SOURCES = stest.c
+@NATIVE_TRUE@stest_LDADD = libbacktrace.la
+
+# We can't use automake's automatic dependency tracking, because it
+# breaks when using bootstrap-lean.  Automatic dependency tracking
+# with GCC bootstrap will cause some of the objects to depend on
+# header files in prev-gcc/include, e.g., stddef.h and stdarg.h.  When
+# using bootstrap-lean, prev-gcc is removed after each stage.  When
+# running "make install", those header files will be gone, causing the
+# library to be rebuilt at install time.  That may not succeed.
+
+# These manual dependencies do not include dependencies on unwind.h,
+# even though that is part of GCC, because where to find it depends on
+# whether we are being built as a host library or a target library.
+INCDIR = $(top_srcdir)/../include
+all: config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+am--refresh: Makefile
+	@:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign --ignore-deps'; \
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign --ignore-deps \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign --ignore-deps Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	$(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+	@if test ! -f $@; then rm -f stamp-h1; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+	rm -f stamp-h1
+	touch $@
+
+distclean-hdr:
+	-rm -f config.h stamp-h1
+backtrace-supported.h: $(top_builddir)/config.status $(srcdir)/backtrace-supported.h.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) $(EXTRA_libbacktrace_la_DEPENDENCIES) 
+	$(LINK)  $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) $(EXTRA_btest_DEPENDENCIES) 
+	@rm -f btest$(EXEEXT)
+	$(btest_LINK) $(btest_OBJECTS) $(btest_LDADD) $(LIBS)
+stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES) $(EXTRA_stest_DEPENDENCIES) 
+	@rm -f stest$(EXEEXT)
+	$(LINK) $(stest_OBJECTS) $(stest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+.c.o:
+	$(COMPILE) -c $<
+
+.c.obj:
+	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+	$(LTCOMPILE) -c -o $@ $<
+
+btest-btest.o: btest.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-btest.o `test -f 'btest.c' || echo '$(srcdir)/'`btest.c
+
+btest-btest.obj: btest.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-btest.obj `if test -f 'btest.c'; then $(CYGPATH_W) 'btest.c'; else $(CYGPATH_W) '$(srcdir)/btest.c'; fi`
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool config.lt
+
+# GNU Make needs to see an explicit $(MAKE) variable in the command it
+# runs to enable its job server during parallel builds.  Hence the
+# comments below.
+all-multi:
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
+install-multi:
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
+
+mostlyclean-multi:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
+clean-multi:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
+distclean-multi:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
+maintainer-clean-multi:
+	$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
+	srcdir=$(srcdir); export srcdir; \
+	list=' $(TESTS) '; \
+	$(am__tty_colors); \
+	if test -n "$$list"; then \
+	  for tst in $$list; do \
+	    if test -f ./$$tst; then dir=./; \
+	    elif test -f $$tst; then dir=; \
+	    else dir="$(srcdir)/"; fi; \
+	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *[\ \	]$$tst[\ \	]*) \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		col=$$red; res=XPASS; \
+	      ;; \
+	      *) \
+		col=$$grn; res=PASS; \
+	      ;; \
+	      esac; \
+	    elif test $$? -ne 77; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *[\ \	]$$tst[\ \	]*) \
+		xfail=`expr $$xfail + 1`; \
+		col=$$lgn; res=XFAIL; \
+	      ;; \
+	      *) \
+		failed=`expr $$failed + 1`; \
+		col=$$red; res=FAIL; \
+	      ;; \
+	      esac; \
+	    else \
+	      skip=`expr $$skip + 1`; \
+	      col=$$blu; res=SKIP; \
+	    fi; \
+	    echo "$${col}$$res$${std}: $$tst"; \
+	  done; \
+	  if test "$$all" -eq 1; then \
+	    tests="test"; \
+	    All=""; \
+	  else \
+	    tests="tests"; \
+	    All="All "; \
+	  fi; \
+	  if test "$$failed" -eq 0; then \
+	    if test "$$xfail" -eq 0; then \
+	      banner="$$All$$all $$tests passed"; \
+	    else \
+	      if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+	      banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+	    fi; \
+	  else \
+	    if test "$$xpass" -eq 0; then \
+	      banner="$$failed of $$all $$tests failed"; \
+	    else \
+	      if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+	      banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+	    fi; \
+	  fi; \
+	  dashes="$$banner"; \
+	  skipped=""; \
+	  if test "$$skip" -ne 0; then \
+	    if test "$$skip" -eq 1; then \
+	      skipped="($$skip test was not run)"; \
+	    else \
+	      skipped="($$skip tests were not run)"; \
+	    fi; \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$skipped"; \
+	  fi; \
+	  report=""; \
+	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+	    report="Please report to $(PACKAGE_BUGREPORT)"; \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$report"; \
+	  fi; \
+	  dashes=`echo "$$dashes" | sed s/./=/g`; \
+	  if test "$$failed" -eq 0; then \
+	    col="$$grn"; \
+	  else \
+	    col="$$red"; \
+	  fi; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  test "$$failed" -eq 0; \
+	else :; fi
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(LTLIBRARIES) all-multi config.h
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am clean-multi
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am distclean-multi
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-hdr distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-multi
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am maintainer-clean-multi
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am mostlyclean-multi
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all all-multi check-am clean-multi distclean-multi install-am \
+	install-multi install-strip maintainer-clean-multi \
+	mostlyclean-multi
+
+.PHONY: CTAGS GTAGS all all-am all-multi am--refresh check check-TESTS \
+	check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-multi clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-hdr \
+	distclean-libtool distclean-multi distclean-tags dvi dvi-am \
+	html html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-multi install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic maintainer-clean-multi mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-multi pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am
+
+alloc.lo: config.h backtrace.h internal.h
+backtrace.lo: config.h backtrace.h internal.h
+btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h
+dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \
+	$(INCDIR)/filenames.h backtrace.h internal.h
+elf.lo: config.h backtrace.h internal.h
+fileline.lo: config.h backtrace.h internal.h
+mmap.lo: config.h backtrace.h internal.h
+mmapio.lo: config.h backtrace.h internal.h
+nounwind.lo: config.h internal.h
+pecoff.lo: config.h backtrace.h internal.h
+posix.lo: config.h backtrace.h internal.h
+print.lo: config.h backtrace.h internal.h
+read.lo: config.h backtrace.h internal.h
+simple.lo: config.h backtrace.h internal.h
+sort.lo: config.h backtrace.h internal.h
+stest.lo: config.h backtrace.h internal.h
+state.lo: config.h backtrace.h backtrace-supported.h internal.h
+unknown.lo: config.h backtrace.h internal.h
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/README
@@ -0,0 +1,23 @@
+The libbacktrace library
+Initially written by Ian Lance Taylor <iant@google.com>
+
+The libbacktrace library may be linked into a program or library and
+used to produce symbolic backtraces.  Sample uses would be to print a
+detailed backtrace when an error occurs or to gather detailed
+profiling information.
+
+The libbacktrace library is provided under a BSD license.  See the
+source files for the exact license text.
+
+The public functions are declared and documented in the header file
+backtrace.h, which should be #include'd by a user of the library.
+
+Building libbacktrace will generate a file backtrace-supported.h,
+which a user of the library may use to determine whether backtraces
+will work.  See the source file backtrace-supported.h.in for the
+macros that it defines.
+
+As of September 2012, libbacktrace only supports ELF executables with
+DWARF debugging information.  The library is written to make it
+straightforward to add support for other object file and debugging
+formats.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/aclocal.m4
@@ -0,0 +1,683 @@
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
+[m4_warning([this file was generated for autoconf 2.64.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.11.6], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+			     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+		  [_AM_DEPENDENCIES(CC)],
+		  [define([AC_PROG_CC],
+			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+		  [_AM_DEPENDENCIES(CXX)],
+		  [define([AC_PROG_CXX],
+			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+		  [_AM_DEPENDENCIES(OBJC)],
+		  [define([AC_PROG_OBJC],
+			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+AC_SUBST(install_sh)])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
+# 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well.  Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+       [enable], [m4_define([am_maintainer_other], [disable])],
+       [disable], [m4_define([am_maintainer_other], [enable])],
+       [m4_define([am_maintainer_other], [enable])
+        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+  AC_ARG_ENABLE([maintainer-mode],
+[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer],
+      [USE_MAINTAINER_MODE=$enableval],
+      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
+    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+m4_if([$1], [v7],
+     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([../config/lead-dot.m4])
+m4_include([../config/multi.m4])
+m4_include([../config/override.m4])
+m4_include([../config/stdint.m4])
+m4_include([../config/unwind_ipinfo.m4])
+m4_include([../config/warnings.m4])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/alloc.c
@@ -0,0 +1,156 @@
+/* alloc.c -- Memory allocation without mmap.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+/* Allocation routines to use on systems that do not support anonymous
+   mmap.  This implementation just uses malloc, which means that the
+   backtrace functions may not be safely invoked from a signal
+   handler.  */
+
+/* Allocate memory like malloc.  If ERROR_CALLBACK is NULL, don't
+   report an error.  */
+
+void *
+backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED,
+		 size_t size, backtrace_error_callback error_callback,
+		 void *data)
+{
+  void *ret;
+
+  ret = malloc (size);
+  if (ret == NULL)
+    {
+      if (error_callback)
+	error_callback (data, "malloc", errno);
+    }
+  return ret;
+}
+
+/* Free memory.  */
+
+void
+backtrace_free (struct backtrace_state *state ATTRIBUTE_UNUSED,
+		void *p, size_t size ATTRIBUTE_UNUSED,
+		backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
+		void *data ATTRIBUTE_UNUSED)
+{
+  free (p);
+}
+
+/* Grow VEC by SIZE bytes.  */
+
+void *
+backtrace_vector_grow (struct backtrace_state *state ATTRIBUTE_UNUSED,
+		       size_t size, backtrace_error_callback error_callback,
+		       void *data, struct backtrace_vector *vec)
+{
+  void *ret;
+
+  if (size > vec->alc)
+    {
+      size_t alc;
+      void *base;
+
+      if (vec->size == 0)
+	alc = 32 * size;
+      else if (vec->size >= 4096)
+	alc = vec->size + 4096;
+      else
+	alc = 2 * vec->size;
+
+      if (alc < vec->size + size)
+	alc = vec->size + size;
+
+      base = realloc (vec->base, alc);
+      if (base == NULL)
+	{
+	  error_callback (data, "realloc", errno);
+	  return NULL;
+	}
+
+      vec->base = base;
+      vec->alc = alc - vec->size;
+    }
+
+  ret = (char *) vec->base + vec->size;
+  vec->size += size;
+  vec->alc -= size;
+  return ret;
+}
+
+/* Finish the current allocation on VEC.  */
+
+void *
+backtrace_vector_finish (struct backtrace_state *state,
+			 struct backtrace_vector *vec,
+			 backtrace_error_callback error_callback,
+			 void *data)
+{
+  void *ret;
+
+  /* With this allocator we call realloc in backtrace_vector_grow,
+     which means we can't easily reuse the memory here.  So just
+     release it.  */
+  if (!backtrace_vector_release (state, vec, error_callback, data))
+    return NULL;
+  ret = vec->base;
+  vec->base = NULL;
+  vec->size = 0;
+  vec->alc = 0;
+  return ret;
+}
+
+/* Release any extra space allocated for VEC.  */
+
+int
+backtrace_vector_release (struct backtrace_state *state ATTRIBUTE_UNUSED,
+			  struct backtrace_vector *vec,
+			  backtrace_error_callback error_callback,
+			  void *data)
+{
+  vec->base = realloc (vec->base, vec->size);
+  if (vec->base == NULL)
+    {
+      error_callback (data, "realloc", errno);
+      return 0;
+    }
+  vec->alc = 0;
+  return 1;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/ansidecl.h
@@ -0,0 +1,355 @@
+/* ANSI and traditional C compatability macros
+   Copyright (C) 1991-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* ANSI and traditional C compatibility macros
+
+   ANSI C is assumed if __STDC__ is #defined.
+
+   Macro		ANSI C definition	Traditional C definition
+   -----		---- - ----------	----------- - ----------
+   PTR			`void *'		`char *'
+   const		not defined		`'
+   volatile		not defined		`'
+   signed		not defined		`'
+
+   For ease of writing code which uses GCC extensions but needs to be
+   portable to other compilers, we provide the GCC_VERSION macro that
+   simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
+   wrappers around __attribute__.  Also, __extension__ will be #defined
+   to nothing if it doesn't work.  See below.  */
+
+#ifndef	_ANSIDECL_H
+#define _ANSIDECL_H	1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Every source file includes this file,
+   so they will all get the switch for lint.  */
+/* LINTLIBRARY */
+
+/* Using MACRO(x,y) in cpp #if conditionals does not work with some
+   older preprocessors.  Thus we can't define something like this:
+
+#define HAVE_GCC_VERSION(MAJOR, MINOR) \
+  (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
+
+and then test "#if HAVE_GCC_VERSION(2,7)".
+
+So instead we use the macro below and test it against specific values.  */
+
+/* This macro simplifies testing whether we are using gcc, and if it
+   is of a particular minimum version. (Both major & minor numbers are
+   significant.)  This macro will evaluate to 0 if we are not using
+   gcc at all.  */
+#ifndef GCC_VERSION
+#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#endif /* GCC_VERSION */
+
+#if defined (__STDC__) || defined(__cplusplus) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
+/* All known AIX compilers implement these things (but don't always
+   define __STDC__).  The RISC/OS MIPS compiler defines these things
+   in SVR4 mode, but does not define __STDC__.  */
+/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other
+   C++ compilers, does not define __STDC__, though it acts as if this
+   was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */
+
+#define PTR		void *
+
+#undef const
+#undef volatile
+#undef signed
+
+/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
+   it too, but it's not in C89.  */
+#undef inline
+#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) || (defined(__SUNPRO_C) && defined(__C99FEATURES__))
+/* it's a keyword */
+#else
+# if GCC_VERSION >= 2007
+#  define inline __inline__   /* __inline__ prevents -pedantic warnings */
+# else
+#  define inline  /* nothing */
+# endif
+#endif
+
+#else	/* Not ANSI C.  */
+
+#define PTR		char *
+
+/* some systems define these in header files for non-ansi mode */
+#undef const
+#undef volatile
+#undef signed
+#undef inline
+#define const
+#define volatile
+#define signed
+#define inline
+
+#endif	/* ANSI C.  */
+
+/* Define macros for some gcc attributes.  This permits us to use the
+   macros freely, and know that they will come into play for the
+   version of gcc in which they are supported.  */
+
+#if (GCC_VERSION < 2007)
+# define __attribute__(x)
+#endif
+
+/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
+#ifndef ATTRIBUTE_MALLOC
+# if (GCC_VERSION >= 2096)
+#  define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define ATTRIBUTE_MALLOC
+# endif /* GNUC >= 2.96 */
+#endif /* ATTRIBUTE_MALLOC */
+
+/* Attributes on labels were valid as of gcc 2.93 and g++ 4.5.  For
+   g++ an attribute on a label must be followed by a semicolon.  */
+#ifndef ATTRIBUTE_UNUSED_LABEL
+# ifndef __cplusplus
+#  if GCC_VERSION >= 2093
+#   define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
+#  else
+#   define ATTRIBUTE_UNUSED_LABEL
+#  endif
+# else
+#  if GCC_VERSION >= 4005
+#   define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED ;
+#  else
+#   define ATTRIBUTE_UNUSED_LABEL
+#  endif
+# endif
+#endif
+
+/* Similarly to ARG_UNUSED below.  Prior to GCC 3.4, the C++ frontend
+   couldn't parse attributes placed after the identifier name, and now
+   the entire compiler is built with C++.  */
+#ifndef ATTRIBUTE_UNUSED
+#if GCC_VERSION >= 3004
+#  define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+#endif /* ATTRIBUTE_UNUSED */
+
+/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the
+   identifier name.  */
+#if ! defined(__cplusplus) || (GCC_VERSION >= 3004)
+# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED
+#else /* !__cplusplus || GNUC >= 3.4 */
+# define ARG_UNUSED(NAME) NAME
+#endif /* !__cplusplus || GNUC >= 3.4 */
+
+#ifndef ATTRIBUTE_NORETURN
+#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif /* ATTRIBUTE_NORETURN */
+
+/* Attribute `nonnull' was valid as of gcc 3.3.  */
+#ifndef ATTRIBUTE_NONNULL
+# if (GCC_VERSION >= 3003)
+#  define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
+# else
+#  define ATTRIBUTE_NONNULL(m)
+# endif /* GNUC >= 3.3 */
+#endif /* ATTRIBUTE_NONNULL */
+
+/* Attribute `returns_nonnull' was valid as of gcc 4.9.  */
+#ifndef ATTRIBUTE_RETURNS_NONNULL
+# if (GCC_VERSION >= 4009)
+#  define ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
+# else
+#  define ATTRIBUTE_RETURNS_NONNULL
+# endif /* GNUC >= 4.9 */
+#endif /* ATTRIBUTE_RETURNS_NONNULL */
+
+/* Attribute `pure' was valid as of gcc 3.0.  */
+#ifndef ATTRIBUTE_PURE
+# if (GCC_VERSION >= 3000)
+#  define ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define ATTRIBUTE_PURE
+# endif /* GNUC >= 3.0 */
+#endif /* ATTRIBUTE_PURE */
+
+/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
+   This was the case for the `printf' format attribute by itself
+   before GCC 3.3, but as of 3.3 we need to add the `nonnull'
+   attribute to retain this behavior.  */
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
+#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
+#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
+#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
+#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
+#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
+#endif /* ATTRIBUTE_PRINTF */
+
+/* Use ATTRIBUTE_FPTR_PRINTF when the format attribute is to be set on
+   a function pointer.  Format attributes were allowed on function
+   pointers as of gcc 3.1.  */
+#ifndef ATTRIBUTE_FPTR_PRINTF
+# if (GCC_VERSION >= 3001)
+#  define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n)
+# else
+#  define ATTRIBUTE_FPTR_PRINTF(m, n)
+# endif /* GNUC >= 3.1 */
+# define ATTRIBUTE_FPTR_PRINTF_1 ATTRIBUTE_FPTR_PRINTF(1, 2)
+# define ATTRIBUTE_FPTR_PRINTF_2 ATTRIBUTE_FPTR_PRINTF(2, 3)
+# define ATTRIBUTE_FPTR_PRINTF_3 ATTRIBUTE_FPTR_PRINTF(3, 4)
+# define ATTRIBUTE_FPTR_PRINTF_4 ATTRIBUTE_FPTR_PRINTF(4, 5)
+# define ATTRIBUTE_FPTR_PRINTF_5 ATTRIBUTE_FPTR_PRINTF(5, 6)
+#endif /* ATTRIBUTE_FPTR_PRINTF */
+
+/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL.  A
+   NULL format specifier was allowed as of gcc 3.3.  */
+#ifndef ATTRIBUTE_NULL_PRINTF
+# if (GCC_VERSION >= 3003)
+#  define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+# else
+#  define ATTRIBUTE_NULL_PRINTF(m, n)
+# endif /* GNUC >= 3.3 */
+# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2)
+# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3)
+# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4)
+# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5)
+# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6)
+#endif /* ATTRIBUTE_NULL_PRINTF */
+
+/* Attribute `sentinel' was valid as of gcc 3.5.  */
+#ifndef ATTRIBUTE_SENTINEL
+# if (GCC_VERSION >= 3005)
+#  define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
+# else
+#  define ATTRIBUTE_SENTINEL
+# endif /* GNUC >= 3.5 */
+#endif /* ATTRIBUTE_SENTINEL */
+
+
+#ifndef ATTRIBUTE_ALIGNED_ALIGNOF
+# if (GCC_VERSION >= 3000)
+#  define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m))))
+# else
+#  define ATTRIBUTE_ALIGNED_ALIGNOF(m)
+# endif /* GNUC >= 3.0 */
+#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */
+
+/* Useful for structures whose layout must much some binary specification
+   regardless of the alignment and padding qualities of the compiler.  */
+#ifndef ATTRIBUTE_PACKED
+# define ATTRIBUTE_PACKED __attribute__ ((packed))
+#endif
+
+/* Attribute `hot' and `cold' was valid as of gcc 4.3.  */
+#ifndef ATTRIBUTE_COLD
+# if (GCC_VERSION >= 4003)
+#  define ATTRIBUTE_COLD __attribute__ ((__cold__))
+# else
+#  define ATTRIBUTE_COLD
+# endif /* GNUC >= 4.3 */
+#endif /* ATTRIBUTE_COLD */
+#ifndef ATTRIBUTE_HOT
+# if (GCC_VERSION >= 4003)
+#  define ATTRIBUTE_HOT __attribute__ ((__hot__))
+# else
+#  define ATTRIBUTE_HOT
+# endif /* GNUC >= 4.3 */
+#endif /* ATTRIBUTE_HOT */
+
+/* Attribute 'no_sanitize_undefined' was valid as of gcc 4.9.  */
+#ifndef ATTRIBUTE_NO_SANITIZE_UNDEFINED
+# if (GCC_VERSION >= 4009)
+#  define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
+# else
+#  define ATTRIBUTE_NO_SANITIZE_UNDEFINED
+# endif /* GNUC >= 4.9 */
+#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
+
+/* We use __extension__ in some places to suppress -pedantic warnings
+   about GCC extensions.  This feature didn't work properly before
+   gcc 2.8.  */
+#if GCC_VERSION < 2008
+#define __extension__
+#endif
+
+/* This is used to declare a const variable which should be visible
+   outside of the current compilation unit.  Use it as
+     EXPORTED_CONST int i = 1;
+   This is because the semantics of const are different in C and C++.
+   "extern const" is permitted in C but it looks strange, and gcc
+   warns about it when -Wc++-compat is not used.  */
+#ifdef __cplusplus
+#define EXPORTED_CONST extern const
+#else
+#define EXPORTED_CONST const
+#endif
+
+/* Be conservative and only use enum bitfields with C++ or GCC.
+   FIXME: provide a complete autoconf test for buggy enum bitfields.  */
+
+#ifdef __cplusplus
+#define ENUM_BITFIELD(TYPE) enum TYPE
+#elif (GCC_VERSION > 2000)
+#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
+#else
+#define ENUM_BITFIELD(TYPE) unsigned int
+#endif
+
+/* C++11 adds the ability to add "override" after an implementation of a
+   virtual function in a subclass, to:
+     (A) document that this is an override of a virtual function
+     (B) allow the compiler to issue a warning if it isn't (e.g. a mismatch
+         of the type signature).
+
+   Similarly, it allows us to add a "final" to indicate that no subclass
+   may subsequently override the vfunc.
+
+   Provide OVERRIDE and FINAL as macros, allowing us to get these benefits
+   when compiling with C++11 support, but without requiring C++11.
+
+   For gcc, use "-std=c++11" to enable C++11 support; gcc 6 onwards enables
+   this by default (actually GNU++14).  */
+
+#if __cplusplus >= 201103
+/* C++11 claims to be available: use it.  final/override were only
+   implemented in 4.7, though.  */
+# if GCC_VERSION < 4007
+#  define OVERRIDE
+#  define FINAL
+# else
+#  define OVERRIDE override
+#  define FINAL final
+# endif
+#elif GCC_VERSION >= 4007
+/* G++ 4.7 supports __final in C++98.  */
+# define OVERRIDE
+# define FINAL __final
+#else
+/* No C++11 support; leave the macros empty: */
+# define OVERRIDE
+# define FINAL
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* ansidecl.h	*/
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/atomic.c
@@ -0,0 +1,113 @@
+/* atomic.c -- Support for atomic functions if not present.
+   Copyright (C) 2013-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <sys/types.h>
+
+#include "backtrace.h"
+#include "backtrace-supported.h"
+#include "internal.h"
+
+/* This file holds implementations of the atomic functions that are
+   used if the host compiler has the sync functions but not the atomic
+   functions, as is true of versions of GCC before 4.7.  */
+
+#if !defined (HAVE_ATOMIC_FUNCTIONS) && defined (HAVE_SYNC_FUNCTIONS)
+
+/* Do an atomic load of a pointer.  */
+
+void *
+backtrace_atomic_load_pointer (void *arg)
+{
+  void **pp;
+  void *p;
+
+  pp = (void **) arg;
+  p = *pp;
+  while (!__sync_bool_compare_and_swap (pp, p, p))
+    p = *pp;
+  return p;
+}
+
+/* Do an atomic load of an int.  */
+
+int
+backtrace_atomic_load_int (int *p)
+{
+  int i;
+
+  i = *p;
+  while (!__sync_bool_compare_and_swap (p, i, i))
+    i = *p;
+  return i;
+}
+
+/* Do an atomic store of a pointer.  */
+
+void
+backtrace_atomic_store_pointer (void *arg, void *p)
+{
+  void **pp;
+  void *old;
+
+  pp = (void **) arg;
+  old = *pp;
+  while (!__sync_bool_compare_and_swap (pp, old, p))
+    old = *pp;
+}
+
+/* Do an atomic store of a size_t value.  */
+
+void
+backtrace_atomic_store_size_t (size_t *p, size_t v)
+{
+  size_t old;
+
+  old = *p;
+  while (!__sync_bool_compare_and_swap (p, old, v))
+    old = *p;
+}
+
+/* Do an atomic store of a int value.  */
+
+void
+backtrace_atomic_store_int (int *p, int v)
+{
+  size_t old;
+
+  old = *p;
+  while (!__sync_bool_compare_and_swap (p, old, v))
+    old = *p;
+}
+
+#endif
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/backtrace-supported.h.in
@@ -0,0 +1,66 @@
+/* backtrace-supported.h.in -- Whether stack backtrace is supported.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+/* The file backtrace-supported.h.in is used by configure to generate
+   the file backtrace-supported.h.  The file backtrace-supported.h may
+   be #include'd to see whether the backtrace library will be able to
+   get a backtrace and produce symbolic information.  */
+
+
+/* BACKTRACE_SUPPORTED will be #define'd as 1 if the backtrace library
+   should work, 0 if it will not.  Libraries may #include this to make
+   other arrangements.  */
+
+#define BACKTRACE_SUPPORTED @BACKTRACE_SUPPORTED@
+
+/* BACKTRACE_USES_MALLOC will be #define'd as 1 if the backtrace
+   library will call malloc as it works, 0 if it will call mmap
+   instead.  This may be used to determine whether it is safe to call
+   the backtrace functions from a signal handler.  In general this
+   only applies to calls like backtrace and backtrace_pcinfo.  It does
+   not apply to backtrace_simple, which never calls malloc.  It does
+   not apply to backtrace_print, which always calls fprintf and
+   therefore malloc.  */
+
+#define BACKTRACE_USES_MALLOC @BACKTRACE_USES_MALLOC@
+
+/* BACKTRACE_SUPPORTS_THREADS will be #define'd as 1 if the backtrace
+   library is configured with threading support, 0 if not.  If this is
+   0, the threaded parameter to backtrace_create_state must be passed
+   as 0.  */
+
+#define BACKTRACE_SUPPORTS_THREADS @BACKTRACE_SUPPORTS_THREADS@
+
+/* BACKTRACE_SUPPORTS_DATA will be #defined'd as 1 if the backtrace_syminfo
+   will work for variables.  It will always work for functions.  */
+
+#define BACKTRACE_SUPPORTS_DATA @BACKTRACE_SUPPORTS_DATA@
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/backtrace.c
@@ -0,0 +1,129 @@
+/* backtrace.c -- Entry point for stack backtrace library.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <sys/types.h>
+
+#include "unwind.h"
+#include "backtrace.h"
+#include "internal.h"
+
+/* The main backtrace_full routine.  */
+
+/* Data passed through _Unwind_Backtrace.  */
+
+struct backtrace_data
+{
+  /* Number of frames to skip.  */
+  int skip;
+  /* Library state.  */
+  struct backtrace_state *state;
+  /* Callback routine.  */
+  backtrace_full_callback callback;
+  /* Error callback routine.  */
+  backtrace_error_callback error_callback;
+  /* Data to pass to callback routines.  */
+  void *data;
+  /* Value to return from backtrace_full.  */
+  int ret;
+  /* Whether there is any memory available.  */
+  int can_alloc;
+};
+
+/* Unwind library callback routine.  This is passed to
+   _Unwind_Backtrace.  */
+
+static _Unwind_Reason_Code
+unwind (struct _Unwind_Context *context, void *vdata)
+{
+  struct backtrace_data *bdata = (struct backtrace_data *) vdata;
+  uintptr_t pc;
+  int ip_before_insn = 0;
+
+#ifdef HAVE_GETIPINFO
+  pc = _Unwind_GetIPInfo (context, &ip_before_insn);
+#else
+  pc = _Unwind_GetIP (context);
+#endif
+
+  if (bdata->skip > 0)
+    {
+      --bdata->skip;
+      return _URC_NO_REASON;
+    }
+
+  if (!ip_before_insn)
+    --pc;
+
+  if (!bdata->can_alloc)
+    bdata->ret = bdata->callback (bdata->data, pc, NULL, 0, NULL);
+  else
+    bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback,
+				   bdata->error_callback, bdata->data);
+  if (bdata->ret != 0)
+    return _URC_END_OF_STACK;
+
+  return _URC_NO_REASON;
+}
+
+/* Get a stack backtrace.  */
+
+int
+backtrace_full (struct backtrace_state *state, int skip,
+		backtrace_full_callback callback,
+		backtrace_error_callback error_callback, void *data)
+{
+  struct backtrace_data bdata;
+  void *p;
+
+  bdata.skip = skip + 1;
+  bdata.state = state;
+  bdata.callback = callback;
+  bdata.error_callback = error_callback;
+  bdata.data = data;
+  bdata.ret = 0;
+
+  /* If we can't allocate any memory at all, don't try to produce
+     file/line information.  */
+  p = backtrace_alloc (state, 4096, NULL, NULL);
+  if (p == NULL)
+    bdata.can_alloc = 0;
+  else
+    {
+      backtrace_free (state, p, 4096, NULL, NULL);
+      bdata.can_alloc = 1;
+    }
+
+  _Unwind_Backtrace (unwind, &bdata);
+  return bdata.ret;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/backtrace.h
@@ -0,0 +1,199 @@
+/* backtrace.h -- Public header file for stack backtrace library.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#ifndef BACKTRACE_H
+#define BACKTRACE_H
+
+#include <stddef.h>
+#include <stdio.h>
+
+/* We want to get a definition for uintptr_t, but we still care about
+   systems that don't have <stdint.h>.  */
+#if defined(__GLIBC__) && __GLIBC__ >= 2
+
+#include <stdint.h>
+
+#elif defined(HAVE_STDINT_H)
+
+#include <stdint.h>
+
+#else
+
+/* Systems that don't have <stdint.h> must provide gstdint.h, e.g.,
+   from GCC_HEADER_STDINT in configure.ac.  */
+#include "gstdint.h"
+
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The backtrace state.  This struct is intentionally not defined in
+   the public interface.  */
+
+struct backtrace_state;
+
+/* The type of the error callback argument to backtrace functions.
+   This function, if not NULL, will be called for certain error cases.
+   The DATA argument is passed to the function that calls this one.
+   The MSG argument is an error message.  The ERRNUM argument, if
+   greater than 0, holds an errno value.  The MSG buffer may become
+   invalid after this function returns.
+
+   As a special case, the ERRNUM argument will be passed as -1 if no
+   debug info can be found for the executable, but the function
+   requires debug info (e.g., backtrace_full, backtrace_pcinfo).  The
+   MSG in this case will be something along the lines of "no debug
+   info".  Similarly, ERRNUM will be passed as -1 if there is no
+   symbol table, but the function requires a symbol table (e.g.,
+   backtrace_syminfo).  This may be used as a signal that some other
+   approach should be tried.  */
+
+typedef void (*backtrace_error_callback) (void *data, const char *msg,
+					  int errnum);
+
+/* Create state information for the backtrace routines.  This must be
+   called before any of the other routines, and its return value must
+   be passed to all of the other routines.  FILENAME is the path name
+   of the executable file; if it is NULL the library will try
+   system-specific path names.  If not NULL, FILENAME must point to a
+   permanent buffer.  If THREADED is non-zero the state may be
+   accessed by multiple threads simultaneously, and the library will
+   use appropriate atomic operations.  If THREADED is zero the state
+   may only be accessed by one thread at a time.  This returns a state
+   pointer on success, NULL on error.  If an error occurs, this will
+   call the ERROR_CALLBACK routine.  */
+
+extern struct backtrace_state *backtrace_create_state (
+    const char *filename, int threaded,
+    backtrace_error_callback error_callback, void *data);
+
+/* The type of the callback argument to the backtrace_full function.
+   DATA is the argument passed to backtrace_full.  PC is the program
+   counter.  FILENAME is the name of the file containing PC, or NULL
+   if not available.  LINENO is the line number in FILENAME containing
+   PC, or 0 if not available.  FUNCTION is the name of the function
+   containing PC, or NULL if not available.  This should return 0 to
+   continuing tracing.  The FILENAME and FUNCTION buffers may become
+   invalid after this function returns.  */
+
+typedef int (*backtrace_full_callback) (void *data, uintptr_t pc,
+					const char *filename, int lineno,
+					const char *function);
+
+/* Get a full stack backtrace.  SKIP is the number of frames to skip;
+   passing 0 will start the trace with the function calling
+   backtrace_full.  DATA is passed to the callback routine.  If any
+   call to CALLBACK returns a non-zero value, the stack backtrace
+   stops, and backtrace returns that value; this may be used to limit
+   the number of stack frames desired.  If all calls to CALLBACK
+   return 0, backtrace returns 0.  The backtrace_full function will
+   make at least one call to either CALLBACK or ERROR_CALLBACK.  This
+   function requires debug info for the executable.  */
+
+extern int backtrace_full (struct backtrace_state *state, int skip,
+			   backtrace_full_callback callback,
+			   backtrace_error_callback error_callback,
+			   void *data);
+
+/* The type of the callback argument to the backtrace_simple function.
+   DATA is the argument passed to simple_backtrace.  PC is the program
+   counter.  This should return 0 to continue tracing.  */
+
+typedef int (*backtrace_simple_callback) (void *data, uintptr_t pc);
+
+/* Get a simple backtrace.  SKIP is the number of frames to skip, as
+   in backtrace.  DATA is passed to the callback routine.  If any call
+   to CALLBACK returns a non-zero value, the stack backtrace stops,
+   and backtrace_simple returns that value.  Otherwise
+   backtrace_simple returns 0.  The backtrace_simple function will
+   make at least one call to either CALLBACK or ERROR_CALLBACK.  This
+   function does not require any debug info for the executable.  */
+
+extern int backtrace_simple (struct backtrace_state *state, int skip,
+			     backtrace_simple_callback callback,
+			     backtrace_error_callback error_callback,
+			     void *data);
+
+/* Print the current backtrace in a user readable format to a FILE.
+   SKIP is the number of frames to skip, as in backtrace_full.  Any
+   error messages are printed to stderr.  This function requires debug
+   info for the executable.  */
+
+extern void backtrace_print (struct backtrace_state *state, int skip, FILE *);
+
+/* Given PC, a program counter in the current program, call the
+   callback function with filename, line number, and function name
+   information.  This will normally call the callback function exactly
+   once.  However, if the PC happens to describe an inlined call, and
+   the debugging information contains the necessary information, then
+   this may call the callback function multiple times.  This will make
+   at least one call to either CALLBACK or ERROR_CALLBACK.  This
+   returns the first non-zero value returned by CALLBACK, or 0.  */
+
+extern int backtrace_pcinfo (struct backtrace_state *state, uintptr_t pc,
+			     backtrace_full_callback callback,
+			     backtrace_error_callback error_callback,
+			     void *data);
+
+/* The type of the callback argument to backtrace_syminfo.  DATA and
+   PC are the arguments passed to backtrace_syminfo.  SYMNAME is the
+   name of the symbol for the corresponding code.  SYMVAL is the
+   value and SYMSIZE is the size of the symbol.  SYMNAME will be NULL
+   if no error occurred but the symbol could not be found.  */
+
+typedef void (*backtrace_syminfo_callback) (void *data, uintptr_t pc,
+					    const char *symname,
+					    uintptr_t symval,
+					    uintptr_t symsize);
+
+/* Given ADDR, an address or program counter in the current program,
+   call the callback information with the symbol name and value
+   describing the function or variable in which ADDR may be found.
+   This will call either CALLBACK or ERROR_CALLBACK exactly once.
+   This returns 1 on success, 0 on failure.  This function requires
+   the symbol table but does not require the debug info.  Note that if
+   the symbol table is present but ADDR could not be found in the
+   table, CALLBACK will be called with a NULL SYMNAME argument.
+   Returns 1 on success, 0 on error.  */
+
+extern int backtrace_syminfo (struct backtrace_state *state, uintptr_t addr,
+			      backtrace_syminfo_callback callback,
+			      backtrace_error_callback error_callback,
+			      void *data);
+
+#ifdef __cplusplus
+} /* End extern "C".  */
+#endif
+
+#endif
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/btest.c
@@ -0,0 +1,721 @@
+/* btest.c -- Test for libbacktrace library
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+/* This program tests the externally visible interfaces of the
+   libbacktrace library.  */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "filenames.h"
+
+#include "backtrace.h"
+#include "backtrace-supported.h"
+
+/* Portable attribute syntax.  Actually some of these tests probably
+   won't work if the attributes are not recognized.  */
+
+#ifndef GCC_VERSION
+# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#endif
+
+#if (GCC_VERSION < 2007)
+# define __attribute__(x)
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+/* Used to collect backtrace info.  */
+
+struct info
+{
+  char *filename;
+  int lineno;
+  char *function;
+};
+
+/* Passed to backtrace callback function.  */
+
+struct bdata
+{
+  struct info *all;
+  size_t index;
+  size_t max;
+  int failed;
+};
+
+/* Passed to backtrace_simple callback function.  */
+
+struct sdata
+{
+  uintptr_t *addrs;
+  size_t index;
+  size_t max;
+  int failed;
+};
+
+/* Passed to backtrace_syminfo callback function.  */
+
+struct symdata
+{
+  const char *name;
+  uintptr_t val, size;
+  int failed;
+};
+
+/* The backtrace state.  */
+
+static void *state;
+
+/* The number of failures.  */
+
+static int failures;
+
+/* Return the base name in a path.  */
+
+static const char *
+base (const char *p)
+{
+  const char *last;
+  const char *s;
+
+  last = NULL;
+  for (s = p; *s != '\0'; ++s)
+    {
+      if (IS_DIR_SEPARATOR (*s))
+	last = s + 1;
+    }
+  return last != NULL ? last : p;
+}
+
+/* Check an entry in a struct info array.  */
+
+static void
+check (const char *name, int index, const struct info *all, int want_lineno,
+       const char *want_function, int *failed)
+{
+  if (*failed)
+    return;
+  if (all[index].filename == NULL || all[index].function == NULL)
+    {
+      fprintf (stderr, "%s: [%d]: missing file name or function name\n",
+	       name, index);
+      *failed = 1;
+      return;
+    }
+  if (strcmp (base (all[index].filename), "btest.c") != 0)
+    {
+      fprintf (stderr, "%s: [%d]: got %s expected test.c\n", name, index,
+	       all[index].filename);
+      *failed = 1;
+    }
+  if (all[index].lineno != want_lineno)
+    {
+      fprintf (stderr, "%s: [%d]: got %d expected %d\n", name, index,
+	       all[index].lineno, want_lineno);
+      *failed = 1;
+    }
+  if (strcmp (all[index].function, want_function) != 0)
+    {
+      fprintf (stderr, "%s: [%d]: got %s expected %s\n", name, index,
+	       all[index].function, want_function);
+      *failed = 1;
+    }
+}
+
+/* The backtrace callback function.  */
+
+static int
+callback_one (void *vdata, uintptr_t pc ATTRIBUTE_UNUSED,
+	      const char *filename, int lineno, const char *function)
+{
+  struct bdata *data = (struct bdata *) vdata;
+  struct info *p;
+
+  if (data->index >= data->max)
+    {
+      fprintf (stderr, "callback_one: callback called too many times\n");
+      data->failed = 1;
+      return 1;
+    }
+
+  p = &data->all[data->index];
+  if (filename == NULL)
+    p->filename = NULL;
+  else
+    {
+      p->filename = strdup (filename);
+      assert (p->filename != NULL);
+    }
+  p->lineno = lineno;
+  if (function == NULL)
+    p->function = NULL;
+  else
+    {
+      p->function = strdup (function);
+      assert (p->function != NULL);
+    }
+  ++data->index;
+
+  return 0;
+}
+
+/* An error callback passed to backtrace.  */
+
+static void
+error_callback_one (void *vdata, const char *msg, int errnum)
+{
+  struct bdata *data = (struct bdata *) vdata;
+
+  fprintf (stderr, "%s", msg);
+  if (errnum > 0)
+    fprintf (stderr, ": %s", strerror (errnum));
+  fprintf (stderr, "\n");
+  data->failed = 1;
+}
+
+/* The backtrace_simple callback function.  */
+
+static int
+callback_two (void *vdata, uintptr_t pc)
+{
+  struct sdata *data = (struct sdata *) vdata;
+
+  if (data->index >= data->max)
+    {
+      fprintf (stderr, "callback_two: callback called too many times\n");
+      data->failed = 1;
+      return 1;
+    }
+
+  data->addrs[data->index] = pc;
+  ++data->index;
+
+  return 0;
+}
+
+/* An error callback passed to backtrace_simple.  */
+
+static void
+error_callback_two (void *vdata, const char *msg, int errnum)
+{
+  struct sdata *data = (struct sdata *) vdata;
+
+  fprintf (stderr, "%s", msg);
+  if (errnum > 0)
+    fprintf (stderr, ": %s", strerror (errnum));
+  fprintf (stderr, "\n");
+  data->failed = 1;
+}
+
+/* The backtrace_syminfo callback function.  */
+
+static void
+callback_three (void *vdata, uintptr_t pc ATTRIBUTE_UNUSED,
+		const char *symname, uintptr_t symval,
+		uintptr_t symsize)
+{
+  struct symdata *data = (struct symdata *) vdata;
+
+  if (symname == NULL)
+    data->name = NULL;
+  else
+    {
+      data->name = strdup (symname);
+      assert (data->name != NULL);
+    }
+  data->val = symval;
+  data->size = symsize;
+}
+
+/* The backtrace_syminfo error callback function.  */
+
+static void
+error_callback_three (void *vdata, const char *msg, int errnum)
+{
+  struct symdata *data = (struct symdata *) vdata;
+
+  fprintf (stderr, "%s", msg);
+  if (errnum > 0)
+    fprintf (stderr, ": %s", strerror (errnum));
+  fprintf (stderr, "\n");
+  data->failed = 1;
+}
+
+/* Test the backtrace function with non-inlined functions.  */
+
+static int test1 (void) __attribute__ ((noinline, unused));
+static int f2 (int) __attribute__ ((noinline));
+static int f3 (int, int) __attribute__ ((noinline));
+
+static int
+test1 (void)
+{
+  /* Returning a value here and elsewhere avoids a tailcall which
+     would mess up the backtrace.  */
+  return f2 (__LINE__) + 1;
+}
+
+static int
+f2 (int f1line)
+{
+  return f3 (f1line, __LINE__) + 2;
+}
+
+static int
+f3 (int f1line, int f2line)
+{
+  struct info all[20];
+  struct bdata data;
+  int f3line;
+  int i;
+
+  data.all = &all[0];
+  data.index = 0;
+  data.max = 20;
+  data.failed = 0;
+
+  f3line = __LINE__ + 1;
+  i = backtrace_full (state, 0, callback_one, error_callback_one, &data);
+
+  if (i != 0)
+    {
+      fprintf (stderr, "test1: unexpected return value %d\n", i);
+      data.failed = 1;
+    }
+
+  if (data.index < 3)
+    {
+      fprintf (stderr,
+	       "test1: not enough frames; got %zu, expected at least 3\n",
+	       data.index);
+      data.failed = 1;
+    }
+
+  check ("test1", 0, all, f3line, "f3", &data.failed);
+  check ("test1", 1, all, f2line, "f2", &data.failed);
+  check ("test1", 2, all, f1line, "test1", &data.failed);
+
+  printf ("%s: backtrace_full noinline\n", data.failed ? "FAIL" : "PASS");
+
+  if (data.failed)
+    ++failures;
+
+  return failures;
+}
+
+/* Test the backtrace function with inlined functions.  */
+
+static inline int test2 (void) __attribute__ ((always_inline, unused));
+static inline int f12 (int) __attribute__ ((always_inline));
+static inline int f13 (int, int) __attribute__ ((always_inline));
+
+static inline int
+test2 (void)
+{
+  return f12 (__LINE__) + 1;
+}
+
+static inline int
+f12 (int f1line)
+{
+  return f13 (f1line, __LINE__) + 2;
+}
+
+static inline int
+f13 (int f1line, int f2line)
+{
+  struct info all[20];
+  struct bdata data;
+  int f3line;
+  int i;
+
+  data.all = &all[0];
+  data.index = 0;
+  data.max = 20;
+  data.failed = 0;
+
+  f3line = __LINE__ + 1;
+  i = backtrace_full (state, 0, callback_one, error_callback_one, &data);
+
+  if (i != 0)
+    {
+      fprintf (stderr, "test2: unexpected return value %d\n", i);
+      data.failed = 1;
+    }
+
+  check ("test2", 0, all, f3line, "f13", &data.failed);
+  check ("test2", 1, all, f2line, "f12", &data.failed);
+  check ("test2", 2, all, f1line, "test2", &data.failed);
+
+  printf ("%s: backtrace_full inline\n", data.failed ? "FAIL" : "PASS");
+
+  if (data.failed)
+    ++failures;
+
+  return failures;
+}
+
+/* Test the backtrace_simple function with non-inlined functions.  */
+
+static int test3 (void) __attribute__ ((noinline, unused));
+static int f22 (int) __attribute__ ((noinline));
+static int f23 (int, int) __attribute__ ((noinline));
+
+static int
+test3 (void)
+{
+  return f22 (__LINE__) + 1;
+}
+
+static int
+f22 (int f1line)
+{
+  return f23 (f1line, __LINE__) + 2;
+}
+
+static int
+f23 (int f1line, int f2line)
+{
+  uintptr_t addrs[20];
+  struct sdata data;
+  int f3line;
+  int i;
+
+  data.addrs = &addrs[0];
+  data.index = 0;
+  data.max = 20;
+  data.failed = 0;
+
+  f3line = __LINE__ + 1;
+  i = backtrace_simple (state, 0, callback_two, error_callback_two, &data);
+
+  if (i != 0)
+    {
+      fprintf (stderr, "test3: unexpected return value %d\n", i);
+      data.failed = 1;
+    }
+
+  if (!data.failed)
+    {
+      struct info all[20];
+      struct bdata bdata;
+      int j;
+
+      bdata.all = &all[0];
+      bdata.index = 0;
+      bdata.max = 20;
+      bdata.failed = 0;
+
+      for (j = 0; j < 3; ++j)
+	{
+	  i = backtrace_pcinfo (state, addrs[j], callback_one,
+				error_callback_one, &bdata);
+	  if (i != 0)
+	    {
+	      fprintf (stderr,
+		       ("test3: unexpected return value "
+			"from backtrace_pcinfo %d\n"),
+		       i);
+	      bdata.failed = 1;
+	    }
+	  if (!bdata.failed && bdata.index != (size_t) (j + 1))
+	    {
+	      fprintf (stderr,
+		       ("wrong number of calls from backtrace_pcinfo "
+			"got %u expected %d\n"),
+		       (unsigned int) bdata.index, j + 1);
+	      bdata.failed = 1;
+	    }
+	}
+
+      check ("test3", 0, all, f3line, "f23", &bdata.failed);
+      check ("test3", 1, all, f2line, "f22", &bdata.failed);
+      check ("test3", 2, all, f1line, "test3", &bdata.failed);
+
+      if (bdata.failed)
+	data.failed = 1;
+
+      for (j = 0; j < 3; ++j)
+	{
+	  struct symdata symdata;
+
+	  symdata.name = NULL;
+	  symdata.val = 0;
+	  symdata.size = 0;
+	  symdata.failed = 0;
+
+	  i = backtrace_syminfo (state, addrs[j], callback_three,
+				 error_callback_three, &symdata);
+	  if (i == 0)
+	    {
+	      fprintf (stderr,
+		       ("test3: [%d]: unexpected return value "
+			"from backtrace_syminfo %d\n"),
+		       j, i);
+	      symdata.failed = 1;
+	    }
+
+	  if (!symdata.failed)
+	    {
+	      const char *expected;
+
+	      switch (j)
+		{
+		case 0:
+		  expected = "f23";
+		  break;
+		case 1:
+		  expected = "f22";
+		  break;
+		case 2:
+		  expected = "test3";
+		  break;
+		default:
+		  assert (0);
+		}
+
+	      if (symdata.name == NULL)
+		{
+		  fprintf (stderr, "test3: [%d]: NULL syminfo name\n", j);
+		  symdata.failed = 1;
+		}
+	      /* Use strncmp, not strcmp, because GCC might create a
+		 clone.  */
+	      else if (strncmp (symdata.name, expected, strlen (expected))
+		       != 0)
+		{
+		  fprintf (stderr,
+			   ("test3: [%d]: unexpected syminfo name "
+			    "got %s expected %s\n"),
+			   j, symdata.name, expected);
+		  symdata.failed = 1;
+		}
+	    }
+
+	  if (symdata.failed)
+	    data.failed = 1;
+	}
+    }
+
+  printf ("%s: backtrace_simple noinline\n", data.failed ? "FAIL" : "PASS");
+
+  if (data.failed)
+    ++failures;
+
+  return failures;
+}
+
+/* Test the backtrace_simple function with inlined functions.  */
+
+static inline int test4 (void) __attribute__ ((always_inline, unused));
+static inline int f32 (int) __attribute__ ((always_inline));
+static inline int f33 (int, int) __attribute__ ((always_inline));
+
+static inline int
+test4 (void)
+{
+  return f32 (__LINE__) + 1;
+}
+
+static inline int
+f32 (int f1line)
+{
+  return f33 (f1line, __LINE__) + 2;
+}
+
+static inline int
+f33 (int f1line, int f2line)
+{
+  uintptr_t addrs[20];
+  struct sdata data;
+  int f3line;
+  int i;
+
+  data.addrs = &addrs[0];
+  data.index = 0;
+  data.max = 20;
+  data.failed = 0;
+
+  f3line = __LINE__ + 1;
+  i = backtrace_simple (state, 0, callback_two, error_callback_two, &data);
+
+  if (i != 0)
+    {
+      fprintf (stderr, "test3: unexpected return value %d\n", i);
+      data.failed = 1;
+    }
+
+  if (!data.failed)
+    {
+      struct info all[20];
+      struct bdata bdata;
+
+      bdata.all = &all[0];
+      bdata.index = 0;
+      bdata.max = 20;
+      bdata.failed = 0;
+
+      i = backtrace_pcinfo (state, addrs[0], callback_one, error_callback_one,
+			    &bdata);
+      if (i != 0)
+	{
+	  fprintf (stderr,
+		   ("test4: unexpected return value "
+		    "from backtrace_pcinfo %d\n"),
+		   i);
+	  bdata.failed = 1;
+	}
+
+      check ("test4", 0, all, f3line, "f33", &bdata.failed);
+      check ("test4", 1, all, f2line, "f32", &bdata.failed);
+      check ("test4", 2, all, f1line, "test4", &bdata.failed);
+
+      if (bdata.failed)
+	data.failed = 1;
+    }
+
+  printf ("%s: backtrace_simple inline\n", data.failed ? "FAIL" : "PASS");
+
+  if (data.failed)
+    ++failures;
+
+  return failures;
+}
+
+#if BACKTRACE_SUPPORTS_DATA
+
+int global = 1;
+
+static int
+test5 (void)
+{
+  struct symdata symdata;
+  int i;
+  uintptr_t addr = (uintptr_t) &global;
+
+  if (sizeof (global) > 1)
+    addr += 1;
+
+  symdata.name = NULL;
+  symdata.val = 0;
+  symdata.size = 0;
+  symdata.failed = 0;
+
+  i = backtrace_syminfo (state, addr, callback_three,
+			 error_callback_three, &symdata);
+  if (i == 0)
+    {
+      fprintf (stderr,
+	       "test5: unexpected return value from backtrace_syminfo %d\n",
+	       i);
+      symdata.failed = 1;
+    }
+
+  if (!symdata.failed)
+    {
+      if (symdata.name == NULL)
+	{
+	  fprintf (stderr, "test5: NULL syminfo name\n");
+	  symdata.failed = 1;
+	}
+      else if (strcmp (symdata.name, "global") != 0)
+	{
+	  fprintf (stderr,
+		   "test5: unexpected syminfo name got %s expected %s\n",
+		   symdata.name, "global");
+	  symdata.failed = 1;
+	}
+      else if (symdata.val != (uintptr_t) &global)
+	{
+	  fprintf (stderr,
+		   "test5: unexpected syminfo value got %lx expected %lx\n",
+		   (unsigned long) symdata.val,
+		   (unsigned long) (uintptr_t) &global);
+	  symdata.failed = 1;
+	}
+      else if (symdata.size != sizeof (global))
+	{
+	  fprintf (stderr,
+		   "test5: unexpected syminfo size got %lx expected %lx\n",
+		   (unsigned long) symdata.size,
+		   (unsigned long) sizeof (global));
+	  symdata.failed = 1;
+	}
+    }
+
+  printf ("%s: backtrace_syminfo variable\n",
+	  symdata.failed ? "FAIL" : "PASS");
+
+  if (symdata.failed)
+    ++failures;
+
+  return failures;
+}
+
+#endif /* BACKTRACE_SUPPORTS_DATA  */
+
+static void
+error_callback_create (void *data ATTRIBUTE_UNUSED, const char *msg,
+		       int errnum)
+{
+  fprintf (stderr, "%s", msg);
+  if (errnum > 0)
+    fprintf (stderr, ": %s", strerror (errnum));
+  fprintf (stderr, "\n");
+  exit (EXIT_FAILURE);
+}
+
+/* Run all the tests.  */
+
+int
+main (int argc ATTRIBUTE_UNUSED, char **argv)
+{
+  state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS,
+				  error_callback_create, NULL);
+
+#if BACKTRACE_SUPPORTED
+  test1 ();
+  test2 ();
+  test3 ();
+  test4 ();
+#if BACKTRACE_SUPPORTS_DATA
+  test5 ();
+#endif
+#endif
+
+  exit (failures ? EXIT_FAILURE : EXIT_SUCCESS);
+}
new file mode 100755
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/config.guess
@@ -0,0 +1,1462 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
+
+timestamp='2016-10-02'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+#
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+#
+# Please send patches to <config-patches@gnu.org>.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright 1992-2016 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+	# If the system lacks a compiler, then just pick glibc.
+	# We could probably try harder.
+	LIBC=gnu
+
+	eval $set_cc_for_build
+	cat <<-EOF > $dummy.c
+	#include <features.h>
+	#if defined(__UCLIBC__)
+	LIBC=uclibc
+	#elif defined(__dietlibc__)
+	LIBC=dietlibc
+	#else
+	LIBC=gnu
+	#endif
+	EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	;;
+esac
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    earmv*)
+		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
+		;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently (or will in the future) and ABI.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		os=netbsdelf
+		;;
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep -q __ELF__
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+		os=netbsd
+		;;
+	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}${abi}"
+	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:LibertyBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:Sortix:*:*)
+	echo ${UNAME_MACHINE}-unknown-sortix
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE=alpha ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE=alpha ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE=alpha ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE=alphaev5 ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE=alphaev56 ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE=alphapca56 ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE=alphapca57 ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE=alphaev6 ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE=alphaev67 ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE=alphaev68 ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE=alphaev68 ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE=alphaev68 ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE=alphaev69 ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE=alphaev7 ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE=alphaev79 ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	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.
+	exitcode=$?
+	trap '' 0
+	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:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+	echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH=i386
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH=x86_64
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????: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
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[4567])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/lslpp ] ; then
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH=hppa2.0n ;;
+			  64) HP_ARCH=hppa2.0w ;;
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
+			esac ;;
+		    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^		//' << EOF >$dummy.c
+
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
+
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
+
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
+EOF
+		    (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = hppa2.0w ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep -q __LP64__
+	    then
+		HP_ARCH=hppa2.0w
+	    else
+		HP_ARCH=hppa64
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+	exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+	exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+	exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+	exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    5000:UNIX_System_V:4.*:*)
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW64*:*)
+	echo ${UNAME_MACHINE}-pc-mingw64
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    *:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
+    i*:windows32*:*)
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:*)
+	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	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*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# 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}
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+	esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	else
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+	    fi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    cris:Linux:*:*)
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	exit ;;
+    crisv32:Linux:*:*)
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    frv:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    i*86:Linux:*:*)
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    k1om:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=${UNAME_MACHINE}el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=${UNAME_MACHINE}
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+	;;
+    mips64el:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    openrisc*:Linux:*:*)
+	echo or1k-unknown-linux-${LIBC}
+	exit ;;
+    or32:Linux:*:* | or1k*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-${LIBC}
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
+	esac
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-${LIBC}
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-${LIBC}
+	exit ;;
+    ppc64le:Linux:*:*)
+	echo powerpc64le-unknown-linux-${LIBC}
+	exit ;;
+    ppcle:Linux:*:*)
+	echo powerpcle-unknown-linux-${LIBC}
+	exit ;;
+    riscv32:Linux:*:* | riscv64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+	exit ;;
+    sh64*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+	exit ;;
+    x86_64:Linux:*:*)
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+	exit ;;
+    xtensa*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+	# Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configure will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+	exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel@ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+		echo mips-nec-sysv${UNAME_RELEASE}
+	else
+		echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+	exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
+    x86_64:Haiku:*:*)
+	echo x86_64-unknown-haiku
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-ACE:SUPER-UX:*:*)
+	echo sxace-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	eval $set_cc_for_build
+	if test "$UNAME_PROCESSOR" = unknown ; then
+	    UNAME_PROCESSOR=powerpc
+	fi
+	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		    (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+		    grep IS_64BIT_ARCH >/dev/null
+		then
+		    case $UNAME_PROCESSOR in
+			i386) UNAME_PROCESSOR=x86_64 ;;
+			powerpc) UNAME_PROCESSOR=powerpc64 ;;
+		    esac
+		fi
+	    fi
+	elif test "$UNAME_PROCESSOR" = i386 ; then
+	    # Avoid executing cc on OS X 10.9, as it ships with a stub
+	    # that puts up a graphical alert prompting to install
+	    # 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
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = x86; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSE-*:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = 386; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+	echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
+    amd64:Isilon\ OneFS:*:*)
+	echo x86_64-unknown-onefs
+	exit ;;
+esac
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+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
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/config.h.in
@@ -0,0 +1,134 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* ELF size: 32 or 64 */
+#undef BACKTRACE_ELF_SIZE
+
+/* Define to 1 if you have the __atomic functions */
+#undef HAVE_ATOMIC_FUNCTIONS
+
+/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRNLEN
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if dl_iterate_phdr is available. */
+#undef HAVE_DL_ITERATE_PHDR
+
+/* Define to 1 if you have the fcntl function */
+#undef HAVE_FCNTL
+
+/* Define if getexecname is available. */
+#undef HAVE_GETEXECNAME
+
+/* Define if _Unwind_GetIPInfo is available. */
+#undef HAVE_GETIPINFO
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <link.h> header file. */
+#undef HAVE_LINK_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the __sync functions */
+#undef HAVE_SYNC_FUNCTIONS
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `char', as computed by sizeof. */
+#undef SIZEOF_CHAR
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
new file mode 100755
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/config.sub
@@ -0,0 +1,1825 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright 1992-2016 Free Software Foundation, Inc.
+
+timestamp='2016-11-19'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches to <config-patches@gnu.org>.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2016 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  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
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-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/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| aarch64 | aarch64_be \
+	| 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)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
+	# 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
+	# 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)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-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*)
+		basic_machine=powerpc-ibm
+		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*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	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)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		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])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-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)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		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)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		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)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		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)
+		basic_machine=np1-gould
+		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		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)
+		basic_machine=hppa1.1-hitachi
+		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)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-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-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-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-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-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)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tile*)
+		basic_machine=$basic_machine-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+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
+		;;
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -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* | -glidix* \
+	      | -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*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+	-nacl*)
+		;;
+	-ios)
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	score-*)
+		os=-elf
+		;;
+	spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	c8051-*)
+		os=-elf
+		;;
+	hexagon-*)
+		os=-elf
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-cnk*|-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
new file mode 100755
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/configure
@@ -0,0 +1,15189 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.64 for package-unused version-unused.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+# Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+	# neutralization value for shells without unset; and this also
+	# works around shells that cannot unset nonexistent variables.
+	BASH_ENV=/dev/null
+	ENV=/dev/null
+	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+	export CONFIG_SHELL
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  fi
+  $as_echo "$as_me: error: $1" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='package-unused'
+PACKAGE_TARNAME='libbacktrace'
+PACKAGE_VERSION='version-unused'
+PACKAGE_STRING='package-unused version-unused'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+ac_unique_file="backtrace.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+NATIVE_FALSE
+NATIVE_TRUE
+BACKTRACE_USES_MALLOC
+ALLOC_FILE
+VIEW_FILE
+BACKTRACE_SUPPORTS_DATA
+BACKTRACE_SUPPORTED
+FORMAT_FILE
+BACKTRACE_SUPPORTS_THREADS
+PIC_FLAG
+WARN_FLAGS
+EXTRA_FLAGS
+BACKTRACE_FILE
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+AR
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
+LIBTOOL
+RANLIB
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+libtool_VERSION
+EGREP
+GREP
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+multi_basedir
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_multilib
+enable_maintainer_mode
+with_target_subdir
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+with_system_libunwind
+enable_host_shared
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information."
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures package-unused version-unused to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/libbacktrace]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of package-unused version-unused:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-multilib       build many library versions (default)
+  --enable-maintainer-mode  enable make rules and dependencies not useful
+			  (and sometimes confusing) to the casual installer
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-host-shared    build host code as shared libraries
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-target-subdir=SUBDIR      Configuring in a subdirectory for target
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-system-libunwind use installed libunwind
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+package-unused configure version-unused
+generated by GNU Autoconf 2.64
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  return $ac_retval
+
+} # ac_fn_c_compute_int
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR
+# ------------------------------------
+# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+ac_fn_c_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
+#endif
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_decl
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by package-unused $as_me version-unused, which was
+generated by GNU Autoconf 2.64.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+if test -n "${with_target_subdir}"; then
+  # Default to --enable-multilib
+# Check whether --enable-multilib was given.
+if test "${enable_multilib+set}" = set; then :
+  enableval=$enable_multilib; case "$enableval" in
+  yes) multilib=yes ;;
+  no)  multilib=no ;;
+  *)   as_fn_error "bad value $enableval for multilib option" "$LINENO" 5 ;;
+ esac
+else
+  multilib=yes
+fi
+
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+  if test "$with_target_subdir" != "."; then
+    multi_basedir="$srcdir/$with_multisrctop../.."
+  else
+    multi_basedir="$srcdir/$with_multisrctop.."
+  fi
+else
+  multi_basedir="$srcdir/.."
+fi
+
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+   && test "x${with_multisubdir}" != x ; then
+   cross_compiling=maybe
+fi
+
+ac_config_commands="$ac_config_commands default-1"
+
+fi
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  for ac_t in install-sh install.sh shtool; do
+    if test -f "$ac_dir/$ac_t"; then
+      ac_aux_dir=$ac_dir
+      ac_install_sh="$ac_aux_dir/$ac_t -c"
+      break 2
+    fi
+  done
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if test "${ac_cv_target+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+target_alias=${target_alias-$host_alias}
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then :
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "C compiler cannot create executables
+See \`config.log' for more details." "$LINENO" 5; }; }
+fi
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = x""yes; then :
+  MINIX=yes
+else
+  MINIX=
+fi
+
+
+  if test "$MINIX" = yes; then
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+
+
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define _MINIX 1" >>confdefs.h
+
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#	  define __EXTENSIONS__ 1
+	  $ac_includes_default
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_safe_to_define___extensions__=yes
+else
+  ac_cv_safe_to_define___extensions__=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+  test $ac_cv_safe_to_define___extensions__ = yes &&
+    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
+
+  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
+
+  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+
+libtool_VERSION=1:0:0
+
+
+# 1.11.1: Require that version of automake.
+# foreign: Don't require README, INSTALL, NEWS, etc.
+# no-define: Don't define PACKAGE and VERSION.
+# no-dependencies: Don't generate automatic dependencies.
+#    (because it breaks when using bootstrap-lean, since some of the
+#    headers are gone at "make install" time).
+# -Wall: Issue all automake warnings.
+# -Wno-portability: Don't warn about constructs supported by GNU make.
+#    (because GCC requires GNU make anyhow).
+am__api_version='1.11'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
+    as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      as_fn_error "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   as_fn_error "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+  done
+IFS=$as_save_IFS
+
+fi
+
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    test -d ./--version && rmdir ./--version
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='libbacktrace'
+ VERSION='version-unused'
+
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+    # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+   if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+
+# Check whether --with-target-subdir was given.
+if test "${with_target_subdir+set}" = set; then :
+  withval=$with_target_subdir;
+fi
+
+
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+case "$AWK" in
+"") as_fn_error "can't build without awk" "$LINENO" 5 ;;
+esac
+
+case `pwd` in
+  *\ * | *\	*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.2.7a'
+macro_revision='1.3134'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`print -r -- -n 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if test "${ac_cv_path_FGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$DUMPBIN" && break
+  done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in dumpbin "link -dump"
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_DUMPBIN" && break
+done
+
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DUMPBIN=$ac_ct_DUMPBIN
+  fi
+fi
+
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[	 ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="ar"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+const struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    case `/usr/bin/file conftest.o` in
+	      *x86-64*)
+		LD="${LD-ld} -m elf32_x86_64"
+		;;
+	      *)
+		LD="${LD-ld} -m elf_i386"
+		;;
+	    esac
+	    ;;
+	  powerpc64le-*linux*)
+	    LD="${LD-ld} -m elf32lppclinux"
+	    ;;
+	  powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  powerpcle-*linux*)
+	    LD="${LD-ld} -m elf64lppc"
+	    ;;
+	  powerpc-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
+  fi
+else
+  LIPO="$ac_cv_prog_LIPO"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
+else
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
+else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&5
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
+else
+  lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if test "${lt_cv_ld_force_load+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[012][,.]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+
+
+
+        enable_dlopen=no
+
+
+  enable_win32_dll=no
+
+
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+
+
+
+
+
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='--shared'
+	lt_prog_compiler_static='--static'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-qpic'
+	lt_prog_compiler_static='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  whole_archive_flag_spec=
+	  tmp_sharedflag='--shared' ;;
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+	  hardcode_libdir_flag_spec=
+	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      export_dynamic_flag_spec='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_from_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec=''
+  fi
+  link_all_deplibs=yes
+  allow_undefined_flag="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+  else
+  ld_shlibs=no
+  fi
+
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld='+b $libdir'
+	hardcode_libdir_separator=:
+	hardcode_direct=yes
+	hardcode_direct_absolute=yes
+	export_dynamic_flag_spec='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if test "${lt_cv_prog_compiler__b+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  hardcode_direct_absolute=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo(void) {}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+        LDFLAGS="$save_LDFLAGS"
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	hardcode_direct_absolute=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	export_dynamic_flag_spec='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if test "${lt_cv_archive_cmds_need_lc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[23].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if test "${lt_cv_shlibpath_overrides_runpath+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+    ;;
+
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = x""yes; then :
+  lt_cv_dlopen="shl_load"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
+else
+  ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
+else
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
+else
+  ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 11134 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#endif
+
+void fnord () { int i=42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 11240 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#endif
+
+void fnord () { int i=42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  # Report which library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+        ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+backtrace_supported=yes
+
+if test -n "${with_target_subdir}"; then
+  # We are compiling a GCC library.  We can assume that the unwind
+  # library exists.
+  BACKTRACE_FILE="backtrace.lo simple.lo"
+else
+  ac_fn_c_check_header_mongrel "$LINENO" "unwind.h" "ac_cv_header_unwind_h" "$ac_includes_default"
+if test "x$ac_cv_header_unwind_h" = x""yes; then :
+  ac_fn_c_check_func "$LINENO" "_Unwind_Backtrace" "ac_cv_func__Unwind_Backtrace"
+if test "x$ac_cv_func__Unwind_Backtrace" = x""yes; then :
+  BACKTRACE_FILE="backtrace.lo simple.lo"
+else
+  BACKTRACE_FILE="nounwind.lo"
+                    backtrace_supported=no
+fi
+
+else
+  BACKTRACE_FILE="nounwind.lo"
+     backtrace_supported=no
+fi
+
+
+fi
+
+
+EXTRA_FLAGS=
+if test -n "${with_target_subdir}"; then
+  EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -funwind-tables option" >&5
+$as_echo_n "checking for -funwind-tables option... " >&6; }
+if test "${libbacktrace_cv_c_unwind_tables+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  CFLAGS_hold="$CFLAGS"
+     CFLAGS="$CFLAGS -funwind-tables"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+static int f() { return 0; }
+int
+main ()
+{
+return f();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libbacktrace_cv_c_unwind_tables=yes
+else
+  libbacktrace_cv_c_unwind_tables=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     CFLAGS="$CFLAGS_hold"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_c_unwind_tables" >&5
+$as_echo "$libbacktrace_cv_c_unwind_tables" >&6; }
+  if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
+    EXTRA_FLAGS=-funwind-tables
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -frandom-seed=string option" >&5
+$as_echo_n "checking for -frandom-seed=string option... " >&6; }
+if test "${libbacktrace_cv_c_random_seed_string+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  CFLAGS_hold="$CFLAGS"
+     CFLAGS="$CFLAGS -frandom-seed=conftest.lo"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libbacktrace_cv_c_random_seed_string=yes
+else
+  libbacktrace_cv_c_random_seed_string=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     CFLAGS="$CFLAGS_hold"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_c_random_seed_string" >&5
+$as_echo "$libbacktrace_cv_c_random_seed_string" >&6; }
+  if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then
+    EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@"
+  fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+WARN_FLAGS=
+save_CFLAGS="$CFLAGS"
+for real_option in -W -Wall -Wwrite-strings -Wstrict-prototypes \
+			  -Wmissing-prototypes -Wold-style-definition \
+			  -Wmissing-format-attribute -Wcast-qual; do
+  # Do the check with the no- prefix removed since gcc silently
+  # accepts any -Wno-* option on purpose
+  case $real_option in
+    -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
+    *) option=$real_option ;;
+  esac
+  as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5
+$as_echo_n "checking whether $CC supports $option... " >&6; }
+if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  CFLAGS="$option"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_acx_Woption=yes"
+else
+  eval "$as_acx_Woption=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+eval ac_res=\$$as_acx_Woption
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then :
+  WARN_FLAGS="$WARN_FLAGS${WARN_FLAGS:+ }$real_option"
+fi
+  done
+CFLAGS="$save_CFLAGS"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+if test -n "${with_target_subdir}"; then
+  WARN_FLAGS="$WARN_FLAGS -Werror"
+fi
+
+
+
+if test -n "${with_target_subdir}"; then
+
+
+# Check whether --with-system-libunwind was given.
+if test "${with_system_libunwind+set}" = set; then :
+  withval=$with_system_libunwind;
+fi
+
+  # If system-libunwind was not specifically set, pick a default setting.
+  if test x$with_system_libunwind = x; then
+    case ${target} in
+      ia64-*-hpux*) with_system_libunwind=yes ;;
+      *) with_system_libunwind=no ;;
+    esac
+  fi
+  # Based on system-libunwind and target, do we have ipinfo?
+  if  test x$with_system_libunwind = xyes; then
+    case ${target} in
+      ia64-*-*) have_unwind_getipinfo=no ;;
+      *) have_unwind_getipinfo=yes ;;
+    esac
+  else
+    # Darwin before version 9 does not have _Unwind_GetIPInfo.
+
+    case ${target} in
+      *-*-darwin[3-8]|*-*-darwin[3-8].*) have_unwind_getipinfo=no ;;
+      *) have_unwind_getipinfo=yes ;;
+    esac
+
+  fi
+
+  if test x$have_unwind_getipinfo = xyes; then
+
+$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h
+
+  fi
+
+else
+  ac_save_CFFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Unwind_GetIPInfo" >&5
+$as_echo_n "checking for _Unwind_GetIPInfo... " >&6; }
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "unwind.h"
+	struct _Unwind_Context *context;
+	int ip_before_insn = 0;
+int
+main ()
+{
+return _Unwind_GetIPInfo (context, &ip_before_insn);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  have_unwind_getipinfo=yes
+else
+  have_unwind_getipinfo=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  CFLAGS="$ac_save_CFLAGS"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unwind_getipinfo" >&5
+$as_echo "$have_unwind_getipinfo" >&6; }
+  if test "$have_unwind_getipinfo" = "yes"; then
+
+$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h
+
+  fi
+fi
+
+# Enable --enable-host-shared.
+# Check whether --enable-host-shared was given.
+if test "${enable_host_shared+set}" = set; then :
+  enableval=$enable_host_shared; PIC_FLAG=-fPIC
+else
+  PIC_FLAG=
+fi
+
+
+
+# Test for __sync support.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __sync extensions" >&5
+$as_echo_n "checking __sync extensions... " >&6; }
+if test "${libbacktrace_cv_sys_sync+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "${with_target_subdir}"; then
+   case "${host}" in
+   hppa*-*-hpux*) libbacktrace_cv_sys_sync=no ;;
+   *) libbacktrace_cv_sys_sync=yes ;;
+   esac
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int i;
+int
+main ()
+{
+__sync_bool_compare_and_swap (&i, i, i);
+                       __sync_lock_test_and_set (&i, 1);
+                       __sync_lock_release (&i);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  libbacktrace_cv_sys_sync=yes
+else
+  libbacktrace_cv_sys_sync=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_sys_sync" >&5
+$as_echo "$libbacktrace_cv_sys_sync" >&6; }
+BACKTRACE_SUPPORTS_THREADS=0
+if test "$libbacktrace_cv_sys_sync" = "yes"; then
+  BACKTRACE_SUPPORTS_THREADS=1
+
+$as_echo "#define HAVE_SYNC_FUNCTIONS 1" >>confdefs.h
+
+fi
+
+
+# Test for __atomic support.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __atomic extensions" >&5
+$as_echo_n "checking __atomic extensions... " >&6; }
+if test "${libbacktrace_cv_sys_atomic+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "${with_target_subdir}"; then
+   libbacktrace_cv_sys_atomic=yes
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int i;
+int
+main ()
+{
+__atomic_load_n (&i, __ATOMIC_ACQUIRE);
+		       __atomic_store_n (&i, 1, __ATOMIC_RELEASE);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  libbacktrace_cv_sys_atomic=yes
+else
+  libbacktrace_cv_sys_atomic=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_sys_atomic" >&5
+$as_echo "$libbacktrace_cv_sys_atomic" >&6; }
+if test "$libbacktrace_cv_sys_atomic" = "yes"; then
+
+$as_echo "#define HAVE_ATOMIC_FUNCTIONS 1" >>confdefs.h
+
+fi
+
+# The library needs to be able to read the executable itself.  Compile
+# a file to determine the executable format.  The awk script
+# filetype.awk prints out the file type.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking output filetype" >&5
+$as_echo_n "checking output filetype... " >&6; }
+if test "${libbacktrace_cv_sys_filetype+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  filetype=
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int i;
+int
+main ()
+{
+int j;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "compiler failed
+See \`config.log' for more details." "$LINENO" 5; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+libbacktrace_cv_sys_filetype=$filetype
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_sys_filetype" >&5
+$as_echo "$libbacktrace_cv_sys_filetype" >&6; }
+
+# Match the file type to decide what files to compile.
+FORMAT_FILE=
+backtrace_supports_data=yes
+case "$libbacktrace_cv_sys_filetype" in
+elf*) FORMAT_FILE="elf.lo" ;;
+pecoff) FORMAT_FILE="pecoff.lo"
+        backtrace_supports_data=no
+	;;
+*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not determine output file type" >&5
+$as_echo "$as_me: WARNING: could not determine output file type" >&2;}
+   FORMAT_FILE="unknown.lo"
+   backtrace_supported=no
+   ;;
+esac
+
+
+# ELF defines.
+elfsize=
+case "$libbacktrace_cv_sys_filetype" in
+elf32) elfsize=32 ;;
+elf64) elfsize=64 ;;
+*)     elfsize=unused
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define BACKTRACE_ELF_SIZE $elfsize
+_ACEOF
+
+
+BACKTRACE_SUPPORTED=0
+if test "$backtrace_supported" = "yes"; then
+  BACKTRACE_SUPPORTED=1
+fi
+
+
+BACKTRACE_SUPPORTS_DATA=0
+if test "$backtrace_supports_data" = "yes"; then
+  BACKTRACE_SUPPORTS_DATA=1
+fi
+
+
+
+
+inttype_headers=`echo inttypes.h sys/inttypes.h  | sed -e 's/,/ /g'`
+
+acx_cv_header_stdint=stddef.h
+acx_cv_header_stdint_kind="(already complete)"
+for i in stdint.h $inttype_headers; do
+  unset ac_cv_type_uintptr_t
+  unset ac_cv_type_uintmax_t
+  unset ac_cv_type_int_least32_t
+  unset ac_cv_type_int_fast32_t
+  unset ac_cv_type_uint64_t
+  $as_echo_n "looking for a compliant stdint.h in $i, " >&6
+  ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uintmax_t" = x""yes; then :
+  acx_cv_header_stdint=$i
+else
+  continue
+fi
+
+  ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uintptr_t" = x""yes; then :
+
+else
+  acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+  ac_fn_c_check_type "$LINENO" "int_least32_t" "ac_cv_type_int_least32_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_int_least32_t" = x""yes; then :
+
+else
+  acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+  ac_fn_c_check_type "$LINENO" "int_fast32_t" "ac_cv_type_int_fast32_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_int_fast32_t" = x""yes; then :
+
+else
+  acx_cv_header_stdint_kind="(mostly complete)"
+fi
+
+  ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uint64_t" = x""yes; then :
+
+else
+  acx_cv_header_stdint_kind="(lacks uint64_t)"
+fi
+
+  break
+done
+if test "$acx_cv_header_stdint" = stddef.h; then
+  acx_cv_header_stdint_kind="(lacks uintmax_t)"
+  for i in stdint.h $inttype_headers; do
+    unset ac_cv_type_uintptr_t
+    unset ac_cv_type_uint32_t
+    unset ac_cv_type_uint64_t
+    $as_echo_n "looking for an incomplete stdint.h in $i, " >&6
+    ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uint32_t" = x""yes; then :
+  acx_cv_header_stdint=$i
+else
+  continue
+fi
+
+    ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uint64_t" = x""yes; then :
+
+fi
+
+    ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_uintptr_t" = x""yes; then :
+
+fi
+
+    break
+  done
+fi
+if test "$acx_cv_header_stdint" = stddef.h; then
+  acx_cv_header_stdint_kind="(u_intXX_t style)"
+  for i in sys/types.h $inttype_headers; do
+    unset ac_cv_type_u_int32_t
+    unset ac_cv_type_u_int64_t
+    $as_echo_n "looking for u_intXX_t types in $i, " >&6
+    ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_u_int32_t" = x""yes; then :
+  acx_cv_header_stdint=$i
+else
+  continue
+fi
+
+    ac_fn_c_check_type "$LINENO" "u_int64_t" "ac_cv_type_u_int64_t" "#include <sys/types.h>
+#include <$i>
+"
+if test "x$ac_cv_type_u_int64_t" = x""yes; then :
+
+fi
+
+    break
+  done
+fi
+if test "$acx_cv_header_stdint" = stddef.h; then
+  acx_cv_header_stdint_kind="(using manual detection)"
+fi
+
+test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no
+test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no
+test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no
+test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no
+test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no
+
+# ----------------- Summarize what we found so far
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what to include in gstdint.h" >&5
+$as_echo_n "checking what to include in gstdint.h... " >&6; }
+
+case `$as_basename -- gstdint.h ||
+$as_expr X/gstdint.h : '.*/\([^/][^/]*\)/*$' \| \
+	 Xgstdint.h : 'X\(//\)$' \| \
+	 Xgstdint.h : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/gstdint.h |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'` in
+  stdint.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5
+$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
+  inttypes.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5
+$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;;
+  *) ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5
+$as_echo "$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6; }
+
+# ----------------- done included file, check C basic types --------
+
+# Lacking an uintptr_t?  Test size of void *
+case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in
+  stddef.h:* | *:no) # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if test "${ac_cv_sizeof_void_p+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_void_p" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (void *)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_void_p=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+ ;;
+esac
+
+# Lacking an uint64_t?  Test size of long
+case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in
+  stddef.h:*:* | *:no:no) # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_long=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+ ;;
+esac
+
+if test $acx_cv_header_stdint = stddef.h; then
+  # Lacking a good header?  Test size of everything and deduce all types.
+  # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if test "${ac_cv_sizeof_int+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_int" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (int)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_int=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+  # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if test "${ac_cv_sizeof_short+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_short" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (short)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_short=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+  # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5
+$as_echo_n "checking size of char... " >&6; }
+if test "${ac_cv_sizeof_char+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_char" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (char)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_char=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5
+$as_echo "$ac_cv_sizeof_char" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHAR $ac_cv_sizeof_char
+_ACEOF
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int8_t" >&5
+$as_echo_n "checking for type equivalent to int8_t... " >&6; }
+  case "$ac_cv_sizeof_char" in
+    1) acx_cv_type_int8_t=char ;;
+    *) as_fn_error "no 8-bit type, please report a bug" "$LINENO" 5
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int8_t" >&5
+$as_echo "$acx_cv_type_int8_t" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int16_t" >&5
+$as_echo_n "checking for type equivalent to int16_t... " >&6; }
+  case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in
+    2:*) acx_cv_type_int16_t=int ;;
+    *:2) acx_cv_type_int16_t=short ;;
+    *) as_fn_error "no 16-bit type, please report a bug" "$LINENO" 5
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int16_t" >&5
+$as_echo "$acx_cv_type_int16_t" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int32_t" >&5
+$as_echo_n "checking for type equivalent to int32_t... " >&6; }
+  case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in
+    4:*) acx_cv_type_int32_t=int ;;
+    *:4) acx_cv_type_int32_t=long ;;
+    *) as_fn_error "no 32-bit type, please report a bug" "$LINENO" 5
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int32_t" >&5
+$as_echo "$acx_cv_type_int32_t" >&6; }
+fi
+
+# These tests are here to make the output prettier
+
+if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then
+  case "$ac_cv_sizeof_long" in
+    8) acx_cv_type_int64_t=long ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int64_t" >&5
+$as_echo_n "checking for type equivalent to int64_t... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5
+$as_echo "${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6; }
+fi
+
+# Now we can use the above types
+
+if test "$ac_cv_type_uintptr_t" != yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to intptr_t" >&5
+$as_echo_n "checking for type equivalent to intptr_t... " >&6; }
+  case $ac_cv_sizeof_void_p in
+    2) acx_cv_type_intptr_t=int16_t ;;
+    4) acx_cv_type_intptr_t=int32_t ;;
+    8) acx_cv_type_intptr_t=int64_t ;;
+    *) as_fn_error "no equivalent for intptr_t, please report a bug" "$LINENO" 5
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_intptr_t" >&5
+$as_echo "$acx_cv_type_intptr_t" >&6; }
+fi
+
+# ----------------- done all checks, emit header -------------
+ac_config_commands="$ac_config_commands gstdint.h"
+
+
+
+
+for ac_header in sys/mman.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_mman_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_MMAN_H 1
+_ACEOF
+
+fi
+
+done
+
+if test "$ac_cv_header_sys_mman_h" = "no"; then
+  have_mmap=no
+else
+  if test -n "${with_target_subdir}"; then
+    # When built as a GCC target library, we can't do a link test.  We
+    # simply assume that if we have mman.h, we have mmap.
+    have_mmap=yes
+    case "${host}" in
+    spu-*-*|*-*-msdosdjgpp)
+        # The SPU does not have mmap, but it has a sys/mman.h header file
+        # containing "mmap_eaddr" and the mmap flags, confusing the test.
+        # DJGPP also has sys/man.h, but no mmap
+	have_mmap=no ;;
+    esac
+  else
+    ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap"
+if test "x$ac_cv_func_mmap" = x""yes; then :
+  have_mmap=yes
+else
+  have_mmap=no
+fi
+
+  fi
+fi
+if test "$have_mmap" = "no"; then
+  VIEW_FILE=read.lo
+  ALLOC_FILE=alloc.lo
+else
+  VIEW_FILE=mmapio.lo
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/mman.h>
+#if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
+  #error no MAP_ANONYMOUS
+#endif
+
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ALLOC_FILE=mmap.lo
+else
+  ALLOC_FILE=alloc.lo
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+
+
+
+BACKTRACE_USES_MALLOC=0
+if test "$ALLOC_FILE" = "alloc.lo"; then
+  BACKTRACE_USES_MALLOC=1
+fi
+
+
+# Check for dl_iterate_phdr.
+for ac_header in link.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "link.h" "ac_cv_header_link_h" "$ac_includes_default"
+if test "x$ac_cv_header_link_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LINK_H 1
+_ACEOF
+
+fi
+
+done
+
+if test "$ac_cv_header_link_h" = "no"; then
+  have_dl_iterate_phdr=no
+else
+  if test -n "${with_target_subdir}"; then
+    # When built as a GCC target library, we can't do a link test.
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <link.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "dl_iterate_phdr" >/dev/null 2>&1; then :
+  have_dl_iterate_phdr=yes
+else
+  have_dl_iterate_phdr=no
+fi
+rm -f conftest*
+
+    case "${host}" in
+    *-*-solaris2.10*)
+        # Avoid dl_iterate_phdr on Solaris 10, where it is in the
+    	# header file but is only in -ldl.
+	have_dl_iterate_phdr=no ;;
+    esac
+  else
+    ac_fn_c_check_func "$LINENO" "dl_iterate_phdr" "ac_cv_func_dl_iterate_phdr"
+if test "x$ac_cv_func_dl_iterate_phdr" = x""yes; then :
+  have_dl_iterate_phdr=yes
+else
+  have_dl_iterate_phdr=no
+fi
+
+  fi
+fi
+if test "$have_dl_iterate_phdr" = "yes"; then
+
+$as_echo "#define HAVE_DL_ITERATE_PHDR 1" >>confdefs.h
+
+fi
+
+# Check for the fcntl function.
+if test -n "${with_target_subdir}"; then
+   case "${host}" in
+   *-*-mingw*) have_fcntl=no ;;
+   spu-*-*) have_fcntl=no ;;
+   *) have_fcntl=yes ;;
+   esac
+else
+  ac_fn_c_check_func "$LINENO" "fcntl" "ac_cv_func_fcntl"
+if test "x$ac_cv_func_fcntl" = x""yes; then :
+  have_fcntl=yes
+else
+  have_fcntl=no
+fi
+
+fi
+if test "$have_fcntl" = "yes"; then
+
+$as_echo "#define HAVE_FCNTL 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strnlen" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRNLEN $ac_have_decl
+_ACEOF
+
+
+# Check for getexecname function.
+if test -n "${with_target_subdir}"; then
+   case "${host}" in
+   *-*-solaris2*) have_getexecname=yes ;;
+   *) have_getexecname=no ;;
+   esac
+else
+  ac_fn_c_check_func "$LINENO" "getexecname" "ac_cv_func_getexecname"
+if test "x$ac_cv_func_getexecname" = x""yes; then :
+  have_getexecname=yes
+else
+  have_getexecname=no
+fi
+
+fi
+if test "$have_getexecname" = "yes"; then
+
+$as_echo "#define HAVE_GETEXECNAME 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tests can run" >&5
+$as_echo_n "checking whether tests can run... " >&6; }
+if test "${libbacktrace_cv_sys_native+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  libbacktrace_cv_sys_native=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  libbacktrace_cv_sys_native=yes
+else
+  libbacktrace_cv_sys_native=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_sys_native" >&5
+$as_echo "$libbacktrace_cv_sys_native" >&6; }
+ if test "$libbacktrace_cv_sys_native" = "yes"; then
+  NATIVE_TRUE=
+  NATIVE_FALSE='#'
+else
+  NATIVE_TRUE='#'
+  NATIVE_FALSE=
+fi
+
+
+if test "${multilib}" = "yes"; then
+  multilib_arg="--enable-multilib"
+else
+  multilib_arg=
+fi
+
+ac_config_files="$ac_config_files Makefile backtrace-supported.h"
+
+
+# We need multilib support, but only if configuring for the target.
+ac_config_commands="$ac_config_commands default"
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${NATIVE_TRUE}" && test -z "${NATIVE_FALSE}"; then
+  as_fn_error "conditional \"NATIVE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  fi
+  $as_echo "$as_me: error: $1" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by package-unused $as_me version-unused, which was
+generated by GNU Autoconf 2.64.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+package-unused config.status version-unused
+configured by $0, generated by GNU Autoconf 2.64,
+  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) as_fn_error "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+  *) as_fn_append ac_config_targets " $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} ${ac_configure_args}"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'
+
+
+
+
+GCC="$GCC"
+CC="$CC"
+acx_cv_header_stdint="$acx_cv_header_stdint"
+acx_cv_type_int8_t="$acx_cv_type_int8_t"
+acx_cv_type_int16_t="$acx_cv_type_int16_t"
+acx_cv_type_int32_t="$acx_cv_type_int32_t"
+acx_cv_type_int64_t="$acx_cv_type_int64_t"
+acx_cv_type_intptr_t="$acx_cv_type_intptr_t"
+ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t"
+ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t"
+ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
+ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
+ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t"
+ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
+ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
+ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p"
+
+
+# Variables needed in config.status (file generation) which aren't already
+# passed by autoconf.
+SUBDIRS="$SUBDIRS"
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+    "gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "backtrace-supported.h") CONFIG_FILES="$CONFIG_FILES backtrace-supported.h" ;;
+    "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+
+  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\r'
+else
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = ""
+
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+  || as_fn_error "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_t"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+	`' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  as_dir="$ac_dir"; as_fn_mkdir_p
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+  s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+    } >"$tmp/config.h" \
+      || as_fn_error "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$tmp/config.h" "$ac_file" \
+	|| as_fn_error "could not create $ac_file" "$LINENO" 5
+    fi
+  else
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error "could not create -" "$LINENO" 5
+  fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$_am_arg" : 'X\(//\)[^/]' \| \
+	 X"$_am_arg" : 'X\(//\)$' \| \
+	 X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "default-1":C)
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" Makefile "*)
+   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ;;
+esac ;;
+    "libtool":C)
+
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+  func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
+  esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=${#1}
+}
+
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$1+=\$2"
+}
+_LT_EOF
+    ;;
+  *)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+    ;;
+  esac
+
+
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+ ;;
+    "gstdint.h":C)
+if test "$GCC" = yes; then
+  echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h
+else
+  echo "/* generated for $CC */" > tmp-stdint.h
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+  #ifndef GCC_GENERATED_STDINT_H
+  #define GCC_GENERATED_STDINT_H 1
+
+  #include <sys/types.h>
+EOF
+
+if test "$acx_cv_header_stdint" != stdint.h; then
+  echo "#include <stddef.h>" >> tmp-stdint.h
+fi
+if test "$acx_cv_header_stdint" != stddef.h; then
+  echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+  /* glibc uses these symbols as guards to prevent redefinitions.  */
+  #ifdef __int8_t_defined
+  #define _INT8_T
+  #define _INT16_T
+  #define _INT32_T
+  #endif
+  #ifdef __uint32_t_defined
+  #define _UINT32_T
+  #endif
+
+EOF
+
+# ----------------- done header, emit basic int types -------------
+if test "$acx_cv_header_stdint" = stddef.h; then
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    #ifndef _UINT8_T
+    #define _UINT8_T
+    #ifndef __uint8_t_defined
+    #define __uint8_t_defined
+    #ifndef uint8_t
+    typedef unsigned $acx_cv_type_int8_t uint8_t;
+    #endif
+    #endif
+    #endif
+
+    #ifndef _UINT16_T
+    #define _UINT16_T
+    #ifndef __uint16_t_defined
+    #define __uint16_t_defined
+    #ifndef uint16_t
+    typedef unsigned $acx_cv_type_int16_t uint16_t;
+    #endif
+    #endif
+    #endif
+
+    #ifndef _UINT32_T
+    #define _UINT32_T
+    #ifndef __uint32_t_defined
+    #define __uint32_t_defined
+    #ifndef uint32_t
+    typedef unsigned $acx_cv_type_int32_t uint32_t;
+    #endif
+    #endif
+    #endif
+
+    #ifndef _INT8_T
+    #define _INT8_T
+    #ifndef __int8_t_defined
+    #define __int8_t_defined
+    #ifndef int8_t
+    typedef $acx_cv_type_int8_t int8_t;
+    #endif
+    #endif
+    #endif
+
+    #ifndef _INT16_T
+    #define _INT16_T
+    #ifndef __int16_t_defined
+    #define __int16_t_defined
+    #ifndef int16_t
+    typedef $acx_cv_type_int16_t int16_t;
+    #endif
+    #endif
+    #endif
+
+    #ifndef _INT32_T
+    #define _INT32_T
+    #ifndef __int32_t_defined
+    #define __int32_t_defined
+    #ifndef int32_t
+    typedef $acx_cv_type_int32_t int32_t;
+    #endif
+    #endif
+    #endif
+EOF
+elif test "$ac_cv_type_u_int32_t" = yes; then
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */
+    #ifndef _INT8_T
+    #define _INT8_T
+    #endif
+    #ifndef _INT16_T
+    #define _INT16_T
+    #endif
+    #ifndef _INT32_T
+    #define _INT32_T
+    #endif
+
+    #ifndef _UINT8_T
+    #define _UINT8_T
+    #ifndef __uint8_t_defined
+    #define __uint8_t_defined
+    #ifndef uint8_t
+    typedef u_int8_t uint8_t;
+    #endif
+    #endif
+    #endif
+
+    #ifndef _UINT16_T
+    #define _UINT16_T
+    #ifndef __uint16_t_defined
+    #define __uint16_t_defined
+    #ifndef uint16_t
+    typedef u_int16_t uint16_t;
+    #endif
+    #endif
+    #endif
+
+    #ifndef _UINT32_T
+    #define _UINT32_T
+    #ifndef __uint32_t_defined
+    #define __uint32_t_defined
+    #ifndef uint32_t
+    typedef u_int32_t uint32_t;
+    #endif
+    #endif
+    #endif
+EOF
+else
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* Some systems have guard macros to prevent redefinitions, define them.  */
+    #ifndef _INT8_T
+    #define _INT8_T
+    #endif
+    #ifndef _INT16_T
+    #define _INT16_T
+    #endif
+    #ifndef _INT32_T
+    #define _INT32_T
+    #endif
+    #ifndef _UINT8_T
+    #define _UINT8_T
+    #endif
+    #ifndef _UINT16_T
+    #define _UINT16_T
+    #endif
+    #ifndef _UINT32_T
+    #define _UINT32_T
+    #endif
+EOF
+fi
+
+# ------------- done basic int types, emit int64_t types ------------
+if test "$ac_cv_type_uint64_t" = yes; then
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* system headers have good uint64_t and int64_t */
+    #ifndef _INT64_T
+    #define _INT64_T
+    #endif
+    #ifndef _UINT64_T
+    #define _UINT64_T
+    #endif
+EOF
+elif test "$ac_cv_type_u_int64_t" = yes; then
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* system headers have an u_int64_t (and int64_t) */
+    #ifndef _INT64_T
+    #define _INT64_T
+    #endif
+    #ifndef _UINT64_T
+    #define _UINT64_T
+    #ifndef __uint64_t_defined
+    #define __uint64_t_defined
+    #ifndef uint64_t
+    typedef u_int64_t uint64_t;
+    #endif
+    #endif
+    #endif
+EOF
+elif test -n "$acx_cv_type_int64_t"; then
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* architecture has a 64-bit type, $acx_cv_type_int64_t */
+    #ifndef _INT64_T
+    #define _INT64_T
+    #ifndef int64_t
+    typedef $acx_cv_type_int64_t int64_t;
+    #endif
+    #endif
+    #ifndef _UINT64_T
+    #define _UINT64_T
+    #ifndef __uint64_t_defined
+    #define __uint64_t_defined
+    #ifndef uint64_t
+    typedef unsigned $acx_cv_type_int64_t uint64_t;
+    #endif
+    #endif
+    #endif
+EOF
+else
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* some common heuristics for int64_t, using compiler-specific tests */
+    #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L
+    #ifndef _INT64_T
+    #define _INT64_T
+    #ifndef __int64_t_defined
+    #ifndef int64_t
+    typedef long long int64_t;
+    #endif
+    #endif
+    #endif
+    #ifndef _UINT64_T
+    #define _UINT64_T
+    #ifndef uint64_t
+    typedef unsigned long long uint64_t;
+    #endif
+    #endif
+
+    #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0
+    /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
+       does not implement __extension__.  But that compiler doesn't define
+       __GNUC_MINOR__.  */
+    # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
+    # define __extension__
+    # endif
+
+    # ifndef _INT64_T
+    # define _INT64_T
+    # ifndef int64_t
+    __extension__ typedef long long int64_t;
+    # endif
+    # endif
+    # ifndef _UINT64_T
+    # define _UINT64_T
+    # ifndef uint64_t
+    __extension__ typedef unsigned long long uint64_t;
+    # endif
+    # endif
+
+    #elif !defined __STRICT_ANSI__
+    # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
+
+    #  ifndef _INT64_T
+    #  define _INT64_T
+    #  ifndef int64_t
+    typedef __int64 int64_t;
+    #  endif
+    #  endif
+    #  ifndef _UINT64_T
+    #  define _UINT64_T
+    #  ifndef uint64_t
+    typedef unsigned __int64 uint64_t;
+    #  endif
+    #  endif
+    # endif /* compiler */
+
+    #endif /* ANSI version */
+EOF
+fi
+
+# ------------- done int64_t types, emit intptr types ------------
+if test "$ac_cv_type_uintptr_t" != yes; then
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */
+    #ifndef __uintptr_t_defined
+    #ifndef uintptr_t
+    typedef u$acx_cv_type_intptr_t uintptr_t;
+    #endif
+    #endif
+    #ifndef __intptr_t_defined
+    #ifndef intptr_t
+    typedef $acx_cv_type_intptr_t  intptr_t;
+    #endif
+    #endif
+EOF
+fi
+
+# ------------- done intptr types, emit int_least types ------------
+if test "$ac_cv_type_int_least32_t" != yes; then
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* Define int_least types */
+    typedef int8_t     int_least8_t;
+    typedef int16_t    int_least16_t;
+    typedef int32_t    int_least32_t;
+    #ifdef _INT64_T
+    typedef int64_t    int_least64_t;
+    #endif
+
+    typedef uint8_t    uint_least8_t;
+    typedef uint16_t   uint_least16_t;
+    typedef uint32_t   uint_least32_t;
+    #ifdef _UINT64_T
+    typedef uint64_t   uint_least64_t;
+    #endif
+EOF
+fi
+
+# ------------- done intptr types, emit int_fast types ------------
+if test "$ac_cv_type_int_fast32_t" != yes; then
+      sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* Define int_fast types.  short is often slow */
+    typedef int8_t       int_fast8_t;
+    typedef int          int_fast16_t;
+    typedef int32_t      int_fast32_t;
+    #ifdef _INT64_T
+    typedef int64_t      int_fast64_t;
+    #endif
+
+    typedef uint8_t      uint_fast8_t;
+    typedef unsigned int uint_fast16_t;
+    typedef uint32_t     uint_fast32_t;
+    #ifdef _UINT64_T
+    typedef uint64_t     uint_fast64_t;
+    #endif
+EOF
+fi
+
+if test "$ac_cv_type_uintmax_t" != yes; then
+  sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+    /* Define intmax based on what we found */
+    #ifndef intmax_t
+    #ifdef _INT64_T
+    typedef int64_t       intmax_t;
+    #else
+    typedef long          intmax_t;
+    #endif
+    #endif
+    #ifndef uintmax_t
+    #ifdef _UINT64_T
+    typedef uint64_t      uintmax_t;
+    #else
+    typedef unsigned long uintmax_t;
+    #endif
+    #endif
+EOF
+fi
+
+sed 's/^ *//' >> tmp-stdint.h <<EOF
+
+  #endif /* GCC_GENERATED_STDINT_H */
+EOF
+
+if test -r gstdint.h && cmp -s tmp-stdint.h gstdint.h; then
+  rm -f tmp-stdint.h
+else
+  mv -f tmp-stdint.h gstdint.h
+fi
+
+ ;;
+    "default":C) if test -n "$CONFIG_FILES"; then
+   if test -n "${with_target_subdir}"; then
+     # Multilibs need MULTISUBDIR defined correctly in certain makefiles so
+     # that multilib installs will end up installed in the correct place.
+     # The testsuite needs it for multilib-aware ABI baseline files.
+     # To work around this not being passed down from config-ml.in ->
+     # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
+     # append it here.  Only modify Makefiles that have just been created.
+     #
+     # Also, get rid of this simulated-VPATH thing that automake does.
+     cat > vpsed << \_EOF
+  s!`test -f '$<' || echo '$(srcdir)/'`!!
+_EOF
+     for i in $SUBDIRS; do
+      case $CONFIG_FILES in
+       *${i}/Makefile*)
+	 #echo "Adding MULTISUBDIR to $i/Makefile"
+	 sed -f vpsed $i/Makefile > tmp
+	 grep '^MULTISUBDIR =' Makefile >> tmp
+	 mv tmp $i/Makefile
+	 ;;
+      esac
+     done
+     rm vpsed
+   fi
+ fi
+ ;;
+
+  esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || as_fn_exit $?
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/configure.ac
@@ -0,0 +1,409 @@
+# configure.ac -- Backtrace configure script.
+# Copyright (C) 2012-2016 Free Software Foundation, Inc.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+
+#     (1) Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+
+#     (2) Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+
+#     (3) The name of the author may not be used to
+#     endorse or promote products derived from this software without
+#     specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+AC_PREREQ(2.64)
+AC_INIT(package-unused, version-unused,, libbacktrace)
+AC_CONFIG_SRCDIR(backtrace.h)
+AC_CONFIG_HEADER(config.h)
+
+if test -n "${with_target_subdir}"; then
+  AM_ENABLE_MULTILIB(, ..)
+fi
+
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+
+AC_USE_SYSTEM_EXTENSIONS
+
+libtool_VERSION=1:0:0
+AC_SUBST(libtool_VERSION)
+
+# 1.11.1: Require that version of automake.
+# foreign: Don't require README, INSTALL, NEWS, etc.
+# no-define: Don't define PACKAGE and VERSION.
+# no-dependencies: Don't generate automatic dependencies.
+#    (because it breaks when using bootstrap-lean, since some of the
+#    headers are gone at "make install" time).
+# -Wall: Issue all automake warnings.
+# -Wno-portability: Don't warn about constructs supported by GNU make.
+#    (because GCC requires GNU make anyhow).
+AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies -Wall -Wno-portability])
+
+AM_MAINTAINER_MODE
+
+AC_ARG_WITH(target-subdir,
+[  --with-target-subdir=SUBDIR      Configuring in a subdirectory for target])
+
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+m4_rename([_AC_ARG_VAR_PRECIOUS],[backtrace_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+AC_PROG_CC
+m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+
+AC_SUBST(CFLAGS)
+
+AC_PROG_RANLIB
+
+AC_PROG_AWK
+case "$AWK" in
+"") AC_MSG_ERROR([can't build without awk]) ;;
+esac
+
+LT_INIT
+AM_PROG_LIBTOOL
+
+backtrace_supported=yes
+
+if test -n "${with_target_subdir}"; then
+  # We are compiling a GCC library.  We can assume that the unwind
+  # library exists.
+  BACKTRACE_FILE="backtrace.lo simple.lo"
+else
+  AC_CHECK_HEADER([unwind.h],
+    [AC_CHECK_FUNC([_Unwind_Backtrace],
+	           [BACKTRACE_FILE="backtrace.lo simple.lo"],
+		   [BACKTRACE_FILE="nounwind.lo"
+                    backtrace_supported=no])],
+    [BACKTRACE_FILE="nounwind.lo"
+     backtrace_supported=no])
+fi
+AC_SUBST(BACKTRACE_FILE)
+
+EXTRA_FLAGS=
+if test -n "${with_target_subdir}"; then
+  EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@"
+else
+  AC_CACHE_CHECK([for -funwind-tables option],
+    [libbacktrace_cv_c_unwind_tables],
+    [CFLAGS_hold="$CFLAGS"
+     CFLAGS="$CFLAGS -funwind-tables"
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])],
+       [libbacktrace_cv_c_unwind_tables=yes],
+       [libbacktrace_cv_c_unwind_tables=no])
+     CFLAGS="$CFLAGS_hold"])
+  if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
+    EXTRA_FLAGS=-funwind-tables
+  fi
+  AC_CACHE_CHECK([for -frandom-seed=string option],
+    [libbacktrace_cv_c_random_seed_string],
+    [CFLAGS_hold="$CFLAGS"
+     CFLAGS="$CFLAGS -frandom-seed=conftest.lo"
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([], [return 0;])],
+       [libbacktrace_cv_c_random_seed_string=yes],
+       [libbacktrace_cv_c_random_seed_string=no])
+     CFLAGS="$CFLAGS_hold"])
+  if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then
+    EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@"
+  fi
+fi
+AC_SUBST(EXTRA_FLAGS)
+
+ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
+			  -Wmissing-prototypes -Wold-style-definition \
+			  -Wmissing-format-attribute -Wcast-qual],
+			  [WARN_FLAGS])
+
+if test -n "${with_target_subdir}"; then
+  WARN_FLAGS="$WARN_FLAGS -Werror"
+fi
+
+AC_SUBST(WARN_FLAGS)
+
+if test -n "${with_target_subdir}"; then
+  GCC_CHECK_UNWIND_GETIPINFO
+else
+  ac_save_CFFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
+  AC_MSG_CHECKING([for _Unwind_GetIPInfo])
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM(
+       [#include "unwind.h"
+	struct _Unwind_Context *context;
+	int ip_before_insn = 0;],
+	[return _Unwind_GetIPInfo (context, &ip_before_insn);])],
+	[have_unwind_getipinfo=yes], [have_unwind_getipinfo=no])
+  CFLAGS="$ac_save_CFLAGS"
+  AC_MSG_RESULT([$have_unwind_getipinfo])
+  if test "$have_unwind_getipinfo" = "yes"; then
+    AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
+  fi
+fi
+
+# Enable --enable-host-shared.
+AC_ARG_ENABLE(host-shared,
+[AS_HELP_STRING([--enable-host-shared],
+		[build host code as shared libraries])],
+[PIC_FLAG=-fPIC], [PIC_FLAG=])
+AC_SUBST(PIC_FLAG)
+
+# Test for __sync support.
+AC_CACHE_CHECK([__sync extensions],
+[libbacktrace_cv_sys_sync],
+[if test -n "${with_target_subdir}"; then
+   case "${host}" in
+   hppa*-*-hpux*) libbacktrace_cv_sys_sync=no ;;
+   *) libbacktrace_cv_sys_sync=yes ;;
+   esac
+ else
+   AC_LINK_IFELSE(
+     [AC_LANG_PROGRAM([int i;],
+                      [__sync_bool_compare_and_swap (&i, i, i);
+                       __sync_lock_test_and_set (&i, 1);
+                       __sync_lock_release (&i);])],
+     [libbacktrace_cv_sys_sync=yes],
+     [libbacktrace_cv_sys_sync=no])
+ fi])
+BACKTRACE_SUPPORTS_THREADS=0
+if test "$libbacktrace_cv_sys_sync" = "yes"; then
+  BACKTRACE_SUPPORTS_THREADS=1
+  AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1,
+	    [Define to 1 if you have the __sync functions])
+fi
+AC_SUBST(BACKTRACE_SUPPORTS_THREADS)
+
+# Test for __atomic support.
+AC_CACHE_CHECK([__atomic extensions],
+[libbacktrace_cv_sys_atomic],
+[if test -n "${with_target_subdir}"; then
+   libbacktrace_cv_sys_atomic=yes
+ else
+   AC_LINK_IFELSE(
+     [AC_LANG_PROGRAM([int i;],
+     		      [__atomic_load_n (&i, __ATOMIC_ACQUIRE);
+		       __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])],
+     [libbacktrace_cv_sys_atomic=yes],
+     [libbacktrace_cv_sys_atomic=no])
+ fi])
+if test "$libbacktrace_cv_sys_atomic" = "yes"; then
+  AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1,
+	    [Define to 1 if you have the __atomic functions])
+fi
+
+# The library needs to be able to read the executable itself.  Compile
+# a file to determine the executable format.  The awk script
+# filetype.awk prints out the file type.
+AC_CACHE_CHECK([output filetype],
+[libbacktrace_cv_sys_filetype],
+[filetype=
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([int i;], [int j;])],
+  [filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`],
+  [AC_MSG_FAILURE([compiler failed])])
+libbacktrace_cv_sys_filetype=$filetype])
+
+# Match the file type to decide what files to compile.
+FORMAT_FILE=
+backtrace_supports_data=yes
+case "$libbacktrace_cv_sys_filetype" in
+elf*) FORMAT_FILE="elf.lo" ;;
+pecoff) FORMAT_FILE="pecoff.lo"
+        backtrace_supports_data=no
+	;;
+*) AC_MSG_WARN([could not determine output file type])
+   FORMAT_FILE="unknown.lo"
+   backtrace_supported=no
+   ;;
+esac
+AC_SUBST(FORMAT_FILE)
+
+# ELF defines.
+elfsize=
+case "$libbacktrace_cv_sys_filetype" in
+elf32) elfsize=32 ;;
+elf64) elfsize=64 ;;
+*)     elfsize=unused
+esac
+AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
+
+BACKTRACE_SUPPORTED=0
+if test "$backtrace_supported" = "yes"; then
+  BACKTRACE_SUPPORTED=1
+fi
+AC_SUBST(BACKTRACE_SUPPORTED)
+
+BACKTRACE_SUPPORTS_DATA=0
+if test "$backtrace_supports_data" = "yes"; then
+  BACKTRACE_SUPPORTS_DATA=1
+fi
+AC_SUBST(BACKTRACE_SUPPORTS_DATA)
+
+GCC_HEADER_STDINT(gstdint.h)
+
+AC_CHECK_HEADERS(sys/mman.h)
+if test "$ac_cv_header_sys_mman_h" = "no"; then
+  have_mmap=no
+else
+  if test -n "${with_target_subdir}"; then
+    # When built as a GCC target library, we can't do a link test.  We
+    # simply assume that if we have mman.h, we have mmap.
+    have_mmap=yes
+    case "${host}" in
+    spu-*-*|*-*-msdosdjgpp)
+        # The SPU does not have mmap, but it has a sys/mman.h header file
+        # containing "mmap_eaddr" and the mmap flags, confusing the test.
+        # DJGPP also has sys/man.h, but no mmap
+	have_mmap=no ;;
+    esac
+  else
+    AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no])
+  fi
+fi
+if test "$have_mmap" = "no"; then
+  VIEW_FILE=read.lo
+  ALLOC_FILE=alloc.lo
+else
+  VIEW_FILE=mmapio.lo
+  AC_PREPROC_IFELSE([
+#include <sys/mman.h>
+#if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
+  #error no MAP_ANONYMOUS
+#endif
+], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
+fi
+AC_SUBST(VIEW_FILE)
+AC_SUBST(ALLOC_FILE)
+
+BACKTRACE_USES_MALLOC=0
+if test "$ALLOC_FILE" = "alloc.lo"; then
+  BACKTRACE_USES_MALLOC=1
+fi
+AC_SUBST(BACKTRACE_USES_MALLOC)
+
+# Check for dl_iterate_phdr.
+AC_CHECK_HEADERS(link.h)
+if test "$ac_cv_header_link_h" = "no"; then
+  have_dl_iterate_phdr=no
+else
+  if test -n "${with_target_subdir}"; then
+    # When built as a GCC target library, we can't do a link test.
+    AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes],
+		    [have_dl_iterate_phdr=no])
+    case "${host}" in
+    *-*-solaris2.10*)
+        # Avoid dl_iterate_phdr on Solaris 10, where it is in the
+    	# header file but is only in -ldl.
+	have_dl_iterate_phdr=no ;;
+    esac
+  else
+    AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes],
+		  [have_dl_iterate_phdr=no])
+  fi
+fi
+if test "$have_dl_iterate_phdr" = "yes"; then
+  AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.])
+fi
+
+# Check for the fcntl function.
+if test -n "${with_target_subdir}"; then
+   case "${host}" in
+   *-*-mingw*) have_fcntl=no ;;
+   spu-*-*) have_fcntl=no ;;
+   *) have_fcntl=yes ;;
+   esac
+else
+  AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no])
+fi
+if test "$have_fcntl" = "yes"; then
+  AC_DEFINE([HAVE_FCNTL], 1,
+	    [Define to 1 if you have the fcntl function])
+fi
+
+AC_CHECK_DECLS(strnlen)
+
+# Check for getexecname function.
+if test -n "${with_target_subdir}"; then
+   case "${host}" in
+   *-*-solaris2*) have_getexecname=yes ;;
+   *) have_getexecname=no ;;
+   esac
+else
+  AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no])
+fi
+if test "$have_getexecname" = "yes"; then
+  AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.])
+fi
+
+AC_CACHE_CHECK([whether tests can run],
+  [libbacktrace_cv_sys_native],
+  [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
+     [libbacktrace_cv_sys_native=yes],
+     [libbacktrace_cv_sys_native=no],
+     [libbacktrace_cv_sys_native=no])])
+AM_CONDITIONAL(NATIVE, test "$libbacktrace_cv_sys_native" = "yes")
+
+if test "${multilib}" = "yes"; then
+  multilib_arg="--enable-multilib"
+else
+  multilib_arg=
+fi
+
+AC_CONFIG_FILES(Makefile backtrace-supported.h)
+
+# We need multilib support, but only if configuring for the target.
+AC_CONFIG_COMMANDS([default],
+[if test -n "$CONFIG_FILES"; then
+   if test -n "${with_target_subdir}"; then
+     # Multilibs need MULTISUBDIR defined correctly in certain makefiles so
+     # that multilib installs will end up installed in the correct place.
+     # The testsuite needs it for multilib-aware ABI baseline files.
+     # To work around this not being passed down from config-ml.in ->
+     # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
+     # append it here.  Only modify Makefiles that have just been created.
+     #
+     # Also, get rid of this simulated-VPATH thing that automake does.
+     cat > vpsed << \_EOF
+  s!`test -f '$<' || echo '$(srcdir)/'`!!
+_EOF
+     for i in $SUBDIRS; do
+      case $CONFIG_FILES in
+       *${i}/Makefile*)
+	 #echo "Adding MULTISUBDIR to $i/Makefile"
+	 sed -f vpsed $i/Makefile > tmp
+	 grep '^MULTISUBDIR =' Makefile >> tmp
+	 mv tmp $i/Makefile
+	 ;;
+      esac
+     done
+     rm vpsed
+   fi
+ fi
+],
+[
+# Variables needed in config.status (file generation) which aren't already
+# passed by autoconf.
+SUBDIRS="$SUBDIRS"
+])
+
+AC_OUTPUT
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/dwarf.c
@@ -0,0 +1,3038 @@
+/* dwarf.c -- Get file/line information from DWARF for backtraces.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "dwarf2.h"
+#include "filenames.h"
+
+#include "backtrace.h"
+#include "internal.h"
+
+#if !defined(HAVE_DECL_STRNLEN) || !HAVE_DECL_STRNLEN
+
+/* If strnlen is not declared, provide our own version.  */
+
+static size_t
+xstrnlen (const char *s, size_t maxlen)
+{
+  size_t i;
+
+  for (i = 0; i < maxlen; ++i)
+    if (s[i] == '\0')
+      break;
+  return i;
+}
+
+#define strnlen xstrnlen
+
+#endif
+
+/* A buffer to read DWARF info.  */
+
+struct dwarf_buf
+{
+  /* Buffer name for error messages.  */
+  const char *name;
+  /* Start of the buffer.  */
+  const unsigned char *start;
+  /* Next byte to read.  */
+  const unsigned char *buf;
+  /* The number of bytes remaining.  */
+  size_t left;
+  /* Whether the data is big-endian.  */
+  int is_bigendian;
+  /* Error callback routine.  */
+  backtrace_error_callback error_callback;
+  /* Data for error_callback.  */
+  void *data;
+  /* Non-zero if we've reported an underflow error.  */
+  int reported_underflow;
+};
+
+/* A single attribute in a DWARF abbreviation.  */
+
+struct attr
+{
+  /* The attribute name.  */
+  enum dwarf_attribute name;
+  /* The attribute form.  */
+  enum dwarf_form form;
+};
+
+/* A single DWARF abbreviation.  */
+
+struct abbrev
+{
+  /* The abbrev code--the number used to refer to the abbrev.  */
+  uint64_t code;
+  /* The entry tag.  */
+  enum dwarf_tag tag;
+  /* Non-zero if this abbrev has child entries.  */
+  int has_children;
+  /* The number of attributes.  */
+  size_t num_attrs;
+  /* The attributes.  */
+  struct attr *attrs;
+};
+
+/* The DWARF abbreviations for a compilation unit.  This structure
+   only exists while reading the compilation unit.  Most DWARF readers
+   seem to a hash table to map abbrev ID's to abbrev entries.
+   However, we primarily care about GCC, and GCC simply issues ID's in
+   numerical order starting at 1.  So we simply keep a sorted vector,
+   and try to just look up the code.  */
+
+struct abbrevs
+{
+  /* The number of abbrevs in the vector.  */
+  size_t num_abbrevs;
+  /* The abbrevs, sorted by the code field.  */
+  struct abbrev *abbrevs;
+};
+
+/* The different kinds of attribute values.  */
+
+enum attr_val_encoding
+{
+  /* An address.  */
+  ATTR_VAL_ADDRESS,
+  /* A unsigned integer.  */
+  ATTR_VAL_UINT,
+  /* A sigd integer.  */
+  ATTR_VAL_SINT,
+  /* A string.  */
+  ATTR_VAL_STRING,
+  /* An offset to other data in the containing unit.  */
+  ATTR_VAL_REF_UNIT,
+  /* An offset to other data within the .dwarf_info section.  */
+  ATTR_VAL_REF_INFO,
+  /* An offset to data in some other section.  */
+  ATTR_VAL_REF_SECTION,
+  /* A type signature.  */
+  ATTR_VAL_REF_TYPE,
+  /* A block of data (not represented).  */
+  ATTR_VAL_BLOCK,
+  /* An expression (not represented).  */
+  ATTR_VAL_EXPR,
+};
+
+/* An attribute value.  */
+
+struct attr_val
+{
+  /* How the value is stored in the field u.  */
+  enum attr_val_encoding encoding;
+  union
+  {
+    /* ATTR_VAL_ADDRESS, ATTR_VAL_UINT, ATTR_VAL_REF*.  */
+    uint64_t uint;
+    /* ATTR_VAL_SINT.  */
+    int64_t sint;
+    /* ATTR_VAL_STRING.  */
+    const char *string;
+    /* ATTR_VAL_BLOCK not stored.  */
+  } u;
+};
+
+/* The line number program header.  */
+
+struct line_header
+{
+  /* The version of the line number information.  */
+  int version;
+  /* The minimum instruction length.  */
+  unsigned int min_insn_len;
+  /* The maximum number of ops per instruction.  */
+  unsigned int max_ops_per_insn;
+  /* The line base for special opcodes.  */
+  int line_base;
+  /* The line range for special opcodes.  */
+  unsigned int line_range;
+  /* The opcode base--the first special opcode.  */
+  unsigned int opcode_base;
+  /* Opcode lengths, indexed by opcode - 1.  */
+  const unsigned char *opcode_lengths;
+  /* The number of directory entries.  */
+  size_t dirs_count;
+  /* The directory entries.  */
+  const char **dirs;
+  /* The number of filenames.  */
+  size_t filenames_count;
+  /* The filenames.  */
+  const char **filenames;
+};
+
+/* Map a single PC value to a file/line.  We will keep a vector of
+   these sorted by PC value.  Each file/line will be correct from the
+   PC up to the PC of the next entry if there is one.  We allocate one
+   extra entry at the end so that we can use bsearch.  */
+
+struct line
+{
+  /* PC.  */
+  uintptr_t pc;
+  /* File name.  Many entries in the array are expected to point to
+     the same file name.  */
+  const char *filename;
+  /* Line number.  */
+  int lineno;
+  /* Index of the object in the original array read from the DWARF
+     section, before it has been sorted.  The index makes it possible
+     to use Quicksort and maintain stability.  */
+  int idx;
+};
+
+/* A growable vector of line number information.  This is used while
+   reading the line numbers.  */
+
+struct line_vector
+{
+  /* Memory.  This is an array of struct line.  */
+  struct backtrace_vector vec;
+  /* Number of valid mappings.  */
+  size_t count;
+};
+
+/* A function described in the debug info.  */
+
+struct function
+{
+  /* The name of the function.  */
+  const char *name;
+  /* If this is an inlined function, the filename of the call
+     site.  */
+  const char *caller_filename;
+  /* If this is an inlined function, the line number of the call
+     site.  */
+  int caller_lineno;
+  /* Map PC ranges to inlined functions.  */
+  struct function_addrs *function_addrs;
+  size_t function_addrs_count;
+};
+
+/* An address range for a function.  This maps a PC value to a
+   specific function.  */
+
+struct function_addrs
+{
+  /* Range is LOW <= PC < HIGH.  */
+  uint64_t low;
+  uint64_t high;
+  /* Function for this address range.  */
+  struct function *function;
+};
+
+/* A growable vector of function address ranges.  */
+
+struct function_vector
+{
+  /* Memory.  This is an array of struct function_addrs.  */
+  struct backtrace_vector vec;
+  /* Number of address ranges present.  */
+  size_t count;
+};
+
+/* A DWARF compilation unit.  This only holds the information we need
+   to map a PC to a file and line.  */
+
+struct unit
+{
+  /* The first entry for this compilation unit.  */
+  const unsigned char *unit_data;
+  /* The length of the data for this compilation unit.  */
+  size_t unit_data_len;
+  /* The offset of UNIT_DATA from the start of the information for
+     this compilation unit.  */
+  size_t unit_data_offset;
+  /* DWARF version.  */
+  int version;
+  /* Whether unit is DWARF64.  */
+  int is_dwarf64;
+  /* Address size.  */
+  int addrsize;
+  /* Offset into line number information.  */
+  off_t lineoff;
+  /* Primary source file.  */
+  const char *filename;
+  /* Compilation command working directory.  */
+  const char *comp_dir;
+  /* Absolute file name, only set if needed.  */
+  const char *abs_filename;
+  /* The abbreviations for this unit.  */
+  struct abbrevs abbrevs;
+
+  /* The fields above this point are read in during initialization and
+     may be accessed freely.  The fields below this point are read in
+     as needed, and therefore require care, as different threads may
+     try to initialize them simultaneously.  */
+
+  /* PC to line number mapping.  This is NULL if the values have not
+     been read.  This is (struct line *) -1 if there was an error
+     reading the values.  */
+  struct line *lines;
+  /* Number of entries in lines.  */
+  size_t lines_count;
+  /* PC ranges to function.  */
+  struct function_addrs *function_addrs;
+  size_t function_addrs_count;
+};
+
+/* An address range for a compilation unit.  This maps a PC value to a
+   specific compilation unit.  Note that we invert the representation
+   in DWARF: instead of listing the units and attaching a list of
+   ranges, we list the ranges and have each one point to the unit.
+   This lets us do a binary search to find the unit.  */
+
+struct unit_addrs
+{
+  /* Range is LOW <= PC < HIGH.  */
+  uint64_t low;
+  uint64_t high;
+  /* Compilation unit for this address range.  */
+  struct unit *u;
+};
+
+/* A growable vector of compilation unit address ranges.  */
+
+struct unit_addrs_vector
+{
+  /* Memory.  This is an array of struct unit_addrs.  */
+  struct backtrace_vector vec;
+  /* Number of address ranges present.  */
+  size_t count;
+};
+
+/* The information we need to map a PC to a file and line.  */
+
+struct dwarf_data
+{
+  /* The data for the next file we know about.  */
+  struct dwarf_data *next;
+  /* The base address for this file.  */
+  uintptr_t base_address;
+  /* A sorted list of address ranges.  */
+  struct unit_addrs *addrs;
+  /* Number of address ranges in list.  */
+  size_t addrs_count;
+  /* The unparsed .debug_info section.  */
+  const unsigned char *dwarf_info;
+  size_t dwarf_info_size;
+  /* The unparsed .debug_line section.  */
+  const unsigned char *dwarf_line;
+  size_t dwarf_line_size;
+  /* The unparsed .debug_ranges section.  */
+  const unsigned char *dwarf_ranges;
+  size_t dwarf_ranges_size;
+  /* The unparsed .debug_str section.  */
+  const unsigned char *dwarf_str;
+  size_t dwarf_str_size;
+  /* Whether the data is big-endian or not.  */
+  int is_bigendian;
+  /* A vector used for function addresses.  We keep this here so that
+     we can grow the vector as we read more functions.  */
+  struct function_vector fvec;
+};
+
+/* Report an error for a DWARF buffer.  */
+
+static void
+dwarf_buf_error (struct dwarf_buf *buf, const char *msg)
+{
+  char b[200];
+
+  snprintf (b, sizeof b, "%s in %s at %d",
+	    msg, buf->name, (int) (buf->buf - buf->start));
+  buf->error_callback (buf->data, b, 0);
+}
+
+/* Require at least COUNT bytes in BUF.  Return 1 if all is well, 0 on
+   error.  */
+
+static int
+require (struct dwarf_buf *buf, size_t count)
+{
+  if (buf->left >= count)
+    return 1;
+
+  if (!buf->reported_underflow)
+    {
+      dwarf_buf_error (buf, "DWARF underflow");
+      buf->reported_underflow = 1;
+    }
+
+  return 0;
+}
+
+/* Advance COUNT bytes in BUF.  Return 1 if all is well, 0 on
+   error.  */
+
+static int
+advance (struct dwarf_buf *buf, size_t count)
+{
+  if (!require (buf, count))
+    return 0;
+  buf->buf += count;
+  buf->left -= count;
+  return 1;
+}
+
+/* Read one byte from BUF and advance 1 byte.  */
+
+static unsigned char
+read_byte (struct dwarf_buf *buf)
+{
+  const unsigned char *p = buf->buf;
+
+  if (!advance (buf, 1))
+    return 0;
+  return p[0];
+}
+
+/* Read a signed char from BUF and advance 1 byte.  */
+
+static signed char
+read_sbyte (struct dwarf_buf *buf)
+{
+  const unsigned char *p = buf->buf;
+
+  if (!advance (buf, 1))
+    return 0;
+  return (*p ^ 0x80) - 0x80;
+}
+
+/* Read a uint16 from BUF and advance 2 bytes.  */
+
+static uint16_t
+read_uint16 (struct dwarf_buf *buf)
+{
+  const unsigned char *p = buf->buf;
+
+  if (!advance (buf, 2))
+    return 0;
+  if (buf->is_bigendian)
+    return ((uint16_t) p[0] << 8) | (uint16_t) p[1];
+  else
+    return ((uint16_t) p[1] << 8) | (uint16_t) p[0];
+}
+
+/* Read a uint32 from BUF and advance 4 bytes.  */
+
+static uint32_t
+read_uint32 (struct dwarf_buf *buf)
+{
+  const unsigned char *p = buf->buf;
+
+  if (!advance (buf, 4))
+    return 0;
+  if (buf->is_bigendian)
+    return (((uint32_t) p[0] << 24) | ((uint32_t) p[1] << 16)
+	    | ((uint32_t) p[2] << 8) | (uint32_t) p[3]);
+  else
+    return (((uint32_t) p[3] << 24) | ((uint32_t) p[2] << 16)
+	    | ((uint32_t) p[1] << 8) | (uint32_t) p[0]);
+}
+
+/* Read a uint64 from BUF and advance 8 bytes.  */
+
+static uint64_t
+read_uint64 (struct dwarf_buf *buf)
+{
+  const unsigned char *p = buf->buf;
+
+  if (!advance (buf, 8))
+    return 0;
+  if (buf->is_bigendian)
+    return (((uint64_t) p[0] << 56) | ((uint64_t) p[1] << 48)
+	    | ((uint64_t) p[2] << 40) | ((uint64_t) p[3] << 32)
+	    | ((uint64_t) p[4] << 24) | ((uint64_t) p[5] << 16)
+	    | ((uint64_t) p[6] << 8) | (uint64_t) p[7]);
+  else
+    return (((uint64_t) p[7] << 56) | ((uint64_t) p[6] << 48)
+	    | ((uint64_t) p[5] << 40) | ((uint64_t) p[4] << 32)
+	    | ((uint64_t) p[3] << 24) | ((uint64_t) p[2] << 16)
+	    | ((uint64_t) p[1] << 8) | (uint64_t) p[0]);
+}
+
+/* Read an offset from BUF and advance the appropriate number of
+   bytes.  */
+
+static uint64_t
+read_offset (struct dwarf_buf *buf, int is_dwarf64)
+{
+  if (is_dwarf64)
+    return read_uint64 (buf);
+  else
+    return read_uint32 (buf);
+}
+
+/* Read an address from BUF and advance the appropriate number of
+   bytes.  */
+
+static uint64_t
+read_address (struct dwarf_buf *buf, int addrsize)
+{
+  switch (addrsize)
+    {
+    case 1:
+      return read_byte (buf);
+    case 2:
+      return read_uint16 (buf);
+    case 4:
+      return read_uint32 (buf);
+    case 8:
+      return read_uint64 (buf);
+    default:
+      dwarf_buf_error (buf, "unrecognized address size");
+      return 0;
+    }
+}
+
+/* Return whether a value is the highest possible address, given the
+   address size.  */
+
+static int
+is_highest_address (uint64_t address, int addrsize)
+{
+  switch (addrsize)
+    {
+    case 1:
+      return address == (unsigned char) -1;
+    case 2:
+      return address == (uint16_t) -1;
+    case 4:
+      return address == (uint32_t) -1;
+    case 8:
+      return address == (uint64_t) -1;
+    default:
+      return 0;
+    }
+}
+
+/* Read an unsigned LEB128 number.  */
+
+static uint64_t
+read_uleb128 (struct dwarf_buf *buf)
+{
+  uint64_t ret;
+  unsigned int shift;
+  int overflow;
+  unsigned char b;
+
+  ret = 0;
+  shift = 0;
+  overflow = 0;
+  do
+    {
+      const unsigned char *p;
+
+      p = buf->buf;
+      if (!advance (buf, 1))
+	return 0;
+      b = *p;
+      if (shift < 64)
+	ret |= ((uint64_t) (b & 0x7f)) << shift;
+      else if (!overflow)
+	{
+	  dwarf_buf_error (buf, "LEB128 overflows uint64_t");
+	  overflow = 1;
+	}
+      shift += 7;
+    }
+  while ((b & 0x80) != 0);
+
+  return ret;
+}
+
+/* Read a signed LEB128 number.  */
+
+static int64_t
+read_sleb128 (struct dwarf_buf *buf)
+{
+  uint64_t val;
+  unsigned int shift;
+  int overflow;
+  unsigned char b;
+
+  val = 0;
+  shift = 0;
+  overflow = 0;
+  do
+    {
+      const unsigned char *p;
+
+      p = buf->buf;
+      if (!advance (buf, 1))
+	return 0;
+      b = *p;
+      if (shift < 64)
+	val |= ((uint64_t) (b & 0x7f)) << shift;
+      else if (!overflow)
+	{
+	  dwarf_buf_error (buf, "signed LEB128 overflows uint64_t");
+	  overflow = 1;
+	}
+      shift += 7;
+    }
+  while ((b & 0x80) != 0);
+
+  if ((b & 0x40) != 0 && shift < 64)
+    val |= ((uint64_t) -1) << shift;
+
+  return (int64_t) val;
+}
+
+/* Return the length of an LEB128 number.  */
+
+static size_t
+leb128_len (const unsigned char *p)
+{
+  size_t ret;
+
+  ret = 1;
+  while ((*p & 0x80) != 0)
+    {
+      ++p;
+      ++ret;
+    }
+  return ret;
+}
+
+/* Free an abbreviations structure.  */
+
+static void
+free_abbrevs (struct backtrace_state *state, struct abbrevs *abbrevs,
+	      backtrace_error_callback error_callback, void *data)
+{
+  size_t i;
+
+  for (i = 0; i < abbrevs->num_abbrevs; ++i)
+    backtrace_free (state, abbrevs->abbrevs[i].attrs,
+		    abbrevs->abbrevs[i].num_attrs * sizeof (struct attr),
+		    error_callback, data);
+  backtrace_free (state, abbrevs->abbrevs,
+		  abbrevs->num_abbrevs * sizeof (struct abbrev),
+		  error_callback, data);
+  abbrevs->num_abbrevs = 0;
+  abbrevs->abbrevs = NULL;
+}
+
+/* Read an attribute value.  Returns 1 on success, 0 on failure.  If
+   the value can be represented as a uint64_t, sets *VAL and sets
+   *IS_VALID to 1.  We don't try to store the value of other attribute
+   forms, because we don't care about them.  */
+
+static int
+read_attribute (enum dwarf_form form, struct dwarf_buf *buf,
+		int is_dwarf64, int version, int addrsize,
+		const unsigned char *dwarf_str, size_t dwarf_str_size,
+		struct attr_val *val)
+{
+  /* Avoid warnings about val.u.FIELD may be used uninitialized if
+     this function is inlined.  The warnings aren't valid but can
+     occur because the different fields are set and used
+     conditionally.  */
+  memset (val, 0, sizeof *val);
+
+  switch (form)
+    {
+    case DW_FORM_addr:
+      val->encoding = ATTR_VAL_ADDRESS;
+      val->u.uint = read_address (buf, addrsize);
+      return 1;
+    case DW_FORM_block2:
+      val->encoding = ATTR_VAL_BLOCK;
+      return advance (buf, read_uint16 (buf));
+    case DW_FORM_block4:
+      val->encoding = ATTR_VAL_BLOCK;
+      return advance (buf, read_uint32 (buf));
+    case DW_FORM_data2:
+      val->encoding = ATTR_VAL_UINT;
+      val->u.uint = read_uint16 (buf);
+      return 1;
+    case DW_FORM_data4:
+      val->encoding = ATTR_VAL_UINT;
+      val->u.uint = read_uint32 (buf);
+      return 1;
+    case DW_FORM_data8:
+      val->encoding = ATTR_VAL_UINT;
+      val->u.uint = read_uint64 (buf);
+      return 1;
+    case DW_FORM_string:
+      val->encoding = ATTR_VAL_STRING;
+      val->u.string = (const char *) buf->buf;
+      return advance (buf, strnlen ((const char *) buf->buf, buf->left) + 1);
+    case DW_FORM_block:
+      val->encoding = ATTR_VAL_BLOCK;
+      return advance (buf, read_uleb128 (buf));
+    case DW_FORM_block1:
+      val->encoding = ATTR_VAL_BLOCK;
+      return advance (buf, read_byte (buf));
+    case DW_FORM_data1:
+      val->encoding = ATTR_VAL_UINT;
+      val->u.uint = read_byte (buf);
+      return 1;
+    case DW_FORM_flag:
+      val->encoding = ATTR_VAL_UINT;
+      val->u.uint = read_byte (buf);
+      return 1;
+    case DW_FORM_sdata:
+      val->encoding = ATTR_VAL_SINT;
+      val->u.sint = read_sleb128 (buf);
+      return 1;
+    case DW_FORM_strp:
+      {
+	uint64_t offset;
+
+	offset = read_offset (buf, is_dwarf64);
+	if (offset >= dwarf_str_size)
+	  {
+	    dwarf_buf_error (buf, "DW_FORM_strp out of range");
+	    return 0;
+	  }
+	val->encoding = ATTR_VAL_STRING;
+	val->u.string = (const char *) dwarf_str + offset;
+	return 1;
+      }
+    case DW_FORM_udata:
+      val->encoding = ATTR_VAL_UINT;
+      val->u.uint = read_uleb128 (buf);
+      return 1;
+    case DW_FORM_ref_addr:
+      val->encoding = ATTR_VAL_REF_INFO;
+      if (version == 2)
+	val->u.uint = read_address (buf, addrsize);
+      else
+	val->u.uint = read_offset (buf, is_dwarf64);
+      return 1;
+    case DW_FORM_ref1:
+      val->encoding = ATTR_VAL_REF_UNIT;
+      val->u.uint = read_byte (buf);
+      return 1;
+    case DW_FORM_ref2:
+      val->encoding = ATTR_VAL_REF_UNIT;
+      val->u.uint = read_uint16 (buf);
+      return 1;
+    case DW_FORM_ref4:
+      val->encoding = ATTR_VAL_REF_UNIT;
+      val->u.uint = read_uint32 (buf);
+      return 1;
+    case DW_FORM_ref8:
+      val->encoding = ATTR_VAL_REF_UNIT;
+      val->u.uint = read_uint64 (buf);
+      return 1;
+    case DW_FORM_ref_udata:
+      val->encoding = ATTR_VAL_REF_UNIT;
+      val->u.uint = read_uleb128 (buf);
+      return 1;
+    case DW_FORM_indirect:
+      {
+	uint64_t form;
+
+	form = read_uleb128 (buf);
+	return read_attribute ((enum dwarf_form) form, buf, is_dwarf64,
+			       version, addrsize, dwarf_str, dwarf_str_size,
+			       val);
+      }
+    case DW_FORM_sec_offset:
+      val->encoding = ATTR_VAL_REF_SECTION;
+      val->u.uint = read_offset (buf, is_dwarf64);
+      return 1;
+    case DW_FORM_exprloc:
+      val->encoding = ATTR_VAL_EXPR;
+      return advance (buf, read_uleb128 (buf));
+    case DW_FORM_flag_present:
+      val->encoding = ATTR_VAL_UINT;
+      val->u.uint = 1;
+      return 1;
+    case DW_FORM_ref_sig8:
+      val->encoding = ATTR_VAL_REF_TYPE;
+      val->u.uint = read_uint64 (buf);
+      return 1;
+    case DW_FORM_GNU_addr_index:
+      val->encoding = ATTR_VAL_REF_SECTION;
+      val->u.uint = read_uleb128 (buf);
+      return 1;
+    case DW_FORM_GNU_str_index:
+      val->encoding = ATTR_VAL_REF_SECTION;
+      val->u.uint = read_uleb128 (buf);
+      return 1;
+    case DW_FORM_GNU_ref_alt:
+      val->encoding = ATTR_VAL_REF_SECTION;
+      val->u.uint = read_offset (buf, is_dwarf64);
+      return 1;
+    case DW_FORM_GNU_strp_alt:
+      val->encoding = ATTR_VAL_REF_SECTION;
+      val->u.uint = read_offset (buf, is_dwarf64);
+      return 1;
+    default:
+      dwarf_buf_error (buf, "unrecognized DWARF form");
+      return 0;
+    }
+}
+
+/* Compare function_addrs for qsort.  When ranges are nested, make the
+   smallest one sort last.  */
+
+static int
+function_addrs_compare (const void *v1, const void *v2)
+{
+  const struct function_addrs *a1 = (const struct function_addrs *) v1;
+  const struct function_addrs *a2 = (const struct function_addrs *) v2;
+
+  if (a1->low < a2->low)
+    return -1;
+  if (a1->low > a2->low)
+    return 1;
+  if (a1->high < a2->high)
+    return 1;
+  if (a1->high > a2->high)
+    return -1;
+  return strcmp (a1->function->name, a2->function->name);
+}
+
+/* Compare a PC against a function_addrs for bsearch.  Note that if
+   there are multiple ranges containing PC, which one will be returned
+   is unpredictable.  We compensate for that in dwarf_fileline.  */
+
+static int
+function_addrs_search (const void *vkey, const void *ventry)
+{
+  const uintptr_t *key = (const uintptr_t *) vkey;
+  const struct function_addrs *entry = (const struct function_addrs *) ventry;
+  uintptr_t pc;
+
+  pc = *key;
+  if (pc < entry->low)
+    return -1;
+  else if (pc >= entry->high)
+    return 1;
+  else
+    return 0;
+}
+
+/* Add a new compilation unit address range to a vector.  Returns 1 on
+   success, 0 on failure.  */
+
+static int
+add_unit_addr (struct backtrace_state *state, uintptr_t base_address,
+	       struct unit_addrs addrs,
+	       backtrace_error_callback error_callback, void *data,
+	       struct unit_addrs_vector *vec)
+{
+  struct unit_addrs *p;
+
+  /* Add in the base address of the module here, so that we can look
+     up the PC directly.  */
+  addrs.low += base_address;
+  addrs.high += base_address;
+
+  /* Try to merge with the last entry.  */
+  if (vec->count > 0)
+    {
+      p = (struct unit_addrs *) vec->vec.base + (vec->count - 1);
+      if ((addrs.low == p->high || addrs.low == p->high + 1)
+	  && addrs.u == p->u)
+	{
+	  if (addrs.high > p->high)
+	    p->high = addrs.high;
+	  return 1;
+	}
+    }
+
+  p = ((struct unit_addrs *)
+       backtrace_vector_grow (state, sizeof (struct unit_addrs),
+			      error_callback, data, &vec->vec));
+  if (p == NULL)
+    return 0;
+
+  *p = addrs;
+  ++vec->count;
+  return 1;
+}
+
+/* Free a unit address vector.  */
+
+static void
+free_unit_addrs_vector (struct backtrace_state *state,
+			struct unit_addrs_vector *vec,
+			backtrace_error_callback error_callback, void *data)
+{
+  struct unit_addrs *addrs;
+  size_t i;
+
+  addrs = (struct unit_addrs *) vec->vec.base;
+  for (i = 0; i < vec->count; ++i)
+    free_abbrevs (state, &addrs[i].u->abbrevs, error_callback, data);
+}
+
+/* Compare unit_addrs for qsort.  When ranges are nested, make the
+   smallest one sort last.  */
+
+static int
+unit_addrs_compare (const void *v1, const void *v2)
+{
+  const struct unit_addrs *a1 = (const struct unit_addrs *) v1;
+  const struct unit_addrs *a2 = (const struct unit_addrs *) v2;
+
+  if (a1->low < a2->low)
+    return -1;
+  if (a1->low > a2->low)
+    return 1;
+  if (a1->high < a2->high)
+    return 1;
+  if (a1->high > a2->high)
+    return -1;
+  if (a1->u->lineoff < a2->u->lineoff)
+    return -1;
+  if (a1->u->lineoff > a2->u->lineoff)
+    return 1;
+  return 0;
+}
+
+/* Compare a PC against a unit_addrs for bsearch.  Note that if there
+   are multiple ranges containing PC, which one will be returned is
+   unpredictable.  We compensate for that in dwarf_fileline.  */
+
+static int
+unit_addrs_search (const void *vkey, const void *ventry)
+{
+  const uintptr_t *key = (const uintptr_t *) vkey;
+  const struct unit_addrs *entry = (const struct unit_addrs *) ventry;
+  uintptr_t pc;
+
+  pc = *key;
+  if (pc < entry->low)
+    return -1;
+  else if (pc >= entry->high)
+    return 1;
+  else
+    return 0;
+}
+
+/* Sort the line vector by PC.  We want a stable sort here to maintain
+   the order of lines for the same PC values.  Since the sequence is
+   being sorted in place, their addresses cannot be relied on to
+   maintain stability.  That is the purpose of the index member.  */
+
+static int
+line_compare (const void *v1, const void *v2)
+{
+  const struct line *ln1 = (const struct line *) v1;
+  const struct line *ln2 = (const struct line *) v2;
+
+  if (ln1->pc < ln2->pc)
+    return -1;
+  else if (ln1->pc > ln2->pc)
+    return 1;
+  else if (ln1->idx < ln2->idx)
+    return -1;
+  else if (ln1->idx > ln2->idx)
+    return 1;
+  else
+    return 0;
+}
+
+/* Find a PC in a line vector.  We always allocate an extra entry at
+   the end of the lines vector, so that this routine can safely look
+   at the next entry.  Note that when there are multiple mappings for
+   the same PC value, this will return the last one.  */
+
+static int
+line_search (const void *vkey, const void *ventry)
+{
+  const uintptr_t *key = (const uintptr_t *) vkey;
+  const struct line *entry = (const struct line *) ventry;
+  uintptr_t pc;
+
+  pc = *key;
+  if (pc < entry->pc)
+    return -1;
+  else if (pc >= (entry + 1)->pc)
+    return 1;
+  else
+    return 0;
+}
+
+/* Sort the abbrevs by the abbrev code.  This function is passed to
+   both qsort and bsearch.  */
+
+static int
+abbrev_compare (const void *v1, const void *v2)
+{
+  const struct abbrev *a1 = (const struct abbrev *) v1;
+  const struct abbrev *a2 = (const struct abbrev *) v2;
+
+  if (a1->code < a2->code)
+    return -1;
+  else if (a1->code > a2->code)
+    return 1;
+  else
+    {
+      /* This really shouldn't happen.  It means there are two
+	 different abbrevs with the same code, and that means we don't
+	 know which one lookup_abbrev should return.  */
+      return 0;
+    }
+}
+
+/* Read the abbreviation table for a compilation unit.  Returns 1 on
+   success, 0 on failure.  */
+
+static int
+read_abbrevs (struct backtrace_state *state, uint64_t abbrev_offset,
+	      const unsigned char *dwarf_abbrev, size_t dwarf_abbrev_size,
+	      int is_bigendian, backtrace_error_callback error_callback,
+	      void *data, struct abbrevs *abbrevs)
+{
+  struct dwarf_buf abbrev_buf;
+  struct dwarf_buf count_buf;
+  size_t num_abbrevs;
+
+  abbrevs->num_abbrevs = 0;
+  abbrevs->abbrevs = NULL;
+
+  if (abbrev_offset >= dwarf_abbrev_size)
+    {
+      error_callback (data, "abbrev offset out of range", 0);
+      return 0;
+    }
+
+  abbrev_buf.name = ".debug_abbrev";
+  abbrev_buf.start = dwarf_abbrev;
+  abbrev_buf.buf = dwarf_abbrev + abbrev_offset;
+  abbrev_buf.left = dwarf_abbrev_size - abbrev_offset;
+  abbrev_buf.is_bigendian = is_bigendian;
+  abbrev_buf.error_callback = error_callback;
+  abbrev_buf.data = data;
+  abbrev_buf.reported_underflow = 0;
+
+  /* Count the number of abbrevs in this list.  */
+
+  count_buf = abbrev_buf;
+  num_abbrevs = 0;
+  while (read_uleb128 (&count_buf) != 0)
+    {
+      if (count_buf.reported_underflow)
+	return 0;
+      ++num_abbrevs;
+      // Skip tag.
+      read_uleb128 (&count_buf);
+      // Skip has_children.
+      read_byte (&count_buf);
+      // Skip attributes.
+      while (read_uleb128 (&count_buf) != 0)
+	read_uleb128 (&count_buf);
+      // Skip form of last attribute.
+      read_uleb128 (&count_buf);
+    }
+
+  if (count_buf.reported_underflow)
+    return 0;
+
+  if (num_abbrevs == 0)
+    return 1;
+
+  abbrevs->num_abbrevs = num_abbrevs;
+  abbrevs->abbrevs = ((struct abbrev *)
+		      backtrace_alloc (state,
+				       num_abbrevs * sizeof (struct abbrev),
+				       error_callback, data));
+  if (abbrevs->abbrevs == NULL)
+    return 0;
+  memset (abbrevs->abbrevs, 0, num_abbrevs * sizeof (struct abbrev));
+
+  num_abbrevs = 0;
+  while (1)
+    {
+      uint64_t code;
+      struct abbrev a;
+      size_t num_attrs;
+      struct attr *attrs;
+
+      if (abbrev_buf.reported_underflow)
+	goto fail;
+
+      code = read_uleb128 (&abbrev_buf);
+      if (code == 0)
+	break;
+
+      a.code = code;
+      a.tag = (enum dwarf_tag) read_uleb128 (&abbrev_buf);
+      a.has_children = read_byte (&abbrev_buf);
+
+      count_buf = abbrev_buf;
+      num_attrs = 0;
+      while (read_uleb128 (&count_buf) != 0)
+	{
+	  ++num_attrs;
+	  read_uleb128 (&count_buf);
+	}
+
+      if (num_attrs == 0)
+	{
+	  attrs = NULL;
+	  read_uleb128 (&abbrev_buf);
+	  read_uleb128 (&abbrev_buf);
+	}
+      else
+	{
+	  attrs = ((struct attr *)
+		   backtrace_alloc (state, num_attrs * sizeof *attrs,
+				    error_callback, data));
+	  if (attrs == NULL)
+	    goto fail;
+	  num_attrs = 0;
+	  while (1)
+	    {
+	      uint64_t name;
+	      uint64_t form;
+
+	      name = read_uleb128 (&abbrev_buf);
+	      form = read_uleb128 (&abbrev_buf);
+	      if (name == 0)
+		break;
+	      attrs[num_attrs].name = (enum dwarf_attribute) name;
+	      attrs[num_attrs].form = (enum dwarf_form) form;
+	      ++num_attrs;
+	    }
+	}
+
+      a.num_attrs = num_attrs;
+      a.attrs = attrs;
+
+      abbrevs->abbrevs[num_abbrevs] = a;
+      ++num_abbrevs;
+    }
+
+  backtrace_qsort (abbrevs->abbrevs, abbrevs->num_abbrevs,
+		   sizeof (struct abbrev), abbrev_compare);
+
+  return 1;
+
+ fail:
+  free_abbrevs (state, abbrevs, error_callback, data);
+  return 0;
+}
+
+/* Return the abbrev information for an abbrev code.  */
+
+static const struct abbrev *
+lookup_abbrev (struct abbrevs *abbrevs, uint64_t code,
+	       backtrace_error_callback error_callback, void *data)
+{
+  struct abbrev key;
+  void *p;
+
+  /* With GCC, where abbrevs are simply numbered in order, we should
+     be able to just look up the entry.  */
+  if (code - 1 < abbrevs->num_abbrevs
+      && abbrevs->abbrevs[code - 1].code == code)
+    return &abbrevs->abbrevs[code - 1];
+
+  /* Otherwise we have to search.  */
+  memset (&key, 0, sizeof key);
+  key.code = code;
+  p = bsearch (&key, abbrevs->abbrevs, abbrevs->num_abbrevs,
+	       sizeof (struct abbrev), abbrev_compare);
+  if (p == NULL)
+    {
+      error_callback (data, "invalid abbreviation code", 0);
+      return NULL;
+    }
+  return (const struct abbrev *) p;
+}
+
+/* Add non-contiguous address ranges for a compilation unit.  Returns
+   1 on success, 0 on failure.  */
+
+static int
+add_unit_ranges (struct backtrace_state *state, uintptr_t base_address,
+		 struct unit *u, uint64_t ranges, uint64_t base,
+		 int is_bigendian, const unsigned char *dwarf_ranges,
+		 size_t dwarf_ranges_size,
+		 backtrace_error_callback error_callback, void *data,
+		 struct unit_addrs_vector *addrs)
+{
+  struct dwarf_buf ranges_buf;
+
+  if (ranges >= dwarf_ranges_size)
+    {
+      error_callback (data, "ranges offset out of range", 0);
+      return 0;
+    }
+
+  ranges_buf.name = ".debug_ranges";
+  ranges_buf.start = dwarf_ranges;
+  ranges_buf.buf = dwarf_ranges + ranges;
+  ranges_buf.left = dwarf_ranges_size - ranges;
+  ranges_buf.is_bigendian = is_bigendian;
+  ranges_buf.error_callback = error_callback;
+  ranges_buf.data = data;
+  ranges_buf.reported_underflow = 0;
+
+  while (1)
+    {
+      uint64_t low;
+      uint64_t high;
+
+      if (ranges_buf.reported_underflow)
+	return 0;
+
+      low = read_address (&ranges_buf, u->addrsize);
+      high = read_address (&ranges_buf, u->addrsize);
+
+      if (low == 0 && high == 0)
+	break;
+
+      if (is_highest_address (low, u->addrsize))
+	base = high;
+      else
+	{
+	  struct unit_addrs a;
+
+	  a.low = low + base;
+	  a.high = high + base;
+	  a.u = u;
+	  if (!add_unit_addr (state, base_address, a, error_callback, data,
+			      addrs))
+	    return 0;
+	}
+    }
+
+  if (ranges_buf.reported_underflow)
+    return 0;
+
+  return 1;
+}
+
+/* Find the address range covered by a compilation unit, reading from
+   UNIT_BUF and adding values to U.  Returns 1 if all data could be
+   read, 0 if there is some error.  */
+
+static int
+find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
+		     struct dwarf_buf *unit_buf,
+		     const unsigned char *dwarf_str, size_t dwarf_str_size,
+		     const unsigned char *dwarf_ranges,
+		     size_t dwarf_ranges_size,
+		     int is_bigendian, backtrace_error_callback error_callback,
+		     void *data, struct unit *u,
+		     struct unit_addrs_vector *addrs)
+{
+  while (unit_buf->left > 0)
+    {
+      uint64_t code;
+      const struct abbrev *abbrev;
+      uint64_t lowpc;
+      int have_lowpc;
+      uint64_t highpc;
+      int have_highpc;
+      int highpc_is_relative;
+      uint64_t ranges;
+      int have_ranges;
+      size_t i;
+
+      code = read_uleb128 (unit_buf);
+      if (code == 0)
+	return 1;
+
+      abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data);
+      if (abbrev == NULL)
+	return 0;
+
+      lowpc = 0;
+      have_lowpc = 0;
+      highpc = 0;
+      have_highpc = 0;
+      highpc_is_relative = 0;
+      ranges = 0;
+      have_ranges = 0;
+      for (i = 0; i < abbrev->num_attrs; ++i)
+	{
+	  struct attr_val val;
+
+	  if (!read_attribute (abbrev->attrs[i].form, unit_buf,
+			       u->is_dwarf64, u->version, u->addrsize,
+			       dwarf_str, dwarf_str_size, &val))
+	    return 0;
+
+	  switch (abbrev->attrs[i].name)
+	    {
+	    case DW_AT_low_pc:
+	      if (val.encoding == ATTR_VAL_ADDRESS)
+		{
+		  lowpc = val.u.uint;
+		  have_lowpc = 1;
+		}
+	      break;
+
+	    case DW_AT_high_pc:
+	      if (val.encoding == ATTR_VAL_ADDRESS)
+		{
+		  highpc = val.u.uint;
+		  have_highpc = 1;
+		}
+	      else if (val.encoding == ATTR_VAL_UINT)
+		{
+		  highpc = val.u.uint;
+		  have_highpc = 1;
+		  highpc_is_relative = 1;
+		}
+	      break;
+
+	    case DW_AT_ranges:
+	      if (val.encoding == ATTR_VAL_UINT
+		  || val.encoding == ATTR_VAL_REF_SECTION)
+		{
+		  ranges = val.u.uint;
+		  have_ranges = 1;
+		}
+	      break;
+
+	    case DW_AT_stmt_list:
+	      if (abbrev->tag == DW_TAG_compile_unit
+		  && (val.encoding == ATTR_VAL_UINT
+		      || val.encoding == ATTR_VAL_REF_SECTION))
+		u->lineoff = val.u.uint;
+	      break;
+
+	    case DW_AT_name:
+	      if (abbrev->tag == DW_TAG_compile_unit
+		  && val.encoding == ATTR_VAL_STRING)
+		u->filename = val.u.string;
+	      break;
+
+	    case DW_AT_comp_dir:
+	      if (abbrev->tag == DW_TAG_compile_unit
+		  && val.encoding == ATTR_VAL_STRING)
+		u->comp_dir = val.u.string;
+	      break;
+
+	    default:
+	      break;
+	    }
+	}
+
+      if (abbrev->tag == DW_TAG_compile_unit
+	  || abbrev->tag == DW_TAG_subprogram)
+	{
+	  if (have_ranges)
+	    {
+	      if (!add_unit_ranges (state, base_address, u, ranges, lowpc,
+				    is_bigendian, dwarf_ranges,
+				    dwarf_ranges_size, error_callback,
+				    data, addrs))
+		return 0;
+	    }
+	  else if (have_lowpc && have_highpc)
+	    {
+	      struct unit_addrs a;
+
+	      if (highpc_is_relative)
+		highpc += lowpc;
+	      a.low = lowpc;
+	      a.high = highpc;
+	      a.u = u;
+
+	      if (!add_unit_addr (state, base_address, a, error_callback, data,
+				  addrs))
+		return 0;
+	    }
+
+	  /* If we found the PC range in the DW_TAG_compile_unit, we
+	     can stop now.  */
+	  if (abbrev->tag == DW_TAG_compile_unit
+	      && (have_ranges || (have_lowpc && have_highpc)))
+	    return 1;
+	}
+
+      if (abbrev->has_children)
+	{
+	  if (!find_address_ranges (state, base_address, unit_buf,
+				    dwarf_str, dwarf_str_size,
+				    dwarf_ranges, dwarf_ranges_size,
+				    is_bigendian, error_callback, data,
+				    u, addrs))
+	    return 0;
+	}
+    }
+
+  return 1;
+}
+
+/* Build a mapping from address ranges to the compilation units where
+   the line number information for that range can be found.  Returns 1
+   on success, 0 on failure.  */
+
+static int
+build_address_map (struct backtrace_state *state, uintptr_t base_address,
+		   const unsigned char *dwarf_info, size_t dwarf_info_size,
+		   const unsigned char *dwarf_abbrev, size_t dwarf_abbrev_size,
+		   const unsigned char *dwarf_ranges, size_t dwarf_ranges_size,
+		   const unsigned char *dwarf_str, size_t dwarf_str_size,
+		   int is_bigendian, backtrace_error_callback error_callback,
+		   void *data, struct unit_addrs_vector *addrs)
+{
+  struct dwarf_buf info;
+  struct abbrevs abbrevs;
+
+  memset (&addrs->vec, 0, sizeof addrs->vec);
+  addrs->count = 0;
+
+  /* Read through the .debug_info section.  FIXME: Should we use the
+     .debug_aranges section?  gdb and addr2line don't use it, but I'm
+     not sure why.  */
+
+  info.name = ".debug_info";
+  info.start = dwarf_info;
+  info.buf = dwarf_info;
+  info.left = dwarf_info_size;
+  info.is_bigendian = is_bigendian;
+  info.error_callback = error_callback;
+  info.data = data;
+  info.reported_underflow = 0;
+
+  memset (&abbrevs, 0, sizeof abbrevs);
+  while (info.left > 0)
+    {
+      const unsigned char *unit_data_start;
+      uint64_t len;
+      int is_dwarf64;
+      struct dwarf_buf unit_buf;
+      int version;
+      uint64_t abbrev_offset;
+      int addrsize;
+      struct unit *u;
+
+      if (info.reported_underflow)
+	goto fail;
+
+      unit_data_start = info.buf;
+
+      is_dwarf64 = 0;
+      len = read_uint32 (&info);
+      if (len == 0xffffffff)
+	{
+	  len = read_uint64 (&info);
+	  is_dwarf64 = 1;
+	}
+
+      unit_buf = info;
+      unit_buf.left = len;
+
+      if (!advance (&info, len))
+	goto fail;
+
+      version = read_uint16 (&unit_buf);
+      if (version < 2 || version > 4)
+	{
+	  dwarf_buf_error (&unit_buf, "unrecognized DWARF version");
+	  goto fail;
+	}
+
+      abbrev_offset = read_offset (&unit_buf, is_dwarf64);
+      if (!read_abbrevs (state, abbrev_offset, dwarf_abbrev, dwarf_abbrev_size,
+			 is_bigendian, error_callback, data, &abbrevs))
+	goto fail;
+
+      addrsize = read_byte (&unit_buf);
+
+      u = ((struct unit *)
+	   backtrace_alloc (state, sizeof *u, error_callback, data));
+      if (u == NULL)
+	goto fail;
+      u->unit_data = unit_buf.buf;
+      u->unit_data_len = unit_buf.left;
+      u->unit_data_offset = unit_buf.buf - unit_data_start;
+      u->version = version;
+      u->is_dwarf64 = is_dwarf64;
+      u->addrsize = addrsize;
+      u->filename = NULL;
+      u->comp_dir = NULL;
+      u->abs_filename = NULL;
+      u->lineoff = 0;
+      u->abbrevs = abbrevs;
+      memset (&abbrevs, 0, sizeof abbrevs);
+
+      /* The actual line number mappings will be read as needed.  */
+      u->lines = NULL;
+      u->lines_count = 0;
+      u->function_addrs = NULL;
+      u->function_addrs_count = 0;
+
+      if (!find_address_ranges (state, base_address, &unit_buf,
+				dwarf_str, dwarf_str_size,
+				dwarf_ranges, dwarf_ranges_size,
+				is_bigendian, error_callback, data,
+				u, addrs))
+	{
+	  free_abbrevs (state, &u->abbrevs, error_callback, data);
+	  backtrace_free (state, u, sizeof *u, error_callback, data);
+	  goto fail;
+	}
+
+      if (unit_buf.reported_underflow)
+	{
+	  free_abbrevs (state, &u->abbrevs, error_callback, data);
+	  backtrace_free (state, u, sizeof *u, error_callback, data);
+	  goto fail;
+	}
+    }
+  if (info.reported_underflow)
+    goto fail;
+
+  return 1;
+
+ fail:
+  free_abbrevs (state, &abbrevs, error_callback, data);
+  free_unit_addrs_vector (state, addrs, error_callback, data);
+  return 0;
+}
+
+/* Add a new mapping to the vector of line mappings that we are
+   building.  Returns 1 on success, 0 on failure.  */
+
+static int
+add_line (struct backtrace_state *state, struct dwarf_data *ddata,
+	  uintptr_t pc, const char *filename, int lineno,
+	  backtrace_error_callback error_callback, void *data,
+	  struct line_vector *vec)
+{
+  struct line *ln;
+
+  /* If we are adding the same mapping, ignore it.  This can happen
+     when using discriminators.  */
+  if (vec->count > 0)
+    {
+      ln = (struct line *) vec->vec.base + (vec->count - 1);
+      if (pc == ln->pc && filename == ln->filename && lineno == ln->lineno)
+	return 1;
+    }
+
+  ln = ((struct line *)
+	backtrace_vector_grow (state, sizeof (struct line), error_callback,
+			       data, &vec->vec));
+  if (ln == NULL)
+    return 0;
+
+  /* Add in the base address here, so that we can look up the PC
+     directly.  */
+  ln->pc = pc + ddata->base_address;
+
+  ln->filename = filename;
+  ln->lineno = lineno;
+  ln->idx = vec->count;
+
+  ++vec->count;
+
+  return 1;
+}
+
+/* Free the line header information.  If FREE_FILENAMES is true we
+   free the file names themselves, otherwise we leave them, as there
+   may be line structures pointing to them.  */
+
+static void
+free_line_header (struct backtrace_state *state, struct line_header *hdr,
+		  backtrace_error_callback error_callback, void *data)
+{
+  backtrace_free (state, hdr->dirs, hdr->dirs_count * sizeof (const char *),
+		  error_callback, data);
+  backtrace_free (state, hdr->filenames,
+		  hdr->filenames_count * sizeof (char *),
+		  error_callback, data);
+}
+
+/* Read the line header.  Return 1 on success, 0 on failure.  */
+
+static int
+read_line_header (struct backtrace_state *state, struct unit *u,
+		  int is_dwarf64, struct dwarf_buf *line_buf,
+		  struct line_header *hdr)
+{
+  uint64_t hdrlen;
+  struct dwarf_buf hdr_buf;
+  const unsigned char *p;
+  const unsigned char *pend;
+  size_t i;
+
+  hdr->version = read_uint16 (line_buf);
+  if (hdr->version < 2 || hdr->version > 4)
+    {
+      dwarf_buf_error (line_buf, "unsupported line number version");
+      return 0;
+    }
+
+  hdrlen = read_offset (line_buf, is_dwarf64);
+
+  hdr_buf = *line_buf;
+  hdr_buf.left = hdrlen;
+
+  if (!advance (line_buf, hdrlen))
+    return 0;
+
+  hdr->min_insn_len = read_byte (&hdr_buf);
+  if (hdr->version < 4)
+    hdr->max_ops_per_insn = 1;
+  else
+    hdr->max_ops_per_insn = read_byte (&hdr_buf);
+
+  /* We don't care about default_is_stmt.  */
+  read_byte (&hdr_buf);
+
+  hdr->line_base = read_sbyte (&hdr_buf);
+  hdr->line_range = read_byte (&hdr_buf);
+
+  hdr->opcode_base = read_byte (&hdr_buf);
+  hdr->opcode_lengths = hdr_buf.buf;
+  if (!advance (&hdr_buf, hdr->opcode_base - 1))
+    return 0;
+
+  /* Count the number of directory entries.  */
+  hdr->dirs_count = 0;
+  p = hdr_buf.buf;
+  pend = p + hdr_buf.left;
+  while (p < pend && *p != '\0')
+    {
+      p += strnlen((const char *) p, pend - p) + 1;
+      ++hdr->dirs_count;
+    }
+
+  hdr->dirs = ((const char **)
+	       backtrace_alloc (state,
+				hdr->dirs_count * sizeof (const char *),
+				line_buf->error_callback, line_buf->data));
+  if (hdr->dirs == NULL)
+    return 0;
+
+  i = 0;
+  while (*hdr_buf.buf != '\0')
+    {
+      if (hdr_buf.reported_underflow)
+	return 0;
+
+      hdr->dirs[i] = (const char *) hdr_buf.buf;
+      ++i;
+      if (!advance (&hdr_buf,
+		    strnlen ((const char *) hdr_buf.buf, hdr_buf.left) + 1))
+	return 0;
+    }
+  if (!advance (&hdr_buf, 1))
+    return 0;
+
+  /* Count the number of file entries.  */
+  hdr->filenames_count = 0;
+  p = hdr_buf.buf;
+  pend = p + hdr_buf.left;
+  while (p < pend && *p != '\0')
+    {
+      p += strnlen ((const char *) p, pend - p) + 1;
+      p += leb128_len (p);
+      p += leb128_len (p);
+      p += leb128_len (p);
+      ++hdr->filenames_count;
+    }
+
+  hdr->filenames = ((const char **)
+		    backtrace_alloc (state,
+				     hdr->filenames_count * sizeof (char *),
+				     line_buf->error_callback,
+				     line_buf->data));
+  if (hdr->filenames == NULL)
+    return 0;
+  i = 0;
+  while (*hdr_buf.buf != '\0')
+    {
+      const char *filename;
+      uint64_t dir_index;
+
+      if (hdr_buf.reported_underflow)
+	return 0;
+
+      filename = (const char *) hdr_buf.buf;
+      if (!advance (&hdr_buf,
+		    strnlen ((const char *) hdr_buf.buf, hdr_buf.left) + 1))
+	return 0;
+      dir_index = read_uleb128 (&hdr_buf);
+      if (IS_ABSOLUTE_PATH (filename)
+	  || (dir_index == 0 && u->comp_dir == NULL))
+	hdr->filenames[i] = filename;
+      else
+	{
+	  const char *dir;
+	  size_t dir_len;
+	  size_t filename_len;
+	  char *s;
+
+	  if (dir_index == 0)
+	    dir = u->comp_dir;
+	  else if (dir_index - 1 < hdr->dirs_count)
+	    dir = hdr->dirs[dir_index - 1];
+	  else
+	    {
+	      dwarf_buf_error (line_buf,
+			       ("invalid directory index in "
+				"line number program header"));
+	      return 0;
+	    }
+	  dir_len = strlen (dir);
+	  filename_len = strlen (filename);
+	  s = ((char *)
+	       backtrace_alloc (state, dir_len + filename_len + 2,
+				line_buf->error_callback, line_buf->data));
+	  if (s == NULL)
+	    return 0;
+	  memcpy (s, dir, dir_len);
+	  /* FIXME: If we are on a DOS-based file system, and the
+	     directory or the file name use backslashes, then we
+	     should use a backslash here.  */
+	  s[dir_len] = '/';
+	  memcpy (s + dir_len + 1, filename, filename_len + 1);
+	  hdr->filenames[i] = s;
+	}
+
+      /* Ignore the modification time and size.  */
+      read_uleb128 (&hdr_buf);
+      read_uleb128 (&hdr_buf);
+
+      ++i;
+    }
+
+  if (hdr_buf.reported_underflow)
+    return 0;
+
+  return 1;
+}
+
+/* Read the line program, adding line mappings to VEC.  Return 1 on
+   success, 0 on failure.  */
+
+static int
+read_line_program (struct backtrace_state *state, struct dwarf_data *ddata,
+		   struct unit *u, const struct line_header *hdr,
+		   struct dwarf_buf *line_buf, struct line_vector *vec)
+{
+  uint64_t address;
+  unsigned int op_index;
+  const char *reset_filename;
+  const char *filename;
+  int lineno;
+
+  address = 0;
+  op_index = 0;
+  if (hdr->filenames_count > 0)
+    reset_filename = hdr->filenames[0];
+  else
+    reset_filename = "";
+  filename = reset_filename;
+  lineno = 1;
+  while (line_buf->left > 0)
+    {
+      unsigned int op;
+
+      op = read_byte (line_buf);
+      if (op >= hdr->opcode_base)
+	{
+	  unsigned int advance;
+
+	  /* Special opcode.  */
+	  op -= hdr->opcode_base;
+	  advance = op / hdr->line_range;
+	  address += (hdr->min_insn_len * (op_index + advance)
+		      / hdr->max_ops_per_insn);
+	  op_index = (op_index + advance) % hdr->max_ops_per_insn;
+	  lineno += hdr->line_base + (int) (op % hdr->line_range);
+	  add_line (state, ddata, address, filename, lineno,
+		    line_buf->error_callback, line_buf->data, vec);
+	}
+      else if (op == DW_LNS_extended_op)
+	{
+	  uint64_t len;
+
+	  len = read_uleb128 (line_buf);
+	  op = read_byte (line_buf);
+	  switch (op)
+	    {
+	    case DW_LNE_end_sequence:
+	      /* FIXME: Should we mark the high PC here?  It seems
+		 that we already have that information from the
+		 compilation unit.  */
+	      address = 0;
+	      op_index = 0;
+	      filename = reset_filename;
+	      lineno = 1;
+	      break;
+	    case DW_LNE_set_address:
+	      address = read_address (line_buf, u->addrsize);
+	      break;
+	    case DW_LNE_define_file:
+	      {
+		const char *f;
+		unsigned int dir_index;
+
+		f = (const char *) line_buf->buf;
+		if (!advance (line_buf, strnlen (f, line_buf->left) + 1))
+		  return 0;
+		dir_index = read_uleb128 (line_buf);
+		/* Ignore that time and length.  */
+		read_uleb128 (line_buf);
+		read_uleb128 (line_buf);
+		if (IS_ABSOLUTE_PATH (f))
+		  filename = f;
+		else
+		  {
+		    const char *dir;
+		    size_t dir_len;
+		    size_t f_len;
+		    char *p;
+
+		    if (dir_index == 0)
+		      dir = u->comp_dir;
+		    else if (dir_index - 1 < hdr->dirs_count)
+		      dir = hdr->dirs[dir_index - 1];
+		    else
+		      {
+			dwarf_buf_error (line_buf,
+					 ("invalid directory index "
+					  "in line number program"));
+			return 0;
+		      }
+		    dir_len = strlen (dir);
+		    f_len = strlen (f);
+		    p = ((char *)
+			 backtrace_alloc (state, dir_len + f_len + 2,
+					  line_buf->error_callback,
+					  line_buf->data));
+		    if (p == NULL)
+		      return 0;
+		    memcpy (p, dir, dir_len);
+		    /* FIXME: If we are on a DOS-based file system,
+		       and the directory or the file name use
+		       backslashes, then we should use a backslash
+		       here.  */
+		    p[dir_len] = '/';
+		    memcpy (p + dir_len + 1, f, f_len + 1);
+		    filename = p;
+		  }
+	      }
+	      break;
+	    case DW_LNE_set_discriminator:
+	      /* We don't care about discriminators.  */
+	      read_uleb128 (line_buf);
+	      break;
+	    default:
+	      if (!advance (line_buf, len - 1))
+		return 0;
+	      break;
+	    }
+	}
+      else
+	{
+	  switch (op)
+	    {
+	    case DW_LNS_copy:
+	      add_line (state, ddata, address, filename, lineno,
+			line_buf->error_callback, line_buf->data, vec);
+	      break;
+	    case DW_LNS_advance_pc:
+	      {
+		uint64_t advance;
+
+		advance = read_uleb128 (line_buf);
+		address += (hdr->min_insn_len * (op_index + advance)
+			    / hdr->max_ops_per_insn);
+		op_index = (op_index + advance) % hdr->max_ops_per_insn;
+	      }
+	      break;
+	    case DW_LNS_advance_line:
+	      lineno += (int) read_sleb128 (line_buf);
+	      break;
+	    case DW_LNS_set_file:
+	      {
+		uint64_t fileno;
+
+		fileno = read_uleb128 (line_buf);
+		if (fileno == 0)
+		  filename = "";
+		else
+		  {
+		    if (fileno - 1 >= hdr->filenames_count)
+		      {
+			dwarf_buf_error (line_buf,
+					 ("invalid file number in "
+					  "line number program"));
+			return 0;
+		      }
+		    filename = hdr->filenames[fileno - 1];
+		  }
+	      }
+	      break;
+	    case DW_LNS_set_column:
+	      read_uleb128 (line_buf);
+	      break;
+	    case DW_LNS_negate_stmt:
+	      break;
+	    case DW_LNS_set_basic_block:
+	      break;
+	    case DW_LNS_const_add_pc:
+	      {
+		unsigned int advance;
+
+		op = 255 - hdr->opcode_base;
+		advance = op / hdr->line_range;
+		address += (hdr->min_insn_len * (op_index + advance)
+			    / hdr->max_ops_per_insn);
+		op_index = (op_index + advance) % hdr->max_ops_per_insn;
+	      }
+	      break;
+	    case DW_LNS_fixed_advance_pc:
+	      address += read_uint16 (line_buf);
+	      op_index = 0;
+	      break;
+	    case DW_LNS_set_prologue_end:
+	      break;
+	    case DW_LNS_set_epilogue_begin:
+	      break;
+	    case DW_LNS_set_isa:
+	      read_uleb128 (line_buf);
+	      break;
+	    default:
+	      {
+		unsigned int i;
+
+		for (i = hdr->opcode_lengths[op - 1]; i > 0; --i)
+		  read_uleb128 (line_buf);
+	      }
+	      break;
+	    }
+	}
+    }
+
+  return 1;
+}
+
+/* Read the line number information for a compilation unit.  Returns 1
+   on success, 0 on failure.  */
+
+static int
+read_line_info (struct backtrace_state *state, struct dwarf_data *ddata,
+		backtrace_error_callback error_callback, void *data,
+		struct unit *u, struct line_header *hdr, struct line **lines,
+		size_t *lines_count)
+{
+  struct line_vector vec;
+  struct dwarf_buf line_buf;
+  uint64_t len;
+  int is_dwarf64;
+  struct line *ln;
+
+  memset (&vec.vec, 0, sizeof vec.vec);
+  vec.count = 0;
+
+  memset (hdr, 0, sizeof *hdr);
+
+  if (u->lineoff != (off_t) (size_t) u->lineoff
+      || (size_t) u->lineoff >= ddata->dwarf_line_size)
+    {
+      error_callback (data, "unit line offset out of range", 0);
+      goto fail;
+    }
+
+  line_buf.name = ".debug_line";
+  line_buf.start = ddata->dwarf_line;
+  line_buf.buf = ddata->dwarf_line + u->lineoff;
+  line_buf.left = ddata->dwarf_line_size - u->lineoff;
+  line_buf.is_bigendian = ddata->is_bigendian;
+  line_buf.error_callback = error_callback;
+  line_buf.data = data;
+  line_buf.reported_underflow = 0;
+
+  is_dwarf64 = 0;
+  len = read_uint32 (&line_buf);
+  if (len == 0xffffffff)
+    {
+      len = read_uint64 (&line_buf);
+      is_dwarf64 = 1;
+    }
+  line_buf.left = len;
+
+  if (!read_line_header (state, u, is_dwarf64, &line_buf, hdr))
+    goto fail;
+
+  if (!read_line_program (state, ddata, u, hdr, &line_buf, &vec))
+    goto fail;
+
+  if (line_buf.reported_underflow)
+    goto fail;
+
+  if (vec.count == 0)
+    {
+      /* This is not a failure in the sense of a generating an error,
+	 but it is a failure in that sense that we have no useful
+	 information.  */
+      goto fail;
+    }
+
+  /* Allocate one extra entry at the end.  */
+  ln = ((struct line *)
+	backtrace_vector_grow (state, sizeof (struct line), error_callback,
+			       data, &vec.vec));
+  if (ln == NULL)
+    goto fail;
+  ln->pc = (uintptr_t) -1;
+  ln->filename = NULL;
+  ln->lineno = 0;
+  ln->idx = 0;
+
+  if (!backtrace_vector_release (state, &vec.vec, error_callback, data))
+    goto fail;
+
+  ln = (struct line *) vec.vec.base;
+  backtrace_qsort (ln, vec.count, sizeof (struct line), line_compare);
+
+  *lines = ln;
+  *lines_count = vec.count;
+
+  return 1;
+
+ fail:
+  vec.vec.alc += vec.vec.size;
+  vec.vec.size = 0;
+  backtrace_vector_release (state, &vec.vec, error_callback, data);
+  free_line_header (state, hdr, error_callback, data);
+  *lines = (struct line *) (uintptr_t) -1;
+  *lines_count = 0;
+  return 0;
+}
+
+/* Read the name of a function from a DIE referenced by a
+   DW_AT_abstract_origin or DW_AT_specification tag.  OFFSET is within
+   the same compilation unit.  */
+
+static const char *
+read_referenced_name (struct dwarf_data *ddata, struct unit *u,
+		      uint64_t offset, backtrace_error_callback error_callback,
+		      void *data)
+{
+  struct dwarf_buf unit_buf;
+  uint64_t code;
+  const struct abbrev *abbrev;
+  const char *ret;
+  size_t i;
+
+  /* OFFSET is from the start of the data for this compilation unit.
+     U->unit_data is the data, but it starts U->unit_data_offset bytes
+     from the beginning.  */
+
+  if (offset < u->unit_data_offset
+      || offset - u->unit_data_offset >= u->unit_data_len)
+    {
+      error_callback (data,
+		      "abstract origin or specification out of range",
+		      0);
+      return NULL;
+    }
+
+  offset -= u->unit_data_offset;
+
+  unit_buf.name = ".debug_info";
+  unit_buf.start = ddata->dwarf_info;
+  unit_buf.buf = u->unit_data + offset;
+  unit_buf.left = u->unit_data_len - offset;
+  unit_buf.is_bigendian = ddata->is_bigendian;
+  unit_buf.error_callback = error_callback;
+  unit_buf.data = data;
+  unit_buf.reported_underflow = 0;
+
+  code = read_uleb128 (&unit_buf);
+  if (code == 0)
+    {
+      dwarf_buf_error (&unit_buf, "invalid abstract origin or specification");
+      return NULL;
+    }
+
+  abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data);
+  if (abbrev == NULL)
+    return NULL;
+
+  ret = NULL;
+  for (i = 0; i < abbrev->num_attrs; ++i)
+    {
+      struct attr_val val;
+
+      if (!read_attribute (abbrev->attrs[i].form, &unit_buf,
+			   u->is_dwarf64, u->version, u->addrsize,
+			   ddata->dwarf_str, ddata->dwarf_str_size,
+			   &val))
+	return NULL;
+
+      switch (abbrev->attrs[i].name)
+	{
+	case DW_AT_name:
+	  /* We prefer the linkage name if get one.  */
+	  if (val.encoding == ATTR_VAL_STRING)
+	    ret = val.u.string;
+	  break;
+
+	case DW_AT_linkage_name:
+	case DW_AT_MIPS_linkage_name:
+	  if (val.encoding == ATTR_VAL_STRING)
+	    return val.u.string;
+	  break;
+
+	case DW_AT_specification:
+	  if (abbrev->attrs[i].form == DW_FORM_ref_addr
+	      || abbrev->attrs[i].form == DW_FORM_ref_sig8)
+	    {
+	      /* This refers to a specification defined in some other
+		 compilation unit.  We can handle this case if we
+		 must, but it's harder.  */
+	      break;
+	    }
+	  if (val.encoding == ATTR_VAL_UINT
+	      || val.encoding == ATTR_VAL_REF_UNIT)
+	    {
+	      const char *name;
+
+	      name = read_referenced_name (ddata, u, val.u.uint,
+					   error_callback, data);
+	      if (name != NULL)
+		ret = name;
+	    }
+	  break;
+
+	default:
+	  break;
+	}
+    }
+
+  return ret;
+}
+
+/* Add a single range to U that maps to function.  Returns 1 on
+   success, 0 on error.  */
+
+static int
+add_function_range (struct backtrace_state *state, struct dwarf_data *ddata,
+		    struct function *function, uint64_t lowpc, uint64_t highpc,
+		    backtrace_error_callback error_callback,
+		    void *data, struct function_vector *vec)
+{
+  struct function_addrs *p;
+
+  /* Add in the base address here, so that we can look up the PC
+     directly.  */
+  lowpc += ddata->base_address;
+  highpc += ddata->base_address;
+
+  if (vec->count > 0)
+    {
+      p = (struct function_addrs *) vec->vec.base + vec->count - 1;
+      if ((lowpc == p->high || lowpc == p->high + 1)
+	  && function == p->function)
+	{
+	  if (highpc > p->high)
+	    p->high = highpc;
+	  return 1;
+	}
+    }
+
+  p = ((struct function_addrs *)
+       backtrace_vector_grow (state, sizeof (struct function_addrs),
+			      error_callback, data, &vec->vec));
+  if (p == NULL)
+    return 0;
+
+  p->low = lowpc;
+  p->high = highpc;
+  p->function = function;
+  ++vec->count;
+  return 1;
+}
+
+/* Add PC ranges to U that map to FUNCTION.  Returns 1 on success, 0
+   on error.  */
+
+static int
+add_function_ranges (struct backtrace_state *state, struct dwarf_data *ddata,
+		     struct unit *u, struct function *function,
+		     uint64_t ranges, uint64_t base,
+		     backtrace_error_callback error_callback, void *data,
+		     struct function_vector *vec)
+{
+  struct dwarf_buf ranges_buf;
+
+  if (ranges >= ddata->dwarf_ranges_size)
+    {
+      error_callback (data, "function ranges offset out of range", 0);
+      return 0;
+    }
+
+  ranges_buf.name = ".debug_ranges";
+  ranges_buf.start = ddata->dwarf_ranges;
+  ranges_buf.buf = ddata->dwarf_ranges + ranges;
+  ranges_buf.left = ddata->dwarf_ranges_size - ranges;
+  ranges_buf.is_bigendian = ddata->is_bigendian;
+  ranges_buf.error_callback = error_callback;
+  ranges_buf.data = data;
+  ranges_buf.reported_underflow = 0;
+
+  while (1)
+    {
+      uint64_t low;
+      uint64_t high;
+
+      if (ranges_buf.reported_underflow)
+	return 0;
+
+      low = read_address (&ranges_buf, u->addrsize);
+      high = read_address (&ranges_buf, u->addrsize);
+
+      if (low == 0 && high == 0)
+	break;
+
+      if (is_highest_address (low, u->addrsize))
+	base = high;
+      else
+	{
+	  if (!add_function_range (state, ddata, function, low + base,
+				   high + base, error_callback, data, vec))
+	    return 0;
+	}
+    }
+
+  if (ranges_buf.reported_underflow)
+    return 0;
+
+  return 1;
+}
+
+/* Read one entry plus all its children.  Add function addresses to
+   VEC.  Returns 1 on success, 0 on error.  */
+
+static int
+read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata,
+		     struct unit *u, uint64_t base, struct dwarf_buf *unit_buf,
+		     const struct line_header *lhdr,
+		     backtrace_error_callback error_callback, void *data,
+		     struct function_vector *vec_function,
+		     struct function_vector *vec_inlined)
+{
+  while (unit_buf->left > 0)
+    {
+      uint64_t code;
+      const struct abbrev *abbrev;
+      int is_function;
+      struct function *function;
+      struct function_vector *vec;
+      size_t i;
+      uint64_t lowpc;
+      int have_lowpc;
+      uint64_t highpc;
+      int have_highpc;
+      int highpc_is_relative;
+      uint64_t ranges;
+      int have_ranges;
+
+      code = read_uleb128 (unit_buf);
+      if (code == 0)
+	return 1;
+
+      abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data);
+      if (abbrev == NULL)
+	return 0;
+
+      is_function = (abbrev->tag == DW_TAG_subprogram
+		     || abbrev->tag == DW_TAG_entry_point
+		     || abbrev->tag == DW_TAG_inlined_subroutine);
+
+      if (abbrev->tag == DW_TAG_inlined_subroutine)
+	vec = vec_inlined;
+      else
+	vec = vec_function;
+
+      function = NULL;
+      if (is_function)
+	{
+	  function = ((struct function *)
+		      backtrace_alloc (state, sizeof *function,
+				       error_callback, data));
+	  if (function == NULL)
+	    return 0;
+	  memset (function, 0, sizeof *function);
+	}
+
+      lowpc = 0;
+      have_lowpc = 0;
+      highpc = 0;
+      have_highpc = 0;
+      highpc_is_relative = 0;
+      ranges = 0;
+      have_ranges = 0;
+      for (i = 0; i < abbrev->num_attrs; ++i)
+	{
+	  struct attr_val val;
+
+	  if (!read_attribute (abbrev->attrs[i].form, unit_buf,
+			       u->is_dwarf64, u->version, u->addrsize,
+			       ddata->dwarf_str, ddata->dwarf_str_size,
+			       &val))
+	    return 0;
+
+	  /* The compile unit sets the base address for any address
+	     ranges in the function entries.  */
+	  if (abbrev->tag == DW_TAG_compile_unit
+	      && abbrev->attrs[i].name == DW_AT_low_pc
+	      && val.encoding == ATTR_VAL_ADDRESS)
+	    base = val.u.uint;
+
+	  if (is_function)
+	    {
+	      switch (abbrev->attrs[i].name)
+		{
+		case DW_AT_call_file:
+		  if (val.encoding == ATTR_VAL_UINT)
+		    {
+		      if (val.u.uint == 0)
+			function->caller_filename = "";
+		      else
+			{
+			  if (val.u.uint - 1 >= lhdr->filenames_count)
+			    {
+			      dwarf_buf_error (unit_buf,
+					       ("invalid file number in "
+						"DW_AT_call_file attribute"));
+			      return 0;
+			    }
+			  function->caller_filename =
+			    lhdr->filenames[val.u.uint - 1];
+			}
+		    }
+		  break;
+
+		case DW_AT_call_line:
+		  if (val.encoding == ATTR_VAL_UINT)
+		    function->caller_lineno = val.u.uint;
+		  break;
+
+		case DW_AT_abstract_origin:
+		case DW_AT_specification:
+		  if (abbrev->attrs[i].form == DW_FORM_ref_addr
+		      || abbrev->attrs[i].form == DW_FORM_ref_sig8)
+		    {
+		      /* This refers to an abstract origin defined in
+			 some other compilation unit.  We can handle
+			 this case if we must, but it's harder.  */
+		      break;
+		    }
+		  if (val.encoding == ATTR_VAL_UINT
+		      || val.encoding == ATTR_VAL_REF_UNIT)
+		    {
+		      const char *name;
+
+		      name = read_referenced_name (ddata, u, val.u.uint,
+						   error_callback, data);
+		      if (name != NULL)
+			function->name = name;
+		    }
+		  break;
+
+		case DW_AT_name:
+		  if (val.encoding == ATTR_VAL_STRING)
+		    {
+		      /* Don't override a name we found in some other
+			 way, as it will normally be more
+			 useful--e.g., this name is normally not
+			 mangled.  */
+		      if (function->name == NULL)
+			function->name = val.u.string;
+		    }
+		  break;
+
+		case DW_AT_linkage_name:
+		case DW_AT_MIPS_linkage_name:
+		  if (val.encoding == ATTR_VAL_STRING)
+		    function->name = val.u.string;
+		  break;
+
+		case DW_AT_low_pc:
+		  if (val.encoding == ATTR_VAL_ADDRESS)
+		    {
+		      lowpc = val.u.uint;
+		      have_lowpc = 1;
+		    }
+		  break;
+
+		case DW_AT_high_pc:
+		  if (val.encoding == ATTR_VAL_ADDRESS)
+		    {
+		      highpc = val.u.uint;
+		      have_highpc = 1;
+		    }
+		  else if (val.encoding == ATTR_VAL_UINT)
+		    {
+		      highpc = val.u.uint;
+		      have_highpc = 1;
+		      highpc_is_relative = 1;
+		    }
+		  break;
+
+		case DW_AT_ranges:
+		  if (val.encoding == ATTR_VAL_UINT
+		      || val.encoding == ATTR_VAL_REF_SECTION)
+		    {
+		      ranges = val.u.uint;
+		      have_ranges = 1;
+		    }
+		  break;
+
+		default:
+		  break;
+		}
+	    }
+	}
+
+      /* If we couldn't find a name for the function, we have no use
+	 for it.  */
+      if (is_function && function->name == NULL)
+	{
+	  backtrace_free (state, function, sizeof *function,
+			  error_callback, data);
+	  is_function = 0;
+	}
+
+      if (is_function)
+	{
+	  if (have_ranges)
+	    {
+	      if (!add_function_ranges (state, ddata, u, function, ranges,
+					base, error_callback, data, vec))
+		return 0;
+	    }
+	  else if (have_lowpc && have_highpc)
+	    {
+	      if (highpc_is_relative)
+		highpc += lowpc;
+	      if (!add_function_range (state, ddata, function, lowpc, highpc,
+				       error_callback, data, vec))
+		return 0;
+	    }
+	  else
+	    {
+	      backtrace_free (state, function, sizeof *function,
+			      error_callback, data);
+	      is_function = 0;
+	    }
+	}
+
+      if (abbrev->has_children)
+	{
+	  if (!is_function)
+	    {
+	      if (!read_function_entry (state, ddata, u, base, unit_buf, lhdr,
+					error_callback, data, vec_function,
+					vec_inlined))
+		return 0;
+	    }
+	  else
+	    {
+	      struct function_vector fvec;
+
+	      /* Gather any information for inlined functions in
+		 FVEC.  */
+
+	      memset (&fvec, 0, sizeof fvec);
+
+	      if (!read_function_entry (state, ddata, u, base, unit_buf, lhdr,
+					error_callback, data, vec_function,
+					&fvec))
+		return 0;
+
+	      if (fvec.count > 0)
+		{
+		  struct function_addrs *faddrs;
+
+		  if (!backtrace_vector_release (state, &fvec.vec,
+						 error_callback, data))
+		    return 0;
+
+		  faddrs = (struct function_addrs *) fvec.vec.base;
+		  backtrace_qsort (faddrs, fvec.count,
+				   sizeof (struct function_addrs),
+				   function_addrs_compare);
+
+		  function->function_addrs = faddrs;
+		  function->function_addrs_count = fvec.count;
+		}
+	    }
+	}
+    }
+
+  return 1;
+}
+
+/* Read function name information for a compilation unit.  We look
+   through the whole unit looking for function tags.  */
+
+static void
+read_function_info (struct backtrace_state *state, struct dwarf_data *ddata,
+		    const struct line_header *lhdr,
+		    backtrace_error_callback error_callback, void *data,
+		    struct unit *u, struct function_vector *fvec,
+		    struct function_addrs **ret_addrs,
+		    size_t *ret_addrs_count)
+{
+  struct function_vector lvec;
+  struct function_vector *pfvec;
+  struct dwarf_buf unit_buf;
+  struct function_addrs *addrs;
+  size_t addrs_count;
+
+  /* Use FVEC if it is not NULL.  Otherwise use our own vector.  */
+  if (fvec != NULL)
+    pfvec = fvec;
+  else
+    {
+      memset (&lvec, 0, sizeof lvec);
+      pfvec = &lvec;
+    }
+
+  unit_buf.name = ".debug_info";
+  unit_buf.start = ddata->dwarf_info;
+  unit_buf.buf = u->unit_data;
+  unit_buf.left = u->unit_data_len;
+  unit_buf.is_bigendian = ddata->is_bigendian;
+  unit_buf.error_callback = error_callback;
+  unit_buf.data = data;
+  unit_buf.reported_underflow = 0;
+
+  while (unit_buf.left > 0)
+    {
+      if (!read_function_entry (state, ddata, u, 0, &unit_buf, lhdr,
+				error_callback, data, pfvec, pfvec))
+	return;
+    }
+
+  if (pfvec->count == 0)
+    return;
+
+  addrs_count = pfvec->count;
+
+  if (fvec == NULL)
+    {
+      if (!backtrace_vector_release (state, &lvec.vec, error_callback, data))
+	return;
+      addrs = (struct function_addrs *) pfvec->vec.base;
+    }
+  else
+    {
+      /* Finish this list of addresses, but leave the remaining space in
+	 the vector available for the next function unit.  */
+      addrs = ((struct function_addrs *)
+	       backtrace_vector_finish (state, &fvec->vec,
+					error_callback, data));
+      if (addrs == NULL)
+	return;
+      fvec->count = 0;
+    }
+
+  backtrace_qsort (addrs, addrs_count, sizeof (struct function_addrs),
+		   function_addrs_compare);
+
+  *ret_addrs = addrs;
+  *ret_addrs_count = addrs_count;
+}
+
+/* See if PC is inlined in FUNCTION.  If it is, print out the inlined
+   information, and update FILENAME and LINENO for the caller.
+   Returns whatever CALLBACK returns, or 0 to keep going.  */
+
+static int
+report_inlined_functions (uintptr_t pc, struct function *function,
+			  backtrace_full_callback callback, void *data,
+			  const char **filename, int *lineno)
+{
+  struct function_addrs *function_addrs;
+  struct function *inlined;
+  int ret;
+
+  if (function->function_addrs_count == 0)
+    return 0;
+
+  function_addrs = ((struct function_addrs *)
+		    bsearch (&pc, function->function_addrs,
+			     function->function_addrs_count,
+			     sizeof (struct function_addrs),
+			     function_addrs_search));
+  if (function_addrs == NULL)
+    return 0;
+
+  while (((size_t) (function_addrs - function->function_addrs) + 1
+	  < function->function_addrs_count)
+	 && pc >= (function_addrs + 1)->low
+	 && pc < (function_addrs + 1)->high)
+    ++function_addrs;
+
+  /* We found an inlined call.  */
+
+  inlined = function_addrs->function;
+
+  /* Report any calls inlined into this one.  */
+  ret = report_inlined_functions (pc, inlined, callback, data,
+				  filename, lineno);
+  if (ret != 0)
+    return ret;
+
+  /* Report this inlined call.  */
+  ret = callback (data, pc, *filename, *lineno, inlined->name);
+  if (ret != 0)
+    return ret;
+
+  /* Our caller will report the caller of the inlined function; tell
+     it the appropriate filename and line number.  */
+  *filename = inlined->caller_filename;
+  *lineno = inlined->caller_lineno;
+
+  return 0;
+}
+
+/* Look for a PC in the DWARF mapping for one module.  On success,
+   call CALLBACK and return whatever it returns.  On error, call
+   ERROR_CALLBACK and return 0.  Sets *FOUND to 1 if the PC is found,
+   0 if not.  */
+
+static int
+dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata,
+		 uintptr_t pc, backtrace_full_callback callback,
+		 backtrace_error_callback error_callback, void *data,
+		 int *found)
+{
+  struct unit_addrs *entry;
+  struct unit *u;
+  int new_data;
+  struct line *lines;
+  struct line *ln;
+  struct function_addrs *function_addrs;
+  struct function *function;
+  const char *filename;
+  int lineno;
+  int ret;
+
+  *found = 1;
+
+  /* Find an address range that includes PC.  */
+  entry = bsearch (&pc, ddata->addrs, ddata->addrs_count,
+		   sizeof (struct unit_addrs), unit_addrs_search);
+
+  if (entry == NULL)
+    {
+      *found = 0;
+      return 0;
+    }
+
+  /* If there are multiple ranges that contain PC, use the last one,
+     in order to produce predictable results.  If we assume that all
+     ranges are properly nested, then the last range will be the
+     smallest one.  */
+  while ((size_t) (entry - ddata->addrs) + 1 < ddata->addrs_count
+	 && pc >= (entry + 1)->low
+	 && pc < (entry + 1)->high)
+    ++entry;
+
+  /* We need the lines, lines_count, function_addrs,
+     function_addrs_count fields of u.  If they are not set, we need
+     to set them.  When running in threaded mode, we need to allow for
+     the possibility that some other thread is setting them
+     simultaneously.  */
+
+  u = entry->u;
+  lines = u->lines;
+
+  /* Skip units with no useful line number information by walking
+     backward.  Useless line number information is marked by setting
+     lines == -1.  */
+  while (entry > ddata->addrs
+	 && pc >= (entry - 1)->low
+	 && pc < (entry - 1)->high)
+    {
+      if (state->threaded)
+	lines = (struct line *) backtrace_atomic_load_pointer (&u->lines);
+
+      if (lines != (struct line *) (uintptr_t) -1)
+	break;
+
+      --entry;
+
+      u = entry->u;
+      lines = u->lines;
+    }
+
+  if (state->threaded)
+    lines = backtrace_atomic_load_pointer (&u->lines);
+
+  new_data = 0;
+  if (lines == NULL)
+    {
+      size_t function_addrs_count;
+      struct line_header lhdr;
+      size_t count;
+
+      /* We have never read the line information for this unit.  Read
+	 it now.  */
+
+      function_addrs = NULL;
+      function_addrs_count = 0;
+      if (read_line_info (state, ddata, error_callback, data, entry->u, &lhdr,
+			  &lines, &count))
+	{
+	  struct function_vector *pfvec;
+
+	  /* If not threaded, reuse DDATA->FVEC for better memory
+	     consumption.  */
+	  if (state->threaded)
+	    pfvec = NULL;
+	  else
+	    pfvec = &ddata->fvec;
+	  read_function_info (state, ddata, &lhdr, error_callback, data,
+			      entry->u, pfvec, &function_addrs,
+			      &function_addrs_count);
+	  free_line_header (state, &lhdr, error_callback, data);
+	  new_data = 1;
+	}
+
+      /* Atomically store the information we just read into the unit.
+	 If another thread is simultaneously writing, it presumably
+	 read the same information, and we don't care which one we
+	 wind up with; we just leak the other one.  We do have to
+	 write the lines field last, so that the acquire-loads above
+	 ensure that the other fields are set.  */
+
+      if (!state->threaded)
+	{
+	  u->lines_count = count;
+	  u->function_addrs = function_addrs;
+	  u->function_addrs_count = function_addrs_count;
+	  u->lines = lines;
+	}
+      else
+	{
+	  backtrace_atomic_store_size_t (&u->lines_count, count);
+	  backtrace_atomic_store_pointer (&u->function_addrs, function_addrs);
+	  backtrace_atomic_store_size_t (&u->function_addrs_count,
+					 function_addrs_count);
+	  backtrace_atomic_store_pointer (&u->lines, lines);
+	}
+    }
+
+  /* Now all fields of U have been initialized.  */
+
+  if (lines == (struct line *) (uintptr_t) -1)
+    {
+      /* If reading the line number information failed in some way,
+	 try again to see if there is a better compilation unit for
+	 this PC.  */
+      if (new_data)
+	return dwarf_lookup_pc (state, ddata, pc, callback, error_callback,
+				data, found);
+      return callback (data, pc, NULL, 0, NULL);
+    }
+
+  /* Search for PC within this unit.  */
+
+  ln = (struct line *) bsearch (&pc, lines, entry->u->lines_count,
+				sizeof (struct line), line_search);
+  if (ln == NULL)
+    {
+      /* The PC is between the low_pc and high_pc attributes of the
+	 compilation unit, but no entry in the line table covers it.
+	 This implies that the start of the compilation unit has no
+	 line number information.  */
+
+      if (entry->u->abs_filename == NULL)
+	{
+	  const char *filename;
+
+	  filename = entry->u->filename;
+	  if (filename != NULL
+	      && !IS_ABSOLUTE_PATH (filename)
+	      && entry->u->comp_dir != NULL)
+	    {
+	      size_t filename_len;
+	      const char *dir;
+	      size_t dir_len;
+	      char *s;
+
+	      filename_len = strlen (filename);
+	      dir = entry->u->comp_dir;
+	      dir_len = strlen (dir);
+	      s = (char *) backtrace_alloc (state, dir_len + filename_len + 2,
+					    error_callback, data);
+	      if (s == NULL)
+		{
+		  *found = 0;
+		  return 0;
+		}
+	      memcpy (s, dir, dir_len);
+	      /* FIXME: Should use backslash if DOS file system.  */
+	      s[dir_len] = '/';
+	      memcpy (s + dir_len + 1, filename, filename_len + 1);
+	      filename = s;
+	    }
+	  entry->u->abs_filename = filename;
+	}
+
+      return callback (data, pc, entry->u->abs_filename, 0, NULL);
+    }
+
+  /* Search for function name within this unit.  */
+
+  if (entry->u->function_addrs_count == 0)
+    return callback (data, pc, ln->filename, ln->lineno, NULL);
+
+  function_addrs = ((struct function_addrs *)
+		    bsearch (&pc, entry->u->function_addrs,
+			     entry->u->function_addrs_count,
+			     sizeof (struct function_addrs),
+			     function_addrs_search));
+  if (function_addrs == NULL)
+    return callback (data, pc, ln->filename, ln->lineno, NULL);
+
+  /* If there are multiple function ranges that contain PC, use the
+     last one, in order to produce predictable results.  */
+
+  while (((size_t) (function_addrs - entry->u->function_addrs + 1)
+	  < entry->u->function_addrs_count)
+	 && pc >= (function_addrs + 1)->low
+	 && pc < (function_addrs + 1)->high)
+    ++function_addrs;
+
+  function = function_addrs->function;
+
+  filename = ln->filename;
+  lineno = ln->lineno;
+
+  ret = report_inlined_functions (pc, function, callback, data,
+				  &filename, &lineno);
+  if (ret != 0)
+    return ret;
+
+  return callback (data, pc, filename, lineno, function->name);
+}
+
+
+/* Return the file/line information for a PC using the DWARF mapping
+   we built earlier.  */
+
+static int
+dwarf_fileline (struct backtrace_state *state, uintptr_t pc,
+		backtrace_full_callback callback,
+		backtrace_error_callback error_callback, void *data)
+{
+  struct dwarf_data *ddata;
+  int found;
+  int ret;
+
+  if (!state->threaded)
+    {
+      for (ddata = (struct dwarf_data *) state->fileline_data;
+	   ddata != NULL;
+	   ddata = ddata->next)
+	{
+	  ret = dwarf_lookup_pc (state, ddata, pc, callback, error_callback,
+				 data, &found);
+	  if (ret != 0 || found)
+	    return ret;
+	}
+    }
+  else
+    {
+      struct dwarf_data **pp;
+
+      pp = (struct dwarf_data **) (void *) &state->fileline_data;
+      while (1)
+	{
+	  ddata = backtrace_atomic_load_pointer (pp);
+	  if (ddata == NULL)
+	    break;
+
+	  ret = dwarf_lookup_pc (state, ddata, pc, callback, error_callback,
+				 data, &found);
+	  if (ret != 0 || found)
+	    return ret;
+
+	  pp = &ddata->next;
+	}
+    }
+
+  /* FIXME: See if any libraries have been dlopen'ed.  */
+
+  return callback (data, pc, NULL, 0, NULL);
+}
+
+/* Initialize our data structures from the DWARF debug info for a
+   file.  Return NULL on failure.  */
+
+static struct dwarf_data *
+build_dwarf_data (struct backtrace_state *state,
+		  uintptr_t base_address,
+		  const unsigned char *dwarf_info,
+		  size_t dwarf_info_size,
+		  const unsigned char *dwarf_line,
+		  size_t dwarf_line_size,
+		  const unsigned char *dwarf_abbrev,
+		  size_t dwarf_abbrev_size,
+		  const unsigned char *dwarf_ranges,
+		  size_t dwarf_ranges_size,
+		  const unsigned char *dwarf_str,
+		  size_t dwarf_str_size,
+		  int is_bigendian,
+		  backtrace_error_callback error_callback,
+		  void *data)
+{
+  struct unit_addrs_vector addrs_vec;
+  struct unit_addrs *addrs;
+  size_t addrs_count;
+  struct dwarf_data *fdata;
+
+  if (!build_address_map (state, base_address, dwarf_info, dwarf_info_size,
+			  dwarf_abbrev, dwarf_abbrev_size, dwarf_ranges,
+			  dwarf_ranges_size, dwarf_str, dwarf_str_size,
+			  is_bigendian, error_callback, data, &addrs_vec))
+    return NULL;
+
+  if (!backtrace_vector_release (state, &addrs_vec.vec, error_callback, data))
+    return NULL;
+  addrs = (struct unit_addrs *) addrs_vec.vec.base;
+  addrs_count = addrs_vec.count;
+  backtrace_qsort (addrs, addrs_count, sizeof (struct unit_addrs),
+		   unit_addrs_compare);
+
+  fdata = ((struct dwarf_data *)
+	   backtrace_alloc (state, sizeof (struct dwarf_data),
+			    error_callback, data));
+  if (fdata == NULL)
+    return NULL;
+
+  fdata->next = NULL;
+  fdata->base_address = base_address;
+  fdata->addrs = addrs;
+  fdata->addrs_count = addrs_count;
+  fdata->dwarf_info = dwarf_info;
+  fdata->dwarf_info_size = dwarf_info_size;
+  fdata->dwarf_line = dwarf_line;
+  fdata->dwarf_line_size = dwarf_line_size;
+  fdata->dwarf_ranges = dwarf_ranges;
+  fdata->dwarf_ranges_size = dwarf_ranges_size;
+  fdata->dwarf_str = dwarf_str;
+  fdata->dwarf_str_size = dwarf_str_size;
+  fdata->is_bigendian = is_bigendian;
+  memset (&fdata->fvec, 0, sizeof fdata->fvec);
+
+  return fdata;
+}
+
+/* Build our data structures from the DWARF sections for a module.
+   Set FILELINE_FN and STATE->FILELINE_DATA.  Return 1 on success, 0
+   on failure.  */
+
+int
+backtrace_dwarf_add (struct backtrace_state *state,
+		     uintptr_t base_address,
+		     const unsigned char *dwarf_info,
+		     size_t dwarf_info_size,
+		     const unsigned char *dwarf_line,
+		     size_t dwarf_line_size,
+		     const unsigned char *dwarf_abbrev,
+		     size_t dwarf_abbrev_size,
+		     const unsigned char *dwarf_ranges,
+		     size_t dwarf_ranges_size,
+		     const unsigned char *dwarf_str,
+		     size_t dwarf_str_size,
+		     int is_bigendian,
+		     backtrace_error_callback error_callback,
+		     void *data, fileline *fileline_fn)
+{
+  struct dwarf_data *fdata;
+
+  fdata = build_dwarf_data (state, base_address, dwarf_info, dwarf_info_size,
+			    dwarf_line, dwarf_line_size, dwarf_abbrev,
+			    dwarf_abbrev_size, dwarf_ranges, dwarf_ranges_size,
+			    dwarf_str, dwarf_str_size, is_bigendian,
+			    error_callback, data);
+  if (fdata == NULL)
+    return 0;
+
+  if (!state->threaded)
+    {
+      struct dwarf_data **pp;
+
+      for (pp = (struct dwarf_data **) (void *) &state->fileline_data;
+	   *pp != NULL;
+	   pp = &(*pp)->next)
+	;
+      *pp = fdata;
+    }
+  else
+    {
+      while (1)
+	{
+	  struct dwarf_data **pp;
+
+	  pp = (struct dwarf_data **) (void *) &state->fileline_data;
+
+	  while (1)
+	    {
+	      struct dwarf_data *p;
+
+	      p = backtrace_atomic_load_pointer (pp);
+
+	      if (p == NULL)
+		break;
+
+	      pp = &p->next;
+	    }
+
+	  if (__sync_bool_compare_and_swap (pp, NULL, fdata))
+	    break;
+	}
+    }
+
+  *fileline_fn = dwarf_fileline;
+
+  return 1;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/dwarf2.def
@@ -0,0 +1,773 @@
+/* -*- c -*-
+   Declarations and definitions of codes relating to the DWARF2 and
+   DWARF3 symbolic debugging information formats.
+   Copyright (C) 1992-2015 Free Software Foundation, Inc.
+
+   Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
+   Office (AJPO), Florida State University and Silicon Graphics Inc.
+   provided support for this effort -- June 21, 1995.
+
+   Derived from the DWARF 1 implementation written by Ron Guilmette
+   (rfg@netcom.com), November 1990.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it under
+   the terms of the GNU General Public License as published by the Free
+   Software Foundation; either version 3, or (at your option) any later
+   version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This file is derived from the DWARF specification (a public document)
+   Revision 2.0.0 (July 27, 1993) developed by the UNIX International
+   Programming Languages Special Interest Group (UI/PLSIG) and distributed
+   by UNIX International.  Copies of this specification are available from
+   UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
+
+   This file also now contains definitions from the DWARF 3 specification
+   published Dec 20, 2005, available from: http://dwarf.freestandards.org.
+
+   This file also now contains definitions from the DWARF 4
+   specification, available from: http://dwarfstd.org/ */
+
+/* This file declares various DWARF-related constants using a set of
+   macros which can be redefined by the including file.
+   
+   The macros are in sections.  Each section corresponds to a single
+   set of DWARF constants and has a corresponding key.  The key is
+   used in all the macro names.
+   
+   The sections are TAG (for DW_TAG_ constants), FORM (DW_FORM_), AT
+   (DW_AT_), OP (DW_OP_), ATE (DW_ATE_), and CFA (DW_CFA_).
+   
+   Using TAG as an example, the following macros may be used for each
+   key:
+   
+   DW_FIRST_TAG(name, value) - Introduce the first DW_TAG constant.
+   
+   DW_TAG(name, value) - Define a subsequent constant.
+   
+   DW_TAG_DUP(name, value) - Define a subsequent constant whose value
+   is a duplicate of some other constant.  Not all keys use the _DUP
+   macro form.  If more than one name shares a value, then the base
+   (DW_TAG) form will be the preferred name and DW_TAG_DUP will hold
+   any alternate names.
+   
+   DW_END_TAG - Invoked at the end of the DW_TAG constants.  */
+
+DW_FIRST_TAG (DW_TAG_padding, 0x00)
+DW_TAG (DW_TAG_array_type, 0x01)
+DW_TAG (DW_TAG_class_type, 0x02)
+DW_TAG (DW_TAG_entry_point, 0x03)
+DW_TAG (DW_TAG_enumeration_type, 0x04)
+DW_TAG (DW_TAG_formal_parameter, 0x05)
+DW_TAG (DW_TAG_imported_declaration, 0x08)
+DW_TAG (DW_TAG_label, 0x0a)
+DW_TAG (DW_TAG_lexical_block, 0x0b)
+DW_TAG (DW_TAG_member, 0x0d)
+DW_TAG (DW_TAG_pointer_type, 0x0f)
+DW_TAG (DW_TAG_reference_type, 0x10)
+DW_TAG (DW_TAG_compile_unit, 0x11)
+DW_TAG (DW_TAG_string_type, 0x12)
+DW_TAG (DW_TAG_structure_type, 0x13)
+DW_TAG (DW_TAG_subroutine_type, 0x15)
+DW_TAG (DW_TAG_typedef, 0x16)
+DW_TAG (DW_TAG_union_type, 0x17)
+DW_TAG (DW_TAG_unspecified_parameters, 0x18)
+DW_TAG (DW_TAG_variant, 0x19)
+DW_TAG (DW_TAG_common_block, 0x1a)
+DW_TAG (DW_TAG_common_inclusion, 0x1b)
+DW_TAG (DW_TAG_inheritance, 0x1c)
+DW_TAG (DW_TAG_inlined_subroutine, 0x1d)
+DW_TAG (DW_TAG_module, 0x1e)
+DW_TAG (DW_TAG_ptr_to_member_type, 0x1f)
+DW_TAG (DW_TAG_set_type, 0x20)
+DW_TAG (DW_TAG_subrange_type, 0x21)
+DW_TAG (DW_TAG_with_stmt, 0x22)
+DW_TAG (DW_TAG_access_declaration, 0x23)
+DW_TAG (DW_TAG_base_type, 0x24)
+DW_TAG (DW_TAG_catch_block, 0x25)
+DW_TAG (DW_TAG_const_type, 0x26)
+DW_TAG (DW_TAG_constant, 0x27)
+DW_TAG (DW_TAG_enumerator, 0x28)
+DW_TAG (DW_TAG_file_type, 0x29)
+DW_TAG (DW_TAG_friend, 0x2a)
+DW_TAG (DW_TAG_namelist, 0x2b)
+DW_TAG (DW_TAG_namelist_item, 0x2c)
+DW_TAG (DW_TAG_packed_type, 0x2d)
+DW_TAG (DW_TAG_subprogram, 0x2e)
+DW_TAG (DW_TAG_template_type_param, 0x2f)
+DW_TAG (DW_TAG_template_value_param, 0x30)
+DW_TAG (DW_TAG_thrown_type, 0x31)
+DW_TAG (DW_TAG_try_block, 0x32)
+DW_TAG (DW_TAG_variant_part, 0x33)
+DW_TAG (DW_TAG_variable, 0x34)
+DW_TAG (DW_TAG_volatile_type, 0x35)
+/* DWARF 3.  */
+DW_TAG (DW_TAG_dwarf_procedure, 0x36)
+DW_TAG (DW_TAG_restrict_type, 0x37)
+DW_TAG (DW_TAG_interface_type, 0x38)
+DW_TAG (DW_TAG_namespace, 0x39)
+DW_TAG (DW_TAG_imported_module, 0x3a)
+DW_TAG (DW_TAG_unspecified_type, 0x3b)
+DW_TAG (DW_TAG_partial_unit, 0x3c)
+DW_TAG (DW_TAG_imported_unit, 0x3d)
+DW_TAG (DW_TAG_condition, 0x3f)
+DW_TAG (DW_TAG_shared_type, 0x40)
+/* DWARF 4.  */
+DW_TAG (DW_TAG_type_unit, 0x41)
+DW_TAG (DW_TAG_rvalue_reference_type, 0x42)
+DW_TAG (DW_TAG_template_alias, 0x43)
+/* DWARF 5.  */
+DW_TAG (DW_TAG_coarray_type, 0x44)
+DW_TAG (DW_TAG_generic_subrange, 0x45)
+DW_TAG (DW_TAG_dynamic_type, 0x46)
+DW_TAG (DW_TAG_atomic_type, 0x47)
+DW_TAG (DW_TAG_call_site, 0x48)
+DW_TAG (DW_TAG_call_site_parameter, 0x49)
+DW_TAG (DW_TAG_skeleton_unit, 0x4a)
+DW_TAG (DW_TAG_immutable_type, 0x4b)
+
+DW_TAG_DUP (DW_TAG_lo_user, 0x4080)
+DW_TAG_DUP (DW_TAG_hi_user, 0xffff)
+
+/* SGI/MIPS Extensions.  */
+DW_TAG (DW_TAG_MIPS_loop, 0x4081)
+
+/* HP extensions.  See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz .  */
+DW_TAG (DW_TAG_HP_array_descriptor, 0x4090)
+DW_TAG (DW_TAG_HP_Bliss_field, 0x4091)
+DW_TAG (DW_TAG_HP_Bliss_field_set, 0x4092)
+
+/* GNU extensions.  */
+DW_TAG (DW_TAG_format_label, 0x4101)	/* For FORTRAN 77 and Fortran 90.  */
+DW_TAG (DW_TAG_function_template, 0x4102)	/* For C++.  */
+DW_TAG (DW_TAG_class_template, 0x4103)	/* For C++.  */
+DW_TAG (DW_TAG_GNU_BINCL, 0x4104)
+DW_TAG (DW_TAG_GNU_EINCL, 0x4105)
+/* Template template parameter.
+   See http://gcc.gnu.org/wiki/TemplateParmsDwarf .  */
+DW_TAG (DW_TAG_GNU_template_template_param, 0x4106)
+
+/* Template parameter pack extension, specified at
+   http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates
+   The values of these two TAGS are in the DW_TAG_GNU_* space until the tags
+   are properly part of DWARF 5.  */
+DW_TAG (DW_TAG_GNU_template_parameter_pack, 0x4107)
+DW_TAG (DW_TAG_GNU_formal_parameter_pack, 0x4108)
+/* The GNU call site extension, specified at
+   http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open .
+   The values of these two TAGS are in the DW_TAG_GNU_* space until the tags
+   are properly part of DWARF 5.  */
+DW_TAG (DW_TAG_GNU_call_site, 0x4109)
+DW_TAG (DW_TAG_GNU_call_site_parameter, 0x410a)
+/* Extensions for UPC.  See: http://dwarfstd.org/doc/DWARF4.pdf.  */
+DW_TAG (DW_TAG_upc_shared_type, 0x8765)
+DW_TAG (DW_TAG_upc_strict_type, 0x8766)
+DW_TAG (DW_TAG_upc_relaxed_type, 0x8767)
+/* PGI (STMicroelectronics) extensions.  No documentation available.  */
+DW_TAG (DW_TAG_PGI_kanji_type, 0xA000)
+DW_TAG (DW_TAG_PGI_interface_block, 0xA020)
+DW_END_TAG
+
+DW_FIRST_FORM (DW_FORM_addr, 0x01)
+DW_FORM (DW_FORM_block2, 0x03)
+DW_FORM (DW_FORM_block4, 0x04)
+DW_FORM (DW_FORM_data2, 0x05)
+DW_FORM (DW_FORM_data4, 0x06)
+DW_FORM (DW_FORM_data8, 0x07)
+DW_FORM (DW_FORM_string, 0x08)
+DW_FORM (DW_FORM_block, 0x09)
+DW_FORM (DW_FORM_block1, 0x0a)
+DW_FORM (DW_FORM_data1, 0x0b)
+DW_FORM (DW_FORM_flag, 0x0c)
+DW_FORM (DW_FORM_sdata, 0x0d)
+DW_FORM (DW_FORM_strp, 0x0e)
+DW_FORM (DW_FORM_udata, 0x0f)
+DW_FORM (DW_FORM_ref_addr, 0x10)
+DW_FORM (DW_FORM_ref1, 0x11)
+DW_FORM (DW_FORM_ref2, 0x12)
+DW_FORM (DW_FORM_ref4, 0x13)
+DW_FORM (DW_FORM_ref8, 0x14)
+DW_FORM (DW_FORM_ref_udata, 0x15)
+DW_FORM (DW_FORM_indirect, 0x16)
+/* DWARF 4.  */
+DW_FORM (DW_FORM_sec_offset, 0x17)
+DW_FORM (DW_FORM_exprloc, 0x18)
+DW_FORM (DW_FORM_flag_present, 0x19)
+DW_FORM (DW_FORM_ref_sig8, 0x20)
+/* DWARF 5.  */
+DW_FORM (DW_FORM_strx, 0x1a)
+DW_FORM (DW_FORM_addrx, 0x1b)
+DW_FORM (DW_FORM_ref_sup, 0x1c)
+DW_FORM (DW_FORM_strp_sup, 0x1d)
+DW_FORM (DW_FORM_data16, 0x1e)
+DW_FORM (DW_FORM_line_strp, 0x1f)
+DW_FORM (DW_FORM_implicit_const, 0x21)
+DW_FORM (DW_FORM_loclistx, 0x22)
+DW_FORM (DW_FORM_rnglistx, 0x23)
+/* Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFission.  */
+DW_FORM (DW_FORM_GNU_addr_index, 0x1f01)
+DW_FORM (DW_FORM_GNU_str_index, 0x1f02)
+/* Extensions for DWZ multifile.
+   See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open .  */
+DW_FORM (DW_FORM_GNU_ref_alt, 0x1f20)
+DW_FORM (DW_FORM_GNU_strp_alt, 0x1f21)
+DW_END_FORM
+
+DW_FIRST_AT (DW_AT_sibling, 0x01)
+DW_AT (DW_AT_location, 0x02)
+DW_AT (DW_AT_name, 0x03)
+DW_AT (DW_AT_ordering, 0x09)
+DW_AT (DW_AT_subscr_data, 0x0a)
+DW_AT (DW_AT_byte_size, 0x0b)
+DW_AT (DW_AT_bit_offset, 0x0c)
+DW_AT (DW_AT_bit_size, 0x0d)
+DW_AT (DW_AT_element_list, 0x0f)
+DW_AT (DW_AT_stmt_list, 0x10)
+DW_AT (DW_AT_low_pc, 0x11)
+DW_AT (DW_AT_high_pc, 0x12)
+DW_AT (DW_AT_language, 0x13)
+DW_AT (DW_AT_member, 0x14)
+DW_AT (DW_AT_discr, 0x15)
+DW_AT (DW_AT_discr_value, 0x16)
+DW_AT (DW_AT_visibility, 0x17)
+DW_AT (DW_AT_import, 0x18)
+DW_AT (DW_AT_string_length, 0x19)
+DW_AT (DW_AT_common_reference, 0x1a)
+DW_AT (DW_AT_comp_dir, 0x1b)
+DW_AT (DW_AT_const_value, 0x1c)
+DW_AT (DW_AT_containing_type, 0x1d)
+DW_AT (DW_AT_default_value, 0x1e)
+DW_AT (DW_AT_inline, 0x20)
+DW_AT (DW_AT_is_optional, 0x21)
+DW_AT (DW_AT_lower_bound, 0x22)
+DW_AT (DW_AT_producer, 0x25)
+DW_AT (DW_AT_prototyped, 0x27)
+DW_AT (DW_AT_return_addr, 0x2a)
+DW_AT (DW_AT_start_scope, 0x2c)
+DW_AT (DW_AT_bit_stride, 0x2e)
+DW_AT (DW_AT_upper_bound, 0x2f)
+DW_AT (DW_AT_abstract_origin, 0x31)
+DW_AT (DW_AT_accessibility, 0x32)
+DW_AT (DW_AT_address_class, 0x33)
+DW_AT (DW_AT_artificial, 0x34)
+DW_AT (DW_AT_base_types, 0x35)
+DW_AT (DW_AT_calling_convention, 0x36)
+DW_AT (DW_AT_count, 0x37)
+DW_AT (DW_AT_data_member_location, 0x38)
+DW_AT (DW_AT_decl_column, 0x39)
+DW_AT (DW_AT_decl_file, 0x3a)
+DW_AT (DW_AT_decl_line, 0x3b)
+DW_AT (DW_AT_declaration, 0x3c)
+DW_AT (DW_AT_discr_list, 0x3d)
+DW_AT (DW_AT_encoding, 0x3e)
+DW_AT (DW_AT_external, 0x3f)
+DW_AT (DW_AT_frame_base, 0x40)
+DW_AT (DW_AT_friend, 0x41)
+DW_AT (DW_AT_identifier_case, 0x42)
+DW_AT (DW_AT_macro_info, 0x43)
+DW_AT (DW_AT_namelist_items, 0x44)
+DW_AT (DW_AT_priority, 0x45)
+DW_AT (DW_AT_segment, 0x46)
+DW_AT (DW_AT_specification, 0x47)
+DW_AT (DW_AT_static_link, 0x48)
+DW_AT (DW_AT_type, 0x49)
+DW_AT (DW_AT_use_location, 0x4a)
+DW_AT (DW_AT_variable_parameter, 0x4b)
+DW_AT (DW_AT_virtuality, 0x4c)
+DW_AT (DW_AT_vtable_elem_location, 0x4d)
+/* DWARF 3 values.  */
+DW_AT (DW_AT_allocated, 0x4e)
+DW_AT (DW_AT_associated, 0x4f)
+DW_AT (DW_AT_data_location, 0x50)
+DW_AT (DW_AT_byte_stride, 0x51)
+DW_AT (DW_AT_entry_pc, 0x52)
+DW_AT (DW_AT_use_UTF8, 0x53)
+DW_AT (DW_AT_extension, 0x54)
+DW_AT (DW_AT_ranges, 0x55)
+DW_AT (DW_AT_trampoline, 0x56)
+DW_AT (DW_AT_call_column, 0x57)
+DW_AT (DW_AT_call_file, 0x58)
+DW_AT (DW_AT_call_line, 0x59)
+DW_AT (DW_AT_description, 0x5a)
+DW_AT (DW_AT_binary_scale, 0x5b)
+DW_AT (DW_AT_decimal_scale, 0x5c)
+DW_AT (DW_AT_small, 0x5d)
+DW_AT (DW_AT_decimal_sign, 0x5e)
+DW_AT (DW_AT_digit_count, 0x5f)
+DW_AT (DW_AT_picture_string, 0x60)
+DW_AT (DW_AT_mutable, 0x61)
+DW_AT (DW_AT_threads_scaled, 0x62)
+DW_AT (DW_AT_explicit, 0x63)
+DW_AT (DW_AT_object_pointer, 0x64)
+DW_AT (DW_AT_endianity, 0x65)
+DW_AT (DW_AT_elemental, 0x66)
+DW_AT (DW_AT_pure, 0x67)
+DW_AT (DW_AT_recursive, 0x68)
+/* DWARF 4.  */
+DW_AT (DW_AT_signature, 0x69)
+DW_AT (DW_AT_main_subprogram, 0x6a)
+DW_AT (DW_AT_data_bit_offset, 0x6b)
+DW_AT (DW_AT_const_expr, 0x6c)
+DW_AT (DW_AT_enum_class, 0x6d)
+DW_AT (DW_AT_linkage_name, 0x6e)
+/* DWARF 5.  */
+DW_AT (DW_AT_string_length_bit_size, 0x6f)
+DW_AT (DW_AT_string_length_byte_size, 0x70)
+DW_AT (DW_AT_rank, 0x71)
+DW_AT (DW_AT_str_offsets_base, 0x72)
+DW_AT (DW_AT_addr_base, 0x73)
+DW_AT (DW_AT_rnglists_base, 0x74)
+DW_AT (DW_AT_dwo_name, 0x76)
+DW_AT (DW_AT_reference, 0x77)
+DW_AT (DW_AT_rvalue_reference, 0x78)
+DW_AT (DW_AT_macros, 0x79)
+DW_AT (DW_AT_call_all_calls, 0x7a)
+DW_AT (DW_AT_call_all_source_calls, 0x7b)
+DW_AT (DW_AT_call_all_tail_calls, 0x7c)
+DW_AT (DW_AT_call_return_pc, 0x7d)
+DW_AT (DW_AT_call_value, 0x7e)
+DW_AT (DW_AT_call_origin, 0x7f)
+DW_AT (DW_AT_call_parameter, 0x80)
+DW_AT (DW_AT_call_pc, 0x81)
+DW_AT (DW_AT_call_tail_call, 0x82)
+DW_AT (DW_AT_call_target, 0x83)
+DW_AT (DW_AT_call_target_clobbered, 0x84)
+DW_AT (DW_AT_call_data_location, 0x85)
+DW_AT (DW_AT_call_data_value, 0x86)
+DW_AT (DW_AT_noreturn, 0x87)
+DW_AT (DW_AT_alignment, 0x88)
+DW_AT (DW_AT_export_symbols, 0x89)
+DW_AT (DW_AT_deleted, 0x8a)
+DW_AT (DW_AT_defaulted, 0x8b)
+DW_AT (DW_AT_loclists_base, 0x8c)
+
+DW_AT_DUP (DW_AT_lo_user, 0x2000) /* Implementation-defined range start.  */
+DW_AT_DUP (DW_AT_hi_user, 0x3fff) /* Implementation-defined range end.  */
+
+/* SGI/MIPS extensions.  */
+DW_AT (DW_AT_MIPS_fde, 0x2001)
+DW_AT (DW_AT_MIPS_loop_begin, 0x2002)
+DW_AT (DW_AT_MIPS_tail_loop_begin, 0x2003)
+DW_AT (DW_AT_MIPS_epilog_begin, 0x2004)
+DW_AT (DW_AT_MIPS_loop_unroll_factor, 0x2005)
+DW_AT (DW_AT_MIPS_software_pipeline_depth, 0x2006)
+DW_AT (DW_AT_MIPS_linkage_name, 0x2007)
+DW_AT (DW_AT_MIPS_stride, 0x2008)
+DW_AT (DW_AT_MIPS_abstract_name, 0x2009)
+DW_AT (DW_AT_MIPS_clone_origin, 0x200a)
+DW_AT (DW_AT_MIPS_has_inlines, 0x200b)
+/* HP extensions.  */
+DW_AT (DW_AT_HP_block_index, 0x2000)
+DW_AT_DUP (DW_AT_HP_unmodifiable, 0x2001) /* Same as DW_AT_MIPS_fde.  */
+DW_AT_DUP (DW_AT_HP_prologue, 0x2005) /* Same as DW_AT_MIPS_loop_unroll.  */
+DW_AT_DUP (DW_AT_HP_epilogue, 0x2008) /* Same as DW_AT_MIPS_stride.  */
+DW_AT (DW_AT_HP_actuals_stmt_list, 0x2010)
+DW_AT (DW_AT_HP_proc_per_section, 0x2011)
+DW_AT (DW_AT_HP_raw_data_ptr, 0x2012)
+DW_AT (DW_AT_HP_pass_by_reference, 0x2013)
+DW_AT (DW_AT_HP_opt_level, 0x2014)
+DW_AT (DW_AT_HP_prof_version_id, 0x2015)
+DW_AT (DW_AT_HP_opt_flags, 0x2016)
+DW_AT (DW_AT_HP_cold_region_low_pc, 0x2017)
+DW_AT (DW_AT_HP_cold_region_high_pc, 0x2018)
+DW_AT (DW_AT_HP_all_variables_modifiable, 0x2019)
+DW_AT (DW_AT_HP_linkage_name, 0x201a)
+DW_AT (DW_AT_HP_prof_flags, 0x201b)  /* In comp unit of procs_info for -g.  */
+DW_AT (DW_AT_HP_unit_name, 0x201f)
+DW_AT (DW_AT_HP_unit_size, 0x2020)
+DW_AT (DW_AT_HP_widened_byte_size, 0x2021)
+DW_AT (DW_AT_HP_definition_points, 0x2022)
+DW_AT (DW_AT_HP_default_location, 0x2023)
+DW_AT (DW_AT_HP_is_result_param, 0x2029)
+
+/* GNU extensions.  */
+DW_AT (DW_AT_sf_names, 0x2101)
+DW_AT (DW_AT_src_info, 0x2102)
+DW_AT (DW_AT_mac_info, 0x2103)
+DW_AT (DW_AT_src_coords, 0x2104)
+DW_AT (DW_AT_body_begin, 0x2105)
+DW_AT (DW_AT_body_end, 0x2106)
+DW_AT (DW_AT_GNU_vector, 0x2107)
+/* Thread-safety annotations.
+   See http://gcc.gnu.org/wiki/ThreadSafetyAnnotation .  */
+DW_AT (DW_AT_GNU_guarded_by, 0x2108)
+DW_AT (DW_AT_GNU_pt_guarded_by, 0x2109)
+DW_AT (DW_AT_GNU_guarded, 0x210a)
+DW_AT (DW_AT_GNU_pt_guarded, 0x210b)
+DW_AT (DW_AT_GNU_locks_excluded, 0x210c)
+DW_AT (DW_AT_GNU_exclusive_locks_required, 0x210d)
+DW_AT (DW_AT_GNU_shared_locks_required, 0x210e)
+/* One-definition rule violation detection.
+   See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo .  */
+DW_AT (DW_AT_GNU_odr_signature, 0x210f)
+/* Template template argument name.
+   See http://gcc.gnu.org/wiki/TemplateParmsDwarf .  */
+DW_AT (DW_AT_GNU_template_name, 0x2110)
+/* The GNU call site extension.
+   See http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open .  */
+DW_AT (DW_AT_GNU_call_site_value, 0x2111)
+DW_AT (DW_AT_GNU_call_site_data_value, 0x2112)
+DW_AT (DW_AT_GNU_call_site_target, 0x2113)
+DW_AT (DW_AT_GNU_call_site_target_clobbered, 0x2114)
+DW_AT (DW_AT_GNU_tail_call, 0x2115)
+DW_AT (DW_AT_GNU_all_tail_call_sites, 0x2116)
+DW_AT (DW_AT_GNU_all_call_sites, 0x2117)
+DW_AT (DW_AT_GNU_all_source_call_sites, 0x2118)
+/* Section offset into .debug_macro section.  */
+DW_AT (DW_AT_GNU_macros, 0x2119)
+/* Attribute for C++ deleted special member functions (= delete;).  */
+DW_AT (DW_AT_GNU_deleted, 0x211a)
+/* Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFission.  */
+DW_AT (DW_AT_GNU_dwo_name, 0x2130)
+DW_AT (DW_AT_GNU_dwo_id, 0x2131)
+DW_AT (DW_AT_GNU_ranges_base, 0x2132)
+DW_AT (DW_AT_GNU_addr_base, 0x2133)
+DW_AT (DW_AT_GNU_pubnames, 0x2134)
+DW_AT (DW_AT_GNU_pubtypes, 0x2135)
+/* Attribute for discriminator.
+   See http://gcc.gnu.org/wiki/Discriminator  */
+DW_AT (DW_AT_GNU_discriminator, 0x2136)
+/* VMS extensions.  */
+DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201)
+/* GNAT extensions.  */
+/* GNAT descriptive type.
+   See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type .  */
+DW_AT (DW_AT_use_GNAT_descriptive_type, 0x2301)
+DW_AT (DW_AT_GNAT_descriptive_type, 0x2302)
+/* Rational constant extension.
+   See https://gcc.gnu.org/wiki/DW_AT_GNU_numerator_denominator .  */
+DW_TAG (DW_AT_GNU_numerator, 0x2303)
+DW_TAG (DW_AT_GNU_denominator, 0x2304)
+/* Biased integer extension.
+   See https://gcc.gnu.org/wiki/DW_AT_GNU_bias .  */
+DW_TAG (DW_AT_GNU_bias, 0x2305)
+/* UPC extension.  */
+DW_AT (DW_AT_upc_threads_scaled, 0x3210)
+/* PGI (STMicroelectronics) extensions.  */
+DW_AT (DW_AT_PGI_lbase, 0x3a00)
+DW_AT (DW_AT_PGI_soffset, 0x3a01)
+DW_AT (DW_AT_PGI_lstride, 0x3a02)
+/* Apple extensions.  */
+DW_AT (DW_AT_APPLE_optimized, 0x3fe1)
+DW_AT (DW_AT_APPLE_flags, 0x3fe2)
+DW_AT (DW_AT_APPLE_isa, 0x3fe3)
+DW_AT (DW_AT_APPLE_block, 0x3fe4)
+DW_AT (DW_AT_APPLE_major_runtime_vers, 0x3fe5)
+DW_AT (DW_AT_APPLE_runtime_class, 0x3fe6)
+DW_AT (DW_AT_APPLE_omit_frame_ptr, 0x3fe7)
+DW_AT (DW_AT_APPLE_property_name, 0x3fe8)
+DW_AT (DW_AT_APPLE_property_getter, 0x3fe9)
+DW_AT (DW_AT_APPLE_property_setter, 0x3fea)
+DW_AT (DW_AT_APPLE_property_attribute, 0x3feb)
+DW_AT (DW_AT_APPLE_objc_complete_type, 0x3fec)
+DW_AT (DW_AT_APPLE_property, 0x3fed)
+DW_END_AT
+
+DW_FIRST_OP (DW_OP_addr, 0x03)
+DW_OP (DW_OP_deref, 0x06)
+DW_OP (DW_OP_const1u, 0x08)
+DW_OP (DW_OP_const1s, 0x09)
+DW_OP (DW_OP_const2u, 0x0a)
+DW_OP (DW_OP_const2s, 0x0b)
+DW_OP (DW_OP_const4u, 0x0c)
+DW_OP (DW_OP_const4s, 0x0d)
+DW_OP (DW_OP_const8u, 0x0e)
+DW_OP (DW_OP_const8s, 0x0f)
+DW_OP (DW_OP_constu, 0x10)
+DW_OP (DW_OP_consts, 0x11)
+DW_OP (DW_OP_dup, 0x12)
+DW_OP (DW_OP_drop, 0x13)
+DW_OP (DW_OP_over, 0x14)
+DW_OP (DW_OP_pick, 0x15)
+DW_OP (DW_OP_swap, 0x16)
+DW_OP (DW_OP_rot, 0x17)
+DW_OP (DW_OP_xderef, 0x18)
+DW_OP (DW_OP_abs, 0x19)
+DW_OP (DW_OP_and, 0x1a)
+DW_OP (DW_OP_div, 0x1b)
+DW_OP (DW_OP_minus, 0x1c)
+DW_OP (DW_OP_mod, 0x1d)
+DW_OP (DW_OP_mul, 0x1e)
+DW_OP (DW_OP_neg, 0x1f)
+DW_OP (DW_OP_not, 0x20)
+DW_OP (DW_OP_or, 0x21)
+DW_OP (DW_OP_plus, 0x22)
+DW_OP (DW_OP_plus_uconst, 0x23)
+DW_OP (DW_OP_shl, 0x24)
+DW_OP (DW_OP_shr, 0x25)
+DW_OP (DW_OP_shra, 0x26)
+DW_OP (DW_OP_xor, 0x27)
+DW_OP (DW_OP_bra, 0x28)
+DW_OP (DW_OP_eq, 0x29)
+DW_OP (DW_OP_ge, 0x2a)
+DW_OP (DW_OP_gt, 0x2b)
+DW_OP (DW_OP_le, 0x2c)
+DW_OP (DW_OP_lt, 0x2d)
+DW_OP (DW_OP_ne, 0x2e)
+DW_OP (DW_OP_skip, 0x2f)
+DW_OP (DW_OP_lit0, 0x30)
+DW_OP (DW_OP_lit1, 0x31)
+DW_OP (DW_OP_lit2, 0x32)
+DW_OP (DW_OP_lit3, 0x33)
+DW_OP (DW_OP_lit4, 0x34)
+DW_OP (DW_OP_lit5, 0x35)
+DW_OP (DW_OP_lit6, 0x36)
+DW_OP (DW_OP_lit7, 0x37)
+DW_OP (DW_OP_lit8, 0x38)
+DW_OP (DW_OP_lit9, 0x39)
+DW_OP (DW_OP_lit10, 0x3a)
+DW_OP (DW_OP_lit11, 0x3b)
+DW_OP (DW_OP_lit12, 0x3c)
+DW_OP (DW_OP_lit13, 0x3d)
+DW_OP (DW_OP_lit14, 0x3e)
+DW_OP (DW_OP_lit15, 0x3f)
+DW_OP (DW_OP_lit16, 0x40)
+DW_OP (DW_OP_lit17, 0x41)
+DW_OP (DW_OP_lit18, 0x42)
+DW_OP (DW_OP_lit19, 0x43)
+DW_OP (DW_OP_lit20, 0x44)
+DW_OP (DW_OP_lit21, 0x45)
+DW_OP (DW_OP_lit22, 0x46)
+DW_OP (DW_OP_lit23, 0x47)
+DW_OP (DW_OP_lit24, 0x48)
+DW_OP (DW_OP_lit25, 0x49)
+DW_OP (DW_OP_lit26, 0x4a)
+DW_OP (DW_OP_lit27, 0x4b)
+DW_OP (DW_OP_lit28, 0x4c)
+DW_OP (DW_OP_lit29, 0x4d)
+DW_OP (DW_OP_lit30, 0x4e)
+DW_OP (DW_OP_lit31, 0x4f)
+DW_OP (DW_OP_reg0, 0x50)
+DW_OP (DW_OP_reg1, 0x51)
+DW_OP (DW_OP_reg2, 0x52)
+DW_OP (DW_OP_reg3, 0x53)
+DW_OP (DW_OP_reg4, 0x54)
+DW_OP (DW_OP_reg5, 0x55)
+DW_OP (DW_OP_reg6, 0x56)
+DW_OP (DW_OP_reg7, 0x57)
+DW_OP (DW_OP_reg8, 0x58)
+DW_OP (DW_OP_reg9, 0x59)
+DW_OP (DW_OP_reg10, 0x5a)
+DW_OP (DW_OP_reg11, 0x5b)
+DW_OP (DW_OP_reg12, 0x5c)
+DW_OP (DW_OP_reg13, 0x5d)
+DW_OP (DW_OP_reg14, 0x5e)
+DW_OP (DW_OP_reg15, 0x5f)
+DW_OP (DW_OP_reg16, 0x60)
+DW_OP (DW_OP_reg17, 0x61)
+DW_OP (DW_OP_reg18, 0x62)
+DW_OP (DW_OP_reg19, 0x63)
+DW_OP (DW_OP_reg20, 0x64)
+DW_OP (DW_OP_reg21, 0x65)
+DW_OP (DW_OP_reg22, 0x66)
+DW_OP (DW_OP_reg23, 0x67)
+DW_OP (DW_OP_reg24, 0x68)
+DW_OP (DW_OP_reg25, 0x69)
+DW_OP (DW_OP_reg26, 0x6a)
+DW_OP (DW_OP_reg27, 0x6b)
+DW_OP (DW_OP_reg28, 0x6c)
+DW_OP (DW_OP_reg29, 0x6d)
+DW_OP (DW_OP_reg30, 0x6e)
+DW_OP (DW_OP_reg31, 0x6f)
+DW_OP (DW_OP_breg0, 0x70)
+DW_OP (DW_OP_breg1, 0x71)
+DW_OP (DW_OP_breg2, 0x72)
+DW_OP (DW_OP_breg3, 0x73)
+DW_OP (DW_OP_breg4, 0x74)
+DW_OP (DW_OP_breg5, 0x75)
+DW_OP (DW_OP_breg6, 0x76)
+DW_OP (DW_OP_breg7, 0x77)
+DW_OP (DW_OP_breg8, 0x78)
+DW_OP (DW_OP_breg9, 0x79)
+DW_OP (DW_OP_breg10, 0x7a)
+DW_OP (DW_OP_breg11, 0x7b)
+DW_OP (DW_OP_breg12, 0x7c)
+DW_OP (DW_OP_breg13, 0x7d)
+DW_OP (DW_OP_breg14, 0x7e)
+DW_OP (DW_OP_breg15, 0x7f)
+DW_OP (DW_OP_breg16, 0x80)
+DW_OP (DW_OP_breg17, 0x81)
+DW_OP (DW_OP_breg18, 0x82)
+DW_OP (DW_OP_breg19, 0x83)
+DW_OP (DW_OP_breg20, 0x84)
+DW_OP (DW_OP_breg21, 0x85)
+DW_OP (DW_OP_breg22, 0x86)
+DW_OP (DW_OP_breg23, 0x87)
+DW_OP (DW_OP_breg24, 0x88)
+DW_OP (DW_OP_breg25, 0x89)
+DW_OP (DW_OP_breg26, 0x8a)
+DW_OP (DW_OP_breg27, 0x8b)
+DW_OP (DW_OP_breg28, 0x8c)
+DW_OP (DW_OP_breg29, 0x8d)
+DW_OP (DW_OP_breg30, 0x8e)
+DW_OP (DW_OP_breg31, 0x8f)
+DW_OP (DW_OP_regx, 0x90)
+DW_OP (DW_OP_fbreg, 0x91)
+DW_OP (DW_OP_bregx, 0x92)
+DW_OP (DW_OP_piece, 0x93)
+DW_OP (DW_OP_deref_size, 0x94)
+DW_OP (DW_OP_xderef_size, 0x95)
+DW_OP (DW_OP_nop, 0x96)
+/* DWARF 3 extensions.  */
+DW_OP (DW_OP_push_object_address, 0x97)
+DW_OP (DW_OP_call2, 0x98)
+DW_OP (DW_OP_call4, 0x99)
+DW_OP (DW_OP_call_ref, 0x9a)
+DW_OP (DW_OP_form_tls_address, 0x9b)
+DW_OP (DW_OP_call_frame_cfa, 0x9c)
+DW_OP (DW_OP_bit_piece, 0x9d)
+
+/* DWARF 4 extensions.  */
+DW_OP (DW_OP_implicit_value, 0x9e)
+DW_OP (DW_OP_stack_value, 0x9f)
+
+/* DWARF 5 extensions.  */
+DW_OP (DW_OP_implicit_pointer, 0xa0)
+DW_OP (DW_OP_addrx, 0xa1)
+DW_OP (DW_OP_constx, 0xa2)
+DW_OP (DW_OP_entry_value, 0xa3)
+DW_OP (DW_OP_const_type, 0xa4)
+DW_OP (DW_OP_regval_type, 0xa5)
+DW_OP (DW_OP_deref_type, 0xa6)
+DW_OP (DW_OP_xderef_type, 0xa7)
+DW_OP (DW_OP_convert, 0xa8)
+DW_OP (DW_OP_reinterpret, 0xa9)
+
+DW_OP_DUP (DW_OP_lo_user, 0xe0)	/* Implementation-defined range start.  */
+DW_OP_DUP (DW_OP_hi_user, 0xff)	/* Implementation-defined range end.  */
+
+/* GNU extensions.  */
+DW_OP (DW_OP_GNU_push_tls_address, 0xe0)
+/* The following is for marking variables that are uninitialized.  */
+DW_OP (DW_OP_GNU_uninit, 0xf0)
+DW_OP (DW_OP_GNU_encoded_addr, 0xf1)
+/* The GNU implicit pointer extension.
+   See http://www.dwarfstd.org/ShowIssue.php?issue=100831.1&type=open .  */
+DW_OP (DW_OP_GNU_implicit_pointer, 0xf2)
+/* The GNU entry value extension.
+   See http://www.dwarfstd.org/ShowIssue.php?issue=100909.1&type=open .  */
+DW_OP (DW_OP_GNU_entry_value, 0xf3)
+/* The GNU typed stack extension.
+   See http://www.dwarfstd.org/doc/040408.1.html .  */
+DW_OP (DW_OP_GNU_const_type, 0xf4)
+DW_OP (DW_OP_GNU_regval_type, 0xf5)
+DW_OP (DW_OP_GNU_deref_type, 0xf6)
+DW_OP (DW_OP_GNU_convert, 0xf7)
+DW_OP (DW_OP_GNU_reinterpret, 0xf9)
+/* The GNU parameter ref extension.  */
+DW_OP (DW_OP_GNU_parameter_ref, 0xfa)
+/* Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFission.  */
+DW_OP (DW_OP_GNU_addr_index, 0xfb)
+DW_OP (DW_OP_GNU_const_index, 0xfc)
+/* HP extensions.  */
+DW_OP_DUP (DW_OP_HP_unknown, 0xe0) /* Ouch, the same as GNU_push_tls_address.  */
+DW_OP (DW_OP_HP_is_value, 0xe1)
+DW_OP (DW_OP_HP_fltconst4, 0xe2)
+DW_OP (DW_OP_HP_fltconst8, 0xe3)
+DW_OP (DW_OP_HP_mod_range, 0xe4)
+DW_OP (DW_OP_HP_unmod_range, 0xe5)
+DW_OP (DW_OP_HP_tls, 0xe6)
+/* PGI (STMicroelectronics) extensions.  */
+DW_OP (DW_OP_PGI_omp_thread_num, 0xf8)
+DW_END_OP
+
+DW_FIRST_ATE (DW_ATE_void, 0x0)
+DW_ATE (DW_ATE_address, 0x1)
+DW_ATE (DW_ATE_boolean, 0x2)
+DW_ATE (DW_ATE_complex_float, 0x3)
+DW_ATE (DW_ATE_float, 0x4)
+DW_ATE (DW_ATE_signed, 0x5)
+DW_ATE (DW_ATE_signed_char, 0x6)
+DW_ATE (DW_ATE_unsigned, 0x7)
+DW_ATE (DW_ATE_unsigned_char, 0x8)
+/* DWARF 3.  */
+DW_ATE (DW_ATE_imaginary_float, 0x9)
+DW_ATE (DW_ATE_packed_decimal, 0xa)
+DW_ATE (DW_ATE_numeric_string, 0xb)
+DW_ATE (DW_ATE_edited, 0xc)
+DW_ATE (DW_ATE_signed_fixed, 0xd)
+DW_ATE (DW_ATE_unsigned_fixed, 0xe)
+DW_ATE (DW_ATE_decimal_float, 0xf)
+/* DWARF 4.  */
+DW_ATE (DW_ATE_UTF, 0x10)
+/* DWARF 5.  */
+DW_ATE (DW_ATE_UCS, 0x11)
+DW_ATE (DW_ATE_ASCII, 0x12)
+
+DW_ATE_DUP (DW_ATE_lo_user, 0x80)
+DW_ATE_DUP (DW_ATE_hi_user, 0xff)
+
+/* HP extensions.  */
+DW_ATE (DW_ATE_HP_float80, 0x80) /* Floating-point (80 bit).  */
+DW_ATE (DW_ATE_HP_complex_float80, 0x81) /* Complex floating-point (80 bit).  */
+DW_ATE (DW_ATE_HP_float128, 0x82) /* Floating-point (128 bit).  */
+DW_ATE (DW_ATE_HP_complex_float128, 0x83) /* Complex fp (128 bit).  */
+DW_ATE (DW_ATE_HP_floathpintel, 0x84) /* Floating-point (82 bit IA64).  */
+DW_ATE (DW_ATE_HP_imaginary_float80, 0x85)
+DW_ATE (DW_ATE_HP_imaginary_float128, 0x86)
+DW_ATE (DW_ATE_HP_VAX_float, 0x88) /* F or G floating.  */
+DW_ATE (DW_ATE_HP_VAX_float_d, 0x89) /* D floating.  */
+DW_ATE (DW_ATE_HP_packed_decimal, 0x8a) /* Cobol.  */
+DW_ATE (DW_ATE_HP_zoned_decimal, 0x8b) /* Cobol.  */
+DW_ATE (DW_ATE_HP_edited, 0x8c) /* Cobol.  */
+DW_ATE (DW_ATE_HP_signed_fixed, 0x8d) /* Cobol.  */
+DW_ATE (DW_ATE_HP_unsigned_fixed, 0x8e) /* Cobol.  */
+DW_ATE (DW_ATE_HP_VAX_complex_float, 0x8f) /* F or G floating complex.  */
+DW_ATE (DW_ATE_HP_VAX_complex_float_d, 0x90) /* D floating complex.  */
+
+DW_END_ATE
+
+DW_FIRST_CFA (DW_CFA_advance_loc, 0x40)
+DW_CFA (DW_CFA_offset, 0x80)
+DW_CFA (DW_CFA_restore, 0xc0)
+DW_CFA (DW_CFA_nop, 0x00)
+DW_CFA (DW_CFA_set_loc, 0x01)
+DW_CFA (DW_CFA_advance_loc1, 0x02)
+DW_CFA (DW_CFA_advance_loc2, 0x03)
+DW_CFA (DW_CFA_advance_loc4, 0x04)
+DW_CFA (DW_CFA_offset_extended, 0x05)
+DW_CFA (DW_CFA_restore_extended, 0x06)
+DW_CFA (DW_CFA_undefined, 0x07)
+DW_CFA (DW_CFA_same_value, 0x08)
+DW_CFA (DW_CFA_register, 0x09)
+DW_CFA (DW_CFA_remember_state, 0x0a)
+DW_CFA (DW_CFA_restore_state, 0x0b)
+DW_CFA (DW_CFA_def_cfa, 0x0c)
+DW_CFA (DW_CFA_def_cfa_register, 0x0d)
+DW_CFA (DW_CFA_def_cfa_offset, 0x0e)
+/* DWARF 3.  */
+DW_CFA (DW_CFA_def_cfa_expression, 0x0f)
+DW_CFA (DW_CFA_expression, 0x10)
+DW_CFA (DW_CFA_offset_extended_sf, 0x11)
+DW_CFA (DW_CFA_def_cfa_sf, 0x12)
+DW_CFA (DW_CFA_def_cfa_offset_sf, 0x13)
+DW_CFA (DW_CFA_val_offset, 0x14)
+DW_CFA (DW_CFA_val_offset_sf, 0x15)
+DW_CFA (DW_CFA_val_expression, 0x16)
+
+DW_CFA (DW_CFA_lo_user, 0x1c)
+DW_CFA (DW_CFA_hi_user, 0x3f)
+
+/* SGI/MIPS specific.  */
+DW_CFA (DW_CFA_MIPS_advance_loc8, 0x1d)
+/* GNU extensions.  */
+DW_CFA (DW_CFA_GNU_window_save, 0x2d)
+DW_CFA (DW_CFA_GNU_args_size, 0x2e)
+DW_CFA (DW_CFA_GNU_negative_offset_extended, 0x2f)
+
+DW_END_CFA
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/dwarf2.h
@@ -0,0 +1,531 @@
+/* Declarations and definitions of codes relating to the DWARF2 and
+   DWARF3 symbolic debugging information formats.
+   Copyright (C) 1992-2016 Free Software Foundation, Inc.
+
+   Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
+   Office (AJPO), Florida State University and Silicon Graphics Inc.
+   provided support for this effort -- June 21, 1995.
+
+   Derived from the DWARF 1 implementation written by Ron Guilmette
+   (rfg@netcom.com), November 1990.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it under
+   the terms of the GNU General Public License as published by the Free
+   Software Foundation; either version 3, or (at your option) any later
+   version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This file is derived from the DWARF specification (a public document)
+   Revision 2.0.0 (July 27, 1993) developed by the UNIX International
+   Programming Languages Special Interest Group (UI/PLSIG) and distributed
+   by UNIX International.  Copies of this specification are available from
+   UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
+
+   This file also now contains definitions from the DWARF 3 specification
+   published Dec 20, 2005, available from: http://dwarf.freestandards.org.  */
+
+#ifndef _DWARF2_H
+#define _DWARF2_H
+
+#define DW_TAG(name, value) , name = value
+#define DW_TAG_DUP(name, value) , name = value
+#define DW_FORM(name, value) , name = value
+#define DW_AT(name, value) , name = value
+#define DW_AT_DUP(name, value) , name = value
+#define DW_OP(name, value) , name = value
+#define DW_OP_DUP(name, value) , name = value
+#define DW_ATE(name, value) , name = value
+#define DW_ATE_DUP(name, value) , name = value
+#define DW_CFA(name, value) , name = value
+
+#define DW_FIRST_TAG(name, value) enum dwarf_tag { \
+  name = value
+#define DW_END_TAG };
+#define DW_FIRST_FORM(name, value) enum dwarf_form { \
+  name = value
+#define DW_END_FORM };
+#define DW_FIRST_AT(name, value) enum dwarf_attribute { \
+  name = value
+#define DW_END_AT };
+#define DW_FIRST_OP(name, value) enum dwarf_location_atom { \
+  name = value
+#define DW_END_OP };
+#define DW_FIRST_ATE(name, value) enum dwarf_type { \
+  name = value
+#define DW_END_ATE };
+#define DW_FIRST_CFA(name, value) enum dwarf_call_frame_info { \
+  name = value
+#define DW_END_CFA };
+
+#include "dwarf2.def"
+
+#undef DW_FIRST_TAG
+#undef DW_END_TAG
+#undef DW_FIRST_FORM
+#undef DW_END_FORM
+#undef DW_FIRST_AT
+#undef DW_END_AT
+#undef DW_FIRST_OP
+#undef DW_END_OP
+#undef DW_FIRST_ATE
+#undef DW_END_ATE
+#undef DW_FIRST_CFA
+#undef DW_END_CFA
+
+#undef DW_TAG
+#undef DW_TAG_DUP
+#undef DW_FORM
+#undef DW_AT
+#undef DW_AT_DUP
+#undef DW_OP
+#undef DW_OP_DUP
+#undef DW_ATE
+#undef DW_ATE_DUP
+#undef DW_CFA
+
+/* Flag that tells whether entry has a child or not.  */
+#define DW_children_no   0
+#define	DW_children_yes  1
+
+#define DW_AT_stride_size   DW_AT_bit_stride  /* Note: The use of DW_AT_stride_size is deprecated.  */
+#define DW_AT_stride   DW_AT_byte_stride  /* Note: The use of DW_AT_stride is deprecated.  */
+
+/* Decimal sign encodings.  */
+enum dwarf_decimal_sign_encoding
+  {
+    /* DWARF 3.  */
+    DW_DS_unsigned = 0x01,
+    DW_DS_leading_overpunch = 0x02,
+    DW_DS_trailing_overpunch = 0x03,
+    DW_DS_leading_separate = 0x04,
+    DW_DS_trailing_separate = 0x05
+  };
+
+/* Endianity encodings.  */
+enum dwarf_endianity_encoding
+  {
+    /* DWARF 3.  */
+    DW_END_default = 0x00,
+    DW_END_big = 0x01,
+    DW_END_little = 0x02,
+
+    DW_END_lo_user = 0x40,
+    DW_END_hi_user = 0xff
+  };
+
+/* Array ordering names and codes.  */
+enum dwarf_array_dim_ordering
+  {
+    DW_ORD_row_major = 0,
+    DW_ORD_col_major = 1
+  };
+
+/* Access attribute.  */
+enum dwarf_access_attribute
+  {
+    DW_ACCESS_public = 1,
+    DW_ACCESS_protected = 2,
+    DW_ACCESS_private = 3
+  };
+
+/* Visibility.  */
+enum dwarf_visibility_attribute
+  {
+    DW_VIS_local = 1,
+    DW_VIS_exported = 2,
+    DW_VIS_qualified = 3
+  };
+
+/* Virtuality.  */
+enum dwarf_virtuality_attribute
+  {
+    DW_VIRTUALITY_none = 0,
+    DW_VIRTUALITY_virtual = 1,
+    DW_VIRTUALITY_pure_virtual = 2
+  };
+
+/* Case sensitivity.  */
+enum dwarf_id_case
+  {
+    DW_ID_case_sensitive = 0,
+    DW_ID_up_case = 1,
+    DW_ID_down_case = 2,
+    DW_ID_case_insensitive = 3
+  };
+
+/* Calling convention.  */
+enum dwarf_calling_convention
+  {
+    DW_CC_normal = 0x1,
+    DW_CC_program = 0x2,
+    DW_CC_nocall = 0x3,
+
+    /* DWARF 5.  */
+    DW_CC_pass_by_reference = 0x4,
+    DW_CC_pass_by_value = 0x5,
+
+    DW_CC_lo_user = 0x40,
+    DW_CC_hi_user = 0xff,
+
+    DW_CC_GNU_renesas_sh = 0x40,
+    DW_CC_GNU_borland_fastcall_i386 = 0x41,
+
+    /* This DW_CC_ value is not currently generated by any toolchain.  It is
+       used internally to GDB to indicate OpenCL C functions that have been
+       compiled with the IBM XL C for OpenCL compiler and use a non-platform
+       calling convention for passing OpenCL C vector types.  This value may
+       be changed freely as long as it does not conflict with any other DW_CC_
+       value defined here.  */
+    DW_CC_GDB_IBM_OpenCL = 0xff
+  };
+
+/* Inline attribute.  */
+enum dwarf_inline_attribute
+  {
+    DW_INL_not_inlined = 0,
+    DW_INL_inlined = 1,
+    DW_INL_declared_not_inlined = 2,
+    DW_INL_declared_inlined = 3
+  };
+
+/* Discriminant lists.  */
+enum dwarf_discrim_list
+  {
+    DW_DSC_label = 0,
+    DW_DSC_range = 1
+  };
+
+/* Line number opcodes.  */
+enum dwarf_line_number_ops
+  {
+    DW_LNS_extended_op = 0,
+    DW_LNS_copy = 1,
+    DW_LNS_advance_pc = 2,
+    DW_LNS_advance_line = 3,
+    DW_LNS_set_file = 4,
+    DW_LNS_set_column = 5,
+    DW_LNS_negate_stmt = 6,
+    DW_LNS_set_basic_block = 7,
+    DW_LNS_const_add_pc = 8,
+    DW_LNS_fixed_advance_pc = 9,
+    /* DWARF 3.  */
+    DW_LNS_set_prologue_end = 10,
+    DW_LNS_set_epilogue_begin = 11,
+    DW_LNS_set_isa = 12
+  };
+
+/* Line number extended opcodes.  */
+enum dwarf_line_number_x_ops
+  {
+    DW_LNE_end_sequence = 1,
+    DW_LNE_set_address = 2,
+    DW_LNE_define_file = 3,
+    DW_LNE_set_discriminator = 4,
+    /* HP extensions.  */
+    DW_LNE_HP_negate_is_UV_update      = 0x11,
+    DW_LNE_HP_push_context             = 0x12,
+    DW_LNE_HP_pop_context              = 0x13,
+    DW_LNE_HP_set_file_line_column     = 0x14,
+    DW_LNE_HP_set_routine_name         = 0x15,
+    DW_LNE_HP_set_sequence             = 0x16,
+    DW_LNE_HP_negate_post_semantics    = 0x17,
+    DW_LNE_HP_negate_function_exit     = 0x18,
+    DW_LNE_HP_negate_front_end_logical = 0x19,
+    DW_LNE_HP_define_proc              = 0x20,
+    DW_LNE_HP_source_file_correlation  = 0x80,
+
+    DW_LNE_lo_user = 0x80,
+    DW_LNE_hi_user = 0xff
+  };
+
+/* Sub-opcodes for DW_LNE_HP_source_file_correlation.  */
+enum dwarf_line_number_hp_sfc_ops
+  {
+    DW_LNE_HP_SFC_formfeed = 1,
+    DW_LNE_HP_SFC_set_listing_line = 2,
+    DW_LNE_HP_SFC_associate = 3
+  };
+
+/* Content type codes in line table directory_entry_format
+   and file_name_entry_format sequences.  */
+enum dwarf_line_number_content_type
+  {
+    DW_LNCT_path = 0x1,
+    DW_LNCT_directory_index = 0x2,
+    DW_LNCT_timestamp = 0x3,
+    DW_LNCT_size = 0x4,
+    DW_LNCT_MD5 = 0x5,
+    DW_LNCT_lo_user = 0x2000,
+    DW_LNCT_hi_user = 0x3fff
+  };
+
+/* Type codes for location list entries.  */
+enum dwarf_location_list_entry_type
+  {
+    DW_LLE_end_of_list = 0x00,
+    DW_LLE_base_addressx = 0x01,
+    DW_LLE_startx_endx = 0x02,
+    DW_LLE_startx_length = 0x03,
+    DW_LLE_offset_pair = 0x04,
+    DW_LLE_default_location = 0x05,
+    DW_LLE_base_address = 0x06,
+    DW_LLE_start_end = 0x07,
+    DW_LLE_start_length = 0x08,
+
+    /* Former extension for Fission.
+       See http://gcc.gnu.org/wiki/DebugFission.  */
+    DW_LLE_GNU_end_of_list_entry = 0x00,
+    DW_LLE_GNU_base_address_selection_entry = 0x01,
+    DW_LLE_GNU_start_end_entry = 0x02,
+    DW_LLE_GNU_start_length_entry = 0x03
+  };
+
+#define DW_CIE_ID	  0xffffffff
+#define DW64_CIE_ID	  0xffffffffffffffffULL
+#define DW_CIE_VERSION	  1
+
+#define DW_CFA_extended   0
+
+#define DW_CHILDREN_no		     0x00
+#define DW_CHILDREN_yes		     0x01
+
+#define DW_ADDR_none		0
+
+/* Source language names and codes.  */
+enum dwarf_source_language
+  {
+    DW_LANG_C89 = 0x0001,
+    DW_LANG_C = 0x0002,
+    DW_LANG_Ada83 = 0x0003,
+    DW_LANG_C_plus_plus = 0x0004,
+    DW_LANG_Cobol74 = 0x0005,
+    DW_LANG_Cobol85 = 0x0006,
+    DW_LANG_Fortran77 = 0x0007,
+    DW_LANG_Fortran90 = 0x0008,
+    DW_LANG_Pascal83 = 0x0009,
+    DW_LANG_Modula2 = 0x000a,
+    /* DWARF 3.  */
+    DW_LANG_Java = 0x000b,
+    DW_LANG_C99 = 0x000c,
+    DW_LANG_Ada95 = 0x000d,
+    DW_LANG_Fortran95 = 0x000e,
+    DW_LANG_PLI = 0x000f,
+    DW_LANG_ObjC = 0x0010,
+    DW_LANG_ObjC_plus_plus = 0x0011,
+    DW_LANG_UPC = 0x0012,
+    DW_LANG_D = 0x0013,
+    /* DWARF 4.  */
+    DW_LANG_Python = 0x0014,
+    /* DWARF 5.  */
+    DW_LANG_OpenCL = 0x0015,
+    DW_LANG_Go = 0x0016,
+    DW_LANG_Modula3 = 0x0017,
+    DW_LANG_Haskell = 0x0018,
+    DW_LANG_C_plus_plus_03 = 0x0019,
+    DW_LANG_C_plus_plus_11 = 0x001a,
+    DW_LANG_OCaml = 0x001b,
+    DW_LANG_Rust = 0x001c,
+    DW_LANG_C11 = 0x001d,
+    DW_LANG_Swift = 0x001e,
+    DW_LANG_Julia = 0x001f,
+    DW_LANG_Dylan = 0x0020,
+    DW_LANG_C_plus_plus_14 = 0x0021,
+    DW_LANG_Fortran03 = 0x0022,
+    DW_LANG_Fortran08 = 0x0023,
+    DW_LANG_RenderScript = 0x0024,
+
+    DW_LANG_lo_user = 0x8000,	/* Implementation-defined range start.  */
+    DW_LANG_hi_user = 0xffff,	/* Implementation-defined range start.  */
+
+    /* MIPS.  */
+    DW_LANG_Mips_Assembler = 0x8001,
+    /* UPC.  */
+    DW_LANG_Upc = 0x8765,
+    /* HP extensions.  */
+    DW_LANG_HP_Bliss     = 0x8003,
+    DW_LANG_HP_Basic91   = 0x8004,
+    DW_LANG_HP_Pascal91  = 0x8005,
+    DW_LANG_HP_IMacro    = 0x8006,
+    DW_LANG_HP_Assembler = 0x8007,
+
+    /* Rust extension, but replaced in DWARF 5.  */
+    DW_LANG_Rust_old = 0x9000
+  };
+
+/* Names and codes for macro information.  */
+enum dwarf_macinfo_record_type
+  {
+    DW_MACINFO_define = 1,
+    DW_MACINFO_undef = 2,
+    DW_MACINFO_start_file = 3,
+    DW_MACINFO_end_file = 4,
+    DW_MACINFO_vendor_ext = 255
+  };
+
+/* DW_TAG_defaulted/DW_TAG_GNU_defaulted attributes.  */
+enum dwarf_defaulted_attribute
+  {
+    DW_DEFAULTED_no = 0x00,
+    DW_DEFAULTED_in_class = 0x01,
+    DW_DEFAULTED_out_of_class = 0x02
+  };
+
+/* Names and codes for new style macro information.  */
+enum dwarf_macro_record_type
+  {
+    DW_MACRO_define = 0x01,
+    DW_MACRO_undef = 0x02,
+    DW_MACRO_start_file = 0x03,
+    DW_MACRO_end_file = 0x04,
+    DW_MACRO_define_strp = 0x05,
+    DW_MACRO_undef_strp = 0x06,
+    DW_MACRO_import = 0x07,
+    DW_MACRO_define_sup = 0x08,
+    DW_MACRO_undef_sup = 0x09,
+    DW_MACRO_import_sup = 0x0a,
+    DW_MACRO_define_strx = 0x0b,
+    DW_MACRO_undef_strx = 0x0c,
+    DW_MACRO_lo_user = 0xe0,
+    DW_MACRO_hi_user = 0xff,
+
+    /* Compatibility macros for the GNU .debug_macro extension.  */
+    DW_MACRO_GNU_define = 0x01,
+    DW_MACRO_GNU_undef = 0x02,
+    DW_MACRO_GNU_start_file = 0x03,
+    DW_MACRO_GNU_end_file = 0x04,
+    DW_MACRO_GNU_define_indirect = 0x05,
+    DW_MACRO_GNU_undef_indirect = 0x06,
+    DW_MACRO_GNU_transparent_include = 0x07,
+    /* Extensions for DWZ multifile.
+       See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open .  */
+    DW_MACRO_GNU_define_indirect_alt = 0x08,
+    DW_MACRO_GNU_undef_indirect_alt = 0x09,
+    DW_MACRO_GNU_transparent_include_alt = 0x0a,
+    DW_MACRO_GNU_lo_user = 0xe0,
+    DW_MACRO_GNU_hi_user = 0xff
+  };
+
+/* Index attributes in the Abbreviations Table.  */
+enum dwarf_name_index_attribute
+  {
+    DW_IDX_compile_unit = 1,
+    DW_IDX_type_unit = 2,
+    DW_IDX_die_offset = 3,
+    DW_IDX_parent = 4,
+    DW_IDX_type_hash = 5,
+    DW_IDX_lo_user = 0x2000,
+    DW_IDX_hi_user = 0x3fff
+  };
+
+/* Range list entry kinds in .debug_rnglists* section.  */
+enum dwarf_range_list_entry
+  {
+    DW_RLE_end_of_list = 0x00,
+    DW_RLE_base_addressx = 0x01,
+    DW_RLE_startx_endx = 0x02,
+    DW_RLE_startx_length = 0x03,
+    DW_RLE_offset_pair = 0x04,
+    DW_RLE_base_address = 0x05,
+    DW_RLE_start_end = 0x06,
+    DW_RLE_start_length = 0x07
+  };
+
+/* Unit types in unit_type unit header field.  */
+enum dwarf_unit_type
+  {
+    DW_UT_compile = 0x01,
+    DW_UT_type = 0x02,
+    DW_UT_partial = 0x03,
+    DW_UT_skeleton = 0x04,
+    DW_UT_split_compile = 0x05,
+    DW_UT_split_type = 0x06,
+    DW_UT_lo_user = 0x80,
+    DW_UT_hi_user = 0xff
+  };
+
+/* @@@ For use with GNU frame unwind information.  */
+
+#define DW_EH_PE_absptr		0x00
+#define DW_EH_PE_omit		0xff
+
+#define DW_EH_PE_uleb128	0x01
+#define DW_EH_PE_udata2		0x02
+#define DW_EH_PE_udata4		0x03
+#define DW_EH_PE_udata8		0x04
+#define DW_EH_PE_sleb128	0x09
+#define DW_EH_PE_sdata2		0x0A
+#define DW_EH_PE_sdata4		0x0B
+#define DW_EH_PE_sdata8		0x0C
+#define DW_EH_PE_signed		0x08
+
+#define DW_EH_PE_pcrel		0x10
+#define DW_EH_PE_textrel	0x20
+#define DW_EH_PE_datarel	0x30
+#define DW_EH_PE_funcrel	0x40
+#define DW_EH_PE_aligned	0x50
+
+#define DW_EH_PE_indirect	0x80
+
+/* Codes for the debug sections in a dwarf package (.dwp) file.
+   Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFissionDWP.  */
+enum dwarf_sect
+  {
+    DW_SECT_INFO = 1,
+    DW_SECT_TYPES = 2,
+    DW_SECT_ABBREV = 3,
+    DW_SECT_LINE = 4,
+    DW_SECT_LOC = 5,
+    DW_SECT_STR_OFFSETS = 6,
+    DW_SECT_MACINFO = 7,
+    DW_SECT_MACRO = 8,
+    DW_SECT_MAX = 8
+  };
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Return the name of a DW_TAG_ constant, or NULL if the value is not
+   recognized.  */
+extern const char *get_DW_TAG_name (unsigned int tag);
+
+/* Return the name of a DW_AT_ constant, or NULL if the value is not
+   recognized.  */
+extern const char *get_DW_AT_name (unsigned int attr);
+
+/* Return the name of a DW_FORM_ constant, or NULL if the value is not
+   recognized.  */
+extern const char *get_DW_FORM_name (unsigned int form);
+
+/* Return the name of a DW_OP_ constant, or NULL if the value is not
+   recognized.  */
+extern const char *get_DW_OP_name (unsigned int op);
+
+/* Return the name of a DW_ATE_ constant, or NULL if the value is not
+   recognized.  */
+extern const char *get_DW_ATE_name (unsigned int enc);
+
+/* Return the name of a DW_CFA_ constant, or NULL if the value is not
+   recognized.  */
+extern const char *get_DW_CFA_name (unsigned int opc);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _DWARF2_H */
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/elf.c
@@ -0,0 +1,979 @@
+/* elf.c -- Get debug data from an ELF file for backtraces.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#ifdef HAVE_DL_ITERATE_PHDR
+#include <link.h>
+#endif
+
+#include "backtrace.h"
+#include "internal.h"
+
+#ifndef HAVE_DL_ITERATE_PHDR
+
+/* Dummy version of dl_iterate_phdr for systems that don't have it.  */
+
+#define dl_phdr_info x_dl_phdr_info
+#define dl_iterate_phdr x_dl_iterate_phdr
+
+struct dl_phdr_info
+{
+  uintptr_t dlpi_addr;
+  const char *dlpi_name;
+};
+
+static int
+dl_iterate_phdr (int (*callback) (struct dl_phdr_info *,
+				  size_t, void *) ATTRIBUTE_UNUSED,
+		 void *data ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
+#endif /* ! defined (HAVE_DL_ITERATE_PHDR) */
+
+/* The configure script must tell us whether we are 32-bit or 64-bit
+   ELF.  We could make this code test and support either possibility,
+   but there is no point.  This code only works for the currently
+   running executable, which means that we know the ELF mode at
+   configure mode.  */
+
+#if BACKTRACE_ELF_SIZE != 32 && BACKTRACE_ELF_SIZE != 64
+#error "Unknown BACKTRACE_ELF_SIZE"
+#endif
+
+/* <link.h> might #include <elf.h> which might define our constants
+   with slightly different values.  Undefine them to be safe.  */
+
+#undef EI_NIDENT
+#undef EI_MAG0
+#undef EI_MAG1
+#undef EI_MAG2
+#undef EI_MAG3
+#undef EI_CLASS
+#undef EI_DATA
+#undef EI_VERSION
+#undef ELF_MAG0
+#undef ELF_MAG1
+#undef ELF_MAG2
+#undef ELF_MAG3
+#undef ELFCLASS32
+#undef ELFCLASS64
+#undef ELFDATA2LSB
+#undef ELFDATA2MSB
+#undef EV_CURRENT
+#undef ET_DYN
+#undef SHN_LORESERVE
+#undef SHN_XINDEX
+#undef SHN_UNDEF
+#undef SHT_SYMTAB
+#undef SHT_STRTAB
+#undef SHT_DYNSYM
+#undef STT_OBJECT
+#undef STT_FUNC
+
+/* Basic types.  */
+
+typedef uint16_t b_elf_half;    /* Elf_Half.  */
+typedef uint32_t b_elf_word;    /* Elf_Word.  */
+typedef int32_t  b_elf_sword;   /* Elf_Sword.  */
+
+#if BACKTRACE_ELF_SIZE == 32
+
+typedef uint32_t b_elf_addr;    /* Elf_Addr.  */
+typedef uint32_t b_elf_off;     /* Elf_Off.  */
+
+typedef uint32_t b_elf_wxword;  /* 32-bit Elf_Word, 64-bit ELF_Xword.  */
+
+#else
+
+typedef uint64_t b_elf_addr;    /* Elf_Addr.  */
+typedef uint64_t b_elf_off;     /* Elf_Off.  */
+typedef uint64_t b_elf_xword;   /* Elf_Xword.  */
+typedef int64_t  b_elf_sxword;  /* Elf_Sxword.  */
+
+typedef uint64_t b_elf_wxword;  /* 32-bit Elf_Word, 64-bit ELF_Xword.  */
+
+#endif
+
+/* Data structures and associated constants.  */
+
+#define EI_NIDENT 16
+
+typedef struct {
+  unsigned char	e_ident[EI_NIDENT];	/* ELF "magic number" */
+  b_elf_half	e_type;			/* Identifies object file type */
+  b_elf_half	e_machine;		/* Specifies required architecture */
+  b_elf_word	e_version;		/* Identifies object file version */
+  b_elf_addr	e_entry;		/* Entry point virtual address */
+  b_elf_off	e_phoff;		/* Program header table file offset */
+  b_elf_off	e_shoff;		/* Section header table file offset */
+  b_elf_word	e_flags;		/* Processor-specific flags */
+  b_elf_half	e_ehsize;		/* ELF header size in bytes */
+  b_elf_half	e_phentsize;		/* Program header table entry size */
+  b_elf_half	e_phnum;		/* Program header table entry count */
+  b_elf_half	e_shentsize;		/* Section header table entry size */
+  b_elf_half	e_shnum;		/* Section header table entry count */
+  b_elf_half	e_shstrndx;		/* Section header string table index */
+} b_elf_ehdr;  /* Elf_Ehdr.  */
+
+#define EI_MAG0 0
+#define EI_MAG1 1
+#define EI_MAG2 2
+#define EI_MAG3 3
+#define EI_CLASS 4
+#define EI_DATA 5
+#define EI_VERSION 6
+
+#define ELFMAG0 0x7f
+#define ELFMAG1 'E'
+#define ELFMAG2 'L'
+#define ELFMAG3 'F'
+
+#define ELFCLASS32 1
+#define ELFCLASS64 2
+
+#define ELFDATA2LSB 1
+#define ELFDATA2MSB 2
+
+#define EV_CURRENT 1
+
+#define ET_DYN 3
+
+typedef struct {
+  b_elf_word	sh_name;		/* Section name, index in string tbl */
+  b_elf_word	sh_type;		/* Type of section */
+  b_elf_wxword	sh_flags;		/* Miscellaneous section attributes */
+  b_elf_addr	sh_addr;		/* Section virtual addr at execution */
+  b_elf_off	sh_offset;		/* Section file offset */
+  b_elf_wxword	sh_size;		/* Size of section in bytes */
+  b_elf_word	sh_link;		/* Index of another section */
+  b_elf_word	sh_info;		/* Additional section information */
+  b_elf_wxword	sh_addralign;		/* Section alignment */
+  b_elf_wxword	sh_entsize;		/* Entry size if section holds table */
+} b_elf_shdr;  /* Elf_Shdr.  */
+
+#define SHN_UNDEF	0x0000		/* Undefined section */
+#define SHN_LORESERVE	0xFF00		/* Begin range of reserved indices */
+#define SHN_XINDEX	0xFFFF		/* Section index is held elsewhere */
+
+#define SHT_SYMTAB 2
+#define SHT_STRTAB 3
+#define SHT_DYNSYM 11
+
+#if BACKTRACE_ELF_SIZE == 32
+
+typedef struct
+{
+  b_elf_word	st_name;		/* Symbol name, index in string tbl */
+  b_elf_addr	st_value;		/* Symbol value */
+  b_elf_word	st_size;		/* Symbol size */
+  unsigned char	st_info;		/* Symbol binding and type */
+  unsigned char	st_other;		/* Visibility and other data */
+  b_elf_half	st_shndx;		/* Symbol section index */
+} b_elf_sym;  /* Elf_Sym.  */
+
+#else /* BACKTRACE_ELF_SIZE != 32 */
+
+typedef struct
+{
+  b_elf_word	st_name;		/* Symbol name, index in string tbl */
+  unsigned char	st_info;		/* Symbol binding and type */
+  unsigned char	st_other;		/* Visibility and other data */
+  b_elf_half	st_shndx;		/* Symbol section index */
+  b_elf_addr	st_value;		/* Symbol value */
+  b_elf_xword	st_size;		/* Symbol size */
+} b_elf_sym;  /* Elf_Sym.  */
+
+#endif /* BACKTRACE_ELF_SIZE != 32 */
+
+#define STT_OBJECT 1
+#define STT_FUNC 2
+
+/* An index of ELF sections we care about.  */
+
+enum debug_section
+{
+  DEBUG_INFO,
+  DEBUG_LINE,
+  DEBUG_ABBREV,
+  DEBUG_RANGES,
+  DEBUG_STR,
+  DEBUG_MAX
+};
+
+/* Names of sections, indexed by enum elf_section.  */
+
+static const char * const debug_section_names[DEBUG_MAX] =
+{
+  ".debug_info",
+  ".debug_line",
+  ".debug_abbrev",
+  ".debug_ranges",
+  ".debug_str"
+};
+
+/* Information we gather for the sections we care about.  */
+
+struct debug_section_info
+{
+  /* Section file offset.  */
+  off_t offset;
+  /* Section size.  */
+  size_t size;
+  /* Section contents, after read from file.  */
+  const unsigned char *data;
+};
+
+/* Information we keep for an ELF symbol.  */
+
+struct elf_symbol
+{
+  /* The name of the symbol.  */
+  const char *name;
+  /* The address of the symbol.  */
+  uintptr_t address;
+  /* The size of the symbol.  */
+  size_t size;
+};
+
+/* Information to pass to elf_syminfo.  */
+
+struct elf_syminfo_data
+{
+  /* Symbols for the next module.  */
+  struct elf_syminfo_data *next;
+  /* The ELF symbols, sorted by address.  */
+  struct elf_symbol *symbols;
+  /* The number of symbols.  */
+  size_t count;
+};
+
+/* A dummy callback function used when we can't find any debug info.  */
+
+static int
+elf_nodebug (struct backtrace_state *state ATTRIBUTE_UNUSED,
+	     uintptr_t pc ATTRIBUTE_UNUSED,
+	     backtrace_full_callback callback ATTRIBUTE_UNUSED,
+	     backtrace_error_callback error_callback, void *data)
+{
+  error_callback (data, "no debug info in ELF executable", -1);
+  return 0;
+}
+
+/* A dummy callback function used when we can't find a symbol
+   table.  */
+
+static void
+elf_nosyms (struct backtrace_state *state ATTRIBUTE_UNUSED,
+	    uintptr_t addr ATTRIBUTE_UNUSED,
+	    backtrace_syminfo_callback callback ATTRIBUTE_UNUSED,
+	    backtrace_error_callback error_callback, void *data)
+{
+  error_callback (data, "no symbol table in ELF executable", -1);
+}
+
+/* Compare struct elf_symbol for qsort.  */
+
+static int
+elf_symbol_compare (const void *v1, const void *v2)
+{
+  const struct elf_symbol *e1 = (const struct elf_symbol *) v1;
+  const struct elf_symbol *e2 = (const struct elf_symbol *) v2;
+
+  if (e1->address < e2->address)
+    return -1;
+  else if (e1->address > e2->address)
+    return 1;
+  else
+    return 0;
+}
+
+/* Compare an ADDR against an elf_symbol for bsearch.  We allocate one
+   extra entry in the array so that this can look safely at the next
+   entry.  */
+
+static int
+elf_symbol_search (const void *vkey, const void *ventry)
+{
+  const uintptr_t *key = (const uintptr_t *) vkey;
+  const struct elf_symbol *entry = (const struct elf_symbol *) ventry;
+  uintptr_t addr;
+
+  addr = *key;
+  if (addr < entry->address)
+    return -1;
+  else if (addr >= entry->address + entry->size)
+    return 1;
+  else
+    return 0;
+}
+
+/* Initialize the symbol table info for elf_syminfo.  */
+
+static int
+elf_initialize_syminfo (struct backtrace_state *state,
+			uintptr_t base_address,
+			const unsigned char *symtab_data, size_t symtab_size,
+			const unsigned char *strtab, size_t strtab_size,
+			backtrace_error_callback error_callback,
+			void *data, struct elf_syminfo_data *sdata)
+{
+  size_t sym_count;
+  const b_elf_sym *sym;
+  size_t elf_symbol_count;
+  size_t elf_symbol_size;
+  struct elf_symbol *elf_symbols;
+  size_t i;
+  unsigned int j;
+
+  sym_count = symtab_size / sizeof (b_elf_sym);
+
+  /* We only care about function symbols.  Count them.  */
+  sym = (const b_elf_sym *) symtab_data;
+  elf_symbol_count = 0;
+  for (i = 0; i < sym_count; ++i, ++sym)
+    {
+      int info;
+
+      info = sym->st_info & 0xf;
+      if ((info == STT_FUNC || info == STT_OBJECT)
+	  && sym->st_shndx != SHN_UNDEF)
+	++elf_symbol_count;
+    }
+
+  elf_symbol_size = elf_symbol_count * sizeof (struct elf_symbol);
+  elf_symbols = ((struct elf_symbol *)
+		 backtrace_alloc (state, elf_symbol_size, error_callback,
+				  data));
+  if (elf_symbols == NULL)
+    return 0;
+
+  sym = (const b_elf_sym *) symtab_data;
+  j = 0;
+  for (i = 0; i < sym_count; ++i, ++sym)
+    {
+      int info;
+
+      info = sym->st_info & 0xf;
+      if (info != STT_FUNC && info != STT_OBJECT)
+	continue;
+      if (sym->st_shndx == SHN_UNDEF)
+	continue;
+      if (sym->st_name >= strtab_size)
+	{
+	  error_callback (data, "symbol string index out of range", 0);
+	  backtrace_free (state, elf_symbols, elf_symbol_size, error_callback,
+			  data);
+	  return 0;
+	}
+      elf_symbols[j].name = (const char *) strtab + sym->st_name;
+      elf_symbols[j].address = sym->st_value + base_address;
+      elf_symbols[j].size = sym->st_size;
+      ++j;
+    }
+
+  backtrace_qsort (elf_symbols, elf_symbol_count, sizeof (struct elf_symbol),
+		   elf_symbol_compare);
+
+  sdata->next = NULL;
+  sdata->symbols = elf_symbols;
+  sdata->count = elf_symbol_count;
+
+  return 1;
+}
+
+/* Add EDATA to the list in STATE.  */
+
+static void
+elf_add_syminfo_data (struct backtrace_state *state,
+		      struct elf_syminfo_data *edata)
+{
+  if (!state->threaded)
+    {
+      struct elf_syminfo_data **pp;
+
+      for (pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data;
+	   *pp != NULL;
+	   pp = &(*pp)->next)
+	;
+      *pp = edata;
+    }
+  else
+    {
+      while (1)
+	{
+	  struct elf_syminfo_data **pp;
+
+	  pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data;
+
+	  while (1)
+	    {
+	      struct elf_syminfo_data *p;
+
+	      p = backtrace_atomic_load_pointer (pp);
+
+	      if (p == NULL)
+		break;
+
+	      pp = &p->next;
+	    }
+
+	  if (__sync_bool_compare_and_swap (pp, NULL, edata))
+	    break;
+	}
+    }
+}
+
+/* Return the symbol name and value for an ADDR.  */
+
+static void
+elf_syminfo (struct backtrace_state *state, uintptr_t addr,
+	     backtrace_syminfo_callback callback,
+	     backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
+	     void *data)
+{
+  struct elf_syminfo_data *edata;
+  struct elf_symbol *sym = NULL;
+
+  if (!state->threaded)
+    {
+      for (edata = (struct elf_syminfo_data *) state->syminfo_data;
+	   edata != NULL;
+	   edata = edata->next)
+	{
+	  sym = ((struct elf_symbol *)
+		 bsearch (&addr, edata->symbols, edata->count,
+			  sizeof (struct elf_symbol), elf_symbol_search));
+	  if (sym != NULL)
+	    break;
+	}
+    }
+  else
+    {
+      struct elf_syminfo_data **pp;
+
+      pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data;
+      while (1)
+	{
+	  edata = backtrace_atomic_load_pointer (pp);
+	  if (edata == NULL)
+	    break;
+
+	  sym = ((struct elf_symbol *)
+		 bsearch (&addr, edata->symbols, edata->count,
+			  sizeof (struct elf_symbol), elf_symbol_search));
+	  if (sym != NULL)
+	    break;
+
+	  pp = &edata->next;
+	}
+    }
+
+  if (sym == NULL)
+    callback (data, addr, NULL, 0, 0);
+  else
+    callback (data, addr, sym->name, sym->address, sym->size);
+}
+
+/* Add the backtrace data for one ELF file.  Returns 1 on success,
+   0 on failure (in both cases descriptor is closed) or -1 if exe
+   is non-zero and the ELF file is ET_DYN, which tells the caller that
+   elf_add will need to be called on the descriptor again after
+   base_address is determined.  */
+
+static int
+elf_add (struct backtrace_state *state, int descriptor, uintptr_t base_address,
+	 backtrace_error_callback error_callback, void *data,
+	 fileline *fileline_fn, int *found_sym, int *found_dwarf, int exe)
+{
+  struct backtrace_view ehdr_view;
+  b_elf_ehdr ehdr;
+  off_t shoff;
+  unsigned int shnum;
+  unsigned int shstrndx;
+  struct backtrace_view shdrs_view;
+  int shdrs_view_valid;
+  const b_elf_shdr *shdrs;
+  const b_elf_shdr *shstrhdr;
+  size_t shstr_size;
+  off_t shstr_off;
+  struct backtrace_view names_view;
+  int names_view_valid;
+  const char *names;
+  unsigned int symtab_shndx;
+  unsigned int dynsym_shndx;
+  unsigned int i;
+  struct debug_section_info sections[DEBUG_MAX];
+  struct backtrace_view symtab_view;
+  int symtab_view_valid;
+  struct backtrace_view strtab_view;
+  int strtab_view_valid;
+  off_t min_offset;
+  off_t max_offset;
+  struct backtrace_view debug_view;
+  int debug_view_valid;
+
+  *found_sym = 0;
+  *found_dwarf = 0;
+
+  shdrs_view_valid = 0;
+  names_view_valid = 0;
+  symtab_view_valid = 0;
+  strtab_view_valid = 0;
+  debug_view_valid = 0;
+
+  if (!backtrace_get_view (state, descriptor, 0, sizeof ehdr, error_callback,
+			   data, &ehdr_view))
+    goto fail;
+
+  memcpy (&ehdr, ehdr_view.data, sizeof ehdr);
+
+  backtrace_release_view (state, &ehdr_view, error_callback, data);
+
+  if (ehdr.e_ident[EI_MAG0] != ELFMAG0
+      || ehdr.e_ident[EI_MAG1] != ELFMAG1
+      || ehdr.e_ident[EI_MAG2] != ELFMAG2
+      || ehdr.e_ident[EI_MAG3] != ELFMAG3)
+    {
+      error_callback (data, "executable file is not ELF", 0);
+      goto fail;
+    }
+  if (ehdr.e_ident[EI_VERSION] != EV_CURRENT)
+    {
+      error_callback (data, "executable file is unrecognized ELF version", 0);
+      goto fail;
+    }
+
+#if BACKTRACE_ELF_SIZE == 32
+#define BACKTRACE_ELFCLASS ELFCLASS32
+#else
+#define BACKTRACE_ELFCLASS ELFCLASS64
+#endif
+
+  if (ehdr.e_ident[EI_CLASS] != BACKTRACE_ELFCLASS)
+    {
+      error_callback (data, "executable file is unexpected ELF class", 0);
+      goto fail;
+    }
+
+  if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB
+      && ehdr.e_ident[EI_DATA] != ELFDATA2MSB)
+    {
+      error_callback (data, "executable file has unknown endianness", 0);
+      goto fail;
+    }
+
+  /* If the executable is ET_DYN, it is either a PIE, or we are running
+     directly a shared library with .interp.  We need to wait for
+     dl_iterate_phdr in that case to determine the actual base_address.  */
+  if (exe && ehdr.e_type == ET_DYN)
+    return -1;
+
+  shoff = ehdr.e_shoff;
+  shnum = ehdr.e_shnum;
+  shstrndx = ehdr.e_shstrndx;
+
+  if ((shnum == 0 || shstrndx == SHN_XINDEX)
+      && shoff != 0)
+    {
+      struct backtrace_view shdr_view;
+      const b_elf_shdr *shdr;
+
+      if (!backtrace_get_view (state, descriptor, shoff, sizeof shdr,
+			       error_callback, data, &shdr_view))
+	goto fail;
+
+      shdr = (const b_elf_shdr *) shdr_view.data;
+
+      if (shnum == 0)
+	shnum = shdr->sh_size;
+
+      if (shstrndx == SHN_XINDEX)
+	{
+	  shstrndx = shdr->sh_link;
+
+	  /* Versions of the GNU binutils between 2.12 and 2.18 did
+	     not handle objects with more than SHN_LORESERVE sections
+	     correctly.  All large section indexes were offset by
+	     0x100.  There is more information at
+	     http://sourceware.org/bugzilla/show_bug.cgi?id-5900 .
+	     Fortunately these object files are easy to detect, as the
+	     GNU binutils always put the section header string table
+	     near the end of the list of sections.  Thus if the
+	     section header string table index is larger than the
+	     number of sections, then we know we have to subtract
+	     0x100 to get the real section index.  */
+	  if (shstrndx >= shnum && shstrndx >= SHN_LORESERVE + 0x100)
+	    shstrndx -= 0x100;
+	}
+
+      backtrace_release_view (state, &shdr_view, error_callback, data);
+    }
+
+  /* To translate PC to file/line when using DWARF, we need to find
+     the .debug_info and .debug_line sections.  */
+
+  /* Read the section headers, skipping the first one.  */
+
+  if (!backtrace_get_view (state, descriptor, shoff + sizeof (b_elf_shdr),
+			   (shnum - 1) * sizeof (b_elf_shdr),
+			   error_callback, data, &shdrs_view))
+    goto fail;
+  shdrs_view_valid = 1;
+  shdrs = (const b_elf_shdr *) shdrs_view.data;
+
+  /* Read the section names.  */
+
+  shstrhdr = &shdrs[shstrndx - 1];
+  shstr_size = shstrhdr->sh_size;
+  shstr_off = shstrhdr->sh_offset;
+
+  if (!backtrace_get_view (state, descriptor, shstr_off, shstr_size,
+			   error_callback, data, &names_view))
+    goto fail;
+  names_view_valid = 1;
+  names = (const char *) names_view.data;
+
+  symtab_shndx = 0;
+  dynsym_shndx = 0;
+
+  memset (sections, 0, sizeof sections);
+
+  /* Look for the symbol table.  */
+  for (i = 1; i < shnum; ++i)
+    {
+      const b_elf_shdr *shdr;
+      unsigned int sh_name;
+      const char *name;
+      int j;
+
+      shdr = &shdrs[i - 1];
+
+      if (shdr->sh_type == SHT_SYMTAB)
+	symtab_shndx = i;
+      else if (shdr->sh_type == SHT_DYNSYM)
+	dynsym_shndx = i;
+
+      sh_name = shdr->sh_name;
+      if (sh_name >= shstr_size)
+	{
+	  error_callback (data, "ELF section name out of range", 0);
+	  goto fail;
+	}
+
+      name = names + sh_name;
+
+      for (j = 0; j < (int) DEBUG_MAX; ++j)
+	{
+	  if (strcmp (name, debug_section_names[j]) == 0)
+	    {
+	      sections[j].offset = shdr->sh_offset;
+	      sections[j].size = shdr->sh_size;
+	      break;
+	    }
+	}
+    }
+
+  if (symtab_shndx == 0)
+    symtab_shndx = dynsym_shndx;
+  if (symtab_shndx != 0)
+    {
+      const b_elf_shdr *symtab_shdr;
+      unsigned int strtab_shndx;
+      const b_elf_shdr *strtab_shdr;
+      struct elf_syminfo_data *sdata;
+
+      symtab_shdr = &shdrs[symtab_shndx - 1];
+      strtab_shndx = symtab_shdr->sh_link;
+      if (strtab_shndx >= shnum)
+	{
+	  error_callback (data,
+			  "ELF symbol table strtab link out of range", 0);
+	  goto fail;
+	}
+      strtab_shdr = &shdrs[strtab_shndx - 1];
+
+      if (!backtrace_get_view (state, descriptor, symtab_shdr->sh_offset,
+			       symtab_shdr->sh_size, error_callback, data,
+			       &symtab_view))
+	goto fail;
+      symtab_view_valid = 1;
+
+      if (!backtrace_get_view (state, descriptor, strtab_shdr->sh_offset,
+			       strtab_shdr->sh_size, error_callback, data,
+			       &strtab_view))
+	goto fail;
+      strtab_view_valid = 1;
+
+      sdata = ((struct elf_syminfo_data *)
+	       backtrace_alloc (state, sizeof *sdata, error_callback, data));
+      if (sdata == NULL)
+	goto fail;
+
+      if (!elf_initialize_syminfo (state, base_address,
+				   symtab_view.data, symtab_shdr->sh_size,
+				   strtab_view.data, strtab_shdr->sh_size,
+				   error_callback, data, sdata))
+	{
+	  backtrace_free (state, sdata, sizeof *sdata, error_callback, data);
+	  goto fail;
+	}
+
+      /* We no longer need the symbol table, but we hold on to the
+	 string table permanently.  */
+      backtrace_release_view (state, &symtab_view, error_callback, data);
+
+      *found_sym = 1;
+
+      elf_add_syminfo_data (state, sdata);
+    }
+
+  /* FIXME: Need to handle compressed debug sections.  */
+
+  backtrace_release_view (state, &shdrs_view, error_callback, data);
+  shdrs_view_valid = 0;
+  backtrace_release_view (state, &names_view, error_callback, data);
+  names_view_valid = 0;
+
+  /* Read all the debug sections in a single view, since they are
+     probably adjacent in the file.  We never release this view.  */
+
+  min_offset = 0;
+  max_offset = 0;
+  for (i = 0; i < (int) DEBUG_MAX; ++i)
+    {
+      off_t end;
+
+      if (sections[i].size == 0)
+	continue;
+      if (min_offset == 0 || sections[i].offset < min_offset)
+	min_offset = sections[i].offset;
+      end = sections[i].offset + sections[i].size;
+      if (end > max_offset)
+	max_offset = end;
+    }
+  if (min_offset == 0 || max_offset == 0)
+    {
+      if (!backtrace_close (descriptor, error_callback, data))
+	goto fail;
+      return 1;
+    }
+
+  if (!backtrace_get_view (state, descriptor, min_offset,
+			   max_offset - min_offset,
+			   error_callback, data, &debug_view))
+    goto fail;
+  debug_view_valid = 1;
+
+  /* We've read all we need from the executable.  */
+  if (!backtrace_close (descriptor, error_callback, data))
+    goto fail;
+  descriptor = -1;
+
+  for (i = 0; i < (int) DEBUG_MAX; ++i)
+    {
+      if (sections[i].size == 0)
+	sections[i].data = NULL;
+      else
+	sections[i].data = ((const unsigned char *) debug_view.data
+			    + (sections[i].offset - min_offset));
+    }
+
+  if (!backtrace_dwarf_add (state, base_address,
+			    sections[DEBUG_INFO].data,
+			    sections[DEBUG_INFO].size,
+			    sections[DEBUG_LINE].data,
+			    sections[DEBUG_LINE].size,
+			    sections[DEBUG_ABBREV].data,
+			    sections[DEBUG_ABBREV].size,
+			    sections[DEBUG_RANGES].data,
+			    sections[DEBUG_RANGES].size,
+			    sections[DEBUG_STR].data,
+			    sections[DEBUG_STR].size,
+			    ehdr.e_ident[EI_DATA] == ELFDATA2MSB,
+			    error_callback, data, fileline_fn))
+    goto fail;
+
+  *found_dwarf = 1;
+
+  return 1;
+
+ fail:
+  if (shdrs_view_valid)
+    backtrace_release_view (state, &shdrs_view, error_callback, data);
+  if (names_view_valid)
+    backtrace_release_view (state, &names_view, error_callback, data);
+  if (symtab_view_valid)
+    backtrace_release_view (state, &symtab_view, error_callback, data);
+  if (strtab_view_valid)
+    backtrace_release_view (state, &strtab_view, error_callback, data);
+  if (debug_view_valid)
+    backtrace_release_view (state, &debug_view, error_callback, data);
+  if (descriptor != -1)
+    backtrace_close (descriptor, error_callback, data);
+  return 0;
+}
+
+/* Data passed to phdr_callback.  */
+
+struct phdr_data
+{
+  struct backtrace_state *state;
+  backtrace_error_callback error_callback;
+  void *data;
+  fileline *fileline_fn;
+  int *found_sym;
+  int *found_dwarf;
+  int exe_descriptor;
+};
+
+/* Callback passed to dl_iterate_phdr.  Load debug info from shared
+   libraries.  */
+
+static int
+#ifdef __i386__
+__attribute__ ((__force_align_arg_pointer__))
+#endif
+phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
+	       void *pdata)
+{
+  struct phdr_data *pd = (struct phdr_data *) pdata;
+  int descriptor;
+  int does_not_exist;
+  fileline elf_fileline_fn;
+  int found_dwarf;
+
+  /* There is not much we can do if we don't have the module name,
+     unless executable is ET_DYN, where we expect the very first
+     phdr_callback to be for the PIE.  */
+  if (info->dlpi_name == NULL || info->dlpi_name[0] == '\0')
+    {
+      if (pd->exe_descriptor == -1)
+	return 0;
+      descriptor = pd->exe_descriptor;
+      pd->exe_descriptor = -1;
+    }
+  else
+    {
+      if (pd->exe_descriptor != -1)
+	{
+	  backtrace_close (pd->exe_descriptor, pd->error_callback, pd->data);
+	  pd->exe_descriptor = -1;
+	}
+
+      descriptor = backtrace_open (info->dlpi_name, pd->error_callback,
+				   pd->data, &does_not_exist);
+      if (descriptor < 0)
+	return 0;
+    }
+
+  if (elf_add (pd->state, descriptor, info->dlpi_addr, pd->error_callback,
+	       pd->data, &elf_fileline_fn, pd->found_sym, &found_dwarf, 0))
+    {
+      if (found_dwarf)
+	{
+	  *pd->found_dwarf = 1;
+	  *pd->fileline_fn = elf_fileline_fn;
+	}
+    }
+
+  return 0;
+}
+
+/* Initialize the backtrace data we need from an ELF executable.  At
+   the ELF level, all we need to do is find the debug info
+   sections.  */
+
+int
+backtrace_initialize (struct backtrace_state *state, int descriptor,
+		      backtrace_error_callback error_callback,
+		      void *data, fileline *fileline_fn)
+{
+  int ret;
+  int found_sym;
+  int found_dwarf;
+  fileline elf_fileline_fn = elf_nodebug;
+  struct phdr_data pd;
+
+  ret = elf_add (state, descriptor, 0, error_callback, data, &elf_fileline_fn,
+		 &found_sym, &found_dwarf, 1);
+  if (!ret)
+    return 0;
+
+  pd.state = state;
+  pd.error_callback = error_callback;
+  pd.data = data;
+  pd.fileline_fn = &elf_fileline_fn;
+  pd.found_sym = &found_sym;
+  pd.found_dwarf = &found_dwarf;
+  pd.exe_descriptor = ret < 0 ? descriptor : -1;
+
+  dl_iterate_phdr (phdr_callback, (void *) &pd);
+
+  if (!state->threaded)
+    {
+      if (found_sym)
+	state->syminfo_fn = elf_syminfo;
+      else if (state->syminfo_fn == NULL)
+	state->syminfo_fn = elf_nosyms;
+    }
+  else
+    {
+      if (found_sym)
+	backtrace_atomic_store_pointer (&state->syminfo_fn, elf_syminfo);
+      else
+	(void) __sync_bool_compare_and_swap (&state->syminfo_fn, NULL,
+					     elf_nosyms);
+    }
+
+  if (!state->threaded)
+    {
+      if (state->fileline_fn == NULL || state->fileline_fn == elf_nodebug)
+	*fileline_fn = elf_fileline_fn;
+    }
+  else
+    {
+      fileline current_fn;
+
+      current_fn = backtrace_atomic_load_pointer (&state->fileline_fn);
+      if (current_fn == NULL || current_fn == elf_nodebug)
+	*fileline_fn = elf_fileline_fn;
+    }
+
+  return 1;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/fileline.c
@@ -0,0 +1,194 @@
+/* fileline.c -- Get file and line number information in a backtrace.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+#ifndef HAVE_GETEXECNAME
+#define getexecname() NULL
+#endif
+
+/* Initialize the fileline information from the executable.  Returns 1
+   on success, 0 on failure.  */
+
+static int
+fileline_initialize (struct backtrace_state *state,
+		     backtrace_error_callback error_callback, void *data)
+{
+  int failed;
+  fileline fileline_fn;
+  int pass;
+  int called_error_callback;
+  int descriptor;
+
+  if (!state->threaded)
+    failed = state->fileline_initialization_failed;
+  else
+    failed = backtrace_atomic_load_int (&state->fileline_initialization_failed);
+
+  if (failed)
+    {
+      error_callback (data, "failed to read executable information", -1);
+      return 0;
+    }
+
+  if (!state->threaded)
+    fileline_fn = state->fileline_fn;
+  else
+    fileline_fn = backtrace_atomic_load_pointer (&state->fileline_fn);
+  if (fileline_fn != NULL)
+    return 1;
+
+  /* We have not initialized the information.  Do it now.  */
+
+  descriptor = -1;
+  called_error_callback = 0;
+  for (pass = 0; pass < 4; ++pass)
+    {
+      const char *filename;
+      int does_not_exist;
+
+      switch (pass)
+	{
+	case 0:
+	  filename = state->filename;
+	  break;
+	case 1:
+	  filename = getexecname ();
+	  break;
+	case 2:
+	  filename = "/proc/self/exe";
+	  break;
+	case 3:
+	  filename = "/proc/curproc/file";
+	  break;
+	default:
+	  abort ();
+	}
+
+      if (filename == NULL)
+	continue;
+
+      descriptor = backtrace_open (filename, error_callback, data,
+				   &does_not_exist);
+      if (descriptor < 0 && !does_not_exist)
+	{
+	  called_error_callback = 1;
+	  break;
+	}
+      if (descriptor >= 0)
+	break;
+    }
+
+  if (descriptor < 0)
+    {
+      if (!called_error_callback)
+	{
+	  if (state->filename != NULL)
+	    error_callback (data, state->filename, ENOENT);
+	  else
+	    error_callback (data,
+			    "libbacktrace could not find executable to open",
+			    0);
+	}
+      failed = 1;
+    }
+
+  if (!failed)
+    {
+      if (!backtrace_initialize (state, descriptor, error_callback, data,
+				 &fileline_fn))
+	failed = 1;
+    }
+
+  if (failed)
+    {
+      if (!state->threaded)
+	state->fileline_initialization_failed = 1;
+      else
+	backtrace_atomic_store_int (&state->fileline_initialization_failed, 1);
+      return 0;
+    }
+
+  if (!state->threaded)
+    state->fileline_fn = fileline_fn;
+  else
+    {
+      backtrace_atomic_store_pointer (&state->fileline_fn, fileline_fn);
+
+      /* Note that if two threads initialize at once, one of the data
+	 sets may be leaked.  */
+    }
+
+  return 1;
+}
+
+/* Given a PC, find the file name, line number, and function name.  */
+
+int
+backtrace_pcinfo (struct backtrace_state *state, uintptr_t pc,
+		  backtrace_full_callback callback,
+		  backtrace_error_callback error_callback, void *data)
+{
+  if (!fileline_initialize (state, error_callback, data))
+    return 0;
+
+  if (state->fileline_initialization_failed)
+    return 0;
+
+  return state->fileline_fn (state, pc, callback, error_callback, data);
+}
+
+/* Given a PC, find the symbol for it, and its value.  */
+
+int
+backtrace_syminfo (struct backtrace_state *state, uintptr_t pc,
+		   backtrace_syminfo_callback callback,
+		   backtrace_error_callback error_callback, void *data)
+{
+  if (!fileline_initialize (state, error_callback, data))
+    return 0;
+
+  if (state->fileline_initialization_failed)
+    return 0;
+
+  state->syminfo_fn (state, pc, callback, error_callback, data);
+  return 1;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/filenames.h
@@ -0,0 +1,99 @@
+/* Macros for taking apart, interpreting and processing file names.
+
+   These are here because some non-Posix (a.k.a. DOSish) systems have
+   drive letter brain-damage at the beginning of an absolute file name,
+   use forward- and back-slash in path names interchangeably, and
+   some of them have case-insensitive file names.
+
+   Copyright (C) 2000-2015 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef FILENAMES_H
+#define FILENAMES_H
+
+#include "hashtab.h" /* for hashval_t */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
+#  ifndef HAVE_DOS_BASED_FILE_SYSTEM
+#    define HAVE_DOS_BASED_FILE_SYSTEM 1
+#  endif
+#  ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
+#    define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
+#  endif
+#  define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f)
+#  define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
+#  define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
+#else /* not DOSish */
+#  if defined(__APPLE__)
+#    ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
+#      define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
+#    endif
+#  endif /* __APPLE__ */
+#  define HAS_DRIVE_SPEC(f) (0)
+#  define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
+#  define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
+#endif
+
+#define IS_DIR_SEPARATOR_1(dos_based, c)				\
+  (((c) == '/')								\
+   || (((c) == '\\') && (dos_based)))
+
+#define HAS_DRIVE_SPEC_1(dos_based, f)			\
+  ((f)[0] && ((f)[1] == ':') && (dos_based))
+
+/* Remove the drive spec from F, assuming HAS_DRIVE_SPEC (f).
+   The result is a pointer to the remainder of F.  */
+#define STRIP_DRIVE_SPEC(f)	((f) + 2)
+
+#define IS_DOS_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (1, c)
+#define IS_DOS_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (1, f)
+#define HAS_DOS_DRIVE_SPEC(f) HAS_DRIVE_SPEC_1 (1, f)
+
+#define IS_UNIX_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (0, c)
+#define IS_UNIX_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (0, f)
+
+/* Note that when DOS_BASED is true, IS_ABSOLUTE_PATH accepts d:foo as
+   well, although it is only semi-absolute.  This is because the users
+   of IS_ABSOLUTE_PATH want to know whether to prepend the current
+   working directory to a file name, which should not be done with a
+   name like d:foo.  */
+#define IS_ABSOLUTE_PATH_1(dos_based, f)		 \
+  (IS_DIR_SEPARATOR_1 (dos_based, (f)[0])		 \
+   || HAS_DRIVE_SPEC_1 (dos_based, f))
+
+extern int filename_cmp (const char *s1, const char *s2);
+#define FILENAME_CMP(s1, s2)	filename_cmp(s1, s2)
+
+extern int filename_ncmp (const char *s1, const char *s2,
+			  size_t n);
+
+extern hashval_t filename_hash (const void *s);
+
+extern int filename_eq (const void *s1, const void *s2);
+
+extern int canonical_filename_eq (const char *a, const char *b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FILENAMES_H */
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/filetype.awk
@@ -0,0 +1,5 @@
+# An awk script to determine the type of a file.
+/\177ELF\001/ { if (NR == 1) { print "elf32"; exit } }
+/\177ELF\002/ { if (NR == 1) { print "elf64"; exit } }
+/\114\001/    { if (NR == 1) { print "pecoff"; exit } }
+/\144\206/    { if (NR == 1) { print "pecoff"; exit } }
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/hashtab.h
@@ -0,0 +1,204 @@
+/* An expandable hash tables datatype.  
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
+   Contributed by Vladimir Makarov (vmakarov@cygnus.com).
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* This package implements basic hash table functionality.  It is possible
+   to search for an entry, create an entry and destroy an entry.
+
+   Elements in the table are generic pointers.
+
+   The size of the table is not fixed; if the occupancy of the table
+   grows too high the hash table will be expanded.
+
+   The abstract data implementation is based on generalized Algorithm D
+   from Knuth's book "The art of computer programming".  Hash table is
+   expanded by creation of new hash table and transferring elements from
+   the old table to the new table.  */
+
+#ifndef __HASHTAB_H__
+#define __HASHTAB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "ansidecl.h"
+
+/* The type for a hash code.  */
+typedef unsigned int hashval_t;
+
+/* Callback function pointer types.  */
+
+/* Calculate hash of a table entry.  */
+typedef hashval_t (*htab_hash) (const void *);
+
+/* Compare a table entry with a possible entry.  The entry already in
+   the table always comes first, so the second element can be of a
+   different type (but in this case htab_find and htab_find_slot
+   cannot be used; instead the variants that accept a hash value
+   must be used).  */
+typedef int (*htab_eq) (const void *, const void *);
+
+/* Cleanup function called whenever a live element is removed from
+   the hash table.  */
+typedef void (*htab_del) (void *);
+  
+/* Function called by htab_traverse for each live element.  The first
+   arg is the slot of the element (which can be passed to htab_clear_slot
+   if desired), the second arg is the auxiliary pointer handed to
+   htab_traverse.  Return 1 to continue scan, 0 to stop.  */
+typedef int (*htab_trav) (void **, void *);
+
+/* Memory-allocation function, with the same functionality as calloc().
+   Iff it returns NULL, the hash table implementation will pass an error
+   code back to the user, so if your code doesn't handle errors,
+   best if you use xcalloc instead.  */
+typedef void *(*htab_alloc) (size_t, size_t);
+
+/* We also need a free() routine.  */
+typedef void (*htab_free) (void *);
+
+/* Memory allocation and deallocation; variants which take an extra
+   argument.  */
+typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t);
+typedef void (*htab_free_with_arg) (void *, void *);
+
+/* This macro defines reserved value for empty table entry.  */
+
+#define HTAB_EMPTY_ENTRY    ((PTR) 0)
+
+/* This macro defines reserved value for table entry which contained
+   a deleted element. */
+
+#define HTAB_DELETED_ENTRY  ((PTR) 1)
+
+/* Hash tables are of the following type.  The structure
+   (implementation) of this type is not needed for using the hash
+   tables.  All work with hash table should be executed only through
+   functions mentioned below.  The size of this structure is subject to
+   change.  */
+
+struct htab {
+  /* Pointer to hash function.  */
+  htab_hash hash_f;
+
+  /* Pointer to comparison function.  */
+  htab_eq eq_f;
+
+  /* Pointer to cleanup function.  */
+  htab_del del_f;
+
+  /* Table itself.  */
+  void **entries;
+
+  /* Current size (in entries) of the hash table.  */
+  size_t size;
+
+  /* Current number of elements including also deleted elements.  */
+  size_t n_elements;
+
+  /* Current number of deleted elements in the table.  */
+  size_t n_deleted;
+
+  /* The following member is used for debugging. Its value is number
+     of all calls of `htab_find_slot' for the hash table. */
+  unsigned int searches;
+
+  /* The following member is used for debugging.  Its value is number
+     of collisions fixed for time of work with the hash table. */
+  unsigned int collisions;
+
+  /* Pointers to allocate/free functions.  */
+  htab_alloc alloc_f;
+  htab_free free_f;
+
+  /* Alternate allocate/free functions, which take an extra argument.  */
+  void *alloc_arg;
+  htab_alloc_with_arg alloc_with_arg_f;
+  htab_free_with_arg free_with_arg_f;
+
+  /* Current size (in entries) of the hash table, as an index into the
+     table of primes.  */
+  unsigned int size_prime_index;
+};
+
+typedef struct htab *htab_t;
+
+/* An enum saying whether we insert into the hash table or not.  */
+enum insert_option {NO_INSERT, INSERT};
+
+/* The prototypes of the package functions. */
+
+extern htab_t	htab_create_alloc  (size_t, htab_hash,
+                                    htab_eq, htab_del,
+                                    htab_alloc, htab_free);
+
+extern htab_t	htab_create_alloc_ex (size_t, htab_hash,
+                                      htab_eq, htab_del,
+                                      void *, htab_alloc_with_arg,
+                                      htab_free_with_arg);
+
+extern htab_t  htab_create_typed_alloc (size_t, htab_hash, htab_eq, htab_del,
+					htab_alloc, htab_alloc, htab_free);
+
+/* Backward-compatibility functions.  */
+extern htab_t htab_create (size_t, htab_hash, htab_eq, htab_del);
+extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del);
+
+extern void	htab_set_functions_ex (htab_t, htab_hash,
+                                       htab_eq, htab_del,
+                                       void *, htab_alloc_with_arg,
+                                       htab_free_with_arg);
+
+extern void	htab_delete (htab_t);
+extern void	htab_empty (htab_t);
+
+extern void *	htab_find (htab_t, const void *);
+extern void **	htab_find_slot (htab_t, const void *, enum insert_option);
+extern void *	htab_find_with_hash (htab_t, const void *, hashval_t);
+extern void **	htab_find_slot_with_hash (htab_t, const void *,
+					  hashval_t, enum insert_option);
+extern void	htab_clear_slot	(htab_t, void **);
+extern void	htab_remove_elt	(htab_t, void *);
+extern void	htab_remove_elt_with_hash (htab_t, void *, hashval_t);
+
+extern void	htab_traverse (htab_t, htab_trav, void *);
+extern void	htab_traverse_noresize (htab_t, htab_trav, void *);
+
+extern size_t	htab_size (htab_t);
+extern size_t	htab_elements (htab_t);
+extern double	htab_collisions	(htab_t);
+
+/* A hash function for pointers.  */
+extern htab_hash htab_hash_pointer;
+
+/* An equality function for pointers.  */
+extern htab_eq htab_eq_pointer;
+
+/* A hash function for null-terminated strings.  */
+extern hashval_t htab_hash_string (const void *);
+
+/* An iterative hash function for arbitrary data.  */
+extern hashval_t iterative_hash (const void *, size_t, hashval_t);
+/* Shorthand for hashing something with an intrinsic size.  */
+#define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __HASHTAB_H */
new file mode 100755
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/install-sh
@@ -0,0 +1,501 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2013-12-25.23; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+tab='	'
+nl='
+'
+IFS=" $tab$nl"
+
+# Set DOITPROG to "echo" to test this script.
+
+doit=${DOITPROG-}
+doit_exec=${doit:-exec}
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+is_target_a_directory=possibly
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+        case $mode in
+          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+            echo "$0: invalid mode: $mode" >&2
+            exit 1;;
+        esac
+        shift;;
+
+    -o) chowncmd="$chownprog $2"
+        shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t)
+        is_target_a_directory=always
+        dst_arg=$2
+        # Protect names problematic for 'test' and other utilities.
+        case $dst_arg in
+          -* | [=\(\)!]) dst_arg=./$dst_arg;;
+        esac
+        shift;;
+
+    -T) is_target_a_directory=never;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --) shift
+        break;;
+
+    -*) echo "$0: invalid option: $1" >&2
+        exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+  if test -n "$dst_arg"; then
+    echo "$0: target directory not allowed when installing a directory." >&2
+    exit 1
+  fi
+fi
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+    # Protect names problematic for 'test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call 'install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  if test $# -gt 1 || test "$is_target_a_directory" = always; then
+    if test ! -d "$dst_arg"; then
+      echo "$0: $dst_arg: Is not a directory." >&2
+      exit 1
+    fi
+  fi
+fi
+
+if test -z "$dir_arg"; then
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+        u_plus_rw=
+      else
+        u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+        u_plus_rw=
+      else
+        u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names problematic for 'test' and other utilities.
+  case $src in
+    -* | [=\(\)!]) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+    dst=$dst_arg
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test "$is_target_a_directory" = never; then
+        echo "$0: $dst_arg: Is a directory" >&2
+        exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      dstdir=`dirname "$dst"`
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+        # Create intermediate dirs using mode 755 as modified by the umask.
+        # This is like FreeBSD 'install' as of 1997-10-28.
+        umask=`umask`
+        case $stripcmd.$umask in
+          # Optimize common cases.
+          *[2367][2367]) mkdir_umask=$umask;;
+          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+          *[0-7])
+            mkdir_umask=`expr $umask + 22 \
+              - $umask % 100 % 40 + $umask % 20 \
+              - $umask % 10 % 4 + $umask % 2
+            `;;
+          *) mkdir_umask=$umask,go-w;;
+        esac
+
+        # With -d, create the new directory with the user-specified mode.
+        # Otherwise, rely on $mkdir_umask.
+        if test -n "$dir_arg"; then
+          mkdir_mode=-m$mode
+        else
+          mkdir_mode=
+        fi
+
+        posix_mkdir=false
+        case $umask in
+          *[123567][0-7][0-7])
+            # POSIX mkdir -p sets u+wx bits regardless of umask, which
+            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+            ;;
+          *)
+            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+            if (umask $mkdir_umask &&
+                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+            then
+              if test -z "$dir_arg" || {
+                   # Check for POSIX incompatibilities with -m.
+                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+                   # other-writable bit of parent directory when it shouldn't.
+                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                   case $ls_ld_tmpdir in
+                     d????-?r-*) different_mode=700;;
+                     d????-?--*) different_mode=755;;
+                     *) false;;
+                   esac &&
+                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+                   }
+                 }
+              then posix_mkdir=:
+              fi
+              rmdir "$tmpdir/d" "$tmpdir"
+            else
+              # Remove any dirs left behind by ancient mkdir implementations.
+              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+            fi
+            trap '' 0;;
+        esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+        umask $mkdir_umask &&
+        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+        /*) prefix='/';;
+        [-=\(\)!]*) prefix='./';;
+        *)  prefix='';;
+      esac
+
+      oIFS=$IFS
+      IFS=/
+      set -f
+      set fnord $dstdir
+      shift
+      set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+        test X"$d" = X && continue
+
+        prefix=$prefix$d
+        if test -d "$prefix"; then
+          prefixes=
+        else
+          if $posix_mkdir; then
+            (umask=$mkdir_umask &&
+             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+            # Don't fail if two instances are running concurrently.
+            test -d "$prefix" || exit 1
+          else
+            case $prefix in
+              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+              *) qprefix=$prefix;;
+            esac
+            prefixes="$prefixes '$qprefix'"
+          fi
+        fi
+        prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+        # Don't fail if two instances are running concurrently.
+        (umask $mkdir_umask &&
+         eval "\$doit_exec \$mkdirprog $prefixes") ||
+          test -d "$dstdir" || exit 1
+        obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
+       set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       set +f &&
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+        # Now remove or move aside any old file at destination location.
+        # We try this two ways since rm can't unlink itself on some
+        # systems and the destination file might be busy for other
+        # reasons.  In this case, the final cleanup might fail but the new
+        # file should still install successfully.
+        {
+          test ! -f "$dst" ||
+          $doit $rmcmd -f "$dst" 2>/dev/null ||
+          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+          } ||
+          { echo "$0: cannot unlink or rename $dst" >&2
+            (exit 1); exit 1
+          }
+        } &&
+
+        # Now rename the file to the real destination.
+        $doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/internal.h
@@ -0,0 +1,294 @@
+/* internal.h -- Internal header file for stack backtrace library.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#ifndef BACKTRACE_INTERNAL_H
+#define BACKTRACE_INTERNAL_H
+
+/* We assume that <sys/types.h> and "backtrace.h" have already been
+   included.  */
+
+#ifndef GCC_VERSION
+# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#endif
+
+#if (GCC_VERSION < 2007)
+# define __attribute__(x)
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+#ifndef ATTRIBUTE_MALLOC
+# if (GCC_VERSION >= 2096)
+#  define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+#  define ATTRIBUTE_MALLOC
+# endif
+#endif
+
+#ifndef HAVE_SYNC_FUNCTIONS
+
+/* Define out the sync functions.  These should never be called if
+   they are not available.  */
+
+#define __sync_bool_compare_and_swap(A, B, C) (abort(), 1)
+#define __sync_lock_test_and_set(A, B) (abort(), 0)
+#define __sync_lock_release(A) abort()
+
+#endif /* !defined (HAVE_SYNC_FUNCTIONS) */
+
+#ifdef HAVE_ATOMIC_FUNCTIONS
+
+/* We have the atomic builtin functions.  */
+
+#define backtrace_atomic_load_pointer(p) \
+    __atomic_load_n ((p), __ATOMIC_ACQUIRE)
+#define backtrace_atomic_load_int(p) \
+    __atomic_load_n ((p), __ATOMIC_ACQUIRE)
+#define backtrace_atomic_store_pointer(p, v) \
+    __atomic_store_n ((p), (v), __ATOMIC_RELEASE)
+#define backtrace_atomic_store_size_t(p, v) \
+    __atomic_store_n ((p), (v), __ATOMIC_RELEASE)
+#define backtrace_atomic_store_int(p, v) \
+    __atomic_store_n ((p), (v), __ATOMIC_RELEASE)
+
+#else /* !defined (HAVE_ATOMIC_FUNCTIONS) */
+#ifdef HAVE_SYNC_FUNCTIONS
+
+/* We have the sync functions but not the atomic functions.  Define
+   the atomic ones in terms of the sync ones.  */
+
+extern void *backtrace_atomic_load_pointer (void *);
+extern int backtrace_atomic_load_int (int *);
+extern void backtrace_atomic_store_pointer (void *, void *);
+extern void backtrace_atomic_store_size_t (size_t *, size_t);
+extern void backtrace_atomic_store_int (int *, int);
+
+#else /* !defined (HAVE_SYNC_FUNCTIONS) */
+
+/* We have neither the sync nor the atomic functions.  These will
+   never be called.  */
+
+#define backtrace_atomic_load_pointer(p) (abort(), (void *) NULL)
+#define backtrace_atomic_load_int(p) (abort(), 0)
+#define backtrace_atomic_store_pointer(p, v) abort()
+#define backtrace_atomic_store_size_t(p, v) abort()
+#define backtrace_atomic_store_int(p, v) abort()
+
+#endif /* !defined (HAVE_SYNC_FUNCTIONS) */
+#endif /* !defined (HAVE_ATOMIC_FUNCTIONS) */
+
+/* The type of the function that collects file/line information.  This
+   is like backtrace_pcinfo.  */
+
+typedef int (*fileline) (struct backtrace_state *state, uintptr_t pc,
+			 backtrace_full_callback callback,
+			 backtrace_error_callback error_callback, void *data);
+
+/* The type of the function that collects symbol information.  This is
+   like backtrace_syminfo.  */
+
+typedef void (*syminfo) (struct backtrace_state *state, uintptr_t pc,
+			 backtrace_syminfo_callback callback,
+			 backtrace_error_callback error_callback, void *data);
+
+/* What the backtrace state pointer points to.  */
+
+struct backtrace_state
+{
+  /* The name of the executable.  */
+  const char *filename;
+  /* Non-zero if threaded.  */
+  int threaded;
+  /* The master lock for fileline_fn, fileline_data, syminfo_fn,
+     syminfo_data, fileline_initialization_failed and everything the
+     data pointers point to.  */
+  void *lock;
+  /* The function that returns file/line information.  */
+  fileline fileline_fn;
+  /* The data to pass to FILELINE_FN.  */
+  void *fileline_data;
+  /* The function that returns symbol information.  */
+  syminfo syminfo_fn;
+  /* The data to pass to SYMINFO_FN.  */
+  void *syminfo_data;
+  /* Whether initializing the file/line information failed.  */
+  int fileline_initialization_failed;
+  /* The lock for the freelist.  */
+  int lock_alloc;
+  /* The freelist when using mmap.  */
+  struct backtrace_freelist_struct *freelist;
+};
+
+/* Open a file for reading.  Returns -1 on error.  If DOES_NOT_EXIST
+   is not NULL, *DOES_NOT_EXIST will be set to 0 normally and set to 1
+   if the file does not exist.  If the file does not exist and
+   DOES_NOT_EXIST is not NULL, the function will return -1 and will
+   not call ERROR_CALLBACK.  On other errors, or if DOES_NOT_EXIST is
+   NULL, the function will call ERROR_CALLBACK before returning.  */
+extern int backtrace_open (const char *filename,
+			   backtrace_error_callback error_callback,
+			   void *data,
+			   int *does_not_exist);
+
+/* A view of the contents of a file.  This supports mmap when
+   available.  A view will remain in memory even after backtrace_close
+   is called on the file descriptor from which the view was
+   obtained.  */
+
+struct backtrace_view
+{
+  /* The data that the caller requested.  */
+  const void *data;
+  /* The base of the view.  */
+  void *base;
+  /* The total length of the view.  */
+  size_t len;
+};
+
+/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET.  Store the
+   result in *VIEW.  Returns 1 on success, 0 on error.  */
+extern int backtrace_get_view (struct backtrace_state *state, int descriptor,
+			       off_t offset, size_t size,
+			       backtrace_error_callback error_callback,
+			       void *data, struct backtrace_view *view);
+
+/* Release a view created by backtrace_get_view.  */
+extern void backtrace_release_view (struct backtrace_state *state,
+				    struct backtrace_view *view,
+				    backtrace_error_callback error_callback,
+				    void *data);
+
+/* Close a file opened by backtrace_open.  Returns 1 on success, 0 on
+   error.  */
+
+extern int backtrace_close (int descriptor,
+			    backtrace_error_callback error_callback,
+			    void *data);
+
+/* Sort without using memory.  */
+
+extern void backtrace_qsort (void *base, size_t count, size_t size,
+			     int (*compar) (const void *, const void *));
+
+/* Allocate memory.  This is like malloc.  If ERROR_CALLBACK is NULL,
+   this does not report an error, it just returns NULL.  */
+
+extern void *backtrace_alloc (struct backtrace_state *state, size_t size,
+			      backtrace_error_callback error_callback,
+			      void *data) ATTRIBUTE_MALLOC;
+
+/* Free memory allocated by backtrace_alloc.  If ERROR_CALLBACK is
+   NULL, this does not report an error.  */
+
+extern void backtrace_free (struct backtrace_state *state, void *mem,
+			    size_t size,
+			    backtrace_error_callback error_callback,
+			    void *data);
+
+/* A growable vector of some struct.  This is used for more efficient
+   allocation when we don't know the final size of some group of data
+   that we want to represent as an array.  */
+
+struct backtrace_vector
+{
+  /* The base of the vector.  */
+  void *base;
+  /* The number of bytes in the vector.  */
+  size_t size;
+  /* The number of bytes available at the current allocation.  */
+  size_t alc;
+};
+
+/* Grow VEC by SIZE bytes.  Return a pointer to the newly allocated
+   bytes.  Note that this may move the entire vector to a new memory
+   location.  Returns NULL on failure.  */
+
+extern void *backtrace_vector_grow (struct backtrace_state *state, size_t size,
+				    backtrace_error_callback error_callback,
+				    void *data,
+				    struct backtrace_vector *vec);
+
+/* Finish the current allocation on VEC.  Prepare to start a new
+   allocation.  The finished allocation will never be freed.  Returns
+   a pointer to the base of the finished entries, or NULL on
+   failure.  */
+
+extern void* backtrace_vector_finish (struct backtrace_state *state,
+				      struct backtrace_vector *vec,
+				      backtrace_error_callback error_callback,
+				      void *data);
+
+/* Release any extra space allocated for VEC.  This may change
+   VEC->base.  Returns 1 on success, 0 on failure.  */
+
+extern int backtrace_vector_release (struct backtrace_state *state,
+				     struct backtrace_vector *vec,
+				     backtrace_error_callback error_callback,
+				     void *data);
+
+/* Read initial debug data from a descriptor, and set the
+   fileline_data, syminfo_fn, and syminfo_data fields of STATE.
+   Return the fileln_fn field in *FILELN_FN--this is done this way so
+   that the synchronization code is only implemented once.  This is
+   called after the descriptor has first been opened.  It will close
+   the descriptor if it is no longer needed.  Returns 1 on success, 0
+   on error.  There will be multiple implementations of this function,
+   for different file formats.  Each system will compile the
+   appropriate one.  */
+
+extern int backtrace_initialize (struct backtrace_state *state,
+				 int descriptor,
+				 backtrace_error_callback error_callback,
+				 void *data,
+				 fileline *fileline_fn);
+
+/* Add file/line information for a DWARF module.  */
+
+extern int backtrace_dwarf_add (struct backtrace_state *state,
+				uintptr_t base_address,
+				const unsigned char* dwarf_info,
+				size_t dwarf_info_size,
+				const unsigned char *dwarf_line,
+				size_t dwarf_line_size,
+				const unsigned char *dwarf_abbrev,
+				size_t dwarf_abbrev_size,
+				const unsigned char *dwarf_ranges,
+				size_t dwarf_range_size,
+				const unsigned char *dwarf_str,
+				size_t dwarf_str_size,
+				int is_bigendian,
+				backtrace_error_callback error_callback,
+				void *data, fileline *fileline_fn);
+
+#endif
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/ltmain.sh
@@ -0,0 +1,8636 @@
+# Generated from ltmain.m4sh.
+
+# libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --no-finish          let install mode avoid finish commands
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+#         host-triplet:	$host
+#         shell:		$SHELL
+#         compiler:		$LTCC
+#         compiler flags:		$LTCFLAGS
+#         linker:		$LD (gnu? $with_gnu_ld)
+#         $progname:	(GNU libtool 1.3134 2009-11-29) 2.2.7a
+#         automake:	$automake_version
+#         autoconf:	$autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION=2.2.7a
+TIMESTAMP=" 1.3134 2009-11-29"
+package_revision=1.3134
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+          save_$lt_var=\$$lt_var
+          $lt_var=C
+	  export $lt_var
+	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+	fi"
+done
+
+$lt_unset CDPATH
+
+
+
+
+
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+
+
+: ${CP="cp -f"}
+: ${ECHO=$as_echo}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="/mount/endor/wildenhu/local-x86_64/bin/sed"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+  func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+}
+
+# Generated shell functions inserted here.
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+		s@/\./@/@g
+		t dotsl
+		s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
+
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=$func_dirname_result
+     progdir=`cd "$progdir" && pwd`
+     progpath="$progdir/$progname"
+     ;;
+  *)
+     save_IFS="$IFS"
+     IFS=:
+     for progdir in $PATH; do
+       IFS="$save_IFS"
+       test -x "$progdir/$progname" && break
+     done
+     IFS="$save_IFS"
+     test -n "$progdir" || progdir=`pwd`
+     progpath="$progdir/$progname"
+     ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+  s/$bs4/&\\
+/g
+  s/^$bs2$dollar/$bs&/
+  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+  s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+    $ECHO "$progname${mode+: }$mode: $*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $opt_verbose && func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+
+    # bash bug again:
+    :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    func_error ${1+"$@"}
+    func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information."  ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    my_directory_path="$1"
+    my_dir_list=
+
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+      # Protect directory names starting with `-'
+      case $my_directory_path in
+        -*) my_directory_path="./$my_directory_path" ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$my_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+	# list incase some portion of path contains whitespace.
+        my_dir_list="$my_directory_path:$my_dir_list"
+
+        # If the last portion added has no slash in it, the list is done
+        case $my_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+      done
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+      save_mkdir_p_IFS="$IFS"; IFS=':'
+      for my_dir in $my_dir_list; do
+	IFS="$save_mkdir_p_IFS"
+        # mkdir can fail with a `File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$my_dir" 2>/dev/null || :
+      done
+      IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+    case $1 in
+      *[\\\`\"\$]*)
+	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+      *)
+        func_quote_for_eval_unquoted_result="$1" ;;
+    esac
+
+    case $func_quote_for_eval_unquoted_result in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and and variable
+      # expansion for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+        ;;
+      *)
+        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+    esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    case $1 in
+      *[\\\`\"]*)
+	my_arg=`$ECHO "$1" | $SED \
+	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        my_arg="$1" ;;
+    esac
+
+    case $my_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        my_arg="\"$my_arg\""
+        ;;
+    esac
+
+    func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$my_cmd"
+      my_status=$?
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$lt_user_locale
+	    $my_cmd"
+      my_status=$?
+      eval "$lt_safe_locale"
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $SED -n '/(C)/!b go
+	:more
+	/\./!{
+	  N
+	  s/\n# //
+	  b more
+	}
+	:go
+	/^# '$PROGRAM' (GNU /,/# warranty; / {
+        s/^# //
+	s/^# *$//
+        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+        p
+     }' < "$progpath"
+     exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $SED -n '/^# Usage:/,/^#  *-h/ {
+        s/^# //
+	s/^# *$//
+	s/\$progname/'$progname'/
+	p
+    }' < "$progpath"
+    echo
+    $ECHO "run \`$progname --help | more' for full usage"
+    exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
+        s/^# //
+	s/^# *$//
+	s*\$progname*'$progname'*
+	s*\$host*'"$host"'*
+	s*\$SHELL*'"$SHELL"'*
+	s*\$LTCC*'"$LTCC"'*
+	s*\$LTCFLAGS*'"$LTCFLAGS"'*
+	s*\$LD*'"$LD"'*
+	s/\$with_gnu_ld/'"$with_gnu_ld"'/
+	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+	p
+     }' < "$progpath"
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    func_error "missing argument for $1"
+    exit_cmd=exit
+}
+
+exit_cmd=:
+
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+# $mode is unset
+nonopt=
+execute_dlfiles=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+opt_dry_run=false
+opt_finish=:
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func_error ${1+"$@"}
+    func_error "See the $PACKAGE documentation for more information."
+    func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+    echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      echo "enable shared libraries"
+    else
+      echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      echo "enable static libraries"
+    else
+      echo "disable static libraries"
+    fi
+
+    exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+  # Global variable:
+  tagname="$1"
+
+  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+  # Validate tagname.
+  case $tagname in
+    *[!-_A-Za-z0-9,/]*)
+      func_fatal_error "invalid tag name: $tagname"
+      ;;
+  esac
+
+  # Don't test for the "default" C tag, as we know it's
+  # there but not specially marked.
+  case $tagname in
+    CC) ;;
+    *)
+      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+	taglist="$taglist $tagname"
+
+	# Evaluate the configuration.  Be careful to quote the path
+	# and the sed script, to avoid splitting on whitespace, but
+	# also don't use non-portable quotes within backquotes within
+	# quotes we have to do it in 2 steps:
+	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+	eval "$extractedcf"
+      else
+	func_error "ignoring unknown tag $tagname"
+      fi
+      ;;
+  esac
+}
+
+# Parse options once, thoroughly.  This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
+{
+
+  # Shorthand for --mode=foo, only valid as the first argument
+  case $1 in
+  clean|clea|cle|cl)
+    shift; set dummy --mode clean ${1+"$@"}; shift
+    ;;
+  compile|compil|compi|comp|com|co|c)
+    shift; set dummy --mode compile ${1+"$@"}; shift
+    ;;
+  execute|execut|execu|exec|exe|ex|e)
+    shift; set dummy --mode execute ${1+"$@"}; shift
+    ;;
+  finish|finis|fini|fin|fi|f)
+    shift; set dummy --mode finish ${1+"$@"}; shift
+    ;;
+  install|instal|insta|inst|ins|in|i)
+    shift; set dummy --mode install ${1+"$@"}; shift
+    ;;
+  link|lin|li|l)
+    shift; set dummy --mode link ${1+"$@"}; shift
+    ;;
+  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+    shift; set dummy --mode uninstall ${1+"$@"}; shift
+    ;;
+  esac
+
+  # Parse non-mode specific arguments:
+  while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+      --config)		func_config					;;
+
+      --debug)		preserve_args="$preserve_args $opt"
+			func_echo "enabling shell trace mode"
+			opt_debug='set -x'
+			$opt_debug
+			;;
+
+      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			execute_dlfiles="$execute_dlfiles $1"
+			shift
+			;;
+
+      --dry-run | -n)	opt_dry_run=:					;;
+      --features)       func_features					;;
+      --finish)		mode="finish"					;;
+      --no-finish)	opt_finish=false				;;
+
+      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			case $1 in
+			  # Valid mode arguments:
+			  clean)	;;
+			  compile)	;;
+			  execute)	;;
+			  finish)	;;
+			  install)	;;
+			  link)		;;
+			  relink)	;;
+			  uninstall)	;;
+
+			  # Catch anything else as an error
+			  *) func_error "invalid argument for $opt"
+			     exit_cmd=exit
+			     break
+			     ;;
+		        esac
+
+			mode="$1"
+			shift
+			;;
+
+      --preserve-dup-deps)
+			opt_duplicate_deps=:				;;
+
+      --quiet|--silent)	preserve_args="$preserve_args $opt"
+			opt_silent=:
+			opt_verbose=false
+			;;
+
+      --no-quiet|--no-silent)
+			preserve_args="$preserve_args $opt"
+			opt_silent=false
+			;;
+
+      --verbose| -v)	preserve_args="$preserve_args $opt"
+			opt_silent=false
+			opt_verbose=:
+			;;
+
+      --no-verbose)	preserve_args="$preserve_args $opt"
+			opt_verbose=false
+			;;
+
+      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			preserve_args="$preserve_args $opt $1"
+			func_enable_tag "$1"	# tagname is set here
+			shift
+			;;
+
+      # Separate optargs to long options:
+      -dlopen=*|--mode=*|--tag=*)
+			func_opt_split "$opt"
+			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
+			shift
+			;;
+
+      -\?|-h)		func_usage					;;
+      --help)		opt_help=:					;;
+      --help-all)	opt_help=': help-all'				;;
+      --version)	func_version					;;
+
+      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
+
+      *)		nonopt="$opt"
+			break
+			;;
+    esac
+  done
+
+
+  case $host in
+    *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* )
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+      ;;
+  esac
+
+  # Having warned about all mis-specified options, bail out if
+  # anything was wrong.
+  $exit_cmd $EXIT_FAILURE
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
+
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+$opt_help || {
+  # Sanity checks first:
+  func_check_version_match
+
+  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+    func_fatal_configuration "not configured to build any kind of library"
+  fi
+
+  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+
+
+  # Darwin sucks
+  eval "std_shrext=\"$shrext_cmds\""
+
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    func_error "unrecognized option \`-dlopen'"
+    $ECHO "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$progname --help --mode=$mode' for more information."
+}
+
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+	for lalib_p_l in 1 2 3 4
+	do
+	    read lalib_p_line
+	    case "$lalib_p_line" in
+		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+	    esac
+	done
+	exec 0<&5 5<&-
+    fi
+    test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+    func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+    func_ltwrapper_exec_suffix=
+    case $1 in
+    *.exe) ;;
+    *) func_ltwrapper_exec_suffix=.exe ;;
+    esac
+    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+    func_ltwrapper_scriptname_result=""
+    if func_ltwrapper_executable_p "$1"; then
+	func_dirname_and_basename "$1" "" "."
+	func_stripname '' '.exe' "$func_basename_result"
+	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    fi
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $opt_debug
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$save_ifs
+      eval "cmd=\"$cmd\""
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $opt_debug
+    case $1 in
+    */* | *\\*)	. "$1" ;;
+    *)		. "./$1" ;;
+    esac
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $opt_debug
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+        func_quote_for_eval "$arg"
+	CC_quoted="$CC_quoted $func_quote_for_eval_result"
+      done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	      # Double-quote args containing other shell metacharacters.
+	      func_quote_for_eval "$arg"
+	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	    done
+	    CC_expanded=`func_echo_all $CC`
+	    CC_quoted_expanded=`func_echo_all $CC_quoted`
+	    case "$@ " in
+	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  func_echo "unable to infer tagged configuration"
+	  func_fatal_error "specify a tag with \`--tag'"
+#	else
+#	  func_verbose "using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      $MV "${write_libobj}T" "${write_libobj}"
+    }
+}
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $opt_debug
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  test -n "$libobj" && \
+	    func_fatal_error "you cannot specify \`-o' more than once"
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-pie | -fpie | -fPIE)
+          pie_flag="$pie_flag $arg"
+	  continue
+	  ;;
+
+	-shared | -static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  func_stripname '-Wc,' '' "$arg"
+	  args=$func_stripname_result
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+	  for arg in $args; do
+	    IFS="$save_ifs"
+	    func_quote_for_eval "$arg"
+	    lastarg="$lastarg $func_quote_for_eval_result"
+	  done
+	  IFS="$save_ifs"
+	  func_stripname ' ' '' "$lastarg"
+	  lastarg=$func_stripname_result
+
+	  # Add the arguments to base_compile.
+	  base_compile="$base_compile $lastarg"
+	  continue
+	  ;;
+
+	*)
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_quote_for_eval "$lastarg"
+      base_compile="$base_compile $func_quote_for_eval_result"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with \`-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+	func_basename "$srcfile"
+	libobj="$func_basename_result"
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    case $libobj in
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
+    esac
+
+    case $libobj in
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+    *)
+      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	continue
+	;;
+
+      -static)
+	build_libtool_libs=no
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
+      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+    func_dirname_and_basename "$obj" "/" ""
+    objname="$func_basename_result"
+    xdir="$func_dirname_result"
+    lobj=${xdir}$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+      removelist="$removelist $output_obj"
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    removelist="$removelist $lockfile"
+    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+    if test -n "$fix_srcfile_path"; then
+      eval "srcfile=\"$fix_srcfile_path\""
+    fi
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
+      fi
+
+      func_show_eval_locale "$command"	\
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	func_show_eval '$MV "$output_obj" "$lobj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+	suppress_output=' >/dev/null 2>&1'
+      fi
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile$pie_flag"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      func_show_eval_locale "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	func_show_eval '$MV "$output_obj" "$obj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+    fi
+
+    $opt_dry_run || {
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+	removelist=$lockfile
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+  test "$mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -shared           do not build a \`.o' file suitable for static linking
+  -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode \`$mode'"
+        ;;
+    esac
+
+    echo
+    $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for mode in compile link execute install finish uninstall clean; do
+	func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for mode in compile link execute install finish uninstall clean; do
+	echo
+	func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+	H
+	d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $opt_debug
+    # The first argument is the command name.
+    cmd="$nonopt"
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      test -f "$file" \
+	|| func_fatal_help "\`$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+	func_source "$file"
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && \
+	    func_warning "\`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  if test ! -f "$dir/$dlname"; then
+	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+	;;
+
+      *)
+	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval test -z \"\$$shlibpath_var\"; then
+	eval $shlibpath_var=\$dir
+      else
+	eval $shlibpath_var=\$dir:\$$shlibpath_var
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -* | *.la | *.lo ) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if func_ltwrapper_script_p "$file"; then
+	  func_source "$file"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	elif func_ltwrapper_executable_p "$file"; then
+	  func_ltwrapper_scriptname "$file"
+	  func_source "$func_ltwrapper_scriptname_result"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_quote_for_eval "$file"
+      args="$args $func_quote_for_eval_result"
+    done
+
+    if test "X$opt_dry_run" = Xfalse; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var; export $lt_var
+	      else
+		$lt_unset $lt_var
+	      fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+	echo "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_silent && exit $EXIT_SUCCESS
+
+    echo "----------------------------------------------------------------------"
+    echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $ECHO "   $libdir"
+    done
+    echo
+    echo "If you ever happen to want to link against installed libraries"
+    echo "in a given directory, LIBDIR, you must either use libtool, and"
+    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval "flag=\"$hardcode_libdir_flag_spec\""
+
+      $ECHO "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $ECHO "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    echo
+
+    echo "See any operating system documentation about shared libraries for"
+    case $host in
+      solaris2.[6789]|solaris2.1[0-9])
+        echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	echo "pages."
+	;;
+      *)
+        echo "more information, such as the ld(1) and ld.so(8) manual pages."
+        ;;
+    esac
+    echo "----------------------------------------------------------------------"
+    exit $EXIT_SUCCESS
+}
+
+test "$mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $opt_debug
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       case $nonopt in *shtool*) :;; *) false;; esac; then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    install_prog="$install_prog$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    no_mode=:
+    for arg
+    do
+      arg2=
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f)
+	if $install_cp; then :; else
+	  prev=$arg
+	fi
+	;;
+      -g | -m | -o)
+	prev=$arg
+	;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
+	    arg2=$install_override_mode
+	    no_mode=false
+	  fi
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      install_prog="$install_prog $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+	func_quote_for_eval "$arg2"
+      fi
+      install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prev' option requires an argument"
+
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+	func_quote_for_eval "$install_override_mode"
+	install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
+      fi
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	func_fatal_help "no file or destination specified"
+      else
+	func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      func_dirname_and_basename "$dest" "" "."
+      destdir="$func_dirname_result"
+      destname="$func_basename_result"
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+	func_fatal_help "\`$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  func_fatal_help "\`$destdir' must be an absolute directory name"
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$file' is not a valid libtool archive"
+
+	library_names=
+	old_library=
+	relink_command=
+	func_source "$file"
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	func_dirname "$file" "/" ""
+	dir="$func_dirname_result"
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  test "$inst_prefix_dir" = "$destdir" && \
+	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	  else
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	  fi
+
+	  func_warning "relinking \`$file'"
+	  func_show_eval "$relink_command" \
+	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names; shift
+	if test -n "$1"; then
+	  realname="$1"
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+	      'exit $?'
+	  tstripme="$stripme"
+	  case $host_os in
+	  cygwin* | mingw* | pw32* | cegcc*)
+	    case $realname in
+	    *.dll.a)
+	      tstripme=""
+	      ;;
+	    esac
+	    ;;
+	  esac
+	  if test -n "$tstripme" && test -n "$striplib"; then
+	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      test "$linkname" != "$realname" \
+		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  func_execute_cmds "$postinstall_cmds" 'exit $?'
+	fi
+
+	# Install the pseudo-library for information purposes.
+	func_basename "$file"
+	name="$func_basename_result"
+	instname="$dir/$name"i
+	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  func_lo2o "$destfile"
+	  staticdest=$func_lo2o_result
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	test -n "$destfile" && \
+	  func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  func_lo2o "$file"
+	  staticobj=$func_lo2o_result
+	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      func_stripname '' '.exe' "$file"
+	      file=$func_stripname_result
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin* | *mingw*)
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      wrapper=$func_ltwrapper_scriptname_result
+	    else
+	      func_stripname '' '.exe' "$file"
+	      wrapper=$func_stripname_result
+	    fi
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if func_ltwrapper_script_p "$wrapper"; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  func_source "$wrapper"
+
+	  # Check the variables that should have been set.
+	  test -z "$generated_by_libtool_version" && \
+	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      func_source "$lib"
+	    fi
+	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      func_warning "\`$lib' has not been installed in \`$libdir'"
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  func_source "$wrapper"
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    $opt_dry_run || {
+	      if test "$finalize" = yes; then
+	        tmpdir=`func_mktempdir`
+		func_basename "$file$stripped_ext"
+		file="$func_basename_result"
+	        outputname="$tmpdir/$file"
+	        # Replace the output file specification.
+	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+	        $opt_silent || {
+	          func_quote_for_expand "$relink_command"
+		  eval "func_echo $func_quote_for_expand_result"
+	        }
+	        if eval "$relink_command"; then :
+	          else
+		  func_error "error: relink \`$file' with the above command before installing it"
+		  $opt_dry_run || ${RM}r "$tmpdir"
+		  continue
+	        fi
+	        file="$outputname"
+	      else
+	        func_warning "cannot relink \`$file'"
+	      fi
+	    }
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    func_stripname '' '.exe' "$destfile"
+	    destfile=$func_stripname_result
+	    ;;
+	  esac
+	  ;;
+	esac
+	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+	$opt_dry_run || if test -n "$outputname"; then
+	  ${RM}r "$tmpdir"
+	fi
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name="$func_basename_result"
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	func_show_eval "$old_striplib $oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs" && $opt_finish; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $opt_debug
+    my_outputname="$1"
+    my_originator="$2"
+    my_pic_p="${3-no}"
+    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	my_dlsyms="${my_outputname}S.c"
+      else
+	func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+	# Discover the nlist of each of the dlfiles.
+	nlist="$output_objdir/${my_outputname}.nm"
+
+	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+	# Parse the name list into a source file.
+	func_verbose "creating $output_objdir/$my_dlsyms"
+
+	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+	if test "$dlself" = yes; then
+	  func_verbose "generating symbol list for \`$output'"
+
+	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+	  # Add our own program objects to the symbol list.
+	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	  for progfile in $progfiles; do
+	    func_verbose "extracting global C symbols from \`$progfile'"
+	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -n "$exclude_expsyms"; then
+	    $opt_dry_run || {
+	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	      $MV "$nlist"T "$nlist"
+	    }
+	  fi
+
+	  if test -n "$export_symbols_regex"; then
+	    $opt_dry_run || {
+	      $EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T
+	      $MV "$nlist"T "$nlist"
+	    }
+	  fi
+
+	  # Prepare the list of exported symbols
+	  if test -z "$export_symbols"; then
+	    export_symbols="$output_objdir/$outputname.exp"
+	    $opt_dry_run || {
+	      $RM $export_symbols
+	      ${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' < "$nlist" > "$export_symbols"
+	      case $host in
+	      *cygwin* | *mingw* | *cegcc* )
+                echo EXPORTS > "$output_objdir/$outputname.def"
+                cat "$export_symbols" >> "$output_objdir/$outputname.def"
+	        ;;
+	      esac
+	    }
+	  else
+	    $opt_dry_run || {
+	      ${SED} -e 's/\([].[*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/' < "$export_symbols" > "$output_objdir/$outputname.exp"
+	      $GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T
+	      $MV "$nlist"T "$nlist"
+	      case $host in
+	        *cygwin* | *mingw* | *cegcc* )
+	          echo EXPORTS > "$output_objdir/$outputname.def"
+	          cat "$nlist" >> "$output_objdir/$outputname.def"
+	          ;;
+	      esac
+	    }
+	  fi
+	fi
+
+	for dlprefile in $dlprefiles; do
+	  func_verbose "extracting global C symbols from \`$dlprefile'"
+	  func_basename "$dlprefile"
+	  name="$func_basename_result"
+	  $opt_dry_run || {
+	    $ECHO ": $name " >> "$nlist"
+	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	  }
+	done
+
+	$opt_dry_run || {
+	  # Make sure we have at least an empty file.
+	  test -f "$nlist" || : > "$nlist"
+
+	  if test -n "$exclude_expsyms"; then
+	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	    $MV "$nlist"T "$nlist"
+	  fi
+
+	  # Try sorting and uniquifying the output.
+	  if $GREP -v "^: " < "$nlist" |
+	      if sort -k 3 </dev/null >/dev/null 2>&1; then
+		sort -k 3
+	      else
+		sort +2
+	      fi |
+	      uniq > "$nlist"S; then
+	    :
+	  else
+	    $GREP -v "^: " < "$nlist" > "$nlist"S
+	  fi
+
+	  if test -f "$nlist"S; then
+	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+	  else
+	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	  fi
+
+	  echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+typedef struct {
+  const char *name;
+  void *address;
+} lt_dlsymlist;
+"
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc* )
+	    echo >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs.  */"
+	    lt_dlsym_const= ;;
+	  *osf5*)
+	    echo >> "$output_objdir/$my_dlsyms" "\
+/* This system does not cope well with relocations in const data */"
+	    lt_dlsym_const= ;;
+	  *)
+	    lt_dlsym_const=const ;;
+	  esac
+
+	  echo >> "$output_objdir/$my_dlsyms" "\
+extern $lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+$lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+  { \"$my_originator\", (void *) 0 },"
+
+	  case $need_lib_prefix in
+	  no)
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  *)
+	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  esac
+	  echo >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	} # !$opt_dry_run
+
+	pic_flag_for_symtable=
+	case "$compile_command " in
+	*" -static "*) ;;
+	*)
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+	  *-*-hpux*)
+	    pic_flag_for_symtable=" $pic_flag"  ;;
+	  *)
+	    if test "X$my_pic_p" != Xno; then
+	      pic_flag_for_symtable=" $pic_flag"
+	    fi
+	    ;;
+	  esac
+	  ;;
+	esac
+	symtab_cflags=
+	for arg in $LTCFLAGS; do
+	  case $arg in
+	  -pie | -fpie | -fPIE) ;;
+	  *) symtab_cflags="$symtab_cflags $arg" ;;
+	  esac
+	done
+
+	# Now compile the dynamic symbol file.
+	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+	# Clean up the generated files.
+	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+	# Transform the symbol file into the correct name.
+	symfileobj="$output_objdir/${my_outputname}S.$objext"
+	case $host in
+	*cygwin* | *mingw* | *cegcc* )
+	  if test -f "$output_objdir/$my_outputname.def"; then
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	  else
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  fi
+	  ;;
+	*)
+	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  ;;
+	esac
+	;;
+      *)
+	func_fatal_error "unknown suffix for \`$my_dlsyms'"
+	;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+  $opt_debug
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if $OBJDUMP -f "$1" | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      win32_nmres=`$NM -f posix -A "$1" |
+	$SED -n -e '
+	    1,100{
+		/ I /{
+		    s,.*,import,
+		    p
+		    q
+		}
+	    }'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+		   'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $opt_debug
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib="$func_basename_result"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  func_arith $extracted_serial + 1
+	  extracted_serial=$func_arith_result
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+	func_verbose "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	$opt_dry_run || {
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`basename "$darwin_archive"`
+	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+	  if test -n "$darwin_arches"; then
+	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      $LIPO -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    $RM -rf unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd $darwin_orig_dir
+	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	} # !$opt_dry_run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+	;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+	func_emit_wrapper_arg1=${1-no}
+
+	$ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+  done
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+    # special case for '.'
+    if test \"\$thisdir\" = \".\"; then
+      thisdir=\`pwd\`
+    fi
+    # remove .libs from thisdir
+    case \"\$thisdir\" in
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    $objdir )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $ECHO "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+	  $ECHO "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \"\$relink_command\" 2>&1\`; then :
+      else
+	$ECHO \"\$relink_command_output\" >&2
+	$RM \"\$progdir/\$file\"
+	exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+	else
+	  $ECHO "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$ECHO "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $ECHO "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$ECHO "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2* | *-cegcc*)
+	  $ECHO "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $ECHO "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+}
+
+
+# func_to_host_path arg
+#
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin.  Calling this function does no harm for other
+# $host/$build combinations not listed above.
+#
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
+{
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        case $build in
+          *mingw* ) # actually, msys
+            # awkward: cmd appends spaces to result
+            func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
+              $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_path_result=`cygpath -w "$1" |
+	      $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # Unfortunately, winepath does not exit with a non-zero
+            # error code, so we are forced to check the contents of
+            # stdout. On the other hand, if the command is not
+            # found, the shell will set an exit code of 127 and print
+            # *an error message* to stdout. So we must check for both
+            # error code of zero AND non-empty stdout, which explains
+            # the odd construction:
+            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+              func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
+                $SED -e "$lt_sed_naive_backslashify"`
+            else
+              # Allow warning below.
+              func_to_host_path_result=
+            fi
+            ;;
+        esac
+        if test -z "$func_to_host_path_result" ; then
+          func_error "Could not determine host path corresponding to"
+          func_error "  \`$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback:
+          func_to_host_path_result="$1"
+        fi
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_path
+
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
+{
+  func_to_host_pathlist_result="$1"
+  if test -n "$1"; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        # Remove leading and trailing path separator characters from
+        # ARG. msys behavior is inconsistent here, cygpath turns them
+        # into '.;' and ';.', and winepath ignores them completely.
+	func_stripname : : "$1"
+        func_to_host_pathlist_tmp1=$func_stripname_result
+        case $build in
+          *mingw* ) # Actually, msys.
+            # Awkward: cmd appends spaces to result.
+            func_to_host_pathlist_result=`
+	      ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
+	      $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # unfortunately, winepath doesn't convert pathlists
+            func_to_host_pathlist_result=""
+            func_to_host_pathlist_oldIFS=$IFS
+            IFS=:
+            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+              IFS=$func_to_host_pathlist_oldIFS
+              if test -n "$func_to_host_pathlist_f" ; then
+                func_to_host_path "$func_to_host_pathlist_f"
+                if test -n "$func_to_host_path_result" ; then
+                  if test -z "$func_to_host_pathlist_result" ; then
+                    func_to_host_pathlist_result="$func_to_host_path_result"
+                  else
+                    func_append func_to_host_pathlist_result ";$func_to_host_path_result"
+                  fi
+                fi
+              fi
+            done
+            IFS=$func_to_host_pathlist_oldIFS
+            ;;
+        esac
+        if test -z "$func_to_host_pathlist_result"; then
+          func_error "Could not determine the host path(s) corresponding to"
+          func_error "  \`$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback. This may break if $1 contains DOS-style drive
+          # specifications. The fix is not to complicate the expression
+          # below, but for the user to provide a working wine installation
+          # with winepath so that path translation in the cross-to-mingw
+          # case works properly.
+          lt_replace_pathsep_nix_to_dos="s|:|;|g"
+          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+            $SED -e "$lt_replace_pathsep_nix_to_dos"`
+        fi
+        # Now, add the leading and trailing path separators back
+        case "$1" in
+          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+            ;;
+        esac
+        case "$1" in
+          *: ) func_append func_to_host_pathlist_result ";"
+            ;;
+        esac
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_pathlist
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+	cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "$SHELL $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+	    cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#undef LTWRAPPER_DEBUGPRINTF
+#if defined LT_DEBUGWRAPPER
+# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
+static void
+ltwrapper_debugprintf (const char *fmt, ...)
+{
+    va_list args;
+    va_start (args, fmt);
+    (void) vfprintf (stderr, fmt, args);
+    va_end (args);
+}
+#else
+# define LTWRAPPER_DEBUGPRINTF(args)
+#endif
+
+const char *program_name = NULL;
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+	    cat <<EOF
+const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_pathlist "$temp_rpath"
+	      cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test -n "$dllsearchpath"; then
+              func_to_host_pathlist "$dllsearchpath:"
+	      cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test "$fast_install" = yes; then
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+	    else
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+	    fi
+
+
+	    cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
+
+static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int  newargc;
+  char *tmp_pathspec;
+  char *actual_cwrapper_path;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
+  intptr_t rval = 127;
+
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
+  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+
+  /* very simple arg parsing; don't want to rely on getopt */
+  for (i = 1; i < argc; i++)
+    {
+      if (strcmp (argv[i], dumpscript_opt) == 0)
+	{
+EOF
+	    case "$host" in
+	      *mingw* | *cygwin* )
+		# make stdout use "unix" line endings
+		echo "          setmode(1,_O_BINARY);"
+		;;
+	      esac
+
+	    cat <<"EOF"
+	  lt_dump_script (stdout);
+	  return 0;
+	}
+    }
+
+  newargz = XMALLOC (char *, argc + 1);
+  tmp_pathspec = find_executable (argv[0]);
+  if (tmp_pathspec == NULL)
+    lt_fatal ("Couldn't find %s", argv[0]);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
+			  tmp_pathspec));
+
+  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
+			  actual_cwrapper_path));
+  XFREE (tmp_pathspec);
+
+  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+			  target_name));
+EOF
+
+	    cat <<EOF
+  newargz[0] =
+    XMALLOC (char, (strlen (actual_cwrapper_path) +
+		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
+EOF
+
+	    cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
+
+	    case $host_os in
+	      mingw*)
+	    cat <<"EOF"
+  {
+    char* p;
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+	*p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+      {
+	*p = '/';
+      }
+  }
+EOF
+	    ;;
+	    esac
+
+	    cat <<"EOF"
+  XFREE (target_name);
+  XFREE (actual_cwrapper_path);
+  XFREE (actual_cwrapper_name);
+
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal ("Unrecognized option in %s namespace: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
+
+  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+  for (i = 0; i < newargc; i++)
+    {
+      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+    }
+
+EOF
+
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+  /* execv doesn't actually work on mingw as expected on unix */
+  newargz = prepare_spawn (newargz);
+  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  if (rval == -1)
+    {
+      /* failed to start process */
+      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+      return 127;
+    }
+  return rval;
+EOF
+		;;
+	      *)
+		cat <<"EOF"
+  execv (lt_argv_zero, newargz);
+  return rval; /* =127, but avoids unused variable warning */
+EOF
+		;;
+	    esac
+
+	    cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void *p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+			  string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable (const char *path)
+{
+  struct stat st;
+
+  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
+			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    return 1;
+  else
+    return 0;
+}
+
+int
+make_executable (const char *path)
+{
+  int rval = 0;
+  struct stat st;
+
+  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
+			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  if ((!path) || (!*path))
+    return 0;
+
+  if (stat (path, &st) >= 0)
+    {
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+    }
+  return rval;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise
+   Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+  int has_slash = 0;
+  const char *p;
+  const char *p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char *concat_name;
+
+  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
+			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable (concat_name))
+	return concat_name;
+      XFREE (concat_name);
+    }
+  else
+    {
+#endif
+      if (IS_DIR_SEPARATOR (wrapper[0]))
+	{
+	  concat_name = xstrdup (wrapper);
+	  if (check_executable (concat_name))
+	    return concat_name;
+	  XFREE (concat_name);
+	}
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+    }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+      {
+	has_slash = 1;
+	break;
+      }
+  if (!has_slash)
+    {
+      /* no slashes; search PATH */
+      const char *path = getenv ("PATH");
+      if (path != NULL)
+	{
+	  for (p = path; *p; p = p_next)
+	    {
+	      const char *q;
+	      size_t p_len;
+	      for (q = p; *q; q++)
+		if (IS_PATH_SEPARATOR (*q))
+		  break;
+	      p_len = q - p;
+	      p_next = (*q == '\0' ? q : q + 1);
+	      if (p_len == 0)
+		{
+		  /* empty path: current directory */
+		  if (getcwd (tmp, LT_PATHMAX) == NULL)
+		    lt_fatal ("getcwd failed");
+		  tmp_len = strlen (tmp);
+		  concat_name =
+		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, tmp, tmp_len);
+		  concat_name[tmp_len] = '/';
+		  strcpy (concat_name + tmp_len + 1, wrapper);
+		}
+	      else
+		{
+		  concat_name =
+		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, p, p_len);
+		  concat_name[p_len] = '/';
+		  strcpy (concat_name + p_len + 1, wrapper);
+		}
+	      if (check_executable (concat_name))
+		return concat_name;
+	      XFREE (concat_name);
+	    }
+	}
+      /* not found in PATH; assume curdir */
+    }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen (tmp);
+  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable (concat_name))
+    return concat_name;
+  XFREE (concat_name);
+  return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+  return xstrdup (pathspec);
+#else
+  char buf[LT_PATHMAX];
+  struct stat s;
+  char *tmp_pathspec = xstrdup (pathspec);
+  char *p;
+  int has_symlinks = 0;
+  while (strlen (tmp_pathspec) && !has_symlinks)
+    {
+      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
+			      tmp_pathspec));
+      if (lstat (tmp_pathspec, &s) == 0)
+	{
+	  if (S_ISLNK (s.st_mode) != 0)
+	    {
+	      has_symlinks = 1;
+	      break;
+	    }
+
+	  /* search backwards for last DIR_SEPARATOR */
+	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    p--;
+	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    {
+	      /* no more DIR_SEPARATORS left */
+	      break;
+	    }
+	  *p = '\0';
+	}
+      else
+	{
+	  char *errstr = strerror (errno);
+	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+	}
+    }
+  XFREE (tmp_pathspec);
+
+  if (!has_symlinks)
+    {
+      return xstrdup (pathspec);
+    }
+
+  tmp_pathspec = realpath (pathspec, buf);
+  if (tmp_pathspec == 0)
+    {
+      lt_fatal ("Could not follow symlinks for %s", pathspec);
+    }
+  return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert (str != NULL);
+  assert (pat != NULL);
+
+  len = strlen (str);
+  patlen = strlen (pat);
+
+  if (patlen <= len)
+    {
+      str += len - patlen;
+      if (strcmp (str, pat) == 0)
+	*str = '\0';
+    }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char *mode,
+	       const char *message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+EOF
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+	new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+	{
+	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+	  size_t length;
+	  unsigned int backslashes;
+	  const char *s;
+	  char *quoted_string;
+	  char *p;
+
+	  length = 0;
+	  backslashes = 0;
+	  if (quote_around)
+	    length++;
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		length += backslashes + 1;
+	      length++;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    length += backslashes + 1;
+
+	  quoted_string = XMALLOC (char, length + 1);
+
+	  p = quoted_string;
+	  backslashes = 0;
+	  if (quote_around)
+	    *p++ = '"';
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		{
+		  unsigned int j;
+		  for (j = backslashes + 1; j > 0; j--)
+		    *p++ = '\\';
+		}
+	      *p++ = c;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    {
+	      unsigned int j;
+	      for (j = backslashes; j > 0; j--)
+		*p++ = '\\';
+	      *p++ = '"';
+	    }
+	  *p = '\0';
+
+	  new_argv[i] = quoted_string;
+	}
+      else
+	new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+		;;
+	    esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+	    func_emit_wrapper yes |
+              $SED -e 's/\([\\"]\)/\\\1/g' \
+	           -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
+
+            cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval "$file_magic_cmd \"\$1\" 2>/dev/null" | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $opt_debug
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args=$nonopt
+    base_compile="$nonopt $@"
+    compile_command=$nonopt
+    finalize_command=$nonopt
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    bindir=
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module="${wl}-single_module"
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	break
+	;;
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    func_warning "complete static linking is impossible in this configuration"
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	-static)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      func_quote_for_eval "$arg"
+      qarg=$func_quote_for_eval_unquoted_result
+      func_append libtool_args " $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  func_append compile_command " @OUTPUT@"
+	  func_append finalize_command " @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	bindir)
+	  bindir="$arg"
+	  prev=
+	  continue
+	  ;;
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    func_append compile_command " @SYMFILE@"
+	    func_append finalize_command " @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  test -f "$arg" \
+	    || func_fatal_error "symbol file \`$arg' does not exist"
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	framework)
+	  case $host in
+	    *-*-darwin*)
+	      case "$deplibs " in
+		*" $qarg.ltframework "*) ;;
+		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+		   ;;
+	      esac
+	      ;;
+	  esac
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat "$save_arg"`
+	    do
+#	      moreargs="$moreargs $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if func_lalib_unsafe_p "$arg"; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		func_source "$arg"
+
+		if test -z "$pic_object" ||
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none &&
+		   test "$non_pic_object" = none; then
+		  func_fatal_error "cannot find name of object for \`$arg'"
+		fi
+
+		# Extract subdirectory from the argument.
+		func_dirname "$arg" "/" ""
+		xdir="$func_dirname_result"
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      dlfiles="$dlfiles $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    dlprefiles="$dlprefiles $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  func_append libobjs " $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  func_append non_pic_objects " $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if $opt_dry_run; then
+		  # Extract subdirectory from the argument.
+		  func_dirname "$arg" "/" ""
+		  xdir="$func_dirname_result"
+
+		  func_lo2o "$arg"
+		  pic_object=$xdir$objdir/$func_lo2o_result
+		  non_pic_object=$xdir$func_lo2o_result
+		  func_append libobjs " $pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+	        else
+		  func_fatal_error "\`$arg' is not a valid libtool object"
+		fi
+	      fi
+	    done
+	  else
+	    func_fatal_error "link input file \`$arg' does not exist"
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    func_fatal_error "only absolute run-paths are allowed"
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	shrext)
+	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	weak)
+	  weak_libs="$weak_libs $arg"
+	  prev=
+	  continue
+	  ;;
+	xcclinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  func_append compile_command " $wl$qarg"
+	  func_append finalize_command " $wl$qarg"
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  # See comment for -static flag below, for more details.
+	  func_append compile_command " $link_static_flag"
+	  func_append finalize_command " $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -bindir)
+	prev=bindir
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  func_fatal_error "more than one -exported-symbols argument is not allowed"
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework)
+	prev=framework
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  func_append compile_command " $arg"
+	  func_append finalize_command " $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	func_stripname '-L' '' "$arg"
+	dir=$func_stripname_result
+	if test -z "$dir"; then
+	  if test "$#" -gt 0; then
+	    func_fatal_error "require no space between \`-L' and \`$1'"
+	  else
+	    func_fatal_error "need path for \`-L' option"
+	  fi
+	fi
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  test -z "$absdir" && \
+	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  ::) dllsearchpath=$dir;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    deplibs="$deplibs System.ltframework"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-linux*)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot)
+	compiler_flags="$compiler_flags $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	prev=xcompiler
+	continue
+	;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	compiler_flags="$compiler_flags $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	case "$new_inherited_linker_flags " in
+	    *" $arg "*) ;;
+	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+	esac
+	continue
+	;;
+
+      -multi_module)
+	single_module="${wl}-multi_module"
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # and Darwin in order for the loader to find any dlls it needs.
+	  func_warning "\`-no-install' is ignored for $host"
+	  func_warning "assuming \`-no-fast-install' instead"
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	func_stripname '-R' '' "$arg"
+	dir=$func_stripname_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  func_fatal_error "only absolute run-paths are allowed"
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -shared)
+	# The effects of -shared are defined in a previous loop.
+	continue
+	;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -static | -static-libtool-libs)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -weak)
+        prev=weak
+	continue
+	;;
+
+      -Wc,*)
+	func_stripname '-Wc,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  arg="$arg $func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Wl,*)
+	func_stripname '-Wl,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+	  linker_flags="$linker_flags $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # -msg_* for osf cc
+      -msg_*)
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # @file GCC response files
+      # -tp=* Portland pgcc target processor selection
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+        func_append compile_command " $arg"
+        func_append finalize_command " $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      *.$objext)
+	# A standard object.
+	objs="$objs $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if func_lalib_unsafe_p "$arg"; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  func_source "$arg"
+
+	  if test -z "$pic_object" ||
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none &&
+	     test "$non_pic_object" = none; then
+	    func_fatal_error "cannot find name of object for \`$arg'"
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  func_dirname "$arg" "/" ""
+	  xdir="$func_dirname_result"
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		dlfiles="$dlfiles $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    func_append libobjs " $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    func_append non_pic_objects " $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if $opt_dry_run; then
+	    # Extract subdirectory from the argument.
+	    func_dirname "$arg" "/" ""
+	    xdir="$func_dirname_result"
+
+	    func_lo2o "$arg"
+	    pic_object=$xdir$objdir/$func_lo2o_result
+	    non_pic_object=$xdir$func_lo2o_result
+	    func_append libobjs " $pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  else
+	    func_fatal_error "\`$arg' is not a valid libtool object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prevarg' option requires an argument"
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval "arg=\"$export_dynamic_flag_spec\""
+      func_append compile_command " $arg"
+      func_append finalize_command " $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname="$func_basename_result"
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval "sys_lib_search_path=\"$sys_lib_search_path_spec\""
+    eval "sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\""
+
+    func_dirname "$output" "/" ""
+    output_objdir="$func_dirname_result$objdir"
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_duplicate_deps ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  esac
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+	passes="conv dlpreopen link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test "$linkmode,$pass" = "lib,link"; then
+	## FIXME: Find the place where the list is rebuilt in the wrong
+	##        order, and fix it there properly
+        tmp_deplibs=
+	for deplib in $deplibs; do
+	  tmp_deplibs="$deplib $tmp_deplibs"
+	done
+	deplibs="$tmp_deplibs"
+      fi
+
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+	# Collect and forward deplibs of preopened libtool libs
+	for lib in $dlprefiles; do
+	  # Ignore non-libtool-libs
+	  dependency_libs=
+	  case $lib in
+	  *.la)	func_source "$lib" ;;
+	  esac
+
+	  # Collect preopened libtool deplibs, except any this library
+	  # has declared as weak libs
+	  for deplib in $dependency_libs; do
+	    func_basename "$deplib"
+            deplib_base=$func_basename_result
+	    case " $weak_libs " in
+	    *" $deplib_base "*) ;;
+	    *) deplibs="$deplibs $deplib" ;;
+	    esac
+	  done
+	done
+	libs="$dlprefiles"
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    compiler_flags="$compiler_flags $deplib"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    func_warning "\`-l' is ignored for archives/objects"
+	    continue
+	  fi
+	  func_stripname '-l' '' "$deplib"
+	  name=$func_stripname_result
+	  if test "$linkmode" = lib; then
+	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+	  else
+	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+	  fi
+	  for searchdir in $searchdirs; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if func_lalib_p "$lib"; then
+		  library_names=
+		  old_library=
+		  func_source "$lib"
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    func_dirname "$lib" "" "."
+		    ladir="$func_dirname_result"
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+		;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	*.ltframework)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    func_stripname '-L' '' "$deplib"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    func_stripname '-L' '' "$deplib"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    ;;
+	  *)
+	    func_warning "\`-L' is ignored for archives/objects"
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    func_stripname '-R' '' "$deplib"
+	    dir=$func_stripname_result
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    # Linking convenience modules into shared libraries is allowed,
+	    # but linking other static libraries is non-portable.
+	    case " $dlpreconveniencelibs " in
+	    *" $deplib "*) ;;
+	    *)
+	      valid_a_lib=no
+	      case $deplibs_check_method in
+		match_pattern*)
+		  set dummy $deplibs_check_method; shift
+		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		    valid_a_lib=yes
+		  fi
+		;;
+		pass_all)
+		  valid_a_lib=yes
+		;;
+	      esac
+	      if test "$valid_a_lib" != yes; then
+		echo
+		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because the file extensions .$libext of this argument makes me believe"
+		echo "*** that it is just a static archive that I should not use here."
+	      else
+		echo
+		$ECHO "*** Warning: Linking the shared library $output against the"
+		$ECHO "*** static library $deplib is not portable!"
+		deplibs="$deplib $deplibs"
+	      fi
+	      ;;
+	    esac
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+	fi
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$lib" \
+	  || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+	func_dirname "$lib" "" "."
+	ladir="$func_dirname_result"
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	inherited_linker_flags=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	func_source "$lib"
+
+	# Convert "-framework foo" to "foo.ltframework"
+	if test -n "$inherited_linker_flags"; then
+	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+	    case " $new_inherited_linker_flags " in
+	      *" $tmp_inherited_linker_flag "*) ;;
+	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+	    esac
+	  done
+	fi
+	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      func_fatal_error "cannot find name of link library for \`$lib'"
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    func_fatal_error "\`$lib' is not a convenience library"
+	  fi
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    deplibs="$deplib $deplibs"
+	    if $opt_duplicate_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  func_fatal_error "cannot find name of link library for \`$lib'"
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    func_warning "cannot determine absolute directory name of \`$ladir'"
+	    func_warning "passing it literally to the linker, although it might fail"
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	func_basename "$lib"
+	laname="$func_basename_result"
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    func_warning "library \`$lib' was moved."
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  fi
+	fi # $installed = yes
+	func_stripname 'lib' '.la' "$laname"
+	name=$func_stripname_result
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir" && test "$linkmode" = prog; then
+	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	    # Keep a list of preopened convenience libraries to check
+	    # that they are being used correctly in the link pass.
+	    test -z "$libdir" && \
+		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) func_stripname '-L' '' "$deplib"
+	         newlib_search_path="$newlib_search_path $func_stripname_result"
+		 ;;
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if $opt_duplicate_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { { test "$prefer_static_libs" = no ||
+	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath:" in
+	      *"$absdir:"*) ;;
+	      *) temp_rpath="$temp_rpath$absdir:" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc*)
+	      # No point in relinking DLLs because paths are not encoded
+	      notinst_deplibs="$notinst_deplibs $lib"
+	      need_relink=no
+	    ;;
+	  *)
+	    if test "$installed" = no; then
+	      notinst_deplibs="$notinst_deplibs $lib"
+	      need_relink=yes
+	    fi
+	    ;;
+	  esac
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on some
+	  # systems (darwin).  Don't bleat about dlopened modules though!
+	  dlopenmodule=""
+	  for dlpremoduletest in $dlprefiles; do
+	    if test "X$dlpremoduletest" = "X$lib"; then
+	      dlopenmodule="$dlpremoduletest"
+	      break
+	    fi
+	  done
+	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+	    echo
+	    if test "$linkmode" = prog; then
+	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $ECHO "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    shift
+	    realname="$1"
+	    shift
+	    eval "libname=\"$libname_spec\""
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw* | *cegcc*)
+	        func_arith $current - $age
+		major=$func_arith_result
+		versuffix="-$major"
+		;;
+	      esac
+	      eval "soname=\"$soname_spec\""
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    func_basename "$soroot"
+	    soname="$func_basename_result"
+	    func_stripname 'lib' '.dll' "$soname"
+	    newlib=libimp-$func_stripname_result.a
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      func_verbose "extracting exported symbol list from \`$soname'"
+	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      func_verbose "generating import library for \`$soname'"
+	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a (non-dlopened) module then we can not
+		    # link against it, someone is ignoring the earlier warnings
+		    if /usr/bin/file -L $add 2> /dev/null |
+			 $GREP ": [^:]* bundle" >/dev/null ; then
+		      if test "X$dlopenmodule" != "X$lib"; then
+			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
+			if test -z "$old_library" ; then
+			  echo
+			  echo "*** And there doesn't seem to be a static archive available"
+			  echo "*** The link will probably fail, sorry"
+			else
+			  add="$dir/$old_library"
+			fi
+		      elif test -n "$old_library"; then
+			add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes &&
+	         test "$hardcode_direct_absolute" = no; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$absdir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      func_fatal_configuration "unsupported hardcode properties"
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes &&
+		 test "$hardcode_minus_L" != yes &&
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes &&
+	       test "$hardcode_direct_absolute" = no; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+		add="$inst_prefix_dir$libdir/$linklib"
+	      else
+		add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    echo
+	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) func_stripname '-R' '' "$libdir"
+	           temp_xrpath=$func_stripname_result
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if $opt_duplicate_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      path=
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+	        func_dirname "$deplib" "" "."
+		dir="$func_dirname_result"
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    func_warning "cannot determine absolute directory name of \`$dir'"
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if $GREP "^installed=no" $deplib > /dev/null; then
+		case $host in
+		*-*-darwin*)
+		  depdepl=
+		  deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$absdir/$objdir/$depdepl" ; then
+		      depdepl="$absdir/$objdir/$depdepl"
+		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                      if test -z "$darwin_install_name"; then
+                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                      fi
+		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+		      path=
+		    fi
+		  fi
+		  ;;
+		*)
+		  path="-L$absdir/$objdir"
+		  ;;
+		esac
+		else
+		  libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  test -z "$libdir" && \
+		    func_fatal_error "\`$deplib' is not a valid libtool archive"
+		  test "$absdir" != "$libdir" && \
+		    func_warning "\`$deplib' seems to be moved"
+
+		  path="-L$absdir"
+		fi
+		;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      if test "$pass" = link; then
+	if test "$linkmode" = "prog"; then
+	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+	else
+	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	fi
+      fi
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\$$var
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\$tmp_libs
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  tmp_libs="$tmp_libs $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+    fi
+    if test "$linkmode" = prog || test "$linkmode" = lib; then
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for archives"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for archives" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+	func_warning "\`-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	func_stripname 'lib' '.la' "$outputname"
+	name=$func_stripname_result
+	eval "shared_ext=\"$shrext_cmds\""
+	eval "libname=\"$libname_spec\""
+	;;
+      *)
+	test "$module" = no && \
+	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  func_stripname '' '.la' "$outputname"
+	  name=$func_stripname_result
+	  eval "shared_ext=\"$shrext_cmds\""
+	  eval "libname=\"$libname_spec\""
+	else
+	  func_stripname '' '.la' "$outputname"
+	  libname=$func_stripname_result
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+	else
+	  echo
+	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+	  $ECHO "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      test "$dlself" != no && \
+	func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test "$#" -gt 1 && \
+	func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+      install_libdir="$1"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	test -n "$vinfo" && \
+	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+	test -n "$release" && \
+	  func_warning "\`-release' is ignored for convenience libraries"
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	shift
+	IFS="$save_ifs"
+
+	test -n "$7" && \
+	  func_fatal_help "too many parameters to \`-version-info'"
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$1"
+	  number_minor="$2"
+	  number_revision="$3"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows|none)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|qnx|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_minor"
+	    lt_irix_increment=no
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$1"
+	  revision="$2"
+	  age="$3"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "CURRENT \`$current' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "REVISION \`$revision' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "AGE \`$age' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  func_arith $current + 1
+	  minor_current=$func_arith_result
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	irix | nonstopux)
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    func_arith $current - $age
+	  else
+	    func_arith $current - $age + 1
+	  fi
+	  major=$func_arith_result
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    func_arith $revision - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    func_arith $current - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	qnx)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  func_arith $current - $age
+	  major=$func_arith_result
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  func_fatal_configuration "unknown library version type \`$version_type'"
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    func_warning "undefined symbols not allowed in $host shared libraries"
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" "yes"
+      libobjs="$libobjs $symfileobj"
+      test "X$libobjs" = "X " && libobjs=
+
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$ECHO "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext | *.gcno)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+		 then
+		   continue
+		 fi
+	       fi
+	       removelist="$removelist $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	test -n "$removelist" && \
+	  func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs System.ltframework"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    ;;
+	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $opt_dry_run || $RM conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $opt_dry_run || $RM conftest
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      case $i in
+	      -l*)
+		func_stripname -l '' "$i"
+		name=$func_stripname_result
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    newdeplibs="$newdeplibs $i"
+		    i=""
+		    ;;
+		  esac
+		fi
+		if test -n "$i" ; then
+		  eval "libname=\"$libname_spec\""
+		  eval "deplib_matches=\"$library_names_spec\""
+		  set dummy $deplib_matches; shift
+		  deplib_match=$1
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    echo
+		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		    echo "*** I have the capability to make that library automatically link in when"
+		    echo "*** you link to this library.  But I can only do this if you have a"
+		    echo "*** shared version of the library, which I believe you do not have"
+		    echo "*** because a test_compile did reveal that the linker did not use it for"
+		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+		;;
+	      *)
+		newdeplibs="$newdeplibs $i"
+		;;
+	      esac
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      case $i in
+	      -l*)
+		func_stripname -l '' "$i"
+		name=$func_stripname_result
+		$opt_dry_run || $RM conftest
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      newdeplibs="$newdeplibs $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    eval "libname=\"$libname_spec\""
+		    eval "deplib_matches=\"$library_names_spec\""
+		    set dummy $deplib_matches; shift
+		    deplib_match=$1
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      newdeplibs="$newdeplibs $i"
+		    else
+		      droppeddeps=yes
+		      echo
+		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		      echo "*** I have the capability to make that library automatically link in when"
+		      echo "*** you link to this library.  But I can only do this if you have a"
+		      echo "*** shared version of the library, which you do not appear to have"
+		      echo "*** because a test_compile did reveal that the linker did not use this one"
+		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  echo
+		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
+		  echo "*** make it link in!  You will probably need to install it or some"
+		  echo "*** library that it depends on before this library will be fully"
+		  echo "*** functional.  Installing it before continuing would be even better."
+		fi
+		;;
+	      *)
+		newdeplibs="$newdeplibs $i"
+		;;
+	      esac
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method; shift
+	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		eval "libname=\"$libname_spec\""
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null |
+			 $GREP " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval "$file_magic_cmd \"\$potlib\"" 2>/dev/null |
+			 $SED -e 10q |
+			 $EGREP "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method; shift
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		eval "libname=\"$libname_spec\""
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+		       $EGREP "$match_pattern_regex" > /dev/null; then
+		      newdeplibs="$newdeplibs $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+	    done
+	  fi
+	  case $tmp_deplibs in
+	  *[!\	\ ]*)
+	    echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	    ;;
+	  esac
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library with the System framework
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+	*-*-darwin*)
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval "flag=\"$hardcode_libdir_flag_spec\""
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      eval "dep_rpath=\"$hardcode_libdir_flag_spec_ld\""
+	    else
+	      eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval $runpath_var=\$rpath\$$runpath_var
+	    export $runpath_var
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval $shlibpath_var=\$shlibpath\$$shlibpath_var
+	  export $shlibpath_var
+	fi
+
+	# Get the real and link names of the library.
+	eval "shared_ext=\"$shrext_cmds\""
+	eval "library_names=\"$library_names_spec\""
+	set dummy $library_names
+	shift
+	realname="$1"
+	shift
+
+	if test -n "$soname_spec"; then
+	  eval "soname=\"$soname_spec\""
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	test "X$libobjs" = "X " && libobjs=
+
+	delfiles=
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+	  export_symbols="$output_objdir/$libname.uexp"
+	  delfiles="$delfiles $export_symbols"
+	fi
+
+	orig_export_symbols=
+	case $host_os in
+	cygwin* | mingw* | cegcc*)
+	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+	    # exporting using user supplied symfile
+	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+	      # and it's NOT already a .def file. Must figure out
+	      # which of the given symbols are data symbols and tag
+	      # them as such. So, trigger use of export_symbols_cmds.
+	      # export_symbols gets reassigned inside the "prepare
+	      # the list of exported symbols" if statement, so the
+	      # include_expsyms logic still works.
+	      orig_export_symbols="$export_symbols"
+	      export_symbols=
+	      always_export_symbols=yes
+	    fi
+	  fi
+	  ;;
+	esac
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    func_verbose "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $opt_dry_run || $RM $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      eval "cmd=\"$cmd\""
+	      func_len " $cmd"
+	      len=$func_len_result
+	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      else
+		# The command line is too long to execute in one step.
+		func_verbose "using reloadable object file for export list..."
+		skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  tmp_export_symbols="$export_symbols"
+	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	  $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"
+	fi
+
+	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+	  # The given exports_symbols file has to be filtered, so filter it.
+	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	  # 's' commands which not all seds can handle. GNU sed should be fine
+	  # though. Also, the filter scales superlinearly with the number of
+	  # global variables. join(1) would be nice here, but unfortunately
+	  # isn't a blessed tool.
+	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	  export_symbols=$output_objdir/$libname.def
+	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+	  case " $convenience " in
+	  *" $test_deplib "*) ;;
+	  *)
+	    tmp_deplibs="$tmp_deplibs $test_deplib"
+	    ;;
+	  esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec" &&
+	    test "$compiler_needs_object" = yes &&
+	    test -z "$libobjs"; then
+	    # extract the archives, so we have objects to list.
+	    # TODO: could optimize this to just extract one archive.
+	    whole_archive_flag_spec=
+	  fi
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval "libobjs=\"\$libobjs $whole_archive_flag_spec\""
+	    test "X$libobjs" = "X " && libobjs=
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    libobjs="$libobjs $func_extract_archives_result"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval "flag=\"$thread_safe_flag_spec\""
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $opt_dry_run || (cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U) || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval "test_cmds=\"$module_expsym_cmds\""
+	    cmds=$module_expsym_cmds
+	  else
+	    eval "test_cmds=\"$module_cmds\""
+	    cmds=$module_cmds
+	  fi
+	else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    eval "test_cmds=\"$archive_expsym_cmds\""
+	    cmds=$archive_expsym_cmds
+	  else
+	    eval "test_cmds=\"$archive_cmds\""
+	    cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   func_len " $test_cmds" &&
+	   len=$func_len_result &&
+	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise
+	  # or, if using GNU ld and skipped_export is not :, use a linker
+	  # script.
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  func_basename "$output"
+	  output_la=$func_basename_result
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  last_robj=
+	  k=1
+
+	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+	    output=${output_objdir}/${output_la}.lnkscript
+	    func_verbose "creating GNU ld script: $output"
+	    echo 'INPUT (' > $output
+	    for obj in $save_libobjs
+	    do
+	      $ECHO "$obj" >> $output
+	    done
+	    echo ')' >> $output
+	    delfiles="$delfiles $output"
+	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+	    output=${output_objdir}/${output_la}.lnk
+	    func_verbose "creating linker input file list: $output"
+	    : > $output
+	    set x $save_libobjs
+	    shift
+	    firstobj=
+	    if test "$compiler_needs_object" = yes; then
+	      firstobj="$1 "
+	      shift
+	    fi
+	    for obj
+	    do
+	      $ECHO "$obj" >> $output
+	    done
+	    delfiles="$delfiles $output"
+	    output=$firstobj\"$file_list_spec$output\"
+	  else
+	    if test -n "$save_libobjs"; then
+	      func_verbose "creating reloadable object files..."
+	      output=$output_objdir/$output_la-${k}.$objext
+	      eval "test_cmds=\"$reload_cmds\""
+	      func_len " $test_cmds"
+	      len0=$func_len_result
+	      len=$len0
+
+	      # Loop over the list of objects to be linked.
+	      for obj in $save_libobjs
+	      do
+		func_len " $obj"
+		func_arith $len + $func_len_result
+		len=$func_arith_result
+		if test "X$objlist" = X ||
+		   test "$len" -lt "$max_cmd_len"; then
+		  func_append objlist " $obj"
+		else
+		  # The command $test_cmds is almost too long, add a
+		  # command to the queue.
+		  if test "$k" -eq 1 ; then
+		    # The first file doesn't have a previous command to add.
+		    reload_objs=$objlist
+		    eval "concat_cmds=\"$reload_cmds\""
+		  else
+		    # All subsequent reloadable object files will link in
+		    # the last one created.
+		    reload_objs="$objlist $last_robj"
+		    eval "concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\""
+		  fi
+		  last_robj=$output_objdir/$output_la-${k}.$objext
+		  func_arith $k + 1
+		  k=$func_arith_result
+		  output=$output_objdir/$output_la-${k}.$objext
+		  objlist=" $obj"
+		  func_len " $last_robj"
+		  func_arith $len0 + $func_len_result
+		  len=$func_arith_result
+		fi
+	      done
+	      # Handle the remaining objects by creating one last
+	      # reloadable object file.  All subsequent reloadable object
+	      # files will link in the last one created.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      reload_objs="$objlist $last_robj"
+	      eval "concat_cmds=\"\${concat_cmds}$reload_cmds\""
+	      if test -n "$last_robj"; then
+	        eval "concat_cmds=\"\${concat_cmds}~\$RM $last_robj\""
+	      fi
+	      delfiles="$delfiles $output"
+
+	    else
+	      output=
+	    fi
+
+	    if ${skipped_export-false}; then
+	      func_verbose "generating symbol list for \`$libname.la'"
+	      export_symbols="$output_objdir/$libname.exp"
+	      $opt_dry_run || $RM $export_symbols
+	      libobjs=$output
+	      # Append the command to create the export file.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval "concat_cmds=\"\$concat_cmds$export_symbols_cmds\""
+	      if test -n "$last_robj"; then
+		eval "concat_cmds=\"\$concat_cmds~\$RM $last_robj\""
+	      fi
+	    fi
+
+	    test -n "$save_libobjs" &&
+	      func_verbose "creating a temporary reloadable object file: $output"
+
+	    # Loop through the commands generated above and execute them.
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $concat_cmds; do
+	      IFS="$save_ifs"
+	      $opt_silent || {
+		  func_quote_for_expand "$cmd"
+		  eval "func_echo $func_quote_for_expand_result"
+	      }
+	      $opt_dry_run || eval "$cmd" || {
+		lt_exit=$?
+
+		# Restore the uninstalled library and exit
+		if test "$mode" = relink; then
+		  ( cd "$output_objdir" && \
+		    $RM "${realname}T" && \
+		    $MV "${realname}U" "$realname" )
+		fi
+
+		exit $lt_exit
+	      }
+	    done
+	    IFS="$save_ifs"
+
+	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+
+          if ${skipped_export-false}; then
+	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	      tmp_export_symbols="$export_symbols"
+	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	      $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"
+	    fi
+
+	    if test -n "$orig_export_symbols"; then
+	      # The given exports_symbols file has to be filtered, so filter it.
+	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	      # 's' commands which not all seds can handle. GNU sed should be fine
+	      # though. Also, the filter scales superlinearly with the number of
+	      # global variables. join(1) would be nice here, but unfortunately
+	      # isn't a blessed tool.
+	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	      export_symbols=$output_objdir/$libname.def
+	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	    fi
+	  fi
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval "libobjs=\"\$libobjs $whole_archive_flag_spec\""
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	      cmds=$archive_expsym_cmds
+	    else
+	      cmds=$archive_cmds
+	    fi
+	  fi
+	fi
+
+	if test -n "$delfiles"; then
+	  # Append the command to remove temporary files to $cmds.
+	  eval "cmds=\"\$cmds~\$RM $delfiles\""
+	fi
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  libobjs="$libobjs $func_extract_archives_result"
+	  test "X$libobjs" = "X " && libobjs=
+	fi
+
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval "cmd=\"$cmd\""
+	  $opt_silent || {
+	    func_quote_for_expand "$cmd"
+	    eval "func_echo $func_quote_for_expand_result"
+	  }
+	  $opt_dry_run || eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$mode" = relink; then
+	      ( cd "$output_objdir" && \
+	        $RM "${realname}T" && \
+		$MV "${realname}U" "$realname" )
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $opt_dry_run || (cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname) || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      func_show_eval '${RM}r "$gentop"'
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for objects"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for objects" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for objects"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+	test -n "$objs$old_deplibs" && \
+	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+	libobj=$output
+	func_lo2o "$libobj"
+	obj=$func_lo2o_result
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval "tmp_whole_archive_flags=\"$whole_archive_flag_spec\""
+	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+	else
+	  gentop="$output_objdir/${obj}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $opt_dry_run || echo timestamp > $libobj || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+	func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) func_stripname '' '.exe' "$output"
+	          output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for programs"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for programs"
+
+      test "$preload" = yes \
+        && test "$dlopen_support" = unknown \
+	&& test "$dlopen_self" = unknown \
+	&& test "$dlopen_self_static" = unknown && \
+	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+	# Don't allow lazy linking, it breaks C++ global constructors
+	# But is supposedly fixed on 10.4 or later (yay!).
+	if test "$tagname" = CXX ; then
+	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	    10.[0123])
+	      compile_command="$compile_command ${wl}-bind_at_load"
+	      finalize_command="$finalize_command ${wl}-bind_at_load"
+	    ;;
+	  esac
+	fi
+	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval "flag=\"$hardcode_libdir_flag_spec\""
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  ::) dllsearchpath=$libdir;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval "rpath=\" $hardcode_libdir_flag_spec\""
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval "flag=\"$hardcode_libdir_flag_spec\""
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval "rpath=\" $hardcode_libdir_flag_spec\""
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+	func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=yes
+      case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
+      *cygwin* | *mingw* )
+        if test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      *)
+        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      esac
+      if test "$wrappers_required" = no; then
+	# Replace the output file specification.
+	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	exit_status=0
+	func_show_eval "$link_command" 'exit_status=$?'
+
+	# Delete the generated files.
+	if test -f "$output_objdir/${outputname}S.${objext}"; then
+	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$opt_dry_run || $RM $output
+	# Link the executable and exit
+	func_show_eval "$link_command" 'exit $?'
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	func_warning "this platform does not like uninstalled shared libraries"
+	func_warning "\`$output' will be relinked during installation"
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      # Now create the wrapper script.
+      func_verbose "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    func_quote_for_eval "$var_value"
+	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) func_stripname '' '.exe' "$output"
+	         output=$func_stripname_result ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    func_stripname '' '.exe' "$outputname"
+	    outputname=$func_stripname_result ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+	    func_dirname_and_basename "$output" "" "."
+	    output_name=$func_basename_result
+	    output_path=$func_dirname_result
+	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
+	    cwrapper="$output_path/$output_name.exe"
+	    $RM $cwrappersource $cwrapper
+	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_cwrapperexe_src > $cwrappersource
+
+	    # The wrapper executable is built using the $host compiler,
+	    # because it contains $host paths and files. If cross-
+	    # compiling, it, like the target executable, must be
+	    # executed on the $host or under an emulation environment.
+	    $opt_dry_run || {
+	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+	      $STRIP $cwrapper
+	    }
+
+	    # Now, create the wrapper script for func_source use:
+	    func_ltwrapper_scriptname $cwrapper
+	    $RM $func_ltwrapper_scriptname_result
+	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+	    $opt_dry_run || {
+	      # note: this script will not be executed, so do not chmod.
+	      if test "x$build" = "x$host" ; then
+		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+	      else
+		func_emit_wrapper no > $func_ltwrapper_scriptname_result
+	      fi
+	    }
+	  ;;
+	  * )
+	    $RM $output
+	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_wrapper no > $output
+	    chmod +x $output
+	  ;;
+	esac
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save $symfileobj"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	  if test "$preload" = yes && test -f "$symfileobj"; then
+	    oldobjs="$oldobjs $symfileobj"
+	  fi
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	generated="$generated $gentop"
+
+	func_extract_archives $gentop $addlibs
+	oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	cmds=$old_archive_from_new_cmds
+      else
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  oldobjs="$oldobjs $func_extract_archives_result"
+	fi
+
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      func_basename "$obj"
+	      $ECHO "$func_basename_result"
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  echo "copying selected object files to avoid basename conflicts..."
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+	  func_mkdir_p "$gentop"
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    func_basename "$obj"
+	    objbase="$func_basename_result"
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		func_arith $counter + 1
+		counter=$func_arith_result
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      oldobjs="$oldobjs $gentop/$newobj"
+	      ;;
+	    *) oldobjs="$oldobjs $obj" ;;
+	    esac
+	  done
+	fi
+	eval "cmds=\"$old_archive_cmds\""
+
+	func_len " $cmds"
+	len=$func_len_result
+	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  func_verbose "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  eval "test_cmds=\"$old_archive_cmds\""
+	  func_len " $test_cmds"
+	  len0=$func_len_result
+	  len=$len0
+	  for obj in $save_oldobjs
+	  do
+	    func_len " $obj"
+	    func_arith $len + $func_len_result
+	    len=$func_arith_result
+	    func_append objlist " $obj"
+	    if test "$len" -lt "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+		RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval "concat_cmds=\"\${concat_cmds}$old_archive_cmds\""
+	      objlist=
+	      len=$len0
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval "cmds=\"\$concat_cmds\""
+	  else
+	    eval "cmds=\"\$concat_cmds~\$old_archive_cmds\""
+	  fi
+	fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      func_verbose "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  func_quote_for_eval "$var_value"
+	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		func_basename "$deplib"
+		name="$func_basename_result"
+		libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$deplib' is not a valid libtool archive"
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+
+	    for lib in $dlfiles; do
+	      case $lib in
+	      *.la)
+	        func_basename "$lib"
+		name="$func_basename_result"
+		libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		newdlfiles="$newdlfiles $libdir/$name"
+		;;
+	      *) newdlfiles="$newdlfiles $lib" ;;
+	      esac
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+	      *.la)
+		# Only pass preopened files to the pseudo-archive (for
+		# eventual linking with the app. that links it) if we
+		# didn't already link the preopened objects directly into
+		# the library:
+		func_basename "$lib"
+		name="$func_basename_result"
+		libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		newdlprefiles="$newdlprefiles $libdir/$name"
+		;;
+	      esac
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlfiles="$newdlfiles $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlprefiles="$newdlprefiles $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $RM $output
+	  # place dlname in correct position for cygwin
+	  # In fact, it would be nice if we could use this code for all target
+	  # systems that can't hard-code library paths into their executables
+	  # and that have no shared library path variable independent of PATH,
+	  # but it turns out we can't easily determine that from inspecting
+	  # libtool variables, so we have to hard-code the OSs to which it
+	  # applies here; at the moment, that means platforms that use the PE
+	  # object format with DLL files.  See the long comment at the top of
+	  # tests/bindir.at for full details.
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+	      # If a -bindir argument was supplied, place the dll there.
+	      if test "x$bindir" != x ;
+	      then
+		func_relative_path "$install_libdir" "$bindir"
+		tdlname=$func_relative_path_result$dlname
+	      else
+		# Otherwise fall back on heuristic.
+		tdlname=../bin/$dlname
+	      fi
+	      ;;
+	  esac
+	  $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $ECHO >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+{ test "$mode" = link || test "$mode" = relink; } &&
+    func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $opt_debug
+    RM="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) RM="$RM $arg"; rmforce=yes ;;
+      -*) RM="$RM $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir="$func_dirname_result"
+      if test "X$dir" = X.; then
+	objdir="$origobjdir"
+      else
+	objdir="$dir/$origobjdir"
+      fi
+      func_basename "$file"
+      name="$func_basename_result"
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+	 { test -h "$file"; } >/dev/null 2>&1 ||
+	 test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if func_lalib_p "$file"; then
+	  func_source $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+	  case "$mode" in
+	  clean)
+	    case "  $library_names " in
+	    # "  " in the beginning catches empty $dlname
+	    *" $dlname "*) ;;
+	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    esac
+	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if func_lalib_p "$file"; then
+
+	  # Read the .lo file
+	  func_source $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" &&
+	     test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" &&
+	     test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    func_stripname '' '.exe' "$file"
+	    file=$func_stripname_result
+	    func_stripname '' '.exe' "$name"
+	    noexename=$func_stripname_result
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    rmfiles="$rmfiles $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if func_ltwrapper_p "$file"; then
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      relink_command=
+	      func_source $func_ltwrapper_scriptname_result
+	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
+	    else
+	      relink_command=
+	      func_source $dir/$noexename
+	    fi
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      rmfiles="$rmfiles $objdir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
+    func_mode_uninstall ${1+"$@"}
+
+test -z "$mode" && {
+  help="$generic_help"
+  func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode \`$mode'"
+
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
new file mode 100755
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/missing
@@ -0,0 +1,215 @@
+#! /bin/sh
+# Common wrapper for a few potentially missing GNU programs.
+
+scriptversion=2013-10-28.13; # UTC
+
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try '$0 --help' for more information"
+  exit 1
+fi
+
+case $1 in
+
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
+
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: unknown '$1' option"
+    echo 1>&2 "Try '$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
+
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'autom4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
+    ;;
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/mmap.c
@@ -0,0 +1,303 @@
+/* mmap.c -- Memory allocation with mmap.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+/* Memory allocation on systems that provide anonymous mmap.  This
+   permits the backtrace functions to be invoked from a signal
+   handler, assuming that mmap is async-signal safe.  */
+
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+/* A list of free memory blocks.  */
+
+struct backtrace_freelist_struct
+{
+  /* Next on list.  */
+  struct backtrace_freelist_struct *next;
+  /* Size of this block, including this structure.  */
+  size_t size;
+};
+
+/* Free memory allocated by backtrace_alloc.  */
+
+static void
+backtrace_free_locked (struct backtrace_state *state, void *addr, size_t size)
+{
+  /* Just leak small blocks.  We don't have to be perfect.  */
+  if (size >= sizeof (struct backtrace_freelist_struct))
+    {
+      struct backtrace_freelist_struct *p;
+
+      p = (struct backtrace_freelist_struct *) addr;
+      p->next = state->freelist;
+      p->size = size;
+      state->freelist = p;
+    }
+}
+
+/* Allocate memory like malloc.  If ERROR_CALLBACK is NULL, don't
+   report an error.  */
+
+void *
+backtrace_alloc (struct backtrace_state *state,
+		 size_t size, backtrace_error_callback error_callback,
+		 void *data)
+{
+  void *ret;
+  int locked;
+  struct backtrace_freelist_struct **pp;
+  size_t pagesize;
+  size_t asksize;
+  void *page;
+
+  ret = NULL;
+
+  /* If we can acquire the lock, then see if there is space on the
+     free list.  If we can't acquire the lock, drop straight into
+     using mmap.  __sync_lock_test_and_set returns the old state of
+     the lock, so we have acquired it if it returns 0.  */
+
+  if (!state->threaded)
+    locked = 1;
+  else
+    locked = __sync_lock_test_and_set (&state->lock_alloc, 1) == 0;
+
+  if (locked)
+    {
+      for (pp = &state->freelist; *pp != NULL; pp = &(*pp)->next)
+	{
+	  if ((*pp)->size >= size)
+	    {
+	      struct backtrace_freelist_struct *p;
+
+	      p = *pp;
+	      *pp = p->next;
+
+	      /* Round for alignment; we assume that no type we care about
+		 is more than 8 bytes.  */
+	      size = (size + 7) & ~ (size_t) 7;
+	      if (size < p->size)
+		backtrace_free_locked (state, (char *) p + size,
+				       p->size - size);
+
+	      ret = (void *) p;
+
+	      break;
+	    }
+	}
+
+      if (state->threaded)
+	__sync_lock_release (&state->lock_alloc);
+    }
+
+  if (ret == NULL)
+    {
+      /* Allocate a new page.  */
+
+      pagesize = getpagesize ();
+      asksize = (size + pagesize - 1) & ~ (pagesize - 1);
+      page = mmap (NULL, asksize, PROT_READ | PROT_WRITE,
+		   MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+      if (page == MAP_FAILED)
+	{
+	  if (error_callback)
+	    error_callback (data, "mmap", errno);
+	}
+      else
+	{
+	  size = (size + 7) & ~ (size_t) 7;
+	  if (size < asksize)
+	    backtrace_free (state, (char *) page + size, asksize - size,
+			    error_callback, data);
+
+	  ret = page;
+	}
+    }
+
+  return ret;
+}
+
+/* Free memory allocated by backtrace_alloc.  */
+
+void
+backtrace_free (struct backtrace_state *state, void *addr, size_t size,
+		backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
+		void *data ATTRIBUTE_UNUSED)
+{
+  int locked;
+
+  /* If we are freeing a large aligned block, just release it back to
+     the system.  This case arises when growing a vector for a large
+     binary with lots of debug info.  Calling munmap here may cause us
+     to call mmap again if there is also a large shared library; we
+     just live with that.  */
+  if (size >= 16 * 4096)
+    {
+      size_t pagesize;
+
+      pagesize = getpagesize ();
+      if (((uintptr_t) addr & (pagesize - 1)) == 0
+	  && (size & (pagesize - 1)) == 0)
+	{
+	  /* If munmap fails for some reason, just add the block to
+	     the freelist.  */
+	  if (munmap (addr, size) == 0)
+	    return;
+	}
+    }
+
+  /* If we can acquire the lock, add the new space to the free list.
+     If we can't acquire the lock, just leak the memory.
+     __sync_lock_test_and_set returns the old state of the lock, so we
+     have acquired it if it returns 0.  */
+
+  if (!state->threaded)
+    locked = 1;
+  else
+    locked = __sync_lock_test_and_set (&state->lock_alloc, 1) == 0;
+
+  if (locked)
+    {
+      backtrace_free_locked (state, addr, size);
+
+      if (state->threaded)
+	__sync_lock_release (&state->lock_alloc);
+    }
+}
+
+/* Grow VEC by SIZE bytes.  */
+
+void *
+backtrace_vector_grow (struct backtrace_state *state,size_t size,
+		       backtrace_error_callback error_callback,
+		       void *data, struct backtrace_vector *vec)
+{
+  void *ret;
+
+  if (size > vec->alc)
+    {
+      size_t pagesize;
+      size_t alc;
+      void *base;
+
+      pagesize = getpagesize ();
+      alc = vec->size + size;
+      if (vec->size == 0)
+	alc = 16 * size;
+      else if (alc < pagesize)
+	{
+	  alc *= 2;
+	  if (alc > pagesize)
+	    alc = pagesize;
+	}
+      else
+	{
+	  alc *= 2;
+	  alc = (alc + pagesize - 1) & ~ (pagesize - 1);
+	}
+      base = backtrace_alloc (state, alc, error_callback, data);
+      if (base == NULL)
+	return NULL;
+      if (vec->base != NULL)
+	{
+	  memcpy (base, vec->base, vec->size);
+	  backtrace_free (state, vec->base, vec->size + vec->alc,
+			  error_callback, data);
+	}
+      vec->base = base;
+      vec->alc = alc - vec->size;
+    }
+
+  ret = (char *) vec->base + vec->size;
+  vec->size += size;
+  vec->alc -= size;
+  return ret;
+}
+
+/* Finish the current allocation on VEC.  */
+
+void *
+backtrace_vector_finish (
+  struct backtrace_state *state ATTRIBUTE_UNUSED,
+  struct backtrace_vector *vec,
+  backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
+  void *data ATTRIBUTE_UNUSED)
+{
+  void *ret;
+
+  ret = vec->base;
+  vec->base = (char *) vec->base + vec->size;
+  vec->size = 0;
+  return ret;
+}
+
+/* Release any extra space allocated for VEC.  */
+
+int
+backtrace_vector_release (struct backtrace_state *state,
+			  struct backtrace_vector *vec,
+			  backtrace_error_callback error_callback,
+			  void *data)
+{
+  size_t size;
+  size_t alc;
+  size_t aligned;
+
+  /* Make sure that the block that we free is aligned on an 8-byte
+     boundary.  */
+  size = vec->size;
+  alc = vec->alc;
+  aligned = (size + 7) & ~ (size_t) 7;
+  alc -= aligned - size;
+
+  backtrace_free (state, (char *) vec->base + aligned, alc,
+		  error_callback, data);
+  vec->alc = 0;
+  return 1;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/mmapio.c
@@ -0,0 +1,100 @@
+/* mmapio.c -- File views using mmap.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+/* This file implements file views and memory allocation when mmap is
+   available.  */
+
+/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET.  */
+
+int
+backtrace_get_view (struct backtrace_state *state ATTRIBUTE_UNUSED,
+		    int descriptor, off_t offset, size_t size,
+		    backtrace_error_callback error_callback,
+		    void *data, struct backtrace_view *view)
+{
+  size_t pagesize;
+  unsigned int inpage;
+  off_t pageoff;
+  void *map;
+
+  pagesize = getpagesize ();
+  inpage = offset % pagesize;
+  pageoff = offset - inpage;
+
+  size += inpage;
+  size = (size + (pagesize - 1)) & ~ (pagesize - 1);
+
+  map = mmap (NULL, size, PROT_READ, MAP_PRIVATE, descriptor, pageoff);
+  if (map == MAP_FAILED)
+    {
+      error_callback (data, "mmap", errno);
+      return 0;
+    }
+
+  view->data = (char *) map + inpage;
+  view->base = map;
+  view->len = size;
+
+  return 1;
+}
+
+/* Release a view read by backtrace_get_view.  */
+
+void
+backtrace_release_view (struct backtrace_state *state ATTRIBUTE_UNUSED,
+			struct backtrace_view *view,
+			backtrace_error_callback error_callback,
+			void *data)
+{
+  union {
+    const void *cv;
+    void *v;
+  } const_cast;
+
+  const_cast.cv = view->base;
+  if (munmap (const_cast.v, view->len) < 0)
+    error_callback (data, "munmap", errno);
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/nounwind.c
@@ -0,0 +1,66 @@
+/* backtrace.c -- Entry point for stack backtrace library.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <sys/types.h>
+
+#include "backtrace.h"
+
+#include "internal.h"
+
+/* This source file is compiled if the unwind library is not
+   available.  */
+
+int
+backtrace_full (struct backtrace_state *state ATTRIBUTE_UNUSED,
+		int skip ATTRIBUTE_UNUSED,
+		backtrace_full_callback callback ATTRIBUTE_UNUSED,
+		backtrace_error_callback error_callback, void *data)
+{
+  error_callback (data,
+		  "no stack trace because unwind library not available",
+		  0);
+  return 0;
+}
+
+int
+backtrace_simple (struct backtrace_state *state ATTRIBUTE_UNUSED,
+		  int skip ATTRIBUTE_UNUSED,
+		  backtrace_simple_callback callback ATTRIBUTE_UNUSED,
+		  backtrace_error_callback error_callback, void *data)
+{
+  error_callback (data,
+		  "no stack trace because unwind library not available",
+		  0);
+  return 0;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/pecoff.c
@@ -0,0 +1,937 @@
+/* pecoff.c -- Get debug data from a PE/COFFF file for backtraces.
+   Copyright (C) 2015-2016 Free Software Foundation, Inc.
+   Adapted from elf.c by Tristan Gingold, AdaCore.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+/* Coff file header.  */
+
+typedef struct {
+  uint16_t machine;
+  uint16_t number_of_sections;
+  uint32_t time_date_stamp;
+  uint32_t pointer_to_symbol_table;
+  uint32_t number_of_symbols;
+  uint16_t size_of_optional_header;
+  uint16_t characteristics;
+} b_coff_file_header;
+
+/* Coff optional header.  */
+
+typedef struct {
+  uint16_t magic;
+  uint8_t  major_linker_version;
+  uint8_t  minor_linker_version;
+  uint32_t size_of_code;
+  uint32_t size_of_initialized_data;
+  uint32_t size_of_uninitialized_data;
+  uint32_t address_of_entry_point;
+  uint32_t base_of_code;
+  union {
+    struct {
+      uint32_t base_of_data;
+      uint32_t image_base;
+    } pe;
+    struct {
+      uint64_t image_base;
+    } pep;
+  } u;
+} b_coff_optional_header;
+
+/* Values of magic in optional header.  */
+
+#define PE_MAGIC 0x10b		/* PE32 executable.  */
+#define PEP_MAGIC 0x20b		/* PE32+ executable (for 64bit targets).  */
+
+/* Coff section header.  */
+
+typedef struct {
+  char name[8];
+  uint32_t virtual_size;
+  uint32_t virtual_address;
+  uint32_t size_of_raw_data;
+  uint32_t pointer_to_raw_data;
+  uint32_t pointer_to_relocations;
+  uint32_t pointer_to_line_numbers;
+  uint16_t number_of_relocations;
+  uint16_t number_of_line_numbers;
+  uint32_t characteristics;
+} b_coff_section_header;
+
+/* Coff symbol name.  */
+
+typedef union {
+  char short_name[8];
+  struct {
+    unsigned char zeroes[4];
+    unsigned char off[4];
+  } long_name;
+} b_coff_name;
+
+/* Coff symbol (external representation which is unaligned).  */
+
+typedef struct {
+  b_coff_name name;
+  unsigned char value[4];
+  unsigned char section_number[2];
+  unsigned char type[2];
+  unsigned char storage_class;
+  unsigned char number_of_aux_symbols;
+} b_coff_external_symbol;
+
+/* Symbol types.  */
+
+#define N_TBSHFT 4			/* Shift for the derived type.  */
+#define IMAGE_SYM_DTYPE_FUNCTION 2	/* Function derived type.  */
+
+/* Size of a coff symbol.  */
+
+#define SYM_SZ 18
+
+/* Coff symbol, internal representation (aligned).  */
+
+typedef struct {
+  const char *name;
+  uint32_t value;
+  int16_t sec;
+  uint16_t type;
+  uint16_t sc;
+} b_coff_internal_symbol;
+
+/* An index of sections we care about.  */
+
+enum debug_section
+{
+  DEBUG_INFO,
+  DEBUG_LINE,
+  DEBUG_ABBREV,
+  DEBUG_RANGES,
+  DEBUG_STR,
+  DEBUG_MAX
+};
+
+/* Names of sections, indexed by enum debug_section.  */
+
+static const char * const debug_section_names[DEBUG_MAX] =
+{
+  ".debug_info",
+  ".debug_line",
+  ".debug_abbrev",
+  ".debug_ranges",
+  ".debug_str"
+};
+
+/* Information we gather for the sections we care about.  */
+
+struct debug_section_info
+{
+  /* Section file offset.  */
+  off_t offset;
+  /* Section size.  */
+  size_t size;
+  /* Section contents, after read from file.  */
+  const unsigned char *data;
+};
+
+/* Information we keep for an coff symbol.  */
+
+struct coff_symbol
+{
+  /* The name of the symbol.  */
+  const char *name;
+  /* The address of the symbol.  */
+  uintptr_t address;
+};
+
+/* Information to pass to coff_syminfo.  */
+
+struct coff_syminfo_data
+{
+  /* Symbols for the next module.  */
+  struct coff_syminfo_data *next;
+  /* The COFF symbols, sorted by address.  */
+  struct coff_symbol *symbols;
+  /* The number of symbols.  */
+  size_t count;
+};
+
+/* A dummy callback function used when we can't find any debug info.  */
+
+static int
+coff_nodebug (struct backtrace_state *state ATTRIBUTE_UNUSED,
+	      uintptr_t pc ATTRIBUTE_UNUSED,
+	      backtrace_full_callback callback ATTRIBUTE_UNUSED,
+	      backtrace_error_callback error_callback, void *data)
+{
+  error_callback (data, "no debug info in PE/COFF executable", -1);
+  return 0;
+}
+
+/* A dummy callback function used when we can't find a symbol
+   table.  */
+
+static void
+coff_nosyms (struct backtrace_state *state ATTRIBUTE_UNUSED,
+	     uintptr_t addr ATTRIBUTE_UNUSED,
+	     backtrace_syminfo_callback callback ATTRIBUTE_UNUSED,
+	     backtrace_error_callback error_callback, void *data)
+{
+  error_callback (data, "no symbol table in PE/COFF executable", -1);
+}
+
+/* Read a potentially unaligned 4 byte word at P, using native endianness.  */
+
+static uint32_t
+coff_read4 (const unsigned char *p)
+{
+  uint32_t res;
+
+  memcpy (&res, p, 4);
+  return res;
+}
+
+/* Read a potentially unaligned 2 byte word at P, using native endianness.
+   All 2 byte word in symbols are always aligned, but for coherency all
+   fields are declared as char arrays.  */
+
+static uint16_t
+coff_read2 (const unsigned char *p)
+{
+  uint16_t res;
+
+  memcpy (&res, p, sizeof (res));
+  return res;
+}
+
+/* Return the length (without the trailing 0) of a COFF short name.  */
+
+static size_t
+coff_short_name_len (const char *name)
+{
+  int i;
+
+  for (i = 0; i < 8; i++)
+    if (name[i] == 0)
+      return i;
+  return 8;
+}
+
+/* Return true iff COFF short name CNAME is the same as NAME (a NUL-terminated
+   string).  */
+
+static int
+coff_short_name_eq (const char *name, const char *cname)
+{
+  int i;
+
+  for (i = 0; i < 8; i++)
+    {
+      if (name[i] != cname[i])
+	return 0;
+      if (name[i] == 0)
+	return 1;
+    }
+  return name[8] == 0;
+}
+
+/* Return true iff NAME is the same as string at offset OFF.  */
+
+static int
+coff_long_name_eq (const char *name, unsigned int off,
+		   struct backtrace_view *str_view)
+{
+  if (off >= str_view->len)
+    return 0;
+  return strcmp (name, (const char *)str_view->data + off) == 0;
+}
+
+/* Compare struct coff_symbol for qsort.  */
+
+static int
+coff_symbol_compare (const void *v1, const void *v2)
+{
+  const struct coff_symbol *e1 = (const struct coff_symbol *) v1;
+  const struct coff_symbol *e2 = (const struct coff_symbol *) v2;
+
+  if (e1->address < e2->address)
+    return -1;
+  else if (e1->address > e2->address)
+    return 1;
+  else
+    return 0;
+}
+
+/* Convert SYM to internal (and aligned) format ISYM, using string table
+   from STRTAB and STRTAB_SIZE, and number of sections SECTS_NUM.
+   Return -1 in case of error (invalid section number or string index).  */
+
+static int
+coff_expand_symbol (b_coff_internal_symbol *isym,
+		    const b_coff_external_symbol *sym,
+		    uint16_t sects_num,
+		    const unsigned char *strtab, size_t strtab_size)
+{
+  isym->type = coff_read2 (sym->type);
+  isym->sec = coff_read2 (sym->section_number);
+  isym->sc = sym->storage_class;
+
+  if (isym->sec > 0 && (uint16_t) isym->sec > sects_num)
+    return -1;
+  if (sym->name.short_name[0] != 0)
+    isym->name = sym->name.short_name;
+  else
+    {
+      uint32_t off = coff_read4 (sym->name.long_name.off);
+
+      if (off >= strtab_size)
+	return -1;
+      isym->name = (const char *) strtab + off;
+    }
+  return 0;
+}
+
+/* Return true iff SYM is a defined symbol for a function.  Data symbols
+   aren't considered because they aren't easily identified (same type as
+   section names, presence of symbols defined by the linker script).  */
+
+static int
+coff_is_function_symbol (const b_coff_internal_symbol *isym)
+{
+  return (isym->type >> N_TBSHFT) == IMAGE_SYM_DTYPE_FUNCTION
+    && isym->sec > 0;
+}
+
+/* Initialize the symbol table info for coff_syminfo.  */
+
+static int
+coff_initialize_syminfo (struct backtrace_state *state,
+			 uintptr_t base_address,
+			 const b_coff_section_header *sects, size_t sects_num,
+			 const b_coff_external_symbol *syms, size_t syms_size,
+			 const unsigned char *strtab, size_t strtab_size,
+			 backtrace_error_callback error_callback,
+			 void *data, struct coff_syminfo_data *sdata)
+{
+  size_t syms_count;
+  char *coff_symstr;
+  size_t coff_symstr_len;
+  size_t coff_symbol_count;
+  size_t coff_symbol_size;
+  struct coff_symbol *coff_symbols;
+  struct coff_symbol *coff_sym;
+  char *coff_str;
+  size_t i;
+
+  syms_count = syms_size / SYM_SZ;
+
+  /* We only care about function symbols.  Count them.  Also count size of
+     strings for in-symbol names.  */
+  coff_symbol_count = 0;
+  coff_symstr_len = 0;
+  for (i = 0; i < syms_count; ++i)
+    {
+      const b_coff_external_symbol *asym = &syms[i];
+      b_coff_internal_symbol isym;
+
+      if (coff_expand_symbol (&isym, asym, sects_num, strtab, strtab_size) < 0)
+	{
+	  error_callback (data, "invalid section or offset in coff symbol", 0);
+	  return 0;
+	}
+      if (coff_is_function_symbol (&isym))
+	{
+	  ++coff_symbol_count;
+	  if (asym->name.short_name[0] != 0)
+	    coff_symstr_len += coff_short_name_len (asym->name.short_name) + 1;
+	}
+
+      i += asym->number_of_aux_symbols;
+    }
+
+  coff_symbol_size = (coff_symbol_count + 1) * sizeof (struct coff_symbol);
+  coff_symbols = ((struct coff_symbol *)
+		  backtrace_alloc (state, coff_symbol_size, error_callback,
+				   data));
+  if (coff_symbols == NULL)
+    return 0;
+
+  /* Allocate memory for symbols strings.  */
+  if (coff_symstr_len > 0)
+    {
+      coff_symstr = ((char *)
+		     backtrace_alloc (state, coff_symstr_len, error_callback,
+				      data));
+      if (coff_symstr == NULL)
+	{
+	  backtrace_free (state, coff_symbols, coff_symbol_size,
+			  error_callback, data);
+	  return 0;
+	}
+    }
+  else
+    coff_symstr = NULL;
+
+  /* Copy symbols.  */
+  coff_sym = coff_symbols;
+  coff_str = coff_symstr;
+  for (i = 0; i < syms_count; ++i)
+    {
+      const b_coff_external_symbol *asym = &syms[i];
+      b_coff_internal_symbol isym;
+
+      if (coff_expand_symbol (&isym, asym, sects_num, strtab, strtab_size))
+	{
+	  /* Should not fail, as it was already tested in the previous
+	     loop.  */
+	  abort ();
+	}
+      if (coff_is_function_symbol (&isym))
+	{
+	  const char *name;
+	  int16_t secnum;
+
+	  if (asym->name.short_name[0] != 0)
+	    {
+	      size_t len = coff_short_name_len (isym.name);
+	      name = coff_str;
+	      memcpy (coff_str, isym.name, len);
+	      coff_str[len] = 0;
+	      coff_str += len + 1;
+	    }
+	  else
+	    name = isym.name;
+
+	  /* Strip leading '_'.  */
+	  if (name[0] == '_')
+	    name++;
+
+	  /* Symbol value is section relative, so we need to read the address
+	     of its section.  */
+	  secnum = coff_read2 (asym->section_number);
+
+	  coff_sym->name = name;
+	  coff_sym->address = (coff_read4 (asym->value)
+			       + sects[secnum - 1].virtual_address
+			       + base_address);
+	  coff_sym++;
+	}
+
+      i += asym->number_of_aux_symbols;
+    }
+
+  /* End of symbols marker.  */
+  coff_sym->name = NULL;
+  coff_sym->address = -1;
+
+  backtrace_qsort (coff_symbols, coff_symbol_count,
+		   sizeof (struct coff_symbol), coff_symbol_compare);
+
+  sdata->next = NULL;
+  sdata->symbols = coff_symbols;
+  sdata->count = coff_symbol_count;
+
+  return 1;
+}
+
+/* Add EDATA to the list in STATE.  */
+
+static void
+coff_add_syminfo_data (struct backtrace_state *state,
+		       struct coff_syminfo_data *sdata)
+{
+  if (!state->threaded)
+    {
+      struct coff_syminfo_data **pp;
+
+      for (pp = (struct coff_syminfo_data **) (void *) &state->syminfo_data;
+	   *pp != NULL;
+	   pp = &(*pp)->next)
+	;
+      *pp = sdata;
+    }
+  else
+    {
+      while (1)
+	{
+	  struct coff_syminfo_data **pp;
+
+	  pp = (struct coff_syminfo_data **) (void *) &state->syminfo_data;
+
+	  while (1)
+	    {
+	      struct coff_syminfo_data *p;
+
+	      p = backtrace_atomic_load_pointer (pp);
+
+	      if (p == NULL)
+		break;
+
+	      pp = &p->next;
+	    }
+
+	  if (__sync_bool_compare_and_swap (pp, NULL, sdata))
+	    break;
+	}
+    }
+}
+
+/* Compare an ADDR against an elf_symbol for bsearch.  We allocate one
+   extra entry in the array so that this can look safely at the next
+   entry.  */
+
+static int
+coff_symbol_search (const void *vkey, const void *ventry)
+{
+  const uintptr_t *key = (const uintptr_t *) vkey;
+  const struct coff_symbol *entry = (const struct coff_symbol *) ventry;
+  uintptr_t addr;
+
+  addr = *key;
+  if (addr < entry->address)
+    return -1;
+  else if (addr >= entry[1].address)
+    return 1;
+  else
+    return 0;
+}
+
+/* Return the symbol name and value for an ADDR.  */
+
+static void
+coff_syminfo (struct backtrace_state *state, uintptr_t addr,
+	      backtrace_syminfo_callback callback,
+	      backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
+	      void *data)
+{
+  struct coff_syminfo_data *sdata;
+  struct coff_symbol *sym = NULL;
+
+  if (!state->threaded)
+    {
+      for (sdata = (struct coff_syminfo_data *) state->syminfo_data;
+	   sdata != NULL;
+	   sdata = sdata->next)
+	{
+	  sym = ((struct coff_symbol *)
+		 bsearch (&addr, sdata->symbols, sdata->count,
+			  sizeof (struct coff_symbol), coff_symbol_search));
+	  if (sym != NULL)
+	    break;
+	}
+    }
+  else
+    {
+      struct coff_syminfo_data **pp;
+
+      pp = (struct coff_syminfo_data **) (void *) &state->syminfo_data;
+      while (1)
+	{
+	  sdata = backtrace_atomic_load_pointer (pp);
+	  if (sdata == NULL)
+	    break;
+
+	  sym = ((struct coff_symbol *)
+		 bsearch (&addr, sdata->symbols, sdata->count,
+			  sizeof (struct coff_symbol), coff_symbol_search));
+	  if (sym != NULL)
+	    break;
+
+	  pp = &sdata->next;
+	}
+    }
+
+  if (sym == NULL)
+    callback (data, addr, NULL, 0, 0);
+  else
+    callback (data, addr, sym->name, sym->address, 0);
+}
+
+/* Add the backtrace data for one PE/COFF file.  Returns 1 on success,
+   0 on failure (in both cases descriptor is closed).  */
+
+static int
+coff_add (struct backtrace_state *state, int descriptor,
+	  backtrace_error_callback error_callback, void *data,
+	  fileline *fileline_fn, int *found_sym, int *found_dwarf)
+{
+  struct backtrace_view fhdr_view;
+  off_t fhdr_off;
+  int magic_ok;
+  b_coff_file_header fhdr;
+  off_t opt_sects_off;
+  size_t opt_sects_size;
+  unsigned int sects_num;
+  struct backtrace_view sects_view;
+  int sects_view_valid;
+  const b_coff_optional_header *opt_hdr;
+  const b_coff_section_header *sects;
+  struct backtrace_view str_view;
+  int str_view_valid;
+  size_t str_size;
+  off_t str_off;
+  struct backtrace_view syms_view;
+  off_t syms_off;
+  size_t syms_size;
+  int syms_view_valid;
+  unsigned int syms_num;
+  unsigned int i;
+  struct debug_section_info sections[DEBUG_MAX];
+  off_t min_offset;
+  off_t max_offset;
+  struct backtrace_view debug_view;
+  int debug_view_valid;
+  uintptr_t image_base;
+
+  *found_sym = 0;
+  *found_dwarf = 0;
+
+  sects_view_valid = 0;
+  syms_view_valid = 0;
+  str_view_valid = 0;
+  debug_view_valid = 0;
+
+  /* Map the MS-DOS stub (if any) and extract file header offset.  */
+  if (!backtrace_get_view (state, descriptor, 0, 0x40, error_callback,
+			   data, &fhdr_view))
+    goto fail;
+
+  {
+    const char *vptr = (const char *)fhdr_view.data;
+
+    if (vptr[0] == 'M' && vptr[1] == 'Z')
+      memcpy (&fhdr_off, vptr + 0x3c, 4);
+    else
+      fhdr_off = 0;
+  }
+
+  backtrace_release_view (state, &fhdr_view, error_callback, data);
+
+  /* Map the coff file header.  */
+  if (!backtrace_get_view (state, descriptor, fhdr_off,
+			   sizeof (b_coff_file_header) + 4,
+			   error_callback, data, &fhdr_view))
+    goto fail;
+
+  if (fhdr_off != 0)
+    {
+      const char *magic = (const char *) fhdr_view.data;
+      magic_ok = memcmp (magic, "PE\0", 4) == 0;
+      fhdr_off += 4;
+
+      memcpy (&fhdr, fhdr_view.data + 4, sizeof fhdr);
+    }
+  else
+    {
+      memcpy (&fhdr, fhdr_view.data, sizeof fhdr);
+      /* TODO: test fhdr.machine for coff but non-PE platforms.  */
+      magic_ok = 0;
+    }
+  backtrace_release_view (state, &fhdr_view, error_callback, data);
+
+  if (!magic_ok)
+    {
+      error_callback (data, "executable file is not COFF", 0);
+      goto fail;
+    }
+
+  sects_num = fhdr.number_of_sections;
+  syms_num = fhdr.number_of_symbols;
+
+  opt_sects_off = fhdr_off + sizeof (fhdr);
+  opt_sects_size = (fhdr.size_of_optional_header
+		    + sects_num * sizeof (b_coff_section_header));
+
+  /* To translate PC to file/line when using DWARF, we need to find
+     the .debug_info and .debug_line sections.  */
+
+  /* Read the optional header and the section headers.  */
+
+  if (!backtrace_get_view (state, descriptor, opt_sects_off, opt_sects_size,
+			   error_callback, data, &sects_view))
+    goto fail;
+  sects_view_valid = 1;
+  opt_hdr = (const b_coff_optional_header *) sects_view.data;
+  sects = (const b_coff_section_header *)
+    (sects_view.data + fhdr.size_of_optional_header);
+
+  if (fhdr.size_of_optional_header > sizeof (*opt_hdr))
+    {
+      if (opt_hdr->magic == PE_MAGIC)
+	image_base = opt_hdr->u.pe.image_base;
+      else if (opt_hdr->magic == PEP_MAGIC)
+	image_base = opt_hdr->u.pep.image_base;
+      else
+	{
+	  error_callback (data, "bad magic in PE optional header", 0);
+	  goto fail;
+	}
+    }
+  else
+    image_base = 0;
+
+  /* Read the symbol table and the string table.  */
+
+  if (fhdr.pointer_to_symbol_table == 0)
+    {
+      /* No symbol table, no string table.  */
+      str_off = 0;
+      str_size = 0;
+      syms_num = 0;
+      syms_size = 0;
+    }
+  else
+    {
+      /* Symbol table is followed by the string table.  The string table
+	 starts with its length (on 4 bytes).
+	 Map the symbol table and the length of the string table.  */
+      syms_off = fhdr.pointer_to_symbol_table;
+      syms_size = syms_num * SYM_SZ;
+
+      if (!backtrace_get_view (state, descriptor, syms_off, syms_size + 4,
+			       error_callback, data, &syms_view))
+	goto fail;
+      syms_view_valid = 1;
+
+      memcpy (&str_size, syms_view.data + syms_size, 4);
+
+      str_off = syms_off + syms_size;
+
+      if (str_size > 4)
+	{
+	  /* Map string table (including the length word).  */
+
+	  if (!backtrace_get_view (state, descriptor, str_off, str_size,
+				   error_callback, data, &str_view))
+	    goto fail;
+	  str_view_valid = 1;
+	}
+    }
+
+  memset (sections, 0, sizeof sections);
+
+  /* Look for the symbol table.  */
+  for (i = 0; i < sects_num; ++i)
+    {
+      const b_coff_section_header *s = sects + i;
+      unsigned int str_off;
+      int j;
+
+      if (s->name[0] == '/')
+	{
+	  /* Extended section name.  */
+	  str_off = atoi (s->name + 1);
+	}
+      else
+	str_off = 0;
+
+      for (j = 0; j < (int) DEBUG_MAX; ++j)
+	{
+	  const char *dbg_name = debug_section_names[j];
+	  int match;
+
+	  if (str_off != 0)
+	    match = coff_long_name_eq (dbg_name, str_off, &str_view);
+	  else
+	    match = coff_short_name_eq (dbg_name, s->name);
+	  if (match)
+	    {
+	      sections[j].offset = s->pointer_to_raw_data;
+	      sections[j].size = s->virtual_size <= s->size_of_raw_data ?
+		s->virtual_size : s->size_of_raw_data;
+	      break;
+	    }
+	}
+    }
+
+  if (syms_num != 0)
+    {
+      struct coff_syminfo_data *sdata;
+
+      sdata = ((struct coff_syminfo_data *)
+	       backtrace_alloc (state, sizeof *sdata, error_callback, data));
+      if (sdata == NULL)
+	goto fail;
+
+      if (!coff_initialize_syminfo (state, image_base,
+				    sects, sects_num,
+				    syms_view.data, syms_size,
+				    str_view.data, str_size,
+				    error_callback, data, sdata))
+	{
+	  backtrace_free (state, sdata, sizeof *sdata, error_callback, data);
+	  goto fail;
+	}
+
+      *found_sym = 1;
+
+      coff_add_syminfo_data (state, sdata);
+    }
+
+  backtrace_release_view (state, &sects_view, error_callback, data);
+  sects_view_valid = 0;
+  backtrace_release_view (state, &syms_view, error_callback, data);
+  syms_view_valid = 0;
+
+  /* Read all the debug sections in a single view, since they are
+     probably adjacent in the file.  We never release this view.  */
+
+  min_offset = 0;
+  max_offset = 0;
+  for (i = 0; i < (int) DEBUG_MAX; ++i)
+    {
+      off_t end;
+
+      if (sections[i].size == 0)
+	continue;
+      if (min_offset == 0 || sections[i].offset < min_offset)
+	min_offset = sections[i].offset;
+      end = sections[i].offset + sections[i].size;
+      if (end > max_offset)
+	max_offset = end;
+    }
+  if (min_offset == 0 || max_offset == 0)
+    {
+      if (!backtrace_close (descriptor, error_callback, data))
+	goto fail;
+      *fileline_fn = coff_nodebug;
+      return 1;
+    }
+
+  if (!backtrace_get_view (state, descriptor, min_offset,
+			   max_offset - min_offset,
+			   error_callback, data, &debug_view))
+    goto fail;
+  debug_view_valid = 1;
+
+  /* We've read all we need from the executable.  */
+  if (!backtrace_close (descriptor, error_callback, data))
+    goto fail;
+  descriptor = -1;
+
+  for (i = 0; i < (int) DEBUG_MAX; ++i)
+    {
+      if (sections[i].size == 0)
+	sections[i].data = NULL;
+      else
+	sections[i].data = ((const unsigned char *) debug_view.data
+			    + (sections[i].offset - min_offset));
+    }
+
+  if (!backtrace_dwarf_add (state, /* base_address */ 0,
+			    sections[DEBUG_INFO].data,
+			    sections[DEBUG_INFO].size,
+			    sections[DEBUG_LINE].data,
+			    sections[DEBUG_LINE].size,
+			    sections[DEBUG_ABBREV].data,
+			    sections[DEBUG_ABBREV].size,
+			    sections[DEBUG_RANGES].data,
+			    sections[DEBUG_RANGES].size,
+			    sections[DEBUG_STR].data,
+			    sections[DEBUG_STR].size,
+			    0, /* FIXME */
+			    error_callback, data, fileline_fn))
+    goto fail;
+
+  *found_dwarf = 1;
+
+  return 1;
+
+ fail:
+  if (sects_view_valid)
+    backtrace_release_view (state, &sects_view, error_callback, data);
+  if (str_view_valid)
+    backtrace_release_view (state, &str_view, error_callback, data);
+  if (syms_view_valid)
+    backtrace_release_view (state, &syms_view, error_callback, data);
+  if (debug_view_valid)
+    backtrace_release_view (state, &debug_view, error_callback, data);
+  if (descriptor != -1)
+    backtrace_close (descriptor, error_callback, data);
+  return 0;
+}
+
+/* Initialize the backtrace data we need from an ELF executable.  At
+   the ELF level, all we need to do is find the debug info
+   sections.  */
+
+int
+backtrace_initialize (struct backtrace_state *state, int descriptor,
+		      backtrace_error_callback error_callback,
+		      void *data, fileline *fileline_fn)
+{
+  int ret;
+  int found_sym;
+  int found_dwarf;
+  fileline coff_fileline_fn;
+
+  ret = coff_add (state, descriptor, error_callback, data,
+		  &coff_fileline_fn, &found_sym, &found_dwarf);
+  if (!ret)
+    return 0;
+
+  if (!state->threaded)
+    {
+      if (found_sym)
+	state->syminfo_fn = coff_syminfo;
+      else if (state->syminfo_fn == NULL)
+	state->syminfo_fn = coff_nosyms;
+    }
+  else
+    {
+      if (found_sym)
+	backtrace_atomic_store_pointer (&state->syminfo_fn, coff_syminfo);
+      else
+	__sync_bool_compare_and_swap (&state->syminfo_fn, NULL, coff_nosyms);
+    }
+
+  if (!state->threaded)
+    {
+      if (state->fileline_fn == NULL || state->fileline_fn == coff_nodebug)
+	*fileline_fn = coff_fileline_fn;
+    }
+  else
+    {
+      fileline current_fn;
+
+      current_fn = backtrace_atomic_load_pointer (&state->fileline_fn);
+      if (current_fn == NULL || current_fn == coff_nodebug)
+	*fileline_fn = coff_fileline_fn;
+    }
+
+  return 1;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/posix.c
@@ -0,0 +1,100 @@
+/* posix.c -- POSIX file I/O routines for the backtrace library.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
+#ifndef FD_CLOEXEC
+#define FD_CLOEXEC 1
+#endif
+
+/* Open a file for reading.  */
+
+int
+backtrace_open (const char *filename, backtrace_error_callback error_callback,
+		void *data, int *does_not_exist)
+{
+  int descriptor;
+
+  if (does_not_exist != NULL)
+    *does_not_exist = 0;
+
+  descriptor = open (filename, (int) (O_RDONLY | O_BINARY | O_CLOEXEC));
+  if (descriptor < 0)
+    {
+      if (does_not_exist != NULL && errno == ENOENT)
+	*does_not_exist = 1;
+      else
+	error_callback (data, filename, errno);
+      return -1;
+    }
+
+#ifdef HAVE_FCNTL
+  /* Set FD_CLOEXEC just in case the kernel does not support
+     O_CLOEXEC. It doesn't matter if this fails for some reason.
+     FIXME: At some point it should be safe to only do this if
+     O_CLOEXEC == 0.  */
+  fcntl (descriptor, F_SETFD, FD_CLOEXEC);
+#endif
+
+  return descriptor;
+}
+
+/* Close DESCRIPTOR.  */
+
+int
+backtrace_close (int descriptor, backtrace_error_callback error_callback,
+		 void *data)
+{
+  if (close (descriptor) < 0)
+    {
+      error_callback (data, "close", errno);
+      return 0;
+    }
+  return 1;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/print.c
@@ -0,0 +1,92 @@
+/* print.c -- Print the current backtrace.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+/* Passed to callbacks.  */
+
+struct print_data
+{
+  struct backtrace_state *state;
+  FILE *f;
+};
+
+/* Print one level of a backtrace.  */
+
+static int
+print_callback (void *data, uintptr_t pc, const char *filename, int lineno,
+		const char *function)
+{
+  struct print_data *pdata = (struct print_data *) data;
+
+  fprintf (pdata->f, "0x%lx %s\n\t%s:%d\n",
+	   (unsigned long) pc,
+	   function == NULL ? "???" : function,
+	   filename == NULL ? "???" : filename,
+	   lineno);
+  return 0;
+}
+
+/* Print errors to stderr.  */
+
+static void
+error_callback (void *data, const char *msg, int errnum)
+{
+  struct print_data *pdata = (struct print_data *) data;
+
+  if (pdata->state->filename != NULL)
+    fprintf (stderr, "%s: ", pdata->state->filename);
+  fprintf (stderr, "libbacktrace: %s", msg);
+  if (errnum > 0)
+    fprintf (stderr, ": %s", strerror (errnum));
+  fputc ('\n', stderr);
+}
+
+/* Print a backtrace.  */
+
+void
+backtrace_print (struct backtrace_state *state, int skip, FILE *f)
+{
+  struct print_data data;
+
+  data.state = state;
+  data.f = f;
+  backtrace_full (state, skip + 1, print_callback, error_callback,
+		  (void *) &data);
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/read.c
@@ -0,0 +1,96 @@
+/* read.c -- File views without mmap.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+/* This file implements file views when mmap is not available.  */
+
+/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET.  */
+
+int
+backtrace_get_view (struct backtrace_state *state, int descriptor,
+		    off_t offset, size_t size,
+		    backtrace_error_callback error_callback,
+		    void *data, struct backtrace_view *view)
+{
+  ssize_t got;
+
+  if (lseek (descriptor, offset, SEEK_SET) < 0)
+    {
+      error_callback (data, "lseek", errno);
+      return 0;
+    }
+
+  view->base = backtrace_alloc (state, size, error_callback, data);
+  if (view->base == NULL)
+    return 0;
+  view->data = view->base;
+  view->len = size;
+
+  got = read (descriptor, view->base, size);
+  if (got < 0)
+    {
+      error_callback (data, "read", errno);
+      free (view->base);
+      return 0;
+    }
+
+  if ((size_t) got < size)
+    {
+      error_callback (data, "file too short", 0);
+      free (view->base);
+      return 0;
+    }
+
+  return 1;
+}
+
+/* Release a view read by backtrace_get_view.  */
+
+void
+backtrace_release_view (struct backtrace_state *state,
+			struct backtrace_view *view,
+			backtrace_error_callback error_callback,
+			void *data)
+{
+  backtrace_free (state, view->base, view->len, error_callback, data);
+  view->data = NULL;
+  view->base = NULL;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/simple.c
@@ -0,0 +1,108 @@
+/* simple.c -- The backtrace_simple function.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include "unwind.h"
+#include "backtrace.h"
+
+/* The simple_backtrace routine.  */
+
+/* Data passed through _Unwind_Backtrace.  */
+
+struct backtrace_simple_data
+{
+  /* Number of frames to skip.  */
+  int skip;
+  /* Library state.  */
+  struct backtrace_state *state;
+  /* Callback routine.  */
+  backtrace_simple_callback callback;
+  /* Error callback routine.  */
+  backtrace_error_callback error_callback;
+  /* Data to pass to callback routine.  */
+  void *data;
+  /* Value to return from backtrace.  */
+  int ret;
+};
+
+/* Unwind library callback routine.  This is passd to
+   _Unwind_Backtrace.  */
+
+static _Unwind_Reason_Code
+simple_unwind (struct _Unwind_Context *context, void *vdata)
+{
+  struct backtrace_simple_data *bdata = (struct backtrace_simple_data *) vdata;
+  uintptr_t pc;
+  int ip_before_insn = 0;
+
+#ifdef HAVE_GETIPINFO
+  pc = _Unwind_GetIPInfo (context, &ip_before_insn);
+#else
+  pc = _Unwind_GetIP (context);
+#endif
+
+  if (bdata->skip > 0)
+    {
+      --bdata->skip;
+      return _URC_NO_REASON;
+    }
+
+  if (!ip_before_insn)
+    --pc;
+
+  bdata->ret = bdata->callback (bdata->data, pc);
+
+  if (bdata->ret != 0)
+    return _URC_END_OF_STACK;
+
+  return _URC_NO_REASON;
+}
+
+/* Get a simple stack backtrace.  */
+
+int
+backtrace_simple (struct backtrace_state *state, int skip,
+		  backtrace_simple_callback callback,
+		  backtrace_error_callback error_callback, void *data)
+{
+  struct backtrace_simple_data bdata;
+
+  bdata.skip = skip + 1;
+  bdata.state = state;
+  bdata.callback = callback;
+  bdata.error_callback = error_callback;
+  bdata.data = data;
+  bdata.ret = 0;
+  _Unwind_Backtrace (simple_unwind, &bdata);
+  return bdata.ret;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/sort.c
@@ -0,0 +1,108 @@
+/* sort.c -- Sort without allocating memory
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <stddef.h>
+#include <sys/types.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+/* The GNU glibc version of qsort allocates memory, which we must not
+   do if we are invoked by a signal handler.  So provide our own
+   sort.  */
+
+static void
+swap (char *a, char *b, size_t size)
+{
+  size_t i;
+
+  for (i = 0; i < size; i++, a++, b++)
+    {
+      char t;
+
+      t = *a;
+      *a = *b;
+      *b = t;
+    }
+}
+
+void
+backtrace_qsort (void *basearg, size_t count, size_t size,
+		 int (*compar) (const void *, const void *))
+{
+  char *base = (char *) basearg;
+  size_t i;
+  size_t mid;
+
+ tail_recurse:
+  if (count < 2)
+    return;
+
+  /* The symbol table and DWARF tables, which is all we use this
+     routine for, tend to be roughly sorted.  Pick the middle element
+     in the array as our pivot point, so that we are more likely to
+     cut the array in half for each recursion step.  */
+  swap (base, base + (count / 2) * size, size);
+
+  mid = 0;
+  for (i = 1; i < count; i++)
+    {
+      if ((*compar) (base, base + i * size) > 0)
+	{
+	  ++mid;
+	  if (i != mid)
+	    swap (base + mid * size, base + i * size, size);
+	}
+    }
+
+  if (mid > 0)
+    swap (base, base + mid * size, size);
+
+  /* Recurse with the smaller array, loop with the larger one.  That
+     ensures that our maximum stack depth is log count.  */
+  if (2 * mid < count)
+    {
+      backtrace_qsort (base, mid, size, compar);
+      base += (mid + 1) * size;
+      count -= mid + 1;
+      goto tail_recurse;
+    }
+  else
+    {
+      backtrace_qsort (base + (mid + 1) * size, count - (mid + 1),
+		       size, compar);
+      count = mid;
+      goto tail_recurse;
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/state.c
@@ -0,0 +1,72 @@
+/* state.c -- Create the backtrace state.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <string.h>
+#include <sys/types.h>
+
+#include "backtrace.h"
+#include "backtrace-supported.h"
+#include "internal.h"
+
+/* Create the backtrace state.  This will then be passed to all the
+   other routines.  */
+
+struct backtrace_state *
+backtrace_create_state (const char *filename, int threaded,
+			backtrace_error_callback error_callback,
+			void *data)
+{
+  struct backtrace_state init_state;
+  struct backtrace_state *state;
+
+#ifndef HAVE_SYNC_FUNCTIONS
+  if (threaded)
+    {
+      error_callback (data, "backtrace library does not support threads", 0);
+      return NULL;
+    }
+#endif
+
+  memset (&init_state, 0, sizeof init_state);
+  init_state.filename = filename;
+  init_state.threaded = threaded;
+
+  state = ((struct backtrace_state *)
+	   backtrace_alloc (&init_state, sizeof *state, error_callback, data));
+  if (state == NULL)
+    return NULL;
+  *state = init_state;
+
+  return state;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/stest.c
@@ -0,0 +1,137 @@
+/* stest.c -- Test for libbacktrace internal sort function
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+/* Test the local qsort implementation.  */
+
+#define MAX 10
+
+struct test
+{
+  size_t count;
+  int input[MAX];
+  int output[MAX];
+};
+
+static struct test tests[] =
+  {
+    {
+      10,
+      { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },
+      { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
+    },
+    {
+      9,
+      { 1, 2, 3, 4, 5, 6, 7, 8, 9 },
+      { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
+    },
+    {
+      10,
+      { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 },
+      { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },
+    },
+    {
+      9,
+      { 9, 8, 7, 6, 5, 4, 3, 2, 1 },
+      { 1, 2, 3, 4, 5, 6, 7, 8, 9 },
+    },
+    {
+      10,
+      { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 },
+      { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },
+    },
+    {
+      5,
+      { 4, 5, 3, 1, 2 },
+      { 1, 2, 3, 4, 5 },
+    },
+    {
+      5,
+      { 1, 1, 1, 1, 1 },
+      { 1, 1, 1, 1, 1 },
+    },
+    {
+      5,
+      { 1, 1, 2, 1, 1 },
+      { 1, 1, 1, 1, 2 },
+    },
+    {
+      5,
+      { 2, 1, 1, 1, 1 },
+      { 1, 1, 1, 1, 2 },
+    },
+  };
+
+static int
+compare (const void *a, const void *b)
+{
+  const int *ai = (const int *) a;
+  const int *bi = (const int *) b;
+
+  return *ai - *bi;
+}
+
+int
+main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+{
+  int failures;
+  size_t i;
+  int a[MAX];
+
+  failures = 0;
+  for (i = 0; i < sizeof tests / sizeof tests[0]; i++)
+    {
+      memcpy (a, tests[i].input, tests[i].count * sizeof (int));
+      backtrace_qsort (a, tests[i].count, sizeof (int), compare);
+      if (memcmp (a, tests[i].output, tests[i].count * sizeof (int)) != 0)
+	{
+	  size_t j;
+
+	  fprintf (stderr, "test %d failed:", (int) i);
+	  for (j = 0; j < tests[i].count; j++)
+	    fprintf (stderr, " %d", a[j]);
+	  fprintf (stderr, "\n");
+	  ++failures;
+	}
+    }
+
+  exit (failures > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/src/libbacktrace/unknown.c
@@ -0,0 +1,64 @@
+/* unknown.c -- used when backtrace configury does not know file format.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
+   Written by Ian Lance Taylor, Google.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    (1) Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    (2) Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+    (3) The name of the author may not be used to
+    endorse or promote products derived from this software without
+    specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.  */
+
+#include "config.h"
+
+#include <sys/types.h>
+
+#include "backtrace.h"
+#include "internal.h"
+
+/* A trivial routine that always fails to find fileline data.  */
+
+static int
+unknown_fileline (struct backtrace_state *state ATTRIBUTE_UNUSED,
+		  uintptr_t pc, backtrace_full_callback callback,
+		  backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
+		  void *data)
+
+{
+  return callback (data, pc, NULL, 0, NULL);
+}
+
+/* Initialize the backtrace data when we don't know how to read the
+   debug info.  */
+
+int
+backtrace_initialize (struct backtrace_state *state ATTRIBUTE_UNUSED,
+		      int descriptor ATTRIBUTE_UNUSED,
+		      backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
+		      void *data ATTRIBUTE_UNUSED, fileline *fileline_fn)
+{
+  state->fileline_data = NULL;
+  *fileline_fn = unknown_fileline;
+  return 1;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace-sys-0.1.10/symbol-map
@@ -0,0 +1,18 @@
+backtrace_full __rbt_backtrace_full
+backtrace_dwarf_add __rbt_backtrace_dwarf_add
+backtrace_initialize __rbt_backtrace_initialize
+backtrace_pcinfo __rbt_backtrace_pcinfo
+backtrace_syminfo __rbt_backtrace_syminfo
+backtrace_get_view __rbt_backtrace_get_view
+backtrace_release_view __rbt_backtrace_release_view
+backtrace_alloc __rbt_backtrace_alloc
+backtrace_free __rbt_backtrace_free
+backtrace_vector_finish __rbt_backtrace_vector_finish
+backtrace_vector_grow __rbt_backtrace_vector_grow
+backtrace_vector_release __rbt_backtrace_vector_release
+backtrace_close __rbt_backtrace_close
+backtrace_open __rbt_backtrace_open
+backtrace_print __rbt_backtrace_print
+backtrace_simple __rbt_backtrace_simple
+backtrace_qsort __rbt_backtrace_qsort
+backtrace_create_state __rbt_backtrace_create_state
--- a/third_party/rust/backtrace-sys/.cargo-checksum.json
+++ b/third_party/rust/backtrace-sys/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"749f043da5cdbd988e2068e94feb3e75ed326945a99cf288c94ae444f5328680","build.rs":"2cf7c28f03f85c8e68969bcb5b076c8effa8543d39a12fe651ff332ac6a394c7","src/lib.rs":"cb45ba047240bceac6ea74da50c2f48ae81a965b578c833a766a3ea0db1075f3","src/libbacktrace/ChangeLog":"ad6f9058524b950aed734db83419e0624df55a48af8091c8bcad7a125aeeffdd","src/libbacktrace/ChangeLog.jit":"ee143b5c9dc571d9aca006be246a83b1f019c39a3fd7b0025eb37463e30200ce","src/libbacktrace/Makefile.am":"74d0036c9715cb7fa6c749cead794ba96283f47d243cf2b25bc6fac8f04667d5","src/libbacktrace/Makefile.in":"9ca92df95c8d62b8a0e106357a796ef4d2c5ec7fd02ab133fd0a65de1984e096","src/libbacktrace/README":"3d1a15714583197945df8db054da6f30613316ec311c5ec2d68b92fab12364a2","src/libbacktrace/aclocal.m4":"e3a6dfa4ce929624ac289b260987a7fa9b512cfbf3ff6f39c5d1e38cbad1a0ea","src/libbacktrace/alloc.c":"829ceab369210fc60758f339807fe0bf55832c77adb3a4450fae586a90a9673d","src/libbacktrace/ansidecl.h":"14acfcd6c044bc73de85b120cbc3e626771a01712911ee1f6137585fd710fb1e","src/libbacktrace/atomic.c":"3e1882a520e0e1115107e194fbd97daa8d3feef15a70047969f4976e7542c263","src/libbacktrace/backtrace-supported.h.in":"42277f3c383386b6cfa3d3d889336e92303fac0ae1a9fb8a6a56737245dfb8f3","src/libbacktrace/backtrace.c":"76bdabddc4eb8a46a7eec98ce610c86909c89c629eb850a0cde98f5a78c9b99d","src/libbacktrace/backtrace.h":"cd2db6474556b655e42c0a973b871c1b6cb4796809490bf59cc8d3d0e8c083f5","src/libbacktrace/btest.c":"fff55e4acf6ad02a6f719046fc4e3f8bf795166ed9956122a79e17c6be266738","src/libbacktrace/config.guess":"8131853dbc8c3be5171fa96353de7a884a79d3f1d6b3fbf48f99037f5f95fe27","src/libbacktrace/config.h.in":"9b0d30416c93906e5c0ce36c95a7426bfd41228114f381949e89d263305b5b65","src/libbacktrace/config.sub":"3b739084e4b409aacf8531f87b57efa602eccdd17b5cddbc4ae1313a2c866f34","src/libbacktrace/configure":"2b45c89d06809c6ed49d70bfdf51a93e44370fc81f689169a073f47b14b366e5","src/libbacktrace/configure.ac":"360b1a033e33d2c58d2f36aaa6644a2aac0dd8960417df6d64202cc099a1c3f3","src/libbacktrace/dwarf.c":"b969c3abb07a09aa4ac5094dba5777d2c23fee77ade4ec0934142d6b81049785","src/libbacktrace/dwarf2.def":"d947302d8b259f0abdd9dd2f50a0713f4e7395c05ce88ddfdb37a7145b045d82","src/libbacktrace/dwarf2.h":"b3b13fa412a1573e3ee8dcb1d603ec33de7140f00b3bbbaa5292724f0087ace3","src/libbacktrace/elf.c":"728d7e47bf077de4dad6eecc76c134b4b4898dc5866572587692848f29aaec5c","src/libbacktrace/fileline.c":"bae25b6662bfd01a43bccc645206e00aeea27f18a51f6303f00f4fa1d9f2e861","src/libbacktrace/filenames.h":"bce400200dbc7452ca2a7f27dd36516949c4c94a135a6a322f011f3ce7817377","src/libbacktrace/filetype.awk":"9dd5352f288c3737fccd24a2c7583f4d0dbca2b95b2735a90a26b644478018af","src/libbacktrace/hashtab.h":"4cb7f68db5c2e8ff1190ecf859e7feb58447ea20bd9818bb1f447b46e2813c58","src/libbacktrace/install-sh":"d7c113e5484fce8b48f9a34a7a91e385ec279247d415b0b7d749bd56ad8ee8a2","src/libbacktrace/internal.h":"ed657e14aa33b4b5217919435e69019c5a677a00a9c134bf0297f000f146b093","src/libbacktrace/ltmain.sh":"ee4019f80b993cdb1bd13bf39434ad4f1ef15ae57a97594c53fb7b1d76d776a4","src/libbacktrace/missing":"b1a337b731bbb58846d31ca2f5143c293a455fa41b481e236e89a9016d96b034","src/libbacktrace/mmap.c":"fec72286a2d8a0c53fd56ea61b3766b87031f6f803f6de6c3c656e39bc85cdc2","src/libbacktrace/mmapio.c":"32a672fd2b8b3395c8a16ef11d839437ca35570fbc235bb0e2e70ef8097a12fc","src/libbacktrace/nounwind.c":"7694636af38ef488c814ab9b71854d6a259c1f3f635bd4c3ed99a88ca2beb5f1","src/libbacktrace/pecoff.c":"00cf6976cfc1e018f5e5473d4fbef4ae86de825dd2749897c45dfcebcefc6abf","src/libbacktrace/posix.c":"73754fcfa0a5b0342e8fe32166e7228b61e022699a8a3c9a2ef8e46260736704","src/libbacktrace/print.c":"ec1e80e17e27130bf9412470e8dc9155a0dc9ca3a78125081f5073b438b54157","src/libbacktrace/read.c":"399458fb06389aa4bd5ce376c4620cf733b5555d1dabe7ef19f185da1e37e614","src/libbacktrace/simple.c":"686d976c2bdb1a074f9be05af026d4b4c7a4978c2602268747d492563f18e0dc","src/libbacktrace/sort.c":"1a1e44af4e4d02fc568b318aa1517792edd6972a27029ba78e938856ef8ba1a0","src/libbacktrace/state.c":"49d547f5622b0ea0c39bc873b09a7dce276fdc6469118f5ab2e72c55bd0457fb","src/libbacktrace/stest.c":"aa1b90fe2d6dc8ac65ac0168776c2d242efc6460ac596deb14ac1e72bf764871","src/libbacktrace/unknown.c":"914aa113cd17ed678d40927391b35f6027e87b3a02e36e9f1822ec1efe9c0e20","symbol-map":"b941b2516efbb9e46521eeb166c60b31d52b2a4aaaf35d7f9af24946bbe1328a"},"package":"d192fd129132fbc97497c1f2ec2c2c5174e376b95f535199ef4fe0a293d33842"}
\ No newline at end of file
+{"files":{"Cargo.toml":"744f124e8a67a644dfee3665baad89b5f98ac93d79034aca685e0ac79802a5d6","build.rs":"dd3a9eeb5f071ebf073657b691593aa9432a5280d3c7719bd8357e20e6ccdf7f","src/lib.rs":"cb45ba047240bceac6ea74da50c2f48ae81a965b578c833a766a3ea0db1075f3","src/libbacktrace/ChangeLog":"ad6f9058524b950aed734db83419e0624df55a48af8091c8bcad7a125aeeffdd","src/libbacktrace/ChangeLog.jit":"ee143b5c9dc571d9aca006be246a83b1f019c39a3fd7b0025eb37463e30200ce","src/libbacktrace/Makefile.am":"74d0036c9715cb7fa6c749cead794ba96283f47d243cf2b25bc6fac8f04667d5","src/libbacktrace/Makefile.in":"9ca92df95c8d62b8a0e106357a796ef4d2c5ec7fd02ab133fd0a65de1984e096","src/libbacktrace/README":"3d1a15714583197945df8db054da6f30613316ec311c5ec2d68b92fab12364a2","src/libbacktrace/aclocal.m4":"e3a6dfa4ce929624ac289b260987a7fa9b512cfbf3ff6f39c5d1e38cbad1a0ea","src/libbacktrace/alloc.c":"829ceab369210fc60758f339807fe0bf55832c77adb3a4450fae586a90a9673d","src/libbacktrace/ansidecl.h":"14acfcd6c044bc73de85b120cbc3e626771a01712911ee1f6137585fd710fb1e","src/libbacktrace/atomic.c":"3e1882a520e0e1115107e194fbd97daa8d3feef15a70047969f4976e7542c263","src/libbacktrace/backtrace-supported.h.in":"42277f3c383386b6cfa3d3d889336e92303fac0ae1a9fb8a6a56737245dfb8f3","src/libbacktrace/backtrace.c":"76bdabddc4eb8a46a7eec98ce610c86909c89c629eb850a0cde98f5a78c9b99d","src/libbacktrace/backtrace.h":"cd2db6474556b655e42c0a973b871c1b6cb4796809490bf59cc8d3d0e8c083f5","src/libbacktrace/btest.c":"fff55e4acf6ad02a6f719046fc4e3f8bf795166ed9956122a79e17c6be266738","src/libbacktrace/config.guess":"8131853dbc8c3be5171fa96353de7a884a79d3f1d6b3fbf48f99037f5f95fe27","src/libbacktrace/config.h.in":"9b0d30416c93906e5c0ce36c95a7426bfd41228114f381949e89d263305b5b65","src/libbacktrace/config.sub":"3b739084e4b409aacf8531f87b57efa602eccdd17b5cddbc4ae1313a2c866f34","src/libbacktrace/configure":"2b45c89d06809c6ed49d70bfdf51a93e44370fc81f689169a073f47b14b366e5","src/libbacktrace/configure.ac":"360b1a033e33d2c58d2f36aaa6644a2aac0dd8960417df6d64202cc099a1c3f3","src/libbacktrace/dwarf.c":"b969c3abb07a09aa4ac5094dba5777d2c23fee77ade4ec0934142d6b81049785","src/libbacktrace/dwarf2.def":"d947302d8b259f0abdd9dd2f50a0713f4e7395c05ce88ddfdb37a7145b045d82","src/libbacktrace/dwarf2.h":"b3b13fa412a1573e3ee8dcb1d603ec33de7140f00b3bbbaa5292724f0087ace3","src/libbacktrace/elf.c":"728d7e47bf077de4dad6eecc76c134b4b4898dc5866572587692848f29aaec5c","src/libbacktrace/fileline.c":"bae25b6662bfd01a43bccc645206e00aeea27f18a51f6303f00f4fa1d9f2e861","src/libbacktrace/filenames.h":"bce400200dbc7452ca2a7f27dd36516949c4c94a135a6a322f011f3ce7817377","src/libbacktrace/filetype.awk":"9dd5352f288c3737fccd24a2c7583f4d0dbca2b95b2735a90a26b644478018af","src/libbacktrace/hashtab.h":"4cb7f68db5c2e8ff1190ecf859e7feb58447ea20bd9818bb1f447b46e2813c58","src/libbacktrace/install-sh":"d7c113e5484fce8b48f9a34a7a91e385ec279247d415b0b7d749bd56ad8ee8a2","src/libbacktrace/internal.h":"ed657e14aa33b4b5217919435e69019c5a677a00a9c134bf0297f000f146b093","src/libbacktrace/ltmain.sh":"ee4019f80b993cdb1bd13bf39434ad4f1ef15ae57a97594c53fb7b1d76d776a4","src/libbacktrace/missing":"b1a337b731bbb58846d31ca2f5143c293a455fa41b481e236e89a9016d96b034","src/libbacktrace/mmap.c":"fec72286a2d8a0c53fd56ea61b3766b87031f6f803f6de6c3c656e39bc85cdc2","src/libbacktrace/mmapio.c":"32a672fd2b8b3395c8a16ef11d839437ca35570fbc235bb0e2e70ef8097a12fc","src/libbacktrace/nounwind.c":"7694636af38ef488c814ab9b71854d6a259c1f3f635bd4c3ed99a88ca2beb5f1","src/libbacktrace/pecoff.c":"00cf6976cfc1e018f5e5473d4fbef4ae86de825dd2749897c45dfcebcefc6abf","src/libbacktrace/posix.c":"73754fcfa0a5b0342e8fe32166e7228b61e022699a8a3c9a2ef8e46260736704","src/libbacktrace/print.c":"ec1e80e17e27130bf9412470e8dc9155a0dc9ca3a78125081f5073b438b54157","src/libbacktrace/read.c":"399458fb06389aa4bd5ce376c4620cf733b5555d1dabe7ef19f185da1e37e614","src/libbacktrace/simple.c":"686d976c2bdb1a074f9be05af026d4b4c7a4978c2602268747d492563f18e0dc","src/libbacktrace/sort.c":"1a1e44af4e4d02fc568b318aa1517792edd6972a27029ba78e938856ef8ba1a0","src/libbacktrace/state.c":"49d547f5622b0ea0c39bc873b09a7dce276fdc6469118f5ab2e72c55bd0457fb","src/libbacktrace/stest.c":"aa1b90fe2d6dc8ac65ac0168776c2d242efc6460ac596deb14ac1e72bf764871","src/libbacktrace/unknown.c":"914aa113cd17ed678d40927391b35f6027e87b3a02e36e9f1822ec1efe9c0e20","symbol-map":"b941b2516efbb9e46521eeb166c60b31d52b2a4aaaf35d7f9af24946bbe1328a"},"package":"afccc5772ba333abccdf60d55200fa3406f8c59dcf54d5f7998c9107d3799c7c"}
\ No newline at end of file
--- a/third_party/rust/backtrace-sys/Cargo.toml
+++ b/third_party/rust/backtrace-sys/Cargo.toml
@@ -1,18 +1,26 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "backtrace-sys"
-version = "0.1.10"
+version = "0.1.12"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 build = "build.rs"
-license = "MIT/Apache-2.0"
-repository = "https://github.com/alexcrichton/backtrace-rs"
+description = "Bindings to the libbacktrace gcc library\n"
 homepage = "https://github.com/alexcrichton/backtrace-rs"
 documentation = "http://alexcrichton.com/backtrace-rs"
-description = """
-Bindings to the libbacktrace gcc library
-"""
-
-[dependencies]
-libc = "0.2"
-
-[build-dependencies]
-gcc = "0.3"
+license = "MIT/Apache-2.0"
+repository = "https://github.com/alexcrichton/backtrace-rs"
+[dependencies.libc]
+version = "0.2"
+[build-dependencies.gcc]
+version = "0.3"
--- a/third_party/rust/backtrace-sys/build.rs
+++ b/third_party/rust/backtrace-sys/build.rs
@@ -30,16 +30,17 @@ fn try_tool(compiler: &gcc::Tool, cc: &s
 
 fn find_tool(compiler: &gcc::Tool, cc: &str, tool: &str) -> PathBuf {
     // Allow overrides via env var
     if let Some(s) = env::var_os(tool.to_uppercase()) {
         return s.into()
     }
     let tool_suffix = format!("-{}", tool);
     try_tool(compiler, cc, "-gcc", &tool_suffix)
+        .or_else(|| try_tool(compiler, cc, "-clang", &tool_suffix))
         .or_else(|| try_tool(compiler, cc, "-cc", &tool_suffix))
         .unwrap_or_else(|| PathBuf::from(tool))
 }
 
 fn main() {
     let src = env::current_dir().unwrap();
     let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap());
     let target = env::var("TARGET").unwrap();
@@ -55,39 +56,73 @@ fn main() {
         return
     }
 
     // no way this will ever compile for emscripten
     if target.contains("emscripten") {
         return
     }
 
+    let mut make = "make";
+
+    // host BSDs has GNU-make as gmake
+    if host.contains("bitrig") || host.contains("dragonfly") ||
+        host.contains("freebsd") || host.contains("netbsd") ||
+        host.contains("openbsd") {
+
+        make = "gmake"
+    }
+
+    let configure = src.join("src/libbacktrace/configure").into_os_string();
+
+    // When cross-compiling on Windows, this path will contain backslashes,
+    // but configure doesn't like that. Replace them with forward slashes.
+    #[cfg(windows)]
+    let configure = {
+        use std::os::windows::ffi::{OsStrExt, OsStringExt};
+        let mut chars: Vec<u16> = configure.encode_wide().collect();
+        for c in chars.iter_mut() {
+            if *c == '\\' as u16 {
+                *c = '/' as u16;
+            }
+        }
+        OsString::from_wide(&chars)
+    };
+
     let cfg = gcc::Config::new();
     let compiler = cfg.get_compiler();
     let cc = compiler.path().file_name().unwrap().to_str().unwrap();
     let mut flags = OsString::new();
     for (i, flag) in compiler.args().iter().enumerate() {
         if i > 0 {
             flags.push(" ");
         }
         flags.push(flag);
     }
     let ar = find_tool(&compiler, cc, "ar");
-    run(Command::new(src.join("src/libbacktrace/configure"))
-                .current_dir(&dst)
-                .env("CC", compiler.path())
-                .env("CFLAGS", flags)
-                .arg("--with-pic")
-                .arg("--disable-multilib")
-                .arg("--disable-shared")
-                .arg("--disable-host-shared")
-                .arg(format!("--target={}", target))
-                .arg(format!("--host={}", host)),
-        "sh");
-    run(Command::new("make")
+    let mut cmd = Command::new("sh");
+
+    cmd.arg(configure)
+       .current_dir(&dst)
+       .env("AR", &ar)
+       .env("CC", compiler.path())
+       .env("CFLAGS", flags)
+       .arg("--with-pic")
+       .arg("--disable-multilib")
+       .arg("--disable-shared")
+       .arg("--disable-host-shared")
+       .arg(format!("--host={}", target));
+
+    // Apparently passing this flag causes problems on Windows
+    if !host.contains("windows") {
+       cmd.arg(format!("--build={}", host));
+    }
+
+    run(&mut cmd, "sh");
+    run(Command::new(make)
                 .current_dir(&dst)
                 .arg(format!("INCDIR={}",
                              src.join("src/libbacktrace").display())),
         "make");
     println!("cargo:rustc-link-search=native={}/.libs", dst.display());
     println!("cargo:rustc-link-lib=static=backtrace");
 
     // The standard library currently bundles in libbacktrace, but it's
--- a/third_party/rust/backtrace/.cargo-checksum.json
+++ b/third_party/rust/backtrace/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"6f11d19317924088c90d605e1d13e4af230b10e289c5df6139c40a62409eabd9","Cargo.toml":"f893b7b701611e48ab80db25670342084b11d8d4ed3f3471b68842c490d247b8","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"11061a4c1e27fde148b5b1fb6df553f8eb464e279be0f5e278d262bf35d7b0f8","appveyor.yml":"29d9f44137560479a75b02a7953cfa0c378c2577ed1925f579b400295c7937e3","examples/backtrace.rs":"fd6e1cc6c3378ec7d41cd03b2bef187051298dceb01147e71f207dbb8a0c4867","examples/raw.rs":"f07be26d1f97cd7ac79290ac99d19c4eec5d27031fe270ab5364c25d9c2ad9e0","src/backtrace/dbghelp.rs":"45c5052763857d4a3727c3082be1b2f6c28f7973afd66706657defda5d97c6ec","src/backtrace/libunwind.rs":"cc9cdc1d389571cdedf43dfc2d39b8c3af85531a3965ed700c724f436afb213e","src/backtrace/mod.rs":"d00f4a574fae44df81b1d40bf44acea84addb70b4c76c85bfaa1f3ab0bcd7f0d","src/backtrace/noop.rs":"dc4a6602e9852b945c382194402314d3d68c8ca90199af9a8159419fb91a3c99","src/backtrace/unix_backtrace.rs":"1bb4a4a2f1e56f8ac04002dd77411116d8b4920f905d1ddfcb289e242f939a86","src/capture.rs":"de3250fcb9ff941391dea24decc8166d058f17abe77d25ff82b766ac384f00ea","src/dylib.rs":"09f3d7f32849cf0daa4de9df48f8e4a4d5ba62e20723c79578201bd271dc4777","src/lib.rs":"7ccd8cc3679435f0e39efd26f23d9d7a01094ab09ba6d411c6587b2420c6886b","src/symbolize/coresymbolication.rs":"99280684791694f560824b39291ee7ad78a2b53f82e5972ff3d9b77b43671f60","src/symbolize/dbghelp.rs":"d743545bb3e64eafc4903e3e7aec115b64da2174e75afd7b465bc0b89573b88a","src/symbolize/dladdr.rs":"8287cbca440a9e92e74d88c5a7b920f6b4cf6d8f50bc8b0f61aca5ba42d5b5ec","src/symbolize/libbacktrace.rs":"0cdad7de2501baef9da193ee6aab21c453d26348a2071c805a133efe1209eaa1","src/symbolize/mod.rs":"7f2efe54ce40f42ba38673614cff2a510632123cb6d1bc3da88566f12bcba588","src/symbolize/noop.rs":"b622fcecb4e22b42c3d3e2ef5dc5a6ab14601fec83c7797ee1fbbacc12fe6ca1","tests/smoke.rs":"fc882d7db0f4842e4415e3319774a33ba27c4d6412a62f8ee194a5dafd8a6128"},"package":"72f9b4182546f4b04ebc4ab7f84948953a118bd6021a1b6a6c909e3e94f6be76"}
\ No newline at end of file
+{"files":{".travis.yml":"7c4c8bd9d72ba4186b6ff777a5168a1eacb5b2245bb675ab8f4abd5859ec906f","Cargo.toml":"e4c5543dd4144dec207c77df49246b1fec9dfcecde2b4ee50d2f016fd11d9a1b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"11061a4c1e27fde148b5b1fb6df553f8eb464e279be0f5e278d262bf35d7b0f8","appveyor.yml":"29d9f44137560479a75b02a7953cfa0c378c2577ed1925f579b400295c7937e3","examples/backtrace.rs":"fd6e1cc6c3378ec7d41cd03b2bef187051298dceb01147e71f207dbb8a0c4867","examples/raw.rs":"f07be26d1f97cd7ac79290ac99d19c4eec5d27031fe270ab5364c25d9c2ad9e0","src/backtrace/dbghelp.rs":"45c5052763857d4a3727c3082be1b2f6c28f7973afd66706657defda5d97c6ec","src/backtrace/libunwind.rs":"cc9cdc1d389571cdedf43dfc2d39b8c3af85531a3965ed700c724f436afb213e","src/backtrace/mod.rs":"91a544bd9e89da6b580e2580ab15ead354f13243bca50516ff5cefe68a8cd199","src/backtrace/noop.rs":"dc4a6602e9852b945c382194402314d3d68c8ca90199af9a8159419fb91a3c99","src/backtrace/unix_backtrace.rs":"31204989a8852428792a1c99d36717559aad14d93526e8a37744214adf188268","src/capture.rs":"a6f379300f6a578c52fce5927461fb0d084b2eb080113561a2e0cc11aa1f5c73","src/dylib.rs":"09f3d7f32849cf0daa4de9df48f8e4a4d5ba62e20723c79578201bd271dc4777","src/lib.rs":"20006ff65d1e9fd7f8fea52ae5515f99be99ffcc90b988f22d6cf276062cc9a0","src/symbolize/coresymbolication.rs":"99280684791694f560824b39291ee7ad78a2b53f82e5972ff3d9b77b43671f60","src/symbolize/dbghelp.rs":"6557ef254bb146609efd1534c4ac698e0278c4ce0b5f005108c6c8cd834f7250","src/symbolize/dladdr.rs":"8287cbca440a9e92e74d88c5a7b920f6b4cf6d8f50bc8b0f61aca5ba42d5b5ec","src/symbolize/gimli.rs":"44abf9436f53ed38e053d324548509731234577445eb5d2fe17f0adbb5834c03","src/symbolize/libbacktrace.rs":"0cdad7de2501baef9da193ee6aab21c453d26348a2071c805a133efe1209eaa1","src/symbolize/mod.rs":"5cce6abcdebe8f5766b0697fc47fdfa119afd231b99048d0b9c67af3a295b4ae","src/symbolize/noop.rs":"b622fcecb4e22b42c3d3e2ef5dc5a6ab14601fec83c7797ee1fbbacc12fe6ca1","tests/long_fn_name.rs":"1291e92a2dceab9ad3d424a26dd32bd8a3b77e86c2409ab8930c56918c3d961f","tests/smoke.rs":"85b5de78290cb1b247494fa2f118096c1fda2f249db47f3d94dd52446c5f0d7d"},"package":"99f2ce94e22b8e664d95c57fff45b98a966c2252b60691d0b7aeeccd88d70983"}
\ No newline at end of file
--- a/third_party/rust/backtrace/.travis.yml
+++ b/third_party/rust/backtrace/.travis.yml
@@ -1,38 +1,59 @@
 language: rust
+
 rust:
   - stable
   - beta
   - nightly
+
 sudo: false
+
+dist: trusty
+
+addons:
+  sources:
+    # Provides clang-3.9
+    - llvm-toolchain-trusty-3.9
+  apt:
+    packages:
+      # Required for `bindgen`, which is required by `findshlibs`, which is
+      # required by the `gimli` feature.
+      - clang-3.9
+
 before_script:
   - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
+  - export LIBCLANG_PATH=/usr/lib/llvm-3.9/lib
+
 script:
   - cargo test
   - cargo test --no-default-features
   - cargo test --no-default-features --features 'libunwind'
   - cargo test --no-default-features --features 'libunwind dladdr'
   - cargo test --no-default-features --features 'libunwind libbacktrace'
   - cargo test --no-default-features --features 'unix-backtrace'
   - cargo test --no-default-features --features 'unix-backtrace dladdr'
   - cargo test --no-default-features --features 'unix-backtrace libbacktrace'
   - cargo test --no-default-features --features 'serialize-serde'
   - cargo test --no-default-features --features 'serialize-rustc'
   - cargo test --no-default-features --features 'serialize-rustc serialize-serde'
   - cargo test --no-default-features --features 'cpp_demangle'
+  - cargo test --no-default-features --features 'gimli-symbolize'
   - cd ./cpp_smoke_test && cargo test && cd ..
   - cargo clean && cargo build
   - rustdoc --test README.md -L target/debug/deps -L target/debug
   - cargo doc --no-deps
+
 notifications:
   email:
     on_success: never
+
 after_success:
   - travis-cargo --only nightly doc-upload
+
 env:
   global:
     # serde-codegen has historically needed a large stack to expand
     - RUST_MIN_STACK=16777216
     - secure: "Kuf3j6gC3MhR+F7g8/5J4+3tu+FXJP/SqKjsUVVjs/qjniIVX3MwZPhtP/pVtdRvYjW0NzLw5Nufb4o1cyY4uKwR8BHHNuEUE/h3mPShjWHqzLyn5QiBumPozsFCa32H4gconRmp3+s0YrBT7nLoGvUZZS0dkldMkpvvrPL/yUKXLS8HEP4L1GO5iMQQYG6i3sbWTbHikE6ZQogW/iZommyqUkVB/s/SQvdH9SXu89ttNXlm/F+EIsgsgyzpbULp5sD34GRDPJe+H1m+sgA1kTRrzmuBGNmz9mx6GyIKaqACTm1gRcb06nFjTPVTQioJBNnoV7TEqZCvjuSsUjcGmP4Aeissafo93ADzV+bd0uoWIScE9ltSVS+RgCDV+sd0GHz5U6FjhgZp0amaVl3d6hPp8lbTfK/gfj1i9ktQfKZbG7rB4tfIU1KeQRkyE9vb/TaKp8nwBbc4SVQ4EKFOlRbE1S1FooaKZweW8w57d2u+sMMMVJbO28/Ap8tk9xDSOl4shPaT0iM0U9/heF8FmCZB1OKXLKn6TAaNFnaMTvdTHl+Tjrf6Vzd/oPXJ7GuaB6eLxXYjXvZHuKiLkSZriOzhL7PbijNILbSgZt7+Fa0vcnXP8zgD4dmupx/CoIHLN9NP4o9cGXuBcaJ/iFryJ4i5LKGFNEUHtXkavDrcgcA="
 
 
 os:
--- a/third_party/rust/backtrace/Cargo.toml
+++ b/third_party/rust/backtrace/Cargo.toml
@@ -1,87 +1,81 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "backtrace"
-version = "0.3.2"
-authors = ["Alex Crichton <alex@alexcrichton.com>",
-           "The Rust Project Developers"]
-license = "MIT/Apache-2.0"
-readme = "README.md"
-repository = "https://github.com/alexcrichton/backtrace-rs"
+version = "0.3.3"
+authors = ["Alex Crichton <alex@alexcrichton.com>", "The Rust Project Developers"]
+description = "A library to acquire a stack trace (backtrace) at runtime in a Rust program.\n"
 homepage = "https://github.com/alexcrichton/backtrace-rs"
 documentation = "http://alexcrichton.com/backtrace-rs"
-description = """
-A library to acquire a stack trace (backtrace) at runtime in a Rust program.
-"""
-[dependencies]
-libc = "0.2"
-cfg-if = "0.1"
-rustc-demangle = "0.1.4"
+readme = "README.md"
+license = "MIT/Apache-2.0"
+repository = "https://github.com/alexcrichton/backtrace-rs"
+[dependencies.cpp_demangle]
+version = "0.2.3"
+optional = true
+default-features = false
 
-# Optionally enable the ability to serialize a `Backtrace`
-serde = { version = "1.0", optional = true }
-serde_derive = { version = "1.0", optional = true }
-rustc-serialize = { version = "0.3", optional = true }
-
-# Optionally demangle C++ frames' symbols in backtraces.
-cpp_demangle = { default-features = false, version = "0.2.3", optional = true }
+[dependencies.serde_derive]
+version = "1.0"
+optional = true
 
-[target.'cfg(windows)'.dependencies]
-dbghelp-sys = { version = "0.2", optional = true }
-kernel32-sys = { version = "0.2", optional = true }
-winapi = { version = "0.2.5", optional = true }
+[dependencies.serde]
+version = "1.0"
+optional = true
 
-[target.'cfg(all(unix, not(target_os = "emscripten"), not(target_os = "macos"), not(target_os = "ios")))'.dependencies]
-backtrace-sys = { path = "backtrace-sys", version = "0.1.3", optional = true }
+[dependencies.rustc-demangle]
+version = "0.1.4"
 
-# Each feature controls the two phases of finding a backtrace: getting a
-# backtrace and then resolving instruction pointers to symbols. The default
-# feature enables all the necessary features for each platform this library
-# supports, but it can be disabled to have finer grained control over the
-# dependencies.
-#
-# Note that not all features are available on all platforms, so even though a
-# feature is enabled some other feature may be used instead.
-[features]
-default = ["libunwind", "libbacktrace", "coresymbolication", "dladdr", "dbghelp"]
+[dependencies.cfg-if]
+version = "0.1"
+
+[dependencies.findshlibs]
+version = "0.3.3"
+optional = true
+
+[dependencies.rustc-serialize]
+version = "0.3"
+optional = true
 
-    #=======================================
-    # Methods of acquiring a backtrace
-    #
-    # - libunwind: when using this the libgcc library is linked against to get
-    #   the unwinding support. This is generally the most reliable method to get
-    #   a backtrace on unix.
-    # - unix-backtrace: this uses the backtrace(3) function to acquire a
-    #   backtrace, but is not as reliable as libunwind. It is, however,
-    #   generally found in more locations.
-    # - dbghelp: on windows this enables usage of dbghelp.dll to find a
-    #   backtrace at runtime
-    # - kernel32: on windows this enables using RtlCaptureStackBackTrace as the
-    #   function to acquire a backtrace
-    libunwind = []
-    unix-backtrace = []
-    dbghelp = ["kernel32-sys", "winapi", "dbghelp-sys"]
-    kernel32 = []
+[dependencies.addr2line]
+version = "0.5.0"
+optional = true
 
-    #=======================================
-    # Methods of resolving symbols
-    #
-    # - libbacktrace: this feature activates the `backtrace-sys` dependency,
-    #   building the libbacktrace library found in gcc repos. This library
-    #   parses the DWARF info of ELF executables to find symbol names, and it
-    #   can also provide filename/line number information if debuginfo is
-    #   compiled in. This library currently only primarily works on unixes that
-    #   are not OSX, however.
-    # - dladdr: this feature uses the dladdr(3) function (a glibc extension) to
-    #   resolve symbol names. This is fairly unreliable on linux, but works well
-    #   enough on OSX.
-    # - coresymbolication: this feature uses the undocumented core symbolication
-    #   framework on OS X to symbolize.
-    libbacktrace = ["backtrace-sys"]
-    dladdr = []
-    coresymbolication = []
+[features]
+gimli-symbolize = ["addr2line", "findshlibs"]
+coresymbolication = []
+dladdr = []
+kernel32 = []
+unix-backtrace = []
+dbghelp = ["kernel32-sys", "winapi", "dbghelp-sys"]
+default = ["libunwind", "libbacktrace", "coresymbolication", "dladdr", "dbghelp"]
+libunwind = []
+serialize-rustc = ["rustc-serialize"]
+libbacktrace = ["backtrace-sys"]
+serialize-serde = ["serde", "serde_derive"]
+[target."cfg(windows)".dependencies.dbghelp-sys]
+version = "0.2"
+optional = true
 
-    #=======================================
-    # Methods of serialization
-    #
-    # Various features used for enabling rustc-serialize or syntex codegen.
-    serialize-rustc = ["rustc-serialize"]
-    serialize-serde = ["serde", "serde_derive"]
+[target."cfg(windows)".dependencies.winapi]
+version = "0.2.5"
+optional = true
+
+[target."cfg(windows)".dependencies.kernel32-sys]
+version = "0.2"
+optional = true
+[target."cfg(all(unix, not(target_os = \"emscripten\"), not(target_os = \"macos\"), not(target_os = \"ios\")))".dependencies.backtrace-sys]
+version = "0.1.3"
+optional = true
+[target."cfg(unix)".dependencies.libc]
+version = "0.2"
--- a/third_party/rust/backtrace/src/backtrace/mod.rs
+++ b/third_party/rust/backtrace/src/backtrace/mod.rs
@@ -31,17 +31,17 @@ use std::os::raw::c_void;
 /// fn main() {
 ///     backtrace::trace(|frame| {
 ///         // ...
 ///
 ///         true // continue the backtrace
 ///     });
 /// }
 /// ```
-#[inline(never)] // if this is never inlined then the first frame can be konwn
+#[inline(never)] // if this is never inlined then the first frame can be known
                  // to be skipped
 pub fn trace<F: FnMut(&Frame) -> bool>(mut cb: F) {
     trace_imp(&mut cb)
 }
 
 /// A trait representing one frame of a backtrace, yielded to the `trace`
 /// function of this crate.
 ///
@@ -85,16 +85,17 @@ impl fmt::Debug for Frame {
             .field("symbol_address", &self.symbol_address())
             .finish()
     }
 }
 
 cfg_if! {
     if #[cfg(all(unix,
                  not(target_os = "emscripten"),
+                 not(all(target_os = "ios", target_arch = "arm")),
                  feature = "libunwind"))] {
         mod libunwind;
         use self::libunwind::trace as trace_imp;
         use self::libunwind::Frame as FrameImp;
     } else if #[cfg(all(unix,
                         not(target_os = "emscripten"),
                         feature = "unix-backtrace"))] {
         mod unix_backtrace;
--- a/third_party/rust/backtrace/src/backtrace/unix_backtrace.rs
+++ b/third_party/rust/backtrace/src/backtrace/unix_backtrace.rs
@@ -20,17 +20,17 @@ impl Frame {
     pub fn symbol_address(&self) -> *mut c_void { self.addr }
 }
 
 extern {
     fn backtrace(buf: *mut *mut c_void, sz: c_int) -> c_int;
 }
 
 #[inline(always)]
-pub fn trace(mut cb: &mut FnMut(&super::Frame) -> bool) {
+pub fn trace(cb: &mut FnMut(&super::Frame) -> bool) {
     const SIZE: usize = 100;
 
     let mut buf: [*mut c_void; SIZE];
     let cnt;
     unsafe {
         buf = mem::zeroed();
         cnt = backtrace(buf.as_mut_ptr(), SIZE as c_int);
     }
--- a/third_party/rust/backtrace/src/capture.rs
+++ b/third_party/rust/backtrace/src/capture.rs
@@ -21,17 +21,17 @@ pub struct Backtrace {
 /// This type is returned as a list from `Backtrace::frames` and represents one
 /// stack frame in a captured backtrace.
 #[derive(Clone)]
 #[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
 #[cfg_attr(feature = "serialize-serde", derive(Deserialize, Serialize))]
 pub struct BacktraceFrame {
     ip: usize,
     symbol_address: usize,
-    symbols: Vec<BacktraceSymbol>,
+    symbols: Option<Vec<BacktraceSymbol>>,
 }
 
 /// Captured version of a symbol in a backtrace.
 ///
 /// This type is returned as a list from `BacktraceFrame::symbols` and
 /// represents the metadata for a symbol in a backtrace.
 #[derive(Clone)]
 #[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))]
@@ -44,57 +44,92 @@ pub struct BacktraceSymbol {
 }
 
 impl Backtrace {
     /// Captures a backtrace at the callsite of this function, returning an
     /// owned representation.
     ///
     /// This function is useful for representing a backtrace as an object in
     /// Rust. This returned value can be sent across threads and printed
-    /// elsewhere, and thie purpose of this value is to be entirely self
+    /// elsewhere, and the purpose of this value is to be entirely self
     /// contained.
     ///
     /// # Examples
     ///
     /// ```
     /// use backtrace::Backtrace;
     ///
     /// let current_backtrace = Backtrace::new();
     /// ```
     pub fn new() -> Backtrace {
+        let mut bt = Backtrace::new_unresolved();
+        bt.resolve();
+        return bt
+    }
+
+    /// Similar to `new` except that this does not resolve any symbols, this
+    /// simply captures the backtrace as a list of addresses.
+    ///
+    /// At a later time the `resolve` function can be called to resolve this
+    /// backtrace's symbols into readable names. This function exists because
+    /// the resolution process can sometimes take a significant amount of time
+    /// whereas any one backtrace may only be rarely printed.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use backtrace::Backtrace;
+    ///
+    /// let mut current_backtrace = Backtrace::new_unresolved();
+    /// println!("{:?}", current_backtrace); // no symbol names
+    /// current_backtrace.resolve();
+    /// println!("{:?}", current_backtrace); // symbol names now present
+    /// ```
+    pub fn new_unresolved() -> Backtrace {
         let mut frames = Vec::new();
         trace(|frame| {
-            let mut symbols = Vec::new();
-            resolve(frame.ip(), |symbol| {
-                symbols.push(BacktraceSymbol {
-                    name: symbol.name().map(|m| m.as_bytes().to_vec()),
-                    addr: symbol.addr().map(|a| a as usize),
-                    filename: symbol.filename().map(|m| m.to_path_buf()),
-                    lineno: symbol.lineno(),
-                });
-            });
             frames.push(BacktraceFrame {
                 ip: frame.ip() as usize,
                 symbol_address: frame.symbol_address() as usize,
-                symbols: symbols,
+                symbols: None,
             });
             true
         });
 
         Backtrace { frames: frames }
     }
 
     /// Returns the frames from when this backtrace was captured.
     ///
     /// The first entry of this slice is likely the function `Backtrace::new`,
     /// and the last frame is likely something about how this thread or the main
     /// function started.
     pub fn frames(&self) -> &[BacktraceFrame] {
         &self.frames
     }
+
+    /// If this backtrace was created from `new_unresolved` then this function
+    /// will resolve all addresses in the backtrace to their symbolic names.
+    ///
+    /// If this backtrace has been previously resolved or was created through
+    /// `new`, this function does nothing.
+    pub fn resolve(&mut self) {
+        for frame in self.frames.iter_mut().filter(|f| f.symbols.is_none()) {
+            let mut symbols = Vec::new();
+            resolve(frame.ip as *mut _, |symbol| {
+                symbols.push(BacktraceSymbol {
+                    name: symbol.name().map(|m| m.as_bytes().to_vec()),
+                    addr: symbol.addr().map(|a| a as usize),
+                    filename: symbol.filename().map(|m| m.to_path_buf()),
+                    lineno: symbol.lineno(),
+                });
+            });
+            frame.symbols = Some(symbols);
+        }
+    }
 }
 
 impl From<Vec<BacktraceFrame>> for Backtrace {
     fn from(frames: Vec<BacktraceFrame>) -> Self {
         Backtrace {
             frames: frames
         }
     }
@@ -111,27 +146,28 @@ impl BacktraceFrame {
     pub fn ip(&self) -> *mut c_void {
         self.ip as *mut c_void
     }
 
     /// Same as `Frame::symbol_address`
     pub fn symbol_address(&self) -> *mut c_void {
         self.symbol_address as *mut c_void
     }
-}
 
-impl BacktraceFrame {
     /// Returns the list of symbols that this frame corresponds to.
     ///
     /// Normally there is only one symbol per frame, but sometimes if a number
     /// of functions are inlined into one frame then multiple symbols will be
     /// returned. The first symbol listed is the "innermost function", whereas
     /// the last symbol is the outermost (last caller).
+    ///
+    /// Note that if this frame came from an unresolved backtrace then this will
+    /// return an empty list.
     pub fn symbols(&self) -> &[BacktraceSymbol] {
-        &self.symbols
+        self.symbols.as_ref().map(|s| &s[..]).unwrap_or(&[])
     }
 }
 
 impl BacktraceSymbol {
     /// Same as `Symbol::name`
     pub fn name(&self) -> Option<SymbolName> {
         self.name.as_ref().map(|s| SymbolName::new(s))
     }
@@ -157,21 +193,28 @@ impl fmt::Debug for Backtrace {
         let hex_width = mem::size_of::<usize>() * 2 + 2;
 
         try!(write!(fmt, "stack backtrace:"));
 
         for (idx, frame) in self.frames().iter().enumerate() {
             let ip = frame.ip();
             try!(write!(fmt, "\n{:4}: {:2$?}", idx, ip, hex_width));
 
-            if frame.symbols.len() == 0 {
+            let symbols = match frame.symbols {
+                Some(ref s) => s,
+                None => {
+                    try!(write!(fmt, " - <unresolved>"));
+                    continue
+                }
+            };
+            if symbols.len() == 0 {
                 try!(write!(fmt, " - <no info>"));
             }
 
-            for (idx, symbol) in frame.symbols().iter().enumerate() {
+            for (idx, symbol) in symbols.iter().enumerate() {
                 if idx != 0 {
                     try!(write!(fmt, "\n      {:1$}", "", hex_width));
                 }
 
                 if let Some(name) = symbol.name() {
                     try!(write!(fmt, " - {}", name));
                 } else {
                     try!(write!(fmt, " - <unknown>"));
--- a/third_party/rust/backtrace/src/lib.rs
+++ b/third_party/rust/backtrace/src/lib.rs
@@ -20,17 +20,17 @@
 //! # Platform Support
 //!
 //! Currently this library is verified to work on Linux, OSX, and Windows, but
 //! it may work on other platforms as well. Note that the quality of the
 //! backtrace may vary across platforms.
 //!
 //! # API Principles
 //!
-//! This library attempts to be as flexible as possible to accomodate different
+//! This library attempts to be as flexible as possible to accommodate different
 //! backend implementations of acquiring a backtrace. Consequently the currently
 //! exported functions are closure-based as opposed to the likely expected
 //! iterator-based versions. This is done due to limitations of the underlying
 //! APIs used from the system.
 //!
 //! # Usage
 //!
 //! First, add this to your Cargo.toml
@@ -64,39 +64,46 @@
 //!     });
 //! }
 //! ```
 
 #![doc(html_root_url = "http://alexcrichton.com/backtrace-rs")]
 #![deny(missing_docs)]
 #![deny(warnings)]
 
+#[cfg(unix)]
 extern crate libc;
 #[cfg(all(windows, feature = "kernel32-sys"))] extern crate kernel32;
 #[cfg(all(windows, feature = "winapi"))] extern crate winapi;
 #[cfg(all(windows, feature = "dbghelp"))] extern crate dbghelp;
 
-#[cfg(feature = "serde")]
-extern crate serde;
-
 #[cfg(feature = "serde_derive")]
 #[cfg_attr(feature = "serde_derive", macro_use)]
 extern crate serde_derive;
 
 #[cfg(feature = "rustc-serialize")]
 extern crate rustc_serialize;
 
 #[macro_use]
 extern crate cfg_if;
 
 extern crate rustc_demangle;
 
 #[cfg(feature = "cpp_demangle")]
 extern crate cpp_demangle;
 
+#[cfg(all(feature = "gimli-symbolize",
+          unix,
+          target_os = "linux"))]
+extern crate addr2line;
+#[cfg(all(feature = "gimli-symbolize",
+          unix,
+          target_os = "linux"))]
+extern crate findshlibs;
+
 #[allow(dead_code)] // not used everywhere
 #[cfg(unix)]
 #[macro_use]
 mod dylib;
 
 pub use backtrace::{trace, Frame};
 mod backtrace;
 
--- a/third_party/rust/backtrace/src/symbolize/dbghelp.rs
+++ b/third_party/rust/backtrace/src/symbolize/dbghelp.rs
@@ -65,18 +65,25 @@ pub fn resolve(addr: *mut c_void, cb: &m
         let mut displacement = 0u64;
         let ret = ::dbghelp::SymFromAddrW(kernel32::GetCurrentProcess(),
                                           addr as DWORD64,
                                           &mut displacement,
                                           info);
         if ret != TRUE {
             return
         }
+
+        // If the symbol name is greater than MaxNameLen, SymFromAddrW will
+        // give a buffer of (MaxNameLen - 1) characters and set NameLen to
+        // the real value.
+        let name_len = ::std::cmp::min(info.NameLen as usize,
+                                       info.MaxNameLen as usize - 1);
+
         let name = slice::from_raw_parts(info.Name.as_ptr() as *const u16,
-                                         info.NameLen as usize);
+                                         name_len);
         let name = OsString::from_wide(name);
 
         let mut line = mem::zeroed::<IMAGEHLP_LINEW64>();
         line.SizeOfStruct = mem::size_of::<IMAGEHLP_LINEW64>() as DWORD;
         let mut displacement = 0;
         let ret = ::dbghelp::SymGetLineFromAddrW64(kernel32::GetCurrentProcess(),
                                                    addr as DWORD64,
                                                    &mut displacement,
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace/src/symbolize/gimli.rs
@@ -0,0 +1,170 @@
+use addr2line;
+use findshlibs::{self, Segment, SharedLibrary};
+use std::cell::RefCell;
+use std::env;
+use std::os::raw::c_void;
+use std::path::{Path, PathBuf};
+use std::u32;
+
+use SymbolName;
+
+const MAPPINGS_CACHE_SIZE: usize = 4;
+
+thread_local! {
+    // A very small, very simple LRU cache for debug info mappings.
+    //
+    // The hit rate should be very high, since the typical stack doesn't cross
+    // between many shared libraries.
+    //
+    // The `addr2line::Mapping` structures are pretty expensive to create. Its
+    // cost is expected to be amortized by subsequent `locate` queries, which
+    // leverage the structures built when constructing `addr2line::Mapping`s to
+    // get nice speedups. If we didn't have this cache, that amortization would
+    // never happen, and symbolicating backtraces would be ssssllllooooowwww.
+    static MAPPINGS_CACHE: RefCell<Vec<(PathBuf, addr2line::Mapping)>>
+        = RefCell::new(Vec::with_capacity(MAPPINGS_CACHE_SIZE));
+}
+
+fn with_mapping_for_path<F>(path: PathBuf, mut f: F)
+where
+    F: FnMut(&mut addr2line::Mapping)
+{
+    MAPPINGS_CACHE.with(|cache| {
+        let mut cache = cache.borrow_mut();
+
+        let idx = cache.iter().position(|&(ref p, _)| p == &path);
+
+        // Invariant: after this conditional completes without early returning
+        // from an error, the cache entry for this path is at index 0.
+
+        if let Some(idx) = idx {
+            // When the mapping is already in the cache, move it to the front.
+            if idx != 0 {
+                let entry = cache.remove(idx);
+                cache.insert(0, entry);
+            }
+        } else {
+            // When the mapping is not in the cache, create a new mapping,
+            // insert it into the front of the cache, and evict the oldest cache
+            // entry if necessary.
+            let opts = addr2line::Options::default()
+                .with_functions();
+
+            let mapping = match opts.build(&path) {
+                Err(_) => return,
+                Ok(m) => m,
+            };
+
+            if cache.len() == MAPPINGS_CACHE_SIZE {
+                cache.pop();
+            }
+
+            cache.insert(0, (path, mapping));
+        }
+
+        f(&mut cache[0].1);
+    });
+}
+
+pub fn resolve(addr: *mut c_void, cb: &mut FnMut(&super::Symbol)) {
+    // First, find the file containing the segment that the given AVMA (after
+    // relocation) address falls within. Use the containing segment to compute
+    // the SVMA (before relocation) address.
+    //
+    // Note that the OS APIs that `SharedLibrary::each` is implemented with hold
+    // a lock for the duration of the `each` call, so we want to keep this
+    // section as short as possible to avoid contention with other threads
+    // capturing backtraces.
+    let addr = findshlibs::Avma(addr as *mut u8 as *const u8);
+    let mut so_info = None;
+    findshlibs::TargetSharedLibrary::each(|so| {
+        use findshlibs::IterationControl::*;
+
+        for segment in so.segments() {
+            if segment.contains_avma(so, addr) {
+                let addr = so.avma_to_svma(addr);
+                let path = so.name().to_string_lossy();
+                so_info = Some((addr, path.to_string()));
+                return Break;
+            }
+        }
+
+        Continue
+    });
+    let (addr, path) = match so_info {
+        None => return,
+        Some((a, p)) => (a, p),
+    };
+
+    // Second, fixup the path. Empty path means that this address falls within
+    // the main executable, not a shared library.
+    let path = if path.is_empty() {
+        match env::current_exe() {
+            Err(_) => return,
+            Ok(p) => p,
+        }
+    } else {
+        PathBuf::from(path)
+    };
+
+    // Finally, get a cached mapping or create a new mapping for this file, and
+    // evaluate the DWARF info to find the file/line/name for this address.
+    with_mapping_for_path(path, |mapping| {
+        let (file, line, func) = match mapping.locate(addr.0 as u64) {
+            Ok(None) | Err(_) => return,
+            Ok(Some((file, line, func))) => (file, line, func),
+        };
+
+        let sym = super::Symbol {
+            inner: Symbol::new(addr.0 as usize,
+                               file,
+                               line,
+                               func.map(|f| f.to_string()))
+        };
+
+        cb(&sym);
+    });
+}
+
+pub struct Symbol {
+    addr: usize,
+    file: PathBuf,
+    line: Option<u64>,
+    name: Option<String>,
+}
+
+impl Symbol {
+    fn new(addr: usize,
+           file: PathBuf,
+           line: Option<u64>,
+           name: Option<String>)
+           -> Symbol {
+        Symbol {
+            addr,
+            file,
+            line,
+            name,
+        }
+    }
+
+    pub fn name(&self) -> Option<SymbolName> {
+        self.name.as_ref().map(|s| SymbolName::new(s.as_bytes()))
+    }
+
+    pub fn addr(&self) -> Option<*mut c_void> {
+        Some(self.addr as *mut c_void)
+    }
+
+    pub fn filename(&self) -> Option<&Path> {
+        Some(self.file.as_ref())
+    }
+
+    pub fn lineno(&self) -> Option<u32> {
+        self.line
+            .and_then(|l| if l > (u32::MAX as u64) {
+                None
+            } else {
+                Some(l as u32)
+            })
+    }
+}
--- a/third_party/rust/backtrace/src/symbolize/mod.rs
+++ b/third_party/rust/backtrace/src/symbolize/mod.rs
@@ -12,17 +12,17 @@ use rustc_demangle::{try_demangle, Deman
 /// This function will look up the given address in areas such as the local
 /// symbol table, dynamic symbol table, or DWARF debug info (depending on the
 /// activated implementation) to find symbols to yield.
 ///
 /// The closure may not be called if resolution could not be performed, and it
 /// also may be called more than once in the case of inlined functions.
 ///
 /// Symbols yielded represent the execution at the specified `addr`, returning
-/// file/line pairs for that addres (if available).
+/// file/line pairs for that address (if available).
 ///
 /// # Example
 ///
 /// ```
 /// extern crate backtrace;
 ///
 /// fn main() {
 ///     backtrace::trace(|frame| {
@@ -41,17 +41,17 @@ pub fn resolve<F: FnMut(&Symbol)>(addr: 
 }
 
 /// A trait representing the resolution of a symbol in a file.
 ///
 /// This trait is yielded as a trait object to the closure given to the
 /// `backtrace::resolve` function, and it is virtually dispatched as it's
 /// unknown which implementation is behind it.
 ///
-/// A symbol can give contextual information about a funciton, for example the
+/// A symbol can give contextual information about a function, for example the
 /// name, filename, line number, precise address, etc. Not all information is
 /// always available in a symbol, however, so all methods return an `Option`.
 pub struct Symbol {
     inner: SymbolImp,
 }
 
 impl Symbol {
     /// Returns the name of this function.
@@ -250,16 +250,22 @@ cfg_if! {
     }
 }
 
 cfg_if! {
     if #[cfg(all(windows, feature = "dbghelp"))] {
         mod dbghelp;
         use self::dbghelp::resolve as resolve_imp;
         use self::dbghelp::Symbol as SymbolImp;
+    } else if #[cfg(all(feature = "gimli-symbolize",
+                        unix,
+                        target_os = "linux"))] {
+        mod gimli;
+        use self::gimli::resolve as resolve_imp;
+        use self::gimli::Symbol as SymbolImp;
     } else if #[cfg(all(feature = "libbacktrace",
                         unix,
                         not(target_os = "emscripten"),
                         not(target_os = "macos"),
                         not(target_os = "ios")))] {
         mod libbacktrace;
         use self::libbacktrace::resolve as resolve_imp;
         use self::libbacktrace::Symbol as SymbolImp;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/backtrace/tests/long_fn_name.rs
@@ -0,0 +1,56 @@
+extern crate backtrace;
+
+#[cfg(all(windows, feature = "dbghelp"))]
+extern crate winapi;
+
+use backtrace::Backtrace;
+
+// 50-character module name
+mod _234567890_234567890_234567890_234567890_234567890 {
+    // 50-character struct name
+    #[allow(non_camel_case_types)]
+    pub struct _234567890_234567890_234567890_234567890_234567890<T>(T);
+    impl<T> _234567890_234567890_234567890_234567890_234567890<T> {
+        #[allow(dead_code)]
+        pub fn new() -> ::Backtrace {
+            ::Backtrace::new()
+        }
+    }
+}
+
+// Long function names must be truncated to (MAX_SYM_NAME - 1) characters.
+// Only run this test for msvc, since gnu prints "<no info>" for all frames.
+#[test]
+#[cfg(all(windows, feature = "dbghelp", target_env = "msvc"))]
+fn test_long_fn_name() {
+    use _234567890_234567890_234567890_234567890_234567890::
+        _234567890_234567890_234567890_234567890_234567890 as S;
+
+    // 10 repetitions of struct name, so fully qualified function name is
+    // atleast 10 * (50 + 50) * 2 = 2000 characters long.
+    // It's actually longer since it also includes `::`, `<>` and the
+    // name of the current module
+    let bt = S::<S<S<S<S<S<S<S<S<S<i32>>>>>>>>>>::new();
+    println!("{:?}", bt);
+
+    let mut found_long_name_frame = false;
+
+    for frame in bt.frames() {
+        let symbols = frame.symbols();
+        if symbols.is_empty() {
+            continue;
+        }
+
+        if let Some(function_name) = symbols[0].name() {
+            let function_name = function_name.as_str().unwrap();
+            if function_name.contains(
+                "::_234567890_234567890_234567890_234567890_234567890")
+            {
+                found_long_name_frame = true;
+                assert_eq!(function_name.len(), winapi::MAX_SYM_NAME - 1);
+            }
+        }
+    }
+
+    assert!(found_long_name_frame);
+}
--- a/third_party/rust/backtrace/tests/smoke.rs
+++ b/third_party/rust/backtrace/tests/smoke.rs
@@ -7,16 +7,19 @@ static LIBUNWIND: bool = cfg!(all(unix, 
 static UNIX_BACKTRACE: bool = cfg!(all(unix, feature = "unix-backtrace"));
 static LIBBACKTRACE: bool = cfg!(all(unix, feature = "libbacktrace")) &&
                             !cfg!(target_os = "macos") && !cfg!(target_os = "ios");
 static CORESYMBOLICATION: bool = cfg!(all(any(target_os = "macos", target_os = "ios"),
                                           feature = "coresymbolication"));
 static DLADDR: bool = cfg!(all(unix, feature = "dladdr"));
 static DBGHELP: bool = cfg!(all(windows, feature = "dbghelp"));
 static MSVC: bool = cfg!(target_env = "msvc");
+static GIMLI_SYMBOLIZE: bool = cfg!(all(feature = "gimli-symbolize",
+                                        unix,
+                                        target_os = "linux"));
 
 #[test]
 fn smoke_test_frames() {
     frame_1(line!());
     #[inline(never)] fn frame_1(start_line: u32) { frame_2(start_line) }
     #[inline(never)] fn frame_2(start_line: u32) { frame_3(start_line) }
     #[inline(never)] fn frame_3(start_line: u32) { frame_4(start_line) }
     #[inline(never)] fn frame_4(start_line: u32) {
@@ -66,17 +69,17 @@ fn smoke_test_frames() {
 
         // windows dbghelp is *quite* liberal (and wrong) in many of its reports
         // right now...
         if !DBGHELP {
             assert!(sym - actual_fn_pointer < 1024);
         }
 
         let mut resolved = 0;
-        let can_resolve = DLADDR || LIBBACKTRACE || CORESYMBOLICATION || DBGHELP;
+        let can_resolve = DLADDR || LIBBACKTRACE || CORESYMBOLICATION || DBGHELP || GIMLI_SYMBOLIZE;
 
         let mut name = None;
         let mut addr = None;
         let mut line = None;
         let mut file = None;
         backtrace::resolve(ip as *mut c_void, |sym| {
             resolved += 1;
             name = sym.name().map(|v| v.to_string());
copy from third_party/rust/base64/.cargo-checksum.json
copy to third_party/rust/base64-0.5.2/.cargo-checksum.json
copy from third_party/rust/base64/Cargo.toml
copy to third_party/rust/base64-0.5.2/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/base64-0.5.2/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/base64-0.5.2/LICENSE-MIT
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Alice Maz
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
copy from third_party/rust/base64/README.md
copy to third_party/rust/base64-0.5.2/README.md
copy from third_party/rust/base64/benches/benchmarks.rs
copy to third_party/rust/base64-0.5.2/benches/benchmarks.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/base64-0.5.2/examples/make_tables.rs
@@ -0,0 +1,73 @@
+use std::collections::HashMap;
+use std::iter::Iterator;
+
+fn main() {
+    println!("pub const INVALID_VALUE: u8 = 255;");
+
+    // A-Z
+    let standard_alphabet: Vec<u8> = (0x41..0x5B)
+        // a-z
+        .chain(0x61..0x7B)
+        // 0-9
+        .chain(0x30..0x3A)
+        // +
+        .chain(0x2B..0x2C)
+        // /
+        .chain(0x2F..0x30)
+        .collect();
+    print_encode_table(&standard_alphabet, "STANDARD_ENCODE", 0);
+    print_decode_table(&standard_alphabet, "STANDARD_DECODE", 0);
+
+    // A-Z
+    let url_alphabet: Vec<u8> = (0x41..0x5B)
+        // a-z
+        .chain(0x61..0x7B)
+        // 0-9
+        .chain(0x30..0x3A)
+        // -
+        .chain(0x2D..0x2E)
+        // _s
+        .chain(0x5F..0x60)
+        .collect();
+    print_encode_table(&url_alphabet, "URL_SAFE_ENCODE", 0);
+    print_decode_table(&url_alphabet, "URL_SAFE_DECODE", 0);
+
+}
+
+fn print_encode_table(alphabet: &[u8], const_name: &str, indent_depth: usize) {
+    println!("{:width$}pub const {}: &'static [u8; 64] = &[", "", const_name, width=indent_depth);
+
+    for (i, b) in alphabet.iter().enumerate() {
+        println!("{:width$}{}, // input {} (0x{:X}) => '{}' (0x{:X})", "",
+                 b, i, i, String::from_utf8(vec!(*b as u8)).unwrap(), b, width=indent_depth + 4);
+    }
+
+    println!("{:width$}];", "", width=indent_depth);
+}
+
+fn print_decode_table(alphabet: &[u8], const_name: &str, indent_depth: usize) {
+    // map of alphabet bytes to 6-bit morsels
+    let mut input_to_morsel = HashMap::<u8, u8>::new();
+
+    // standard base64 alphabet bytes, in order
+    for (morsel, ascii_byte) in alphabet.iter().enumerate() {
+        // truncation cast is fine here
+        let _ = input_to_morsel.insert(*ascii_byte, morsel as u8);
+    }
+
+    println!("{:width$}pub const {}: &'static [u8; 256] = &[", "", const_name, width=indent_depth);
+    for ascii_byte in 0..256 {
+        let (value, comment) = match input_to_morsel.get(&(ascii_byte as u8)) {
+            None => ("INVALID_VALUE".to_string(),
+                    format!("input {} (0x{:X})", ascii_byte, ascii_byte)),
+            Some(v) => (format!("{}", *v),
+                        format!("input {} (0x{:X} char '{}') => {} (0x{:X})",
+                                ascii_byte,
+                                ascii_byte,
+                                String::from_utf8(vec!(ascii_byte as u8)).unwrap(), *v, *v))
+        };
+
+        println!("{:width$}{}, // {}", "", value, comment, width=indent_depth + 4);
+    }
+    println!("{:width$}];", "", width=indent_depth);
+}
copy from third_party/rust/base64/src/lib.rs
copy to third_party/rust/base64-0.5.2/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/base64-0.5.2/src/tables.rs
@@ -0,0 +1,649 @@
+pub const INVALID_VALUE: u8 = 255;
+pub const STANDARD_ENCODE: &'static [u8; 64] = &[
+    65, // input 0 (0x0) => 'A' (0x41)
+    66, // input 1 (0x1) => 'B' (0x42)
+    67, // input 2 (0x2) => 'C' (0x43)
+    68, // input 3 (0x3) => 'D' (0x44)
+    69, // input 4 (0x4) => 'E' (0x45)
+    70, // input 5 (0x5) => 'F' (0x46)
+    71, // input 6 (0x6) => 'G' (0x47)
+    72, // input 7 (0x7) => 'H' (0x48)
+    73, // input 8 (0x8) => 'I' (0x49)
+    74, // input 9 (0x9) => 'J' (0x4A)
+    75, // input 10 (0xA) => 'K' (0x4B)
+    76, // input 11 (0xB) => 'L' (0x4C)
+    77, // input 12 (0xC) => 'M' (0x4D)
+    78, // input 13 (0xD) => 'N' (0x4E)
+    79, // input 14 (0xE) => 'O' (0x4F)
+    80, // input 15 (0xF) => 'P' (0x50)
+    81, // input 16 (0x10) => 'Q' (0x51)
+    82, // input 17 (0x11) => 'R' (0x52)
+    83, // input 18 (0x12) => 'S' (0x53)
+    84, // input 19 (0x13) => 'T' (0x54)
+    85, // input 20 (0x14) => 'U' (0x55)
+    86, // input 21 (0x15) => 'V' (0x56)
+    87, // input 22 (0x16) => 'W' (0x57)
+    88, // input 23 (0x17) => 'X' (0x58)
+    89, // input 24 (0x18) => 'Y' (0x59)
+    90, // input 25 (0x19) => 'Z' (0x5A)
+    97, // input 26 (0x1A) => 'a' (0x61)
+    98, // input 27 (0x1B) => 'b' (0x62)
+    99, // input 28 (0x1C) => 'c' (0x63)
+    100, // input 29 (0x1D) => 'd' (0x64)
+    101, // input 30 (0x1E) => 'e' (0x65)
+    102, // input 31 (0x1F) => 'f' (0x66)
+    103, // input 32 (0x20) => 'g' (0x67)
+    104, // input 33 (0x21) => 'h' (0x68)
+    105, // input 34 (0x22) => 'i' (0x69)
+    106, // input 35 (0x23) => 'j' (0x6A)
+    107, // input 36 (0x24) => 'k' (0x6B)
+    108, // input 37 (0x25) => 'l' (0x6C)
+    109, // input 38 (0x26) => 'm' (0x6D)
+    110, // input 39 (0x27) => 'n' (0x6E)
+    111, // input 40 (0x28) => 'o' (0x6F)
+    112, // input 41 (0x29) => 'p' (0x70)
+    113, // input 42 (0x2A) => 'q' (0x71)
+    114, // input 43 (0x2B) => 'r' (0x72)
+    115, // input 44 (0x2C) => 's' (0x73)
+    116, // input 45 (0x2D) => 't' (0x74)
+    117, // input 46 (0x2E) => 'u' (0x75)
+    118, // input 47 (0x2F) => 'v' (0x76)
+    119, // input 48 (0x30) => 'w' (0x77)
+    120, // input 49 (0x31) => 'x' (0x78)
+    121, // input 50 (0x32) => 'y' (0x79)
+    122, // input 51 (0x33) => 'z' (0x7A)
+    48, // input 52 (0x34) => '0' (0x30)
+    49, // input 53 (0x35) => '1' (0x31)
+    50, // input 54 (0x36) => '2' (0x32)
+    51, // input 55 (0x37) => '3' (0x33)
+    52, // input 56 (0x38) => '4' (0x34)
+    53, // input 57 (0x39) => '5' (0x35)
+    54, // input 58 (0x3A) => '6' (0x36)
+    55, // input 59 (0x3B) => '7' (0x37)
+    56, // input 60 (0x3C) => '8' (0x38)
+    57, // input 61 (0x3D) => '9' (0x39)
+    43, // input 62 (0x3E) => '+' (0x2B)
+    47, // input 63 (0x3F) => '/' (0x2F)
+];
+pub const STANDARD_DECODE: &'static [u8; 256] = &[
+    INVALID_VALUE, // input 0 (0x0)
+    INVALID_VALUE, // input 1 (0x1)
+    INVALID_VALUE, // input 2 (0x2)
+    INVALID_VALUE, // input 3 (0x3)
+    INVALID_VALUE, // input 4 (0x4)
+    INVALID_VALUE, // input 5 (0x5)
+    INVALID_VALUE, // input 6 (0x6)
+    INVALID_VALUE, // input 7 (0x7)
+    INVALID_VALUE, // input 8 (0x8)
+    INVALID_VALUE, // input 9 (0x9)
+    INVALID_VALUE, // input 10 (0xA)
+    INVALID_VALUE, // input 11 (0xB)
+    INVALID_VALUE, // input 12 (0xC)
+    INVALID_VALUE, // input 13 (0xD)
+    INVALID_VALUE, // input 14 (0xE)
+    INVALID_VALUE, // input 15 (0xF)
+    INVALID_VALUE, // input 16 (0x10)
+    INVALID_VALUE, // input 17 (0x11)
+    INVALID_VALUE, // input 18 (0x12)
+    INVALID_VALUE, // input 19 (0x13)
+    INVALID_VALUE, // input 20 (0x14)
+    INVALID_VALUE, // input 21 (0x15)
+    INVALID_VALUE, // input 22 (0x16)
+    INVALID_VALUE, // input 23 (0x17)
+    INVALID_VALUE, // input 24 (0x18)
+    INVALID_VALUE, // input 25 (0x19)
+    INVALID_VALUE, // input 26 (0x1A)
+    INVALID_VALUE, // input 27 (0x1B)
+    INVALID_VALUE, // input 28 (0x1C)
+    INVALID_VALUE, // input 29 (0x1D)
+    INVALID_VALUE, // input 30 (0x1E)
+    INVALID_VALUE, // input 31 (0x1F)
+    INVALID_VALUE, // input 32 (0x20)
+    INVALID_VALUE, // input 33 (0x21)
+    INVALID_VALUE, // input 34 (0x22)
+    INVALID_VALUE, // input 35 (0x23)
+    INVALID_VALUE, // input 36 (0x24)
+    INVALID_VALUE, // input 37 (0x25)
+    INVALID_VALUE, // input 38 (0x26)
+    INVALID_VALUE, // input 39 (0x27)
+    INVALID_VALUE, // input 40 (0x28)
+    INVALID_VALUE, // input 41 (0x29)
+    INVALID_VALUE, // input 42 (0x2A)
+    62, // input 43 (0x2B char '+') => 62 (0x3E)
+    INVALID_VALUE, // input 44 (0x2C)
+    INVALID_VALUE, // input 45 (0x2D)
+    INVALID_VALUE, // input 46 (0x2E)
+    63, // input 47 (0x2F char '/') => 63 (0x3F)
+    52, // input 48 (0x30 char '0') => 52 (0x34)
+    53, // input 49 (0x31 char '1') => 53 (0x35)
+    54, // input 50 (0x32 char '2') => 54 (0x36)
+    55, // input 51 (0x33 char '3') => 55 (0x37)
+    56, // input 52 (0x34 char '4') => 56 (0x38)
+    57, // input 53 (0x35 char '5') => 57 (0x39)
+    58, // input 54 (0x36 char '6') => 58 (0x3A)
+    59, // input 55 (0x37 char '7') => 59 (0x3B)
+    60, // input 56 (0x38 char '8') => 60 (0x3C)
+    61, // input 57 (0x39 char '9') => 61 (0x3D)
+    INVALID_VALUE, // input 58 (0x3A)
+    INVALID_VALUE, // input 59 (0x3B)
+    INVALID_VALUE, // input 60 (0x3C)
+    INVALID_VALUE, // input 61 (0x3D)
+    INVALID_VALUE, // input 62 (0x3E)
+    INVALID_VALUE, // input 63 (0x3F)
+    INVALID_VALUE, // input 64 (0x40)
+    0, // input 65 (0x41 char 'A') => 0 (0x0)
+    1, // input 66 (0x42 char 'B') => 1 (0x1)
+    2, // input 67 (0x43 char 'C') => 2 (0x2)
+    3, // input 68 (0x44 char 'D') => 3 (0x3)
+    4, // input 69 (0x45 char 'E') => 4 (0x4)
+    5, // input 70 (0x46 char 'F') => 5 (0x5)
+    6, // input 71 (0x47 char 'G') => 6 (0x6)
+    7, // input 72 (0x48 char 'H') => 7 (0x7)
+    8, // input 73 (0x49 char 'I') => 8 (0x8)
+    9, // input 74 (0x4A char 'J') => 9 (0x9)
+    10, // input 75 (0x4B char 'K') => 10 (0xA)
+    11, // input 76 (0x4C char 'L') => 11 (0xB)
+    12, // input 77 (0x4D char 'M') => 12 (0xC)
+    13, // input 78 (0x4E char 'N') => 13 (0xD)
+    14, // input 79 (0x4F char 'O') => 14 (0xE)
+    15, // input 80 (0x50 char 'P') => 15 (0xF)
+    16, // input 81 (0x51 char 'Q') => 16 (0x10)
+    17, // input 82 (0x52 char 'R') => 17 (0x11)
+    18, // input 83 (0x53 char 'S') => 18 (0x12)
+    19, // input 84 (0x54 char 'T') => 19 (0x13)
+    20, // input 85 (0x55 char 'U') => 20 (0x14)
+    21, // input 86 (0x56 char 'V') => 21 (0x15)
+    22, // input 87 (0x57 char 'W') => 22 (0x16)
+    23, // input 88 (0x58 char 'X') => 23 (0x17)
+    24, // input 89 (0x59 char 'Y') => 24 (0x18)
+    25, // input 90 (0x5A char 'Z') => 25 (0x19)
+    INVALID_VALUE, // input 91 (0x5B)
+    INVALID_VALUE, // input 92 (0x5C)
+    INVALID_VALUE, // input 93 (0x5D)
+    INVALID_VALUE, // input 94 (0x5E)
+    INVALID_VALUE, // input 95 (0x5F)
+    INVALID_VALUE, // input 96 (0x60)
+    26, // input 97 (0x61 char 'a') => 26 (0x1A)
+    27, // input 98 (0x62 char 'b') => 27 (0x1B)
+    28, // input 99 (0x63 char 'c') => 28 (0x1C)
+    29, // input 100 (0x64 char 'd') => 29 (0x1D)
+    30, // input 101 (0x65 char 'e') => 30 (0x1E)
+    31, // input 102 (0x66 char 'f') => 31 (0x1F)
+    32, // input 103 (0x67 char 'g') => 32 (0x20)
+    33, // input 104 (0x68 char 'h') => 33 (0x21)
+    34, // input 105 (0x69 char 'i') => 34 (0x22)
+    35, // input 106 (0x6A char 'j') => 35 (0x23)
+    36, // input 107 (0x6B char 'k') => 36 (0x24)
+    37, // input 108 (0x6C char 'l') => 37 (0x25)
+    38, // input 109 (0x6D char 'm') => 38 (0x26)
+    39, // input 110 (0x6E char 'n') => 39 (0x27)
+    40, // input 111 (0x6F char 'o') => 40 (0x28)
+    41, // input 112 (0x70 char 'p') => 41 (0x29)
+    42, // input 113 (0x71 char 'q') => 42 (0x2A)
+    43, // input 114 (0x72 char 'r') => 43 (0x2B)
+    44, // input 115 (0x73 char 's') => 44 (0x2C)
+    45, // input 116 (0x74 char 't') => 45 (0x2D)
+    46, // input 117 (0x75 char 'u') => 46 (0x2E)
+    47, // input 118 (0x76 char 'v') => 47 (0x2F)
+    48, // input 119 (0x77 char 'w') => 48 (0x30)
+    49, // input 120 (0x78 char 'x') => 49 (0x31)
+    50, // input 121 (0x79 char 'y') => 50 (0x32)
+    51, // input 122 (0x7A char 'z') => 51 (0x33)
+    INVALID_VALUE, // input 123 (0x7B)
+    INVALID_VALUE, // input 124 (0x7C)
+    INVALID_VALUE, // input 125 (0x7D)
+    INVALID_VALUE, // input 126 (0x7E)
+    INVALID_VALUE, // input 127 (0x7F)
+    INVALID_VALUE, // input 128 (0x80)
+    INVALID_VALUE, // input 129 (0x81)
+    INVALID_VALUE, // input 130 (0x82)
+    INVALID_VALUE, // input 131 (0x83)
+    INVALID_VALUE, // input 132 (0x84)
+    INVALID_VALUE, // input 133 (0x85)
+    INVALID_VALUE, // input 134 (0x86)
+    INVALID_VALUE, // input 135 (0x87)
+    INVALID_VALUE, // input 136 (0x88)
+    INVALID_VALUE, // input 137 (0x89)
+    INVALID_VALUE, // input 138 (0x8A)
+    INVALID_VALUE, // input 139 (0x8B)
+    INVALID_VALUE, // input 140 (0x8C)
+    INVALID_VALUE, // input 141 (0x8D)
+    INVALID_VALUE, // input 142 (0x8E)
+    INVALID_VALUE, // input 143 (0x8F)
+    INVALID_VALUE, // input 144 (0x90)
+    INVALID_VALUE, // input 145 (0x91)
+    INVALID_VALUE, // input 146 (0x92)
+    INVALID_VALUE, // input 147 (0x93)
+    INVALID_VALUE, // input 148 (0x94)
+    INVALID_VALUE, // input 149 (0x95)
+    INVALID_VALUE, // input 150 (0x96)
+    INVALID_VALUE, // input 151 (0x97)
+    INVALID_VALUE, // input 152 (0x98)
+    INVALID_VALUE, // input 153 (0x99)
+    INVALID_VALUE, // input 154 (0x9A)
+    INVALID_VALUE, // input 155 (0x9B)
+    INVALID_VALUE, // input 156 (0x9C)
+    INVALID_VALUE, // input 157 (0x9D)
+    INVALID_VALUE, // input 158 (0x9E)
+    INVALID_VALUE, // input 159 (0x9F)
+    INVALID_VALUE, // input 160 (0xA0)
+    INVALID_VALUE, // input 161 (0xA1)
+    INVALID_VALUE, // input 162 (0xA2)
+    INVALID_VALUE, // input 163 (0xA3)
+    INVALID_VALUE, // input 164 (0xA4)
+    INVALID_VALUE, // input 165 (0xA5)
+    INVALID_VALUE, // input 166 (0xA6)
+    INVALID_VALUE, // input 167 (0xA7)
+    INVALID_VALUE, // input 168 (0xA8)
+    INVALID_VALUE, // input 169 (0xA9)
+    INVALID_VALUE, // input 170 (0xAA)
+    INVALID_VALUE, // input 171 (0xAB)
+    INVALID_VALUE, // input 172 (0xAC)
+    INVALID_VALUE, // input 173 (0xAD)
+    INVALID_VALUE, // input 174 (0xAE)
+    INVALID_VALUE, // input 175 (0xAF)
+    INVALID_VALUE, // input 176 (0xB0)
+    INVALID_VALUE, // input 177 (0xB1)
+    INVALID_VALUE, // input 178 (0xB2)
+    INVALID_VALUE, // input 179 (0xB3)
+    INVALID_VALUE, // input 180 (0xB4)
+    INVALID_VALUE, // input 181 (0xB5)
+    INVALID_VALUE, // input 182 (0xB6)
+    INVALID_VALUE, // input 183 (0xB7)
+    INVALID_VALUE, // input 184 (0xB8)
+    INVALID_VALUE, // input 185 (0xB9)
+    INVALID_VALUE, // input 186 (0xBA)
+    INVALID_VALUE, // input 187 (0xBB)
+    INVALID_VALUE, // input 188 (0xBC)
+    INVALID_VALUE, // input 189 (0xBD)
+    INVALID_VALUE, // input 190 (0xBE)
+    INVALID_VALUE, // input 191 (0xBF)
+    INVALID_VALUE, // input 192 (0xC0)
+    INVALID_VALUE, // input 193 (0xC1)
+    INVALID_VALUE, // input 194 (0xC2)
+    INVALID_VALUE, // input 195 (0xC3)
+    INVALID_VALUE, // input 196 (0xC4)
+    INVALID_VALUE, // input 197 (0xC5)
+    INVALID_VALUE, // input 198 (0xC6)
+    INVALID_VALUE, // input 199 (0xC7)
+    INVALID_VALUE, // input 200 (0xC8)
+    INVALID_VALUE, // input 201 (0xC9)
+    INVALID_VALUE, // input 202 (0xCA)
+    INVALID_VALUE, // input 203 (0xCB)
+    INVALID_VALUE, // input 204 (0xCC)
+    INVALID_VALUE, // input 205 (0xCD)
+    INVALID_VALUE, // input 206 (0xCE)
+    INVALID_VALUE, // input 207 (0xCF)
+    INVALID_VALUE, // input 208 (0xD0)
+    INVALID_VALUE, // input 209 (0xD1)
+    INVALID_VALUE, // input 210 (0xD2)
+    INVALID_VALUE, // input 211 (0xD3)
+    INVALID_VALUE, // input 212 (0xD4)
+    INVALID_VALUE, // input 213 (0xD5)
+    INVALID_VALUE, // input 214 (0xD6)
+    INVALID_VALUE, // input 215 (0xD7)
+    INVALID_VALUE, // input 216 (0xD8)
+    INVALID_VALUE, // input 217 (0xD9)
+    INVALID_VALUE, // input 218 (0xDA)
+    INVALID_VALUE, // input 219 (0xDB)
+    INVALID_VALUE, // input 220 (0xDC)
+    INVALID_VALUE, // input 221 (0xDD)
+    INVALID_VALUE, // input 222 (0xDE)
+    INVALID_VALUE, // input 223 (0xDF)
+    INVALID_VALUE, // input 224 (0xE0)
+    INVALID_VALUE, // input 225 (0xE1)
+    INVALID_VALUE, // input 226 (0xE2)
+    INVALID_VALUE, // input 227 (0xE3)
+    INVALID_VALUE, // input 228 (0xE4)
+    INVALID_VALUE, // input 229 (0xE5)
+    INVALID_VALUE, // input 230 (0xE6)
+    INVALID_VALUE, // input 231 (0xE7)
+    INVALID_VALUE, // input 232 (0xE8)
+    INVALID_VALUE, // input 233 (0xE9)
+    INVALID_VALUE, // input 234 (0xEA)
+    INVALID_VALUE, // input 235 (0xEB)
+    INVALID_VALUE, // input 236 (0xEC)
+    INVALID_VALUE, // input 237 (0xED)
+    INVALID_VALUE, // input 238 (0xEE)
+    INVALID_VALUE, // input 239 (0xEF)
+    INVALID_VALUE, // input 240 (0xF0)
+    INVALID_VALUE, // input 241 (0xF1)
+    INVALID_VALUE, // input 242 (0xF2)
+    INVALID_VALUE, // input 243 (0xF3)
+    INVALID_VALUE, // input 244 (0xF4)
+    INVALID_VALUE, // input 245 (0xF5)
+    INVALID_VALUE, // input 246 (0xF6)
+    INVALID_VALUE, // input 247 (0xF7)
+    INVALID_VALUE, // input 248 (0xF8)
+    INVALID_VALUE, // input 249 (0xF9)
+    INVALID_VALUE, // input 250 (0xFA)
+    INVALID_VALUE, // input 251 (0xFB)
+    INVALID_VALUE, // input 252 (0xFC)
+    INVALID_VALUE, // input 253 (0xFD)
+    INVALID_VALUE, // input 254 (0xFE)
+    INVALID_VALUE, // input 255 (0xFF)
+];
+pub const URL_SAFE_ENCODE: &'static [u8; 64] = &[
+    65, // input 0 (0x0) => 'A' (0x41)
+    66, // input 1 (0x1) => 'B' (0x42)
+    67, // input 2 (0x2) => 'C' (0x43)
+    68, // input 3 (0x3) => 'D' (0x44)
+    69, // input 4 (0x4) => 'E' (0x45)
+    70, // input 5 (0x5) => 'F' (0x46)
+    71, // input 6 (0x6) => 'G' (0x47)
+    72, // input 7 (0x7) => 'H' (0x48)
+    73, // input 8 (0x8) => 'I' (0x49)
+    74, // input 9 (0x9) => 'J' (0x4A)
+    75, // input 10 (0xA) => 'K' (0x4B)
+    76, // input 11 (0xB) => 'L' (0x4C)
+    77, // input 12 (0xC) => 'M' (0x4D)
+    78, // input 13 (0xD) => 'N' (0x4E)
+    79, // input 14 (0xE) => 'O' (0x4F)
+    80, // input 15 (0xF) => 'P' (0x50)
+    81, // input 16 (0x10) => 'Q' (0x51)
+    82, // input 17 (0x11) => 'R' (0x52)
+    83, // input 18 (0x12) => 'S' (0x53)
+    84, // input 19 (0x13) => 'T' (0x54)
+    85, // input 20 (0x14) => 'U' (0x55)
+    86, // input 21 (0x15) => 'V' (0x56)
+    87, // input 22 (0x16) => 'W' (0x57)
+    88, // input 23 (0x17) => 'X' (0x58)
+    89, // input 24 (0x18) => 'Y' (0x59)
+    90, // input 25 (0x19) => 'Z' (0x5A)
+    97, // input 26 (0x1A) => 'a' (0x61)
+    98, // input 27 (0x1B) => 'b' (0x62)
+    99, // input 28 (0x1C) => 'c' (0x63)
+    100, // input 29 (0x1D) => 'd' (0x64)
+    101, // input 30 (0x1E) => 'e' (0x65)
+    102, // input 31 (0x1F) => 'f' (0x66)
+    103, // input 32 (0x20) => 'g' (0x67)
+    104, // input 33 (0x21) => 'h' (0x68)
+    105, // input 34 (0x22) => 'i' (0x69)
+    106, // input 35 (0x23) => 'j' (0x6A)
+    107, // input 36 (0x24) => 'k' (0x6B)
+    108, // input 37 (0x25) => 'l' (0x6C)
+    109, // input 38 (0x26) => 'm' (0x6D)
+    110, // input 39 (0x27) => 'n' (0x6E)
+    111, // input 40 (0x28) => 'o' (0x6F)
+    112, // input 41 (0x29) => 'p' (0x70)
+    113, // input 42 (0x2A) => 'q' (0x71)
+    114, // input 43 (0x2B) => 'r' (0x72)
+    115, // input 44 (0x2C) => 's' (0x73)
+    116, // input 45 (0x2D) => 't' (0x74)
+    117, // input 46 (0x2E) => 'u' (0x75)
+    118, // input 47 (0x2F) => 'v' (0x76)
+    119, // input 48 (0x30) => 'w' (0x77)
+    120, // input 49 (0x31) => 'x' (0x78)
+    121, // input 50 (0x32) => 'y' (0x79)
+    122, // input 51 (0x33) => 'z' (0x7A)
+    48, // input 52 (0x34) => '0' (0x30)
+    49, // input 53 (0x35) => '1' (0x31)
+    50, // input 54 (0x36) => '2' (0x32)
+    51, // input 55 (0x37) => '3' (0x33)
+    52, // input 56 (0x38) => '4' (0x34)
+    53, // input 57 (0x39) => '5' (0x35)
+    54, // input 58 (0x3A) => '6' (0x36)
+    55, // input 59 (0x3B) => '7' (0x37)
+    56, // input 60 (0x3C) => '8' (0x38)
+    57, // input 61 (0x3D) => '9' (0x39)
+    45, // input 62 (0x3E) => '-' (0x2D)
+    95, // input 63 (0x3F) => '_' (0x5F)
+];
+pub const URL_SAFE_DECODE: &'static [u8; 256] = &[
+    INVALID_VALUE, // input 0 (0x0)
+    INVALID_VALUE, // input 1 (0x1)
+    INVALID_VALUE, // input 2 (0x2)
+    INVALID_VALUE, // input 3 (0x3)
+    INVALID_VALUE, // input 4 (0x4)
+    INVALID_VALUE, // input 5 (0x5)
+    INVALID_VALUE, // input 6 (0x6)
+    INVALID_VALUE, // input 7 (0x7)
+    INVALID_VALUE, // input 8 (0x8)
+    INVALID_VALUE, // input 9 (0x9)
+    INVALID_VALUE, // input 10 (0xA)
+    INVALID_VALUE, // input 11 (0xB)
+    INVALID_VALUE, // input 12 (0xC)
+    INVALID_VALUE, // input 13 (0xD)
+    INVALID_VALUE, // input 14 (0xE)
+    INVALID_VALUE, // input 15 (0xF)
+    INVALID_VALUE, // input 16 (0x10)
+    INVALID_VALUE, // input 17 (0x11)
+    INVALID_VALUE, // input 18 (0x12)
+    INVALID_VALUE, // input 19 (0x13)
+    INVALID_VALUE, // input 20 (0x14)
+    INVALID_VALUE, // input 21 (0x15)
+    INVALID_VALUE, // input 22 (0x16)
+    INVALID_VALUE, // input 23 (0x17)
+    INVALID_VALUE, // input 24 (0x18)
+    INVALID_VALUE, // input 25 (0x19)
+    INVALID_VALUE, // input 26 (0x1A)
+    INVALID_VALUE, // input 27 (0x1B)
+    INVALID_VALUE, // input 28 (0x1C)
+    INVALID_VALUE, // input 29 (0x1D)
+    INVALID_VALUE, // input 30 (0x1E)
+    INVALID_VALUE, // input 31 (0x1F)
+    INVALID_VALUE, // input 32 (0x20)
+    INVALID_VALUE, // input 33 (0x21)
+    INVALID_VALUE, // input 34 (0x22)
+    INVALID_VALUE, // input 35 (0x23)
+    INVALID_VALUE, // input 36 (0x24)
+    INVALID_VALUE, // input 37 (0x25)
+    INVALID_VALUE, // input 38 (0x26)
+    INVALID_VALUE, // input 39 (0x27)
+    INVALID_VALUE, // input 40 (0x28)
+    INVALID_VALUE, // input 41 (0x29)
+    INVALID_VALUE, // input 42 (0x2A)
+    INVALID_VALUE, // input 43 (0x2B)
+    INVALID_VALUE, // input 44 (0x2C)
+    62, // input 45 (0x2D char '-') => 62 (0x3E)
+    INVALID_VALUE, // input 46 (0x2E)
+    INVALID_VALUE, // input 47 (0x2F)
+    52, // input 48 (0x30 char '0') => 52 (0x34)
+    53, // input 49 (0x31 char '1') => 53 (0x35)
+    54, // input 50 (0x32 char '2') => 54 (0x36)
+    55, // input 51 (0x33 char '3') => 55 (0x37)
+    56, // input 52 (0x34 char '4') => 56 (0x38)
+    57, // input 53 (0x35 char '5') => 57 (0x39)
+    58, // input 54 (0x36 char '6') => 58 (0x3A)
+    59, // input 55 (0x37 char '7') => 59 (0x3B)
+    60, // input 56 (0x38 char '8') => 60 (0x3C)
+    61, // input 57 (0x39 char '9') => 61 (0x3D)
+    INVALID_VALUE, // input 58 (0x3A)
+    INVALID_VALUE, // input 59 (0x3B)
+    INVALID_VALUE, // input 60 (0x3C)
+    INVALID_VALUE, // input 61 (0x3D)
+    INVALID_VALUE, // input 62 (0x3E)
+    INVALID_VALUE, // input 63 (0x3F)
+    INVALID_VALUE, // input 64 (0x40)
+    0, // input 65 (0x41 char 'A') => 0 (0x0)
+    1, // input 66 (0x42 char 'B') => 1 (0x1)
+    2, // input 67 (0x43 char 'C') => 2 (0x2)
+    3, // input 68 (0x44 char 'D') => 3 (0x3)
+    4, // input 69 (0x45 char 'E') => 4 (0x4)
+    5, // input 70 (0x46 char 'F') => 5 (0x5)
+    6, // input 71 (0x47 char 'G') => 6 (0x6)
+    7, // input 72 (0x48 char 'H') => 7 (0x7)
+    8, // input 73 (0x49 char 'I') => 8 (0x8)
+    9, // input 74 (0x4A char 'J') => 9 (0x9)
+    10, // input 75 (0x4B char 'K') => 10 (0xA)
+    11, // input 76 (0x4C char 'L') => 11 (0xB)
+    12, // input 77 (0x4D char 'M') => 12 (0xC)
+    13, // input 78 (0x4E char 'N') => 13 (0xD)
+    14, // input 79 (0x4F char 'O') => 14 (0xE)
+    15, // input 80 (0x50 char 'P') => 15 (0xF)
+    16, // input 81 (0x51 char 'Q') => 16 (0x10)
+    17, // input 82 (0x52 char 'R') => 17 (0x11)
+    18, // input 83 (0x53 char 'S') => 18 (0x12)
+    19, // input 84 (0x54 char 'T') => 19 (0x13)
+    20, // input 85 (0x55 char 'U') => 20 (0x14)
+    21, // input 86 (0x56 char 'V') => 21 (0x15)
+    22, // input 87 (0x57 char 'W') => 22 (0x16)
+    23, // input 88 (0x58 char 'X') => 23 (0x17)
+    24, // input 89 (0x59 char 'Y') => 24 (0x18)
+    25, // input 90 (0x5A char 'Z') => 25 (0x19)
+    INVALID_VALUE, // input 91 (0x5B)
+    INVALID_VALUE, // input 92 (0x5C)
+    INVALID_VALUE, // input 93 (0x5D)
+    INVALID_VALUE, // input 94 (0x5E)
+    63, // input 95 (0x5F char '_') => 63 (0x3F)
+    INVALID_VALUE, // input 96 (0x60)
+    26, // input 97 (0x61 char 'a') => 26 (0x1A)
+    27, // input 98 (0x62 char 'b') => 27 (0x1B)
+    28, // input 99 (0x63 char 'c') => 28 (0x1C)
+    29, // input 100 (0x64 char 'd') => 29 (0x1D)
+    30, // input 101 (0x65 char 'e') => 30 (0x1E)
+    31, // input 102 (0x66 char 'f') => 31 (0x1F)
+    32, // input 103 (0x67 char 'g') => 32 (0x20)
+    33, // input 104 (0x68 char 'h') => 33 (0x21)
+    34, // input 105 (0x69 char 'i') => 34 (0x22)
+    35, // input 106 (0x6A char 'j') => 35 (0x23)
+    36, // input 107 (0x6B char 'k') => 36 (0x24)
+    37, // input 108 (0x6C char 'l') => 37 (0x25)
+    38, // input 109 (0x6D char 'm') => 38 (0x26)
+    39, // input 110 (0x6E char 'n') => 39 (0x27)
+    40, // input 111 (0x6F char 'o') => 40 (0x28)
+    41, // input 112 (0x70 char 'p') => 41 (0x29)
+    42, // input 113 (0x71 char 'q') => 42 (0x2A)
+    43, // input 114 (0x72 char 'r') => 43 (0x2B)
+    44, // input 115 (0x73 char 's') => 44 (0x2C)
+    45, // input 116 (0x74 char 't') => 45 (0x2D)
+    46, // input 117 (0x75 char 'u') => 46 (0x2E)
+    47, // input 118 (0x76 char 'v') => 47 (0x2F)
+    48, // input 119 (0x77 char 'w') => 48 (0x30)
+    49, // input 120 (0x78 char 'x') => 49 (0x31)
+    50, // input 121 (0x79 char 'y') => 50 (0x32)
+    51, // input 122 (0x7A char 'z') => 51 (0x33)
+    INVALID_VALUE, // input 123 (0x7B)
+    INVALID_VALUE, // input 124 (0x7C)
+    INVALID_VALUE, // input 125 (0x7D)
+    INVALID_VALUE, // input 126 (0x7E)
+    INVALID_VALUE, // input 127 (0x7F)
+    INVALID_VALUE, // input 128 (0x80)
+    INVALID_VALUE, // input 129 (0x81)
+    INVALID_VALUE, // input 130 (0x82)
+    INVALID_VALUE, // input 131 (0x83)
+    INVALID_VALUE, // input 132 (0x84)
+    INVALID_VALUE, // input 133 (0x85)
+    INVALID_VALUE, // input 134 (0x86)
+    INVALID_VALUE, // input 135 (0x87)
+    INVALID_VALUE, // input 136 (0x88)
+    INVALID_VALUE, // input 137 (0x89)
+    INVALID_VALUE, // input 138 (0x8A)
+    INVALID_VALUE, // input 139 (0x8B)
+    INVALID_VALUE, // input 140 (0x8C)
+    INVALID_VALUE, // input 141 (0x8D)
+    INVALID_VALUE, // input 142 (0x8E)
+    INVALID_VALUE, // input 143 (0x8F)
+    INVALID_VALUE, // input 144 (0x90)
+    INVALID_VALUE, // input 145 (0x91)
+    INVALID_VALUE, // input 146 (0x92)
+    INVALID_VALUE, // input 147 (0x93)
+    INVALID_VALUE, // input 148 (0x94)
+    INVALID_VALUE, // input 149 (0x95)
+    INVALID_VALUE, // input 150 (0x96)
+    INVALID_VALUE, // input 151 (0x97)
+    INVALID_VALUE, // input 152 (0x98)
+    INVALID_VALUE, // input 153 (0x99)
+    INVALID_VALUE, // input 154 (0x9A)
+    INVALID_VALUE, // input 155 (0x9B)
+    INVALID_VALUE, // input 156 (0x9C)
+    INVALID_VALUE, // input 157 (0x9D)
+    INVALID_VALUE, // input 158 (0x9E)
+    INVALID_VALUE, // input 159 (0x9F)
+    INVALID_VALUE, // input 160 (0xA0)
+    INVALID_VALUE, // input 161 (0xA1)
+    INVALID_VALUE, // input 162 (0xA2)
+    INVALID_VALUE, // input 163 (0xA3)
+    INVALID_VALUE, // input 164 (0xA4)
+    INVALID_VALUE, // input 165 (0xA5)
+    INVALID_VALUE, // input 166 (0xA6)
+    INVALID_VALUE, // input 167 (0xA7)
+    INVALID_VALUE, // input 168 (0xA8)
+    INVALID_VALUE, // input 169 (0xA9)
+    INVALID_VALUE, // input 170 (0xAA)
+    INVALID_VALUE, // input 171 (0xAB)
+    INVALID_VALUE, // input 172 (0xAC)
+    INVALID_VALUE, // input 173 (0xAD)
+    INVALID_VALUE, // input 174 (0xAE)
+    INVALID_VALUE, // input 175 (0xAF)
+    INVALID_VALUE, // input 176 (0xB0)
+    INVALID_VALUE, // input 177 (0xB1)
+    INVALID_VALUE, // input 178 (0xB2)
+    INVALID_VALUE, // input 179 (0xB3)
+    INVALID_VALUE, // input 180 (0xB4)
+    INVALID_VALUE, // input 181 (0xB5)
+    INVALID_VALUE, // input 182 (0xB6)
+    INVALID_VALUE, // input 183 (0xB7)
+    INVALID_VALUE, // input 184 (0xB8)
+    INVALID_VALUE, // input 185 (0xB9)
+    INVALID_VALUE, // input 186 (0xBA)
+    INVALID_VALUE, // input 187 (0xBB)
+    INVALID_VALUE, // input 188 (0xBC)
+    INVALID_VALUE, // input 189 (0xBD)
+    INVALID_VALUE, // input 190 (0xBE)
+    INVALID_VALUE, // input 191 (0xBF)
+    INVALID_VALUE, // input 192 (0xC0)
+    INVALID_VALUE, // input 193 (0xC1)
+    INVALID_VALUE, // input 194 (0xC2)
+    INVALID_VALUE, // input 195 (0xC3)
+    INVALID_VALUE, // input 196 (0xC4)
+    INVALID_VALUE, // input 197 (0xC5)
+    INVALID_VALUE, // input 198 (0xC6)
+    INVALID_VALUE, // input 199 (0xC7)
+    INVALID_VALUE, // input 200 (0xC8)
+    INVALID_VALUE, // input 201 (0xC9)
+    INVALID_VALUE, // input 202 (0xCA)
+    INVALID_VALUE, // input 203 (0xCB)
+    INVALID_VALUE, // input 204 (0xCC)
+    INVALID_VALUE, // input 205 (0xCD)
+    INVALID_VALUE, // input 206 (0xCE)
+    INVALID_VALUE, // input 207 (0xCF)
+    INVALID_VALUE, // input 208 (0xD0)
+    INVALID_VALUE, // input 209 (0xD1)
+    INVALID_VALUE, // input 210 (0xD2)
+    INVALID_VALUE, // input 211 (0xD3)
+    INVALID_VALUE, // input 212 (0xD4)
+    INVALID_VALUE, // input 213 (0xD5)
+    INVALID_VALUE, // input 214 (0xD6)
+    INVALID_VALUE, // input 215 (0xD7)
+    INVALID_VALUE, // input 216 (0xD8)
+    INVALID_VALUE, // input 217 (0xD9)
+    INVALID_VALUE, // input 218 (0xDA)
+    INVALID_VALUE, // input 219 (0xDB)
+    INVALID_VALUE, // input 220 (0xDC)
+    INVALID_VALUE, // input 221 (0xDD)
+    INVALID_VALUE, // input 222 (0xDE)
+    INVALID_VALUE, // input 223 (0xDF)
+    INVALID_VALUE, // input 224 (0xE0)
+    INVALID_VALUE, // input 225 (0xE1)
+    INVALID_VALUE, // input 226 (0xE2)
+    INVALID_VALUE, // input 227 (0xE3)
+    INVALID_VALUE, // input 228 (0xE4)
+    INVALID_VALUE, // input 229 (0xE5)
+    INVALID_VALUE, // input 230 (0xE6)
+    INVALID_VALUE, // input 231 (0xE7)
+    INVALID_VALUE, // input 232 (0xE8)
+    INVALID_VALUE, // input 233 (0xE9)
+    INVALID_VALUE, // input 234 (0xEA)
+    INVALID_VALUE, // input 235 (0xEB)
+    INVALID_VALUE, // input 236 (0xEC)
+    INVALID_VALUE, // input 237 (0xED)
+    INVALID_VALUE, // input 238 (0xEE)
+    INVALID_VALUE, // input 239 (0xEF)
+    INVALID_VALUE, // input 240 (0xF0)
+    INVALID_VALUE, // input 241 (0xF1)
+    INVALID_VALUE, // input 242 (0xF2)
+    INVALID_VALUE, // input 243 (0xF3)
+    INVALID_VALUE, // input 244 (0xF4)
+    INVALID_VALUE, // input 245 (0xF5)
+    INVALID_VALUE, // input 246 (0xF6)
+    INVALID_VALUE, // input 247 (0xF7)
+    INVALID_VALUE, // input 248 (0xF8)
+    INVALID_VALUE, // input 249 (0xF9)
+    INVALID_VALUE, // input 250 (0xFA)
+    INVALID_VALUE, // input 251 (0xFB)
+    INVALID_VALUE, // input 252 (0xFC)
+    INVALID_VALUE, // input 253 (0xFD)
+    INVALID_VALUE, // input 254 (0xFE)
+    INVALID_VALUE, // input 255 (0xFF)
+];
copy from third_party/rust/base64/tests/tests.rs
copy to third_party/rust/base64-0.5.2/tests/tests.rs
--- a/third_party/rust/base64/.cargo-checksum.json
+++ b/third_party/rust/base64/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"79fbb792e6c1d05c44188c808ef7120c592e50291a706fe0f669b8ac9a2ad5e5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0dd882e53de11566d50f8e8e2d5a651bcf3fabee4987d70f306233cf39094ba7","README.md":"b2da2fd61c4f3abf45127d183b61eb2dabc1c97cd191854987aa0328549a663f","benches/benchmarks.rs":"f0469f65f901c3e92fa506c0deb277fd136a7f968cae7cc4f030c0c15e52322f","examples/make_tables.rs":"3c80f2a8cdb204168cc1b60f8904d544b2da067b9e6a7b40ade5fb4a994b4175","src/lib.rs":"a3ac363513ae99a9b0049c19c92bc46b57ac9a0ebfd3317b7b387c5fbaa16a8a","src/tables.rs":"378743892907cde87c1a92e6afee2df36ce590311e61381b2cc0404b3e018039","tests/tests.rs":"dc2c293bae576cc596bdfb6ef783dc1d24d3bf992bf532caaebe1738cb0608cc"},"package":"30e93c03064e7590d0466209155251b90c22e37fab1daf2771582598b5827557"}
\ No newline at end of file
+{"files":{"Cargo.toml":"6f4dcaea19fa469551f91670c673d9e240fee726ea78c0ab46ba7b779b3a0d31","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0dd882e53de11566d50f8e8e2d5a651bcf3fabee4987d70f306233cf39094ba7","README.md":"ac936d8d62e3aab7294e077901010ed0daf99b5f1df0569ffe197859955338c1","benches/benchmarks.rs":"9a7167a38f6f42be4ac32e723aeedcdfd8740a90775c461170a4203809e768f3","examples/make_tables.rs":"3c80f2a8cdb204168cc1b60f8904d544b2da067b9e6a7b40ade5fb4a994b4175","src/lib.rs":"cc226627c531a6d84c95f7b41dc024a26bb0b2341554b4b937baac4b591adf77","src/line_wrap.rs":"3a8f8fb96e3f63d80b87a94e8d4a235ad4e18bd3ee6413c2fd9dcd70354177b6","src/tables.rs":"378743892907cde87c1a92e6afee2df36ce590311e61381b2cc0404b3e018039","src/tests.rs":"61a54ba78255fd360f8b39ca47cefae2e5cb568b525ca1bef7e92dc127a0a485","tests/tests.rs":"80b9b3a44517baaf9bf584cf02fe521594f7993270dffeed3d1e743cf617206c"},"package":"96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9"}
\ No newline at end of file
--- a/third_party/rust/base64/Cargo.toml
+++ b/third_party/rust/base64/Cargo.toml
@@ -1,21 +1,22 @@
 [package]
 name = "base64"
-version = "0.5.2"
+version = "0.6.0"
 authors = ["Alice Maz <alice@alicemaz.com>", "Marshall Pierce <marshall@mpierce.org>"]
 description = "encodes and decodes base64 as bytes or utf8"
 repository = "https://github.com/alicemaz/rust-base64"
 documentation = "https://github.com/alicemaz/rust-base64/blob/master/README.md"
 readme = "README.md"
 keywords = ["base64", "utf8", "encode", "decode"]
 categories = ["encoding"]
-license = "MIT"
+license = "MIT/Apache-2.0"
 
 [dependencies]
 byteorder = "1.0.0"
+safemem = "0.2.0"
 
 [dev-dependencies]
 rand = "=0.3.15"
 
 [profile.bench]
 # Uncomment when using `perf record`
 #debug = true
--- a/third_party/rust/base64/README.md
+++ b/third_party/rust/base64/README.md
@@ -1,17 +1,17 @@
 [base64](https://crates.io/crates/base64)
 ===
 
 It's base64. What more could anyone want?
 
 Example
 ---
 
-In Cargo.toml: `base64 = "~0.5.0"`
+In Cargo.toml: `base64 = "~0.6.0"`
 
 ```rust
 extern crate base64;
 
 use base64::{encode, decode};
 
 fn main() {
     let a = b"hello world";
@@ -101,12 +101,26 @@ You'll see a bunch of interleaved rust s
          :
          :                  let input_chunk = BigEndian::read_u64(&input_bytes[input_index..(input_index + 8)]);
          :                  morsel = decode_table[(input_chunk >> 56) as usize];
  lib.rs:322    3.68 :     106a4:       cmp    $0xff,%r15
          :                  if morsel == decode_tables::INVALID_VALUE {
     0.00 :        106ab:       je     1090e <base64::decode_config_buf::hbf68a45fefa299c1+0x46e>
 ```
 
+
+Fuzzing
+---
+
+This uses [cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz). See `fuzz/fuzzers` for the available fuzzing scripts. To run, use an invocation like these:
+
+```
+rustup run nightly cargo fuzz run roundtrip
+rustup run nightly cargo fuzz run roundtrip_no_pad
+rustup run nightly cargo fuzz run roundtrip_mime -- -max_len=10240
+rustup run nightly cargo fuzz run roundtrip_random_config -- -max_len=10240
+```
+
+
 License
 ---
 
 This project is dual-licensed under MIT and Apache 2.0.
--- a/third_party/rust/base64/benches/benchmarks.rs
+++ b/third_party/rust/base64/benches/benchmarks.rs
@@ -1,97 +1,107 @@
 #![feature(test)]
 
 extern crate base64;
 extern crate test;
 extern crate rand;
 
-use base64::{decode, decode_config_buf, encode, encode_config_buf, STANDARD};
+use base64::{decode, decode_config_buf, encode, encode_config_buf, Config, MIME, STANDARD};
 
 use test::Bencher;
 use rand::Rng;
 
 #[bench]
 fn encode_3b(b: &mut Bencher) {
     do_encode_bench(b, 3)
 }
 
 #[bench]
 fn encode_3b_reuse_buf(b: &mut Bencher) {
-    do_encode_bench_reuse_buf(b, 3)
+    do_encode_bench_reuse_buf(b, 3, STANDARD)
 }
 
 #[bench]
 fn encode_50b(b: &mut Bencher) {
     do_encode_bench(b, 50)
 }
 
 #[bench]
 fn encode_50b_reuse_buf(b: &mut Bencher) {
-    do_encode_bench_reuse_buf(b, 50)
+    do_encode_bench_reuse_buf(b, 50, STANDARD)
 }
 
 #[bench]
 fn encode_100b(b: &mut Bencher) {
     do_encode_bench(b, 100)
 }
 
 #[bench]
 fn encode_100b_reuse_buf(b: &mut Bencher) {
-    do_encode_bench_reuse_buf(b, 100)
+    do_encode_bench_reuse_buf(b, 100, STANDARD)
 }
 
 #[bench]
 fn encode_500b(b: &mut Bencher) {
     do_encode_bench(b, 500)
 }
 
 #[bench]
 fn encode_500b_reuse_buf(b: &mut Bencher) {
-    do_encode_bench_reuse_buf(b, 500)
+    do_encode_bench_reuse_buf(b, 500, STANDARD)
+}
+
+#[bench]
+fn encode_500b_reuse_buf_mime(b: &mut Bencher) {
+    do_encode_bench_reuse_buf(b, 500, MIME)
 }
 
 #[bench]
 fn encode_3kib(b: &mut Bencher) {
     do_encode_bench(b, 3 * 1024)
 }
 
 #[bench]
 fn encode_3kib_reuse_buf(b: &mut Bencher) {
-    do_encode_bench_reuse_buf(b, 3 * 1024)
+    do_encode_bench_reuse_buf(b, 3 * 1024, STANDARD)
+}
+
+#[bench]
+fn encode_3kib_reuse_buf_mime(b: &mut Bencher) {
+    do_encode_bench_reuse_buf(b, 3 * 1024, MIME)
 }
 
 #[bench]
 fn encode_3mib(b: &mut Bencher) {
     do_encode_bench(b, 3 * 1024 * 1024)
 }
 
 #[bench]
 fn encode_3mib_reuse_buf(b: &mut Bencher) {
-    do_encode_bench_reuse_buf(b, 3 * 1024 * 1024)
+    do_encode_bench_reuse_buf(b, 3 * 1024 * 1024, STANDARD)
 }
 
 #[bench]
 fn encode_10mib(b: &mut Bencher) {
     do_encode_bench(b, 10 * 1024 * 1024)
 }
 
 #[bench]
 fn encode_10mib_reuse_buf(b: &mut Bencher) {
-    do_encode_bench_reuse_buf(b, 10 * 1024 * 1024)
+    do_encode_bench_reuse_buf(b, 10 * 1024 * 1024, STANDARD)
 }
 
 #[bench]
 fn encode_30mib(b: &mut Bencher) {
     do_encode_bench(b, 30 * 1024 * 1024)
 }
 
 #[bench]
 fn encode_30mib_reuse_buf(b: &mut Bencher) {
-    do_encode_bench_reuse_buf(b, 30 * 1024 * 1024)
+    do_encode_bench_reuse_buf(b, 30 * 1024 * 1024, STANDARD)
 }
 
 #[bench]
 fn decode_3b(b: &mut Bencher) {
     do_decode_bench(b, 3)
 }
 
 #[bench]
@@ -201,26 +211,25 @@ fn do_encode_bench(b: &mut Bencher, size
 
     b.bytes = v.len() as u64;
     b.iter(|| {
         let e = encode(&v);
         test::black_box(&e);
     });
 }
 
-fn do_encode_bench_reuse_buf(b: &mut Bencher, size: usize) {
+fn do_encode_bench_reuse_buf(b: &mut Bencher, size: usize, config: Config) {
     let mut v: Vec<u8> = Vec::with_capacity(size);
     fill(&mut v);
 
     let mut buf = String::new();
 
     b.bytes = v.len() as u64;
     b.iter(|| {
-        let e = encode_config_buf(&v, STANDARD, &mut buf);
-        test::black_box(&e);
+        encode_config_buf(&v, config, &mut buf);
         buf.clear();
     });
 }
 
 fn fill(v: &mut Vec<u8>) {
     let cap = v.capacity();
     // weak randomness is plenty; we just want to not be completely friendly to the branch predictor
     let mut r = rand::weak_rng();
--- a/third_party/rust/base64/src/lib.rs
+++ b/third_party/rust/base64/src/lib.rs
@@ -1,34 +1,63 @@
 extern crate byteorder;
 
 use std::{fmt, error, str};
 
 use byteorder::{BigEndian, ByteOrder};
 
 mod tables;
 
+mod line_wrap;
+use line_wrap::{line_wrap_parameters, line_wrap};
+
 /// Available encoding character sets
 #[derive(Clone, Copy, Debug)]
 pub enum CharacterSet {
     /// The standard character set (uses `+` and `/`)
     Standard,
     /// The URL safe character set (uses `-` and `_`)
     UrlSafe
 }
 
+impl CharacterSet {
+    fn encode_table(&self) -> &'static [u8; 64] {
+        match *self {
+            CharacterSet::Standard => tables::STANDARD_ENCODE,
+            CharacterSet::UrlSafe => tables::URL_SAFE_ENCODE
+        }
+    }
+
+    fn decode_table(&self) -> &'static [u8; 256] {
+        match *self {
+            CharacterSet::Standard => tables::STANDARD_DECODE,
+            CharacterSet::UrlSafe => tables::URL_SAFE_DECODE
+        }
+    }
+}
+
 #[derive(Clone, Copy, Debug)]
 pub enum LineEnding {
     LF,
     CRLF,
 }
 
+impl LineEnding {
+    fn len(&self) -> usize {
+        match *self {
+            LineEnding::LF => 1,
+            LineEnding::CRLF => 2
+        }
+    }
+}
+
 #[derive(Clone, Copy, Debug)]
 pub enum LineWrap {
     NoWrap,
+    // wrap length is always > 0
     Wrap(usize, LineEnding)
 }
 
 /// Contains configuration parameters for base64 encoding
 #[derive(Clone, Copy, Debug)]
 pub struct Config {
     /// Character set to use
     char_set: CharacterSet,
@@ -82,17 +111,16 @@ pub static URL_SAFE: Config = Config {
 
 pub static URL_SAFE_NO_PAD: Config = Config {
     char_set: CharacterSet::UrlSafe,
     pad: false,
     strip_whitespace: false,
     line_wrap: LineWrap::NoWrap,
 };
 
-
 #[derive(Debug, PartialEq, Eq)]
 pub enum DecodeError {
     InvalidByte(usize, u8),
     InvalidLength,
 }
 
 impl fmt::Display for DecodeError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -166,46 +194,56 @@ pub fn decode<T: ?Sized + AsRef<[u8]>>(i
 ///    let b64 = base64::encode_config(b"hello world~", base64::STANDARD);
 ///    println!("{}", b64);
 ///
 ///    let b64_url = base64::encode_config(b"hello internet~", base64::URL_SAFE);
 ///    println!("{}", b64_url);
 ///}
 ///```
 pub fn encode_config<T: ?Sized + AsRef<[u8]>>(input: &T, config: Config) -> String {
-    let mut buf = match encoded_size(input.as_ref().len(), config) {
+    let mut buf = match encoded_size(input.as_ref().len(), &config) {
         Some(n) => String::with_capacity(n),
         None => panic!("integer overflow when calculating buffer size")
     };
 
     encode_config_buf(input, config, &mut buf);
 
     buf
 }
 
 /// calculate the base64 encoded string size, including padding
-fn encoded_size(bytes_len: usize, config: Config) -> Option<usize> {
-    let printing_output_chars = bytes_len
-        .checked_add(2)
-        .map(|x| x / 3)
-        .and_then(|x| x.checked_mul(4));
+fn encoded_size(bytes_len: usize, config: &Config) -> Option<usize> {
+    let rem = bytes_len % 3;
+
+    let complete_input_chunks = bytes_len / 3;
+    let complete_chunk_output = complete_input_chunks.checked_mul(4);
 
-    //TODO this is subtly wrong but in a not dangerous way
-    //pushing patch with identical to previous behavior, then fixing
-    let line_ending_output_chars = match config.line_wrap {
-        LineWrap::NoWrap => Some(0),
-        LineWrap::Wrap(n, LineEnding::CRLF) =>
-            printing_output_chars.map(|y| y / n).and_then(|y| y.checked_mul(2)),
-        LineWrap::Wrap(n, LineEnding::LF) =>
-            printing_output_chars.map(|y| y / n),
+    let encoded_len_no_wrap = if rem > 0 {
+        if config.pad {
+            complete_chunk_output.and_then(|c| c.checked_add(4))
+        } else {
+            let encoded_rem = match rem {
+                1 => 2,
+                2 => 3,
+                _ => panic!("Impossible remainder")
+            };
+            complete_chunk_output.and_then(|c| c.checked_add(encoded_rem))
+        }
+    } else {
+        complete_chunk_output
     };
 
-    printing_output_chars.and_then(|x|
-        line_ending_output_chars.and_then(|y| x.checked_add(y))
-    )
+    encoded_len_no_wrap.map(|e| {
+        match config.line_wrap {
+            LineWrap::NoWrap => e,
+            LineWrap::Wrap(line_len, line_ending) => {
+                line_wrap_parameters(e, line_len, line_ending).total_len
+            }
+        }
+    })
 }
 
 ///Encode arbitrary octets as base64.
 ///Writes into the supplied buffer to avoid allocations.
 ///
 ///# Example
 ///
 ///```rust
@@ -218,119 +256,183 @@ fn encoded_size(bytes_len: usize, config
 ///
 ///    buf.clear();
 ///    base64::encode_config_buf(b"hello internet~", base64::URL_SAFE, &mut buf);
 ///    println!("{}", buf);
 ///}
 ///```
 pub fn encode_config_buf<T: ?Sized + AsRef<[u8]>>(input: &T, config: Config, buf: &mut String) {
     let input_bytes = input.as_ref();
-    let ref charset = match config.char_set {
-        CharacterSet::Standard => tables::STANDARD_ENCODE,
-        CharacterSet::UrlSafe => tables::URL_SAFE_ENCODE,
-    };
 
-    // reserve to make sure the memory we'll be writing to with unsafe is allocated
-    let resv_size = match encoded_size(input_bytes.len(), config) {
-        Some(n) => n,
-        None => panic!("integer overflow when calculating buffer size"),
-    };
-    buf.reserve(resv_size);
+    let encoded_size = encoded_size(input_bytes.len(), &config)
+        .expect("usize overflow when calculating buffer size");
 
     let orig_buf_len = buf.len();
-    let mut fast_loop_output_buf_len = orig_buf_len;
-
-    let input_chunk_len = 6;
-
-    let last_fast_index = input_bytes.len().saturating_sub(8);
 
     // we're only going to insert valid utf8
-    let mut raw = unsafe { buf.as_mut_vec() };
-    // start at the first free part of the output buf
-    let mut output_ptr = unsafe { raw.as_mut_ptr().offset(orig_buf_len as isize) };
+    let mut buf_bytes;
+    unsafe {
+        buf_bytes = buf.as_mut_vec();
+    }
+
+    buf_bytes.resize(orig_buf_len.checked_add(encoded_size)
+                         .expect("usize overflow when calculating expanded buffer size"), 0);
+
+    let mut b64_output = &mut buf_bytes[orig_buf_len..];
+
+    let encoded_bytes = encode_with_padding(input_bytes, b64_output, config.char_set.encode_table(),
+                                            config.pad);
+
+    if let LineWrap::Wrap(line_len, line_end) = config.line_wrap {
+        line_wrap(b64_output, encoded_bytes, line_len, line_end);
+    }
+}
+
+/// Encode input bytes and pad if configured.
+/// `output` must be long enough to hold the encoded `input` with padding.
+/// Returns the number of bytes written.
+fn encode_with_padding(input: &[u8], output: &mut [u8], encode_table: &[u8; 64], pad: bool) -> usize {
+    let b64_bytes_written = encode_to_slice(input, output, encode_table);
+
+    let padding_bytes = if pad {
+        add_padding(input.len(), &mut output[b64_bytes_written..])
+    } else {
+        0
+    };
+
+    b64_bytes_written.checked_add(padding_bytes)
+        .expect("usize overflow when calculating b64 length")
+}
+
+/// Encode input bytes to utf8 base64 bytes. Does not pad or line wrap.
+/// `output` must be long enough to hold the encoded `input` without padding or line wrapping.
+/// Returns the number of bytes written.
+#[inline]
+fn encode_to_slice(input: &[u8], output: &mut [u8], encode_table: &[u8; 64]) -> usize {
     let mut input_index: usize = 0;
-    if input_bytes.len() >= 8 {
-        while input_index <= last_fast_index {
-            let input_chunk = BigEndian::read_u64(&input_bytes[input_index..(input_index + 8)]);
+
+    const BLOCKS_PER_FAST_LOOP: usize = 4;
+    const LOW_SIX_BITS: u64 = 0x3F;
+
+    // we read 8 bytes at a time (u64) but only actually consume 6 of those bytes. Thus, we need
+    // 2 trailing bytes to be available to read..
+    let last_fast_index = input.len().saturating_sub(BLOCKS_PER_FAST_LOOP * 6 + 2);
+    let mut output_index = 0;
 
-            // strip off 6 bits at a time for the first 6 bytes
-            unsafe {
-                std::ptr::write(output_ptr, charset[((input_chunk >> 58) & 0x3F) as usize]);
-                std::ptr::write(output_ptr.offset(1), charset[((input_chunk >> 52) & 0x3F) as usize]);
-                std::ptr::write(output_ptr.offset(2), charset[((input_chunk >> 46) & 0x3F) as usize]);
-                std::ptr::write(output_ptr.offset(3), charset[((input_chunk >> 40) & 0x3F) as usize]);
-                std::ptr::write(output_ptr.offset(4), charset[((input_chunk >> 34) & 0x3F) as usize]);
-                std::ptr::write(output_ptr.offset(5), charset[((input_chunk >> 28) & 0x3F) as usize]);
-                std::ptr::write(output_ptr.offset(6), charset[((input_chunk >> 22) & 0x3F) as usize]);
-                std::ptr::write(output_ptr.offset(7), charset[((input_chunk >> 16) & 0x3F) as usize]);
-                output_ptr = output_ptr.offset(8);
-            }
+    if last_fast_index > 0 {
+        while input_index <= last_fast_index {
+            // Major performance wins from letting the optimizer do the bounds check once, mostly
+            // on the output side
+            let input_chunk = &input[input_index..(input_index + (BLOCKS_PER_FAST_LOOP * 6 + 2))];
+            let mut output_chunk = &mut output[output_index..(output_index + BLOCKS_PER_FAST_LOOP * 8)];
+
+            // Hand-unrolling for 32 vs 16 or 8 bytes produces yields performance about equivalent
+            // to unsafe pointer code on a Xeon E5-1650v3. 64 byte unrolling was slightly better for
+            // large inputs but significantly worse for 50-byte input, unsurprisingly. I suspect
+            // that it's a not uncommon use case to encode smallish chunks of data (e.g. a 64-byte
+            // SHA-512 digest), so it would be nice if that fit in the unrolled loop at least once.
+            // Plus, single-digit percentage performance differences might well be quite different
+            // on different hardware.
+
+            let input_u64 = BigEndian::read_u64(&input_chunk[0..]);
+
+            output_chunk[0] = encode_table[((input_u64 >> 58) & LOW_SIX_BITS) as usize];
+            output_chunk[1] = encode_table[((input_u64 >> 52) & LOW_SIX_BITS) as usize];
+            output_chunk[2] = encode_table[((input_u64 >> 46) & LOW_SIX_BITS) as usize];
+            output_chunk[3] = encode_table[((input_u64 >> 40) & LOW_SIX_BITS) as usize];
+            output_chunk[4] = encode_table[((input_u64 >> 34) & LOW_SIX_BITS) as usize];
+            output_chunk[5] = encode_table[((input_u64 >> 28) & LOW_SIX_BITS) as usize];
+            output_chunk[6] = encode_table[((input_u64 >> 22) & LOW_SIX_BITS) as usize];
+            output_chunk[7] = encode_table[((input_u64 >> 16) & LOW_SIX_BITS) as usize];
+
+            let input_u64 = BigEndian::read_u64(&input_chunk[6..]);
 
-            input_index += input_chunk_len;
-            fast_loop_output_buf_len += 8;
+            output_chunk[8] = encode_table[((input_u64 >> 58) & LOW_SIX_BITS) as usize];
+            output_chunk[9] = encode_table[((input_u64 >> 52) & LOW_SIX_BITS) as usize];
+            output_chunk[10] = encode_table[((input_u64 >> 46) & LOW_SIX_BITS) as usize];
+            output_chunk[11] = encode_table[((input_u64 >> 40) & LOW_SIX_BITS) as usize];
+            output_chunk[12] = encode_table[((input_u64 >> 34) & LOW_SIX_BITS) as usize];
+            output_chunk[13] = encode_table[((input_u64 >> 28) & LOW_SIX_BITS) as usize];
+            output_chunk[14] = encode_table[((input_u64 >> 22) & LOW_SIX_BITS) as usize];
+            output_chunk[15] = encode_table[((input_u64 >> 16) & LOW_SIX_BITS) as usize];
+
+            let input_u64 = BigEndian::read_u64(&input_chunk[12..]);
+
+            output_chunk[16] = encode_table[((input_u64 >> 58) & LOW_SIX_BITS) as usize];
+            output_chunk[17] = encode_table[((input_u64 >> 52) & LOW_SIX_BITS) as usize];
+            output_chunk[18] = encode_table[((input_u64 >> 46) & LOW_SIX_BITS) as usize];
+            output_chunk[19] = encode_table[((input_u64 >> 40) & LOW_SIX_BITS) as usize];
+            output_chunk[20] = encode_table[((input_u64 >> 34) & LOW_SIX_BITS) as usize];
+            output_chunk[21] = encode_table[((input_u64 >> 28) & LOW_SIX_BITS) as usize];
+            output_chunk[22] = encode_table[((input_u64 >> 22) & LOW_SIX_BITS) as usize];
+            output_chunk[23] = encode_table[((input_u64 >> 16) & LOW_SIX_BITS) as usize];
+
+            let input_u64 = BigEndian::read_u64(&input_chunk[18..]);
+
+            output_chunk[24] = encode_table[((input_u64 >> 58) & LOW_SIX_BITS) as usize];
+            output_chunk[25] = encode_table[((input_u64 >> 52) & LOW_SIX_BITS) as usize];
+            output_chunk[26] = encode_table[((input_u64 >> 46) & LOW_SIX_BITS) as usize];
+            output_chunk[27] = encode_table[((input_u64 >> 40) & LOW_SIX_BITS) as usize];
+            output_chunk[28] = encode_table[((input_u64 >> 34) & LOW_SIX_BITS) as usize];
+            output_chunk[29] = encode_table[((input_u64 >> 28) & LOW_SIX_BITS) as usize];
+            output_chunk[30] = encode_table[((input_u64 >> 22) & LOW_SIX_BITS) as usize];
+            output_chunk[31] = encode_table[((input_u64 >> 16) & LOW_SIX_BITS) as usize];
+
+            output_index += BLOCKS_PER_FAST_LOOP * 8;
+            input_index += BLOCKS_PER_FAST_LOOP * 6;
         }
     }
 
-    unsafe {
-        // expand len to include the bytes we just wrote
-        raw.set_len(fast_loop_output_buf_len);
-    }
+    // Encode what's left after the fast loop.
 
-    // encode the 0 to 7 bytes left after the fast loop
+    const LOW_SIX_BITS_U8: u8 = 0x3F;
 
-    let rem = input_bytes.len() % 3;
-    let start_of_rem = input_bytes.len() - rem;
+    let rem = input.len() % 3;
+    let start_of_rem = input.len() - rem;
 
     // start at the first index not handled by fast loop, which may be 0.
-    let mut leftover_index = input_index;
+
+    while input_index < start_of_rem {
+        let input_chunk = &input[input_index..(input_index + 3)];
+        let mut output_chunk = &mut output[output_index..(output_index + 4)];
 
-    while leftover_index < start_of_rem {
-        raw.push(charset[(input_bytes[leftover_index] >> 2) as usize]);
-        raw.push(charset[((input_bytes[leftover_index] << 4 | input_bytes[leftover_index + 1] >> 4) & 0x3f) as usize]);
-        raw.push(charset[((input_bytes[leftover_index + 1] << 2 | input_bytes[leftover_index + 2] >> 6) & 0x3f) as usize]);
-        raw.push(charset[(input_bytes[leftover_index + 2] & 0x3f) as usize]);
+        output_chunk[0] = encode_table[(input_chunk[0] >> 2) as usize];
+        output_chunk[1] = encode_table[((input_chunk[0] << 4 | input_chunk[1] >> 4) & LOW_SIX_BITS_U8) as usize];
+        output_chunk[2] = encode_table[((input_chunk[1] << 2 | input_chunk[2] >> 6) & LOW_SIX_BITS_U8) as usize];
+        output_chunk[3] = encode_table[(input_chunk[2] & LOW_SIX_BITS_U8) as usize];
 
-        leftover_index += 3;
+        input_index += 3;
+        output_index += 4;
     }
 
     if rem == 2 {
-        raw.push(charset[(input_bytes[start_of_rem] >> 2) as usize]);
-        raw.push(charset[((input_bytes[start_of_rem] << 4 | input_bytes[start_of_rem + 1] >> 4) & 0x3f) as usize]);
-        raw.push(charset[(input_bytes[start_of_rem + 1] << 2 & 0x3f) as usize]);
+        output[output_index] = encode_table[(input[start_of_rem] >> 2) as usize];
+        output[output_index + 1] = encode_table[((input[start_of_rem] << 4 | input[start_of_rem + 1] >> 4) & LOW_SIX_BITS_U8) as usize];
+        output[output_index + 2] = encode_table[((input[start_of_rem + 1] << 2) & LOW_SIX_BITS_U8) as usize];
+        output_index += 3;
     } else if rem == 1 {
-        raw.push(charset[(input_bytes[start_of_rem] >> 2) as usize]);
-        raw.push(charset[(input_bytes[start_of_rem] << 4 & 0x3f) as usize]);
-    }
-
-    if config.pad {
-        for _ in 0..((3 - rem) % 3) {
-            raw.push(0x3d);
-        }
+        output[output_index] = encode_table[(input[start_of_rem] >> 2) as usize];
+        output[output_index + 1] = encode_table[((input[start_of_rem] << 4) & LOW_SIX_BITS_U8) as usize];
+        output_index += 2;
     }
 
-    //TODO FIXME this does the wrong thing for nonempty buffers
-    if orig_buf_len == 0 {
-        if let LineWrap::Wrap(line_size, line_end) = config.line_wrap {
-            let len = raw.len();
-            let mut i = 0;
-            let mut j = 0;
+    output_index
+}
 
-            while i < len {
-                if i > 0 && i % line_size == 0 {
-                    match line_end {
-                        LineEnding::LF => { raw.insert(j, b'\n'); j += 1; }
-                        LineEnding::CRLF => { raw.insert(j, b'\r'); raw.insert(j + 1, b'\n'); j += 2; }
-                    }
-                }
+/// Write padding characters.
+/// `output` is the slice where padding should be written, of length at least 2.
+fn add_padding(input_len: usize, output: &mut[u8]) -> usize {
+    let rem = input_len % 3;
+    let mut bytes_written = 0;
+    for _ in 0..((3 - rem) % 3) {
+        output[bytes_written] = b'=';
+        bytes_written += 1;
+    }
 
-                i += 1;
-                j += 1;
-            }
-        }
-    }
+    bytes_written
 }
 
 ///Decode from string reference as octets.
 ///Returns a Result containing a Vec<u8>.
 ///
 ///# Example
 ///
 ///```rust
@@ -379,137 +481,96 @@ pub fn decode_config_buf<T: ?Sized + AsR
         input_copy = Vec::<u8>::with_capacity(input.as_ref().len());
         input_copy.extend(input.as_ref().iter().filter(|b| !b" \n\t\r\x0b\x0c".contains(b)));
 
         input_copy.as_ref()
     } else {
         input.as_ref()
     };
 
-    let ref decode_table = match config.char_set {
-        CharacterSet::Standard => tables::STANDARD_DECODE,
-        CharacterSet::UrlSafe => tables::URL_SAFE_DECODE,
-    };
-
-    buffer.reserve(input_bytes.len() * 3 / 4);
+    let decode_table = &config.char_set.decode_table();
 
-    // the fast loop only handles complete chunks of 8 input bytes without padding
-    let chunk_len = 8;
-    let decoded_chunk_len = 6;
-    let remainder_len = input_bytes.len() % chunk_len;
+    // decode logic operates on chunks of 8 input bytes without padding
+    const INPUT_CHUNK_LEN: usize = 8;
+    const DECODED_CHUNK_LEN: usize = 6;
+    // we read a u64 and write a u64, but a u64 of input only yields 6 bytes of output, so the last
+    // 2 bytes of any output u64 should not be counted as written to (but must be available in a
+    // slice).
+    const DECODED_CHUNK_SUFFIX: usize = 2;
+
+    let remainder_len = input_bytes.len() % INPUT_CHUNK_LEN;
     let trailing_bytes_to_skip = if remainder_len == 0 {
-        // if input is a multiple of the chunk size, ignore the last chunk as it may have padding
-        chunk_len
+        // if input is a multiple of the chunk size, ignore the last chunk as it may have padding,
+        // and the fast decode logic cannot handle padding
+        INPUT_CHUNK_LEN
     } else {
         remainder_len
     };
 
     let length_of_full_chunks = input_bytes.len().saturating_sub(trailing_bytes_to_skip);
 
     let starting_output_index = buffer.len();
     // Resize to hold decoded output from fast loop. Need the extra two bytes because
-    // we write a full 8 bytes for the last 6-byte decoded chunk and then truncate off two
+    // we write a full 8 bytes for the last 6-byte decoded chunk and then truncate off the last two.
     let new_size = starting_output_index
-        + length_of_full_chunks / chunk_len * decoded_chunk_len
-        + (chunk_len - decoded_chunk_len);
+        .checked_add(length_of_full_chunks / INPUT_CHUNK_LEN * DECODED_CHUNK_LEN)
+        .and_then(|l| l.checked_add(DECODED_CHUNK_SUFFIX))
+        .expect("Overflow when calculating output buffer length");
+
     buffer.resize(new_size, 0);
 
-    let mut output_index = starting_output_index;
-
     {
-        let buffer_slice = buffer.as_mut_slice();
-
+        let mut output_index = 0;
         let mut input_index = 0;
-        // initial value is never used; always set if fast loop breaks
-        let mut bad_byte_index: usize = 0;
-        // a non-invalid value means it's not an error if fast loop never runs
-        let mut morsel: u8 = 0;
-
-        // fast loop of 8 bytes at a time
-        while input_index < length_of_full_chunks {
-            let mut accum: u64;
+        let buffer_slice = &mut buffer.as_mut_slice()[starting_output_index..];
 
-            let input_chunk = BigEndian::read_u64(&input_bytes[input_index..(input_index + 8)]);
-            morsel = decode_table[(input_chunk >> 56) as usize];
-            if morsel == tables::INVALID_VALUE {
-                bad_byte_index = input_index;
-                break;
-            };
-            accum = (morsel as u64) << 58;
-
-            morsel = decode_table[(input_chunk >> 48 & 0xFF) as usize];
-            if morsel == tables::INVALID_VALUE {
-                bad_byte_index = input_index + 1;
-                break;
-            };
-            accum |= (morsel as u64) << 52;
-
-            morsel = decode_table[(input_chunk >> 40 & 0xFF) as usize];
-            if morsel == tables::INVALID_VALUE {
-                bad_byte_index = input_index + 2;
-                break;
-            };
-            accum |= (morsel as u64) << 46;
+        // how many u64's of input to handle at a time
+        const CHUNKS_PER_FAST_LOOP_BLOCK: usize = 4;
+        const INPUT_BLOCK_LEN: usize = CHUNKS_PER_FAST_LOOP_BLOCK * INPUT_CHUNK_LEN;
+        // includes the trailing 2 bytes for the final u64 write
+        const DECODED_BLOCK_LEN: usize = CHUNKS_PER_FAST_LOOP_BLOCK * DECODED_CHUNK_LEN +
+            DECODED_CHUNK_SUFFIX;
+        // the start index of the last block of data that is big enough to use the unrolled loop
+        let last_block_start_index = length_of_full_chunks
+            .saturating_sub(INPUT_CHUNK_LEN * CHUNKS_PER_FAST_LOOP_BLOCK);
 
-            morsel = decode_table[(input_chunk >> 32 & 0xFF) as usize];
-            if morsel == tables::INVALID_VALUE {
-                bad_byte_index = input_index + 3;
-                break;
-            };
-            accum |= (morsel as u64) << 40;
+        // manual unroll to CHUNKS_PER_FAST_LOOP_BLOCK of u64s to amortize slice bounds checks
+        if last_block_start_index > 0 {
+            while input_index <= last_block_start_index {
+                let input_slice = &input_bytes[input_index..(input_index + INPUT_BLOCK_LEN)];
+                let output_slice = &mut buffer_slice[output_index..(output_index + DECODED_BLOCK_LEN)];
 
-            morsel = decode_table[(input_chunk >> 24 & 0xFF) as usize];
-            if morsel == tables::INVALID_VALUE {
-                bad_byte_index = input_index + 4;
-                break;
-            };
-            accum |= (morsel as u64) << 34;
-
-            morsel = decode_table[(input_chunk >> 16 & 0xFF) as usize];
-            if morsel == tables::INVALID_VALUE {
-                bad_byte_index = input_index + 5;
-                break;
-            };
-            accum |= (morsel as u64) << 28;
+                decode_chunk(&input_slice[0..], input_index, decode_table, &mut output_slice[0..])?;
+                decode_chunk(&input_slice[8..], input_index + 8, decode_table, &mut output_slice[6..])?;
+                decode_chunk(&input_slice[16..], input_index + 16, decode_table, &mut output_slice[12..])?;
+                decode_chunk(&input_slice[24..], input_index + 24, decode_table, &mut output_slice[18..])?;
 
-            morsel = decode_table[(input_chunk >> 8 & 0xFF) as usize];
-            if morsel == tables::INVALID_VALUE {
-                bad_byte_index = input_index + 6;
-                break;
-            };
-            accum |= (morsel as u64) << 22;
+                input_index += INPUT_BLOCK_LEN;
+                output_index += DECODED_BLOCK_LEN - DECODED_CHUNK_SUFFIX;
+            }
+        }
 
-            morsel = decode_table[(input_chunk & 0xFF) as usize];
-            if morsel == tables::INVALID_VALUE {
-                bad_byte_index = input_index + 7;
-                break;
-            };
-            accum |= (morsel as u64) << 16;
+        // still pretty fast loop: 8 bytes at a time for whatever we didn't do in the faster loop.
+        while input_index < length_of_full_chunks {
+            decode_chunk(&input_bytes[input_index..(input_index + 8)], input_index, decode_table,
+                         &mut buffer_slice[output_index..(output_index + 8)])?;
 
-            BigEndian::write_u64(&mut buffer_slice[(output_index)..(output_index + 8)],
-                                 accum);
-
-            output_index += 6;
-            input_index += chunk_len;
-        };
-
-        if morsel == tables::INVALID_VALUE {
-            // we got here from a break
-            return Err(DecodeError::InvalidByte(bad_byte_index, input_bytes[bad_byte_index]));
+            output_index += DECODED_CHUNK_LEN;
+            input_index += INPUT_CHUNK_LEN;
         }
     }
 
     // Truncate off the last two bytes from writing the last u64.
     // Unconditional because we added on the extra 2 bytes in the resize before the loop,
     // so it will never underflow.
-    let new_len = buffer.len() - (chunk_len - decoded_chunk_len);
+    let new_len = buffer.len() - DECODED_CHUNK_SUFFIX;
     buffer.truncate(new_len);
 
     // handle leftovers (at most 8 bytes, decoded to 6).
-    // Use a u64 as a stack-resident 8 bytes buffer.
+    // Use a u64 as a stack-resident 8 byte buffer.
     let mut leftover_bits: u64 = 0;
     let mut morsels_in_leftover = 0;
     let mut padding_bytes = 0;
     let mut first_padding_index: usize = 0;
     for (i, b) in input_bytes[length_of_full_chunks..].iter().enumerate() {
         // '=' padding
         if *b == 0x3D {
             // There can be bad padding in a few ways:
@@ -518,49 +579,58 @@ pub fn decode_config_buf<T: ?Sized + AsR
             //     in the current quad.
             // 3 - More than two characters of padding. If 3 or 4 padding chars
             //     are in the same quad, that implies it will be caught by #2.
             //     If it spreads from one quad to another, it will be caught by
             //     #2 in the second quad.
 
             if i % 4 < 2 {
                 // Check for case #2.
-                // TODO InvalidPadding error
-                return Err(DecodeError::InvalidByte(length_of_full_chunks + i, *b));
-            };
+                let bad_padding_index = length_of_full_chunks + if padding_bytes > 0 {
+                    // If we've already seen padding, report the first padding index.
+                    // This is to be consistent with the faster logic above: it will report an error
+                    // on the first padding character (since it doesn't expect to see anything but
+                    // actual encoded data).
+                    first_padding_index
+                } else {
+                    // haven't seen padding before, just use where we are now
+                    i
+                };
+                return Err(DecodeError::InvalidByte(bad_padding_index, *b));
+            }
 
             if padding_bytes == 0 {
                 first_padding_index = i;
-            };
+            }
 
             padding_bytes += 1;
             continue;
-        };
+        }
 
         // Check for case #1.
         // To make '=' handling consistent with the main loop, don't allow
         // non-suffix '=' in trailing chunk either. Report error as first
         // erroneous padding.
         if padding_bytes > 0 {
             return Err(DecodeError::InvalidByte(
                 length_of_full_chunks + first_padding_index, 0x3D));
-        };
+        }
 
         // can use up to 8 * 6 = 48 bits of the u64, if last chunk has no padding.
         // To minimize shifts, pack the leftovers from left to right.
         let shift = 64 - (morsels_in_leftover + 1) * 6;
-        // tables are all 256 elements, cannot overflow from a u8 index
+        // tables are all 256 elements, lookup with a u8 index always succeeds
         let morsel = decode_table[*b as usize];
         if morsel == tables::INVALID_VALUE {
             return Err(DecodeError::InvalidByte(length_of_full_chunks + i, *b));
-        };
+        }
 
         leftover_bits |= (morsel as u64) << shift;
         morsels_in_leftover += 1;
-    };
+    }
 
     let leftover_bits_ready_to_append = match morsels_in_leftover {
         0 => 0,
         1 => return Err(DecodeError::InvalidLength),
         2 => 8,
         3 => 16,
         4 => 24,
         5 => return Err(DecodeError::InvalidLength),
@@ -577,99 +647,69 @@ pub fn decode_config_buf<T: ?Sized + AsR
         buffer.push(selected_bits);
 
         leftover_bits_appended_to_buf += 8;
     };
 
     Ok(())
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-
-    #[test]
-    fn encoded_size_correct() {
-        assert_eq!(Some(0), encoded_size(0, STANDARD));
+// yes, really inline (worth 30-50% speedup)
+#[inline(always)]
+fn decode_chunk(input: &[u8], index_at_start_of_input: usize, decode_table: &[u8; 256],
+                output: &mut [u8]) -> Result<(), DecodeError> {
+    let mut accum: u64;
 
-        assert_eq!(Some(4), encoded_size(1, STANDARD));
-        assert_eq!(Some(4), encoded_size(2, STANDARD));
-        assert_eq!(Some(4), encoded_size(3, STANDARD));
-
-        assert_eq!(Some(8), encoded_size(4, STANDARD));
-        assert_eq!(Some(8), encoded_size(5, STANDARD));
-        assert_eq!(Some(8), encoded_size(6, STANDARD));
-
-        assert_eq!(Some(12), encoded_size(7, STANDARD));
-        assert_eq!(Some(12), encoded_size(8, STANDARD));
-        assert_eq!(Some(12), encoded_size(9, STANDARD));
-
-        assert_eq!(Some(72), encoded_size(54, STANDARD));
+    let morsel = decode_table[input[0] as usize];
+    if morsel == tables::INVALID_VALUE {
+        return Err(DecodeError::InvalidByte(index_at_start_of_input, input[0]));
+    }
+    accum = (morsel as u64) << 58;
 
-        assert_eq!(Some(76), encoded_size(55, STANDARD));
-        assert_eq!(Some(76), encoded_size(56, STANDARD));
-        assert_eq!(Some(76), encoded_size(57, STANDARD));
-
-        assert_eq!(Some(80), encoded_size(58, STANDARD));
+    let morsel = decode_table[input[1] as usize];
+    if morsel == tables::INVALID_VALUE {
+        return Err(DecodeError::InvalidByte(index_at_start_of_input + 1, input[1]));
     }
-
-    #[test]
-    fn encoded_size_correct_mime() {
-        assert_eq!(Some(0), encoded_size(0, MIME));
+    accum |= (morsel as u64) << 52;
 
-        assert_eq!(Some(4), encoded_size(1, MIME));
-        assert_eq!(Some(4), encoded_size(2, MIME));
-        assert_eq!(Some(4), encoded_size(3, MIME));
+    let morsel = decode_table[input[2] as usize];
+    if morsel == tables::INVALID_VALUE {
+        return Err(DecodeError::InvalidByte(index_at_start_of_input + 2, input[2]));
+    }
+    accum |= (morsel as u64) << 46;
 
-        assert_eq!(Some(8), encoded_size(4, MIME));
-        assert_eq!(Some(8), encoded_size(5, MIME));
-        assert_eq!(Some(8), encoded_size(6, MIME));
-
-        assert_eq!(Some(12), encoded_size(7, MIME));
-        assert_eq!(Some(12), encoded_size(8, MIME));
-        assert_eq!(Some(12), encoded_size(9, MIME));
+    let morsel = decode_table[input[3] as usize];
+    if morsel == tables::INVALID_VALUE {
+        return Err(DecodeError::InvalidByte(index_at_start_of_input + 3, input[3]));
+    }
+    accum |= (morsel as u64) << 40;
 
-        assert_eq!(Some(72), encoded_size(54, MIME));
-
-        assert_eq!(Some(78), encoded_size(55, MIME));
-        assert_eq!(Some(78), encoded_size(56, MIME));
-        assert_eq!(Some(78), encoded_size(57, MIME));
-
-        assert_eq!(Some(82), encoded_size(58, MIME));
+    let morsel = decode_table[input[4] as usize];
+    if morsel == tables::INVALID_VALUE {
+        return Err(DecodeError::InvalidByte(index_at_start_of_input + 4, input[4]));
     }
+    accum |= (morsel as u64) << 34;
 
-    #[test]
-    fn encoded_size_correct_lf() {
-        let config = Config::new(
-            CharacterSet::Standard,
-            true,
-            false,
-            LineWrap::Wrap(76, LineEnding::LF)
-        );
-
-        assert_eq!(Some(0), encoded_size(0, config));
+    let morsel = decode_table[input[5] as usize];
+    if morsel == tables::INVALID_VALUE {
+        return Err(DecodeError::InvalidByte(index_at_start_of_input + 5, input[5]));
+    }
+    accum |= (morsel as u64) << 28;
 
-        assert_eq!(Some(4), encoded_size(1, config));
-        assert_eq!(Some(4), encoded_size(2, config));
-        assert_eq!(Some(4), encoded_size(3, config));
-
-        assert_eq!(Some(8), encoded_size(4, config));
-        assert_eq!(Some(8), encoded_size(5, config));
-        assert_eq!(Some(8), encoded_size(6, config));
-
-        assert_eq!(Some(12), encoded_size(7, config));
-        assert_eq!(Some(12), encoded_size(8, config));
-        assert_eq!(Some(12), encoded_size(9, config));
+    let morsel = decode_table[input[6] as usize];
+    if morsel == tables::INVALID_VALUE {
+        return Err(DecodeError::InvalidByte(index_at_start_of_input + 6, input[6]));
+    }
+    accum |= (morsel as u64) << 22;
 
-        assert_eq!(Some(72), encoded_size(54, config));
-
-        assert_eq!(Some(77), encoded_size(55, config));
-        assert_eq!(Some(77), encoded_size(56, config));
-        assert_eq!(Some(77), encoded_size(57, config));
+    let morsel = decode_table[input[7] as usize];
+    if morsel == tables::INVALID_VALUE {
+        return Err(DecodeError::InvalidByte(index_at_start_of_input + 7, input[7]));
+    }
+    accum |= (morsel as u64) << 16;
 
-        assert_eq!(Some(81), encoded_size(58, config));
-    }
+    BigEndian::write_u64(output, accum);
 
-    #[test]
-    fn encoded_size_overflow() {
-        assert_eq!(None, encoded_size(std::usize::MAX, STANDARD));
-    }
+    Ok(())
 }
+
+#[cfg(test)]
+mod tests;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/base64/src/line_wrap.rs
@@ -0,0 +1,350 @@
+extern crate safemem;
+
+use super::*;
+
+use std::str;
+
+#[derive(Debug, PartialEq)]
+pub struct LineWrapParameters {
+    // number of lines that need an ending
+    pub lines_with_endings: usize,
+    // length of last line (which never needs an ending)
+    pub last_line_len: usize,
+    // length of lines that need an ending (which are always full lines), with their endings
+    pub total_full_wrapped_lines_len: usize,
+    // length of all lines, including endings for the ones that need them
+    pub total_len: usize,
+    // length of the line endings only
+    pub total_line_endings_len: usize
+}
+
+/// Calculations about how many lines we'll get for a given line length, line ending, etc.
+/// This assumes that the last line will not get an ending, even if it is the full line length.
+pub fn line_wrap_parameters(input_len: usize, line_len: usize, line_ending: LineEnding)
+                            -> LineWrapParameters {
+    let line_ending_len = line_ending.len();
+
+    if input_len <= line_len {
+        // no wrapping needed
+        return LineWrapParameters {
+            lines_with_endings: 0,
+            last_line_len: input_len,
+            total_full_wrapped_lines_len: 0,
+            total_len: input_len,
+            total_line_endings_len: 0
+        };
+    };
+
+    // num_lines_with_endings > 0, last_line_length > 0
+    let (num_lines_with_endings, last_line_length) = if input_len % line_len > 0 {
+        // Every full line has an ending since there is a partial line at the end
+        (input_len / line_len, input_len % line_len)
+    } else {
+        // Every line is a full line, but no trailing ending.
+        // Subtraction will not underflow since we know input_len > line_len.
+        (input_len / line_len - 1, line_len)
+    };
+
+    // TODO should we expose exceeding usize via Result to be kind to 16-bit users? Or is that
+    // always going to be a panic anyway in practice? If we choose to use a Result we could pull
+    // line wrapping out of the normal encode path and have it be a separate step. Then only users
+    // who need line wrapping would care about the possibility for error.
+
+    let single_full_line_with_ending_len = line_len.checked_add(line_ending_len)
+        .expect("Line length with ending exceeds usize");
+    // length of just the full lines with line endings
+    let total_full_wrapped_lines_len = num_lines_with_endings
+        .checked_mul(single_full_line_with_ending_len)
+        .expect("Full lines with endings length exceeds usize");
+    // all lines with appropriate endings, including the last line
+    let total_all_wrapped_len = total_full_wrapped_lines_len.checked_add(last_line_length)
+        .expect("All lines with endings length exceeds usize");
+    let total_line_endings_len = num_lines_with_endings.checked_mul(line_ending_len)
+        .expect("Total line endings length exceeds usize");
+
+    LineWrapParameters {
+        lines_with_endings: num_lines_with_endings,
+        last_line_len: last_line_length,
+        total_full_wrapped_lines_len: total_full_wrapped_lines_len,
+        total_len: total_all_wrapped_len,
+        total_line_endings_len: total_line_endings_len
+    }
+}
+
+
+/// Insert line endings into the encoded base64 after each complete line (except the last line, even
+/// if it is complete).
+/// The provided buffer must be large enough to handle the increased size after endings are
+/// inserted.
+/// `input_len` is the length of the encoded data in `encoded_buf`.
+/// `line_len` is the width without line ending characters.
+/// Returns the number of line ending bytes added.
+pub fn line_wrap(encoded_buf: &mut [u8], input_len: usize, line_len: usize, line_ending: LineEnding) -> usize {
+    let line_wrap_params = line_wrap_parameters(input_len, line_len, line_ending);
+
+    // ptr.offset() is undefined if it wraps, and there is no checked_offset(). However, because
+    // we perform this check up front to make sure we have enough capacity, we know that none of
+    // the subsequent pointer operations (assuming they implement the desired behavior of course!)
+    // will overflow.
+    assert!(encoded_buf.len() >= line_wrap_params.total_len,
+        "Buffer must be able to hold encoded data after line wrapping");
+
+    // Move the last line, either partial or full, by itself as it does not have a line ending
+    // afterwards
+    let last_line_start = line_wrap_params.lines_with_endings.checked_mul(line_len)
+        .expect("Start of last line in input exceeds usize");
+    // last line starts immediately after all the wrapped full lines
+    let new_line_start = line_wrap_params.total_full_wrapped_lines_len;
+
+    safemem::copy_over(encoded_buf, last_line_start, new_line_start, line_wrap_params.last_line_len);
+
+    let mut line_ending_bytes = 0;
+
+    let line_ending_len = line_ending.len();
+
+    // handle the full lines
+    for line_num in 0..line_wrap_params.lines_with_endings {
+        // doesn't underflow because line_num < lines_with_endings
+        let lines_before_this_line = line_wrap_params.lines_with_endings - 1 - line_num;
+        let old_line_start = lines_before_this_line.checked_mul(line_len)
+            .expect("Old line start index exceeds usize");
+        let new_line_start = lines_before_this_line.checked_mul(line_ending_len)
+            .and_then(|i| i.checked_add(old_line_start))
+            .expect("New line start index exceeds usize");
+
+        safemem::copy_over(encoded_buf, old_line_start, new_line_start, line_len);
+
+        let after_new_line = new_line_start.checked_add(line_len)
+            .expect("Line ending index exceeds usize");
+
+        match line_ending {
+            LineEnding::LF => {
+                encoded_buf[after_new_line] = b'\n';
+                line_ending_bytes += 1;
+            }
+            LineEnding::CRLF => {
+                encoded_buf[after_new_line] = b'\r';
+                encoded_buf[after_new_line.checked_add(1).expect("Line ending index exceeds usize")]
+                    = b'\n';
+                line_ending_bytes += 2;
+            }
+        }
+    }
+
+    assert_eq!(line_wrap_params.total_line_endings_len, line_ending_bytes);
+
+    line_ending_bytes
+}
+
+#[cfg(test)]
+mod tests {
+    extern crate rand;
+
+    use super::super::*;
+    use super::*;
+
+    use self::rand::Rng;
+    use self::rand::distributions::{IndependentSample, Range};
+
+    #[test]
+    fn line_params_perfect_multiple_of_line_length_lf() {
+        let params = line_wrap_parameters(100, 20, LineEnding::LF);
+
+        assert_eq!(LineWrapParameters {
+            lines_with_endings: 4,
+            last_line_len: 20,
+            total_full_wrapped_lines_len: 84,
+            total_len: 104,
+            total_line_endings_len: 4
+        }, params);
+    }
+
+    #[test]
+    fn line_params_partial_last_line_crlf() {
+        let params = line_wrap_parameters(103, 20, LineEnding::CRLF);
+
+        assert_eq!(LineWrapParameters {
+            lines_with_endings: 5,
+            last_line_len: 3,
+            total_full_wrapped_lines_len: 110,
+            total_len: 113,
+            total_line_endings_len: 10
+        }, params);
+    }
+
+    #[test]
+    fn line_params_line_len_1_crlf() {
+        let params = line_wrap_parameters(100, 1, LineEnding::CRLF);
+
+        assert_eq!(LineWrapParameters {
+            lines_with_endings: 99,
+            last_line_len: 1,
+            total_full_wrapped_lines_len: 99 * 3,
+            total_len: 99 * 3 + 1,
+            total_line_endings_len: 99 * 2
+        }, params);
+    }
+
+    #[test]
+    fn line_params_line_len_longer_than_input_crlf() {
+        let params = line_wrap_parameters(100, 200, LineEnding::CRLF);
+
+        assert_eq!(LineWrapParameters {
+            lines_with_endings: 0,
+            last_line_len: 100,
+            total_full_wrapped_lines_len: 0,
+            total_len: 100,
+            total_line_endings_len: 0
+        }, params);
+    }
+
+    #[test]
+    fn line_params_line_len_same_as_input_crlf() {
+        let params = line_wrap_parameters(100, 100, LineEnding::CRLF);
+
+        assert_eq!(LineWrapParameters {
+            lines_with_endings: 0,
+            last_line_len: 100,
+            total_full_wrapped_lines_len: 0,
+            total_len: 100,
+            total_line_endings_len: 0
+        }, params);
+    }
+
+    #[test]
+    fn line_wrap_length_1_lf() {
+        let mut buf = vec![0x1, 0x2, 0x3, 0x4];
+
+        do_line_wrap(&mut buf, 1, LineEnding::LF);
+
+        assert_eq!(vec![0x1, 0xA, 0x2, 0xA, 0x3, 0xA, 0x4], buf);
+    }
+
+    #[test]
+    fn line_wrap_length_1_crlf() {
+        let mut buf = vec![0x1, 0x2, 0x3, 0x4];
+
+        do_line_wrap(&mut buf, 1, LineEnding::CRLF);
+
+        assert_eq!(vec![0x1, 0xD, 0xA, 0x2, 0xD, 0xA, 0x3, 0xD, 0xA, 0x4], buf);
+    }
+
+    #[test]
+    fn line_wrap_length_2_lf_full_lines() {
+        let mut buf = vec![0x1, 0x2, 0x3, 0x4];
+
+        do_line_wrap(&mut buf, 2, LineEnding::LF);
+
+        assert_eq!(vec![0x1, 0x2, 0xA, 0x3, 0x4], buf);
+    }
+
+    #[test]
+    fn line_wrap_length_2_crlf_full_lines() {
+        let mut buf = vec![0x1, 0x2, 0x3, 0x4];
+
+        do_line_wrap(&mut buf, 2, LineEnding::CRLF);
+
+        assert_eq!(vec![0x1, 0x2, 0xD, 0xA, 0x3, 0x4], buf);
+    }
+
+    #[test]
+    fn line_wrap_length_2_lf_partial_line() {
+        let mut buf = vec![0x1, 0x2, 0x3, 0x4, 0x5];
+
+        do_line_wrap(&mut buf, 2, LineEnding::LF);
+
+        assert_eq!(vec![0x1, 0x2, 0xA, 0x3, 0x4, 0xA, 0x5], buf);
+    }
+
+    #[test]
+    fn line_wrap_length_2_crlf_partial_line() {
+        let mut buf = vec![0x1, 0x2, 0x3, 0x4, 0x5];
+
+        do_line_wrap(&mut buf, 2, LineEnding::CRLF);
+
+        assert_eq!(vec![0x1, 0x2, 0xD, 0xA, 0x3, 0x4, 0xD, 0xA, 0x5], buf);
+    }
+
+    #[test]
+    fn line_wrap_random() {
+        let mut buf: Vec<u8> = Vec::new();
+        let buf_range = Range::new(10, 1000);
+        let line_range = Range::new(10, 100);
+        let mut rng = rand::weak_rng();
+
+        for _ in 0..10_000 {
+            buf.clear();
+
+            let buf_len = buf_range.ind_sample(&mut rng);
+            let line_len = line_range.ind_sample(&mut rng);
+            let line_ending = if rng.gen() {
+                LineEnding::LF
+            } else {
+                LineEnding::CRLF
+            };
+            let line_ending_len = line_ending.len();
+
+            for _ in 0..buf_len {
+                buf.push(rng.gen());
+            }
+
+            let line_wrap_params = line_wrap_parameters(buf_len, line_len, line_ending);
+
+            let not_wrapped_buf = buf.to_vec();
+
+            let _ = do_line_wrap(&mut buf, line_len, line_ending);
+
+            // remove the endings
+            for line_ending_num in 0..line_wrap_params.lines_with_endings {
+                let line_ending_offset = (line_ending_num + 1) * line_len;
+
+                for _ in 0..line_ending_len {
+                    buf.remove(line_ending_offset);
+                }
+            }
+
+            assert_eq!(not_wrapped_buf, buf);
+        }
+    }
+
+    fn do_line_wrap(buf: &mut Vec<u8>, line_len: usize, line_ending: LineEnding) -> usize {
+        let mut rng = rand::weak_rng();
+
+        let orig_len = buf.len();
+
+        // A 3x inflation is enough for the worst case: line length 1, crlf ending.
+        // We add on extra bytes so we'll have un-wrapped bytes at the end that shouldn't get
+        // modified..
+        for _ in 0..(1000 + 2 * orig_len) {
+            buf.push(rng.gen());
+        }
+
+        let mut before_line_wrap = buf.to_vec();
+
+        let params = line_wrap_parameters(orig_len, line_len, line_ending);
+
+        let bytes_written = line_wrap(&mut buf[..], orig_len, line_len, line_ending);
+
+        assert_eq!(params.total_line_endings_len, bytes_written);
+        assert_eq!(params.lines_with_endings * line_ending.len(), bytes_written);
+        assert_eq!(params.total_len, orig_len + bytes_written);
+
+        // make sure line_wrap didn't touch anything beyond what it should
+        let start_of_untouched_data = orig_len + bytes_written;
+        assert_eq!(before_line_wrap[start_of_untouched_data..],
+            buf[start_of_untouched_data..]);
+
+        // also make sure that line wrapping will fit into a slice no bigger than what it should
+        // need
+        let bytes_written_precise_fit =
+            line_wrap(&mut before_line_wrap[0..(params.total_len)], orig_len, line_len,
+                      line_ending);
+
+        assert_eq!(bytes_written, bytes_written_precise_fit);
+        assert_eq!(&buf[0..(params.total_len)], &before_line_wrap[0..(params.total_len)]);
+
+        buf.truncate(orig_len + bytes_written);
+
+        bytes_written
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/base64/src/tests.rs
@@ -0,0 +1,478 @@
+extern crate rand;
+
+use super::*;
+use super::line_wrap::{line_wrap_parameters};
+use self::rand::Rng;
+use self::rand::distributions::{IndependentSample, Range};
+
+#[test]
+fn encoded_size_correct_standard() {
+    assert_encoded_length(0, 0, STANDARD);
+
+    assert_encoded_length(1, 4, STANDARD);
+    assert_encoded_length(2, 4, STANDARD);
+    assert_encoded_length(3, 4, STANDARD);
+
+    assert_encoded_length(4, 8, STANDARD);
+    assert_encoded_length(5, 8, STANDARD);
+    assert_encoded_length(6, 8, STANDARD);
+
+    assert_encoded_length(7, 12, STANDARD);
+    assert_encoded_length(8, 12, STANDARD);
+    assert_encoded_length(9, 12, STANDARD);
+
+    assert_encoded_length(54, 72, STANDARD);
+
+    assert_encoded_length(55, 76, STANDARD);
+    assert_encoded_length(56, 76, STANDARD);
+    assert_encoded_length(57, 76, STANDARD);
+
+    assert_encoded_length(58, 80, STANDARD);
+}
+
+#[test]
+fn encoded_size_correct_no_pad_no_wrap() {
+    assert_encoded_length(0, 0, URL_SAFE_NO_PAD);
+
+    assert_encoded_length(1, 2, URL_SAFE_NO_PAD);
+    assert_encoded_length(2, 3, URL_SAFE_NO_PAD);
+    assert_encoded_length(3, 4, URL_SAFE_NO_PAD);
+
+    assert_encoded_length(4, 6, URL_SAFE_NO_PAD);
+    assert_encoded_length(5, 7, URL_SAFE_NO_PAD);
+    assert_encoded_length(6, 8, URL_SAFE_NO_PAD);
+
+    assert_encoded_length(7, 10, URL_SAFE_NO_PAD);
+    assert_encoded_length(8, 11, URL_SAFE_NO_PAD);
+    assert_encoded_length(9, 12, URL_SAFE_NO_PAD);
+
+    assert_encoded_length(54, 72, URL_SAFE_NO_PAD);
+
+    assert_encoded_length(55, 74, URL_SAFE_NO_PAD);
+    assert_encoded_length(56, 75, URL_SAFE_NO_PAD);
+    assert_encoded_length(57, 76, URL_SAFE_NO_PAD);
+
+    assert_encoded_length(58, 78, URL_SAFE_NO_PAD);
+}
+
+#[test]
+fn encoded_size_correct_mime() {
+    assert_encoded_length(0, 0, MIME);
+
+    assert_encoded_length(1, 4, MIME);
+    assert_encoded_length(2, 4, MIME);
+    assert_encoded_length(3, 4, MIME);
+
+    assert_encoded_length(4, 8, MIME);
+    assert_encoded_length(5, 8, MIME);
+    assert_encoded_length(6, 8, MIME);
+
+    assert_encoded_length(7, 12, MIME);
+    assert_encoded_length(8, 12, MIME);
+    assert_encoded_length(9, 12, MIME);
+
+    assert_encoded_length(54, 72, MIME);
+
+    assert_encoded_length(55, 76, MIME);
+    assert_encoded_length(56, 76, MIME);
+    assert_encoded_length(57, 76, MIME);
+
+    assert_encoded_length(58, 82, MIME);
+    assert_encoded_length(59, 82, MIME);
+    assert_encoded_length(60, 82, MIME);
+}
+
+#[test]
+fn encoded_size_correct_lf_pad() {
+    let config = Config::new(
+        CharacterSet::Standard,
+        true,
+        false,
+        LineWrap::Wrap(76, LineEnding::LF)
+    );
+
+    assert_encoded_length(0, 0, config);
+
+    assert_encoded_length(1, 4, config);
+    assert_encoded_length(2, 4, config);
+    assert_encoded_length(3, 4, config);
+
+    assert_encoded_length(4, 8, config);
+    assert_encoded_length(5, 8, config);
+    assert_encoded_length(6, 8, config);
+
+    assert_encoded_length(7, 12, config);
+    assert_encoded_length(8, 12, config);
+    assert_encoded_length(9, 12, config);
+
+    assert_encoded_length(54, 72, config);
+
+    assert_encoded_length(55, 76, config);
+    assert_encoded_length(56, 76, config);
+    assert_encoded_length(57, 76, config);
+
+    // one fewer than MIME
+    assert_encoded_length(58, 81, config);
+    assert_encoded_length(59, 81, config);
+    assert_encoded_length(60, 81, config);
+}
+
+#[test]
+fn encoded_size_overflow() {
+    assert_eq!(None, encoded_size(std::usize::MAX, &STANDARD));
+}
+
+#[test]
+fn roundtrip_random_config_short() {
+    // exercise the slower encode/decode routines that operate on shorter buffers more vigorously
+    roundtrip_random_config(Range::new(0, 50), Range::new(0, 50), 10_000);
+}
+
+#[test]
+fn roundtrip_random_config_long() {
+    roundtrip_random_config(Range::new(0, 1000), Range::new(0, 1000), 10_000);
+}
+
+#[test]
+fn encode_into_nonempty_buffer_doesnt_clobber_existing_contents() {
+    let mut orig_data = Vec::new();
+    let mut prefix = String::new();
+    let mut encoded_data_no_prefix = String::new();
+    let mut encoded_data_with_prefix = String::new();
+    let mut decoded = Vec::new();
+
+    let prefix_len_range = Range::new(0, 1000);
+    let input_len_range = Range::new(0, 1000);
+    let line_len_range = Range::new(1, 1000);
+
+    let mut rng = rand::weak_rng();
+
+    for _ in 0..10_000 {
+        orig_data.clear();
+        prefix.clear();
+        encoded_data_no_prefix.clear();
+        encoded_data_with_prefix.clear();
+        decoded.clear();
+
+        let input_len = input_len_range.ind_sample(&mut rng);
+
+        for _ in 0..input_len {
+            orig_data.push(rng.gen());
+        }
+
+        let prefix_len = prefix_len_range.ind_sample(&mut rng);
+        for _ in 0..prefix_len {
+            // getting convenient random single-byte printable chars that aren't base64 is annoying
+            prefix.push('#');
+        }
+        encoded_data_with_prefix.push_str(&prefix);
+
+        let config = random_config(&mut rng, &line_len_range);
+        encode_config_buf(&orig_data, config, &mut encoded_data_no_prefix);
+        encode_config_buf(&orig_data, config, &mut encoded_data_with_prefix);
+
+        assert_eq!(encoded_data_no_prefix.len() + prefix_len, encoded_data_with_prefix.len());
+        assert_encode_sanity(&encoded_data_no_prefix, &config, input_len);
+        assert_encode_sanity(&encoded_data_with_prefix[prefix_len..], &config, input_len);
+
+        // append plain encode onto prefix
+        prefix.push_str(&mut encoded_data_no_prefix);
+
+        assert_eq!(prefix, encoded_data_with_prefix);
+
+        // since we know we have the correct count of line endings, it's reasonable to simply remove
+        // them without worrying about where they are
+        let encoded_no_line_endings: String = encoded_data_no_prefix.chars()
+            .filter(|&c| c != '\r' && c != '\n')
+            .collect();
+
+        decode_config_buf(&encoded_no_line_endings, config, &mut decoded).unwrap();
+        assert_eq!(orig_data, decoded);
+    }
+}
+
+#[test]
+fn decode_into_nonempty_buffer_doesnt_clobber_existing_contents() {
+    let mut orig_data = Vec::new();
+    let mut encoded_data = String::new();
+    let mut decoded_with_prefix = Vec::new();
+    let mut decoded_without_prefix = Vec::new();
+    let mut prefix = Vec::new();
+
+    let prefix_len_range = Range::new(0, 1000);
+    let input_len_range = Range::new(0, 1000);
+    let line_len_range = Range::new(1, 1000);
+
+    let mut rng = rand::weak_rng();
+
+    for _ in 0..10_000 {
+        orig_data.clear();
+        encoded_data.clear();
+        decoded_with_prefix.clear();
+        decoded_without_prefix.clear();
+        prefix.clear();
+
+        let input_len = input_len_range.ind_sample(&mut rng);
+
+        for _ in 0..input_len {
+            orig_data.push(rng.gen());
+        }
+
+        let config = random_config(&mut rng, &line_len_range);
+        encode_config_buf(&orig_data, config, &mut encoded_data);
+        assert_encode_sanity(&encoded_data, &config, input_len);
+
+        let prefix_len = prefix_len_range.ind_sample(&mut rng);
+
+        // fill the buf with a prefix
+        for _ in 0..prefix_len {
+            prefix.push(rng.gen());
+        }
+
+        decoded_with_prefix.resize(prefix_len, 0);
+        decoded_with_prefix.copy_from_slice(&prefix);
+
+        // remove line wrapping
+        let encoded_no_line_endings: String = encoded_data.chars()
+            .filter(|&c| c != '\r' && c != '\n')
+            .collect();
+
+        // decode into the non-empty buf
+        decode_config_buf(&encoded_no_line_endings, config, &mut decoded_with_prefix).unwrap();
+        // also decode into the empty buf
+        decode_config_buf(&encoded_no_line_endings, config, &mut decoded_without_prefix).unwrap();
+
+        assert_eq!(prefix_len + decoded_without_prefix.len(), decoded_with_prefix.len());
+        assert_eq!(orig_data, decoded_without_prefix);
+
+        // append plain decode onto prefix
+        prefix.append(&mut decoded_without_prefix);
+
+        assert_eq!(prefix, decoded_with_prefix);
+    }
+}
+
+#[test]
+fn encode_with_padding_random_valid_utf8() {
+    let mut input = Vec::new();
+    let mut output = Vec::new();
+
+    let input_len_range = Range::new(0, 1000);
+    let line_len_range = Range::new(1, 1000);
+
+    let mut rng = rand::weak_rng();
+
+    for _ in 0..10_000 {
+        input.clear();
+        output.clear();
+
+        let input_len = input_len_range.ind_sample(&mut rng);
+
+        for _ in 0..input_len {
+            input.push(rng.gen());
+        }
+
+        let config = random_config(&mut rng, &line_len_range);
+
+        // fill up the output buffer with garbage
+        let encoded_size = encoded_size(input_len, &config).unwrap();
+        for _ in 0..encoded_size {
+            output.push(rng.gen());
+        }
+
+        let orig_output_buf = output.to_vec();
+
+        let bytes_written =
+            encode_with_padding(&input, &mut output, config.char_set.encode_table(), config.pad);
+
+        let line_ending_bytes = total_line_ending_bytes(bytes_written, &config);
+        assert_eq!(encoded_size, bytes_written + line_ending_bytes);
+        // make sure the part beyond bytes_written is the same garbage it was before
+        assert_eq!(orig_output_buf[bytes_written..], output[bytes_written..]);
+
+        // make sure the encoded bytes are UTF-8
+        let _ = str::from_utf8(&output[0..bytes_written]).unwrap();
+    }
+}
+
+#[test]
+fn encode_to_slice_random_valid_utf8() {
+    let mut input = Vec::new();
+    let mut output = Vec::new();
+
+    let input_len_range = Range::new(0, 1000);
+    let line_len_range = Range::new(1, 1000);
+
+    let mut rng = rand::weak_rng();
+
+    for _ in 0..10_000 {
+        input.clear();
+        output.clear();
+
+        let input_len = input_len_range.ind_sample(&mut rng);
+
+        for _ in 0..input_len {
+            input.push(rng.gen());
+        }
+
+        let config = random_config(&mut rng, &line_len_range);
+
+
+        // fill up the output buffer with garbage
+        let encoded_size = encoded_size(input_len, &config).unwrap();
+        for _ in 0..encoded_size {
+            output.push(rng.gen());
+        }
+
+        let orig_output_buf = output.to_vec();
+
+        let bytes_written =
+            encode_to_slice(&input, &mut output, config.char_set.encode_table());
+
+        // make sure the part beyond bytes_written is the same garbage it was before
+        assert_eq!(orig_output_buf[bytes_written..], output[bytes_written..]);
+
+        // make sure the encoded bytes are UTF-8
+        let _ = str::from_utf8(&output[0..bytes_written]).unwrap();
+    }
+}
+
+#[test]
+fn add_padding_random_valid_utf8(){
+    let mut output = Vec::new();
+
+    let mut rng = rand::weak_rng();
+
+    // cover our bases for length % 3
+    for input_len in 0..10 {
+        output.clear();
+
+        // fill output with random
+        for _ in 0..10 {
+            output.push(rng.gen());
+        }
+
+        let orig_output_buf = output.to_vec();
+
+        let bytes_written =
+            add_padding(input_len, &mut output);
+
+        // make sure the part beyond bytes_written is the same garbage it was before
+        assert_eq!(orig_output_buf[bytes_written..], output[bytes_written..]);
+
+        // make sure the encoded bytes are UTF-8
+        let _ = str::from_utf8(&output[0..bytes_written]).unwrap();
+    }
+}
+
+fn total_line_ending_bytes(encoded_len: usize, config: &Config) -> usize {
+    match config.line_wrap {
+        LineWrap::NoWrap => 0,
+        LineWrap::Wrap(line_len, line_ending) =>
+            line_wrap_parameters(encoded_len, line_len, line_ending).total_line_endings_len
+    }
+}
+
+fn assert_encoded_length(input_len: usize, encoded_len: usize, config: Config) {
+    assert_eq!(encoded_len, encoded_size(input_len, &config).unwrap());
+
+    let mut bytes: Vec<u8> = Vec::new();
+    let mut rng = rand::weak_rng();
+
+    for _ in 0..input_len {
+        bytes.push(rng.gen());
+    }
+
+    let encoded = encode_config(&bytes, config);
+    assert_encode_sanity(&encoded, &config, input_len);
+
+    assert_eq!(encoded_len, encoded.len());
+}
+
+fn assert_encode_sanity(encoded: &str, config: &Config, input_len: usize) {
+    let input_rem = input_len % 3;
+    let (expected_padding_len, last_encoded_chunk_len) = if input_rem > 0 {
+        if config.pad {
+            (3 - input_rem, 4)
+        } else {
+            (0, input_rem + 1)
+        }
+    } else {
+        (0, 0)
+    };
+
+    let b64_only_len = (input_len / 3) * 4 + last_encoded_chunk_len;
+
+    let expected_line_ending_len = match config.line_wrap {
+        LineWrap::NoWrap => 0,
+        LineWrap::Wrap(line_len, line_ending) =>
+            line_wrap_parameters(b64_only_len, line_len, line_ending).total_line_endings_len
+    };
+
+    let expected_encoded_len = encoded_size(input_len, &config).unwrap();
+
+    assert_eq!(expected_encoded_len, encoded.len());
+
+    let line_endings_len = encoded.chars().filter(|&c| c == '\r' || c == '\n').count();
+    let padding_len = encoded.chars().filter(|&c| c == '=').count();
+
+    assert_eq!(expected_padding_len, padding_len);
+    assert_eq!(expected_line_ending_len, line_endings_len);
+
+    let _ = str::from_utf8(encoded.as_bytes()).expect("Base64 should be valid utf8");
+}
+
+fn roundtrip_random_config(input_len_range: Range<usize>, line_len_range: Range<usize>,
+                           iterations: u32) {
+    let mut input_buf: Vec<u8> = Vec::new();
+    let mut encoded_buf = String::new();
+    let mut rng = rand::weak_rng();
+
+    for _ in 0..iterations {
+        input_buf.clear();
+        encoded_buf.clear();
+
+        let input_len = input_len_range.ind_sample(&mut rng);
+
+        let config = random_config(&mut rng, &line_len_range);
+
+        for _ in 0..input_len {
+            input_buf.push(rng.gen());
+        }
+
+        encode_config_buf(&input_buf, config, &mut encoded_buf);
+
+        assert_encode_sanity(&encoded_buf, &config, input_len);
+
+        // remove line wrapping
+        let encoded_no_line_endings: String = encoded_buf.chars()
+            .filter(|&c| c != '\r' && c != '\n')
+            .collect();
+
+        assert_eq!(input_buf, decode_config(&encoded_no_line_endings, config).unwrap());
+    }
+}
+
+pub fn random_config<R: Rng>(rng: &mut R, line_len_range: &Range<usize>) -> Config {
+    let line_wrap = if rng.gen() {
+        LineWrap::NoWrap
+    } else {
+        let line_len = line_len_range.ind_sample(rng);
+
+        let line_ending = if rng.gen() {
+            LineEnding::LF
+        } else {
+            LineEnding::CRLF
+        };
+
+        LineWrap::Wrap(line_len, line_ending)
+    };
+
+    let charset = if rng.gen() {
+        CharacterSet::UrlSafe
+    } else {
+        CharacterSet::Standard
+    };
+
+    Config::new(charset, rng.gen(), rng.gen(), line_wrap)
+}
--- a/third_party/rust/base64/tests/tests.rs
+++ b/third_party/rust/base64/tests/tests.rs
@@ -13,138 +13,71 @@ fn compare_decode(expected: &str, target
     assert_eq!(expected, String::from_utf8(decode(target).unwrap()).unwrap());
     assert_eq!(expected, String::from_utf8(decode(target.as_bytes()).unwrap()).unwrap());
 }
 
 fn compare_decode_mime(expected: &str, target: &str) {
     assert_eq!(expected, String::from_utf8(decode_config(target, MIME).unwrap()).unwrap());
 }
 
-fn push_rand(buf: &mut Vec<u8>, len: usize) {
-    let mut r = rand::weak_rng();
-
-    for _ in 0..len {
-        buf.push(r.gen::<u8>());
-    }
-}
-
-// generate every possible byte string recursively and test encode/decode roundtrip
-fn roundtrip_append_recurse(byte_buf: &mut Vec<u8>, str_buf: &mut String, remaining_bytes: usize) {
-    let orig_length = byte_buf.len();
-    for b in 0..256 {
-        byte_buf.push(b as u8);
-
-        if remaining_bytes > 1 {
-            roundtrip_append_recurse(byte_buf, str_buf, remaining_bytes - 1)
-        } else {
-            encode_config_buf(&byte_buf, STANDARD, str_buf);
-            let roundtrip_bytes = decode_config(&str_buf, STANDARD).unwrap();
-            assert_eq!(*byte_buf, roundtrip_bytes);
-
-            str_buf.clear();
-
-        }
-
-        byte_buf.truncate(orig_length);
-    }
-}
-
-// generate every possible byte string recursively and test encode/decode roundtrip with
-// padding removed
-fn roundtrip_append_recurse_strip_padding(byte_buf: &mut Vec<u8>, str_buf: &mut String,
-                                          remaining_bytes: usize) {
-    let orig_length = byte_buf.len();
-    for b in 0..256 {
-        byte_buf.push(b as u8);
-
-        if remaining_bytes > 1 {
-            roundtrip_append_recurse_strip_padding(byte_buf, str_buf, remaining_bytes - 1)
-        } else {
-            encode_config_buf(&byte_buf, STANDARD, str_buf);
-            {
-                let trimmed = str_buf.trim_right_matches('=');
-                let roundtrip_bytes = decode_config(&trimmed, STANDARD).unwrap();
-                assert_eq!(*byte_buf, roundtrip_bytes);
-            }
-            str_buf.clear();
-        }
-
-        byte_buf.truncate(orig_length);
-    }
-}
-
 // generate random contents of the specified length and test encode/decode roundtrip
-fn roundtrip_random(byte_buf: &mut Vec<u8>, str_buf: &mut String, byte_len: usize,
-                    approx_values_per_byte: u8, max_rounds: u64) {
+fn roundtrip_random(byte_buf: &mut Vec<u8>, str_buf: &mut String, config: Config,
+                    byte_len: usize, approx_values_per_byte: u8, max_rounds: u64) {
+    // let the short ones be short but don't let it get too crazy large
     let num_rounds = calculate_number_of_rounds(byte_len, approx_values_per_byte, max_rounds);
     let mut r = rand::weak_rng();
+    let mut decode_buf = Vec::new();
 
     for _ in 0..num_rounds {
         byte_buf.clear();
         str_buf.clear();
+        decode_buf.clear();
         while byte_buf.len() < byte_len {
             byte_buf.push(r.gen::<u8>());
         }
 
-        encode_config_buf(&byte_buf, STANDARD, str_buf);
-        let roundtrip_bytes = decode_config(&str_buf, STANDARD).unwrap();
-
-        assert_eq!(*byte_buf, roundtrip_bytes);
-    }
-}
+        encode_config_buf(&byte_buf, config, str_buf);
+        decode_config_buf(&str_buf, config, &mut decode_buf).unwrap();
 
-// generate random contents of the specified length and test encode/decode roundtrip
-fn roundtrip_random_strip_padding(byte_buf: &mut Vec<u8>, str_buf: &mut String, byte_len: usize,
-                    approx_values_per_byte: u8, max_rounds: u64) {
-    // let the short ones be short but don't let it get too crazy large
-    let num_rounds = calculate_number_of_rounds(byte_len, approx_values_per_byte, max_rounds);
-    let mut r = rand::weak_rng();
-
-    for _ in 0..num_rounds {
-        byte_buf.clear();
-        str_buf.clear();
-        while byte_buf.len() < byte_len {
-            byte_buf.push(r.gen::<u8>());
-        }
-
-        encode_config_buf(&byte_buf, STANDARD, str_buf);
-        let trimmed = str_buf.trim_right_matches('=');
-        let roundtrip_bytes = decode_config(&trimmed, STANDARD).unwrap();
-
-        assert_eq!(*byte_buf, roundtrip_bytes);
+        assert_eq!(byte_buf, &decode_buf);
     }
 }
 
 fn calculate_number_of_rounds(byte_len: usize, approx_values_per_byte: u8, max: u64) -> u64 {
     // don't overflow
     let mut prod = approx_values_per_byte as u64;
 
     for _ in 0..byte_len {
         if prod > max {
             return max;
         }
 
         prod = prod.saturating_mul(prod);
     }
 
-    return prod;
+    prod
+}
+
+fn no_pad_config() -> Config {
+    Config::new(CharacterSet::Standard, false, false, LineWrap::NoWrap)
 }
 
 //-------
 //decode
 
 #[test]
 fn decode_rfc4648_0() {
     compare_decode("", "");
 }
 
 #[test]
 fn decode_rfc4648_1() {
     compare_decode("f", "Zg==");
 }
+
 #[test]
 fn decode_rfc4648_1_just_a_bit_of_padding() {
     // allows less padding than required
     compare_decode("f", "Zg=");
 }
 
 #[test]
 fn decode_rfc4648_1_no_padding() {
@@ -189,347 +122,187 @@ fn decode_rfc4648_5_no_padding() {
 #[test]
 fn decode_rfc4648_6() {
     compare_decode("foobar", "Zm9vYmFy");
 }
 
 //this is a MAY in the rfc: https://tools.ietf.org/html/rfc4648#section-3.3
 #[test]
 fn decode_pad_inside_fast_loop_chunk_error() {
-    // can't PartialEq Base64Error, so we do this the hard way
-    match decode("YWxpY2U=====").unwrap_err() {
-        DecodeError::InvalidByte(offset, byte) => {
-            // since the first 8 bytes are handled in the fast loop, the
-            // padding is an error. Could argue that the *next* padding
-            // byte is technically the first erroneous one, but reporting
-            // that accurately is more complex and probably nobody cares
-            assert_eq!(7, offset);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push_str("YWxpY2U=====");
+
+        // since the first 8 bytes are handled in the fast loop, the
+        // padding is an error. Could argue that the *next* padding
+        // byte is technically the first erroneous one, but reporting
+        // that accurately is more complex and probably nobody cares
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4 + 7, b'='), decode(&s).unwrap_err());
     }
 }
 
 #[test]
 fn decode_extra_pad_after_fast_loop_chunk_error() {
-    match decode("YWxpY2UABB===").unwrap_err() {
-        DecodeError::InvalidByte(offset, byte) => {
-            // extraneous third padding byte
-            assert_eq!(12, offset);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
-    };
-}
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push_str("YWxpY2UABB===");
 
-
-//same
-#[test]
-fn decode_absurd_pad_error() {
-    match decode("==Y=Wx===pY=2U=====").unwrap_err() {
-        DecodeError::InvalidByte(size, byte) => {
-            assert_eq!(0, size);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
+        // first padding byte
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4 + 10, b'='), decode(&s).unwrap_err());
     }
 }
 
 #[test]
-fn decode_starts_with_padding_single_quad_error() {
-    match decode("====").unwrap_err() {
-        DecodeError::InvalidByte(offset, byte) => {
-            // with no real input, first padding byte is bogus
-            assert_eq!(0, offset);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
+fn decode_absurd_pad_error() {
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push_str("==Y=Wx===pY=2U=====");
+
+        // first padding byte
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4, b'='), decode(&s).unwrap_err());
     }
 }
 
 #[test]
 fn decode_extra_padding_in_trailing_quad_returns_error() {
-    match decode("zzz==").unwrap_err() {
-        DecodeError::InvalidByte(size, byte) => {
-            // first unneeded padding byte
-            assert_eq!(4, size);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push_str("EEE==");
+
+        // first padding byte -- which would be legal if it was by itself
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4 + 3, b'='), decode(&s).unwrap_err());
     }
 }
 
 #[test]
 fn decode_extra_padding_in_trailing_quad_2_returns_error() {
-    match decode("zz===").unwrap_err() {
-        DecodeError::InvalidByte(size, byte) => {
-            // first unneeded padding byte
-            assert_eq!(4, size);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push_str("EE===");
+
+        // first padding byte -- which would be legal if it was by itself
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4 + 2, b'='), decode(&s).unwrap_err());
     }
 }
 
-
 #[test]
 fn decode_start_second_quad_with_padding_returns_error() {
-    match decode("zzzz=").unwrap_err() {
-        DecodeError::InvalidByte(size, byte) => {
-            // first unneeded padding byte
-            assert_eq!(4, size);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push_str("=");
+
+        // first padding byte -- must have two non-padding bytes in a quad
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4, b'='), decode(&s).unwrap_err());
+
+        // two padding bytes -- same
+        s.push_str("=");
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4, b'='), decode(&s).unwrap_err());
+
+        s.push_str("=");
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4, b'='), decode(&s).unwrap_err());
+
+        s.push_str("=");
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4, b'='), decode(&s).unwrap_err());
     }
 }
 
 #[test]
 fn decode_padding_in_last_quad_followed_by_non_padding_returns_error() {
-    match decode("zzzz==z").unwrap_err() {
-        DecodeError::InvalidByte(size, byte) => {
-            assert_eq!(4, size);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
-    }
-}
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push_str("==E");
 
-#[test]
-fn decode_too_short_with_padding_error() {
-    match decode("z==").unwrap_err() {
-        DecodeError::InvalidByte(size, byte) => {
-            // first unneeded padding byte
-            assert_eq!(1, size);
-            assert_eq!(0x3D, byte);
-        }
-        _ => assert!(false)
+        // first padding byte -- must have two non-padding bytes in a quad
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4, b'='), decode(&s).unwrap_err());
     }
 }
 
 #[test]
-fn decode_too_short_without_padding_error() {
-    match decode("z").unwrap_err() {
-        DecodeError::InvalidLength => {}
-        _ => assert!(false)
-    }
-}
+fn decode_one_char_in_quad_with_padding_error() {
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push_str("E=");
+
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4 + 1, b'='), decode(&s).unwrap_err());
 
-#[test]
-fn decode_too_short_second_quad_without_padding_error() {
-    match decode("zzzzX").unwrap_err() {
-        DecodeError::InvalidLength => {}
-        _ => assert!(false)
+        // more padding doesn't change the error
+        s.push_str("=");
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4 + 1, b'='), decode(&s).unwrap_err());
+
+        s.push_str("=");
+        assert_eq!(DecodeError::InvalidByte(num_quads * 4 + 1, b'='), decode(&s).unwrap_err());
     }
 }
 
 #[test]
-fn decode_error_for_bogus_char_in_right_position() {
-    for length in 1..25 {
-        for error_position in 0_usize..length {
-            let prefix: String = std::iter::repeat("A").take(error_position).collect();
-            let suffix: String = std::iter::repeat("B").take(length - error_position - 1).collect();
+fn decode_one_char_in_quad_without_padding_error() {
+    for num_quads in 0..25 {
+        let mut s: String = std::iter::repeat("ABCD").take(num_quads).collect();
+        s.push('E');
+
+        assert_eq!(DecodeError::InvalidLength, decode(&s).unwrap_err());
+    }
+}
 
-            let input = prefix + "%" + &suffix;
-            assert_eq!(length, input.len(),
-                "length {} error position {}", length, error_position);
+#[test]
+fn decode_reject_invalid_bytes_with_correct_error() {
+    for length in 1..100 {
+        for index in 0_usize..length {
+            for invalid_byte in " \t\n\r\x0C\x0B\x00%*.".bytes() {
+                let prefix: String = std::iter::repeat("A").take(index).collect();
+                let suffix: String = std::iter::repeat("B").take(length - index - 1).collect();
 
-            match decode(&input).unwrap_err() {
-                DecodeError::InvalidByte(size, byte) => {
-                    assert_eq!(error_position, size,
-                        "length {} error position {}", length, error_position);
-                    assert_eq!(0x25, byte);
-                }
-                _ => assert!(false)
+                let input = prefix + &String::from_utf8(vec![invalid_byte]).unwrap() + &suffix;
+                assert_eq!(length, input.len(), "length {} error position {}", length, index);
+
+                assert_eq!(DecodeError::InvalidByte(index, invalid_byte),
+                    decode(&input).unwrap_err());
             }
         }
     }
 }
 
 #[test]
-fn decode_into_nonempty_buffer_doesnt_clobber_existing_contents() {
-    let mut orig_data = Vec::new();
-    let mut encoded_data = String::new();
-    let mut decoded_with_prefix = Vec::new();
-    let mut decoded_without_prefix = Vec::new();
-    let mut prefix = Vec::new();
-    for encoded_length in 0_usize..26 {
-        if encoded_length % 4 == 1 {
-            // can't have a lone byte in a quad of input
-            continue;
-        };
-
-        let raw_data_byte_triples = encoded_length / 4;
-        // 4 base64 bytes -> 3 input bytes, 3 -> 2, 2 -> 1, 0 -> 0
-        let raw_data_byte_leftovers = (encoded_length % 4).saturating_sub(1);
-
-        // we'll borrow buf to make some data to encode
-        orig_data.clear();
-        push_rand(&mut orig_data, raw_data_byte_triples * 3 + raw_data_byte_leftovers);
-
-        encoded_data.clear();
-        encode_config_buf(&orig_data, STANDARD, &mut encoded_data);
-
-        assert_eq!(encoded_length, encoded_data.trim_right_matches('=').len());
-
-        for prefix_length in 1..26 {
-            decoded_with_prefix.clear();
-            decoded_without_prefix.clear();
-            prefix.clear();
-
-            // fill the buf with a prefix
-            push_rand(&mut prefix, prefix_length);
-            decoded_with_prefix.resize(prefix_length, 0);
-            decoded_with_prefix.copy_from_slice(&prefix);
-
-            // decode into the non-empty buf
-            decode_config_buf(&encoded_data, STANDARD, &mut decoded_with_prefix).unwrap();
-            // also decode into the empty buf
-            decode_config_buf(&encoded_data, STANDARD, &mut decoded_without_prefix).unwrap();
-
-            assert_eq!(prefix_length + decoded_without_prefix.len(), decoded_with_prefix.len());
-
-            // append plain decode onto prefix
-            prefix.append(&mut decoded_without_prefix);
-
-            assert_eq!(prefix, decoded_with_prefix);
-        }
-    }
-}
-
-#[test]
-fn roundtrip_random_no_fast_loop() {
+fn roundtrip_random_short_standard() {
     let mut byte_buf: Vec<u8> = Vec::new();
     let mut str_buf = String::new();
 
-    for input_len in 0..9 {
-        roundtrip_random(&mut byte_buf, &mut str_buf, input_len, 4, 10000);
-    }
-}
-
-#[test]
-fn roundtrip_random_with_fast_loop() {
-    let mut byte_buf: Vec<u8> = Vec::new();
-    let mut str_buf = String::new();
-
-    for input_len in 9..26 {
-        roundtrip_random(&mut byte_buf, &mut str_buf, input_len, 4, 100000);
-    }
-}
-
-#[test]
-fn roundtrip_random_no_fast_loop_no_padding() {
-    let mut byte_buf: Vec<u8> = Vec::new();
-    let mut str_buf = String::new();
-
-    for input_len in 0..9 {
-        roundtrip_random_strip_padding(&mut byte_buf, &mut str_buf, input_len, 4, 10000);
+    for input_len in 0..40 {
+        roundtrip_random(&mut byte_buf, &mut str_buf, STANDARD, input_len, 4, 10000);
     }
 }
 
 #[test]
-fn roundtrip_random_with_fast_loop_no_padding() {
+fn roundtrip_random_with_fast_loop_standard() {
     let mut byte_buf: Vec<u8> = Vec::new();
     let mut str_buf = String::new();
 
-    for input_len in 9..26 {
-        roundtrip_random_strip_padding(&mut byte_buf, &mut str_buf, input_len, 4, 100000);
+    for input_len in 40..100 {
+        roundtrip_random(&mut byte_buf, &mut str_buf, STANDARD, input_len, 4, 1000);
     }
 }
 
 #[test]
-fn roundtrip_all_1_byte() {
-    let mut byte_buf: Vec<u8> = Vec::new();
-    let mut str_buf = String::new();
-    roundtrip_append_recurse(&mut byte_buf, &mut str_buf, 1);
-}
-
-#[test]
-fn roundtrip_all_1_byte_no_padding() {
-    let mut byte_buf: Vec<u8> = Vec::new();
-    let mut str_buf = String::new();
-    roundtrip_append_recurse_strip_padding(&mut byte_buf, &mut str_buf, 1);
-}
-
-#[test]
-fn roundtrip_all_2_byte() {
-    let mut byte_buf: Vec<u8> = Vec::new();
-    let mut str_buf = String::new();
-    roundtrip_append_recurse(&mut byte_buf, &mut str_buf, 2);
-}
-
-#[test]
-fn roundtrip_all_2_byte_no_padding() {
-    let mut byte_buf: Vec<u8> = Vec::new();
-    let mut str_buf = String::new();
-    roundtrip_append_recurse_strip_padding(&mut byte_buf, &mut str_buf, 2);
-}
-
-#[test]
-fn roundtrip_all_3_byte() {
-    let mut byte_buf: Vec<u8> = Vec::new();
-    let mut str_buf = String::new();
-    roundtrip_append_recurse(&mut byte_buf, &mut str_buf, 3);
-}
-
-#[test]
-fn roundtrip_random_4_byte() {
+fn roundtrip_random_short_no_padding() {
     let mut byte_buf: Vec<u8> = Vec::new();
     let mut str_buf = String::new();
 
-    roundtrip_random(&mut byte_buf, &mut str_buf, 4, 48, 10000);
-}
-
-//TODO like, write a thing to test every ascii val lol
-//prolly just yankput the 64 array and a 256 one later
-//is there a way to like, not have to write a fn every time
-//"hi test harness this should panic 192 times" would be nice
-//oh well whatever this is better done by a fuzzer
-
-//strip yr whitespace kids
-#[test]
-#[should_panic]
-fn decode_reject_space() {
-    assert!(decode("YWx pY2U=").is_ok());
-}
-
-#[test]
-#[should_panic]
-fn decode_reject_tab() {
-    assert!(decode("YWx\tpY2U=").is_ok());
+    for input_len in 0..40 {
+        roundtrip_random(&mut byte_buf, &mut str_buf, no_pad_config(), input_len, 4, 10000);
+    }
 }
 
 #[test]
-#[should_panic]
-fn decode_reject_ff() {
-    assert!(decode("YWx\x0cpY2U=").is_ok());
-}
-
-#[test]
-#[should_panic]
-fn decode_reject_vtab() {
-    assert!(decode("YWx\x0bpY2U=").is_ok());
-}
+fn roundtrip_random_no_padding() {
+    let mut byte_buf: Vec<u8> = Vec::new();
+    let mut str_buf = String::new();
 
-#[test]
-#[should_panic]
-fn decode_reject_nl() {
-    assert!(decode("YWx\npY2U=").is_ok());
-}
-
-#[test]
-#[should_panic]
-fn decode_reject_crnl() {
-    assert!(decode("YWx\r\npY2U=").is_ok());
-}
-
-#[test]
-#[should_panic]
-fn decode_reject_null() {
-    assert!(decode("YWx\0pY2U=").is_ok());
+    for input_len in 40..100 {
+        roundtrip_random(&mut byte_buf, &mut str_buf, no_pad_config(), input_len, 4, 1000);
+    }
 }
 
 #[test]
 fn decode_mime_allow_space() {
     assert!(decode_config("YWx pY2U=", MIME).is_ok());
 }
 
 #[test]
@@ -553,19 +326,18 @@ fn decode_mime_allow_nl() {
 }
 
 #[test]
 fn decode_mime_allow_crnl() {
     assert!(decode_config("YWx\r\npY2U=", MIME).is_ok());
 }
 
 #[test]
-#[should_panic]
 fn decode_mime_reject_null() {
-    assert!(decode_config("YWx\0pY2U=", MIME).is_ok());
+    assert_eq!(DecodeError::InvalidByte(3, 0x0),decode_config("YWx\0pY2U=", MIME).unwrap_err());
 }
 
 #[test]
 fn decode_mime_absurd_whitespace() {
     compare_decode_mime("how could you let this happen",
         "\n aG93I\n\nG\x0bNvd\r\nWxkI HlvdSB \tsZXQgdGh\rpcyBo\x0cYXBwZW4 =   ");
 }
 
@@ -638,59 +410,48 @@ fn encode_all_bytes_url() {
         bytes.push(i);
     }
     bytes.push(255); //bug with "overflowing" ranges?
 
     assert_eq!("AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0-P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn-AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq-wsbKztLW2t7i5uru8vb6_wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t_g4eLj5OXm5-jp6uvs7e7v8PHy8_T19vf4-fr7_P3-_w==", encode_config(&bytes, URL_SAFE));
 }
 
 #[test]
-fn encode_into_nonempty_buffer_doesnt_clobber_existing_contents() {
-    let mut orig_data = Vec::new();
-    let mut encoded_with_prefix = String::new();
-    let mut encoded_without_prefix = String::new();
-    let mut prefix = String::new();
-    for orig_data_length in 0_usize..26 {
-        // we'll borrow buf to make some data to encode
-        orig_data.clear();
-        push_rand(&mut orig_data, orig_data_length);
-
-        for prefix_length in 1..26 {
-            encoded_with_prefix.clear();
-            encoded_without_prefix.clear();
-            prefix.clear();
+fn encode_line_ending_lf_partial_last_line() {
+    let config = Config::new(CharacterSet::Standard, true, false,
+                             LineWrap::Wrap(3, LineEnding::LF));
+    assert_eq!("Zm9\nvYm\nFy", encode_config(b"foobar", config));
+}
 
-            for _ in 0..prefix_length {
-                prefix.push('~');
-            }
-
-            encoded_with_prefix.push_str(&prefix);
-
-            // encode into the non-empty buf
-            encode_config_buf(&orig_data, STANDARD, &mut encoded_with_prefix);
-            // also encode into the empty buf
-            encode_config_buf(&orig_data, STANDARD, &mut encoded_without_prefix);
-
-            assert_eq!(prefix_length + encoded_without_prefix.len(), encoded_with_prefix.len());
-
-            // append plain decode onto prefix
-            prefix.push_str(&mut encoded_without_prefix);
-
-            assert_eq!(prefix, encoded_with_prefix);
-        }
-    }
+#[test]
+fn encode_line_ending_crlf_partial_last_line() {
+    let config = Config::new(CharacterSet::Standard, true, false,
+                             LineWrap::Wrap(3, LineEnding::CRLF));
+    assert_eq!("Zm9\r\nvYm\r\nFy", encode_config(b"foobar", config));
 }
 
+#[test]
+fn encode_line_ending_lf_full_last_line() {
+    let config = Config::new(CharacterSet::Standard, true, false,
+                             LineWrap::Wrap(4, LineEnding::LF));
+    assert_eq!("Zm9v\nYmFy", encode_config(b"foobar", config));
+}
+
+#[test]
+fn encode_line_ending_crlf_full_last_line() {
+    let config = Config::new(CharacterSet::Standard, true, false,
+                             LineWrap::Wrap(4, LineEnding::CRLF));
+    assert_eq!("Zm9v\r\nYmFy", encode_config(b"foobar", config));
+}
 
 #[test]
 fn because_we_can() {
     compare_decode("alice", "YWxpY2U=");
     compare_decode("alice", &encode(b"alice"));
     compare_decode("alice", &encode(&decode(&encode(b"alice")).unwrap()));
 }
 
-
 #[test]
 fn encode_url_safe_without_padding() {
     let encoded = encode_config(b"alice", URL_SAFE_NO_PAD);
     assert_eq!(&encoded, "YWxpY2U");
     assert_eq!(String::from_utf8(decode(&encoded).unwrap()).unwrap(), "alice");
 }
copy from third_party/rust/byteorder/.cargo-checksum.json
copy to third_party/rust/byteorder-1.0.0/.cargo-checksum.json
copy from third_party/rust/byteorder/.travis.yml
copy to third_party/rust/byteorder-1.0.0/.travis.yml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/byteorder-1.0.0/COPYING
@@ -0,0 +1,3 @@
+This project is dual-licensed under the Unlicense and MIT licenses.
+
+You may use this code under the terms of either license.
copy from third_party/rust/byteorder/Cargo.toml
copy to third_party/rust/byteorder-1.0.0/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/byteorder-1.0.0/LICENSE-MIT
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Andrew Gallant
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/byteorder-1.0.0/README.md
@@ -0,0 +1,56 @@
+This crate provides convenience methods for encoding and decoding numbers in
+either big-endian or little-endian order.
+
+[![Build status](https://api.travis-ci.org/BurntSushi/byteorder.png)](https://travis-ci.org/BurntSushi/byteorder)
+[![](http://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder)
+
+Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org).
+
+
+### Documentation
+
+https://docs.rs/byteorder
+
+
+### Installation
+
+This crate works with Cargo and is on
+[crates.io](https://crates.io/crates/byteorder). Add it to your `Cargo.toml`
+like so:
+
+```toml
+[dependencies]
+byteorder = "1"
+```
+
+If you want to augment existing `Read` and `Write` traits, then import the
+extension methods like so:
+
+```rust
+extern crate byteorder;
+
+use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian};
+```
+
+For example:
+
+```rust
+use std::io::Cursor;
+use byteorder::{BigEndian, ReadBytesExt};
+
+let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
+// Note that we use type parameters to indicate which kind of byte order
+// we want!
+assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
+assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());
+```
+
+### `no_std` crates
+
+This crate has a feature, `std`, that is enabled by default. To use this crate
+in a `no_std` context, add the following to your `Cargo.toml`:
+
+```toml
+[dependencies]
+byteorder = { version = "1", default-features = false }
+```
new file mode 100644
--- /dev/null
+++ b/third_party/rust/byteorder-1.0.0/UNLICENSE
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
copy from third_party/rust/byteorder/benches/bench.rs
copy to third_party/rust/byteorder-1.0.0/benches/bench.rs
copy from third_party/rust/byteorder/src/lib.rs
copy to third_party/rust/byteorder-1.0.0/src/lib.rs
rename from third_party/rust/byteorder/src/new.rs
rename to third_party/rust/byteorder-1.0.0/src/new.rs
--- a/third_party/rust/byteorder/.cargo-checksum.json
+++ b/third_party/rust/byteorder/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"c8243fb884ca390f5a7b8cc45e1c0d5bbbdd7e4e82ada2dc1880b3a904c9ce12","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"b6cd79e1f2a93cd8a5c6e6dd7985c46fc26e442ae5b8ed4a0ff37a4ad4708023","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","README.md":"0559514b9d7488e96fb7a2f3c043a62fadf3495a1e10602d109ce79ee67da998","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","benches/bench.rs":"f583692d829c8dfe19b1d5b9e968ccf5c74d6733367ca183edff74041a6afedd","src/lib.rs":"b038b8a84b2b7b2143b2835185b3cbbacaf056fa8a2f03bec84bfd79c913c726","src/new.rs":"161c21b7ebb5668c7cc70b46b0eb37709e06bb9c854f2fdfc6ce3d3babcbf3de"},"package":"c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8"}
\ No newline at end of file
+{"files":{".travis.yml":"a798200a7a2a7b499b4c44f0e516cd8975dc5f4b933144d1e2b1523087330b95","CHANGELOG.md":"caa17ca58eafcd282ed7b8bd47ef0670ce30a20aad339bf2758469f09fa4559d","COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"0e636678a02b111d1ebdfdc8ac5a835a2a41370028eeadf6d5fbfd3239f531f8","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","README.md":"0559514b9d7488e96fb7a2f3c043a62fadf3495a1e10602d109ce79ee67da998","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","benches/bench.rs":"250d46461a0529a856d76a6421fd45c499bccba2c532e05dbf438c94582a8eac","src/io.rs":"5429f522221b3cce8a5c90fba7ad98b0ddad4fab44acc39763e6adabd511c021","src/lib.rs":"d31f218ca1892bea2812dd575ceb700779de704dc8bf1b9a778315ab75343c5d"},"package":"ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d"}
\ No newline at end of file
--- a/third_party/rust/byteorder/.travis.yml
+++ b/third_party/rust/byteorder/.travis.yml
@@ -5,11 +5,18 @@ rust:
   - beta
   - nightly
 script:
   - cargo build --verbose
   - cargo doc
   - cargo test --verbose
   - cargo test --verbose --no-default-features --lib
   - if [ "$TRAVIS_RUST_VERSION" = "nightly" ]; then
-      cargo bench --verbose;
-      cargo bench --verbose --no-default-features;
+      cargo test --verbose --features i128;
+      cargo test --verbose --no-default-features --features i128 --lib;
+      cargo bench --verbose --no-run;
+      cargo bench --verbose --no-run --no-default-features;
+      cargo bench --verbose --no-run --features i128;
+      cargo bench --verbose --no-run --no-default-features --features i128;
     fi
+branches:
+  only:
+    - master
new file mode 100644
--- /dev/null
+++ b/third_party/rust/byteorder/CHANGELOG.md
@@ -0,0 +1,36 @@
+1.1.0
+=====
+This release of `byteorder` features a number of fixes and improvements, mostly
+as a result of the
+[Litz Blitz evaluation](https://public.etherpad-mozilla.org/p/rust-crate-eval-byteorder).
+
+Feature enhancements:
+
+* [FEATURE #63](https://github.com/BurntSushi/byteorder/issues/63):
+  Add methods for reading/writing slices of numbers for a specific
+  endianness.
+* [FEATURE #65](https://github.com/BurntSushi/byteorder/issues/65):
+  Add support for `u128`/`i128` types. (Behind the nightly only `i128`
+  feature.)
+* [FEATURE #72](https://github.com/BurntSushi/byteorder/issues/72):
+  Add "panics" and "errors" sections for each relevant public API item.
+* [FEATURE #74](https://github.com/BurntSushi/byteorder/issues/74):
+  Add CI badges to Cargo.toml.
+* [FEATURE #75](https://github.com/BurntSushi/byteorder/issues/75):
+  Add more examples to public API items.
+* Add 24-bit read/write methods.
+* Add `BE` and `LE` type aliases for `BigEndian` and `LittleEndian`,
+  respectively.
+
+Bug fixes:
+
+* [BUG #68](https://github.com/BurntSushi/byteorder/issues/68):
+  Panic in {BigEndian,LittleEndian}::default.
+* [BUG #69](https://github.com/BurntSushi/byteorder/issues/69):
+  Seal the `ByteOrder` trait to prevent out-of-crate implementations.
+* [BUG #71](https://github.com/BurntSushi/byteorder/issues/71):
+  Guarantee that the results of `read_f32`/`read_f64` are always defined.
+* [BUG #73](https://github.com/BurntSushi/byteorder/issues/73):
+  Add crates.io categories.
+* [BUG #77](https://github.com/BurntSushi/byteorder/issues/77):
+  Add `html_root` doc attribute.
--- a/third_party/rust/byteorder/Cargo.toml
+++ b/third_party/rust/byteorder/Cargo.toml
@@ -1,26 +1,44 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "byteorder"
-version = "1.0.0"  #:version
+version = "1.1.0"
 authors = ["Andrew Gallant <jamslam@gmail.com>"]
 description = "Library for reading/writing numbers in big-endian and little-endian."
+homepage = "https://github.com/BurntSushi/byteorder"
 documentation = "https://docs.rs/byteorder"
-homepage = "https://github.com/BurntSushi/byteorder"
-repository = "https://github.com/BurntSushi/byteorder"
 readme = "README.md"
 keywords = ["byte", "endian", "big-endian", "little-endian", "binary"]
+categories = ["encoding", "parsing"]
 license = "Unlicense/MIT"
+repository = "https://github.com/BurntSushi/byteorder"
+[profile.bench]
+opt-level = 3
 
 [lib]
 name = "byteorder"
 bench = false
+[dev-dependencies.rand]
+version = "0.3"
 
-[dev-dependencies]
-quickcheck = "0.4"
-rand = "0.3"
+[dev-dependencies.quickcheck]
+version = "0.4"
+default-features = false
 
 [features]
 default = ["std"]
+i128 = []
 std = []
-
-[profile.bench]
-opt-level = 3
+[badges.travis-ci]
+branch = "master"
+repository = "https://github.com/BurntSushi/byteorder"
--- a/third_party/rust/byteorder/benches/bench.rs
+++ b/third_party/rust/byteorder/benches/bench.rs
@@ -1,11 +1,13 @@
+#![cfg_attr(feature = "i128", feature(i128))]
 #![feature(test)]
 
 extern crate byteorder;
+extern crate rand;
 extern crate test;
 
 macro_rules! bench_num {
     ($name:ident, $read:ident, $bytes:expr, $data:expr) => (
         mod $name {
             use byteorder::{ByteOrder, BigEndian, NativeEndian, LittleEndian};
             use super::test::Bencher;
             use super::test::black_box as bb;
@@ -141,8 +143,178 @@ bench_num!(uint_8, read_uint, 8, [1, 2, 
 bench_num!(int_1, read_int, 1, [1]);
 bench_num!(int_2, read_int, 2, [1, 2]);
 bench_num!(int_3, read_int, 3, [1, 2, 3]);
 bench_num!(int_4, read_int, 4, [1, 2, 3, 4]);
 bench_num!(int_5, read_int, 5, [1, 2, 3, 4, 5]);
 bench_num!(int_6, read_int, 6, [1, 2, 3, 4, 5, 6]);
 bench_num!(int_7, read_int, 7, [1, 2, 3, 4, 5, 6, 7]);
 bench_num!(int_8, read_int, 8, [1, 2, 3, 4, 5, 6, 7, 8]);
+
+#[cfg(feature = "i128")]
+bench_num!(u128, MAX, read_u128, write_u128,
+    16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+#[cfg(feature = "i128")]
+bench_num!(i128, MAX, read_i128, write_i128,
+    16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+
+#[cfg(feature = "i128")]
+bench_num!(uint128_1, read_uint128,
+    1, [1]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_2, read_uint128,
+    2, [1, 2]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_3, read_uint128,
+    3, [1, 2, 3]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_4, read_uint128,
+    4, [1, 2, 3, 4]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_5, read_uint128,
+    5, [1, 2, 3, 4, 5]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_6, read_uint128,
+    6, [1, 2, 3, 4, 5, 6]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_7, read_uint128,
+    7, [1, 2, 3, 4, 5, 6, 7]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_8, read_uint128,
+    8, [1, 2, 3, 4, 5, 6, 7, 8]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_9, read_uint128,
+    9, [1, 2, 3, 4, 5, 6, 7, 8, 9]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_10, read_uint128,
+    10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_11, read_uint128,
+    11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_12, read_uint128,
+    12, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_13, read_uint128,
+    13, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_14, read_uint128,
+    14, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_15, read_uint128,
+    15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+#[cfg(feature = "i128")]
+bench_num!(uint128_16, read_uint128,
+    16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+
+#[cfg(feature = "i128")]
+bench_num!(int128_1, read_int128,
+    1, [1]);
+#[cfg(feature = "i128")]
+bench_num!(int128_2, read_int128,
+    2, [1, 2]);
+#[cfg(feature = "i128")]
+bench_num!(int128_3, read_int128,
+    3, [1, 2, 3]);
+#[cfg(feature = "i128")]
+bench_num!(int128_4, read_int128,
+    4, [1, 2, 3, 4]);
+#[cfg(feature = "i128")]
+bench_num!(int128_5, read_int128,
+    5, [1, 2, 3, 4, 5]);
+#[cfg(feature = "i128")]
+bench_num!(int128_6, read_int128,
+    6, [1, 2, 3, 4, 5, 6]);
+#[cfg(feature = "i128")]
+bench_num!(int128_7, read_int128,
+    7, [1, 2, 3, 4, 5, 6, 7]);
+#[cfg(feature = "i128")]
+bench_num!(int128_8, read_int128,
+    8, [1, 2, 3, 4, 5, 6, 7, 8]);
+#[cfg(feature = "i128")]
+bench_num!(int128_9, read_int128,
+    9, [1, 2, 3, 4, 5, 6, 7, 8, 9]);
+#[cfg(feature = "i128")]
+bench_num!(int128_10, read_int128,
+    10, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
+#[cfg(feature = "i128")]
+bench_num!(int128_11, read_int128,
+    11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
+#[cfg(feature = "i128")]
+bench_num!(int128_12, read_int128,
+    12, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
+#[cfg(feature = "i128")]
+bench_num!(int128_13, read_int128,
+    13, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);
+#[cfg(feature = "i128")]
+bench_num!(int128_14, read_int128,
+    14, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
+#[cfg(feature = "i128")]
+bench_num!(int128_15, read_int128,
+    15, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
+#[cfg(feature = "i128")]
+bench_num!(int128_16, read_int128,
+    16, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+
+
+macro_rules! bench_slice {
+    ($name:ident, $numty:ty, $read:ident, $write:ident) => {
+        mod $name {
+            use std::mem::size_of;
+
+            use byteorder::{ByteOrder, BigEndian, LittleEndian};
+            use rand::{self, Rng};
+            use test::Bencher;
+
+            #[bench]
+            fn read_big_endian(b: &mut Bencher) {
+                let mut numbers: Vec<$numty> =
+                    rand::thread_rng().gen_iter().take(100000).collect();
+                let mut bytes = vec![0; numbers.len() * size_of::<$numty>()];
+                BigEndian::$write(&numbers, &mut bytes);
+
+                b.bytes = bytes.len() as u64;
+                b.iter(|| {
+                    BigEndian::$read(&bytes, &mut numbers);
+                });
+            }
+
+            #[bench]
+            fn read_little_endian(b: &mut Bencher) {
+                let mut numbers: Vec<$numty> =
+                    rand::thread_rng().gen_iter().take(100000).collect();
+                let mut bytes = vec![0; numbers.len() * size_of::<$numty>()];
+                LittleEndian::$write(&numbers, &mut bytes);
+
+                b.bytes = bytes.len() as u64;
+                b.iter(|| {
+                    LittleEndian::$read(&bytes, &mut numbers);
+                });
+            }
+
+            #[bench]
+            fn write_big_endian(b: &mut Bencher) {
+                let numbers: Vec<$numty> =
+                    rand::thread_rng().gen_iter().take(100000).collect();
+                let mut bytes = vec![0; numbers.len() * size_of::<$numty>()];
+
+                b.bytes = bytes.len() as u64;
+                b.iter(|| {
+                    BigEndian::$write(&numbers, &mut bytes);
+                });
+            }
+
+            #[bench]
+            fn write_little_endian(b: &mut Bencher) {
+                let numbers: Vec<$numty> =
+                    rand::thread_rng().gen_iter().take(100000).collect();
+                let mut bytes = vec![0; numbers.len() * size_of::<$numty>()];
+
+                b.bytes = bytes.len() as u64;
+                b.iter(|| {
+                    LittleEndian::$write(&numbers, &mut bytes);
+                });
+            }
+        }
+    }
+}
+
+bench_slice!(slice_u64, u64, read_u64_into, write_u64_into);
new file mode 100644
--- /dev/null
+++ b/third_party/rust/byteorder/src/io.rs
@@ -0,0 +1,1189 @@
+use std::io::{self, Result};
+use std::slice;
+// use std::mem::transmute;
+
+use ByteOrder;
+
+/// Extends `Read` with methods for reading numbers. (For `std::io`.)
+///
+/// Most of the methods defined here have an unconstrained type parameter that
+/// must be explicitly instantiated. Typically, it is instantiated with either
+/// the `BigEndian` or `LittleEndian` types defined in this crate.
+///
+/// # Examples
+///
+/// Read unsigned 16 bit big-endian integers from a `Read`:
+///
+/// ```rust
+/// use std::io::Cursor;
+/// use byteorder::{BigEndian, ReadBytesExt};
+///
+/// let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
+/// assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
+/// assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());
+/// ```
+pub trait ReadBytesExt: io::Read {
+    /// Reads an unsigned 8 bit integer from the underlying reader.
+    ///
+    /// Note that since this reads a single byte, no byte order conversions
+    /// are used. It is included for completeness.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read unsigned 8 bit integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![2, 5]);
+    /// assert_eq!(2, rdr.read_u8().unwrap());
+    /// assert_eq!(5, rdr.read_u8().unwrap());
+    /// ```
+    #[inline]
+    fn read_u8(&mut self) -> Result<u8> {
+        let mut buf = [0; 1];
+        try!(self.read_exact(&mut buf));
+        Ok(buf[0])
+    }
+
+    /// Reads a signed 8 bit integer from the underlying reader.
+    ///
+    /// Note that since this reads a single byte, no byte order conversions
+    /// are used. It is included for completeness.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read unsigned 8 bit integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0x02, 0xfb]);
+    /// assert_eq!(2, rdr.read_i8().unwrap());
+    /// assert_eq!(-5, rdr.read_i8().unwrap());
+    /// ```
+    #[inline]
+    fn read_i8(&mut self) -> Result<i8> {
+        let mut buf = [0; 1];
+        try!(self.read_exact(&mut buf));
+        Ok(buf[0] as i8)
+    }
+
+    /// Reads an unsigned 16 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read unsigned 16 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
+    /// assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
+    /// assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_u16<T: ByteOrder>(&mut self) -> Result<u16> {
+        let mut buf = [0; 2];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_u16(&buf))
+    }
+
+    /// Reads a signed 16 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read signed 16 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0x00, 0xc1, 0xff, 0x7c]);
+    /// assert_eq!(193, rdr.read_i16::<BigEndian>().unwrap());
+    /// assert_eq!(-132, rdr.read_i16::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_i16<T: ByteOrder>(&mut self) -> Result<i16> {
+        let mut buf = [0; 2];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_i16(&buf))
+    }
+
+    /// Reads an unsigned 24 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read unsigned 24 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0x00, 0x01, 0x0b]);
+    /// assert_eq!(267, rdr.read_u24::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_u24<T: ByteOrder>(&mut self) -> Result<u32> {
+        let mut buf = [0; 3];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_u24(&buf))
+    }
+
+    /// Reads a signed 24 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read signed 24 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0xff, 0x7a, 0x33]);
+    /// assert_eq!(-34253, rdr.read_i24::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_i24<T: ByteOrder>(&mut self) -> Result<i32> {
+        let mut buf = [0; 3];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_i24(&buf))
+    }
+
+    /// Reads an unsigned 32 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read unsigned 32 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0x00, 0x00, 0x01, 0x0b]);
+    /// assert_eq!(267, rdr.read_u32::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_u32<T: ByteOrder>(&mut self) -> Result<u32> {
+        let mut buf = [0; 4];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_u32(&buf))
+    }
+
+    /// Reads a signed 32 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read signed 32 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0xff, 0xff, 0x7a, 0x33]);
+    /// assert_eq!(-34253, rdr.read_i32::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_i32<T: ByteOrder>(&mut self) -> Result<i32> {
+        let mut buf = [0; 4];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_i32(&buf))
+    }
+
+    /// Reads an unsigned 64 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read an unsigned 64 bit big-endian integer from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0x00, 0x03, 0x43, 0x95, 0x4d, 0x60, 0x86, 0x83]);
+    /// assert_eq!(918733457491587, rdr.read_u64::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_u64<T: ByteOrder>(&mut self) -> Result<u64> {
+        let mut buf = [0; 8];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_u64(&buf))
+    }
+
+    /// Reads a signed 64 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a signed 64 bit big-endian integer from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0x80, 0, 0, 0, 0, 0, 0, 0]);
+    /// assert_eq!(i64::min_value(), rdr.read_i64::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_i64<T: ByteOrder>(&mut self) -> Result<i64> {
+        let mut buf = [0; 8];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_i64(&buf))
+    }
+
+    /// Reads an unsigned 128 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read an unsigned 128 bit big-endian integer from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0x00, 0x03, 0x43, 0x95, 0x4d, 0x60, 0x86, 0x83,
+    ///     0x00, 0x03, 0x43, 0x95, 0x4d, 0x60, 0x86, 0x83
+    /// ]);
+    /// assert_eq!(16947640962301618749969007319746179, rdr.read_u128::<BigEndian>().unwrap());
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_u128<T: ByteOrder>(&mut self) -> Result<u128> {
+        let mut buf = [0; 16];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_u128(&buf))
+    }
+
+    /// Reads a signed 128 bit integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a signed 128 bit big-endian integer from a `Read`:
+    ///
+    /// ```rust
+    /// #![feature(i128_type)]
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+    /// assert_eq!(i128::min_value(), rdr.read_i128::<BigEndian>().unwrap());
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_i128<T: ByteOrder>(&mut self) -> Result<i128> {
+        let mut buf = [0; 16];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_i128(&buf))
+    }
+
+    /// Reads an unsigned n-bytes integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read an unsigned n-byte big-endian integer from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0x80, 0x74, 0xfa]);
+    /// assert_eq!(8418554, rdr.read_uint::<BigEndian>(3).unwrap());
+    #[inline]
+    fn read_uint<T: ByteOrder>(&mut self, nbytes: usize) -> Result<u64> {
+        let mut buf = [0; 8];
+        try!(self.read_exact(&mut buf[..nbytes]));
+        Ok(T::read_uint(&buf[..nbytes], nbytes))
+    }
+
+    /// Reads a signed n-bytes integer from the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read an unsigned n-byte big-endian integer from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0xc1, 0xff, 0x7c]);
+    /// assert_eq!(-4063364, rdr.read_int::<BigEndian>(3).unwrap());
+    #[inline]
+    fn read_int<T: ByteOrder>(&mut self, nbytes: usize) -> Result<i64> {
+        let mut buf = [0; 8];
+        try!(self.read_exact(&mut buf[..nbytes]));
+        Ok(T::read_int(&buf[..nbytes], nbytes))
+    }
+
+    /// Reads an unsigned n-bytes integer from the underlying reader.
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_uint128<T: ByteOrder>(&mut self, nbytes: usize) -> Result<u128> {
+        let mut buf = [0; 16];
+        try!(self.read_exact(&mut buf[..nbytes]));
+        Ok(T::read_uint128(&buf[..nbytes], nbytes))
+    }
+
+    /// Reads a signed n-bytes integer from the underlying reader.
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_int128<T: ByteOrder>(&mut self, nbytes: usize) -> Result<i128> {
+        let mut buf = [0; 16];
+        try!(self.read_exact(&mut buf[..nbytes]));
+        Ok(T::read_int128(&buf[..nbytes], nbytes))
+    }
+
+    /// Reads a IEEE754 single-precision (4 bytes) floating point number from
+    /// the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a big-endian single-precision floating point number from a `Read`:
+    ///
+    /// ```rust
+    /// use std::f32;
+    /// use std::io::Cursor;
+    ///
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0x40, 0x49, 0x0f, 0xdb,
+    /// ]);
+    /// assert_eq!(f32::consts::PI, rdr.read_f32::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_f32<T: ByteOrder>(&mut self) -> Result<f32> {
+        let mut buf = [0; 4];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_f32(&buf))
+    }
+
+    /// Reads a IEEE754 double-precision (8 bytes) floating point number from
+    /// the underlying reader.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a big-endian double-precision floating point number from a `Read`:
+    ///
+    /// ```rust
+    /// use std::f64;
+    /// use std::io::Cursor;
+    ///
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18,
+    /// ]);
+    /// assert_eq!(f64::consts::PI, rdr.read_f64::<BigEndian>().unwrap());
+    /// ```
+    #[inline]
+    fn read_f64<T: ByteOrder>(&mut self) -> Result<f64> {
+        let mut buf = [0; 8];
+        try!(self.read_exact(&mut buf));
+        Ok(T::read_f64(&buf))
+    }
+
+    /// Reads a sequence of unsigned 16 bit integers from the underlying
+    /// reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of unsigned 16 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
+    /// let mut dst = [0; 2];
+    /// rdr.read_u16_into::<BigEndian>(&mut dst).unwrap();
+    /// assert_eq!([517, 768], dst);
+    /// ```
+    #[inline]
+    fn read_u16_into<T: ByteOrder>(&mut self, dst: &mut [u16]) -> Result<()> {
+        {
+            let mut buf = unsafe { slice_to_u8_mut(dst) };
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_u16(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of unsigned 32 bit integers from the underlying
+    /// reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of unsigned 32 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0, 0, 2, 5, 0, 0, 3, 0]);
+    /// let mut dst = [0; 2];
+    /// rdr.read_u32_into::<BigEndian>(&mut dst).unwrap();
+    /// assert_eq!([517, 768], dst);
+    /// ```
+    #[inline]
+    fn read_u32_into<T: ByteOrder>(&mut self, dst: &mut [u32]) -> Result<()> {
+        {
+            let mut buf = unsafe { slice_to_u8_mut(dst) };
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_u32(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of unsigned 64 bit integers from the underlying
+    /// reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of unsigned 64 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0, 0, 0, 0, 0, 0, 2, 5,
+    ///     0, 0, 0, 0, 0, 0, 3, 0,
+    /// ]);
+    /// let mut dst = [0; 2];
+    /// rdr.read_u64_into::<BigEndian>(&mut dst).unwrap();
+    /// assert_eq!([517, 768], dst);
+    /// ```
+    #[inline]
+    fn read_u64_into<T: ByteOrder>(&mut self, dst: &mut [u64]) -> Result<()> {
+        {
+            let mut buf = unsafe { slice_to_u8_mut(dst) };
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_u64(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of unsigned 128 bit integers from the underlying
+    /// reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of unsigned 128 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5,
+    ///     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+    /// ]);
+    /// let mut dst = [0; 2];
+    /// rdr.read_u128_into::<BigEndian>(&mut dst).unwrap();
+    /// assert_eq!([517, 768], dst);
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_u128_into<T: ByteOrder>(
+        &mut self,
+        dst: &mut [u128],
+    ) -> Result<()> {
+        {
+            let mut buf = unsafe { slice_to_u8_mut(dst) };
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_u128(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of signed 16 bit integers from the underlying
+    /// reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of signed 16 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
+    /// let mut dst = [0; 2];
+    /// rdr.read_i16_into::<BigEndian>(&mut dst).unwrap();
+    /// assert_eq!([517, 768], dst);
+    /// ```
+    #[inline]
+    fn read_i16_into<T: ByteOrder>(&mut self, dst: &mut [i16]) -> Result<()> {
+        {
+            let mut buf = unsafe { slice_to_u8_mut(dst) };
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_i16(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of signed 32 bit integers from the underlying
+    /// reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of signed 32 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![0, 0, 2, 5, 0, 0, 3, 0]);
+    /// let mut dst = [0; 2];
+    /// rdr.read_i32_into::<BigEndian>(&mut dst).unwrap();
+    /// assert_eq!([517, 768], dst);
+    /// ```
+    #[inline]
+    fn read_i32_into<T: ByteOrder>(&mut self, dst: &mut [i32]) -> Result<()> {
+        {
+            let mut buf = unsafe { slice_to_u8_mut(dst) };
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_i32(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of signed 64 bit integers from the underlying
+    /// reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of signed 64 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0, 0, 0, 0, 0, 0, 2, 5,
+    ///     0, 0, 0, 0, 0, 0, 3, 0,
+    /// ]);
+    /// let mut dst = [0; 2];
+    /// rdr.read_i64_into::<BigEndian>(&mut dst).unwrap();
+    /// assert_eq!([517, 768], dst);
+    /// ```
+    #[inline]
+    fn read_i64_into<T: ByteOrder>(&mut self, dst: &mut [i64]) -> Result<()> {
+        {
+            let mut buf = unsafe { slice_to_u8_mut(dst) };
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_i64(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of signed 128 bit integers from the underlying
+    /// reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of signed 128 bit big-endian integers from a `Read`:
+    ///
+    /// ```rust
+    /// use std::io::Cursor;
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5,
+    ///     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+    /// ]);
+    /// let mut dst = [0; 2];
+    /// rdr.read_i128_into::<BigEndian>(&mut dst).unwrap();
+    /// assert_eq!([517, 768], dst);
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_i128_into<T: ByteOrder>(
+        &mut self,
+        dst: &mut [i128],
+    ) -> Result<()> {
+        {
+            let mut buf = unsafe { slice_to_u8_mut(dst) };
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_i128(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of IEEE754 single-precision (4 bytes) floating
+    /// point numbers from the underlying reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Safety
+    ///
+    /// This method is unsafe because there are no guarantees made about the
+    /// floating point values. In particular, this method does not check for
+    /// signaling NaNs, which may result in undefined behavior.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of big-endian single-precision floating point number
+    /// from a `Read`:
+    ///
+    /// ```rust
+    /// use std::f32;
+    /// use std::io::Cursor;
+    ///
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0x40, 0x49, 0x0f, 0xdb,
+    ///     0x3f, 0x80, 0x00, 0x00,
+    /// ]);
+    /// let mut dst = [0.0; 2];
+    /// unsafe {
+    ///     rdr.read_f32_into_unchecked::<BigEndian>(&mut dst).unwrap();
+    /// }
+    /// assert_eq!([f32::consts::PI, 1.0], dst);
+    /// ```
+    #[inline]
+    unsafe fn read_f32_into_unchecked<T: ByteOrder>(
+        &mut self,
+        dst: &mut [f32],
+    ) -> Result<()> {
+        {
+            let mut buf = slice_to_u8_mut(dst);
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_f32(dst);
+        Ok(())
+    }
+
+    /// Reads a sequence of IEEE754 double-precision (8 bytes) floating
+    /// point numbers from the underlying reader.
+    ///
+    /// The given buffer is either filled completely or an error is returned.
+    /// If an error is returned, the contents of `dst` are unspecified.
+    ///
+    /// # Safety
+    ///
+    /// This method is unsafe because there are no guarantees made about the
+    /// floating point values. In particular, this method does not check for
+    /// signaling NaNs, which may result in undefined behavior.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Read::read_exact`].
+    ///
+    /// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
+    ///
+    /// # Examples
+    ///
+    /// Read a sequence of big-endian single-precision floating point number
+    /// from a `Read`:
+    ///
+    /// ```rust
+    /// use std::f64;
+    /// use std::io::Cursor;
+    ///
+    /// use byteorder::{BigEndian, ReadBytesExt};
+    ///
+    /// let mut rdr = Cursor::new(vec![
+    ///     0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18,
+    ///     0x3f, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    /// ]);
+    /// let mut dst = [0.0; 2];
+    /// unsafe {
+    ///     rdr.read_f64_into_unchecked::<BigEndian>(&mut dst).unwrap();
+    /// }
+    /// assert_eq!([f64::consts::PI, 1.0], dst);
+    /// ```
+    #[inline]
+    unsafe fn read_f64_into_unchecked<T: ByteOrder>(
+        &mut self,
+        dst: &mut [f64],
+    ) -> Result<()> {
+        {
+            let mut buf = slice_to_u8_mut(dst);
+            try!(self.read_exact(buf));
+        }
+        T::from_slice_f64(dst);
+        Ok(())
+    }
+}
+
+/// All types that implement `Read` get methods defined in `ReadBytesExt`
+/// for free.
+impl<R: io::Read + ?Sized> ReadBytesExt for R {}
+
+/// Extends `Write` with methods for writing numbers. (For `std::io`.)
+///
+/// Most of the methods defined here have an unconstrained type parameter that
+/// must be explicitly instantiated. Typically, it is instantiated with either
+/// the `BigEndian` or `LittleEndian` types defined in this crate.
+///
+/// # Examples
+///
+/// Write unsigned 16 bit big-endian integers to a `Write`:
+///
+/// ```rust
+/// use byteorder::{BigEndian, WriteBytesExt};
+///
+/// let mut wtr = vec![];
+/// wtr.write_u16::<BigEndian>(517).unwrap();
+/// wtr.write_u16::<BigEndian>(768).unwrap();
+/// assert_eq!(wtr, vec![2, 5, 3, 0]);
+/// ```
+pub trait WriteBytesExt: io::Write {
+    /// Writes an unsigned 8 bit integer to the underlying writer.
+    ///
+    /// Note that since this writes a single byte, no byte order conversions
+    /// are used. It is included for completeness.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_u8(&mut self, n: u8) -> Result<()> {
+        self.write_all(&[n])
+    }
+
+    /// Writes a signed 8 bit integer to the underlying writer.
+    ///
+    /// Note that since this writes a single byte, no byte order conversions
+    /// are used. It is included for completeness.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_i8(&mut self, n: i8) -> Result<()> {
+        self.write_all(&[n as u8])
+    }
+
+    /// Writes an unsigned 16 bit integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_u16<T: ByteOrder>(&mut self, n: u16) -> Result<()> {
+        let mut buf = [0; 2];
+        T::write_u16(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes a signed 16 bit integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_i16<T: ByteOrder>(&mut self, n: i16) -> Result<()> {
+        let mut buf = [0; 2];
+        T::write_i16(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes an unsigned 24 bit integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_u24<T: ByteOrder>(&mut self, n: u32) -> Result<()> {
+        let mut buf = [0; 3];
+        T::write_u24(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes a signed 24 bit integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_i24<T: ByteOrder>(&mut self, n: i32) -> Result<()> {
+        let mut buf = [0; 3];
+        T::write_i24(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes an unsigned 32 bit integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_u32<T: ByteOrder>(&mut self, n: u32) -> Result<()> {
+        let mut buf = [0; 4];
+        T::write_u32(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes a signed 32 bit integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_i32<T: ByteOrder>(&mut self, n: i32) -> Result<()> {
+        let mut buf = [0; 4];
+        T::write_i32(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes an unsigned 64 bit integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_u64<T: ByteOrder>(&mut self, n: u64) -> Result<()> {
+        let mut buf = [0; 8];
+        T::write_u64(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes a signed 64 bit integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_i64<T: ByteOrder>(&mut self, n: i64) -> Result<()> {
+        let mut buf = [0; 8];
+        T::write_i64(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes an unsigned 128 bit integer to the underlying writer.
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_u128<T: ByteOrder>(&mut self, n: u128) -> Result<()> {
+        let mut buf = [0; 16];
+        T::write_u128(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes a signed 128 bit integer to the underlying writer.
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_i128<T: ByteOrder>(&mut self, n: i128) -> Result<()> {
+        let mut buf = [0; 16];
+        T::write_i128(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes an unsigned n-bytes integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    ///
+    /// # Panics
+    ///
+    /// If the given integer is not representable in the given number of bytes,
+    /// this method panics. If `nbytes > 8`, this method panics.
+    #[inline]
+    fn write_uint<T: ByteOrder>(
+        &mut self,
+        n: u64,
+        nbytes: usize,
+    ) -> Result<()> {
+        let mut buf = [0; 8];
+        T::write_uint(&mut buf, n, nbytes);
+        self.write_all(&buf[0..nbytes])
+    }
+
+    /// Writes a signed n-bytes integer to the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    ///
+    /// # Panics
+    ///
+    /// If the given integer is not representable in the given number of bytes,
+    /// this method panics. If `nbytes > 8`, this method panics.
+    #[inline]
+    fn write_int<T: ByteOrder>(
+        &mut self,
+        n: i64,
+        nbytes: usize,
+    ) -> Result<()> {
+        let mut buf = [0; 8];
+        T::write_int(&mut buf, n, nbytes);
+        self.write_all(&buf[0..nbytes])
+    }
+
+    /// Writes an unsigned n-bytes integer to the underlying writer.
+    ///
+    /// If the given integer is not representable in the given number of bytes,
+    /// this method panics. If `nbytes > 16`, this method panics.
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_uint128<T: ByteOrder>(
+        &mut self,
+        n: u128,
+        nbytes: usize,
+    ) -> Result<()> {
+        let mut buf = [0; 16];
+        T::write_uint128(&mut buf, n, nbytes);
+        self.write_all(&buf[0..nbytes])
+    }
+
+    /// Writes a signed n-bytes integer to the underlying writer.
+    ///
+    /// If the given integer is not representable in the given number of bytes,
+    /// this method panics. If `nbytes > 16`, this method panics.
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_int128<T: ByteOrder>(
+        &mut self,
+        n: i128,
+        nbytes: usize,
+    ) -> Result<()> {
+        let mut buf = [0; 16];
+        T::write_int128(&mut buf, n, nbytes);
+        self.write_all(&buf[0..nbytes])
+    }
+
+    /// Writes a IEEE754 single-precision (4 bytes) floating point number to
+    /// the underlying writer.
+    ///
+    /// # Errors
+    ///
+    /// This method returns the same errors as [`Write::write_all`].
+    ///
+    /// [`Write::write_all`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_all
+    #[inline]
+    fn write_f32<T: ByteOrder>(&mut self, n: f32) -> Result<()> {
+        let mut buf = [0; 4];
+        T::write_f32(&mut buf, n);
+        self.write_all(&buf)
+    }
+
+    /// Writes a IEEE754 double-precision (8 bytes) floating point number to
+    /// the underlying writer.
+    #[inline]
+    fn write_f64<T: ByteOrder>(&mut self, n: f64) -> Result<()> {
+        let mut buf = [0; 8];
+        T::write_f64(&mut buf, n);
+        self.write_all(&buf)
+    }
+}
+
+/// All types that implement `Write` get methods defined in `WriteBytesExt`
+/// for free.
+impl<W: io::Write + ?Sized> WriteBytesExt for W {}
+
+/// Convert a slice of T (where T is plain old data) to its mutable binary
+/// representation.
+///
+/// This function is wildly unsafe because it permits arbitrary modification of
+/// the binary representation of any `Copy` type. Use with care.
+unsafe fn slice_to_u8_mut<T: Copy>(slice: &mut [T]) -> &mut [u8] {
+    use std::mem::size_of;
+
+    let len = size_of::<T>() * slice.len();
+    slice::from_raw_parts_mut(slice.as_mut_ptr() as *mut u8, len)
+}
--- a/third_party/rust/byteorder/src/lib.rs
+++ b/third_party/rust/byteorder/src/lib.rs
@@ -33,43 +33,60 @@ let mut wtr = vec![];
 wtr.write_u16::<LittleEndian>(517).unwrap();
 wtr.write_u16::<LittleEndian>(768).unwrap();
 assert_eq!(wtr, vec![5, 2, 0, 3]);
 ```
 */
 
 #![deny(missing_docs)]
 #![cfg_attr(not(feature = "std"), no_std)]
+#![cfg_attr(feature = "i128", feature(i128_type))]
+#![cfg_attr(all(feature = "i128", test), feature(i128))]
+#![doc(html_root_url = "https://docs.rs/byteorder/1.0.0")]
 
 #[cfg(feature = "std")]
 extern crate core;
 
 use core::fmt::Debug;
 use core::hash::Hash;
 use core::mem::transmute;
 use core::ptr::copy_nonoverlapping;
 
 #[cfg(feature = "std")]
-pub use new::{ReadBytesExt, WriteBytesExt};
+pub use io::{ReadBytesExt, WriteBytesExt};
 
 #[cfg(feature = "std")]
-mod new;
+mod io;
 
 #[inline]
 fn extend_sign(val: u64, nbytes: usize) -> i64 {
     let shift = (8 - nbytes) * 8;
     (val << shift) as i64 >> shift
 }
 
+#[cfg(feature = "i128")]
+#[inline]
+fn extend_sign128(val: u128, nbytes: usize) -> i128 {
+    let shift = (16 - nbytes) * 8;
+    (val << shift) as i128 >> shift
+}
+
 #[inline]
 fn unextend_sign(val: i64, nbytes: usize) -> u64 {
     let shift = (8 - nbytes) * 8;
     (val << shift) as u64 >> shift
 }
 
+#[cfg(feature = "i128")]
+#[inline]
+fn unextend_sign128(val: i128, nbytes: usize) -> u128 {
+    let shift = (16 - nbytes) * 8;
+    (val << shift) as u128 >> shift
+}
+
 #[inline]
 fn pack_size(n: u64) -> usize {
     if n < 1 << 8 {
         1
     } else if n < 1 << 16 {
         2
     } else if n < 1 << 24 {
         3
@@ -81,24 +98,72 @@ fn pack_size(n: u64) -> usize {
         6
     } else if n < 1 << 56 {
         7
     } else {
         8
     }
 }
 
+#[cfg(feature = "i128")]
+#[inline]
+fn pack_size128(n: u128) -> usize {
+    if n < 1 << 8 {
+        1
+    } else if n < 1 << 16 {
+        2
+    } else if n < 1 << 24 {
+        3
+    } else if n < 1 << 32 {
+        4
+    } else if n < 1 << 40 {
+        5
+    } else if n < 1 << 48 {
+        6
+    } else if n < 1 << 56 {
+        7
+    } else if n < 1 << 64 {
+        8
+    } else if n < 1 << 72 {
+        9
+    } else if n < 1 << 80 {
+        10
+    } else if n < 1 << 88 {
+        11
+    } else if n < 1 << 96 {
+        12
+    } else if n < 1 << 104 {
+        13
+    } else if n < 1 << 112 {
+        14
+    } else if n < 1 << 120 {
+        15
+    } else {
+        16
+    }
+}
+
+mod private {
+    /// Sealed stops crates other than byteorder from implementing any traits
+    /// that use it.
+    pub trait Sealed{}
+    impl Sealed for super::LittleEndian {}
+    impl Sealed for super::BigEndian {}
+}
+
 /// ByteOrder describes types that can serialize integers as bytes.
 ///
 /// Note that `Self` does not appear anywhere in this trait's definition!
 /// Therefore, in order to use it, you'll need to use syntax like
 /// `T::read_u16(&[0, 1])` where `T` implements `ByteOrder`.
 ///
 /// This crate provides two types that implement `ByteOrder`: `BigEndian`
 /// and `LittleEndian`.
+/// This trait is sealed and cannot be implemented for callers to avoid
+/// breaking backwards compatibility when adding new derived traits.
 ///
 /// # Examples
 ///
 /// Write and read `u32` numbers in little endian order:
 ///
 /// ```rust
 /// use byteorder::{ByteOrder, LittleEndian};
 ///
@@ -112,194 +177,1520 @@ fn pack_size(n: u64) -> usize {
 /// ```rust
 /// use byteorder::{ByteOrder, BigEndian};
 ///
 /// let mut buf = [0; 2];
 /// BigEndian::write_i16(&mut buf, -50_000);
 /// assert_eq!(-50_000, BigEndian::read_i16(&buf));
 /// ```
 pub trait ByteOrder
-    : Clone + Copy + Debug + Default + Eq + Hash + Ord + PartialEq + PartialOrd {
+    : Clone + Copy + Debug + Default + Eq + Hash + Ord + PartialEq + PartialOrd
+    + private::Sealed
+{
     /// Reads an unsigned 16 bit integer from `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 2`.
     fn read_u16(buf: &[u8]) -> u16;
 
+    /// Reads an unsigned 24 bit integer from `buf`, stored in u32.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() < 3`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read 24 bit `u32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_u24(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u24(&buf));
+    /// ```
+    fn read_u24(buf: &[u8]) -> u32 {
+        Self::read_uint(buf, 3) as u32
+    }
+
     /// Reads an unsigned 32 bit integer from `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 4`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 4];
+    /// LittleEndian::write_u32(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u32(&buf));
+    /// ```
     fn read_u32(buf: &[u8]) -> u32;
 
     /// Reads an unsigned 64 bit integer from `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 8`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 8];
+    /// LittleEndian::write_u64(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u64(&buf));
+    /// ```
     fn read_u64(buf: &[u8]) -> u64;
 
+    /// Reads an unsigned 128 bit integer from `buf`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() < 16`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u128` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 16];
+    /// LittleEndian::write_u128(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u128(&buf));
+    /// ```
+    #[cfg(feature = "i128")]
+    fn read_u128(buf: &[u8]) -> u128;
+
     /// Reads an unsigned n-bytes integer from `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `nbytes < 1` or `nbytes > 8` or
     /// `buf.len() < nbytes`
+    ///
+    /// # Examples
+    ///
+    /// Write and read an n-byte number in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_uint(&mut buf, 1_000_000, 3);
+    /// assert_eq!(1_000_000, LittleEndian::read_uint(&buf, 3));
+    /// ```
     fn read_uint(buf: &[u8], nbytes: usize) -> u64;
 
+    /// Reads an unsigned n-bytes integer from `buf`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `nbytes < 1` or `nbytes > 16` or
+    /// `buf.len() < nbytes`
+    ///
+    /// # Examples
+    ///
+    /// Write and read an n-byte number in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_uint128(&mut buf, 1_000_000, 3);
+    /// assert_eq!(1_000_000, LittleEndian::read_uint128(&buf, 3));
+    /// ```
+    #[cfg(feature = "i128")]
+    fn read_uint128(buf: &[u8], nbytes: usize) -> u128;
+
     /// Writes an unsigned 16 bit integer `n` to `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 2`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u16` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 2];
+    /// LittleEndian::write_u16(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u16(&buf));
+    /// ```
     fn write_u16(buf: &mut [u8], n: u16);
 
+    /// Writes an unsigned 24 bit integer `n` to `buf`, stored in u32.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() < 3`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read 24 bit `u32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_u24(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u24(&buf));
+    /// ```
+    fn write_u24(buf: &mut [u8], n: u32) {
+        Self::write_uint(buf, n as u64, 3)
+    }
+
     /// Writes an unsigned 32 bit integer `n` to `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 4`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 4];
+    /// LittleEndian::write_u32(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u32(&buf));
+    /// ```
     fn write_u32(buf: &mut [u8], n: u32);
 
     /// Writes an unsigned 64 bit integer `n` to `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 8`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 8];
+    /// LittleEndian::write_u64(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u64(&buf));
+    /// ```
     fn write_u64(buf: &mut [u8], n: u64);
 
+    /// Writes an unsigned 128 bit integer `n` to `buf`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() < 16`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u128` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 16];
+    /// LittleEndian::write_u128(&mut buf, 1_000_000);
+    /// assert_eq!(1_000_000, LittleEndian::read_u128(&buf));
+    /// ```
+    #[cfg(feature = "i128")]
+    fn write_u128(buf: &mut [u8], n: u128);
+
     /// Writes an unsigned integer `n` to `buf` using only `nbytes`.
     ///
+    /// # Panics
+    ///
     /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 8`, then
     /// this method panics.
+    ///
+    /// # Examples
+    ///
+    /// Write and read an n-byte number in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_uint(&mut buf, 1_000_000, 3);
+    /// assert_eq!(1_000_000, LittleEndian::read_uint(&buf, 3));
+    /// ```
     fn write_uint(buf: &mut [u8], n: u64, nbytes: usize);
 
+    /// Writes an unsigned integer `n` to `buf` using only `nbytes`.
+    ///
+    /// # Panics
+    ///
+    /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 16`, then
+    /// this method panics.
+    ///
+    /// # Examples
+    ///
+    /// Write and read an n-byte number in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_uint128(&mut buf, 1_000_000, 3);
+    /// assert_eq!(1_000_000, LittleEndian::read_uint128(&buf, 3));
+    /// ```
+    #[cfg(feature = "i128")]
+    fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize);
+
     /// Reads a signed 16 bit integer from `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 2`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i16` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 2];
+    /// LittleEndian::write_i16(&mut buf, -1_000);
+    /// assert_eq!(-1_000, LittleEndian::read_i16(&buf));
+    /// ```
     #[inline]
     fn read_i16(buf: &[u8]) -> i16 {
         Self::read_u16(buf) as i16
     }
 
+    /// Reads a signed 24 bit integer from `buf`, stored in i32.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() < 3`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read 24 bit `i32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_i24(&mut buf, -1_000_000);
+    /// assert_eq!(-1_000_000, LittleEndian::read_i24(&buf));
+    /// ```
+    #[inline]
+    fn read_i24(buf: &[u8]) -> i32 {
+        Self::read_int(buf, 3) as i32
+    }
+
     /// Reads a signed 32 bit integer from `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 4`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 4];
+    /// LittleEndian::write_i32(&mut buf, -1_000_000);
+    /// assert_eq!(-1_000_000, LittleEndian::read_i32(&buf));
+    /// ```
     #[inline]
     fn read_i32(buf: &[u8]) -> i32 {
         Self::read_u32(buf) as i32
     }
 
     /// Reads a signed 64 bit integer from `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 8`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 8];
+    /// LittleEndian::write_i64(&mut buf, -1_000_000_000);
+    /// assert_eq!(-1_000_000_000, LittleEndian::read_i64(&buf));
+    /// ```
     #[inline]
     fn read_i64(buf: &[u8]) -> i64 {
         Self::read_u64(buf) as i64
     }
 
+    /// Reads a signed 128 bit integer from `buf`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() < 16`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i128` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 16];
+    /// LittleEndian::write_i128(&mut buf, -1_000_000_000);
+    /// assert_eq!(-1_000_000_000, LittleEndian::read_i128(&buf));
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_i128(buf: &[u8]) -> i128 {
+        Self::read_u128(buf) as i128
+    }
+
     /// Reads a signed n-bytes integer from `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `nbytes < 1` or `nbytes > 8` or
     /// `buf.len() < nbytes`
+    ///
+    /// # Examples
+    ///
+    /// Write and read n-length signed numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_int(&mut buf, -1_000, 3);
+    /// assert_eq!(-1_000, LittleEndian::read_int(&buf, 3));
+    /// ```
     #[inline]
     fn read_int(buf: &[u8], nbytes: usize) -> i64 {
         extend_sign(Self::read_uint(buf, nbytes), nbytes)
     }
 
+    /// Reads a signed n-bytes integer from `buf`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `nbytes < 1` or `nbytes > 16` or
+    /// `buf.len() < nbytes`
+    ///
+    /// # Examples
+    ///
+    /// Write and read n-length signed numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_int128(&mut buf, -1_000, 3);
+    /// assert_eq!(-1_000, LittleEndian::read_int128(&buf, 3));
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_int128(buf: &[u8], nbytes: usize) -> i128 {
+        extend_sign128(Self::read_uint128(buf, nbytes), nbytes)
+    }
+
     /// Reads a IEEE754 single-precision (4 bytes) floating point number.
     ///
+    /// The return value is always defined; signaling NaN's may be turned into
+    /// quiet NaN's.
+    ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 4`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `f32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let e = 2.71828;
+    /// let mut buf = [0; 4];
+    /// LittleEndian::write_f32(&mut buf, e);
+    /// assert_eq!(e, LittleEndian::read_f32(&buf));
+    /// ```
     #[inline]
     fn read_f32(buf: &[u8]) -> f32 {
-        unsafe { transmute(Self::read_u32(buf)) }
+        safe_u32_bits_to_f32(Self::read_u32(buf))
     }
 
     /// Reads a IEEE754 double-precision (8 bytes) floating point number.
     ///
+    /// The return value is always defined; signaling NaN's may be turned into
+    /// quiet NaN's.
+    ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 8`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `f64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let phi = 1.6180339887;
+    /// let mut buf = [0; 8];
+    /// LittleEndian::write_f64(&mut buf, phi);
+    /// assert_eq!(phi, LittleEndian::read_f64(&buf));
+    /// ```
     #[inline]
     fn read_f64(buf: &[u8]) -> f64 {
-        unsafe { transmute(Self::read_u64(buf)) }
+        safe_u64_bits_to_f64(Self::read_u64(buf))
     }
 
     /// Writes a signed 16 bit integer `n` to `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 2`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i16` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 2];
+    /// LittleEndian::write_i16(&mut buf, -1_000);
+    /// assert_eq!(-1_000, LittleEndian::read_i16(&buf));
+    /// ```
     #[inline]
     fn write_i16(buf: &mut [u8], n: i16) {
         Self::write_u16(buf, n as u16)
     }
 
+    /// Writes a signed 24 bit integer `n` to `buf`, stored in i32.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() < 3`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read 24 bit `i32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_i24(&mut buf, -1_000_000);
+    /// assert_eq!(-1_000_000, LittleEndian::read_i24(&buf));
+    /// ```
+    #[inline]
+    fn write_i24(buf: &mut [u8], n: i32) {
+        Self::write_int(buf, n as i64, 3)
+    }
+
     /// Writes a signed 32 bit integer `n` to `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 4`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 4];
+    /// LittleEndian::write_i32(&mut buf, -1_000_000);
+    /// assert_eq!(-1_000_000, LittleEndian::read_i32(&buf));
+    /// ```
     #[inline]
     fn write_i32(buf: &mut [u8], n: i32) {
         Self::write_u32(buf, n as u32)
     }
 
     /// Writes a signed 64 bit integer `n` to `buf`.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 8`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 8];
+    /// LittleEndian::write_i64(&mut buf, -1_000_000_000);
+    /// assert_eq!(-1_000_000_000, LittleEndian::read_i64(&buf));
+    /// ```
     #[inline]
     fn write_i64(buf: &mut [u8], n: i64) {
         Self::write_u64(buf, n as u64)
     }
 
+    /// Writes a signed 128 bit integer `n` to `buf`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() < 16`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read n-byte `i128` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 16];
+    /// LittleEndian::write_i128(&mut buf, -1_000_000_000);
+    /// assert_eq!(-1_000_000_000, LittleEndian::read_i128(&buf));
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_i128(buf: &mut [u8], n: i128) {
+        Self::write_u128(buf, n as u128)
+    }
+
     /// Writes a signed integer `n` to `buf` using only `nbytes`.
     ///
+    /// # Panics
+    ///
     /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 8`, then
     /// this method panics.
+    ///
+    /// # Examples
+    ///
+    /// Write and read an n-byte number in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_int(&mut buf, -1_000, 3);
+    /// assert_eq!(-1_000, LittleEndian::read_int(&buf, 3));
+    /// ```
     #[inline]
     fn write_int(buf: &mut [u8], n: i64, nbytes: usize) {
         Self::write_uint(buf, unextend_sign(n, nbytes), nbytes)
     }
 
+    /// Writes a signed integer `n` to `buf` using only `nbytes`.
+    ///
+    /// # Panics
+    ///
+    /// If `n` is not representable in `nbytes`, or if `nbytes` is `> 16`, then
+    /// this method panics.
+    ///
+    /// # Examples
+    ///
+    /// Write and read n-length signed numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut buf = [0; 3];
+    /// LittleEndian::write_int128(&mut buf, -1_000, 3);
+    /// assert_eq!(-1_000, LittleEndian::read_int128(&buf, 3));
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_int128(buf: &mut [u8], n: i128, nbytes: usize) {
+        Self::write_uint128(buf, unextend_sign128(n, nbytes), nbytes)
+    }
+
     /// Writes a IEEE754 single-precision (4 bytes) floating point number.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 4`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `f32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let e = 2.71828;
+    /// let mut buf = [0; 4];
+    /// LittleEndian::write_f32(&mut buf, e);
+    /// assert_eq!(e, LittleEndian::read_f32(&buf));
+    /// ```
     #[inline]
     fn write_f32(buf: &mut [u8], n: f32) {
         Self::write_u32(buf, unsafe { transmute(n) })
     }
 
     /// Writes a IEEE754 double-precision (8 bytes) floating point number.
     ///
+    /// # Panics
+    ///
     /// Panics when `buf.len() < 8`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `f64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let phi = 1.6180339887;
+    /// let mut buf = [0; 8];
+    /// LittleEndian::write_f64(&mut buf, phi);
+    /// assert_eq!(phi, LittleEndian::read_f64(&buf));
+    /// ```
     #[inline]
     fn write_f64(buf: &mut [u8], n: f64) {
         Self::write_u64(buf, unsafe { transmute(n) })
     }
+
+    /// Reads unsigned 16 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 2*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u16` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 8];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_u16_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_u16_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn read_u16_into(src: &[u8], dst: &mut [u16]);
+
+    /// Reads unsigned 32 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 4*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 16];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_u32_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_u32_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn read_u32_into(src: &[u8], dst: &mut [u32]);
+
+    /// Reads unsigned 64 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 8*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 32];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_u64_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_u64_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn read_u64_into(src: &[u8], dst: &mut [u64]);
+
+    /// Reads unsigned 128 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 16*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u128` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 64];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_u128_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_u128_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[cfg(feature = "i128")]
+    fn read_u128_into(src: &[u8], dst: &mut [u128]);
+
+    /// Reads signed 16 bit integers from `src` to `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() != 2*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i16` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 8];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_i16_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_i16_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[inline]
+    fn read_i16_into(src: &[u8], dst: &mut [i16]) {
+        Self::read_u16_into(src, unsafe { transmute(dst) });
+    }
+
+    /// Reads signed 32 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 4*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 16];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_i32_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_i32_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[inline]
+    fn read_i32_into(src: &[u8], dst: &mut [i32]) {
+        Self::read_u32_into(src, unsafe { transmute(dst) });
+    }
+
+    /// Reads signed 64 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 8*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 32];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_i64_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_i64_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[inline]
+    fn read_i64_into(src: &[u8], dst: &mut [i64]) {
+        Self::read_u64_into(src, unsafe { transmute(dst) });
+    }
+
+    /// Reads signed 128 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 16*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i128` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 64];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_i128_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_i128_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_i128_into(src: &[u8], dst: &mut [i128]) {
+        Self::read_u128_into(src, unsafe { transmute(dst) });
+    }
+
+    /// Reads IEEE754 single-precision (4 bytes) floating point numbers from
+    /// `src` into `dst`.
+    ///
+    /// Note that this does not perform any checks on the floating point
+    /// conversion. In particular, if the `src` data encodes an undefined
+    /// floating point value for your environment, then the result may be
+    /// undefined behavior. For example, this function may produce signaling
+    /// NaN floating point values.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 4*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `f32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 16];
+    /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91];
+    /// LittleEndian::write_f32_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0.0; 4];
+    /// unsafe {
+    ///     LittleEndian::read_f32_into_unchecked(&bytes, &mut numbers_got);
+    /// }
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[inline]
+    unsafe fn read_f32_into_unchecked(src: &[u8], dst: &mut [f32]) {
+        Self::read_u32_into(src, transmute(dst));
+    }
+
+    /// Reads IEEE754 single-precision (4 bytes) floating point numbers from
+    /// `src` into `dst`.
+    ///
+    /// Note that this does not perform any checks on the floating point
+    /// conversion. In particular, if the `src` data encodes an undefined
+    /// floating point value for your environment, then the result may be
+    /// undefined behavior. For example, this function may produce signaling
+    /// NaN floating point values.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 8*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `f64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 32];
+    /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91];
+    /// LittleEndian::write_f64_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0.0; 4];
+    /// unsafe {
+    ///     LittleEndian::read_f64_into_unchecked(&bytes, &mut numbers_got);
+    /// }
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[inline]
+    unsafe fn read_f64_into_unchecked(src: &[u8], dst: &mut [f64]) {
+        Self::read_u64_into(src, transmute(dst));
+    }
+
+    /// Writes unsigned 16 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `dst.len() != 2*src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u16` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 8];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_u16_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_u16_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_u16_into(src: &[u16], dst: &mut [u8]);
+
+    /// Writes unsigned 32 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `dst.len() != 4*src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 16];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_u32_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_u32_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_u32_into(src: &[u32], dst: &mut [u8]);
+
+    /// Writes unsigned 64 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `dst.len() != 8*src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 32];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_u64_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_u64_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_u64_into(src: &[u64], dst: &mut [u8]);
+
+    /// Writes unsigned 128 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `dst.len() != 16*src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `u128` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 64];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_u128_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_u128_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[cfg(feature = "i128")]
+    fn write_u128_into(src: &[u128], dst: &mut [u8]);
+
+    /// Writes signed 16 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `buf.len() != 2*src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i16` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 8];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_i16_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_i16_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_i16_into(src: &[i16], dst: &mut [u8]) {
+        Self::write_u16_into(unsafe { transmute(src) }, dst);
+    }
+
+    /// Writes signed 32 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `dst.len() != 4*src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 16];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_i32_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_i32_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_i32_into(src: &[i32], dst: &mut [u8]) {
+        Self::write_u32_into(unsafe { transmute(src) }, dst);
+    }
+
+    /// Writes signed 64 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `dst.len() != 8*src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 32];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_i64_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_i64_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_i64_into(src: &[i64], dst: &mut [u8]) {
+        Self::write_u64_into(unsafe { transmute(src) }, dst);
+    }
+
+    /// Writes signed 128 bit integers from `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `dst.len() != 16*src.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `i128` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 64];
+    /// let numbers_given = [1, 2, 0xf00f, 0xffee];
+    /// LittleEndian::write_i128_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0; 4];
+    /// LittleEndian::read_i128_into(&bytes, &mut numbers_got);
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    #[cfg(feature = "i128")]
+    fn write_i128_into(src: &[i128], dst: &mut [u8]) {
+        Self::write_u128_into(unsafe { transmute(src) }, dst);
+    }
+
+    /// Writes IEEE754 single-precision (4 bytes) floating point numbers from
+    /// `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 4*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `f32` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 16];
+    /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91];
+    /// LittleEndian::write_f32_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0.0; 4];
+    /// unsafe {
+    ///     LittleEndian::read_f32_into_unchecked(&bytes, &mut numbers_got);
+    /// }
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_f32_into(src: &[f32], dst: &mut [u8]) {
+        Self::write_u32_into(unsafe { transmute(src) }, dst);
+    }
+
+    /// Writes IEEE754 double-precision (8 bytes) floating point numbers from
+    /// `src` into `dst`.
+    ///
+    /// # Panics
+    ///
+    /// Panics when `src.len() != 8*dst.len()`.
+    ///
+    /// # Examples
+    ///
+    /// Write and read `f64` numbers in little endian order:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, LittleEndian};
+    ///
+    /// let mut bytes = [0; 32];
+    /// let numbers_given = [1.0, 2.0, 31.312e311, -11.32e91];
+    /// LittleEndian::write_f64_into(&numbers_given, &mut bytes);
+    ///
+    /// let mut numbers_got = [0.0; 4];
+    /// unsafe {
+    ///     LittleEndian::read_f64_into_unchecked(&bytes, &mut numbers_got);
+    /// }
+    /// assert_eq!(numbers_given, numbers_got);
+    /// ```
+    fn write_f64_into(src: &[f64], dst: &mut [u8]) {
+        Self::write_u64_into(unsafe { transmute(src) }, dst);
+    }
+
+    /// Converts the given slice of unsigned 16 bit integers to a particular
+    /// endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// # Examples
+    ///
+    /// Convert the host platform's endianness to big-endian:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, BigEndian};
+    ///
+    /// let mut numbers = [5, 65000];
+    /// BigEndian::from_slice_u16(&mut numbers);
+    /// if cfg!(target_endian = "little") {
+    ///     assert_eq!(numbers, [5u16.swap_bytes(), 65000u16.swap_bytes()]);
+    /// } else {
+    ///     assert_eq!(numbers, [5, 65000]);
+    /// }
+    /// ```
+    fn from_slice_u16(numbers: &mut [u16]);
+
+    /// Converts the given slice of unsigned 32 bit integers to a particular
+    /// endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// # Examples
+    ///
+    /// Convert the host platform's endianness to big-endian:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, BigEndian};
+    ///
+    /// let mut numbers = [5, 65000];
+    /// BigEndian::from_slice_u32(&mut numbers);
+    /// if cfg!(target_endian = "little") {
+    ///     assert_eq!(numbers, [5u32.swap_bytes(), 65000u32.swap_bytes()]);
+    /// } else {
+    ///     assert_eq!(numbers, [5, 65000]);
+    /// }
+    /// ```
+    fn from_slice_u32(numbers: &mut [u32]);
+
+    /// Converts the given slice of unsigned 64 bit integers to a particular
+    /// endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// # Examples
+    ///
+    /// Convert the host platform's endianness to big-endian:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, BigEndian};
+    ///
+    /// let mut numbers = [5, 65000];
+    /// BigEndian::from_slice_u64(&mut numbers);
+    /// if cfg!(target_endian = "little") {
+    ///     assert_eq!(numbers, [5u64.swap_bytes(), 65000u64.swap_bytes()]);
+    /// } else {
+    ///     assert_eq!(numbers, [5, 65000]);
+    /// }
+    /// ```
+    fn from_slice_u64(numbers: &mut [u64]);
+
+    /// Converts the given slice of unsigned 128 bit integers to a particular
+    /// endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// # Examples
+    ///
+    /// Convert the host platform's endianness to big-endian:
+    ///
+    /// ```rust
+    /// #![feature(i128_type)]
+    ///
+    /// use byteorder::{ByteOrder, BigEndian};
+    ///
+    /// let mut numbers = [5, 65000];
+    /// BigEndian::from_slice_u128(&mut numbers);
+    /// if cfg!(target_endian = "little") {
+    ///     assert_eq!(numbers, [5u128.swap_bytes(), 65000u128.swap_bytes()]);
+    /// } else {
+    ///     assert_eq!(numbers, [5, 65000]);
+    /// }
+    /// ```
+    #[cfg(feature = "i128")]
+    fn from_slice_u128(numbers: &mut [u128]);
+
+    /// Converts the given slice of signed 16 bit integers to a particular
+    /// endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// # Examples
+    ///
+    /// Convert the host platform's endianness to big-endian:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, BigEndian};
+    ///
+    /// let mut numbers = [5, 65000];
+    /// BigEndian::from_slice_i16(&mut numbers);
+    /// if cfg!(target_endian = "little") {
+    ///     assert_eq!(numbers, [5i16.swap_bytes(), 65000i16.swap_bytes()]);
+    /// } else {
+    ///     assert_eq!(numbers, [5, 65000]);
+    /// }
+    /// ```
+    #[inline]
+    fn from_slice_i16(numbers: &mut [i16]) {
+        Self::from_slice_u16(unsafe { transmute(numbers) });
+    }
+
+    /// Converts the given slice of signed 32 bit integers to a particular
+    /// endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// # Examples
+    ///
+    /// Convert the host platform's endianness to big-endian:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, BigEndian};
+    ///
+    /// let mut numbers = [5, 65000];
+    /// BigEndian::from_slice_i32(&mut numbers);
+    /// if cfg!(target_endian = "little") {
+    ///     assert_eq!(numbers, [5i32.swap_bytes(), 65000i32.swap_bytes()]);
+    /// } else {
+    ///     assert_eq!(numbers, [5, 65000]);
+    /// }
+    /// ```
+    #[inline]
+    fn from_slice_i32(numbers: &mut [i32]) {
+        Self::from_slice_u32(unsafe { transmute(numbers) });
+    }
+
+    /// Converts the given slice of signed 64 bit integers to a particular
+    /// endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// # Examples
+    ///
+    /// Convert the host platform's endianness to big-endian:
+    ///
+    /// ```rust
+    /// use byteorder::{ByteOrder, BigEndian};
+    ///
+    /// let mut numbers = [5, 65000];
+    /// BigEndian::from_slice_i64(&mut numbers);
+    /// if cfg!(target_endian = "little") {
+    ///     assert_eq!(numbers, [5i64.swap_bytes(), 65000i64.swap_bytes()]);
+    /// } else {
+    ///     assert_eq!(numbers, [5, 65000]);
+    /// }
+    /// ```
+    #[inline]
+    fn from_slice_i64(numbers: &mut [i64]) {
+        Self::from_slice_u64(unsafe { transmute(numbers) });
+    }
+
+    /// Converts the given slice of signed 128 bit integers to a particular
+    /// endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// # Examples
+    ///
+    /// Convert the host platform's endianness to big-endian:
+    ///
+    /// ```rust
+    /// #![feature(i128_type)]
+    ///
+    /// use byteorder::{ByteOrder, BigEndian};
+    ///
+    /// let mut numbers = [5, 65000];
+    /// BigEndian::from_slice_i128(&mut numbers);
+    /// if cfg!(target_endian = "little") {
+    ///     assert_eq!(numbers, [5i128.swap_bytes(), 65000i128.swap_bytes()]);
+    /// } else {
+    ///     assert_eq!(numbers, [5, 65000]);
+    /// }
+    /// ```
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn from_slice_i128(numbers: &mut [i128]) {
+        Self::from_slice_u128(unsafe { transmute(numbers) });
+    }
+
+    /// Converts the given slice of IEEE754 single-precision (4 bytes) floating
+    /// point numbers to a particular endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// Note that the results of this operation are guaranteed to be defined.
+    /// In particular, this method may replace signaling NaN values with
+    /// quiet NaN values.
+    fn from_slice_f32(numbers: &mut [f32]);
+
+    /// Converts the given slice of IEEE754 double-precision (8 bytes) floating
+    /// point numbers to a particular endianness.
+    ///
+    /// If the endianness matches the endianness of the host platform, then
+    /// this is a no-op.
+    ///
+    /// Note that the results of this operation are guaranteed to be defined.
+    /// In particular, this method may replace signaling NaN values with
+    /// quiet NaN values.
+    fn from_slice_f64(numbers: &mut [f64]);
 }
 
 /// Defines big-endian serialization.
 ///
 /// Note that this type has no value constructor. It is used purely at the
 /// type level.
+///
+/// # Examples
+///
+/// Write and read `u32` numbers in big endian order:
+///
+/// ```rust
+/// use byteorder::{ByteOrder, BigEndian};
+///
+/// let mut buf = [0; 4];
+/// BigEndian::write_u32(&mut buf, 1_000_000);
+/// assert_eq!(1_000_000, BigEndian::read_u32(&buf));
+/// ```
 #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
 pub enum BigEndian {}
 
 impl Default for BigEndian {
     fn default() -> BigEndian {
-        unreachable!()
+        panic!("BigEndian default")
     }
 }
 
+/// A type alias for `BigEndian`.
+pub type BE = BigEndian;
+
 /// Defines little-endian serialization.
 ///
 /// Note that this type has no value constructor. It is used purely at the
 /// type level.
+///
+/// # Examples
+///
+/// Write and read `u32` numbers in little endian order:
+///
+/// ```rust
+/// use byteorder::{ByteOrder, LittleEndian};
+///
+/// let mut buf = [0; 4];
+/// LittleEndian::write_u32(&mut buf, 1_000_000);
+/// assert_eq!(1_000_000, LittleEndian::read_u32(&buf));
+/// ```
 #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
 pub enum LittleEndian {}
 
 impl Default for LittleEndian {
     fn default() -> LittleEndian {
-        unreachable!()
+        panic!("LittleEndian default")
     }
 }
 
+/// A type alias for `LittleEndian`.
+pub type LE = LittleEndian;
+
 /// Defines network byte order serialization.
 ///
 /// Network byte order is defined by [RFC 1700][1] to be big-endian, and is
 /// referred to in several protocol specifications.  This type is an alias of
 /// BigEndian.
 ///
 /// [1]: https://tools.ietf.org/html/rfc1700
 ///
 /// Note that this type has no value constructor. It is used purely at the
 /// type level.
+///
+/// # Examples
+///
+/// Write and read `i16` numbers in big endian order:
+///
+/// ```rust
+/// use byteorder::{ByteOrder, NetworkEndian, BigEndian};
+///
+/// let mut buf = [0; 2];
+/// BigEndian::write_i16(&mut buf, -50_000);
+/// assert_eq!(-50_000, NetworkEndian::read_i16(&buf));
+/// ```
 pub type NetworkEndian = BigEndian;
 
 /// Defines system native-endian serialization.
 ///
 /// Note that this type has no value constructor. It is used purely at the
 /// type level.
 #[cfg(target_endian = "little")]
 pub type NativeEndian = LittleEndian;
@@ -332,71 +1723,266 @@ macro_rules! write_num_bytes {
         unsafe {
             // N.B. https://github.com/rust-lang/rust/issues/22776
             let bytes = transmute::<_, [u8; $size]>($n.$which());
             copy_nonoverlapping((&bytes).as_ptr(), $dst.as_mut_ptr(), $size);
         }
     });
 }
 
+macro_rules! read_slice {
+    ($src:expr, $dst:expr, $size:expr, $which:ident) => {{
+        assert_eq!($src.len(), $size * $dst.len());
+
+        unsafe {
+            copy_nonoverlapping(
+                $src.as_ptr(),
+                $dst.as_mut_ptr() as *mut u8,
+                $src.len());
+        }
+        for v in $dst.iter_mut() {
+            *v = v.$which();
+        }
+    }};
+}
+
+macro_rules! write_slice_native {
+    ($src:expr, $dst:expr, $ty:ty, $size:expr) => {{
+        assert!($size == ::core::mem::size_of::<$ty>());
+        assert_eq!($size * $src.len(), $dst.len());
+
+        unsafe {
+            copy_nonoverlapping(
+                $src.as_ptr() as *const u8,
+                $dst.as_mut_ptr(),
+                $dst.len());
+        }
+    }};
+}
+
+macro_rules! write_slice {
+    ($src:expr, $dst:expr, $ty:ty, $size:expr, $write:expr) => ({
+        assert!($size == ::core::mem::size_of::<$ty>());
+        assert_eq!($size * $src.len(), $dst.len());
+
+        for (&n, chunk) in $src.iter().zip($dst.chunks_mut($size)) {
+            $write(chunk, n);
+        }
+    });
+}
+
 impl ByteOrder for BigEndian {
     #[inline]
     fn read_u16(buf: &[u8]) -> u16 {
         read_num_bytes!(u16, 2, buf, to_be)
     }
 
     #[inline]
     fn read_u32(buf: &[u8]) -> u32 {
         read_num_bytes!(u32, 4, buf, to_be)
     }
 
     #[inline]
     fn read_u64(buf: &[u8]) -> u64 {
         read_num_bytes!(u64, 8, buf, to_be)
     }
 
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_u128(buf: &[u8]) -> u128 {
+        read_num_bytes!(u128, 16, buf, to_be)
+    }
+
     #[inline]
     fn read_uint(buf: &[u8], nbytes: usize) -> u64 {
         assert!(1 <= nbytes && nbytes <= 8 && nbytes <= buf.len());
         let mut out = [0u8; 8];
         let ptr_out = out.as_mut_ptr();
         unsafe {
             copy_nonoverlapping(
                 buf.as_ptr(), ptr_out.offset((8 - nbytes) as isize), nbytes);
             (*(ptr_out as *const u64)).to_be()
         }
     }
 
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_uint128(buf: &[u8], nbytes: usize) -> u128 {
+        assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len());
+        let mut out = [0u8; 16];
+        let ptr_out = out.as_mut_ptr();
+        unsafe {
+            copy_nonoverlapping(
+                buf.as_ptr(), ptr_out.offset((16 - nbytes) as isize), nbytes);
+            (*(ptr_out as *const u128)).to_be()
+        }
+    }
+
     #[inline]
     fn write_u16(buf: &mut [u8], n: u16) {
         write_num_bytes!(u16, 2, n, buf, to_be);
     }
 
     #[inline]
     fn write_u32(buf: &mut [u8], n: u32) {
         write_num_bytes!(u32, 4, n, buf, to_be);
     }
 
     #[inline]
     fn write_u64(buf: &mut [u8], n: u64) {
         write_num_bytes!(u64, 8, n, buf, to_be);
     }
 
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_u128(buf: &mut [u8], n: u128) {
+        write_num_bytes!(u128, 16, n, buf, to_be);
+    }
+
     #[inline]
     fn write_uint(buf: &mut [u8], n: u64, nbytes: usize) {
         assert!(pack_size(n) <= nbytes && nbytes <= 8);
         assert!(nbytes <= buf.len());
         unsafe {
             let bytes: [u8; 8] = transmute(n.to_be());
             copy_nonoverlapping(
                 bytes.as_ptr().offset((8 - nbytes) as isize),
                 buf.as_mut_ptr(),
                 nbytes);
         }
     }
+
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize) {
+        assert!(pack_size128(n) <= nbytes && nbytes <= 16);
+        assert!(nbytes <= buf.len());
+        unsafe {
+            let bytes: [u8; 16] = transmute(n.to_be());
+            copy_nonoverlapping(
+                bytes.as_ptr().offset((16 - nbytes) as isize),
+                buf.as_mut_ptr(),
+                nbytes);
+        }
+    }
+
+    #[inline]
+    fn read_u16_into(src: &[u8], dst: &mut [u16]) {
+        read_slice!(src, dst, 2, to_be);
+    }
+
+    #[inline]
+    fn read_u32_into(src: &[u8], dst: &mut [u32]) {
+        read_slice!(src, dst, 4, to_be);
+    }
+
+    #[inline]
+    fn read_u64_into(src: &[u8], dst: &mut [u64]) {
+        read_slice!(src, dst, 8, to_be);
+    }
+
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_u128_into(src: &[u8], dst: &mut [u128]) {
+        read_slice!(src, dst, 16, to_be);
+    }
+
+    #[inline]
+    fn write_u16_into(src: &[u16], dst: &mut [u8]) {
+        if cfg!(target_endian = "big") {
+            write_slice_native!(src, dst, u16, 2);
+        } else {
+            write_slice!(src, dst, u16, 2, Self::write_u16);
+        }
+    }
+
+    #[inline]
+    fn write_u32_into(src: &[u32], dst: &mut [u8]) {
+        if cfg!(target_endian = "big") {
+            write_slice_native!(src, dst, u32, 4);
+        } else {
+            write_slice!(src, dst, u32, 4, Self::write_u32);
+        }
+    }
+
+    #[inline]
+    fn write_u64_into(src: &[u64], dst: &mut [u8]) {
+        if cfg!(target_endian = "big") {
+            write_slice_native!(src, dst, u64, 8);
+        } else {
+            write_slice!(src, dst, u64, 8, Self::write_u64);
+        }
+    }
+
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_u128_into(src: &[u128], dst: &mut [u8]) {
+        if cfg!(target_endian = "big") {
+            write_slice_native!(src, dst, u128, 16);
+        } else {
+            write_slice!(src, dst, u128, 16, Self::write_u128);
+        }
+    }
+
+    #[inline]
+    fn from_slice_u16(numbers: &mut [u16]) {
+        if cfg!(target_endian = "little") {
+            for n in numbers {
+                *n = n.to_be();
+            }
+        }
+    }
+
+    #[inline]
+    fn from_slice_u32(numbers: &mut [u32]) {
+        if cfg!(target_endian = "little") {
+            for n in numbers {
+                *n = n.to_be();
+            }
+        }
+    }
+
+    #[inline]
+    fn from_slice_u64(numbers: &mut [u64]) {
+        if cfg!(target_endian = "little") {
+            for n in numbers {
+                *n = n.to_be();
+            }
+        }
+    }
+
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn from_slice_u128(numbers: &mut [u128]) {
+        if cfg!(target_endian = "little") {
+            for n in numbers {
+                *n = n.to_be();
+            }
+        }
+    }
+
+    #[inline]
+    fn from_slice_f32(numbers: &mut [f32]) {
+        if cfg!(target_endian = "little") {
+            for n in numbers {
+                let int: u32 = unsafe { transmute(*n) };
+                *n = safe_u32_bits_to_f32(int.to_be());
+            }
+        }
+    }
+
+    #[inline]
+    fn from_slice_f64(numbers: &mut [f64]) {
+        if cfg!(target_endian = "little") {
+            for n in numbers {
+                let int: u64 = unsafe { transmute(*n) };
+                *n = safe_u64_bits_to_f64(int.to_be());
+            }
+        }
+    }
 }
 
 impl ByteOrder for LittleEndian {
     #[inline]
     fn read_u16(buf: &[u8]) -> u16 {
         read_num_bytes!(u16, 2, buf, to_le)
     }
 
@@ -405,182 +1991,538 @@ impl ByteOrder for LittleEndian {
         read_num_bytes!(u32, 4, buf, to_le)
     }
 
     #[inline]
     fn read_u64(buf: &[u8]) -> u64 {
         read_num_bytes!(u64, 8, buf, to_le)
     }
 
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_u128(buf: &[u8]) -> u128 {
+        read_num_bytes!(u128, 16, buf, to_le)
+    }
+
     #[inline]
     fn read_uint(buf: &[u8], nbytes: usize) -> u64 {
         assert!(1 <= nbytes && nbytes <= 8 && nbytes <= buf.len());
         let mut out = [0u8; 8];
         let ptr_out = out.as_mut_ptr();
         unsafe {
             copy_nonoverlapping(buf.as_ptr(), ptr_out, nbytes);
             (*(ptr_out as *const u64)).to_le()
         }
     }
 
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_uint128(buf: &[u8], nbytes: usize) -> u128 {
+        assert!(1 <= nbytes && nbytes <= 16 && nbytes <= buf.len());
+        let mut out = [0u8; 16];
+        let ptr_out = out.as_mut_ptr();
+        unsafe {
+            copy_nonoverlapping(buf.as_ptr(), ptr_out, nbytes);
+            (*(ptr_out as *const u128)).to_le()
+        }
+    }
+
     #[inline]
     fn write_u16(buf: &mut [u8], n: u16) {
         write_num_bytes!(u16, 2, n, buf, to_le);
     }
 
     #[inline]
     fn write_u32(buf: &mut [u8], n: u32) {
         write_num_bytes!(u32, 4, n, buf, to_le);
     }
 
     #[inline]
     fn write_u64(buf: &mut [u8], n: u64) {
         write_num_bytes!(u64, 8, n, buf, to_le);
     }
 
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_u128(buf: &mut [u8], n: u128) {
+        write_num_bytes!(u128, 16, n, buf, to_le);
+    }
+
     #[inline]
     fn write_uint(buf: &mut [u8], n: u64, nbytes: usize) {
         assert!(pack_size(n as u64) <= nbytes && nbytes <= 8);
         assert!(nbytes <= buf.len());
         unsafe {
             let bytes: [u8; 8] = transmute(n.to_le());
             copy_nonoverlapping(bytes.as_ptr(), buf.as_mut_ptr(), nbytes);
         }
     }
+
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_uint128(buf: &mut [u8], n: u128, nbytes: usize) {
+        assert!(pack_size128(n as u128) <= nbytes && nbytes <= 16);
+        assert!(nbytes <= buf.len());
+        unsafe {
+            let bytes: [u8; 16] = transmute(n.to_le());
+            copy_nonoverlapping(bytes.as_ptr(), buf.as_mut_ptr(), nbytes);
+        }
+    }
+
+    #[inline]
+    fn read_u16_into(src: &[u8], dst: &mut [u16]) {
+        read_slice!(src, dst, 2, to_le);
+    }
+
+    #[inline]
+    fn read_u32_into(src: &[u8], dst: &mut [u32]) {
+        read_slice!(src, dst, 4, to_le);
+    }
+
+    #[inline]
+    fn read_u64_into(src: &[u8], dst: &mut [u64]) {
+        read_slice!(src, dst, 8, to_le);
+    }
+
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn read_u128_into(src: &[u8], dst: &mut [u128]) {
+        read_slice!(src, dst, 16, to_le);
+    }
+
+    #[inline]
+    fn write_u16_into(src: &[u16], dst: &mut [u8]) {
+        if cfg!(target_endian = "little") {
+            write_slice_native!(src, dst, u16, 2);
+        } else {
+            write_slice!(src, dst, u16, 2, Self::write_u16);
+        }
+    }
+
+    #[inline]
+    fn write_u32_into(src: &[u32], dst: &mut [u8]) {
+        if cfg!(target_endian = "little") {
+            write_slice_native!(src, dst, u32, 4);
+        } else {
+            write_slice!(src, dst, u32, 4, Self::write_u32);
+        }
+    }
+
+    #[inline]
+    fn write_u64_into(src: &[u64], dst: &mut [u8]) {
+        if cfg!(target_endian = "little") {
+            write_slice_native!(src, dst, u64, 8);
+        } else {
+            write_slice!(src, dst, u64, 8, Self::write_u64);
+        }
+    }
+
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn write_u128_into(src: &[u128], dst: &mut [u8]) {
+        if cfg!(target_endian = "little") {
+            write_slice_native!(src, dst, u128, 16);
+        } else {
+            write_slice!(src, dst, u128, 16, Self::write_u128);
+        }
+    }
+
+    #[inline]
+    fn from_slice_u16(numbers: &mut [u16]) {
+        if cfg!(target_endian = "big") {
+            for n in numbers {
+                *n = n.to_le();
+            }
+        }
+    }
+
+    #[inline]
+    fn from_slice_u32(numbers: &mut [u32]) {
+        if cfg!(target_endian = "big") {
+            for n in numbers {
+                *n = n.to_le();
+            }
+        }
+    }
+
+    #[inline]
+    fn from_slice_u64(numbers: &mut [u64]) {
+        if cfg!(target_endian = "big") {
+            for n in numbers {
+                *n = n.to_le();
+            }
+        }
+    }
+
+    #[cfg(feature = "i128")]
+    #[inline]
+    fn from_slice_u128(numbers: &mut [u128]) {
+        if cfg!(target_endian = "big") {
+            for n in numbers {
+                *n = n.to_le();
+            }
+        }
+    }
+
+    #[inline]
+    fn from_slice_f32(numbers: &mut [f32]) {
+        if cfg!(target_endian = "big") {
+            for n in numbers {
+                let int: u32 = unsafe { transmute(*n) };
+                *n = safe_u32_bits_to_f32(int.to_le());
+            }
+        }
+    }
+
+    #[inline]
+    fn from_slice_f64(numbers: &mut [f64]) {
+        if cfg!(target_endian = "big") {
+            for n in numbers {
+                let int: u64 = unsafe { transmute(*n) };
+                *n = safe_u64_bits_to_f64(int.to_le());
+            }
+        }
+    }
+}
+
+#[inline]
+fn safe_u32_bits_to_f32(u: u32) -> f32 {
+    use core::f32::NAN;
+
+    const EXP_MASK: u32 = 0x7F800000;
+    const FRACT_MASK: u32 = 0x007FFFFF;
+
+    if u & EXP_MASK == EXP_MASK && u & FRACT_MASK != 0 {
+        // While IEEE 754-2008 specifies encodings for quiet NaNs and
+        // signaling ones, certains MIPS and PA-RISC CPUs treat signaling
+        // NaNs differently. Therefore, to be safe, we pass a known quiet
+        // NaN if u is any kind of NaN. The check above only assumes
+        // IEEE 754-1985 to be valid.
+        NAN
+    } else {
+        unsafe { transmute(u) }
+    }
+}
+
+#[inline]
+fn safe_u64_bits_to_f64(u: u64) -> f64 {
+    use core::f64::NAN;
+
+    const EXP_MASK: u64 = 0x7FF0000000000000;
+    const FRACT_MASK: u64 = 0x000FFFFFFFFFFFFF;
+
+    if u & EXP_MASK == EXP_MASK && u & FRACT_MASK != 0 {
+        // While IEEE 754-2008 specifies encodings for quiet NaNs and
+        // signaling ones, certains MIPS and PA-RISC CPUs treat signaling
+        // NaNs differently. Therefore, to be safe, we pass a known quiet
+        // NaN if u is any kind of NaN. The check above only assumes
+        // IEEE 754-1985 to be valid.
+        NAN
+    } else {
+        unsafe { transmute(u) }
+    }
 }
 
 #[cfg(test)]
 mod test {
     extern crate quickcheck;
     extern crate rand;
 
+    use self::quickcheck::{QuickCheck, StdGen, Testable};
     use self::rand::thread_rng;
-    use self::quickcheck::{QuickCheck, StdGen, Testable};
+    #[cfg(feature = "i128")] use self::quickcheck::{Arbitrary, Gen};
+
+    pub const U24_MAX: u32 = 16_777_215;
+    pub const I24_MAX: i32 = 8_388_607;
 
     pub const U64_MAX: u64 = ::core::u64::MAX;
     pub const I64_MAX: u64 = ::core::i64::MAX as u64;
 
+    macro_rules! calc_max {
+        ($max:expr, $bytes:expr) => { calc_max!($max, $bytes, 8) };
+        ($max:expr, $bytes:expr, $maxbytes:expr) => {
+            ($max - 1) >> (8 * ($maxbytes - $bytes))
+        };
+    }
+
+    #[derive(Clone, Debug)]
+    pub struct Wi128<T>(pub T);
+
+    #[cfg(feature = "i128")]
+    impl<T: Clone> Wi128<T> {
+        pub fn clone(&self) -> T {
+            self.0.clone()
+        }
+    }
+
+    impl<T: PartialEq> PartialEq<T> for Wi128<T> {
+        fn eq(&self, other: &T) -> bool {
+            self.0.eq(other)
+        }
+    }
+
+    #[cfg(feature = "i128")]
+    impl Arbitrary for Wi128<u128> {
+        fn arbitrary<G: Gen>(gen: &mut G) -> Wi128<u128> {
+            let max = calc_max!(::core::u128::MAX, gen.size(), 16);
+            let output =
+                (gen.gen::<u64>() as u128) |
+                ((gen.gen::<u64>() as u128) << 64);
+            Wi128(output & (max - 1))
+        }
+    }
+
+    #[cfg(feature = "i128")]
+    impl Arbitrary for Wi128<i128> {
+        fn arbitrary<G: Gen>(gen: &mut G) -> Wi128<i128> {
+            let max = calc_max!(::core::i128::MAX, gen.size(), 16);
+            let output =
+                (gen.gen::<i64>() as i128) |
+                ((gen.gen::<i64>() as i128) << 64);
+            Wi128(output & (max - 1))
+        }
+    }
+
     pub fn qc_sized<A: Testable>(f: A, size: u64) {
         QuickCheck::new()
             .gen(StdGen::new(thread_rng(), size as usize))
             .tests(1_00)
             .max_tests(10_000)
             .quickcheck(f);
     }
 
     macro_rules! qc_byte_order {
-        ($name:ident, $ty_int:ident, $max:expr,
+        ($name:ident, $ty_int:ty, $max:expr,
          $bytes:expr, $read:ident, $write:ident) => (
             mod $name {
                 use {BigEndian, ByteOrder, NativeEndian, LittleEndian};
-                use super::qc_sized;
+                #[allow(unused_imports)] use super::{ qc_sized, Wi128 };
 
                 #[test]
                 fn big_endian() {
-                    let max = ($max - 1) >> (8 * (8 - $bytes));
                     fn prop(n: $ty_int) -> bool {
-                        let mut buf = [0; 8];
-                        BigEndian::$write(&mut buf, n, $bytes);
+                        let mut buf = [0; 16];
+                        BigEndian::$write(&mut buf, n.clone(), $bytes);
                         n == BigEndian::$read(&mut buf[..$bytes], $bytes)
                     }
-                    qc_sized(prop as fn($ty_int) -> bool, max);
+                    qc_sized(prop as fn($ty_int) -> bool, $max);
                 }
 
                 #[test]
                 fn little_endian() {
-                    let max = ($max - 1) >> (8 * (8 - $bytes));
                     fn prop(n: $ty_int) -> bool {
-                        let mut buf = [0; 8];
-                        LittleEndian::$write(&mut buf, n, $bytes);
+                        let mut buf = [0; 16];
+                        LittleEndian::$write(&mut buf, n.clone(), $bytes);
                         n == LittleEndian::$read(&mut buf[..$bytes], $bytes)
                     }
-                    qc_sized(prop as fn($ty_int) -> bool, max);
+                    qc_sized(prop as fn($ty_int) -> bool, $max);
                 }
 
                 #[test]
                 fn native_endian() {
-                    let max = ($max - 1) >> (8 * (8 - $bytes));
                     fn prop(n: $ty_int) -> bool {
-                        let mut buf = [0; 8];
-                        NativeEndian::$write(&mut buf, n, $bytes);
+                        let mut buf = [0; 16];
+                        NativeEndian::$write(&mut buf, n.clone(), $bytes);
                         n == NativeEndian::$read(&mut buf[..$bytes], $bytes)
                     }
-                    qc_sized(prop as fn($ty_int) -> bool, max);
+                    qc_sized(prop as fn($ty_int) -> bool, $max);
                 }
             }
         );
-        ($name:ident, $ty_int:ident, $max:expr,
+        ($name:ident, $ty_int:ty, $max:expr,
          $read:ident, $write:ident) => (
             mod $name {
                 use core::mem::size_of;
                 use {BigEndian, ByteOrder, NativeEndian, LittleEndian};
-                use super::qc_sized;
+                #[allow(unused_imports)] use super::{ qc_sized, Wi128 };
 
                 #[test]
                 fn big_endian() {
                     fn prop(n: $ty_int) -> bool {
                         let bytes = size_of::<$ty_int>();
-                        let mut buf = [0; 8];
-                        BigEndian::$write(&mut buf[8 - bytes..], n);
-                        n == BigEndian::$read(&mut buf[8 - bytes..])
+                        let mut buf = [0; 16];
+                        BigEndian::$write(&mut buf[16 - bytes..], n.clone());
+                        n == BigEndian::$read(&mut buf[16 - bytes..])
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max - 1);
                 }
 
                 #[test]
                 fn little_endian() {
                     fn prop(n: $ty_int) -> bool {
                         let bytes = size_of::<$ty_int>();
-                        let mut buf = [0; 8];
-                        LittleEndian::$write(&mut buf[..bytes], n);
+                        let mut buf = [0; 16];
+                        LittleEndian::$write(&mut buf[..bytes], n.clone());
                         n == LittleEndian::$read(&mut buf[..bytes])
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max - 1);
                 }
 
                 #[test]
                 fn native_endian() {
                     fn prop(n: $ty_int) -> bool {
                         let bytes = size_of::<$ty_int>();
-                        let mut buf = [0; 8];
-                        NativeEndian::$write(&mut buf[..bytes], n);
+                        let mut buf = [0; 16];
+                        NativeEndian::$write(&mut buf[..bytes], n.clone());
                         n == NativeEndian::$read(&mut buf[..bytes])
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max - 1);
                 }
             }
         );
     }
 
     qc_byte_order!(prop_u16, u16, ::core::u16::MAX as u64, read_u16, write_u16);
     qc_byte_order!(prop_i16, i16, ::core::i16::MAX as u64, read_i16, write_i16);
+    qc_byte_order!(prop_u24, u32, ::test::U24_MAX as u64, read_u24, write_u24);
+    qc_byte_order!(prop_i24, i32, ::test::I24_MAX as u64, read_i24, write_i24);
     qc_byte_order!(prop_u32, u32, ::core::u32::MAX as u64, read_u32, write_u32);
     qc_byte_order!(prop_i32, i32, ::core::i32::MAX as u64, read_i32, write_i32);
     qc_byte_order!(prop_u64, u64, ::core::u64::MAX as u64, read_u64, write_u64);
     qc_byte_order!(prop_i64, i64, ::core::i64::MAX as u64, read_i64, write_i64);
     qc_byte_order!(prop_f32, f32, ::core::u64::MAX as u64, read_f32, write_f32);
     qc_byte_order!(prop_f64, f64, ::core::i64::MAX as u64, read_f64, write_f64);
 
-    qc_byte_order!(prop_uint_1, u64, super::U64_MAX, 1, read_uint, write_uint);
-    qc_byte_order!(prop_uint_2, u64, super::U64_MAX, 2, read_uint, write_uint);
-    qc_byte_order!(prop_uint_3, u64, super::U64_MAX, 3, read_uint, write_uint);
-    qc_byte_order!(prop_uint_4, u64, super::U64_MAX, 4, read_uint, write_uint);
-    qc_byte_order!(prop_uint_5, u64, super::U64_MAX, 5, read_uint, write_uint);
-    qc_byte_order!(prop_uint_6, u64, super::U64_MAX, 6, read_uint, write_uint);
-    qc_byte_order!(prop_uint_7, u64, super::U64_MAX, 7, read_uint, write_uint);
-    qc_byte_order!(prop_uint_8, u64, super::U64_MAX, 8, read_uint, write_uint);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_u128, Wi128<u128>, 16 + 1, read_u128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_i128, Wi128<i128>, 16 + 1, read_i128, write_i128);
+
+    qc_byte_order!(prop_uint_1,
+        u64, calc_max!(super::U64_MAX, 1), 1, read_uint, write_uint);
+    qc_byte_order!(prop_uint_2,
+        u64, calc_max!(super::U64_MAX, 2), 2, read_uint, write_uint);
+    qc_byte_order!(prop_uint_3,
+        u64, calc_max!(super::U64_MAX, 3), 3, read_uint, write_uint);
+    qc_byte_order!(prop_uint_4,
+        u64, calc_max!(super::U64_MAX, 4), 4, read_uint, write_uint);
+    qc_byte_order!(prop_uint_5,
+        u64, calc_max!(super::U64_MAX, 5), 5, read_uint, write_uint);
+    qc_byte_order!(prop_uint_6,
+        u64, calc_max!(super::U64_MAX, 6), 6, read_uint, write_uint);
+    qc_byte_order!(prop_uint_7,
+        u64, calc_max!(super::U64_MAX, 7), 7, read_uint, write_uint);
+    qc_byte_order!(prop_uint_8,
+        u64, calc_max!(super::U64_MAX, 8), 8, read_uint, write_uint);
 
-    qc_byte_order!(prop_int_1, i64, super::I64_MAX, 1, read_int, write_int);
-    qc_byte_order!(prop_int_2, i64, super::I64_MAX, 2, read_int, write_int);
-    qc_byte_order!(prop_int_3, i64, super::I64_MAX, 3, read_int, write_int);
-    qc_byte_order!(prop_int_4, i64, super::I64_MAX, 4, read_int, write_int);
-    qc_byte_order!(prop_int_5, i64, super::I64_MAX, 5, read_int, write_int);
-    qc_byte_order!(prop_int_6, i64, super::I64_MAX, 6, read_int, write_int);
-    qc_byte_order!(prop_int_7, i64, super::I64_MAX, 7, read_int, write_int);
-    qc_byte_order!(prop_int_8, i64, super::I64_MAX, 8, read_int, write_int);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_1,
+        Wi128<u128>, 1, 1, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_2,
+        Wi128<u128>, 2, 2, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_3,
+        Wi128<u128>, 3, 3, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_4,
+        Wi128<u128>, 4, 4, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_5,
+        Wi128<u128>, 5, 5, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_6,
+        Wi128<u128>, 6, 6, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_7,
+        Wi128<u128>, 7, 7, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_8,
+        Wi128<u128>, 8, 8, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_9,
+        Wi128<u128>, 9, 9, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_10,
+        Wi128<u128>, 10, 10, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_11,
+        Wi128<u128>, 11, 11, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_12,
+        Wi128<u128>, 12, 12, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_13,
+        Wi128<u128>, 13, 13, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_14,
+        Wi128<u128>, 14, 14, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_15,
+        Wi128<u128>, 15, 15, read_uint128, write_uint128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_uint128_16,
+        Wi128<u128>, 16, 16, read_uint128, write_uint128);
+
+    qc_byte_order!(prop_int_1,
+        i64, calc_max!(super::I64_MAX, 1), 1, read_int, write_int);
+    qc_byte_order!(prop_int_2,
+        i64, calc_max!(super::I64_MAX, 2), 2, read_int, write_int);
+    qc_byte_order!(prop_int_3,
+        i64, calc_max!(super::I64_MAX, 3), 3, read_int, write_int);
+    qc_byte_order!(prop_int_4,
+        i64, calc_max!(super::I64_MAX, 4), 4, read_int, write_int);
+    qc_byte_order!(prop_int_5,
+        i64, calc_max!(super::I64_MAX, 5), 5, read_int, write_int);
+    qc_byte_order!(prop_int_6,
+        i64, calc_max!(super::I64_MAX, 6), 6, read_int, write_int);
+    qc_byte_order!(prop_int_7,
+        i64, calc_max!(super::I64_MAX, 7), 7, read_int, write_int);
+    qc_byte_order!(prop_int_8,
+        i64, calc_max!(super::I64_MAX, 8), 8, read_int, write_int);
+
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_1,
+        Wi128<i128>, 1, 1, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_2,
+        Wi128<i128>, 2, 2, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_3,
+        Wi128<i128>, 3, 3, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_4,
+        Wi128<i128>, 4, 4, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_5,
+        Wi128<i128>, 5, 5, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_6,
+        Wi128<i128>, 6, 6, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_7,
+        Wi128<i128>, 7, 7, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_8,
+        Wi128<i128>, 8, 8, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_9,
+        Wi128<i128>, 9, 9, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_10,
+        Wi128<i128>, 10, 10, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_11,
+        Wi128<i128>, 11, 11, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_12,
+        Wi128<i128>, 12, 12, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_13,
+        Wi128<i128>, 13, 13, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_14,
+        Wi128<i128>, 14, 14, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_15,
+        Wi128<i128>, 15, 15, read_int128, write_int128);
+    #[cfg(feature = "i128")]
+    qc_byte_order!(prop_int128_16,
+        Wi128<i128>, 16, 16, read_int128, write_int128);
+
 
     // Test that all of the byte conversion functions panic when given a
     // buffer that is too small.
     //
     // These tests are critical to ensure safety, otherwise we might end up
     // with a buffer overflow.
     macro_rules! too_small {
         ($name:ident, $maximally_small:expr, $zero:expr,
@@ -662,159 +2604,588 @@ mod test {
     too_small!(small_u16, 1, 0, read_u16, write_u16);
     too_small!(small_i16, 1, 0, read_i16, write_i16);
     too_small!(small_u32, 3, 0, read_u32, write_u32);
     too_small!(small_i32, 3, 0, read_i32, write_i32);
     too_small!(small_u64, 7, 0, read_u64, write_u64);
     too_small!(small_i64, 7, 0, read_i64, write_i64);
     too_small!(small_f32, 3, 0.0, read_f32, write_f32);
     too_small!(small_f64, 7, 0.0, read_f64, write_f64);
+    #[cfg(feature = "i128")]
+    too_small!(small_u128, 15, 0, read_u128, write_u128);
+    #[cfg(feature = "i128")]
+    too_small!(small_i128, 15, 0, read_i128, write_i128);
 
     too_small!(small_uint_1, 1, read_uint);
     too_small!(small_uint_2, 2, read_uint);
     too_small!(small_uint_3, 3, read_uint);
     too_small!(small_uint_4, 4, read_uint);
     too_small!(small_uint_5, 5, read_uint);
     too_small!(small_uint_6, 6, read_uint);
     too_small!(small_uint_7, 7, read_uint);
 
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_1, 1, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_2, 2, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_3, 3, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_4, 4, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_5, 5, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_6, 6, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_7, 7, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_8, 8, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_9, 9, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_10, 10, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_11, 11, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_12, 12, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_13, 13, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_14, 14, read_uint128);
+    #[cfg(feature = "i128")]
+    too_small!(small_uint128_15, 15, read_uint128);
+
     too_small!(small_int_1, 1, read_int);
     too_small!(small_int_2, 2, read_int);
     too_small!(small_int_3, 3, read_int);
     too_small!(small_int_4, 4, read_int);
     too_small!(small_int_5, 5, read_int);
     too_small!(small_int_6, 6, read_int);
     too_small!(small_int_7, 7, read_int);
 
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_1, 1, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_2, 2, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_3, 3, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_4, 4, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_5, 5, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_6, 6, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_7, 7, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_8, 8, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_9, 9, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_10, 10, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_11, 11, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_12, 12, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_13, 13, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_14, 14, read_int128);
+    #[cfg(feature = "i128")]
+    too_small!(small_int128_15, 15, read_int128);
+
+    // Test that reading/writing slices enforces the correct lengths.
+    macro_rules! slice_lengths {
+        ($name:ident, $read:ident, $write:ident,
+         $num_bytes:expr, $numbers:expr) => {
+            mod $name {
+                use {ByteOrder, BigEndian, NativeEndian, LittleEndian};
+
+                #[test]
+                #[should_panic]
+                fn read_big_endian() {
+                    let bytes = [0; $num_bytes];
+                    let mut numbers = $numbers;
+                    BigEndian::$read(&bytes, &mut numbers);
+                }
+
+                #[test]
+                #[should_panic]
+                fn read_little_endian() {
+                    let bytes = [0; $num_bytes];
+                    let mut numbers = $numbers;
+                    LittleEndian::$read(&bytes, &mut numbers);
+                }
+
+                #[test]
+                #[should_panic]
+                fn read_native_endian() {
+                    let bytes = [0; $num_bytes];
+                    let mut numbers = $numbers;
+                    NativeEndian::$read(&bytes, &mut numbers);
+                }
+
+                #[test]
+                #[should_panic]
+                fn write_big_endian() {
+                    let mut bytes = [0; $num_bytes];
+                    let numbers = $numbers;
+                    BigEndian::$write(&numbers, &mut bytes);
+                }
+
+                #[test]
+                #[should_panic]
+                fn write_little_endian() {
+                    let mut bytes = [0; $num_bytes];
+                    let numbers = $numbers;
+                    LittleEndian::$write(&numbers, &mut bytes);
+                }
+
+                #[test]
+                #[should_panic]
+                fn write_native_endian() {
+                    let mut bytes = [0; $num_bytes];
+                    let numbers = $numbers;
+                    NativeEndian::$write(&numbers, &mut bytes);
+                }
+            }
+        }
+    }
+
+    slice_lengths!(
+        slice_len_too_small_u16, read_u16_into, write_u16_into, 3, [0, 0]);
+    slice_lengths!(
+        slice_len_too_big_u16, read_u16_into, write_u16_into, 5, [0, 0]);
+    slice_lengths!(
+        slice_len_too_small_i16, read_i16_into, write_i16_into, 3, [0, 0]);
+    slice_lengths!(
+        slice_len_too_big_i16, read_i16_into, write_i16_into, 5, [0, 0]);
+
+    slice_lengths!(
+        slice_len_too_small_u32, read_u32_into, write_u32_into, 7, [0, 0]);
+    slice_lengths!(
+        slice_len_too_big_u32, read_u32_into, write_u32_into, 9, [0, 0]);
+    slice_lengths!(
+        slice_len_too_small_i32, read_i32_into, write_i32_into, 7, [0, 0]);
+    slice_lengths!(
+        slice_len_too_big_i32, read_i32_into, write_i32_into, 9, [0, 0]);
+
+    slice_lengths!(
+        slice_len_too_small_u64, read_u64_into, write_u64_into, 15, [0, 0]);
+    slice_lengths!(
+        slice_len_too_big_u64, read_u64_into, write_u64_into, 17, [0, 0]);
+    slice_lengths!(
+        slice_len_too_small_i64, read_i64_into, write_i64_into, 15, [0, 0]);
+    slice_lengths!(
+        slice_len_too_big_i64, read_i64_into, write_i64_into, 17, [0, 0]);
+
+    #[cfg(feature = "i128")]
+    slice_lengths!(
+        slice_len_too_small_u128, read_u128_into, write_u128_into, 31, [0, 0]);
+    #[cfg(feature = "i128")]
+    slice_lengths!(
+        slice_len_too_big_u128, read_u128_into, write_u128_into, 33, [0, 0]);
+    #[cfg(feature = "i128")]
+    slice_lengths!(
+        slice_len_too_small_i128, read_i128_into, write_i128_into, 31, [0, 0]);
+    #[cfg(feature = "i128")]
+    slice_lengths!(
+        slice_len_too_big_i128, read_i128_into, write_i128_into, 33, [0, 0]);
+
     #[test]
     fn uint_bigger_buffer() {
         use {ByteOrder, LittleEndian};
         let n = LittleEndian::read_uint(&[1, 2, 3, 4, 5, 6, 7, 8], 5);
         assert_eq!(n, 0x0504030201);
     }
+
+    #[test]
+    fn read_snan() {
+        use core::f32;
+        use core::f64;
+        use core::mem::transmute;
+
+        use {ByteOrder, BigEndian, LittleEndian};
+
+        let sf = BigEndian::read_f32(&[0xFF, 0x80, 0x00, 0x01]);
+        let sbits: u32 = unsafe { transmute(sf) };
+        assert_eq!(sbits, unsafe { transmute(f32::NAN) });
+        assert_eq!(sf.classify(), ::core::num::FpCategory::Nan);
+
+        let df = BigEndian::read_f64(&[0x7F, 0xF0, 0, 0, 0, 0, 0, 0x01]);
+        let dbits: u64 = unsafe { ::core::mem::transmute(df) };
+        assert_eq!(dbits, unsafe { transmute(f64::NAN) });
+        assert_eq!(df.classify(), ::core::num::FpCategory::Nan);
+
+        let sf = LittleEndian::read_f32(&[0x01, 0x00, 0x80, 0xFF]);
+        let sbits: u32 = unsafe { transmute(sf) };
+        assert_eq!(sbits, unsafe { transmute(f32::NAN) });
+        assert_eq!(sf.classify(), ::core::num::FpCategory::Nan);
+
+        let df = LittleEndian::read_f64(&[0x01, 0, 0, 0, 0, 0, 0xF0, 0x7F]);
+        let dbits: u64 = unsafe { ::core::mem::transmute(df) };
+        assert_eq!(dbits, unsafe { transmute(f64::NAN) });
+        assert_eq!(df.classify(), ::core::num::FpCategory::Nan);
+    }
 }
 
 #[cfg(test)]
 #[cfg(feature = "std")]
 mod stdtests {
+    extern crate quickcheck;
+    extern crate rand;
+
+    use self::quickcheck::{QuickCheck, StdGen, Testable};
+    use self::rand::thread_rng;
+
+    fn qc_unsized<A: Testable>(f: A) {
+
+        QuickCheck::new()
+            .gen(StdGen::new(thread_rng(), 16))
+            .tests(1_00)
+            .max_tests(10_000)
+            .quickcheck(f);
+    }
+
+    macro_rules! calc_max {
+        ($max:expr, $bytes:expr) => { ($max - 1) >> (8 * (8 - $bytes)) };
+    }
+
     macro_rules! qc_bytes_ext {
-        ($name:ident, $ty_int:ident, $max:expr,
+        ($name:ident, $ty_int:ty, $max:expr,
          $bytes:expr, $read:ident, $write:ident) => (
             mod $name {
                 use std::io::Cursor;
                 use {
                     ReadBytesExt, WriteBytesExt,
                     BigEndian, NativeEndian, LittleEndian,
                 };
-                use test::qc_sized;
+                #[allow(unused_imports)] use test::{qc_sized, Wi128};
 
                 #[test]
                 fn big_endian() {
-                    let max = ($max - 1) >> (8 * (8 - $bytes));
                     fn prop(n: $ty_int) -> bool {
                         let mut wtr = vec![];
-                        wtr.$write::<BigEndian>(n).unwrap();
+                        wtr.$write::<BigEndian>(n.clone()).unwrap();
                         let mut rdr = Vec::new();
-                        rdr.extend(wtr[8 - $bytes..].iter().map(|&x|x));
+                        rdr.extend(wtr[wtr.len()-$bytes..].iter().map(|&x| x));
                         let mut rdr = Cursor::new(rdr);
                         n == rdr.$read::<BigEndian>($bytes).unwrap()
                     }
-                    qc_sized(prop as fn($ty_int) -> bool, max);
+                    qc_sized(prop as fn($ty_int) -> bool, $max);
                 }
 
                 #[test]
                 fn little_endian() {
-                    let max = ($max - 1) >> (8 * (8 - $bytes));
                     fn prop(n: $ty_int) -> bool {
                         let mut wtr = vec![];
-                        wtr.$write::<LittleEndian>(n).unwrap();
+                        wtr.$write::<LittleEndian>(n.clone()).unwrap();
                         let mut rdr = Cursor::new(wtr);
                         n == rdr.$read::<LittleEndian>($bytes).unwrap()
                     }
-                    qc_sized(prop as fn($ty_int) -> bool, max);
+                    qc_sized(prop as fn($ty_int) -> bool, $max);
                 }
 
                 #[test]
                 fn native_endian() {
-                    let max = ($max - 1) >> (8 * (8 - $bytes));
                     fn prop(n: $ty_int) -> bool {
                         let mut wtr = vec![];
-                        wtr.$write::<NativeEndian>(n).unwrap();
+                        wtr.$write::<NativeEndian>(n.clone()).unwrap();
                         let mut rdr = Cursor::new(wtr);
                         n == rdr.$read::<NativeEndian>($bytes).unwrap()
                     }
-                    qc_sized(prop as fn($ty_int) -> bool, max);
+                    qc_sized(prop as fn($ty_int) -> bool, $max);
                 }
             }
         );
-        ($name:ident, $ty_int:ident, $max:expr, $read:ident, $write:ident) => (
+        ($name:ident, $ty_int:ty, $max:expr, $read:ident, $write:ident) => (
             mod $name {
                 use std::io::Cursor;
                 use {
                     ReadBytesExt, WriteBytesExt,
                     BigEndian, NativeEndian, LittleEndian,
                 };
-                use test::qc_sized;
+                #[allow(unused_imports)] use test::{qc_sized, Wi128};
 
                 #[test]
                 fn big_endian() {
                     fn prop(n: $ty_int) -> bool {
                         let mut wtr = vec![];
-                        wtr.$write::<BigEndian>(n).unwrap();
+                        wtr.$write::<BigEndian>(n.clone()).unwrap();
                         let mut rdr = Cursor::new(wtr);
                         n == rdr.$read::<BigEndian>().unwrap()
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max - 1);
                 }
 
                 #[test]
                 fn little_endian() {
                     fn prop(n: $ty_int) -> bool {
                         let mut wtr = vec![];
-                        wtr.$write::<LittleEndian>(n).unwrap();
+                        wtr.$write::<LittleEndian>(n.clone()).unwrap();
                         let mut rdr = Cursor::new(wtr);
                         n == rdr.$read::<LittleEndian>().unwrap()
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max - 1);
                 }
 
                 #[test]
                 fn native_endian() {
                     fn prop(n: $ty_int) -> bool {
                         let mut wtr = vec![];
-                        wtr.$write::<NativeEndian>(n).unwrap();
+                        wtr.$write::<NativeEndian>(n.clone()).unwrap();
                         let mut rdr = Cursor::new(wtr);
                         n == rdr.$read::<NativeEndian>().unwrap()
                     }
                     qc_sized(prop as fn($ty_int) -> bool, $max - 1);
                 }
             }
         );
     }
 
-    qc_bytes_ext!(prop_ext_u16, u16, ::std::u16::MAX as u64, read_u16, write_u16);
-    qc_bytes_ext!(prop_ext_i16, i16, ::std::i16::MAX as u64, read_i16, write_i16);
-    qc_bytes_ext!(prop_ext_u32, u32, ::std::u32::MAX as u64, read_u32, write_u32);
-    qc_bytes_ext!(prop_ext_i32, i32, ::std::i32::MAX as u64, read_i32, write_i32);
-    qc_bytes_ext!(prop_ext_u64, u64, ::std::u64::MAX as u64, read_u64, write_u64);
-    qc_bytes_ext!(prop_ext_i64, i64, ::std::i64::MAX as u64, read_i64, write_i64);
-    qc_bytes_ext!(prop_ext_f32, f32, ::std::u64::MAX as u64, read_f32, write_f32);
-    qc_bytes_ext!(prop_ext_f64, f64, ::std::i64::MAX as u64, read_f64, write_f64);
+    qc_bytes_ext!(prop_ext_u16,
+        u16, ::std::u16::MAX as u64, read_u16, write_u16);
+    qc_bytes_ext!(prop_ext_i16,
+        i16, ::std::i16::MAX as u64, read_i16, write_i16);
+    qc_bytes_ext!(prop_ext_u32,
+        u32, ::std::u32::MAX as u64, read_u32, write_u32);
+    qc_bytes_ext!(prop_ext_i32,
+        i32, ::std::i32::MAX as u64, read_i32, write_i32);
+    qc_bytes_ext!(prop_ext_u64,
+        u64, ::std::u64::MAX as u64, read_u64, write_u64);
+    qc_bytes_ext!(prop_ext_i64,
+        i64, ::std::i64::MAX as u64, read_i64, write_i64);
+    qc_bytes_ext!(prop_ext_f32,
+        f32, ::std::u64::MAX as u64, read_f32, write_f32);
+    qc_bytes_ext!(prop_ext_f64,
+        f64, ::std::i64::MAX as u64, read_f64, write_f64);
+
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_u128, Wi128<u128>, 16 + 1, read_u128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_i128, Wi128<i128>, 16 + 1, read_i128, write_i128);
+
+    qc_bytes_ext!(prop_ext_uint_1,
+        u64, calc_max!(::test::U64_MAX, 1), 1, read_uint, write_u64);
+    qc_bytes_ext!(prop_ext_uint_2,
+        u64, calc_max!(::test::U64_MAX, 2), 2, read_uint, write_u64);
+    qc_bytes_ext!(prop_ext_uint_3,
+        u64, calc_max!(::test::U64_MAX, 3), 3, read_uint, write_u64);
+    qc_bytes_ext!(prop_ext_uint_4,
+        u64, calc_max!(::test::U64_MAX, 4), 4, read_uint, write_u64);
+    qc_bytes_ext!(prop_ext_uint_5,
+        u64, calc_max!(::test::U64_MAX, 5), 5, read_uint, write_u64);
+    qc_bytes_ext!(prop_ext_uint_6,
+        u64, calc_max!(::test::U64_MAX, 6), 6, read_uint, write_u64);
+    qc_bytes_ext!(prop_ext_uint_7,
+        u64, calc_max!(::test::U64_MAX, 7), 7, read_uint, write_u64);
+    qc_bytes_ext!(prop_ext_uint_8,
+        u64, calc_max!(::test::U64_MAX, 8), 8, read_uint, write_u64);
+
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_1,
+        Wi128<u128>, 1, 1, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_2,
+        Wi128<u128>, 2, 2, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_3,
+        Wi128<u128>, 3, 3, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_4,
+        Wi128<u128>, 4, 4, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_5,
+        Wi128<u128>, 5, 5, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_6,
+        Wi128<u128>, 6, 6, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_7,
+        Wi128<u128>, 7, 7, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_8,
+        Wi128<u128>, 8, 8, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_9,
+        Wi128<u128>, 9, 9, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_10,
+        Wi128<u128>, 10, 10, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_11,
+        Wi128<u128>, 11, 11, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_12,
+        Wi128<u128>, 12, 12, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_13,
+        Wi128<u128>, 13, 13, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_14,
+        Wi128<u128>, 14, 14, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_15,
+        Wi128<u128>, 15, 15, read_uint128, write_u128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_uint128_16,
+        Wi128<u128>, 16, 16, read_uint128, write_u128);
+
+    qc_bytes_ext!(prop_ext_int_1,
+        i64, calc_max!(::test::I64_MAX, 1), 1, read_int, write_i64);
+    qc_bytes_ext!(prop_ext_int_2,
+        i64, calc_max!(::test::I64_MAX, 2), 2, read_int, write_i64);
+    qc_bytes_ext!(prop_ext_int_3,
+        i64, calc_max!(::test::I64_MAX, 3), 3, read_int, write_i64);
+    qc_bytes_ext!(prop_ext_int_4,
+        i64, calc_max!(::test::I64_MAX, 4), 4, read_int, write_i64);
+    qc_bytes_ext!(prop_ext_int_5,
+        i64, calc_max!(::test::I64_MAX, 5), 5, read_int, write_i64);
+    qc_bytes_ext!(prop_ext_int_6,
+        i64, calc_max!(::test::I64_MAX, 6), 6, read_int, write_i64);
+    qc_bytes_ext!(prop_ext_int_7,
+        i64, calc_max!(::test::I64_MAX, 1), 7, read_int, write_i64);
+    qc_bytes_ext!(prop_ext_int_8,
+        i64, calc_max!(::test::I64_MAX, 8), 8, read_int, write_i64);
 
-    qc_bytes_ext!(prop_ext_uint_1, u64, ::test::U64_MAX, 1, read_uint, write_u64);
-    qc_bytes_ext!(prop_ext_uint_2, u64, ::test::U64_MAX, 2, read_uint, write_u64);
-    qc_bytes_ext!(prop_ext_uint_3, u64, ::test::U64_MAX, 3, read_uint, write_u64);
-    qc_bytes_ext!(prop_ext_uint_4, u64, ::test::U64_MAX, 4, read_uint, write_u64);
-    qc_bytes_ext!(prop_ext_uint_5, u64, ::test::U64_MAX, 5, read_uint, write_u64);
-    qc_bytes_ext!(prop_ext_uint_6, u64, ::test::U64_MAX, 6, read_uint, write_u64);
-    qc_bytes_ext!(prop_ext_uint_7, u64, ::test::U64_MAX, 7, read_uint, write_u64);
-    qc_bytes_ext!(prop_ext_uint_8, u64, ::test::U64_MAX, 8, read_uint, write_u64);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_1,
+        Wi128<i128>, 1, 1, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_2,
+        Wi128<i128>, 2, 2, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_3,
+        Wi128<i128>, 3, 3, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_4,
+        Wi128<i128>, 4, 4, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_5,
+        Wi128<i128>, 5, 5, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_6,
+        Wi128<i128>, 6, 6, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_7,
+        Wi128<i128>, 7, 7, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_8,
+        Wi128<i128>, 8, 8, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_9,
+        Wi128<i128>, 9, 9, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_10,
+        Wi128<i128>, 10, 10, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_11,
+        Wi128<i128>, 11, 11, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_12,
+        Wi128<i128>, 12, 12, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_13,
+        Wi128<i128>, 13, 13, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_14,
+        Wi128<i128>, 14, 14, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_15,
+        Wi128<i128>, 15, 15, read_int128, write_i128);
+    #[cfg(feature = "i128")]
+    qc_bytes_ext!(prop_ext_int128_16,
+        Wi128<i128>, 16, 16, read_int128, write_i128);
+
+    // Test slice serialization/deserialization.
+    macro_rules! qc_slice {
+        ($name:ident, $ty_int:ty, $read:ident, $write:ident, $zero:expr) => {
+            mod $name {
+                use core::mem::size_of;
+                use {ByteOrder, BigEndian, NativeEndian, LittleEndian};
+                use super::qc_unsized;
+                #[allow(unused_imports)]
+                use test::Wi128;
+
+                #[test]
+                fn big_endian() {
+                    #[allow(unused_unsafe)]
+                    fn prop(numbers: Vec<$ty_int>) -> bool {
+                        let numbers: Vec<_> = numbers
+                            .into_iter()
+                            .map(|x| x.clone())
+                            .collect();
+                        let num_bytes = size_of::<$ty_int>() * numbers.len();
+                        let mut bytes = vec![0; num_bytes];
+
+                        BigEndian::$write(&numbers, &mut bytes);
 
-    qc_bytes_ext!(prop_ext_int_1, i64, ::test::I64_MAX, 1, read_int, write_i64);
-    qc_bytes_ext!(prop_ext_int_2, i64, ::test::I64_MAX, 2, read_int, write_i64);
-    qc_bytes_ext!(prop_ext_int_3, i64, ::test::I64_MAX, 3, read_int, write_i64);
-    qc_bytes_ext!(prop_ext_int_4, i64, ::test::I64_MAX, 4, read_int, write_i64);
-    qc_bytes_ext!(prop_ext_int_5, i64, ::test::I64_MAX, 5, read_int, write_i64);
-    qc_bytes_ext!(prop_ext_int_6, i64, ::test::I64_MAX, 6, read_int, write_i64);
-    qc_bytes_ext!(prop_ext_int_7, i64, ::test::I64_MAX, 7, read_int, write_i64);
-    qc_bytes_ext!(prop_ext_int_8, i64, ::test::I64_MAX, 8, read_int, write_i64);
+                        let mut got = vec![$zero; numbers.len()];
+                        unsafe { BigEndian::$read(&bytes, &mut got); }
+
+                        numbers == got
+                    }
+                    qc_unsized(prop as fn(_) -> bool);
+                }
+
+                #[test]
+                fn little_endian() {
+                    #[allow(unused_unsafe)]
+                    fn prop(numbers: Vec<$ty_int>) -> bool {
+                        let numbers: Vec<_> = numbers
+                            .into_iter()
+                            .map(|x| x.clone())
+                            .collect();
+                        let num_bytes = size_of::<$ty_int>() * numbers.len();
+                        let mut bytes = vec![0; num_bytes];
+
+                        LittleEndian::$write(&numbers, &mut bytes);
+
+                        let mut got = vec![$zero; numbers.len()];
+                        unsafe { LittleEndian::$read(&bytes, &mut got); }
+
+                        numbers == got
+                    }
+                    qc_unsized(prop as fn(_) -> bool);
+                }
+
+                #[test]
+                fn native_endian() {
+                    #[allow(unused_unsafe)]
+                    fn prop(numbers: Vec<$ty_int>) -> bool {
+                        let numbers: Vec<_> = numbers
+                            .into_iter()
+                            .map(|x| x.clone())
+                            .collect();
+                        let num_bytes = size_of::<$ty_int>() * numbers.len();
+                        let mut bytes = vec![0; num_bytes];
+
+                        NativeEndian::$write(&numbers, &mut bytes);
+
+                        let mut got = vec![$zero; numbers.len()];
+                        unsafe { NativeEndian::$read(&bytes, &mut got); }
+
+                        numbers == got
+                    }
+                    qc_unsized(prop as fn(_) -> bool);
+                }
+            }
+        }
+    }
+
+    qc_slice!(prop_slice_u16, u16, read_u16_into, write_u16_into, 0);
+    qc_slice!(prop_slice_i16, i16, read_i16_into, write_i16_into, 0);
+    qc_slice!(prop_slice_u32, u32, read_u32_into, write_u32_into, 0);
+    qc_slice!(prop_slice_i32, i32, read_i32_into, write_i32_into, 0);
+    qc_slice!(prop_slice_u64, u64, read_u64_into, write_u64_into, 0);
+    qc_slice!(prop_slice_i64, i64, read_i64_into, write_i64_into, 0);
+    #[cfg(feature = "i128")]
+    qc_slice!(
+        prop_slice_u128, Wi128<u128>, read_u128_into, write_u128_into, 0);
+    #[cfg(feature = "i128")]
+    qc_slice!(
+        prop_slice_i128, Wi128<i128>, read_i128_into, write_i128_into, 0);
+
+    qc_slice!(
+        prop_slice_f32, f32, read_f32_into_unchecked, write_f32_into, 0.0);
+    qc_slice!(
+        prop_slice_f64, f64, read_f64_into_unchecked, write_f64_into, 0.0);
 }
-
copy from third_party/rust/cfg-if/.cargo-checksum.json
copy to third_party/rust/cfg-if-0.1.1/.cargo-checksum.json
new file mode 100644
--- /dev/null
+++ b/third_party/rust/cfg-if-0.1.1/.travis.yml
@@ -0,0 +1,23 @@
+language: rust
+rust:
+  - stable
+  - beta
+  - nightly
+sudo: false
+before_script:
+  - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
+script:
+  - cargo build --verbose
+  - cargo test --verbose
+  - rustdoc --test README.md -L target/debug -L target/debug/deps
+  - cargo doc --no-deps
+after_success:
+  - travis-cargo --only nightly doc-upload
+env:
+  global:
+    secure: "TyMGH+sbPmKs9lKCziKShxWr3G6im0owEchVrbUChWnQIQv1WydXftFoEoUsVl6qZspjehWK1b1AsnIgCXK0HtEi4DnqLsxs0s36bOjfg5yHBT/pETTr6kcq7KAL4Be4GmI331k6gT1Oi0TPFp7Sg9xpiWsQqKIHA5Szk2wpFQ8="
+
+
+notifications:
+  email:
+    on_success: never
copy from third_party/rust/cfg-if/Cargo.toml
copy to third_party/rust/cfg-if-0.1.1/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/cfg-if-0.1.1/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/cfg-if-0.1.1/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 Alex Crichton
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/cfg-if-0.1.1/README.md
@@ -0,0 +1,44 @@
+# cfg-if
+
+[![Build Status](https://travis-ci.org/alexcrichton/cfg-if.svg?branch=master)](https://travis-ci.org/alexcrichton/cfg-if)
+
+[Documentation](http://alexcrichton.com/cfg-if)
+
+A macro to ergonomically define an item depending on a large number of #[cfg]
+parameters. Structured like an if-else chain, the first matching branch is the
+item that gets emitted.
+
+```toml
+[dependencies]
+cfg-if = "0.1"
+```
+
+## Example
+
+```rust
+#[macro_use]
+extern crate cfg_if;
+
+cfg_if! {
+    if #[cfg(unix)] {
+        fn foo() { /* unix specific functionality */ }
+    } else if #[cfg(target_pointer_width = "32")] {
+        fn foo() { /* non-unix, 32-bit functionality */ }
+    } else {
+        fn foo() { /* fallback implementation */ }
+    }
+}
+
+fn main() {
+    foo();
+}
+```
+
+# License
+
+`cfg-if` is primarily distributed under the terms of both the MIT license and
+the Apache License (Version 2.0), with portions covered by various BSD-like
+licenses.
+
+See LICENSE-APACHE, and LICENSE-MIT for details.
+
copy from third_party/rust/cfg-if/src/lib.rs
copy to third_party/rust/cfg-if-0.1.1/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/cfg-if-0.1.1/tests/xcrate.rs
@@ -0,0 +1,17 @@
+#[macro_use]
+extern crate cfg_if;
+
+cfg_if! {
+    if #[cfg(foo)] {
+        fn works() -> bool { false }
+    } else if #[cfg(test)] {
+        fn works() -> bool { true }
+    } else {
+        fn works() -> bool { false }
+    }
+}
+
+#[test]
+fn smoke() {
+    assert!(works());
+}
--- a/third_party/rust/cfg-if/.cargo-checksum.json
+++ b/third_party/rust/cfg-if/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"50f67b20a376d437e0706d9bbb0343c677295529991370b2962f814c0b2efea3","Cargo.toml":"d217067290b088db7f696e02ecc25461a0277e5e5e3bca6c7c0412b604c3526b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"3fa9368c60bc701dea294fbacae0469188c4be1de79f82e972bb9b321776cd52","src/lib.rs":"74b287a91a46dc9d0c179053b439fd40c43ad5389fbd5199fff1cce0094726a6","tests/xcrate.rs":"30dcb70fbb9c96fda2b7825592558279f534776f72e2a8a0a3e26df4dedb3caa"},"package":"d0c47d456a36ebf0536a6705c83c1cbbcb9255fbc1d905a6ded104f479268a29"}
\ No newline at end of file
+{"files":{".travis.yml":"50f67b20a376d437e0706d9bbb0343c677295529991370b2962f814c0b2efea3","Cargo.toml":"764b9ce160653e841430da3919ff968b957ff811f7da42c8483c8bfc2f06be25","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"3fa9368c60bc701dea294fbacae0469188c4be1de79f82e972bb9b321776cd52","src/lib.rs":"6915169e3ca05f28e1cb0e052379d74f2496400de1240b74c56e55c2674a6560","tests/xcrate.rs":"30dcb70fbb9c96fda2b7825592558279f534776f72e2a8a0a3e26df4dedb3caa"},"package":"d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"}
\ No newline at end of file
--- a/third_party/rust/cfg-if/Cargo.toml
+++ b/third_party/rust/cfg-if/Cargo.toml
@@ -1,11 +1,11 @@
 [package]
 name = "cfg-if"
-version = "0.1.1"
+version = "0.1.2"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 license = "MIT/Apache-2.0"
 readme = "README.md"
 repository = "https://github.com/alexcrichton/cfg-if"
 homepage = "https://github.com/alexcrichton/cfg-if"
 documentation = "http://alexcrichton.com/cfg-if"
 description = """
 A macro to ergonomically define an item depending on a large number of #[cfg]
--- a/third_party/rust/cfg-if/src/lib.rs
+++ b/third_party/rust/cfg-if/src/lib.rs
@@ -39,16 +39,29 @@ macro_rules! cfg_if {
     ) else * else {
         $($it2:item)*
     }) => {
         __cfg_if_items! {
             () ;
             $( ( ($($meta),*) ($($it)*) ), )*
             ( () ($($it2)*) ),
         }
+    };
+    (
+        if #[cfg($($i_met:meta),*)] { $($i_it:item)* }
+        $(
+            else if #[cfg($($e_met:meta),*)] { $($e_it:item)* }
+        )*
+    ) => {
+        __cfg_if_items! {
+            () ;
+            ( ($($i_met),*) ($($i_it)*) ),
+            $( ( ($($e_met),*) ($($e_it)*) ), )*
+            ( () () ),
+        }
     }
 }
 
 #[macro_export]
 #[doc(hidden)]
 macro_rules! __cfg_if_items {
     (($($not:meta,)*) ; ) => {};
     (($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
@@ -89,15 +102,32 @@ mod tests {
     cfg_if! {
         if #[cfg(foo)] {
             fn works3() -> bool { false }
         } else {
             fn works3() -> bool { true }
         }
     }
 
+    cfg_if! {
+        if #[cfg(test)] {
+            use core::option::Option as Option3;
+            fn works4() -> Option3<u32> { Some(1) }
+        }
+    }
+
+    cfg_if! {
+        if #[cfg(foo)] {
+            fn works5() -> bool { false }
+        } else if #[cfg(test)] {
+            fn works5() -> bool { true }
+        }
+    }
+
     #[test]
     fn it_works() {
         assert!(works1().is_some());
         assert!(works2());
         assert!(works3());
+        assert!(works4().is_some());
+        assert!(works5());
     }
 }
copy from third_party/rust/gcc/.cargo-checksum.json
copy to third_party/rust/gcc-0.3.51/.cargo-checksum.json
copy from third_party/rust/gcc/.travis.yml
copy to third_party/rust/gcc-0.3.51/.travis.yml
copy from third_party/rust/gcc/Cargo.toml
copy to third_party/rust/gcc-0.3.51/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gcc-0.3.51/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gcc-0.3.51/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 Alex Crichton
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
copy from third_party/rust/gcc/README.md
copy to third_party/rust/gcc-0.3.51/README.md
copy from third_party/rust/gcc/appveyor.yml
copy to third_party/rust/gcc-0.3.51/appveyor.yml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gcc-0.3.51/src/bin/gcc-shim.rs
@@ -0,0 +1,23 @@
+#![cfg_attr(test, allow(dead_code))]
+
+use std::env;
+use std::fs::File;
+use std::io::prelude::*;
+use std::path::PathBuf;
+
+fn main() {
+    let out_dir = PathBuf::from(env::var_os("GCCTEST_OUT_DIR").unwrap());
+    for i in 0.. {
+        let candidate = out_dir.join(format!("out{}", i));
+        if candidate.exists() {
+            continue;
+        }
+        let mut f = File::create(candidate).unwrap();
+        for arg in env::args().skip(1) {
+            writeln!(f, "{}", arg).unwrap();
+        }
+
+        File::create(out_dir.join("libfoo.a")).unwrap();
+        break;
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gcc-0.3.51/src/com.rs
@@ -0,0 +1,125 @@
+// Copyright © 2017 winapi-rs developers
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(unused)]
+
+use std::ffi::{OsStr, OsString};
+use std::mem::forget;
+use std::ops::Deref;
+use std::os::windows::ffi::{OsStrExt, OsStringExt};
+use std::ptr::null_mut;
+use std::slice::from_raw_parts;
+use winapi::Interface;
+use winapi::BSTR;
+use winapi::CoInitializeEx;
+use winapi::COINIT_MULTITHREADED;
+use winapi::{SysFreeString, SysStringLen};
+use winapi::IUnknown;
+use winapi::{S_OK, S_FALSE, HRESULT};
+
+pub fn initialize() -> Result<(), HRESULT> {
+    let err = unsafe { CoInitializeEx(null_mut(), COINIT_MULTITHREADED) };
+    if err != S_OK && err != S_FALSE {
+        // S_FALSE just means COM is already initialized
+        return Err(err);
+    }
+    Ok(())
+}
+
+pub struct ComPtr<T>(*mut T) where T: Interface;
+impl<T> ComPtr<T> where T: Interface {
+    /// Creates a `ComPtr` to wrap a raw pointer.
+    /// It takes ownership over the pointer which means it does __not__ call `AddRef`.
+    /// `T` __must__ be a COM interface that inherits from `IUnknown`.
+    pub unsafe fn from_raw(ptr: *mut T) -> ComPtr<T> {
+        assert!(!ptr.is_null());
+        ComPtr(ptr)
+    }
+    /// Casts up the inheritance chain
+    pub fn up<U>(self) -> ComPtr<U> where T: Deref<Target=U>, U: Interface {
+        ComPtr(self.into_raw() as *mut U)
+    }
+    /// Extracts the raw pointer.
+    /// You are now responsible for releasing it yourself.
+    pub fn into_raw(self) -> *mut T {
+        let p = self.0;
+        forget(self);
+        p
+    }
+    /// For internal use only.
+    fn as_unknown(&self) -> &IUnknown {
+        unsafe { &*(self.0 as *mut IUnknown) }
+    }
+    /// Performs QueryInterface fun.
+    pub fn cast<U>(&self) -> Result<ComPtr<U>, i32> where U: Interface {
+        let mut obj = null_mut();
+        let err = unsafe { self.as_unknown().QueryInterface(&U::uuidof(), &mut obj) };
+        if err < 0 { return Err(err); }
+        Ok(unsafe { ComPtr::from_raw(obj as *mut U) })
+    }
+}
+impl<T> Deref for ComPtr<T> where T: Interface {
+    type Target = T;
+    fn deref(&self) -> &T {
+        unsafe { &*self.0 }
+    }
+}
+impl<T> Clone for ComPtr<T> where T: Interface {
+    fn clone(&self) -> Self {
+        unsafe {
+            self.as_unknown().AddRef();
+            ComPtr::from_raw(self.0)
+        }
+    }
+}
+impl<T> Drop for ComPtr<T> where T: Interface {
+    fn drop(&mut self) {
+        unsafe { self.as_unknown().Release(); }
+    }
+}
+pub struct BStr(BSTR);
+impl BStr {
+    pub unsafe fn from_raw(s: BSTR) -> BStr {
+        BStr(s)
+    }
+    pub fn to_osstring(&self) -> OsString {
+        let len = unsafe { SysStringLen(self.0) };
+        let slice = unsafe { from_raw_parts(self.0, len as usize) };
+        OsStringExt::from_wide(slice)
+    }
+}
+impl Drop for BStr {
+    fn drop(&mut self) {
+        unsafe { SysFreeString(self.0) };
+    }
+}
+
+pub trait ToWide {
+    fn to_wide(&self) -> Vec<u16>;
+    fn to_wide_null(&self) -> Vec<u16>;
+}
+impl<T> ToWide for T where T: AsRef<OsStr> {
+    fn to_wide(&self) -> Vec<u16> {
+        self.as_ref().encode_wide().collect()
+    }
+    fn to_wide_null(&self) -> Vec<u16> {
+        self.as_ref().encode_wide().chain(Some(0)).collect()
+    }
+}
+pub trait FromWide where Self: Sized {
+    fn from_wide(wide: &[u16]) -> Self;
+    fn from_wide_null(wide: &[u16]) -> Self {
+        let len = wide.iter().take_while(|&&c| c != 0).count();
+        Self::from_wide(&wide[..len])
+    }
+}
+impl FromWide for OsString {
+    fn from_wide(wide: &[u16]) -> OsString {
+        OsStringExt::from_wide(wide)
+    }
+}
+
copy from third_party/rust/gcc/src/lib.rs
copy to third_party/rust/gcc-0.3.51/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gcc-0.3.51/src/registry.rs
@@ -0,0 +1,190 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::ffi::{OsString, OsStr};
+use std::io;
+use std::ops::RangeFrom;
+use std::os::raw;
+use std::os::windows::prelude::*;
+
+pub struct RegistryKey(Repr);
+
+type HKEY = *mut u8;
+type DWORD = u32;
+type LPDWORD = *mut DWORD;
+type LPCWSTR = *const u16;
+type LPWSTR = *mut u16;
+type LONG = raw::c_long;
+type PHKEY = *mut HKEY;
+type PFILETIME = *mut u8;
+type LPBYTE = *mut u8;
+type REGSAM = u32;
+
+const ERROR_SUCCESS: DWORD = 0;
+const ERROR_NO_MORE_ITEMS: DWORD = 259;
+const HKEY_LOCAL_MACHINE: HKEY = 0x80000002 as HKEY;
+const REG_SZ: DWORD = 1;
+const KEY_READ: DWORD = 0x20019;
+const KEY_WOW64_32KEY: DWORD = 0x200;
+
+#[link(name = "advapi32")]
+extern "system" {
+    fn RegOpenKeyExW(key: HKEY,
+                     lpSubKey: LPCWSTR,
+                     ulOptions: DWORD,
+                     samDesired: REGSAM,
+                     phkResult: PHKEY)
+                     -> LONG;
+    fn RegEnumKeyExW(key: HKEY,
+                     dwIndex: DWORD,
+                     lpName: LPWSTR,
+                     lpcName: LPDWORD,
+                     lpReserved: LPDWORD,
+                     lpClass: LPWSTR,
+                     lpcClass: LPDWORD,
+                     lpftLastWriteTime: PFILETIME)
+                     -> LONG;
+    fn RegQueryValueExW(hKey: HKEY,
+                        lpValueName: LPCWSTR,
+                        lpReserved: LPDWORD,
+                        lpType: LPDWORD,
+                        lpData: LPBYTE,
+                        lpcbData: LPDWORD)
+                        -> LONG;
+    fn RegCloseKey(hKey: HKEY) -> LONG;
+}
+
+struct OwnedKey(HKEY);
+
+enum Repr {
+    Const(HKEY),
+    Owned(OwnedKey),
+}
+
+pub struct Iter<'a> {
+    idx: RangeFrom<DWORD>,
+    key: &'a RegistryKey,
+}
+
+unsafe impl Sync for Repr {}
+unsafe impl Send for Repr {}
+
+pub static LOCAL_MACHINE: RegistryKey = RegistryKey(Repr::Const(HKEY_LOCAL_MACHINE));
+
+impl RegistryKey {
+    fn raw(&self) -> HKEY {
+        match self.0 {
+            Repr::Const(val) => val,
+            Repr::Owned(ref val) => val.0,
+        }
+    }
+
+    pub fn open(&self, key: &OsStr) -> io::Result<RegistryKey> {
+        let key = key.encode_wide().chain(Some(0)).collect::<Vec<_>>();
+        let mut ret = 0 as *mut _;
+        let err = unsafe {
+            RegOpenKeyExW(self.raw(),
+                          key.as_ptr(),
+                          0,
+                          KEY_READ | KEY_WOW64_32KEY,
+                          &mut ret)
+        };
+        if err == ERROR_SUCCESS as LONG {
+            Ok(RegistryKey(Repr::Owned(OwnedKey(ret))))
+        } else {
+            Err(io::Error::from_raw_os_error(err as i32))
+        }
+    }
+
+    pub fn iter(&self) -> Iter {
+        Iter {
+            idx: 0..,
+            key: self,
+        }
+    }
+
+    pub fn query_str(&self, name: &str) -> io::Result<OsString> {
+        let name: &OsStr = name.as_ref();
+        let name = name.encode_wide().chain(Some(0)).collect::<Vec<_>>();
+        let mut len = 0;
+        let mut kind = 0;
+        unsafe {
+            let err = RegQueryValueExW(self.raw(),
+                                       name.as_ptr(),
+                                       0 as *mut _,
+                                       &mut kind,
+                                       0 as *mut _,
+                                       &mut len);
+            if err != ERROR_SUCCESS as LONG {
+                return Err(io::Error::from_raw_os_error(err as i32));
+            }
+            if kind != REG_SZ {
+                return Err(io::Error::new(io::ErrorKind::Other, "registry key wasn't a string"));
+            }
+
+            // The length here is the length in bytes, but we're using wide
+            // characters so we need to be sure to halve it for the capacity
+            // passed in.
+            let mut v = Vec::with_capacity(len as usize / 2);
+            let err = RegQueryValueExW(self.raw(),
+                                       name.as_ptr(),
+                                       0 as *mut _,
+                                       0 as *mut _,
+                                       v.as_mut_ptr() as *mut _,
+                                       &mut len);
+            if err != ERROR_SUCCESS as LONG {
+                return Err(io::Error::from_raw_os_error(err as i32));
+            }
+            v.set_len(len as usize / 2);
+
+            // Some registry keys may have a terminating nul character, but
+            // we're not interested in that, so chop it off if it's there.
+            if v[v.len() - 1] == 0 {
+                v.pop();
+            }
+            Ok(OsString::from_wide(&v))
+        }
+    }
+}
+
+impl Drop for OwnedKey {
+    fn drop(&mut self) {
+        unsafe {
+            RegCloseKey(self.0);
+        }
+    }
+}
+
+impl<'a> Iterator for Iter<'a> {
+    type Item = io::Result<OsString>;
+
+    fn next(&mut self) -> Option<io::Result<OsString>> {
+        self.idx.next().and_then(|i| unsafe {
+            let mut v = Vec::with_capacity(256);
+            let mut len = v.capacity() as DWORD;
+            let ret = RegEnumKeyExW(self.key.raw(),
+                                    i,
+                                    v.as_mut_ptr(),
+                                    &mut len,
+                                    0 as *mut _,
+                                    0 as *mut _,
+                                    0 as *mut _,
+                                    0 as *mut _);
+            if ret == ERROR_NO_MORE_ITEMS as LONG {
+                None
+            } else if ret != ERROR_SUCCESS as LONG {
+                Some(Err(io::Error::from_raw_os_error(ret as i32)))
+            } else {
+                v.set_len(len as usize);
+                Some(Ok(OsString::from_wide(&v)))
+            }
+        })
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gcc-0.3.51/src/setup_config.rs
@@ -0,0 +1,257 @@
+// Copyright © 2017 winapi-rs developers
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(bad_style)]
+#![allow(unused)]
+
+use std::ffi::OsString;
+use std::ptr::null_mut;
+use winapi::Interface;
+use winapi::{LPFILETIME, ULONG};
+use winapi::S_FALSE;
+use winapi::BSTR;
+use winapi::LPCOLESTR;
+use winapi::{CLSCTX_ALL, CoCreateInstance};
+use winapi::LPSAFEARRAY;
+use winapi::{IUnknown, IUnknownVtbl};
+use winapi::{HRESULT, LCID, LPCWSTR, PULONGLONG};
+
+use com::{BStr, ComPtr};
+
+// Bindings to the Setup.Configuration stuff
+pub type InstanceState = u32;
+
+pub const eNone: InstanceState = 0;
+pub const eLocal: InstanceState = 1;
+pub const eRegistered: InstanceState = 2;
+pub const eNoRebootRequired: InstanceState = 4;
+pub const eComplete: InstanceState = -1i32 as u32;
+
+RIDL!{#[uuid(0xb41463c3, 0x8866, 0x43b5, 0xbc, 0x33, 0x2b, 0x06, 0x76, 0xf7, 0xf4, 0x2e)]
+interface ISetupInstance(ISetupInstanceVtbl): IUnknown(IUnknownVtbl) {
+    fn GetInstanceId(
+        pbstrInstanceId: *mut BSTR,
+    ) -> HRESULT,
+    fn GetInstallDate(
+        pInstallDate: LPFILETIME,
+    ) -> HRESULT,
+    fn GetInstallationName(
+        pbstrInstallationName: *mut BSTR,
+    ) -> HRESULT,
+    fn GetInstallationPath(
+        pbstrInstallationPath: *mut BSTR,
+    ) -> HRESULT,
+    fn GetInstallationVersion(
+        pbstrInstallationVersion: *mut BSTR,
+    ) -> HRESULT,
+    fn GetDisplayName(
+        lcid: LCID,
+        pbstrDisplayName: *mut BSTR,
+    ) -> HRESULT,
+    fn GetDescription(
+        lcid: LCID,
+        pbstrDescription: *mut BSTR,
+    ) -> HRESULT,
+    fn ResolvePath(
+        pwszRelativePath: LPCOLESTR,
+        pbstrAbsolutePath: *mut BSTR,
+    ) -> HRESULT,
+}}
+
+RIDL!{#[uuid(0x89143c9a, 0x05af, 0x49b0, 0xb7, 0x17, 0x72, 0xe2, 0x18, 0xa2, 0x18, 0x5c)]
+interface ISetupInstance2(ISetupInstance2Vtbl): ISetupInstance(ISetupInstanceVtbl) {
+    fn GetState(
+        pState: *mut InstanceState,
+    ) -> HRESULT,
+    fn GetPackages(
+        ppsaPackages: *mut LPSAFEARRAY,
+    ) -> HRESULT,
+    fn GetProduct(
+        ppPackage: *mut *mut ISetupPackageReference,
+    ) -> HRESULT,
+    fn GetProductPath(
+        pbstrProductPath: *mut BSTR,
+    ) -> HRESULT,
+}}
+
+RIDL!{#[uuid(0x6380bcff, 0x41d3, 0x4b2e, 0x8b, 0x2e, 0xbf, 0x8a, 0x68, 0x10, 0xc8, 0x48)]
+interface IEnumSetupInstances(IEnumSetupInstancesVtbl): IUnknown(IUnknownVtbl) {
+    fn Next(
+        celt: ULONG,
+        rgelt: *mut *mut ISetupInstance,
+        pceltFetched: *mut ULONG,
+    ) -> HRESULT,
+    fn Skip(
+        celt: ULONG,
+    ) -> HRESULT,
+    fn Reset() -> HRESULT,
+    fn Clone(
+        ppenum: *mut *mut IEnumSetupInstances,
+    ) -> HRESULT,
+}}
+
+RIDL!{#[uuid(0x42843719, 0xdb4c, 0x46c2, 0x8e, 0x7c, 0x64, 0xf1, 0x81, 0x6e, 0xfd, 0x5b)]
+interface ISetupConfiguration(ISetupConfigurationVtbl): IUnknown(IUnknownVtbl) {
+    fn EnumInstances(
+        ppEnumInstances: *mut *mut IEnumSetupInstances,
+    ) -> HRESULT,
+    fn GetInstanceForCurrentProcess(
+        ppInstance: *mut *mut ISetupInstance,
+    ) -> HRESULT,
+    fn GetInstanceForPath(
+        wzPath: LPCWSTR,
+        ppInstance: *mut *mut ISetupInstance,
+    ) -> HRESULT,
+}}
+
+RIDL!{#[uuid(0x26aab78c, 0x4a60, 0x49d6, 0xaf, 0x3b, 0x3c, 0x35, 0xbc, 0x93, 0x36, 0x5d)]
+interface ISetupConfiguration2(ISetupConfiguration2Vtbl):
+    ISetupConfiguration(ISetupConfigurationVtbl) {
+    fn EnumAllInstances(
+        ppEnumInstances: *mut *mut IEnumSetupInstances,
+    ) -> HRESULT,
+}}
+
+RIDL!{#[uuid(0xda8d8a16, 0xb2b6, 0x4487, 0xa2, 0xf1, 0x59, 0x4c, 0xcc, 0xcd, 0x6b, 0xf5)]
+interface ISetupPackageReference(ISetupPackageReferenceVtbl): IUnknown(IUnknownVtbl) {
+    fn GetId(
+        pbstrId: *mut BSTR,
+    ) -> HRESULT,
+    fn GetVersion(
+        pbstrVersion: *mut BSTR,
+    ) -> HRESULT,
+    fn GetChip(
+        pbstrChip: *mut BSTR,
+    ) -> HRESULT,
+    fn GetLanguage(
+        pbstrLanguage: *mut BSTR,
+    ) -> HRESULT,
+    fn GetBranch(
+        pbstrBranch: *mut BSTR,
+    ) -> HRESULT,
+    fn GetType(
+        pbstrType: *mut BSTR,
+    ) -> HRESULT,
+    fn GetUniqueId(
+        pbstrUniqueId: *mut BSTR,
+    ) -> HRESULT,
+}}
+
+RIDL!{#[uuid(0x42b21b78, 0x6192, 0x463e, 0x87, 0xbf, 0xd5, 0x77, 0x83, 0x8f, 0x1d, 0x5c)]
+interface ISetupHelper(ISetupHelperVtbl): IUnknown(IUnknownVtbl) {
+    fn ParseVersion(
+        pwszVersion: LPCOLESTR,
+        pullVersion: PULONGLONG,
+    ) -> HRESULT,
+    fn ParseVersionRange(
+        pwszVersionRange: LPCOLESTR,
+        pullMinVersion: PULONGLONG,
+        pullMaxVersion: PULONGLONG,
+    ) -> HRESULT,
+}}
+
+DEFINE_GUID!{CLSID_SetupConfiguration,
+    0x177f0c4a, 0x1cd3, 0x4de7, 0xa3, 0x2c, 0x71, 0xdb, 0xbb, 0x9f, 0xa3, 0x6d}
+
+// Safe wrapper around the COM interfaces
+pub struct SetupConfiguration(ComPtr<ISetupConfiguration>);
+
+impl SetupConfiguration {
+    pub fn new() -> Result<SetupConfiguration, i32> {
+        let mut obj = null_mut();
+        let err = unsafe { CoCreateInstance(
+            &CLSID_SetupConfiguration, null_mut(), CLSCTX_ALL,
+            &ISetupConfiguration::uuidof(), &mut obj,
+        ) };
+        if err < 0 { return Err(err); }
+        let obj = unsafe { ComPtr::from_raw(obj as *mut ISetupConfiguration) };
+        Ok(SetupConfiguration(obj))
+    }
+    pub fn get_instance_for_current_process(&self) -> Result<SetupInstance, i32> {
+        let mut obj = null_mut();
+        let err = unsafe { self.0.GetInstanceForCurrentProcess(&mut obj) };
+        if err < 0 { return Err(err); }
+        Ok(unsafe { SetupInstance::from_raw(obj) })
+    }
+    pub fn enum_instances(&self) -> Result<EnumSetupInstances, i32> {
+        let mut obj = null_mut();
+        let err = unsafe { self.0.EnumInstances(&mut obj) };
+        if err < 0 { return Err(err); }
+        Ok(unsafe { EnumSetupInstances::from_raw(obj) })
+    }
+    pub fn enum_all_instances(&self) -> Result<EnumSetupInstances, i32> {
+        let mut obj = null_mut();
+        let this = try!(self.0.cast::<ISetupConfiguration2>());
+        let err = unsafe { this.EnumAllInstances(&mut obj) };
+        if err < 0 { return Err(err); }
+        Ok(unsafe { EnumSetupInstances::from_raw(obj) })
+    }
+}
+
+pub struct SetupInstance(ComPtr<ISetupInstance>);
+
+impl SetupInstance {
+    pub unsafe fn from_raw(obj: *mut ISetupInstance) -> SetupInstance {
+        SetupInstance(ComPtr::from_raw(obj))
+    }
+    pub fn instance_id(&self) -> Result<OsString, i32> {
+        let mut s = null_mut();
+        let err = unsafe { self.0.GetInstanceId(&mut s) };
+        let bstr = unsafe { BStr::from_raw(s) };
+        if err < 0 { return Err(err); }
+        Ok(bstr.to_osstring())
+    }
+    pub fn installation_name(&self) -> Result<OsString, i32> {
+        let mut s = null_mut();
+        let err = unsafe { self.0.GetInstallationName(&mut s) };
+        let bstr = unsafe { BStr::from_raw(s) };
+        if err < 0 { return Err(err); }
+        Ok(bstr.to_osstring())
+    }
+    pub fn installation_path(&self) -> Result<OsString, i32> {
+        let mut s = null_mut();
+        let err = unsafe { self.0.GetInstallationPath(&mut s) };
+        let bstr = unsafe { BStr::from_raw(s) };
+        if err < 0 { return Err(err); }
+        Ok(bstr.to_osstring())
+    }
+    pub fn installation_version(&self) -> Result<OsString, i32> {
+        let mut s = null_mut();
+        let err = unsafe { self.0.GetInstallationVersion(&mut s) };
+        let bstr = unsafe { BStr::from_raw(s) };
+        if err < 0 { return Err(err); }
+        Ok(bstr.to_osstring())
+    }
+    pub fn product_path(&self) -> Result<OsString, i32> {
+        let mut s = null_mut();
+        let this = try!(self.0.cast::<ISetupInstance2>());
+        let err = unsafe { this.GetProductPath(&mut s) };
+        let bstr = unsafe { BStr::from_raw(s) };
+        if err < 0 { return Err(err); }
+        Ok(bstr.to_osstring())
+    }
+}
+
+pub struct EnumSetupInstances(ComPtr<IEnumSetupInstances>);
+
+impl EnumSetupInstances {
+    pub unsafe fn from_raw(obj: *mut IEnumSetupInstances) -> EnumSetupInstances {
+        EnumSetupInstances(ComPtr::from_raw(obj))
+    }
+}
+
+impl Iterator for EnumSetupInstances {
+    type Item = Result<SetupInstance, i32>;
+    fn next(&mut self) -> Option<Result<SetupInstance, i32>> {
+        let mut obj = null_mut();
+        let err = unsafe { self.0.Next(1, &mut obj, null_mut()) };
+        if err < 0 { return Some(Err(err)); }
+        if err == S_FALSE { return None; }
+        Some(Ok(unsafe { SetupInstance::from_raw(obj) }))
+    }
+}
+
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gcc-0.3.51/src/winapi.rs
@@ -0,0 +1,214 @@
+// Copyright © 2015-2017 winapi-rs developers
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(bad_style)]
+
+use std::os::raw;
+
+pub type wchar_t = u16;
+
+pub type UINT = raw::c_uint;
+pub type LPUNKNOWN = *mut IUnknown;
+pub type REFIID = *const IID;
+pub type IID = GUID;
+pub type REFCLSID = *const IID;
+pub type PVOID = *mut raw::c_void;
+pub type USHORT = raw::c_ushort;
+pub type ULONG = raw::c_ulong;
+pub type LONG = raw::c_long;
+pub type DWORD = u32;
+pub type LPVOID = *mut raw::c_void;
+pub type HRESULT = raw::c_long;
+pub type LPFILETIME = *mut FILETIME;
+pub type BSTR = *mut OLECHAR;
+pub type OLECHAR = WCHAR;
+pub type WCHAR = wchar_t;
+pub type LPCOLESTR = *const OLECHAR;
+pub type LCID = DWORD;
+pub type LPCWSTR = *const WCHAR;
+pub type PULONGLONG = *mut ULONGLONG;
+pub type ULONGLONG = u64;
+
+pub const S_OK: HRESULT = 0;
+pub const S_FALSE: HRESULT = 1;
+pub const COINIT_MULTITHREADED: u32 = 0x0;
+
+pub type CLSCTX = u32;
+
+pub const CLSCTX_INPROC_SERVER: CLSCTX = 0x1;
+pub const CLSCTX_INPROC_HANDLER: CLSCTX = 0x2;
+pub const CLSCTX_LOCAL_SERVER: CLSCTX = 0x4;
+pub const CLSCTX_REMOTE_SERVER: CLSCTX = 0x10;
+
+pub const CLSCTX_ALL: CLSCTX = CLSCTX_INPROC_SERVER |
+    CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER;
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct GUID {
+    pub Data1: raw::c_ulong,
+    pub Data2: raw::c_ushort,
+    pub Data3: raw::c_ushort,
+    pub Data4: [raw::c_uchar; 8],
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct FILETIME {
+    pub dwLowDateTime: DWORD,
+    pub dwHighDateTime: DWORD,
+}
+
+pub trait Interface {
+    fn uuidof() -> GUID;
+}
+
+#[link(name = "Ole32")]
+#[link(name = "OleAut32")]
+extern { }
+
+extern "system" {
+    pub fn CoInitializeEx(pvReserved: LPVOID, dwCoInit: DWORD) -> HRESULT;
+    pub fn CoCreateInstance(rclsid: REFCLSID, pUnkOuter: LPUNKNOWN,
+                            dwClsContext: DWORD, riid: REFIID,
+                            ppv: *mut LPVOID) -> HRESULT;
+    pub fn SysFreeString(bstrString: BSTR);
+    pub fn SysStringLen(pbstr: BSTR) -> UINT;
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct SAFEARRAYBOUND {
+    pub cElements: ULONG,
+    pub lLbound: LONG,
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct SAFEARRAY {
+    pub cDims: USHORT,
+    pub fFeatures: USHORT,
+    pub cbElements: ULONG,
+    pub cLocks: ULONG,
+    pub pvData: PVOID,
+    pub rgsabound: [SAFEARRAYBOUND; 1],
+}
+
+pub type LPSAFEARRAY = *mut SAFEARRAY;
+
+macro_rules! DEFINE_GUID {
+    (
+        $name:ident, $l:expr, $w1:expr, $w2:expr,
+        $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, $b6:expr, $b7:expr, $b8:expr
+    ) => {
+        pub const $name: $crate::winapi::GUID = $crate::winapi::GUID {
+            Data1: $l,
+            Data2: $w1,
+            Data3: $w2,
+            Data4: [$b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8],
+        };
+    }
+}
+
+macro_rules! RIDL {
+    (#[uuid($($uuid:expr),+)]
+    interface $interface:ident ($vtbl:ident) {$(
+        fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty,
+    )+}) => (
+        #[repr(C)]
+        pub struct $vtbl {
+            $(pub $method: unsafe extern "system" fn(
+                This: *mut $interface,
+                $($p: $t),*
+            ) -> $rtr,)+
+        }
+        #[repr(C)]
+        pub struct $interface {
+            pub lpVtbl: *const $vtbl,
+        }
+        RIDL!{@impl $interface {$(fn $method($($p: $t,)*) -> $rtr,)+}}
+        RIDL!{@uuid $interface $($uuid),+}
+    );
+    (#[uuid($($uuid:expr),+)]
+    interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) {
+    }) => (
+        #[repr(C)]
+        pub struct $vtbl {
+            pub parent: $pvtbl,
+        }
+        #[repr(C)]
+        pub struct $interface {
+            pub lpVtbl: *const $vtbl,
+        }
+        RIDL!{@deref $interface $pinterface}
+        RIDL!{@uuid $interface $($uuid),+}
+    );
+    (#[uuid($($uuid:expr),+)]
+    interface $interface:ident ($vtbl:ident) : $pinterface:ident ($pvtbl:ident) {$(
+        fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty,
+    )+}) => (
+        #[repr(C)]
+        pub struct $vtbl {
+            pub parent: $pvtbl,
+            $(pub $method: unsafe extern "system" fn(
+                This: *mut $interface,
+                $($p: $t,)*
+            ) -> $rtr,)+
+        }
+        #[repr(C)]
+        pub struct $interface {
+            pub lpVtbl: *const $vtbl,
+        }
+        RIDL!{@impl $interface {$(fn $method($($p: $t,)*) -> $rtr,)+}}
+        RIDL!{@deref $interface $pinterface}
+        RIDL!{@uuid $interface $($uuid),+}
+    );
+    (@deref $interface:ident $pinterface:ident) => (
+        impl ::std::ops::Deref for $interface {
+            type Target = $pinterface;
+            #[inline]
+            fn deref(&self) -> &$pinterface {
+                unsafe { &*(self as *const $interface as *const $pinterface) }
+            }
+        }
+    );
+    (@impl $interface:ident {$(
+        fn $method:ident($($p:ident : $t:ty,)*) -> $rtr:ty,
+    )+}) => (
+        impl $interface {
+            $(#[inline] pub unsafe fn $method(&self, $($p: $t,)*) -> $rtr {
+                ((*self.lpVtbl).$method)(self as *const _ as *mut _, $($p,)*)
+            })+
+        }
+    );
+    (@uuid $interface:ident
+        $l:expr, $w1:expr, $w2:expr,
+        $b1:expr, $b2:expr, $b3:expr, $b4:expr, $b5:expr, $b6:expr, $b7:expr, $b8:expr
+    ) => (
+        impl $crate::winapi::Interface for $interface {
+            #[inline]
+            fn uuidof() -> $crate::winapi::GUID {
+                $crate::winapi::GUID {
+                    Data1: $l,
+                    Data2: $w1,
+                    Data3: $w2,
+                    Data4: [$b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8],
+                }
+            }
+        }
+    );
+}
+
+RIDL!{#[uuid(0x00000000, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)]
+interface IUnknown(IUnknownVtbl) {
+    fn QueryInterface(
+        riid: REFIID,
+        ppvObject: *mut *mut raw::c_void,
+    ) -> HRESULT,
+    fn AddRef() -> ULONG,
+    fn Release() -> ULONG,
+}}
copy from third_party/rust/gcc/src/windows_registry.rs
copy to third_party/rust/gcc-0.3.51/src/windows_registry.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gcc-0.3.51/tests/cc_env.rs
@@ -0,0 +1,49 @@
+extern crate tempdir;
+extern crate gcc;
+
+use std::env;
+
+mod support;
+use support::Test;
+
+#[test]
+fn main() {
+    ccache();
+    distcc();
+    ccache_spaces();
+}
+
+fn ccache() {
+    let test = Test::gnu();
+    test.shim("ccache");
+
+    env::set_var("CC", "ccache lol-this-is-not-a-compiler foo");
+    test.gcc().file("foo.c").compile("libfoo.a");
+
+    test.cmd(0)
+        .must_have("lol-this-is-not-a-compiler foo")
+        .must_have("foo.c")
+        .must_not_have("ccache");
+}
+
+fn ccache_spaces() {
+    let test = Test::gnu();
+    test.shim("ccache");
+
+    env::set_var("CC", "ccache        lol-this-is-not-a-compiler foo");
+    test.gcc().file("foo.c").compile("libfoo.a");
+    test.cmd(0).must_have("lol-this-is-not-a-compiler foo");
+}
+
+fn distcc() {
+    let test = Test::gnu();
+    test.shim("distcc");
+
+    env::set_var("CC", "distcc lol-this-is-not-a-compiler foo");
+    test.gcc().file("foo.c").compile("libfoo.a");
+
+    test.cmd(0)
+        .must_have("lol-this-is-not-a-compiler foo")
+        .must_have("foo.c")
+        .must_not_have("distcc");
+}
copy from third_party/rust/gcc/tests/support/mod.rs
copy to third_party/rust/gcc-0.3.51/tests/support/mod.rs
copy from third_party/rust/gcc/tests/test.rs
copy to third_party/rust/gcc-0.3.51/tests/test.rs
--- a/third_party/rust/gcc/.cargo-checksum.json
+++ b/third_party/rust/gcc/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"6ce870c5fe92cc982b64a0301241c2b911f3864a0cca53277ce0697b9a91810b","Cargo.toml":"16170865c061907d466ef8d0d772450a706e81dbdb99a6c5031f1531869b7899","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"b1a639560fd536f2c3ab708a8e1066b675edd4d018dfa4e5e18d0d7327d81c15","appveyor.yml":"46c77d913eaa45871296942c2cd96ef092c9dcaf19201cb5c500a5107faeb06f","src/bin/gcc-shim.rs":"d6be9137cb48b86891e7b263adbf492e1193ffe682db9ba4a88eb1079b874b58","src/com.rs":"0cb06f5db0fb70d27db0e5917ca337de6e7032119e6aabfea1bad9c719f5f34b","src/lib.rs":"d6a022eba51292e379c0ec092dfa2a931e2aa2dd3b5348740c61419a12676dd0","src/registry.rs":"3876ef9573e3bbc050aef41a684b9a510cc1a91b15ae874fe032cf4377b4d116","src/setup_config.rs":"1a3eeb11c6847c31f2a4685b62ab35c76f0b6d5a17f7ed99e9df164283a771f7","src/winapi.rs":"b8240086866595c57bc562bbf423e44fd5a286c9f25bbff8694fe4631e918518","src/windows_registry.rs":"54a4c024213dde0e0df4ed2e9e54fb4f4d72dbdc64a18cdab4c483adaf4aaeea","tests/cc_env.rs":"d92c5e3d3d43ac244e63b2cd2c93a521fcf124bf1ccf8d4c6bfa7f8333d88976","tests/support/mod.rs":"56bcfd1e2ff5ae8e581c71229444a3d96094bf689808808dd80e315bd6632083","tests/test.rs":"c1cbdff76d5912aa47732aed77aa845e989807ca3c84af3423b4c25232c72237"},"package":"120d07f202dcc3f72859422563522b66fe6463a4c513df062874daad05f85f0a"}
\ No newline at end of file
+{"files":{".travis.yml":"276069d13bb9d23f12fc0f8250fe43903a524b3694397f874eb586c34528aa86","Cargo.toml":"7bba6913f7e50e9c66287643efc57d7843a18a628a56b4b06b364d577dd073ec","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"08c52530369790b6ac0c1044a938246a3d585ef4d2827649743e055dc3caa7b3","appveyor.yml":"ef04ec11eba1462746866e02e0f5336cc50b337f61884b6d2547253ddfd0b957","src/bin/gcc-shim.rs":"d6be9137cb48b86891e7b263adbf492e1193ffe682db9ba4a88eb1079b874b58","src/com.rs":"0cb06f5db0fb70d27db0e5917ca337de6e7032119e6aabfea1bad9c719f5f34b","src/lib.rs":"51ae483baaf26049fe3d7631ae37e5d975d553c6494f181c272e5e00d4f8cf6c","src/registry.rs":"3876ef9573e3bbc050aef41a684b9a510cc1a91b15ae874fe032cf4377b4d116","src/setup_config.rs":"1a3eeb11c6847c31f2a4685b62ab35c76f0b6d5a17f7ed99e9df164283a771f7","src/winapi.rs":"b8240086866595c57bc562bbf423e44fd5a286c9f25bbff8694fe4631e918518","src/windows_registry.rs":"6de548aa94215e449f0e58e9a3b1702939d7c2f7b63a9040901c948bf138201d","tests/cc_env.rs":"d92c5e3d3d43ac244e63b2cd2c93a521fcf124bf1ccf8d4c6bfa7f8333d88976","tests/support/mod.rs":"7225766a18166855da16f71b444ee9fb93031c668b524fadf16ccab91137aa2a","tests/test.rs":"cdf94399d9e2aa746cc98056acda31a3652096ef5c19ab294cfe3a1e7c3d1870"},"package":"e8310f7e9c890398b0e80e301c4f474e9918d2b27fca8f48486ca775fa9ffc5a"}
\ No newline at end of file
--- a/third_party/rust/gcc/.travis.yml
+++ b/third_party/rust/gcc/.travis.yml
@@ -1,17 +1,17 @@
 language: rust
 rust:
   - stable
   - beta
   - nightly
 matrix:
   include:
     # Minimum version supported
-    - rust: 1.6.0
+    - rust: 1.13.0
       install:
       script: cargo build
 
 sudo: false
 install:
   - if [ "$TRAVIS_OS_NAME" = "linux" ]; then OS=unknown-linux-gnu; else OS=apple-darwin; fi
   - export TARGET=$ARCH-$OS
   - if [ -z "$NO_ADD" ]; then rustup target add $TARGET; fi
--- a/third_party/rust/gcc/Cargo.toml
+++ b/third_party/rust/gcc/Cargo.toml
@@ -1,27 +1,36 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
-
 name = "gcc"
-version = "0.3.51"
+version = "0.3.53"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
+description = "A build-time dependency for Cargo build scripts to assist in invoking the native\nC compiler to compile native C code into a static archive to be linked into Rust\ncode.\n"
+documentation = "https://docs.rs/gcc"
+readme = "README.md"
+keywords = ["build-dependencies"]
+categories = ["development-tools"]
 license = "MIT/Apache-2.0"
 repository = "https://github.com/alexcrichton/gcc-rs"
-documentation = "https://docs.rs/gcc"
-description = """
-A build-time dependency for Cargo build scripts to assist in invoking the native
-C compiler to compile native C code into a static archive to be linked into Rust
-code.
-"""
-keywords = ["build-dependencies"]
-
-[badges]
-travis-ci = { repository = "alexcrichton/gcc-rs" }
-appveyor = { repository = "alexcrichton/gcc-rs" }
-
-[dependencies]
-rayon = { version = "0.7", optional = true }
+[dependencies.rayon]
+version = "0.8"
+optional = true
+[dev-dependencies.tempdir]
+version = "0.3"
 
 [features]
 parallel = ["rayon"]
+[badges.travis-ci]
+repository = "alexcrichton/gcc-rs"
 
-[dev-dependencies]
-tempdir = "0.3"
+[badges.appveyor]
+repository = "alexcrichton/gcc-rs"
--- a/third_party/rust/gcc/README.md
+++ b/third_party/rust/gcc/README.md
@@ -30,23 +30,27 @@ gcc = "0.3"
 Next up, you'll want to write a build script like so:
 
 ```rust,no_run
 // build.rs
 
 extern crate gcc;
 
 fn main() {
-    gcc::compile_library("libfoo.a", &["foo.c", "bar.c"]);
+    gcc::Build::new()
+        .file("foo.c")
+        .file("bar.c")
+        .compile("foo");
 }
 ```
 
 And that's it! Running `cargo build` should take care of the rest and your Rust
-application will now have the C files `foo.c` and `bar.c` compiled into it. You
-can call the functions in Rust by declaring functions in your Rust code like so:
+application will now have the C files `foo.c` and `bar.c` compiled into a file
+named libfoo.a. You can call the functions in Rust by declaring functions in
+your Rust code like so:
 
 ```
 extern {
     fn foo_function();
     fn bar_function();
 }
 
 pub fn call() {
@@ -132,23 +136,23 @@ required varies per platform, but there 
   rustc. GCC from older [MinGW](http://www.mingw.org) project is compatible
   only with 32-bit rust compiler.
 
 [msys2-help]: http://github.com/rust-lang/rust#building-on-windows
 
 ## C++ support
 
 `gcc-rs` supports C++ libraries compilation by using the `cpp` method on
-`Config`:
+`Build`:
 
 ```rust,no_run
 extern crate gcc;
 
 fn main() {
-    gcc::Config::new()
+    gcc::Build::new()
         .cpp(true) // Switch to C++ library compilation.
         .file("foo.cpp")
         .compile("libfoo.a");
 }
 ```
 
 When using C++ library compilation switch, the `CXX` and `CXXFLAGS` env
 variables are used instead of `CC` and `CFLAGS` and the C++ standard library is
--- a/third_party/rust/gcc/appveyor.yml
+++ b/third_party/rust/gcc/appveyor.yml
@@ -1,9 +1,29 @@
 environment:
+
+  # At the time this was added AppVeyor was having troubles with checking
+  # revocation of SSL certificates of sites like static.rust-lang.org and what
+  # we think is crates.io. The libcurl HTTP client by default checks for
+  # revocation on Windows and according to a mailing list [1] this can be
+  # disabled.
+  #
+  # The `CARGO_HTTP_CHECK_REVOKE` env var here tells cargo to disable SSL
+  # revocation checking on Windows in libcurl. Note, though, that rustup, which
+  # we're using to download Rust here, also uses libcurl as the default backend.
+  # Unlike Cargo, however, rustup doesn't have a mechanism to disable revocation
+  # checking. To get rustup working we set `RUSTUP_USE_HYPER` which forces it to
+  # use the Hyper instead of libcurl backend. Both Hyper and libcurl use
+  # schannel on Windows but it appears that Hyper configures it slightly
+  # differently such that revocation checking isn't turned on by default.
+  #
+  # [1]: https://curl.haxx.se/mail/lib-2016-03/0202.html
+  RUSTUP_USE_HYPER: 1
+  CARGO_HTTP_CHECK_REVOKE: false
+
   matrix:
   - TARGET: x86_64-pc-windows-msvc
     ARCH: amd64
     VS: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
   - TARGET: x86_64-pc-windows-msvc
     ARCH: amd64
     VS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
   - TARGET: i686-pc-windows-msvc
--- a/third_party/rust/gcc/src/lib.rs
+++ b/third_party/rust/gcc/src/lib.rs
@@ -5,45 +5,40 @@
 //!
 //! ```toml
 //! [build-dependencies]
 //! gcc = "0.3"
 //! ```
 //!
 //! The purpose of this crate is to provide the utility functions necessary to
 //! compile C code into a static archive which is then linked into a Rust crate.
-//! The top-level `compile_library` function serves as a convenience and more
-//! advanced configuration is available through the `Config` builder.
+//! Configuration is available through the `Build` struct.
 //!
 //! This crate will automatically detect situations such as cross compilation or
 //! other environment variables set by Cargo and will build code appropriately.
 //!
+//! The crate is not limited to C code, it can accept any source code that can
+//! be passed to a C or C++ compiler. As such, assembly files with extensions
+//! `.s` (gcc/clang) and `.asm` (MSVC) can also be compiled.
+//!
+//! [`Build`]: struct.Build.html
+//!
 //! # Examples
 //!
-//! Use the default configuration:
+//! Use the `Build` struct to compile `src/foo.c`:
 //!
 //! ```no_run
 //! extern crate gcc;
 //!
 //! fn main() {
-//!     gcc::compile_library("libfoo.a", &["src/foo.c"]);
-//! }
-//! ```
-//!
-//! Use more advanced configuration:
-//!
-//! ```no_run
-//! extern crate gcc;
-//!
-//! fn main() {
-//!     gcc::Config::new()
-//!                 .file("src/foo.c")
-//!                 .define("FOO", Some("bar"))
-//!                 .include("src")
-//!                 .compile("libfoo.a");
+//!     gcc::Build::new()
+//!                .file("src/foo.c")
+//!                .define("FOO", Some("bar"))
+//!                .include("src")
+//!                .compile("foo");
 //! }
 //! ```
 
 #![doc(html_root_url = "https://docs.rs/gcc/0.3")]
 #![cfg_attr(test, deny(warnings))]
 #![deny(missing_docs)]
 
 #[cfg(feature = "parallel")]
@@ -52,32 +47,40 @@ extern crate rayon;
 use std::env;
 use std::ffi::{OsString, OsStr};
 use std::fs;
 use std::path::{PathBuf, Path};
 use std::process::{Command, Stdio, Child};
 use std::io::{self, BufReader, BufRead, Read, Write};
 use std::thread::{self, JoinHandle};
 
+#[doc(hidden)]
+#[deprecated(since="0.3.51", note="gcc::Config has been renamed to gcc::Build")]
+pub type Config = Build;
+
+#[cfg(feature = "parallel")]
+use std::sync::Mutex;
+
 // These modules are all glue to support reading the MSVC version from
 // the registry and from COM interfaces
 #[cfg(windows)]
 mod registry;
 #[cfg(windows)]
 #[macro_use]
 mod winapi;
 #[cfg(windows)]
 mod com;
 #[cfg(windows)]
 mod setup_config;
 
 pub mod windows_registry;
 
 /// Extra configuration to pass to gcc.
-pub struct Config {
+#[derive(Clone, Debug)]
+pub struct Build {
     include_directories: Vec<PathBuf>,
     definitions: Vec<(String, Option<String>)>,
     objects: Vec<PathBuf>,
     flags: Vec<String>,
     files: Vec<PathBuf>,
     cpp: bool,
     cpp_link_stdlib: Option<Option<String>>,
     cpp_set_stdlib: Option<String>,
@@ -89,25 +92,65 @@ pub struct Config {
     env: Vec<(OsString, OsString)>,
     compiler: Option<PathBuf>,
     archiver: Option<PathBuf>,
     cargo_metadata: bool,
     pic: Option<bool>,
     static_crt: Option<bool>,
     shared_flag: Option<bool>,
     static_flag: Option<bool>,
+    check_file_created: bool,
+    warnings_into_errors: bool,
+    warnings: bool,
+}
+
+/// Represents the types of errors that may occur while using gcc-rs.
+#[derive(Clone, Debug)]
+enum ErrorKind {
+    /// Error occurred while performing I/O.
+    IOError,
+    /// Invalid architecture supplied.
+    ArchitectureInvalid,
+    /// Environment variable not found, with the var in question as extra info.
+    EnvVarNotFound,
+    /// Error occurred while using external tools (ie: invocation of compiler).
+    ToolExecError,
+    /// Error occurred due to missing external tools.
+    ToolNotFound,
+}
+
+/// Represents an internal error that occurred, with an explaination.
+#[derive(Clone, Debug)]
+pub struct Error {
+    /// Describes the kind of error that occurred.
+    kind: ErrorKind,
+    /// More explaination of error that occurred.
+    message: String,
+}
+
+impl Error {
+    fn new(kind: ErrorKind, message: &str) -> Error {
+        Error { kind: kind, message: message.to_owned() }
+    }
+}
+
+impl From<io::Error> for Error {
+    fn from(e: io::Error) -> Error {
+        Error::new(ErrorKind::IOError, &format!("{}", e))
+    }
 }
 
 /// Configuration used to represent an invocation of a C compiler.
 ///
 /// This can be used to figure out what compiler is in use, what the arguments
 /// to it are, and what the environment variables look like for the compiler.
 /// This can be used to further configure other build systems (e.g. forward
 /// along CC and/or CFLAGS) or the `to_command` method can be used to run the
 /// compiler itself.
+#[derive(Clone, Debug)]
 pub struct Tool {
     path: PathBuf,
     args: Vec<OsString>,
     env: Vec<(OsString, OsString)>,
     family: ToolFamily
 }
 
 /// Represents the family of tools this tool belongs to.
@@ -148,45 +191,70 @@ impl ToolFamily {
     /// What the flag to request macro-expanded source output looks like
     fn expand_flag(&self) -> &'static str {
         match *self {
             ToolFamily::Msvc => "/E",
             ToolFamily::Gnu |
             ToolFamily::Clang => "-E",
         }
     }
+
+    /// What the flags to enable all warnings
+    fn warnings_flags(&self) -> &'static [&'static str] {
+        static MSVC_FLAGS: &'static [&'static str] = &["/Wall"];
+        static GNU_CLANG_FLAGS: &'static [&'static str] = &["-Wall", "-Wextra"];
+
+        match *self {
+            ToolFamily::Msvc => &MSVC_FLAGS,
+            ToolFamily::Gnu |
+            ToolFamily::Clang => &GNU_CLANG_FLAGS,
+        }
+    }
+
+    /// What the flag to turn warning into errors
+    fn warnings_to_errors_flag(&self) -> &'static str {
+        match *self {
+            ToolFamily::Msvc => "/WX",
+            ToolFamily::Gnu |
+            ToolFamily::Clang => "-Werror"
+        }
+    }
 }
 
 /// Compile a library from the given set of input C files.
 ///
 /// This will simply compile all files into object files and then assemble them
 /// into the output. This will read the standard environment variables to detect
 /// cross compilations and such.
 ///
 /// This function will also print all metadata on standard output for Cargo.
 ///
 /// # Example
 ///
 /// ```no_run
-/// gcc::compile_library("libfoo.a", &["foo.c", "bar.c"]);
+/// gcc::compile_library("foo", &["foo.c", "bar.c"]);
 /// ```
+#[deprecated]
+#[doc(hidden)]
 pub fn compile_library(output: &str, files: &[&str]) {
-    let mut c = Config::new();
+    let mut c = Build::new();
     for f in files.iter() {
         c.file(*f);
     }
     c.compile(output);
 }
 
-impl Config {
+impl Build {
     /// Construct a new instance of a blank set of configuration.
     ///
-    /// This builder is finished with the `compile` function.
-    pub fn new() -> Config {
-        Config {
+    /// This builder is finished with the [`compile`] function.
+    ///
+    /// [`compile`]: struct.Build.html#method.compile
+    pub fn new() -> Build {
+        Build {
             include_directories: Vec::new(),
             definitions: Vec::new(),
             objects: Vec::new(),
             flags: Vec::new(),
             files: Vec::new(),
             shared_flag: None,
             static_flag: None,
             cpp: false,
@@ -198,89 +266,260 @@ impl Config {
             opt_level: None,
             debug: None,
             env: Vec::new(),
             compiler: None,
             archiver: None,
             cargo_metadata: true,
             pic: None,
             static_crt: None,
+            check_file_created: false,
+            warnings: true,
+            warnings_into_errors: false,
         }
     }
 
     /// Add a directory to the `-I` or include path for headers
-    pub fn include<P: AsRef<Path>>(&mut self, dir: P) -> &mut Config {
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// use std::path::Path;
+    ///
+    /// let library_path = Path::new("/path/to/library");
+    ///
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .include(library_path)
+    ///            .include("src")
+    ///            .compile("foo");
+    /// ```
+    pub fn include<P: AsRef<Path>>(&mut self, dir: P) -> &mut Build {
         self.include_directories.push(dir.as_ref().to_path_buf());
         self
     }
 
     /// Specify a `-D` variable with an optional value.
-    pub fn define(&mut self, var: &str, val: Option<&str>) -> &mut Config {
-        self.definitions.push((var.to_string(), val.map(|s| s.to_string())));
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .define("FOO", "BAR")
+    ///            .define("BAZ", None)
+    ///            .compile("foo");
+    /// ```
+    pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) -> &mut Build {
+        self.definitions.push((var.to_string(), val.into().map(|s| s.to_string())));
         self
     }
 
     /// Add an arbitrary object file to link in
-    pub fn object<P: AsRef<Path>>(&mut self, obj: P) -> &mut Config {
+    pub fn object<P: AsRef<Path>>(&mut self, obj: P) -> &mut Build {
         self.objects.push(obj.as_ref().to_path_buf());
         self
     }
 
     /// Add an arbitrary flag to the invocation of the compiler
-    pub fn flag(&mut self, flag: &str) -> &mut Config {
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .flag("-ffunction-sections")
+    ///            .compile("foo");
+    /// ```
+    pub fn flag(&mut self, flag: &str) -> &mut Build {
         self.flags.push(flag.to_string());
         self
     }
 
+    fn is_flag_supported(&mut self, flag: &str) -> Result<bool, Error> {
+        let out_dir = self.get_out_dir()?;
+        let src = out_dir.join("flag_check.c");
+        if !self.check_file_created {
+            let mut f = fs::File::create(&src)?;
+            write!(f, "int main(void) {{ return 0; }}")?;
+            self.check_file_created = true;
+        }
+
+        let obj = out_dir.join("flag_check");
+        let target = self.get_target()?;
+        let mut cfg = Build::new();
+        cfg.flag(flag)
+           .target(&target)
+           .opt_level(0)
+           .host(&target)
+           .debug(false)
+           .cpp(self.cpp);
+        let compiler = cfg.try_get_compiler()?;
+        let mut cmd = compiler.to_command();
+        command_add_output_file(&mut cmd, &obj, target.contains("msvc"), false);
+        cmd.arg(&src);
+
+        let output = cmd.output()?;
+        Ok(output.stderr.is_empty())
+    }
+
+    /// Add an arbitrary flag to the invocation of the compiler if it supports it
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .flag_if_supported("-Wlogical-op") // only supported by GCC
+    ///            .flag_if_supported("-Wunreachable-code") // only supported by clang
+    ///            .compile("foo");
+    /// ```
+    pub fn flag_if_supported(&mut self, flag: &str) -> &mut Build {
+        if self.is_flag_supported(flag).unwrap_or(false) {
+            self.flag(flag)
+        } else {
+            self
+        }
+    }
+
     /// Set the `-shared` flag.
     ///
     /// When enabled, the compiler will produce a shared object which can
     /// then be linked with other objects to form an executable.
-    pub fn shared_flag(&mut self, shared_flag: bool) -> &mut Config {
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .shared_flag(true)
+    ///            .compile("libfoo.so");
+    /// ```
+
+    pub fn shared_flag(&mut self, shared_flag: bool) -> &mut Build {
         self.shared_flag = Some(shared_flag);
         self
     }
 
     /// Set the `-static` flag.
     ///
     /// When enabled on systems that support dynamic linking, this prevents
     /// linking with the shared libraries.
-    pub fn static_flag(&mut self, static_flag: bool) -> &mut Config {
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .shared_flag(true)
+    ///            .static_flag(true)
+    ///            .compile("foo");
+    /// ```
+    pub fn static_flag(&mut self, static_flag: bool) -> &mut Build {
         self.static_flag = Some(static_flag);
         self
     }
 
     /// Add a file which will be compiled
-    pub fn file<P: AsRef<Path>>(&mut self, p: P) -> &mut Config {
+    pub fn file<P: AsRef<Path>>(&mut self, p: P) -> &mut Build {
         self.files.push(p.as_ref().to_path_buf());
         self
     }
 
+    /// Add files which will be compiled
+    pub fn files<P>(&mut self, p: P) -> &mut Build
+        where P: IntoIterator,
+              P::Item: AsRef<Path> {
+        for file in p.into_iter() {
+            self.file(file);
+        }
+        self
+    }
+
     /// Set C++ support.
     ///
     /// The other `cpp_*` options will only become active if this is set to
     /// `true`.
-    pub fn cpp(&mut self, cpp: bool) -> &mut Config {
+    pub fn cpp(&mut self, cpp: bool) -> &mut Build {
         self.cpp = cpp;
         self
     }
 
+    /// Set warnings into errors flag.
+    ///
+    /// Disabled by default.
+    ///
+    /// Warning: turning warnings into errors only make sense
+    /// if you are a developer of the crate using gcc-rs.
+    /// Some warnings only appear on some architecture or
+    /// specific version of the compiler. Any user of this crate,
+    /// or any other crate depending on it, could fail during
+    /// compile time.
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .warnings_into_errors(true)
+    ///            .compile("libfoo.a");
+    /// ```
+    pub fn warnings_into_errors(&mut self, warnings_into_errors: bool) -> &mut Build {
+        self.warnings_into_errors = warnings_into_errors;
+        self
+    }
+
+    /// Set warnings flags.
+    ///
+    /// Adds some flags:
+    /// - "/Wall" for MSVC.
+    /// - "-Wall", "-Wextra" for GNU and Clang.
+    ///
+    /// Enabled by default.
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .warnings(false)
+    ///            .compile("libfoo.a");
+    /// ```
+    pub fn warnings(&mut self, warnings: bool) -> &mut Build {
+        self.warnings = warnings;
+        self
+    }
+
     /// Set the standard library to link against when compiling with C++
     /// support.
     ///
     /// The default value of this property depends on the current target: On
     /// OS X `Some("c++")` is used, when compiling for a Visual Studio based
     /// target `None` is used and for other targets `Some("stdc++")` is used.
     ///
     /// A value of `None` indicates that no automatic linking should happen,
     /// otherwise cargo will link against the specified library.
     ///
     /// The given library name must not contain the `lib` prefix.
-    pub fn cpp_link_stdlib(&mut self, cpp_link_stdlib: Option<&str>) -> &mut Config {
-        self.cpp_link_stdlib = Some(cpp_link_stdlib.map(|s| s.into()));
+    ///
+    /// Common values:
+    /// - `stdc++` for GNU
+    /// - `c++` for Clang
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .shared_flag(true)
+    ///            .cpp_link_stdlib("stdc++")
+    ///            .compile("libfoo.so");
+    /// ```
+    pub fn cpp_link_stdlib<'a, V: Into<Option<&'a str>>>(&mut self, cpp_link_stdlib: V) -> &mut Build {
+        self.cpp_link_stdlib = Some(cpp_link_stdlib.into().map(|s| s.into()));
         self
     }
 
     /// Force the C++ compiler to use the specified standard library.
     ///
     /// Setting this option will automatically set `cpp_link_stdlib` to the same
     /// value.
     ///
@@ -294,284 +533,395 @@ impl Config {
     /// detect which compiler is used, as such it is the responsibility of the
     /// caller to ensure that this option is only used in conjuction with a
     /// compiler which supports the `-stdlib` flag.
     ///
     /// A value of `None` indicates that no specific C++ standard library should
     /// be used, otherwise `-stdlib` is added to the compile invocation.
     ///
     /// The given library name must not contain the `lib` prefix.
-    pub fn cpp_set_stdlib(&mut self, cpp_set_stdlib: Option<&str>) -> &mut Config {
+    ///
+    /// Common values:
+    /// - `stdc++` for GNU
+    /// - `c++` for Clang
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .cpp_set_stdlib("c++")
+    ///            .compile("libfoo.a");
+    /// ```
+    pub fn cpp_set_stdlib<'a, V: Into<Option<&'a str>>>(&mut self, cpp_set_stdlib: V) -> &mut Build {
+        let cpp_set_stdlib = cpp_set_stdlib.into();
         self.cpp_set_stdlib = cpp_set_stdlib.map(|s| s.into());
         self.cpp_link_stdlib(cpp_set_stdlib);
         self
     }
 
     /// Configures the target this configuration will be compiling for.
     ///
     /// This option is automatically scraped from the `TARGET` environment
     /// variable by build scripts, so it's not required to call this function.
-    pub fn target(&mut self, target: &str) -> &mut Config {
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .target("aarch64-linux-android")
+    ///            .compile("foo");
+    /// ```
+    pub fn target(&mut self, target: &str) -> &mut Build {
         self.target = Some(target.to_string());
         self
     }
 
     /// Configures the host assumed by this configuration.
     ///
     /// This option is automatically scraped from the `HOST` environment
     /// variable by build scripts, so it's not required to call this function.
-    pub fn host(&mut self, host: &str) -> &mut Config {
+    ///
+    /// # Example
+    ///
+    /// ```no_run
+    /// gcc::Build::new()
+    ///            .file("src/foo.c")
+    ///            .host("arm-linux-gnueabihf")
+    ///            .compile("foo");
+    /// ```
+    pub fn host(&mut self, host: &str) -> &mut Build {
         self.host = Some(host.to_string());
         self
     }
 
     /// Configures the optimization level of the generated object files.
     ///
     /// This option is automatically scraped from the `OPT_LEVEL` environment
     /// variable by build scripts, so it's not required to call this function.
-    pub fn opt_level(&mut self, opt_level: u32) -> &mut Config {
+    pub fn opt_level(&mut self, opt_level: u32) -> &mut Build {
         self.opt_level = Some(opt_level.to_string());
         self
     }
 
     /// Configures the optimization level of the generated object files.
     ///
     /// This option is automatically scraped from the `OPT_LEVEL` environment
     /// variable by build scripts, so it's not required to call this function.
-    pub fn opt_level_str(&mut self, opt_level: &str) -> &mut Config {
+    pub fn opt_level_str(&mut self, opt_level: &str) -> &mut Build {
         self.opt_level = Some(opt_level.to_string());
         self
     }
 
     /// Configures whether the compiler will emit debug information when
     /// generating object files.
     ///
     /// This option is automatically scraped from the `PROFILE` environment
     /// variable by build scripts (only enabled when the profile is "debug"), so
     /// it's not required to call this function.
-    pub fn debug(&mut self, debug: bool) -> &mut Config {
+    pub fn debug(&mut self, debug: bool) -> &mut Build {
         self.debug = Some(debug);
         self
     }
 
     /// Configures the output directory where all object files and static
     /// libraries will be located.
     ///
     /// This option is automatically scraped from the `OUT_DIR` environment
     /// variable by build scripts, so it's not required to call this function.
-    pub fn out_dir<P: AsRef<Path>>(&mut self, out_dir: P) -> &mut Config {
+    pub fn out_dir<P: AsRef<Path>>(&mut self, out_dir: P) -> &mut Build {
         self.out_dir = Some(out_dir.as_ref().to_owned());
         self
     }
 
     /// Configures the compiler to be used to produce output.
     ///
     /// This option is automatically determined from the target platform or a
     /// number of environment variables, so it's not required to call this
     /// function.
-    pub fn compiler<P: AsRef<Path>>(&mut self, compiler: P) -> &mut Config {
+    pub fn compiler<P: AsRef<Path>>(&mut self, compiler: P) -> &mut Build {
         self.compiler = Some(compiler.as_ref().to_owned());
         self
     }
 
     /// Configures the tool used to assemble archives.
     ///
     /// This option is automatically determined from the target platform or a
     /// number of environment variables, so it's not required to call this
     /// function.
-    pub fn archiver<P: AsRef<Path>>(&mut self, archiver: P) -> &mut Config {
+    pub fn archiver<P: AsRef<Path>>(&mut self, archiver: P) -> &mut Build {
         self.archiver = Some(archiver.as_ref().to_owned());
         self
     }
     /// Define whether metadata should be emitted for cargo allowing it to
     /// automatically link the binary. Defaults to `true`.
-    pub fn cargo_metadata(&mut self, cargo_metadata: bool) -> &mut Config {
+    ///
+    /// The emitted metadata is:
+    ///
+    ///  - `rustc-link-lib=static=`*compiled lib*
+    ///  - `rustc-link-search=native=`*target folder*
+    ///  - When target is MSVC, the ATL-MFC libs are added via `rustc-link-search=native=`
+    ///  - When C++ is enabled, the C++ stdlib is added via `rustc-link-lib`
+    ///
+    pub fn cargo_metadata(&mut self, cargo_metadata: bool) -> &mut Build {
         self.cargo_metadata = cargo_metadata;
         self
     }
 
     /// Configures whether the compiler will emit position independent code.
     ///
     /// This option defaults to `false` for `windows-gnu` targets and
     /// to `true` for all other targets.
-    pub fn pic(&mut self, pic: bool) -> &mut Config {
+    pub fn pic(&mut self, pic: bool) -> &mut Build {
         self.pic = Some(pic);
         self
     }
 
     /// Configures whether the /MT flag or the /MD flag will be passed to msvc build tools.
     ///
     /// This option defaults to `false`, and affect only msvc targets.
-    pub fn static_crt(&mut self, static_crt: bool) -> &mut Config {
+    pub fn static_crt(&mut self, static_crt: bool) -> &mut Build {
         self.static_crt = Some(static_crt);
         self
     }
 
-
     #[doc(hidden)]
-    pub fn __set_env<A, B>(&mut self, a: A, b: B) -> &mut Config
+    pub fn __set_env<A, B>(&mut self, a: A, b: B) -> &mut Build
         where A: AsRef<OsStr>,
               B: AsRef<OsStr>
     {
         self.env.push((a.as_ref().to_owned(), b.as_ref().to_owned()));
         self
     }
 
     /// Run the compiler, generating the file `output`
     ///
-    /// The name `output` must begin with `lib` and end with `.a`
-    pub fn compile(&self, output: &str) {
-        assert!(output.starts_with("lib"));
-        assert!(output.ends_with(".a"));
-        let lib_name = &output[3..output.len() - 2];
-        let dst = self.get_out_dir();
+    /// This will return a result instead of panicing; see compile() for the complete description.
+    pub fn try_compile(&self, output: &str) -> Result<(), Error> {
+        let (lib_name, gnu_lib_name) = if output.starts_with("lib") && output.ends_with(".a") {
+                (&output[3..output.len() - 2], output.to_owned())
+            } else {
+                let mut gnu = String::with_capacity(5 + output.len());
+                gnu.push_str("lib");
+                gnu.push_str(&output);
+                gnu.push_str(".a");
+                (output, gnu)
+            };
+        let dst = self.get_out_dir()?;
 
         let mut objects = Vec::new();
         let mut src_dst = Vec::new();
         for file in self.files.iter() {
             let obj = dst.join(file).with_extension("o");
             let obj = if !obj.starts_with(&dst) {
-                dst.join(obj.file_name().unwrap())
+                dst.join(obj.file_name().ok_or_else(|| Error::new(ErrorKind::IOError, "Getting object file details failed."))?)
             } else {
                 obj
             };
-            fs::create_dir_all(&obj.parent().unwrap()).unwrap();
+
+            match obj.parent() {
+                Some(s) => fs::create_dir_all(s)?,
+                None => return Err(Error::new(ErrorKind::IOError, "Getting object file details failed.")),
+            };
+
             src_dst.push((file.to_path_buf(), obj.clone()));
             objects.push(obj);
         }
-        self.compile_objects(&src_dst);
-        self.assemble(lib_name, &dst.join(output), &objects);
+        self.compile_objects(&src_dst)?;
+        self.assemble(lib_name, &dst.join(gnu_lib_name), &objects)?;
 
-        if self.get_target().contains("msvc") {
-            let compiler = self.get_base_compiler();
+        if self.get_target()?.contains("msvc") {
+            let compiler = self.get_base_compiler()?;
             let atlmfc_lib = compiler.env()
                 .iter()
                 .find(|&&(ref var, _)| var.as_os_str() == OsStr::new("LIB"))
                 .and_then(|&(_, ref lib_paths)| {
                     env::split_paths(lib_paths).find(|path| {
                         let sub = Path::new("atlmfc/lib");
                         path.ends_with(sub) || path.parent().map_or(false, |p| p.ends_with(sub))
                     })
                 });
 
             if let Some(atlmfc_lib) = atlmfc_lib {
                 self.print(&format!("cargo:rustc-link-search=native={}", atlmfc_lib.display()));
             }
         }
 
-        self.print(&format!("cargo:rustc-link-lib=static={}",
-                            &output[3..output.len() - 2]));
+        self.print(&format!("cargo:rustc-link-lib=static={}", lib_name));
         self.print(&format!("cargo:rustc-link-search=native={}", dst.display()));
 
         // Add specific C++ libraries, if enabled.
         if self.cpp {
-            if let Some(stdlib) = self.get_cpp_link_stdlib() {
+            if let Some(stdlib) = self.get_cpp_link_stdlib()? {
                 self.print(&format!("cargo:rustc-link-lib={}", stdlib));
             }
         }
+
+        Ok(())
+    }
+
+    /// Run the compiler, generating the file `output`
+    ///
+    /// The name `output` should be the name of the library.  For backwards compatibility,
+    /// the `output` may start with `lib` and end with `.a`.  The Rust compilier will create
+    /// the assembly with the lib prefix and .a extension.  MSVC will create a file without prefix,
+    /// ending with `.lib`.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `output` is not formatted correctly or if one of the underlying
+    /// compiler commands fails. It can also panic if it fails reading file names
+    /// or creating directories.
+    pub fn compile(&self, output: &str) {
+        if let Err(e) = self.try_compile(output) {
+            fail(&e.message);
+        }
     }
 
     #[cfg(feature = "parallel")]
-    fn compile_objects(&self, objs: &[(PathBuf, PathBuf)]) {
+    fn compile_objects(&self, objs: &[(PathBuf, PathBuf)]) -> Result<(), Error> {
         use self::rayon::prelude::*;
 
         let mut cfg = rayon::Configuration::new();
         if let Ok(amt) = env::var("NUM_JOBS") {
             if let Ok(amt) = amt.parse() {
                 cfg = cfg.num_threads(amt);
             }
         }
         drop(rayon::initialize(cfg));
 
+        let results: Mutex<Vec<Result<(), Error>>> = Mutex::new(Vec::new());
+
         objs.par_iter().with_max_len(1)
-            .for_each(|&(ref src, ref dst)| self.compile_object(src, dst));
+            .for_each(|&(ref src, ref dst)| results.lock().unwrap().push(self.compile_object(src, dst)));
+
+        // Check for any errors and return the first one found.
+        for result in results.into_inner().unwrap().iter() {
+            if result.is_err() {
+                return result.clone();
+            }
+        }
+
+        Ok(())
     }
 
     #[cfg(not(feature = "parallel"))]
-    fn compile_objects(&self, objs: &[(PathBuf, PathBuf)]) {
+    fn compile_objects(&self, objs: &[(PathBuf, PathBuf)]) -> Result<(), Error> {
         for &(ref src, ref dst) in objs {
-            self.compile_object(src, dst);
+            self.compile_object(src, dst)?;
         }
+        Ok(())
     }
 
-    fn compile_object(&self, file: &Path, dst: &Path) {
+    fn compile_object(&self, file: &Path, dst: &Path) -> Result<(), Error> {
         let is_asm = file.extension().and_then(|s| s.to_str()) == Some("asm");
-        let msvc = self.get_target().contains("msvc");
+        let msvc = self.get_target()?.contains("msvc");
         let (mut cmd, name) = if msvc && is_asm {
-            self.msvc_macro_assembler()
+            self.msvc_macro_assembler()?
         } else {
-            let compiler = self.get_compiler();
+            let compiler = self.try_get_compiler()?;
             let mut cmd = compiler.to_command();
             for &(ref a, ref b) in self.env.iter() {
                 cmd.env(a, b);
             }
             (cmd,
              compiler.path
                  .file_name()
-                 .unwrap()
+                 .ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get compiler path."))?
                  .to_string_lossy()
                  .into_owned())
         };
-        if msvc && is_asm {
-            cmd.arg("/Fo").arg(dst);
-        } else if msvc {
-            let mut s = OsString::from("/Fo");
-            s.push(&dst);
-            cmd.arg(s);
-        } else {
-            cmd.arg("-o").arg(&dst);
-        }
+        command_add_output_file(&mut cmd, dst, msvc, is_asm);
         cmd.arg(if msvc { "/c" } else { "-c" });
         cmd.arg(file);
 
-        run(&mut cmd, &name);
+        run(&mut cmd, &name)?;
+        Ok(())
     }
 
-    /// Run the compiler, returning the macro-expanded version of the input files.
-    ///
-    /// This is only relevant for C and C++ files.
-    pub fn expand(&self) -> Vec<u8> {
-        let compiler = self.get_compiler();
+    /// This will return a result instead of panicing; see expand() for the complete description.
+    pub fn try_expand(&self) -> Result<Vec<u8>, Error> {
+        let compiler = self.try_get_compiler()?;
         let mut cmd = compiler.to_command();
         for &(ref a, ref b) in self.env.iter() {
             cmd.env(a, b);
         }
         cmd.arg(compiler.family.expand_flag());
+
+        assert!(self.files.len() <= 1,
+                "Expand may only be called for a single file");
+
         for file in self.files.iter() {
             cmd.arg(file);
         }
 
         let name = compiler.path
             .file_name()
-            .unwrap()
+            .ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get compiler path."))?
             .to_string_lossy()
             .into_owned();
 
-        run_output(&mut cmd, &name)
+        Ok(run_output(&mut cmd, &name)?)
+    }
+
+    /// Run the compiler, returning the macro-expanded version of the input files.
+    ///
+    /// This is only relevant for C and C++ files.
+    ///
+    /// # Panics
+    /// Panics if more than one file is present in the config, or if compiler
+    /// path has an invalid file name.
+    ///
+    /// # Example
+    /// ```no_run
+    /// let out = gcc::Build::new()
+    ///                       .file("src/foo.c")
+    ///                       .expand();
+    /// ```
+    pub fn expand(&self) -> Vec<u8> {
+        match self.try_expand() {
+            Err(e) => fail(&e.message),
+            Ok(v) => v,
+        }
     }
 
     /// Get the compiler that's in use for this configuration.
     ///
     /// This function will return a `Tool` which represents the culmination
     /// of this configuration at a snapshot in time. The returned compiler can
     /// be inspected (e.g. the path, arguments, environment) to forward along to
     /// other tools, or the `to_command` method can be used to invoke the
     /// compiler itself.
     ///
     /// This method will take into account all configuration such as debug
     /// information, optimization level, include directories, defines, etc.
     /// Additionally, the compiler binary in use follows the standard
     /// conventions for this path, e.g. looking at the explicitly set compiler,
     /// environment variables (a number of which are inspected here), and then
     /// falling back to the default configuration.
+    ///
+    /// # Panics
+    ///
+    /// Panics if an error occurred while determining the architecture.
     pub fn get_compiler(&self) -> Tool {
-        let opt_level = self.get_opt_level();
-        let target = self.get_target();
+        match self.try_get_compiler() {
+            Ok(tool) => tool,
+            Err(e) => fail(&e.message),
+        }
+    }
 
-        let mut cmd = self.get_base_compiler();
+    /// Get the compiler that's in use for this configuration.
+    ///
+    /// This will return a result instead of panicing; see get_compiler() for the complete description.
+    pub fn try_get_compiler(&self) -> Result<Tool, Error> {
+        let opt_level = self.get_opt_level()?;
+        let target = self.get_target()?;
+
+        let mut cmd = self.get_base_compiler()?;
         let nvcc = cmd.path.file_name()
             .and_then(|p| p.to_str()).map(|p| p.contains("nvcc"))
             .unwrap_or(false);
 
         // Non-target flags
         // If the flag is not conditioned on target variable, it belongs here :)
         match cmd.family {
             ToolFamily::Msvc => {
@@ -597,17 +947,24 @@ impl Config {
                     "1" => cmd.args.push("/O1".into()),
                     // -O3 is a valid value for gcc and clang compilers, but not msvc. Cap to /O2.
                     "2" | "3" => cmd.args.push("/O2".into()),
                     _ => {}
                 }
             }
             ToolFamily::Gnu |
             ToolFamily::Clang => {
-                cmd.args.push(format!("-O{}", opt_level).into());
+                // arm-linux-androideabi-gcc 4.8 shipped with Android NDK does
+                // not support '-Oz'
+                if target.contains("android") && opt_level == "z" {
+                    cmd.args.push("-Os".into());
+                } else {
+                    cmd.args.push(format!("-O{}", opt_level).into());
+                }
+
                 if !nvcc {
                     cmd.args.push("-ffunction-sections".into());
                     cmd.args.push("-fdata-sections".into());
                     if self.pic.unwrap_or(!target.contains("windows-gnu")) {
                         cmd.args.push("-fPIC".into());
                     }
                 } else if self.pic.unwrap_or(false) {
                     cmd.args.push("-Xcompiler".into());
@@ -712,17 +1069,17 @@ impl Config {
                     cmd.args.push("-march=armv7-m".into());
                 }
             }
         }
 
         if target.contains("-ios") {
             // FIXME: potential bug. iOS is always compiled with Clang, but Gcc compiler may be
             // detected instead.
-            self.ios_flags(&mut cmd);
+            self.ios_flags(&mut cmd)?;
         }
 
         if self.static_flag.unwrap_or(false) {
             cmd.args.push("-static".into());
         }
         if self.shared_flag.unwrap_or(false) {
             cmd.args.push("-shared".into());
         }
@@ -753,21 +1110,32 @@ impl Config {
         for &(ref key, ref value) in self.definitions.iter() {
             let lead = if let ToolFamily::Msvc = cmd.family {"/"} else {"-"};
             if let Some(ref value) = *value {
                 cmd.args.push(format!("{}D{}={}", lead, key, value).into());
             } else {
                 cmd.args.push(format!("{}D{}", lead, key).into());
             }
         }
-        cmd
+
+        if self.warnings {
+            for flag in cmd.family.warnings_flags().iter() {
+                cmd.args.push(flag.into());
+            }
+        }
+
+        if self.warnings_into_errors {
+            cmd.args.push(cmd.family.warnings_to_errors_flag().into());
+        }
+
+        Ok(cmd)
     }
 
-    fn msvc_macro_assembler(&self) -> (Command, String) {
-        let target = self.get_target();
+    fn msvc_macro_assembler(&self) -> Result<(Command, String), Error> {
+        let target = self.get_target()?;
         let tool = if target.contains("x86_64") {
             "ml64.exe"
         } else {
             "ml.exe"
         };
         let mut cmd = windows_registry::find(&target, tool).unwrap_or_else(|| self.cmd(tool));
         for directory in self.include_directories.iter() {
             cmd.arg("/I").arg(directory);
@@ -782,76 +1150,82 @@ impl Config {
 
         if target.contains("i686") || target.contains("i586") {
             cmd.arg("/safeseh");
         }
         for flag in self.flags.iter() {
             cmd.arg(flag);
         }
 
-        (cmd, tool.to_string())
+        Ok((cmd, tool.to_string()))
     }
 
-    fn assemble(&self, lib_name: &str, dst: &Path, objects: &[PathBuf]) {
+    fn assemble(&self, lib_name: &str, dst: &Path, objects: &[PathBuf]) -> Result<(), Error> {
         // Delete the destination if it exists as the `ar` tool at least on Unix
         // appends to it, which we don't want.
         let _ = fs::remove_file(&dst);
 
-        let target = self.get_target();
+        let target = self.get_target()?;
         if target.contains("msvc") {
             let mut cmd = match self.archiver {
                 Some(ref s) => self.cmd(s),
                 None => windows_registry::find(&target, "lib.exe").unwrap_or_else(|| self.cmd("lib.exe")),
             };
             let mut out = OsString::from("/OUT:");
             out.push(dst);
             run(cmd.arg(out)
                     .arg("/nologo")
                     .args(objects)
                     .args(&self.objects),
-                "lib.exe");
+                "lib.exe")?;
 
             // The Rust compiler will look for libfoo.a and foo.lib, but the
             // MSVC linker will also be passed foo.lib, so be sure that both
             // exist for now.
             let lib_dst = dst.with_file_name(format!("{}.lib", lib_name));
             let _ = fs::remove_file(&lib_dst);
-            fs::hard_link(&dst, &lib_dst)
+            match fs::hard_link(&dst, &lib_dst)
                 .or_else(|_| {
                     // if hard-link fails, just copy (ignoring the number of bytes written)
                     fs::copy(&dst, &lib_dst).map(|_| ())
-                })
-                .expect("Copying from {:?} to {:?} failed.");;
+                }) {
+                Ok(_) => (),
+                Err(_) => return Err(Error::new(ErrorKind::IOError, "Could not copy or create a hard-link to the generated lib file.")),
+            };
         } else {
-            let ar = self.get_ar();
-            let cmd = ar.file_name().unwrap().to_string_lossy();
+            let ar = self.get_ar()?;
+            let cmd = ar.file_name()
+                .ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get archiver (ar) path."))?
+                .to_string_lossy();
             run(self.cmd(&ar)
                     .arg("crs")
                     .arg(dst)
                     .args(objects)
                     .args(&self.objects),
-                &cmd);
+                &cmd)?;
         }
+
+        Ok(())
     }
 
-    fn ios_flags(&self, cmd: &mut Tool) {
+    fn ios_flags(&self, cmd: &mut Tool) -> Result<(), Error> {
         enum ArchSpec {
             Device(&'static str),
             Simulator(&'static str),
         }
 
-        let target = self.get_target();
-        let arch = target.split('-').nth(0).unwrap();
+        let target = self.get_target()?;
+        let arch = target.split('-').nth(0).ok_or_else(|| Error::new(ErrorKind::ArchitectureInvalid, "Unknown architecture for iOS target."))?;
         let arch = match arch {
             "arm" | "armv7" | "thumbv7" => ArchSpec::Device("armv7"),
             "armv7s" | "thumbv7s" => ArchSpec::Device("armv7s"),
             "arm64" | "aarch64" => ArchSpec::Device("arm64"),
             "i386" | "i686" => ArchSpec::Simulator("-m32"),
             "x86_64" => ArchSpec::Simulator("-m64"),
-            _ => fail("Unknown arch for iOS target"),
+            _ => return Err(Error::new(ErrorKind::ArchitectureInvalid, "Unknown architecture for iOS target.")),
         };
 
         let sdk = match arch {
             ArchSpec::Device(arch) => {
                 cmd.args.push("-arch".into());
                 cmd.args.push(arch.into());
                 cmd.args.push("-miphoneos-version-min=7.0".into());
                 "iphoneos"
@@ -864,56 +1238,60 @@ impl Config {
         };
 
         self.print(&format!("Detecting iOS SDK path for {}", sdk));
         let sdk_path = self.cmd("xcrun")
             .arg("--show-sdk-path")
             .arg("--sdk")
             .arg(sdk)
             .stderr(Stdio::inherit())
-            .output()
-            .unwrap()
+            .output()?
             .stdout;
 
-        let sdk_path = String::from_utf8(sdk_path).unwrap();
+        let sdk_path = match String::from_utf8(sdk_path) {
+            Ok(p) => p,
+            Err(_) => return Err(Error::new(ErrorKind::IOError, "Unable to determine iOS SDK path.")),
+        };
 
         cmd.args.push("-isysroot".into());
         cmd.args.push(sdk_path.trim().into());
+
+        Ok(())
     }
 
     fn cmd<P: AsRef<OsStr>>(&self, prog: P) -> Command {
         let mut cmd = Command::new(prog);
         for &(ref a, ref b) in self.env.iter() {
             cmd.env(a, b);
         }
         cmd
     }
 
-    fn get_base_compiler(&self) -> Tool {
+    fn get_base_compiler(&self) -> Result<Tool, Error> {
         if let Some(ref c) = self.compiler {
-            return Tool::new(c.clone());
+            return Ok(Tool::new(c.clone()));
         }
-        let host = self.get_host();
-        let target = self.get_target();
+        let host = self.get_host()?;
+        let target = self.get_target()?;
         let (env, msvc, gnu) = if self.cpp {
             ("CXX", "cl.exe", "g++")
         } else {
             ("CC", "cl.exe", "gcc")
         };
 
         let default = if host.contains("solaris") {
             // In this case, c++/cc unlikely to exist or be correct.
             gnu
         } else if self.cpp {
             "c++"
         } else {
             "cc"
         };
 
-        self.env_tool(env)
+        let tool_opt: Option<Tool> = self.env_tool(env)
             .map(|(tool, args)| {
                 let mut t = Tool::new(PathBuf::from(tool));
                 for arg in args {
                     t.args.push(arg.into());
                 }
                 t
             })
             .or_else(|| {
@@ -933,27 +1311,30 @@ impl Config {
                         }
                     };
 
                     Some(Tool::new(PathBuf::from(tool)))
                 } else {
                     None
                 }
             })
-            .or_else(|| windows_registry::find_tool(&target, "cl.exe"))
-            .unwrap_or_else(|| {
+            .or_else(|| windows_registry::find_tool(&target, "cl.exe"));
+
+        let tool = match tool_opt {
+            Some(t) => t,
+            None => {
                 let compiler = if host.contains("windows") && target.contains("windows") {
                     if target.contains("msvc") {
                         msvc.to_string()
                     } else {
                         format!("{}.exe", gnu)
                     }
                 } else if target.contains("android") {
                     format!("{}-{}", target.replace("armv7", "arm"), gnu)
-                } else if self.get_host() != target {
+                } else if self.get_host()? != target {
                     // CROSS_COMPILE is of the form: "arm-linux-gnueabi-"
                     let cc_env = self.getenv("CROSS_COMPILE");
                     let cross_compile = cc_env.as_ref().map(|s| s.trim_right_matches('-'));
                     let prefix = cross_compile.or(match &target[..] {
                         "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"),
                         "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
                         "arm-frc-linux-gnueabi" => Some("arm-frc-linux-gnueabi"),
                         "arm-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"),
@@ -991,32 +1372,35 @@ impl Config {
                     match prefix {
                         Some(prefix) => format!("{}-{}", prefix, gnu),
                         None => default.to_string(),
                     }
                 } else {
                     default.to_string()
                 };
                 Tool::new(PathBuf::from(compiler))
-            })
+            }
+        };
+
+        Ok(tool)
     }
 
-    fn get_var(&self, var_base: &str) -> Result<String, String> {
-        let target = self.get_target();
-        let host = self.get_host();
+    fn get_var(&self, var_base: &str) -> Result<String, Error> {
+        let target = self.get_target()?;
+        let host = self.get_host()?;
         let kind = if host == target { "HOST" } else { "TARGET" };
         let target_u = target.replace("-", "_");
         let res = self.getenv(&format!("{}_{}", var_base, target))
             .or_else(|| self.getenv(&format!("{}_{}", var_base, target_u)))
             .or_else(|| self.getenv(&format!("{}_{}", kind, var_base)))
             .or_else(|| self.getenv(var_base));
 
         match res {
             Some(res) => Ok(res),
-            None => Err("could not get environment variable".to_string()),
+            None => Err(Error::new(ErrorKind::EnvVarNotFound, &format!("Could not find environment variable {}.", var_base))),
         }
     }
 
     fn envflags(&self, name: &str) -> Vec<String> {
         self.get_var(name)
             .unwrap_or(String::new())
             .split(|c: char| c.is_whitespace())
             .filter(|s| !s.is_empty())
@@ -1033,93 +1417,123 @@ impl Config {
                 }
             }
             (tool, Vec::new())
         })
     }
 
     /// Returns the default C++ standard library for the current target: `libc++`
     /// for OS X and `libstdc++` for anything else.
-    fn get_cpp_link_stdlib(&self) -> Option<String> {
-        self.cpp_link_stdlib.clone().unwrap_or_else(|| {
-            let target = self.get_target();
-            if target.contains("msvc") {
-                None
-            } else if target.contains("darwin") {
-                Some("c++".to_string())
-            } else if target.contains("freebsd") {
-                Some("c++".to_string())
-            } else {
-                Some("stdc++".to_string())
+    fn get_cpp_link_stdlib(&self) -> Result<Option<String>, Error> {
+        match self.cpp_link_stdlib.clone() {
+            Some(s) => Ok(s),
+            None => {
+                let target = self.get_target()?;
+                if target.contains("msvc") {
+                    Ok(None)
+                } else if target.contains("darwin") {
+                    Ok(Some("c++".to_string()))
+                } else if target.contains("freebsd") {
+                    Ok(Some("c++".to_string()))
+                } else {
+                    Ok(Some("stdc++".to_string()))
+                }
+            },
+        }
+    }
+
+    fn get_ar(&self) -> Result<PathBuf, Error> {
+        match self.archiver
+            .clone()
+            .or_else(|| self.get_var("AR").map(PathBuf::from).ok()) {
+                Some(p) => Ok(p),
+                None => {
+                    if self.get_target()?.contains("android") {
+                        Ok(PathBuf::from(format!("{}-ar", self.get_target()?.replace("armv7", "arm"))))
+                    } else if self.get_target()?.contains("emscripten") {
+                        //Windows use bat files so we have to be a bit more specific
+                        let tool = if cfg!(windows) {
+                            "emar.bat"
+                        } else {
+                            "emar"
+                        };
+
+                        Ok(PathBuf::from(tool))
+                    } else {
+                        Ok(PathBuf::from("ar"))
+                    }
+                }
+            }
+    }
+
+    fn get_target(&self) -> Result<String, Error> {
+        match self.target.clone() {
+            Some(t) => Ok(t),
+            None => Ok(self.getenv_unwrap("TARGET")?),
+        }
+    }
+
+    fn get_host(&self) -> Result<String, Error> {
+        match self.host.clone() {
+            Some(h) => Ok(h),
+            None => Ok(self.getenv_unwrap("HOST")?),
+        }
+    }
+
+    fn get_opt_level(&self) -> Result<String, Error> {
+        match self.opt_level.as_ref().cloned() {
+            Some(ol) => Ok(ol),
+            None => Ok(self.getenv_unwrap("OPT_LEVEL")?),
+        }
+    }
+
+    fn get_debug(&self) -> bool {
+        self.debug.unwrap_or_else(|| {
+            match self.getenv("DEBUG") {
+                Some(s) => s != "false",
+                None => false,
             }
         })
     }
 
-    fn get_ar(&self) -> PathBuf {
-        self.archiver
-            .clone()
-            .or_else(|| self.get_var("AR").map(PathBuf::from).ok())
-            .unwrap_or_else(|| {
-                if self.get_target().contains("android") {
-                    PathBuf::from(format!("{}-ar", self.get_target().replace("armv7", "arm")))
-                } else if self.get_target().contains("emscripten") {
-                    //Windows use bat files so we have to be a bit more specific
-                    let tool = if cfg!(windows) {
-                        "emar.bat"
-                    } else {
-                        "emar"
-                    };
-
-                    PathBuf::from(tool)
-                } else {
-                    PathBuf::from("ar")
-                }
-            })
-    }
-
-    fn get_target(&self) -> String {
-        self.target.clone().unwrap_or_else(|| self.getenv_unwrap("TARGET"))
-    }
-
-    fn get_host(&self) -> String {
-        self.host.clone().unwrap_or_else(|| self.getenv_unwrap("HOST"))
-    }
-
-    fn get_opt_level(&self) -> String {
-        self.opt_level.as_ref().cloned().unwrap_or_else(|| self.getenv_unwrap("OPT_LEVEL"))
-    }
-
-    fn get_debug(&self) -> bool {
-        self.debug.unwrap_or_else(|| self.getenv_unwrap("PROFILE") == "debug")
-    }
-
-    fn get_out_dir(&self) -> PathBuf {
-        self.out_dir.clone().unwrap_or_else(|| env::var_os("OUT_DIR").map(PathBuf::from).unwrap())
+    fn get_out_dir(&self) -> Result<PathBuf, Error> {
+        match self.out_dir.clone() {
+            Some(p) => Ok(p),
+            None => Ok(env::var_os("OUT_DIR")
+                .map(PathBuf::from)
+                .ok_or_else(|| Error::new(ErrorKind::EnvVarNotFound, "Environment variable OUT_DIR not defined."))?),
+        }
     }
 
     fn getenv(&self, v: &str) -> Option<String> {
         let r = env::var(v).ok();
         self.print(&format!("{} = {:?}", v, r));
         r
     }
 
-    fn getenv_unwrap(&self, v: &str) -> String {
+    fn getenv_unwrap(&self, v: &str) -> Result<String, Error> {
         match self.getenv(v) {
-            Some(s) => s,
-            None => fail(&format!("environment variable `{}` not defined", v)),
+            Some(s) => Ok(s),
+            None => Err(Error::new(ErrorKind::EnvVarNotFound, &format!("Environment variable {} not defined.", v.to_string()))),
         }
     }
 
     fn print(&self, s: &str) {
         if self.cargo_metadata {
             println!("{}", s);
         }
     }
 }
 
+impl Default for Build {
+    fn default() -> Build {
+        Build::new()
+    }
+}
+
 impl Tool {
     fn new(path: PathBuf) -> Tool {
         // Try to detect family of the tool from its name, falling back to Gnu.
         let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
             if fname.contains("clang") {
                 ToolFamily::Clang
             } else if fname.contains("cl") && !fname.contains("uclibc") {
                 ToolFamily::Msvc
@@ -1169,72 +1583,91 @@ impl Tool {
     /// operate.
     ///
     /// This is typically only used for MSVC compilers currently.
     pub fn env(&self) -> &[(OsString, OsString)] {
         &self.env
     }
 }
 
-fn run(cmd: &mut Command, program: &str) {
-    let (mut child, print) = spawn(cmd, program);
-    let status = child.wait().expect("failed to wait on child process");
+fn run(cmd: &mut Command, program: &str) -> Result<(), Error> {
+    let (mut child, print) = spawn(cmd, program)?;
+    let status = match child.wait() {
+        Ok(s) => s,
+        Err(_) => return Err(Error::new(ErrorKind::ToolExecError, &format!("Failed to wait on spawned child process, command {:?} with args {:?}.", cmd, program))),
+    };
     print.join().unwrap();
     println!("{}", status);
-    if !status.success() {
-        fail(&format!("command did not execute successfully, got: {}", status));
+
+    if status.success() {
+        Ok(())
+    } else {
+        Err(Error::new(ErrorKind::ToolExecError, &format!("Command {:?} with args {:?} did not execute successfully (status code {}).", cmd, program, status)))
     }
 }
 
-fn run_output(cmd: &mut Command, program: &str) -> Vec<u8> {
+fn run_output(cmd: &mut Command, program: &str) -> Result<Vec<u8>, Error> {
     cmd.stdout(Stdio::piped());
-    let (mut child, print) = spawn(cmd, program);
+    let (mut child, print) = spawn(cmd, program)?;
     let mut stdout = vec![];
     child.stdout.take().unwrap().read_to_end(&mut stdout).unwrap();
-    let status = child.wait().expect("failed to wait on child process");
+    let status = match child.wait() {
+        Ok(s) => s,
+        Err(_) => return Err(Error::new(ErrorKind::ToolExecError, &format!("Failed to wait on spawned child process, command {:?} with args {:?}.", cmd, program))),
+    };
     print.join().unwrap();
     println!("{}", status);
-    if !status.success() {
-        fail(&format!("command did not execute successfully, got: {}", status));
+
+    if status.success() {
+        Ok(stdout)
+    } else {
+        Err(Error::new(ErrorKind::ToolExecError, &format!("Command {:?} with args {:?} did not execute successfully (status code {}).", cmd, program, status)))
     }
-    stdout
 }
 
-fn spawn(cmd: &mut Command, program: &str) -> (Child, JoinHandle<()>) {
+fn spawn(cmd: &mut Command, program: &str) -> Result<(Child, JoinHandle<()>), Error> {
     println!("running: {:?}", cmd);
 
     // Capture the standard error coming from these programs, and write it out
     // with cargo:warning= prefixes. Note that this is a bit wonky to avoid
     // requiring the output to be UTF-8, we instead just ship bytes from one
     // location to another.
     match cmd.stderr(Stdio::piped()).spawn() {
         Ok(mut child) => {
             let stderr = BufReader::new(child.stderr.take().unwrap());
             let print = thread::spawn(move || {
                 for line in stderr.split(b'\n').filter_map(|l| l.ok()) {
                     print!("cargo:warning=");
                     std::io::stdout().write_all(&line).unwrap();
                     println!("");
                 }
             });
-            (child, print)
+            Ok((child, print))
         }
         Err(ref e) if e.kind() == io::ErrorKind::NotFound => {
             let extra = if cfg!(windows) {
                 " (see https://github.com/alexcrichton/gcc-rs#compile-time-requirements \
                    for help)"
             } else {
                 ""
             };
-            fail(&format!("failed to execute command: {}\nIs `{}` \
-                           not installed?{}",
-                          e,
-                          program,
-                          extra));
+            Err(Error::new(ErrorKind::ToolNotFound, &format!("Failed to find tool. Is `{}` installed?{}", program, extra)))
         }
-        Err(e) => fail(&format!("failed to execute command: {}", e)),
+        Err(_) => Err(Error::new(ErrorKind::ToolExecError, &format!("Command {:?} with args {:?} failed to start.", cmd, program))),
     }
 }
 
 fn fail(s: &str) -> ! {
-    println!("\n\n{}\n\n", s);
-    panic!()
+    panic!("\n\nInternal error occurred: {}\n\n", s)
 }
+
+
+fn command_add_output_file(cmd: &mut Command, dst: &Path, msvc: bool, is_asm: bool) {
+    if msvc && is_asm {
+        cmd.arg("/Fo").arg(dst);
+    } else if msvc {
+        let mut s = OsString::from("/Fo");
+        s.push(&dst);
+        cmd.arg(s);
+    } else {
+        cmd.arg("-o").arg(&dst);
+    }
+}
--- a/third_party/rust/gcc/src/windows_registry.rs
+++ b/third_party/rust/gcc/src/windows_registry.rs
@@ -82,16 +82,17 @@ pub fn find_tool(target: &str, tool: &st
 
     return impl_::find_msvc_15(tool, target)
         .or_else(|| impl_::find_msvc_14(tool, target))
         .or_else(|| impl_::find_msvc_12(tool, target))
         .or_else(|| impl_::find_msvc_11(tool, target));
 }
 
 /// A version of Visual Studio
+#[derive(Debug, PartialEq, Eq, Copy, Clone)]
 pub enum VsVers {
     /// Visual Studio 12 (2013)
     Vs12,
     /// Visual Studio 14 (2015)
     Vs14,
     /// Visual Studio 15 (2017)
     Vs15,
 
--- a/third_party/rust/gcc/tests/support/mod.rs
+++ b/third_party/rust/gcc/tests/support/mod.rs
@@ -50,18 +50,18 @@ impl Test {
     pub fn shim(&self, name: &str) -> &Test {
         let fname = format!("{}{}", name, env::consts::EXE_SUFFIX);
         fs::hard_link(&self.gcc, self.td.path().join(&fname))
             .or_else(|_| fs::copy(&self.gcc, self.td.path().join(&fname)).map(|_| ()))
             .unwrap();
         self
     }
 
-    pub fn gcc(&self) -> gcc::Config {
-        let mut cfg = gcc::Config::new();
+    pub fn gcc(&self) -> gcc::Build {
+        let mut cfg = gcc::Build::new();
         let mut path = env::split_paths(&env::var_os("PATH").unwrap()).collect::<Vec<_>>();
         path.insert(0, self.td.path().to_owned());
         let target = if self.msvc {
             "x86_64-pc-windows-msvc"
         } else {
             "x86_64-unknown-linux-gnu"
         };
 
--- a/third_party/rust/gcc/tests/test.rs
+++ b/third_party/rust/gcc/tests/test.rs
@@ -5,17 +5,17 @@ use support::Test;
 
 mod support;
 
 #[test]
 fn gnu_smoke() {
     let test = Test::gnu();
     test.gcc()
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0)
         .must_have("-O2")
         .must_have("foo.c")
         .must_not_have("-g")
         .must_have("-c")
         .must_have("-ffunction-sections")
         .must_have("-fdata-sections");
@@ -23,59 +23,82 @@ fn gnu_smoke() {
 }
 
 #[test]
 fn gnu_opt_level_1() {
     let test = Test::gnu();
     test.gcc()
         .opt_level(1)
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0)
         .must_have("-O1")
         .must_not_have("-O2");
 }
 
 #[test]
 fn gnu_opt_level_s() {
     let test = Test::gnu();
     test.gcc()
         .opt_level_str("s")
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0)
         .must_have("-Os")
         .must_not_have("-O1")
         .must_not_have("-O2")
         .must_not_have("-O3")
         .must_not_have("-Oz");
 }
 
 #[test]
 fn gnu_debug() {
     let test = Test::gnu();
     test.gcc()
         .debug(true)
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
     test.cmd(0).must_have("-g");
 }
 
 #[test]
+fn gnu_warnings_into_errors() {
+    let test = Test::gnu();
+    test.gcc()
+        .warnings_into_errors(true)
+        .file("foo.c")
+        .compile("foo");
+
+    test.cmd(0).must_have("-Werror");
+}
+
+#[test]
+fn gnu_warnings() {
+    let test = Test::gnu();
+    test.gcc()
+        .warnings(true)
+        .file("foo.c")
+        .compile("foo");
+
+    test.cmd(0).must_have("-Wall")
+               .must_have("-Wextra");
+}
+
+#[test]
 fn gnu_x86_64() {
     for vendor in &["unknown-linux-gnu", "apple-darwin"] {
         let target = format!("x86_64-{}", vendor);
         let test = Test::gnu();
         test.gcc()
             .target(&target)
             .host(&target)
             .file("foo.c")
-            .compile("libfoo.a");
+            .compile("foo");
 
         test.cmd(0)
             .must_have("-fPIC")
             .must_have("-m64");
     }
 }
 
 #[test]
@@ -83,198 +106,215 @@ fn gnu_x86_64_no_pic() {
     for vendor in &["unknown-linux-gnu", "apple-darwin"] {
         let target = format!("x86_64-{}", vendor);
         let test = Test::gnu();
         test.gcc()
             .pic(false)
             .target(&target)
             .host(&target)
             .file("foo.c")
-            .compile("libfoo.a");
+            .compile("foo");
 
         test.cmd(0).must_not_have("-fPIC");
     }
 }
 
 #[test]
 fn gnu_i686() {
     for vendor in &["unknown-linux-gnu", "apple-darwin"] {
         let target = format!("i686-{}", vendor);
         let test = Test::gnu();
         test.gcc()
             .target(&target)
             .host(&target)
             .file("foo.c")
-            .compile("libfoo.a");
+            .compile("foo");
 
         test.cmd(0)
             .must_have("-m32");
     }
 }
 
 #[test]
 fn gnu_i686_pic() {
     for vendor in &["unknown-linux-gnu", "apple-darwin"] {
         let target = format!("i686-{}", vendor);
         let test = Test::gnu();
         test.gcc()
             .pic(true)
             .target(&target)
             .host(&target)
             .file("foo.c")
-            .compile("libfoo.a");
+            .compile("foo");
 
         test.cmd(0).must_have("-fPIC");
     }
 }
 
 #[test]
 fn gnu_set_stdlib() {
     let test = Test::gnu();
     test.gcc()
         .cpp_set_stdlib(Some("foo"))
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0).must_not_have("-stdlib=foo");
 }
 
 #[test]
 fn gnu_include() {
     let test = Test::gnu();
     test.gcc()
         .include("foo/bar")
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0).must_have("-I").must_have("foo/bar");
 }
 
 #[test]
 fn gnu_define() {
     let test = Test::gnu();
     test.gcc()
-        .define("FOO", Some("bar"))
+        .define("FOO", "bar")
         .define("BAR", None)
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0).must_have("-DFOO=bar").must_have("-DBAR");
 }
 
 #[test]
 fn gnu_compile_assembly() {
     let test = Test::gnu();
     test.gcc()
         .file("foo.S")
-        .compile("libfoo.a");
+        .compile("foo");
     test.cmd(0).must_have("foo.S");
 }
 
 #[test]
 fn gnu_shared() {
     let test = Test::gnu();
     test.gcc()
         .file("foo.c")
         .shared_flag(true)
         .static_flag(false)
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0)
         .must_have("-shared")
         .must_not_have("-static");
 }
 
 #[test]
+fn gnu_flag_if_supported() {
+    if cfg!(windows) {
+        return
+    }
+    let test = Test::gnu();
+    test.gcc()
+        .file("foo.c")
+        .flag_if_supported("-Wall")
+        .flag_if_supported("-Wflag-does-not-exist")
+        .compile("foo");
+
+    test.cmd(0)
+        .must_have("-Wall")
+        .must_not_have("-Wflag-does-not-exist");
+}
+
+#[test]
 fn gnu_static() {
     let test = Test::gnu();
     test.gcc()
         .file("foo.c")
         .shared_flag(false)
         .static_flag(true)
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0)
         .must_have("-static")
         .must_not_have("-shared");
 }
 
 #[test]
 fn msvc_smoke() {
     let test = Test::msvc();
     test.gcc()
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0)
         .must_have("/O2")
         .must_have("foo.c")
         .must_not_have("/Z7")
         .must_have("/c")
         .must_have("/MD");
     test.cmd(1).must_have(test.td.path().join("foo.o"));
 }
 
 #[test]
 fn msvc_opt_level_0() {
     let test = Test::msvc();
     test.gcc()
         .opt_level(0)
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0).must_not_have("/O2");
 }
 
 #[test]
 fn msvc_debug() {
     let test = Test::msvc();
     test.gcc()
         .debug(true)
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
     test.cmd(0).must_have("/Z7");
 }
 
 #[test]
 fn msvc_include() {
     let test = Test::msvc();
     test.gcc()
         .include("foo/bar")
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0).must_have("/I").must_have("foo/bar");
 }
 
 #[test]
 fn msvc_define() {
     let test = Test::msvc();
     test.gcc()
-        .define("FOO", Some("bar"))
+        .define("FOO", "bar")
         .define("BAR", None)
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0).must_have("/DFOO=bar").must_have("/DBAR");
 }
 
 #[test]
 fn msvc_static_crt() {
     let test = Test::msvc();
     test.gcc()
         .static_crt(true)
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0).must_have("/MT");
 }
 
 #[test]
 fn msvc_no_static_crt() {
     let test = Test::msvc();
     test.gcc()
         .static_crt(false)
         .file("foo.c")
-        .compile("libfoo.a");
+        .compile("foo");
 
     test.cmd(0).must_have("/MD");
 }
copy from third_party/rust/httparse/.cargo-checksum.json
copy to third_party/rust/httparse-1.2.2/.cargo-checksum.json
copy from third_party/rust/httparse/.travis.yml
copy to third_party/rust/httparse-1.2.2/.travis.yml
copy from third_party/rust/httparse/.travis_after.sh
copy to third_party/rust/httparse-1.2.2/.travis_after.sh
copy from third_party/rust/httparse/Cargo.toml
copy to third_party/rust/httparse-1.2.2/Cargo.toml
copy from third_party/rust/httparse/LICENSE-APACHE
copy to third_party/rust/httparse-1.2.2/LICENSE-APACHE
copy from third_party/rust/httparse/LICENSE-MIT
copy to third_party/rust/httparse-1.2.2/LICENSE-MIT
copy from third_party/rust/httparse/README.md
copy to third_party/rust/httparse-1.2.2/README.md
copy from third_party/rust/httparse/benches/parse.rs
copy to third_party/rust/httparse-1.2.2/benches/parse.rs
copy from third_party/rust/httparse/src/iter.rs
copy to third_party/rust/httparse-1.2.2/src/iter.rs
copy from third_party/rust/httparse/src/lib.rs
copy to third_party/rust/httparse-1.2.2/src/lib.rs
--- a/third_party/rust/httparse/.cargo-checksum.json
+++ b/third_party/rust/httparse/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"be18ed6efd3eb179681f340007aaaa2a2fdbe859dee2088268306ca771662f82",".travis_after.sh":"8a2b7facdb728db96f856211101a6ec70d08e8a6c97e2b88b95aacc6e9d43633","Cargo.toml":"8decbc46cc24226324027edebbfa878a887f2cacb2a9b4c9e9cde101a26d05b4","LICENSE-APACHE":"7cfd738c53d61c79f07e348f622bf7707c9084237054d37fbe07788a75f5881c","LICENSE-MIT":"1bc1057abd72f06decbd02da13037adbe5e8f92a719c5032e34ac52aa0f9e62f","README.md":"0d390941cb326a4a5baf06d930285192b5a98e2967e6dec2826acd593fa9bab3","benches/parse.rs":"a4927e4c379e8859b18b40c019655f2b75c3c75977eab066586a5fedee5d6b94","src/iter.rs":"e018f14fbcdcc501218737e2bfb3c44163e42f024756a5de74e9b3ed63c64fcc","src/lib.rs":"4bdb2eaf6e47468ddce4cda0d66440a31294fb6b5fc7dd0d06c032c1281c9624"},"package":"77f756bed9ee3a83ce98774f4155b42a31b787029013f3a7d83eca714e500e21"}
\ No newline at end of file
+{"files":{".travis.yml":"a4625910a2bd490f87b3f8403b92b2b75cd6ca9a0640eb8a8e1e5bf8995ca6be",".travis_after.sh":"c720bd9bc4cf6920c3b6e7798db7243f25f3203124e83e2baa39bcea66f04b8f","Cargo.toml":"ce89721483a37a5e21e4c7c8bd36b64a03067c23b3c6a9569e552a2a0364522e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"ad5ce29918424008bdd8c6e7851bb064533456cbb32ec0d0955b2bc9444613d3","README.md":"8777517c90cff609e5a00a46b548f44803a4943cc7430a0ca6ddc4712af8d4ac","benches/parse.rs":"07f7d63b625090f1ccb086679e24c104de450d8733bb517e38a6eda8511e35e3","src/iter.rs":"9782faa1736e7988feceecdd5169f51b8b7926cbcf6611bbef9e018763e3cec8","src/lib.rs":"d95d4de02b19f2f921e13f0f477092d202fe0e707dc007b9bbd05282d7e69ebc"},"package":"af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07"}
\ No newline at end of file
--- a/third_party/rust/httparse/.travis.yml
+++ b/third_party/rust/httparse/.travis.yml
@@ -1,35 +1,35 @@
-language: rust
-rust:
-  - stable
-  - beta
-  - nightly
-
-sudo: false
-
-cache:
-  apt: true
-  directories:
-    - target/debug/deps
-    - target/debug/build
-
-script:
-  - cargo build --verbose
-  - cargo test --verbose
-  - cargo build --verbose --no-default-features
-  - cargo test --verbose --no-default-features
-
-notifications:
-  email: false
-
-addons:
-  apt:
-    packages:
-      - libcurl4-openssl-dev
-      - libelf-dev
-      - libdw-dev
-
-after_success: ./.travis_after.sh
-
-env:
-  global:
-    secure: VhNfac39x05yr7aAwvg973wdaFxFfg0PqApgHIKyilq0aNDacpPi94sSEjSw1Qan9R6SaAH5nXj6xMst18sCw9DCLZzXr7cboun6Zd+O4eB9Kna5veXASpIa9KH/GMZvILfDFTXnIbLDpvzzEuSS5tWIUu7elikmoZhOXXP82B4=
+language: rust
+rust:
+  - stable
+  - beta
+  - nightly
+
+sudo: false
+
+cache:
+  apt: true
+  directories:
+    - target/debug/deps
+    - target/debug/build
+
+script:
+  - cargo build --verbose
+  - cargo test --verbose
+  - cargo build --verbose --no-default-features
+  - cargo test --verbose --no-default-features
+
+notifications:
+  email: false
+
+addons:
+  apt:
+    packages:
+      - libcurl4-openssl-dev
+      - libelf-dev
+      - libdw-dev
+
+after_success: ./.travis_after.sh
+
+env:
+  global:
+    secure: VhNfac39x05yr7aAwvg973wdaFxFfg0PqApgHIKyilq0aNDacpPi94sSEjSw1Qan9R6SaAH5nXj6xMst18sCw9DCLZzXr7cboun6Zd+O4eB9Kna5veXASpIa9KH/GMZvILfDFTXnIbLDpvzzEuSS5tWIUu7elikmoZhOXXP82B4=
old mode 100644
new mode 100755
--- a/third_party/rust/httparse/.travis_after.sh
+++ b/third_party/rust/httparse/.travis_after.sh
@@ -1,16 +1,16 @@
-#!/bin/bash
-set -ev
-if [[ $TRAVIS_RUST_VERSION = stable ]]; then
-  wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
-  tar xzf master.tar.gz
-  mkdir kcov-master/build
-  cd kcov-master/build
-  cmake ..
-  make
-  make install DESTDIR=../tmp
-  cd ../..
-  ls target/debug
-  ./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov target/debug/httparse-*
-fi
-
-
+#!/bin/bash
+set -ev
+if [[ $TRAVIS_RUST_VERSION = stable ]]; then
+  wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
+  tar xzf master.tar.gz
+  mkdir kcov-master/build
+  cd kcov-master/build
+  cmake ..
+  make
+  make install DESTDIR=../tmp
+  cd ../..
+  ls target/debug
+  ./kcov-master/tmp/usr/local/bin/kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov target/debug/httparse-*
+fi
+
+
--- a/third_party/rust/httparse/Cargo.toml
+++ b/third_party/rust/httparse/Cargo.toml
@@ -1,20 +1,29 @@
-[package]
-
-name = "httparse"
-version = "1.2.2"
-authors = ["Sean McArthur <sean.monstar@gmail.com>"]
-license = "MIT/Apache-2.0"
-description = "A tiny, safe, speedy, zero-copy HTTP/1.x parser."
-repository = "https://github.com/seanmonstar/httparse"
-
-[features]
-default = ["std"]
-std = []
-
-[dev-dependencies]
-pico-sys = "0.0"
-
-[profile.bench]
-lto = true
-codegen-units = 1
-opt-level = 3
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "httparse"
+version = "1.2.3"
+authors = ["Sean McArthur <sean.monstar@gmail.com>"]
+description = "A tiny, safe, speedy, zero-copy HTTP/1.x parser."
+license = "MIT/Apache-2.0"
+repository = "https://github.com/seanmonstar/httparse"
+[profile.bench]
+opt-level = 3
+lto = true
+codegen-units = 1
+[dev-dependencies.pico-sys]
+version = "0.0"
+
+[features]
+default = ["std"]
+std = []
--- a/third_party/rust/httparse/LICENSE-APACHE
+++ b/third_party/rust/httparse/LICENSE-APACHE
@@ -1,201 +1,201 @@
-                              Apache License
-                        Version 2.0, January 2004
-                     http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-   "License" shall mean the terms and conditions for use, reproduction,
-   and distribution as defined by Sections 1 through 9 of this document.
-
-   "Licensor" shall mean the copyright owner or entity authorized by
-   the copyright owner that is granting the License.
-
-   "Legal Entity" shall mean the union of the acting entity and all
-   other entities that control, are controlled by, or are under common
-   control with that entity. For the purposes of this definition,
-   "control" means (i) the power, direct or indirect, to cause the
-   direction or management of such entity, whether by contract or
-   otherwise, or (ii) ownership of fifty percent (50%) or more of the
-   outstanding shares, or (iii) beneficial ownership of such entity.
-
-   "You" (or "Your") shall mean an individual or Legal Entity
-   exercising permissions granted by this License.
-
-   "Source" form shall mean the preferred form for making modifications,
-   including but not limited to software source code, documentation
-   source, and configuration files.
-
-   "Object" form shall mean any form resulting from mechanical
-   transformation or translation of a Source form, including but
-   not limited to compiled object code, generated documentation,
-   and conversions to other media types.
-
-   "Work" shall mean the work of authorship, whether in Source or
-   Object form, made available under the License, as indicated by a
-   copyright notice that is included in or attached to the work
-   (an example is provided in the Appendix below).
-
-   "Derivative Works" shall mean any work, whether in Source or Object
-   form, that is based on (or derived from) the Work and for which the
-   editorial revisions, annotations, elaborations, or other modifications
-   represent, as a whole, an original work of authorship. For the purposes
-   of this License, Derivative Works shall not include works that remain
-   separable from, or merely link (or bind by name) to the interfaces of,
-   the Work and Derivative Works thereof.
-
-   "Contribution" shall mean any work of authorship, including
-   the original version of the Work and any modifications or additions
-   to that Work or Derivative Works thereof, that is intentionally
-   submitted to Licensor for inclusion in the Work by the copyright owner
-   or by an individual or Legal Entity authorized to submit on behalf of
-   the copyright owner. For the purposes of this definition, "submitted"
-   means any form of electronic, verbal, or written communication sent
-   to the Licensor or its representatives, including but not limited to
-   communication on electronic mailing lists, source code control systems,
-   and issue tracking systems that are managed by, or on behalf of, the
-   Licensor for the purpose of discussing and improving the Work, but
-   excluding communication that is conspicuously marked or otherwise
-   designated in writing by the copyright owner as "Not a Contribution."
-
-   "Contributor" shall mean Licensor and any individual or Legal Entity
-   on behalf of whom a Contribution has been received by Licensor and
-   subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
-   this License, each Contributor hereby grants to You a perpetual,
-   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-   copyright license to reproduce, prepare Derivative Works of,
-   publicly display, publicly perform, sublicense, and distribute the
-   Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
-   this License, each Contributor hereby grants to You a perpetual,
-   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-   (except as stated in this section) patent license to make, have made,
-   use, offer to sell, sell, import, and otherwise transfer the Work,
-   where such license applies only to those patent claims licensable
-   by such Contributor that are necessarily infringed by their
-   Contribution(s) alone or by combination of their Contribution(s)
-   with the Work to which such Contribution(s) was submitted. If You
-   institute patent litigation against any entity (including a
-   cross-claim or counterclaim in a lawsuit) alleging that the Work
-   or a Contribution incorporated within the Work constitutes direct
-   or contributory patent infringement, then any patent licenses
-   granted to You under this License for that Work shall terminate
-   as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
-   Work or Derivative Works thereof in any medium, with or without
-   modifications, and in Source or Object form, provided that You
-   meet the following conditions:
-
-   (a) You must give any other recipients of the Work or
-       Derivative Works a copy of this License; and
-
-   (b) You must cause any modified files to carry prominent notices
-       stating that You changed the files; and
-
-   (c) You must retain, in the Source form of any Derivative Works
-       that You distribute, all copyright, patent, trademark, and
-       attribution notices from the Source form of the Work,
-       excluding those notices that do not pertain to any part of
-       the Derivative Works; and
-
-   (d) If the Work includes a "NOTICE" text file as part of its
-       distribution, then any Derivative Works that You distribute must
-       include a readable copy of the attribution notices contained
-       within such NOTICE file, excluding those notices that do not
-       pertain to any part of the Derivative Works, in at least one
-       of the following places: within a NOTICE text file distributed
-       as part of the Derivative Works; within the Source form or
-       documentation, if provided along with the Derivative Works; or,
-       within a display generated by the Derivative Works, if and
-       wherever such third-party notices normally appear. The contents
-       of the NOTICE file are for informational purposes only and
-       do not modify the License. You may add Your own attribution
-       notices within Derivative Works that You distribute, alongside
-       or as an addendum to the NOTICE text from the Work, provided
-       that such additional attribution notices cannot be construed
-       as modifying the License.
-
-   You may add Your own copyright statement to Your modifications and
-   may provide additional or different license terms and conditions
-   for use, reproduction, or distribution of Your modifications, or
-   for any such Derivative Works as a whole, provided Your use,
-   reproduction, and distribution of the Work otherwise complies with
-   the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
-   any Contribution intentionally submitted for inclusion in the Work
-   by You to the Licensor shall be under the terms and conditions of
-   this License, without any additional terms or conditions.
-   Notwithstanding the above, nothing herein shall supersede or modify
-   the terms of any separate license agreement you may have executed
-   with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
-   names, trademarks, service marks, or product names of the Licensor,
-   except as required for reasonable and customary use in describing the
-   origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
-   agreed to in writing, Licensor provides the Work (and each
-   Contributor provides its Contributions) on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-   implied, including, without limitation, any warranties or conditions
-   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-   PARTICULAR PURPOSE. You are solely responsible for determining the
-   appropriateness of using or redistributing the Work and assume any
-   risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
-   whether in tort (including negligence), contract, or otherwise,
-   unless required by applicable law (such as deliberate and grossly
-   negligent acts) or agreed to in writing, shall any Contributor be
-   liable to You for damages, including any direct, indirect, special,
-   incidental, or consequential damages of any character arising as a
-   result of this License or out of the use or inability to use the
-   Work (including but not limited to damages for loss of goodwill,
-   work stoppage, computer failure or malfunction, or any and all
-   other commercial damages or losses), even if such Contributor
-   has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
-   the Work or Derivative Works thereof, You may choose to offer,
-   and charge a fee for, acceptance of support, warranty, indemnity,
-   or other liability obligations and/or rights consistent with this
-   License. However, in accepting such obligations, You may act only
-   on Your own behalf and on Your sole responsibility, not on behalf
-   of any other Contributor, and only if You agree to indemnify,
-   defend, and hold each Contributor harmless for any liability
-   incurred by, or claims asserted against, such Contributor by reason
-   of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
-   To apply the Apache License to your work, attach the following
-   boilerplate notice, with the fields enclosed by brackets "[]"
-   replaced with your own identifying information. (Don't include
-   the brackets!)  The text should be enclosed in the appropriate
-   comment syntax for the file format. We also recommend that a
-   file or class name and description of purpose be included on the
-   same "printed page" as the copyright notice for easier
-   identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-	http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
--- a/third_party/rust/httparse/LICENSE-MIT
+++ b/third_party/rust/httparse/LICENSE-MIT
@@ -1,20 +1,20 @@
-Copyright (c) 2015 Sean McArthur
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
+Copyright (c) 2015 Sean McArthur
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
--- a/third_party/rust/httparse/README.md
+++ b/third_party/rust/httparse/README.md
@@ -1,35 +1,35 @@
-# httparse
-
-[![Build Status](https://travis-ci.org/seanmonstar/httparse.svg?branch=master)](https://travis-ci.org/seanmonstar/httparse)
-[![Coverage Status](https://coveralls.io/repos/seanmonstar/httparse/badge.svg)](https://coveralls.io/r/seanmonstar/httparse)
-[![crates.io](http://meritbadge.herokuapp.com/httparse)](https://crates.io/crates/httparse)
-
-A push parser for the HTTP 1.x protocol. Avoids allocations. Fast.
-
-[Documentation](https://docs.rs/httparse)
-
-## Usage
-
-```rust
-let mut headers = [httparse::EMPTY_HEADER; 16];
-let mut req = httparse::Request::new(&mut headers);
-
-let buf = b"GET /index.html HTTP/1.1\r\nHost";
-assert!(try!(req.parse(buf)).is_partial());
-
-// a partial request, so we try again once we have more data
-
-let buf = b"GET /index.html HTTP/1.1\r\nHost: example.domain\r\n\r\n";
-assert!(try!(req.parse(buf)).is_complete());
-```
-
-## License
-
-Licensed under either of
-
-- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://apache.org/licenses/LICENSE-2.0)
-- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
-
-### Contribution
-
-Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
+# httparse
+
+[![Build Status](https://travis-ci.org/seanmonstar/httparse.svg?branch=master)](https://travis-ci.org/seanmonstar/httparse)
+[![Coverage Status](https://coveralls.io/repos/seanmonstar/httparse/badge.svg)](https://coveralls.io/r/seanmonstar/httparse)
+[![crates.io](http://meritbadge.herokuapp.com/httparse)](https://crates.io/crates/httparse)
+
+A push parser for the HTTP 1.x protocol. Avoids allocations. Fast.
+
+[Documentation](https://docs.rs/httparse)
+
+## Usage
+
+```rust
+let mut headers = [httparse::EMPTY_HEADER; 16];
+let mut req = httparse::Request::new(&mut headers);
+
+let buf = b"GET /index.html HTTP/1.1\r\nHost";
+assert!(try!(req.parse(buf)).is_partial());
+
+// a partial request, so we try again once we have more data
+
+let buf = b"GET /index.html HTTP/1.1\r\nHost: example.domain\r\n\r\n";
+assert!(try!(req.parse(buf)).is_complete());
+```
+
+## License
+
+Licensed under either of
+
+- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://apache.org/licenses/LICENSE-2.0)
+- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
--- a/third_party/rust/httparse/benches/parse.rs
+++ b/third_party/rust/httparse/benches/parse.rs
@@ -1,68 +1,70 @@
-#![feature(test)]
-
-extern crate pico_sys as pico;
-extern crate httparse;
-
-extern crate test;
-
-const REQ: &'static [u8] = b"\
-GET /wp-content/uploads/2010/03/hello-kitty-darth-vader-pink.jpg HTTP/1.1\r\n\
-Host: www.kittyhell.com\r\n\
-User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Pathtraq/0.9\r\n\
-Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n\
-Accept-Language: ja,en-us;q=0.7,en;q=0.3\r\n\
-Accept-Encoding: gzip,deflate\r\n\
-Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7\r\n\
-Keep-Alive: 115\r\n\
-Connection: keep-alive\r\n\
-Cookie: wp_ozh_wsa_visits=2; wp_ozh_wsa_visit_lasttime=xxxxxxxxxx; __utma=xxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.x; __utmz=xxxxxxxxx.xxxxxxxxxx.x.x.utmccn=(referral)|utmcsr=reader.livedoor.com|utmcct=/reader/|utmcmd=referral\r\n\r\n";
-
-
-
-
-#[bench]
-fn bench_pico(b: &mut test::Bencher) {
-    use std::mem;
-
-    #[repr(C)]
-    #[derive(Clone, Copy)]
-    struct Header<'a>(&'a [u8], &'a [u8]);
-
-
-    #[repr(C)]
-    struct Headers<'a>(&'a mut [Header<'a>]);
-    let method = [0i8; 16];
-    let path = [0i8; 16];
-    let mut minor_version = 0;
-    let mut h = [Header(&[], &[]); 16];
-    let mut h_len = h.len();
-    let headers = Headers(&mut h);
-    let prev_buf_len = 0;
-
-    b.iter(|| {
-        let ret = unsafe {
-            pico::ffi::phr_parse_request(
-                REQ.as_ptr() as *const _,
-                REQ.len(),
-                &mut method.as_ptr(),
-                &mut 16,
-                &mut path.as_ptr(),
-                &mut 16,
-                &mut minor_version,
-                mem::transmute::<*mut Header, *mut pico::ffi::phr_header>(headers.0.as_mut_ptr()),
-                &mut h_len as *mut usize as *mut _,
-                prev_buf_len
-            )
-        };
-        assert_eq!(ret, REQ.len() as i32);
-    })
-}
-
-#[bench]
-fn bench_httparse(b: &mut test::Bencher) {
-    let mut headers = [httparse::Header{ name: "", value: &[] }; 16];
-    let mut req = httparse::Request::new(&mut headers);
-    b.iter(|| {
-        assert_eq!(req.parse(REQ).unwrap(), httparse::Status::Complete(REQ.len()));
-    })
-}
+#![feature(test)]
+
+extern crate pico_sys as pico;
+extern crate httparse;
+
+extern crate test;
+
+const REQ: &'static [u8] = b"\
+GET /wp-content/uploads/2010/03/hello-kitty-darth-vader-pink.jpg HTTP/1.1\r\n\
+Host: www.kittyhell.com\r\n\
+User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Pathtraq/0.9\r\n\
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n\
+Accept-Language: ja,en-us;q=0.7,en;q=0.3\r\n\
+Accept-Encoding: gzip,deflate\r\n\
+Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7\r\n\
+Keep-Alive: 115\r\n\
+Connection: keep-alive\r\n\
+Cookie: wp_ozh_wsa_visits=2; wp_ozh_wsa_visit_lasttime=xxxxxxxxxx; __utma=xxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.x; __utmz=xxxxxxxxx.xxxxxxxxxx.x.x.utmccn=(referral)|utmcsr=reader.livedoor.com|utmcct=/reader/|utmcmd=referral\r\n\r\n";
+
+
+
+
+#[bench]
+fn bench_pico(b: &mut test::Bencher) {
+    use std::mem;
+
+    #[repr(C)]
+    #[derive(Clone, Copy)]
+    struct Header<'a>(&'a [u8], &'a [u8]);
+
+
+    #[repr(C)]
+    struct Headers<'a>(&'a mut [Header<'a>]);
+    let method = [0i8; 16];
+    let path = [0i8; 16];
+    let mut minor_version = 0;
+    let mut h = [Header(&[], &[]); 16];
+    let mut h_len = h.len();
+    let headers = Headers(&mut h);
+    let prev_buf_len = 0;
+
+    b.iter(|| {
+        let ret = unsafe {
+            pico::ffi::phr_parse_request(
+                REQ.as_ptr() as *const _,
+                REQ.len(),
+                &mut method.as_ptr(),
+                &mut 16,
+                &mut path.as_ptr(),
+                &mut 16,
+                &mut minor_version,
+                mem::transmute::<*mut Header, *mut pico::ffi::phr_header>(headers.0.as_mut_ptr()),
+                &mut h_len as *mut usize as *mut _,
+                prev_buf_len
+            )
+        };
+        assert_eq!(ret, REQ.len() as i32);
+    });
+    b.bytes = REQ.len() as u64;
+}
+
+#[bench]
+fn bench_httparse(b: &mut test::Bencher) {
+    let mut headers = [httparse::Header{ name: "", value: &[] }; 16];
+    let mut req = httparse::Request::new(&mut headers);
+    b.iter(|| {
+        assert_eq!(req.parse(REQ).unwrap(), httparse::Status::Complete(REQ.len()));
+    });
+    b.bytes = REQ.len() as u64;
+}
--- a/third_party/rust/httparse/src/iter.rs
+++ b/third_party/rust/httparse/src/iter.rs
@@ -1,116 +1,140 @@
-use core::slice;
-
-pub struct Bytes<'a> {
-    slice: &'a [u8],
-    pos: usize
-}
-
-impl<'a> Bytes<'a> {
-    #[inline]
-    pub fn new(slice: &'a [u8]) -> Bytes<'a> {
-        Bytes {
-            slice: slice,
-            pos: 0
-        }
-    }
-
-    #[inline]
-    pub fn pos(&self) -> usize {
-        self.pos
-    }
-
-    #[inline]
-    pub fn peek(&self) -> Option<u8> {
-        self.slice.get(self.pos).cloned()
-    }
-
-    #[inline]
-    pub fn bump(&mut self) {
-        self.pos += 1;
-    }
-
-    #[inline]
-    pub fn len(&self) -> usize {
-        self.slice.len()
-    }
-
-    #[inline]
-    pub fn slice(&mut self) -> &'a [u8] {
-        self.slice_skip(0)
-    }
-
-    #[inline]
-    pub fn slice_skip(&mut self, skip: usize) -> &'a [u8] {
-        debug_assert!(self.pos >= skip);
-        let head_pos = self.pos - skip;
-        unsafe {
-            let ptr = self.slice.as_ptr();
-            let head = slice::from_raw_parts(ptr, head_pos);
-            let tail = slice::from_raw_parts(ptr.offset(self.pos as isize), self.slice.len() - self.pos);
-            self.pos = 0;
-            self.slice = tail;
-            head
-        }
-    }
-
-    #[inline]
-    pub fn next_8<'b>(&'b mut self) -> Option<Bytes8<'b, 'a>> {
-        if self.slice.len() > self.pos + 8 {
-            Some(Bytes8 { bytes: self, pos: 0 })
-        } else {
-            None
-        }
-    }
-}
-
-impl<'a> Iterator for Bytes<'a> {
-    type Item = u8;
-
-    #[inline]
-    fn next(&mut self) -> Option<u8> {
-        if self.slice.len() > self.pos {
-            let b = unsafe { *self.slice.get_unchecked(self.pos) };
-            self.pos += 1;
-            Some(b)
-        } else {
-            None
-        }
-    }
-}
-
-pub struct Bytes8<'a, 'b: 'a> {
-    bytes: &'a mut Bytes<'b>,
-    pos: usize
-}
-
-macro_rules! bytes8_methods {
-    ($f:ident, $pos:expr) => {
-        #[inline]
-        pub fn $f(&mut self) -> u8 {
-            debug_assert!(self.assert_pos($pos));
-            let b = unsafe { *self.bytes.slice.get_unchecked(self.bytes.pos) };
-            self.bytes.pos += 1;
-            b
-        }
-    };
-    () => {
-        bytes8_methods!(_0, 0);
-        bytes8_methods!(_1, 1);
-        bytes8_methods!(_2, 2);
-        bytes8_methods!(_3, 3);
-        bytes8_methods!(_4, 4);
-        bytes8_methods!(_5, 5);
-        bytes8_methods!(_6, 6);
-        bytes8_methods!(_7, 7);
-    }
-}
-
-impl<'a, 'b: 'a> Bytes8<'a, 'b> {
-    bytes8_methods! {}
-
-    fn assert_pos(&mut self, pos: usize) -> bool {
-        let ret = self.pos == pos;
-        self.pos += 1;
-        ret
-    }
-}
+use core::slice;
+
+pub struct Bytes<'a> {
+    slice: &'a [u8],
+    pos: usize
+}
+
+impl<'a> Bytes<'a> {
+    #[inline]
+    pub fn new(slice: &'a [u8]) -> Bytes<'a> {
+        Bytes {
+            slice: slice,
+            pos: 0
+        }
+    }
+
+    #[inline]
+    pub fn pos(&self) -> usize {
+        self.pos
+    }
+
+    #[inline]
+    pub fn peek(&self) -> Option<u8> {
+        self.slice.get(self.pos).cloned()
+    }
+
+    #[inline]
+    pub fn bump(&mut self) {
+        self.pos += 1;
+    }
+
+    #[inline]
+    pub fn len(&self) -> usize {
+        self.slice.len()
+    }
+
+    #[inline]
+    pub fn slice(&mut self) -> &'a [u8] {
+        self.slice_skip(0)
+    }
+
+    #[inline]
+    pub fn slice_skip(&mut self, skip: usize) -> &'a [u8] {
+        debug_assert!(self.pos >= skip);
+        let head_pos = self.pos - skip;
+        unsafe {
+            let ptr = self.slice.as_ptr();
+            let head = slice::from_raw_parts(ptr, head_pos);
+            let tail = slice::from_raw_parts(ptr.offset(self.pos as isize), self.slice.len() - self.pos);
+            self.pos = 0;
+            self.slice = tail;
+            head
+        }
+    }
+
+    #[inline]
+    pub fn next_8<'b>(&'b mut self) -> Option<Bytes8<'b, 'a>> {
+        if self.slice.len() > self.pos + 8 {
+            Some(Bytes8::new(self))
+        } else {
+            None
+        }
+    }
+}
+
+impl<'a> Iterator for Bytes<'a> {
+    type Item = u8;
+
+    #[inline]
+    fn next(&mut self) -> Option<u8> {
+        if self.slice.len() > self.pos {
+            let b = unsafe { *self.slice.get_unchecked(self.pos) };
+            self.pos += 1;
+            Some(b)
+        } else {
+            None
+        }
+    }
+}
+
+pub struct Bytes8<'a, 'b: 'a> {
+    bytes: &'a mut Bytes<'b>,
+    #[cfg(debug_assertions)]
+    pos: usize
+}
+
+macro_rules! bytes8_methods {
+    ($f:ident, $pos:expr) => {
+        #[inline]
+        pub fn $f(&mut self) -> u8 {
+            self.assert_pos($pos);
+            let b = unsafe { *self.bytes.slice.get_unchecked(self.bytes.pos) };
+            self.bytes.pos += 1;
+            b
+        }
+    };
+    () => {
+        bytes8_methods!(_0, 0);
+        bytes8_methods!(_1, 1);
+        bytes8_methods!(_2, 2);
+        bytes8_methods!(_3, 3);
+        bytes8_methods!(_4, 4);
+        bytes8_methods!(_5, 5);
+        bytes8_methods!(_6, 6);
+        bytes8_methods!(_7, 7);
+    }
+}
+
+impl<'a, 'b: 'a> Bytes8<'a, 'b> {
+    bytes8_methods! {}
+
+    #[cfg(not(debug_assertions))]
+    #[inline]
+    fn new(bytes: &'a mut Bytes<'b>) -> Bytes8<'a, 'b> {
+        Bytes8 {
+            bytes: bytes,
+        }
+    }
+
+    #[cfg(debug_assertions)]
+    #[inline]
+    fn new(bytes: &'a mut Bytes<'b>) -> Bytes8<'a, 'b> {
+        Bytes8 {
+            bytes: bytes,
+            pos: 0,
+        }
+    }
+
+    #[cfg(not(debug_assertions))]
+    #[inline]
+    fn assert_pos(&mut self, _pos: usize) {
+    }
+
+    #[cfg(debug_assertions)]
+    #[inline]
+    fn assert_pos(&mut self, pos: usize) {
+        assert!(self.pos == pos);
+        self.pos += 1;
+    }
+}
--- a/third_party/rust/httparse/src/lib.rs
+++ b/third_party/rust/httparse/src/lib.rs
@@ -1,946 +1,994 @@
-#![cfg_attr(not(feature = "std"),  no_std)]
-#![cfg_attr(test, deny(warnings))]
-#![deny(missing_docs)]
-//! # httparse
-//!
-//! A push library for parsing HTTP/1.x requests and responses.
-//!
-//! The focus is on speed and safety. Unsafe code is used to keep parsing fast,
-//! but unsafety is contained in a submodule, with invariants enforced. The
-//! parsing internals use an `Iterator` instead of direct indexing, while
-//! skipping bounds checks.
-//!
-//! The speed is comparable to the fast picohttpparser, currently being around
-//! 1.6 times slower than pico. Improvements can be made as a `likely`
-//! intrinsic, and simd, are stabilized in rustc.
-
-#[cfg(feature = "std")] extern crate std as core;
-
-use core::{fmt, result, str, slice};
-
-use iter::Bytes;
-
-mod iter;
-
-macro_rules! next {
-    ($bytes:ident) => ({
-        match $bytes.next() {
-            Some(b) => b,
-            None => return Ok(Status::Partial)
-        }
-    })
-}
-
-macro_rules! expect {
-    ($bytes:ident.next() == $pat:pat => $ret:expr) => {
-        expect!(next!($bytes) => $pat |? $ret)
-    };
-    ($e:expr => $pat:pat |? $ret:expr) => {
-        match $e {
-            v@$pat => v,
-            _ => return $ret
-        }
-    };
-}
-
-macro_rules! complete {
-    ($e:expr) => {
-        match try!($e) {
-            Status::Complete(v) => v,
-            Status::Partial => return Ok(Status::Partial)
-        }
-    }
-}
-
-#[inline]
-fn shrink<T>(slice: &mut &mut [T], len: usize) {
-    debug_assert!(slice.len() >= len);
-    let ptr = slice.as_mut_ptr();
-    *slice = unsafe { slice::from_raw_parts_mut(ptr, len) };
-}
-
-/// Determines if byte is a token char.
-///
-/// > ```notrust
-/// > token          = 1*tchar
-/// >
-/// > tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
-/// >                / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
-/// >                / DIGIT / ALPHA
-/// >                ; any VCHAR, except delimiters
-/// > ```
-#[inline]
-fn is_token(b: u8) -> bool {
-    b > 0x1F && b < 0x7F
-}
-
-macro_rules! space {
-    ($bytes:ident or $err:expr) => ({
-        expect!($bytes.next() == b' ' => Err($err));
-        $bytes.slice();
-    })
-}
-
-macro_rules! newline {
-    ($bytes:ident) => ({
-        match next!($bytes) {
-            b'\r' => {
-                expect!($bytes.next() == b'\n' => Err(Error::NewLine));
-                $bytes.slice();
-            },
-            b'\n' => {
-                $bytes.slice();
-            },
-            _ => return Err(Error::NewLine)
-        }
-    })
-}
-
-/// An error in parsing.
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub enum Error {
-    /// Invalid byte in header name.
-    HeaderName,
-    /// Invalid byte in header value.
-    HeaderValue,
-    /// Invalid byte in new line.
-    NewLine,
-    /// Invalid byte in Response status.
-    Status,
-    /// Invalid byte where token is required.
-    Token,
-    /// Parsed more headers than provided buffer can contain.
-    TooManyHeaders,
-    /// Invalid byte in HTTP version.
-    Version,
-}
-
-impl Error {
-    #[inline]
-    fn description_str(&self) -> &'static str {
-        match *self {
-            Error::HeaderName => "invalid header name",
-            Error::HeaderValue => "invalid header value",
-            Error::NewLine => "invalid new line",
-            Error::Status => "invalid response status",
-            Error::Token => "invalid token",
-            Error::TooManyHeaders => "too many headers",
-            Error::Version => "invalid HTTP version",
-        }
-    }
-}
-
-impl fmt::Display for Error {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.write_str(self.description_str())
-    }
-}
-
-#[cfg(feature = "std")]
-impl std::error::Error for Error {
-    fn description(&self) -> &str {
-        self.description_str()
-    }
-}
-
-/// An error in parsing a chunk size.
-// Note: Move this into the error enum once v2.0 is released.
-#[derive(Debug, PartialEq, Eq)]
-pub struct InvalidChunkSize;
-
-impl fmt::Display for InvalidChunkSize {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.write_str("invalid chunk size")
-    }
-}
-
-/// A Result of any parsing action.
-///
-/// If the input is invalid, an `Error` will be returned. Note that incomplete
-/// data is not considered invalid, and so will not return an error, but rather
-/// a `Ok(Status::Partial)`.
-pub type Result<T> = result::Result<Status<T>, Error>;
-
-/// The result of a successful parse pass.
-///
-/// `Complete` is used when the buffer contained the complete value.
-/// `Partial` is used when parsing did not reach the end of the expected value,
-/// but no invalid data was found.
-#[derive(Copy, Clone, PartialEq, Debug)]
-pub enum Status<T> {
-    /// The completed result.
-    Complete(T),
-    /// A partial result.
-    Partial
-}
-
-impl<T> Status<T> {
-    /// Convenience method to check if status is complete.
-    #[inline]
-    pub fn is_complete(&self) -> bool {
-        match *self {
-            Status::Complete(..) => true,
-            Status::Partial => false
-        }
-    }
-
-    /// Convenience method to check if status is partial.
-    #[inline]
-    pub fn is_partial(&self) -> bool {
-        match *self {
-            Status::Complete(..) => false,
-            Status::Partial => true
-        }
-    }
-
-    /// Convenience method to unwrap a Complete value. Panics if the status is
-    /// `Partial`.
-    #[inline]
-    pub fn unwrap(self) -> T {
-        match self {
-            Status::Complete(t) => t,
-            Status::Partial => panic!("Tried to unwrap Status::Partial")
-        }
-    }
-}
-
-/// A parsed Request.
-///
-/// The optional values will be `None` if a parse was not complete, and did not
-/// parse the associated property. This allows you to inspect the parts that
-/// could be parsed, before reading more, in case you wish to exit early.
-///
-/// # Example
-///
-/// ```no_run
-/// let buf = b"GET /404 HTTP/1.1\r\nHost:";
-/// let mut headers = [httparse::EMPTY_HEADER; 16];
-/// let mut req = httparse::Request::new(&mut headers);
-/// let res = req.parse(buf).unwrap();
-/// if res.is_partial() {
-///     match req.path {
-///         Some(ref path) => {
-///             // check router for path.
-///             // /404 doesn't exist? we could stop parsing
-///         },
-///         None => {
-///             // must read more and parse again
-///         }
-///     }
-/// }
-/// ```
-pub struct Request<'headers, 'buf: 'headers> {
-    /// The request method, such as `GET`.
-    pub method: Option<&'buf str>,
-    /// The request path, such as `/about-us`.
-    pub path: Option<&'buf str>,
-    /// The request version, such as `HTTP/1.1`.
-    pub version: Option<u8>,
-    /// The request headers.
-    pub headers: &'headers mut [Header<'buf>]
-}
-
-impl<'h, 'b> Request<'h, 'b> {
-    /// Creates a new Request, using a slice of headers you allocate.
-    #[inline]
-    pub fn new(headers: &'h mut [Header<'b>]) -> Request<'h, 'b> {
-        Request {
-            method: None,
-            path: None,
-            version: None,
-            headers: headers,
-        }
-    }
-
-    /// Try to parse a buffer of bytes into the Request.
-    pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize> {
-        let orig_len = buf.len();
-        let mut bytes = Bytes::new(buf);
-        complete!(skip_empty_lines(&mut bytes));
-        self.method = Some(complete!(parse_token(&mut bytes)));
-        self.path = Some(complete!(parse_token(&mut bytes)));
-        self.version = Some(complete!(parse_version(&mut bytes)));
-        newline!(bytes);
-
-        let len = orig_len - bytes.len();
-        let headers_len = complete!(parse_headers_iter(&mut self.headers, &mut bytes));
-
-        Ok(Status::Complete(len + headers_len))
-    }
-}
-
-#[inline]
-fn skip_empty_lines(bytes: &mut Bytes) -> Result<()> {
-    loop {
-        let b = bytes.peek();
-        match b {
-            Some(b'\r') => {
-                bytes.bump();
-                expect!(bytes.next() == b'\n' => Err(Error::NewLine));
-            },
-            Some(b'\n') => {
-                bytes.bump();
-            },
-            Some(..) => {
-                bytes.slice();
-                return Ok(Status::Complete(()));
-            },
-            None => return Ok(Status::Partial)
-        }
-    }
-}
-
-/// A parsed Response.
-///
-/// See `Request` docs for explanation of optional values.
-pub struct Response<'headers, 'buf: 'headers> {
-    /// The response version, such as `HTTP/1.1`.
-    pub version: Option<u8>,
-    /// The response code, such as `200`.
-    pub code: Option<u16>,
-    /// The response reason-phrase, such as `OK`.
-    pub reason: Option<&'buf str>,
-    /// The response headers.
-    pub headers: &'headers mut [Header<'buf>]
-}
-
-impl<'h, 'b> Response<'h, 'b> {
-    /// Creates a new `Response` using a slice of `Header`s you have allocated.
-    #[inline]
-    pub fn new(headers: &'h mut [Header<'b>]) -> Response<'h, 'b> {
-        Response {
-            version: None,
-            code: None,
-            reason: None,
-            headers: headers,
-        }
-    }
-
-    /// Try to parse a buffer of bytes into this `Response`.
-    pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize> {
-        let orig_len = buf.len();
-        let mut bytes = Bytes::new(buf);
-
-        complete!(skip_empty_lines(&mut bytes));
-        self.version = Some(complete!(parse_version(&mut bytes)));
-        space!(bytes or Error::Version);
-        self.code = Some(complete!(parse_code(&mut bytes)));
-
-        // RFC7230 says there must be 'SP' and then reason-phrase, but admits
-        // its only for legacy reasons. With the reason-phrase completely
-        // optional (and preferred to be omitted) in HTTP2, we'll just
-        // handle any response that doesn't include a reason-phrase, because
-        // it's more lenient, and we don't care anyways.
-        //
-        // So, a SP means parse a reason-phrase.
-        // A newline means go to headers.
-        // Anything else we'll say is a malformed status.
-        match next!(bytes) {
-            b' ' => {
-                bytes.slice();
-                self.reason = Some(complete!(parse_reason(&mut bytes)));
-            },
-            b'\r' => {
-                expect!(bytes.next() == b'\n' => Err(Error::Status));
-                self.reason = Some("");
-            },
-            b'\n' => self.reason = Some(""),
-            _ => return Err(Error::Status),
-        }
-
-
-        let len = orig_len - bytes.len();
-        let headers_len = complete!(parse_headers_iter(&mut self.headers, &mut bytes));
-        Ok(Status::Complete(len + headers_len))
-    }
-}
-
-/// Represents a parsed header.
-#[derive(Copy, Clone, PartialEq, Debug)]
-pub struct Header<'a> {
-    /// The name portion of a header.
-    ///
-    /// A header name must be valid ASCII-US, so it's safe to store as a `&str`.
-    pub name: &'a str,
-    /// The value portion of a header.
-    ///
-    /// While headers **should** be ASCII-US, the specification allows for
-    /// values that may not be, and so the value is stored as bytes.
-    pub value: &'a [u8],
-}
-
-/// An empty header, useful for constructing a `Header` array to pass in for
-/// parsing.
-///
-/// # Example
-///
-/// ```
-/// let headers = [httparse::EMPTY_HEADER; 64];
-/// ```
-pub const EMPTY_HEADER: Header<'static> = Header { name: "", value: b"" };
-
-#[inline]
-fn parse_version(bytes: &mut Bytes) -> Result<u8> {
-    if let Some(mut eight) = bytes.next_8() {
-        expect!(eight._0() => b'H' |? Err(Error::Version));
-        expect!(eight._1() => b'T' |? Err(Error::Version));
-        expect!(eight._2() => b'T' |? Err(Error::Version));
-        expect!(eight._3() => b'P' |? Err(Error::Version));
-        expect!(eight._4() => b'/' |? Err(Error::Version));
-        expect!(eight._5() => b'1' |? Err(Error::Version));
-        expect!(eight._6() => b'.' |? Err(Error::Version));
-        let v = match eight._7() {
-            b'0' => 0,
-            b'1' => 1,
-            _ => return Err(Error::Version)
-        };
-        Ok(Status::Complete(v))
-    } else {
-        Ok(Status::Partial)
-    }
-}
-
-/// From [RFC 7230](https://tools.ietf.org/html/rfc7230):
-///
-/// > ```notrust
-/// > reason-phrase  = *( HTAB / SP / VCHAR / obs-text )
-/// > HTAB           = %x09        ; horizontal tab
-/// > VCHAR          = %x21-7E     ; visible (printing) characters
-/// > obs-text       = %x80-FF
-/// > ```
-///
-/// > A.2.  Changes from RFC 2616
-/// >
-/// > Non-US-ASCII content in header fields and the reason phrase
-/// > has been obsoleted and made opaque (the TEXT rule was removed).
-///
-/// Note that the following implementation deliberately rejects the obsoleted (non-US-ASCII) text range.
-///
-/// The fully compliant parser should probably just return the reason-phrase as an opaque &[u8] data
-/// and leave interpretation to user or specialized helpers (akin to .display() in std::path::Path)
-#[inline]
-fn parse_reason<'a>(bytes: &mut Bytes<'a>) -> Result<&'a str> {
-    loop {
-        let b = next!(bytes);
-        if b == b'\r' {
-            expect!(bytes.next() == b'\n' => Err(Error::Status));
-            return Ok(Status::Complete(unsafe {
-                // all bytes up till `i` must have been HTAB / SP / VCHAR
-                str::from_utf8_unchecked(bytes.slice_skip(2))
-            }));
-        } else if b == b'\n' {
-            return Ok(Status::Complete(unsafe {
-                // all bytes up till `i` must have been HTAB / SP / VCHAR
-                str::from_utf8_unchecked(bytes.slice_skip(1))
-            }));
-        } else if !((b >= 0x20 && b <= 0x7E) || b == b'\t') {
-            return Err(Error::Status);
-        }
-    }
-}
-
-#[inline]
-fn parse_token<'a>(bytes: &mut Bytes<'a>) -> Result<&'a str> {
-    loop {
-        let b = next!(bytes);
-        if b == b' ' {
-            return Ok(Status::Complete(unsafe {
-                // all bytes up till `i` must have been `is_token`.
-                str::from_utf8_unchecked(bytes.slice_skip(1))
-            }));
-        } else if !is_token(b) {
-            return Err(Error::Token);
-        }
-    }
-}
-
-#[inline]
-fn parse_code(bytes: &mut Bytes) -> Result<u16> {
-    let hundreds = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
-    let tens = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
-    let ones = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
-
-    Ok(Status::Complete((hundreds - b'0') as u16 * 100 +
-                        (tens - b'0') as u16 * 10 +
-                        (ones - b'0') as u16))
-}
-
-/// Parse a buffer of bytes as headers.
-///
-/// The return value, if complete and successful, includes the index of the
-/// buffer that parsing stopped at, and a sliced reference to the parsed
-/// headers. The length of the slice will be equal to the number of properly
-/// parsed headers.
-///
-/// # Example
-///
-/// ```
-/// let buf = b"Host: foo.bar\nAccept: */*\n\nblah blah";
-/// let mut headers = [httparse::EMPTY_HEADER; 4];
-/// assert_eq!(httparse::parse_headers(buf, &mut headers),
-///            Ok(httparse::Status::Complete((27, &[
-///                httparse::Header { name: "Host", value: b"foo.bar" },
-///                httparse::Header { name: "Accept", value: b"*/*" }
-///            ][..]))));
-/// ```
-pub fn parse_headers<'b: 'h, 'h>(src: &'b [u8], mut dst: &'h mut [Header<'b>])
-    -> Result<(usize, &'h [Header<'b>])> {
-    let mut iter = Bytes::new(src);
-    let pos = complete!(parse_headers_iter(&mut dst, &mut iter));
-    Ok(Status::Complete((pos, dst)))
-}
-
-#[inline]
-fn parse_headers_iter<'a, 'b>(headers: &mut &mut [Header<'a>], bytes: &'b mut Bytes<'a>)
-    -> Result<usize> {
-    let mut num_headers: usize = 0;
-    let mut count: usize = 0;
-    let mut result = Err(Error::TooManyHeaders);
-
-    {
-        let mut iter = headers.iter_mut();
-
-        'headers: loop {
-            // a newline here means the head is over!
-            let b = next!(bytes);
-            if b == b'\r' {
-                expect!(bytes.next() == b'\n' => Err(Error::NewLine));
-                result = Ok(Status::Complete(count + bytes.pos()));
-                break;
-            } else if b == b'\n' {
-                result = Ok(Status::Complete(count + bytes.pos()));
-                break;
-            } else if b == b':' || !is_token(b) {
-                return Err(Error::HeaderName);
-            }
-
-            let header = match iter.next() {
-                Some(header) => header,
-                None => break 'headers
-            };
-
-            num_headers += 1;
-            // parse header name until colon
-            loop {
-                let b = next!(bytes);
-                if b == b':' {
-                    count += bytes.pos();
-                    header.name = unsafe {
-                        str::from_utf8_unchecked(bytes.slice_skip(1))
-                    };
-                    break;
-                } else if !is_token(b) {
-                    return Err(Error::HeaderName);
-                }
-            }
-
-            let mut b;
-
-            'value: loop {
-
-                // eat white space between colon and value
-                loop {
-                    b = next!(bytes);
-                    if b == b' ' || b == b'\t' {
-                        count += bytes.pos();
-                        bytes.slice();
-                        continue;
-                    } else {
-                        if !is_token(b) {
-                            if (b < 0o40 && b != 0o11) || b == 0o177 {
-                                break 'value;
-                            }
-                        }
-                        break;
-                    }
-                }
-
-                // parse value till EOL
-
-
-
-                macro_rules! check {
-                    ($bytes:ident, $i:ident) => ({
-                        b = $bytes.$i();
-                        if !is_token(b) {
-                            if (b < 0o40 && b != 0o11) || b == 0o177 {
-                                break 'value;
-                            }
-                        }
-                    });
-                    ($bytes:ident) => ({
-                        check!($bytes, _0);
-                        check!($bytes, _1);
-                        check!($bytes, _2);
-                        check!($bytes, _3);
-                        check!($bytes, _4);
-                        check!($bytes, _5);
-                        check!($bytes, _6);
-                        check!($bytes, _7);
-                    })
-                }
-                while let Some(mut bytes8) = bytes.next_8() {
-                    check!(bytes8);
-                }
-                loop {
-                    b = next!(bytes);
-                    if !is_token(b) {
-                        if (b < 0o40 && b != 0o11) || b == 0o177 {
-                            break 'value;
-                        }
-                    }
-                }
-            }
-
-            //found_ctl
-            if b == b'\r' {
-                expect!(bytes.next() == b'\n' => Err(Error::HeaderValue));
-                count += bytes.pos();
-                header.value = bytes.slice_skip(2);
-            } else if b == b'\n' {
-                count += bytes.pos();
-                header.value = bytes.slice_skip(1);
-            } else {
-                return Err(Error::HeaderValue);
-            }
-
-        }
-    } // drop iter
-
-    shrink(headers, num_headers);
-    result
-}
-
-/// Parse a buffer of bytes as a chunk size.
-///
-/// The return value, if complete and successful, includes the index of the
-/// buffer that parsing stopped at, and the size of the following chunk.
-///
-/// # Example
-///
-/// ```
-/// let buf = b"4\r\nRust\r\n0\r\n\r\n";
-/// assert_eq!(httparse::parse_chunk_size(buf),
-///            Ok(httparse::Status::Complete((3, 4))));
-/// ```
-pub fn parse_chunk_size(buf: &[u8])
-        -> result::Result<Status<(usize, u64)>, InvalidChunkSize> {
-    const RADIX: u64 = 16;
-    let mut bytes = Bytes::new(buf);
-    let mut size = 0;
-    let mut in_chunk_size = true;
-    let mut in_ext = false;
-    let mut count = 0;
-    loop {
-        let b = next!(bytes);
-        match b {
-            b'0'...b'9' if in_chunk_size => {
-                if count > 15 {
-                    return Err(InvalidChunkSize);
-                }
-                count += 1;
-                size *= RADIX;
-                size += (b - b'0') as u64;
-            },
-            b'a'...b'f' if in_chunk_size => {
-                if count > 15 {
-                    return Err(InvalidChunkSize);
-                }
-                count += 1;
-                size *= RADIX;
-                size += (b + 10 - b'a') as u64;
-            }
-            b'A'...b'F' if in_chunk_size => {
-                if count > 15 {
-                    return Err(InvalidChunkSize);
-                }
-                count += 1;
-                size *= RADIX;
-                size += (b + 10 - b'A') as u64;
-            }
-            b'\r' => {
-                match next!(bytes) {
-                    b'\n' => break,
-                    _ => return Err(InvalidChunkSize),
-                }
-            }
-            // If we weren't in the extension yet, the ";" signals its start
-            b';' if !in_ext => {
-                in_ext = true;
-                in_chunk_size = false;
-            }
-            // "Linear white space" is ignored between the chunk size and the
-            // extension separator token (";") due to the "implied *LWS rule".
-            b'\t' | b' ' if !in_ext & !in_chunk_size => {}
-            // LWS can follow the chunk size, but no more digits can come
-            b'\t' | b' ' if in_chunk_size => in_chunk_size = false,
-            // We allow any arbitrary octet once we are in the extension, since
-            // they all get ignored anyway. According to the HTTP spec, valid
-            // extensions would have a more strict syntax:
-            //     (token ["=" (token | quoted-string)])
-            // but we gain nothing by rejecting an otherwise valid chunk size.
-            _ if in_ext => {}
-            // Finally, if we aren't in the extension and we're reading any
-            // other octet, the chunk size line is invalid!
-            _ => return Err(InvalidChunkSize),
-        }
-    }
-    Ok(Status::Complete((bytes.pos(), size)))
-}
-
-#[cfg(test)]
-mod tests {
-    use super::{Request, Response, Status, EMPTY_HEADER, shrink, parse_chunk_size};
-
-    const NUM_OF_HEADERS: usize = 4;
-
-    #[test]
-    fn test_shrink() {
-        let mut arr = [EMPTY_HEADER; 16];
-        {
-            let slice = &mut &mut arr[..];
-            assert_eq!(slice.len(), 16);
-            shrink(slice, 4);
-            assert_eq!(slice.len(), 4);
-        }
-        assert_eq!(arr.len(), 16);
-    }
-
-    macro_rules! req {
-        ($name:ident, $buf:expr, |$arg:ident| $body:expr) => (
-            req! {$name, $buf, Ok(Status::Complete($buf.len())), |$arg| $body }
-        );
-        ($name:ident, $buf:expr, $len:expr, |$arg:ident| $body:expr) => (
-        #[test]
-        fn $name() {
-            let mut headers = [EMPTY_HEADER; NUM_OF_HEADERS];
-            let mut req = Request::new(&mut headers[..]);
-            let status = req.parse($buf.as_ref());
-            assert_eq!(status, $len);
-            closure(req);
-
-            fn closure($arg: Request) {
-                $body
-            }
-        }
-        )
-    }
-
-    req! {
-        test_request_simple,
-        b"GET / HTTP/1.1\r\n\r\n",
-        |req| {
-            assert_eq!(req.method.unwrap(), "GET");
-            assert_eq!(req.path.unwrap(), "/");
-            assert_eq!(req.version.unwrap(), 1);
-            assert_eq!(req.headers.len(), 0);
-        }
-    }
-
-    req! {
-        test_request_headers,
-        b"GET / HTTP/1.1\r\nHost: foo.com\r\nCookie: \r\n\r\n",
-        |req| {
-            assert_eq!(req.method.unwrap(), "GET");
-            assert_eq!(req.path.unwrap(), "/");
-            assert_eq!(req.version.unwrap(), 1);
-            assert_eq!(req.headers.len(), 2);
-            assert_eq!(req.headers[0].name, "Host");
-            assert_eq!(req.headers[0].value, b"foo.com");
-            assert_eq!(req.headers[1].name, "Cookie");
-            assert_eq!(req.headers[1].value, b"");
-        }
-    }
-
-    req! {
-        test_request_headers_max,
-        b"GET / HTTP/1.1\r\nA: A\r\nB: B\r\nC: C\r\nD: D\r\n\r\n",
-        |req| {
-            assert_eq!(req.headers.len(), NUM_OF_HEADERS);
-        }
-    }
-
-    req! {
-        test_request_multibyte,
-        b"GET / HTTP/1.1\r\nHost: foo.com\r\nUser-Agent: \xe3\x81\xb2\xe3/1.0\r\n\r\n",
-        |req| {
-            assert_eq!(req.method.unwrap(), "GET");
-            assert_eq!(req.path.unwrap(), "/");
-            assert_eq!(req.version.unwrap(), 1);
-            assert_eq!(req.headers[0].name, "Host");
-            assert_eq!(req.headers[0].value, b"foo.com");
-            assert_eq!(req.headers[1].name, "User-Agent");
-            assert_eq!(req.headers[1].value, b"\xe3\x81\xb2\xe3/1.0");
-        }
-    }
-
-
-    req! {
-        test_request_partial,
-        b"GET / HTTP/1.1\r\n\r", Ok(Status::Partial),
-        |_req| {}
-    }
-
-    req! {
-        test_request_newlines,
-        b"GET / HTTP/1.1\nHost: foo.bar\n\n",
-        |_r| {}
-    }
-
-    req! {
-        test_request_empty_lines_prefix,
-        b"\r\n\r\nGET / HTTP/1.1\r\n\r\n",
-        |req| {
-            assert_eq!(req.method.unwrap(), "GET");
-            assert_eq!(req.path.unwrap(), "/");
-            assert_eq!(req.version.unwrap(), 1);
-            assert_eq!(req.headers.len(), 0);
-        }
-    }
-
-    req! {
-        test_request_empty_lines_prefix_lf_only,
-        b"\n\nGET / HTTP/1.1\n\n",
-        |req| {
-            assert_eq!(req.method.unwrap(), "GET");
-            assert_eq!(req.path.unwrap(), "/");
-            assert_eq!(req.version.unwrap(), 1);
-            assert_eq!(req.headers.len(), 0);
-        }
-    }
-
-    req! {
-        test_request_with_invalid_token_delimiter,
-        b"GET\n/ HTTP/1.1\r\nHost: foo.bar\r\n\r\n",
-        Err(::Error::Token),
-        |_r| {}
-    }
-
-    macro_rules! res {
-        ($name:ident, $buf:expr, |$arg:ident| $body:expr) => (
-            res! {$name, $buf, Ok(Status::Complete($buf.len())), |$arg| $body }
-        );
-        ($name:ident, $buf:expr, $len:expr, |$arg:ident| $body:expr) => (
-        #[test]
-        fn $name() {
-            let mut headers = [EMPTY_HEADER; NUM_OF_HEADERS];
-            let mut res = Response::new(&mut headers[..]);
-            let status = res.parse($buf.as_ref());
-            assert_eq!(status, $len);
-            closure(res);
-
-            fn closure($arg: Response) {
-                $body
-            }
-        }
-        )
-    }
-
-    res! {
-        test_response_simple,
-        b"HTTP/1.1 200 OK\r\n\r\n",
-        |res| {
-            assert_eq!(res.version.unwrap(), 1);
-            assert_eq!(res.code.unwrap(), 200);
-            assert_eq!(res.reason.unwrap(), "OK");
-        }
-    }
-
-    res! {
-        test_response_newlines,
-        b"HTTP/1.0 403 Forbidden\nServer: foo.bar\n\n",
-        |_r| {}
-    }
-
-    res! {
-        test_response_reason_missing,
-        b"HTTP/1.1 200 \r\n\r\n",
-        |res| {
-            assert_eq!(res.version.unwrap(), 1);
-            assert_eq!(res.code.unwrap(), 200);
-            assert_eq!(res.reason.unwrap(), "");
-        }
-    }
-
-    res! {
-        test_response_reason_missing_no_space,
-        b"HTTP/1.1 200\r\n\r\n",
-        |res| {
-            assert_eq!(res.version.unwrap(), 1);
-            assert_eq!(res.code.unwrap(), 200);
-            assert_eq!(res.reason.unwrap(), "");
-        }
-    }
-
-    res! {
-        test_response_reason_with_space_and_tab,
-        b"HTTP/1.1 101 Switching Protocols\t\r\n\r\n",
-        |res| {
-            assert_eq!(res.version.unwrap(), 1);
-            assert_eq!(res.code.unwrap(), 101);
-            assert_eq!(res.reason.unwrap(), "Switching Protocols\t");
-        }
-    }
-
-    static RESPONSE_REASON_WITH_OBS_TEXT_BYTE: &'static [u8] = b"HTTP/1.1 200 X\xFFZ\r\n\r\n";
-    res! {
-        test_response_reason_with_obsolete_text_byte,
-        RESPONSE_REASON_WITH_OBS_TEXT_BYTE,
-        Err(::Error::Status),
-        |_res| {}
-    }
-
-    res! {
-        test_response_reason_with_nul_byte,
-        b"HTTP/1.1 200 \x00\r\n\r\n",
-        Err(::Error::Status),
-        |_res| {}
-    }
-
-    res! {
-        test_response_version_missing_space,
-        b"HTTP/1.1",
-        Ok(Status::Partial),
-        |_res| {}
-    }
-
-    res! {
-        test_response_code_missing_space,
-        b"HTTP/1.1 200",
-        Ok(Status::Partial),
-        |_res| {}
-    }
-
-    res! {
-        test_response_empty_lines_prefix_lf_only,
-        b"\n\nHTTP/1.1 200 OK\n\n",
-        |_res| {}
-    }
-
-    #[test]
-    fn test_chunk_size() {
-        assert_eq!(parse_chunk_size(b"0\r\n"), Ok(Status::Complete((3, 0))));
-        assert_eq!(parse_chunk_size(b"12\r\nchunk"), Ok(Status::Complete((4, 18))));
-        assert_eq!(parse_chunk_size(b"3086d\r\n"), Ok(Status::Complete((7, 198765))));
-        assert_eq!(parse_chunk_size(b"3735AB1;foo bar*\r\n"), Ok(Status::Complete((18, 57891505))));
-        assert_eq!(parse_chunk_size(b"3735ab1 ; baz \r\n"), Ok(Status::Complete((16, 57891505))));
-        assert_eq!(parse_chunk_size(b"77a65\r"), Ok(Status::Partial));
-        assert_eq!(parse_chunk_size(b"ab"), Ok(Status::Partial));
-        assert_eq!(parse_chunk_size(b"567f8a\rfoo"), Err(::InvalidChunkSize));
-        assert_eq!(parse_chunk_size(b"567f8a\rfoo"), Err(::InvalidChunkSize));
-        assert_eq!(parse_chunk_size(b"567xf8a\r\n"), Err(::InvalidChunkSize));
-        assert_eq!(parse_chunk_size(b"ffffffffffffffff\r\n"), Ok(Status::Complete((18, ::core::u64::MAX))));
-        assert_eq!(parse_chunk_size(b"1ffffffffffffffff\r\n"), Err(::InvalidChunkSize));
-        assert_eq!(parse_chunk_size(b"Affffffffffffffff\r\n"), Err(::InvalidChunkSize));
-        assert_eq!(parse_chunk_size(b"fffffffffffffffff\r\n"), Err(::InvalidChunkSize));
-    }
-
-    #[cfg(feature = "std")]
-    #[test]
-    fn test_std_error() {
-        use super::Error;
-        use std::error::Error as StdError;
-        let err = Error::HeaderName;
-        assert_eq!(err.to_string(), err.description());
-    }
-}
+#![cfg_attr(not(feature = "std"),  no_std)]
+#![cfg_attr(test, deny(warnings))]
+#![deny(missing_docs)]
+//! # httparse
+//!
+//! A push library for parsing HTTP/1.x requests and responses.
+//!
+//! The focus is on speed and safety. Unsafe code is used to keep parsing fast,
+//! but unsafety is contained in a submodule, with invariants enforced. The
+//! parsing internals use an `Iterator` instead of direct indexing, while
+//! skipping bounds checks.
+//!
+//! The speed is faster than picohttpparser, when SIMD is not available.
+#[cfg(feature = "std")] extern crate std as core;
+
+use core::{fmt, result, str, slice};
+
+use iter::Bytes;
+
+mod iter;
+
+macro_rules! next {
+    ($bytes:ident) => ({
+        match $bytes.next() {
+            Some(b) => b,
+            None => return Ok(Status::Partial)
+        }
+    })
+}
+
+macro_rules! expect {
+    ($bytes:ident.next() == $pat:pat => $ret:expr) => {
+        expect!(next!($bytes) => $pat |? $ret)
+    };
+    ($e:expr => $pat:pat |? $ret:expr) => {
+        match $e {
+            v@$pat => v,
+            _ => return $ret
+        }
+    };
+}
+
+macro_rules! complete {
+    ($e:expr) => {
+        match try!($e) {
+            Status::Complete(v) => v,
+            Status::Partial => return Ok(Status::Partial)
+        }
+    }
+}
+
+#[inline]
+fn shrink<T>(slice: &mut &mut [T], len: usize) {
+    debug_assert!(slice.len() >= len);
+    let ptr = slice.as_mut_ptr();
+    *slice = unsafe { slice::from_raw_parts_mut(ptr, len) };
+}
+
+/// Determines if byte is a token char.
+///
+/// > ```notrust
+/// > token          = 1*tchar
+/// >
+/// > tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
+/// >                / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
+/// >                / DIGIT / ALPHA
+/// >                ; any VCHAR, except delimiters
+/// > ```
+#[inline]
+fn is_token(b: u8) -> bool {
+    b > 0x1F && b < 0x7F
+}
+macro_rules! byte_map {
+    ($($flag:expr,)*) => ([
+        $($flag != 0,)*
+    ])
+}
+
+static HEADER_NAME_MAP: [bool; 256] = byte_map![
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+];
+
+#[inline]
+fn is_header_name_token(b: u8) -> bool {
+    HEADER_NAME_MAP[b as usize]
+}
+
+static HEADER_VALUE_MAP: [bool; 256] = byte_map![
+    0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+];
+
+
+#[inline]
+fn is_header_value_token(b: u8) -> bool {
+    HEADER_VALUE_MAP[b as usize]
+}
+
+
+macro_rules! space {
+    ($bytes:ident or $err:expr) => ({
+        expect!($bytes.next() == b' ' => Err($err));
+        $bytes.slice();
+    })
+}
+
+macro_rules! newline {
+    ($bytes:ident) => ({
+        match next!($bytes) {
+            b'\r' => {
+                expect!($bytes.next() == b'\n' => Err(Error::NewLine));
+                $bytes.slice();
+            },
+            b'\n' => {
+                $bytes.slice();
+            },
+            _ => return Err(Error::NewLine)
+        }
+    })
+}
+
+/// An error in parsing.
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub enum Error {
+    /// Invalid byte in header name.
+    HeaderName,
+    /// Invalid byte in header value.
+    HeaderValue,
+    /// Invalid byte in new line.
+    NewLine,
+    /// Invalid byte in Response status.
+    Status,
+    /// Invalid byte where token is required.
+    Token,
+    /// Parsed more headers than provided buffer can contain.
+    TooManyHeaders,
+    /// Invalid byte in HTTP version.
+    Version,
+}
+
+impl Error {
+    #[inline]
+    fn description_str(&self) -> &'static str {
+        match *self {
+            Error::HeaderName => "invalid header name",
+            Error::HeaderValue => "invalid header value",
+            Error::NewLine => "invalid new line",
+            Error::Status => "invalid response status",
+            Error::Token => "invalid token",
+            Error::TooManyHeaders => "too many headers",
+            Error::Version => "invalid HTTP version",
+        }
+    }
+}
+
+impl fmt::Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(self.description_str())
+    }
+}
+
+#[cfg(feature = "std")]
+impl std::error::Error for Error {
+    fn description(&self) -> &str {
+        self.description_str()
+    }
+}
+
+/// An error in parsing a chunk size.
+// Note: Move this into the error enum once v2.0 is released.
+#[derive(Debug, PartialEq, Eq)]
+pub struct InvalidChunkSize;
+
+impl fmt::Display for InvalidChunkSize {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str("invalid chunk size")
+    }
+}
+
+/// A Result of any parsing action.
+///
+/// If the input is invalid, an `Error` will be returned. Note that incomplete
+/// data is not considered invalid, and so will not return an error, but rather
+/// a `Ok(Status::Partial)`.
+pub type Result<T> = result::Result<Status<T>, Error>;
+
+/// The result of a successful parse pass.
+///
+/// `Complete` is used when the buffer contained the complete value.
+/// `Partial` is used when parsing did not reach the end of the expected value,
+/// but no invalid data was found.
+#[derive(Copy, Clone, PartialEq, Debug)]
+pub enum Status<T> {
+    /// The completed result.
+    Complete(T),
+    /// A partial result.
+    Partial
+}
+
+impl<T> Status<T> {
+    /// Convenience method to check if status is complete.
+    #[inline]
+    pub fn is_complete(&self) -> bool {
+        match *self {
+            Status::Complete(..) => true,
+            Status::Partial => false
+        }
+    }
+
+    /// Convenience method to check if status is partial.
+    #[inline]
+    pub fn is_partial(&self) -> bool {
+        match *self {
+            Status::Complete(..) => false,
+            Status::Partial => true
+        }
+    }
+
+    /// Convenience method to unwrap a Complete value. Panics if the status is
+    /// `Partial`.
+    #[inline]
+    pub fn unwrap(self) -> T {
+        match self {
+            Status::Complete(t) => t,
+            Status::Partial => panic!("Tried to unwrap Status::Partial")
+        }
+    }
+}
+
+/// A parsed Request.
+///
+/// The optional values will be `None` if a parse was not complete, and did not
+/// parse the associated property. This allows you to inspect the parts that
+/// could be parsed, before reading more, in case you wish to exit early.
+///
+/// # Example
+///
+/// ```no_run
+/// let buf = b"GET /404 HTTP/1.1\r\nHost:";
+/// let mut headers = [httparse::EMPTY_HEADER; 16];
+/// let mut req = httparse::Request::new(&mut headers);
+/// let res = req.parse(buf).unwrap();
+/// if res.is_partial() {
+///     match req.path {
+///         Some(ref path) => {
+///             // check router for path.
+///             // /404 doesn't exist? we could stop parsing
+///         },
+///         None => {
+///             // must read more and parse again
+///         }
+///     }
+/// }
+/// ```
+#[derive(Debug, PartialEq)]
+pub struct Request<'headers, 'buf: 'headers> {
+    /// The request method, such as `GET`.
+    pub method: Option<&'buf str>,
+    /// The request path, such as `/about-us`.
+    pub path: Option<&'buf str>,
+    /// The request version, such as `HTTP/1.1`.
+    pub version: Option<u8>,
+    /// The request headers.
+    pub headers: &'headers mut [Header<'buf>]
+}
+
+impl<'h, 'b> Request<'h, 'b> {
+    /// Creates a new Request, using a slice of headers you allocate.
+    #[inline]
+    pub fn new(headers: &'h mut [Header<'b>]) -> Request<'h, 'b> {
+        Request {
+            method: None,
+            path: None,
+            version: None,
+            headers: headers,
+        }
+    }
+
+    /// Try to parse a buffer of bytes into the Request.
+    pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize> {
+        let orig_len = buf.len();
+        let mut bytes = Bytes::new(buf);
+        complete!(skip_empty_lines(&mut bytes));
+        self.method = Some(complete!(parse_token(&mut bytes)));
+        self.path = Some(complete!(parse_token(&mut bytes)));
+        self.version = Some(complete!(parse_version(&mut bytes)));
+        newline!(bytes);
+
+        let len = orig_len - bytes.len();
+        let headers_len = complete!(parse_headers_iter(&mut self.headers, &mut bytes));
+
+        Ok(Status::Complete(len + headers_len))
+    }
+}
+
+#[inline]
+fn skip_empty_lines(bytes: &mut Bytes) -> Result<()> {
+    loop {
+        let b = bytes.peek();
+        match b {
+            Some(b'\r') => {
+                bytes.bump();
+                expect!(bytes.next() == b'\n' => Err(Error::NewLine));
+            },
+            Some(b'\n') => {
+                bytes.bump();
+            },
+            Some(..) => {
+                bytes.slice();
+                return Ok(Status::Complete(()));
+            },
+            None => return Ok(Status::Partial)
+        }
+    }
+}
+
+/// A parsed Response.
+///
+/// See `Request` docs for explanation of optional values.
+#[derive(Debug, PartialEq)]
+pub struct Response<'headers, 'buf: 'headers> {
+    /// The response version, such as `HTTP/1.1`.
+    pub version: Option<u8>,
+    /// The response code, such as `200`.
+    pub code: Option<u16>,
+    /// The response reason-phrase, such as `OK`.
+    pub reason: Option<&'buf str>,
+    /// The response headers.
+    pub headers: &'headers mut [Header<'buf>]
+}
+
+impl<'h, 'b> Response<'h, 'b> {
+    /// Creates a new `Response` using a slice of `Header`s you have allocated.
+    #[inline]
+    pub fn new(headers: &'h mut [Header<'b>]) -> Response<'h, 'b> {
+        Response {
+            version: None,
+            code: None,
+            reason: None,
+            headers: headers,
+        }
+    }
+
+    /// Try to parse a buffer of bytes into this `Response`.
+    pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize> {
+        let orig_len = buf.len();
+        let mut bytes = Bytes::new(buf);
+
+        complete!(skip_empty_lines(&mut bytes));
+        self.version = Some(complete!(parse_version(&mut bytes)));
+        space!(bytes or Error::Version);
+        self.code = Some(complete!(parse_code(&mut bytes)));
+
+        // RFC7230 says there must be 'SP' and then reason-phrase, but admits
+        // its only for legacy reasons. With the reason-phrase completely
+        // optional (and preferred to be omitted) in HTTP2, we'll just
+        // handle any response that doesn't include a reason-phrase, because
+        // it's more lenient, and we don't care anyways.
+        //
+        // So, a SP means parse a reason-phrase.
+        // A newline means go to headers.
+        // Anything else we'll say is a malformed status.
+        match next!(bytes) {
+            b' ' => {
+                bytes.slice();
+                self.reason = Some(complete!(parse_reason(&mut bytes)));
+            },
+            b'\r' => {
+                expect!(bytes.next() == b'\n' => Err(Error::Status));
+                self.reason = Some("");
+            },
+            b'\n' => self.reason = Some(""),
+            _ => return Err(Error::Status),
+        }
+
+
+        let len = orig_len - bytes.len();
+        let headers_len = complete!(parse_headers_iter(&mut self.headers, &mut bytes));
+        Ok(Status::Complete(len + headers_len))
+    }
+}
+
+/// Represents a parsed header.
+#[derive(Copy, Clone, PartialEq, Debug)]
+pub struct Header<'a> {
+    /// The name portion of a header.
+    ///
+    /// A header name must be valid ASCII-US, so it's safe to store as a `&str`.
+    pub name: &'a str,
+    /// The value portion of a header.
+    ///
+    /// While headers **should** be ASCII-US, the specification allows for
+    /// values that may not be, and so the value is stored as bytes.
+    pub value: &'a [u8],
+}
+
+/// An empty header, useful for constructing a `Header` array to pass in for
+/// parsing.
+///
+/// # Example
+///
+/// ```
+/// let headers = [httparse::EMPTY_HEADER; 64];
+/// ```
+pub const EMPTY_HEADER: Header<'static> = Header { name: "", value: b"" };
+
+#[inline]
+fn parse_version(bytes: &mut Bytes) -> Result<u8> {
+    if let Some(mut eight) = bytes.next_8() {
+        expect!(eight._0() => b'H' |? Err(Error::Version));
+        expect!(eight._1() => b'T' |? Err(Error::Version));
+        expect!(eight._2() => b'T' |? Err(Error::Version));
+        expect!(eight._3() => b'P' |? Err(Error::Version));
+        expect!(eight._4() => b'/' |? Err(Error::Version));
+        expect!(eight._5() => b'1' |? Err(Error::Version));
+        expect!(eight._6() => b'.' |? Err(Error::Version));
+        let v = match eight._7() {
+            b'0' => 0,
+            b'1' => 1,
+            _ => return Err(Error::Version)
+        };
+        Ok(Status::Complete(v))
+    } else {
+        Ok(Status::Partial)
+    }
+}
+
+/// From [RFC 7230](https://tools.ietf.org/html/rfc7230):
+///
+/// > ```notrust
+/// > reason-phrase  = *( HTAB / SP / VCHAR / obs-text )
+/// > HTAB           = %x09        ; horizontal tab
+/// > VCHAR          = %x21-7E     ; visible (printing) characters
+/// > obs-text       = %x80-FF
+/// > ```
+///
+/// > A.2.  Changes from RFC 2616
+/// >
+/// > Non-US-ASCII content in header fields and the reason phrase
+/// > has been obsoleted and made opaque (the TEXT rule was removed).
+///
+/// Note that the following implementation deliberately rejects the obsoleted (non-US-ASCII) text range.
+///
+/// The fully compliant parser should probably just return the reason-phrase as an opaque &[u8] data
+/// and leave interpretation to user or specialized helpers (akin to .display() in std::path::Path)
+#[inline]
+fn parse_reason<'a>(bytes: &mut Bytes<'a>) -> Result<&'a str> {
+    loop {
+        let b = next!(bytes);
+        if b == b'\r' {
+            expect!(bytes.next() == b'\n' => Err(Error::Status));
+            return Ok(Status::Complete(unsafe {
+                // all bytes up till `i` must have been HTAB / SP / VCHAR
+                str::from_utf8_unchecked(bytes.slice_skip(2))
+            }));
+        } else if b == b'\n' {
+            return Ok(Status::Complete(unsafe {
+                // all bytes up till `i` must have been HTAB / SP / VCHAR
+                str::from_utf8_unchecked(bytes.slice_skip(1))
+            }));
+        } else if !((b >= 0x20 && b <= 0x7E) || b == b'\t') {
+            return Err(Error::Status);
+        }
+    }
+}
+
+#[inline]
+fn parse_token<'a>(bytes: &mut Bytes<'a>) -> Result<&'a str> {
+    loop {
+        let b = next!(bytes);
+        if b == b' ' {
+            return Ok(Status::Complete(unsafe {
+                // all bytes up till `i` must have been `is_token`.
+                str::from_utf8_unchecked(bytes.slice_skip(1))
+            }));
+        } else if !is_token(b) {
+            return Err(Error::Token);
+        }
+    }
+}
+
+#[inline]
+fn parse_code(bytes: &mut Bytes) -> Result<u16> {
+    let hundreds = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
+    let tens = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
+    let ones = expect!(bytes.next() == b'0'...b'9' => Err(Error::Status));
+
+    Ok(Status::Complete((hundreds - b'0') as u16 * 100 +
+                        (tens - b'0') as u16 * 10 +
+                        (ones - b'0') as u16))
+}
+
+/// Parse a buffer of bytes as headers.
+///
+/// The return value, if complete and successful, includes the index of the
+/// buffer that parsing stopped at, and a sliced reference to the parsed
+/// headers. The length of the slice will be equal to the number of properly
+/// parsed headers.
+///
+/// # Example
+///
+/// ```
+/// let buf = b"Host: foo.bar\nAccept: */*\n\nblah blah";
+/// let mut headers = [httparse::EMPTY_HEADER; 4];
+/// assert_eq!(httparse::parse_headers(buf, &mut headers),
+///            Ok(httparse::Status::Complete((27, &[
+///                httparse::Header { name: "Host", value: b"foo.bar" },
+///                httparse::Header { name: "Accept", value: b"*/*" }
+///            ][..]))));
+/// ```
+pub fn parse_headers<'b: 'h, 'h>(src: &'b [u8], mut dst: &'h mut [Header<'b>])
+    -> Result<(usize, &'h [Header<'b>])> {
+    let mut iter = Bytes::new(src);
+    let pos = complete!(parse_headers_iter(&mut dst, &mut iter));
+    Ok(Status::Complete((pos, dst)))
+}
+
+#[inline]
+fn parse_headers_iter<'a, 'b>(headers: &mut &mut [Header<'a>], bytes: &'b mut Bytes<'a>)
+    -> Result<usize> {
+    let mut num_headers: usize = 0;
+    let mut count: usize = 0;
+    let mut result = Err(Error::TooManyHeaders);
+
+    {
+        let mut iter = headers.iter_mut();
+
+        'headers: loop {
+            // a newline here means the head is over!
+            let b = next!(bytes);
+            if b == b'\r' {
+                expect!(bytes.next() == b'\n' => Err(Error::NewLine));
+                result = Ok(Status::Complete(count + bytes.pos()));
+                break;
+            } else if b == b'\n' {
+                result = Ok(Status::Complete(count + bytes.pos()));
+                break;
+            } else if !is_header_name_token(b) {
+                return Err(Error::HeaderName);
+            }
+
+            let header = match iter.next() {
+                Some(header) => header,
+                None => break 'headers
+            };
+
+            num_headers += 1;
+            // parse header name until colon
+            'name: loop {
+                let b = next!(bytes);
+                if b == b':' {
+                    count += bytes.pos();
+                    header.name = unsafe {
+                        str::from_utf8_unchecked(bytes.slice_skip(1))
+                    };
+                    break 'name;
+                } else if !is_header_name_token(b) {
+                    return Err(Error::HeaderName);
+                }
+            }
+
+            let mut b;
+
+            'value: loop {
+
+                // eat white space between colon and value
+                'whitespace: loop {
+                    b = next!(bytes);
+                    if b == b' ' || b == b'\t' {
+                        count += bytes.pos();
+                        bytes.slice();
+                        continue 'whitespace;
+                    } else {
+                        if !is_header_value_token(b) {
+                            break 'value;
+                        }
+                        break 'whitespace;
+                    }
+                }
+
+                // parse value till EOL
+
+
+
+                macro_rules! check {
+                    ($bytes:ident, $i:ident) => ({
+                        b = $bytes.$i();
+                        if !is_header_value_token(b) {
+                            break 'value;
+                        }
+                    });
+                    ($bytes:ident) => ({
+                        check!($bytes, _0);
+                        check!($bytes, _1);
+                        check!($bytes, _2);
+                        check!($bytes, _3);
+                        check!($bytes, _4);
+                        check!($bytes, _5);
+                        check!($bytes, _6);
+                        check!($bytes, _7);
+                    })
+                }
+                while let Some(mut bytes8) = bytes.next_8() {
+                    check!(bytes8);
+                }
+                loop {
+                    b = next!(bytes);
+                    if !is_header_value_token(b) {
+                        break 'value;
+                    }
+                }
+            }
+
+            //found_ctl
+            if b == b'\r' {
+                expect!(bytes.next() == b'\n' => Err(Error::HeaderValue));
+                count += bytes.pos();
+                header.value = bytes.slice_skip(2);
+            } else if b == b'\n' {
+                count += bytes.pos();
+                header.value = bytes.slice_skip(1);
+            } else {
+                return Err(Error::HeaderValue);
+            }
+
+        }
+    } // drop iter
+
+    shrink(headers, num_headers);
+    result
+}
+
+/// Parse a buffer of bytes as a chunk size.
+///
+/// The return value, if complete and successful, includes the index of the
+/// buffer that parsing stopped at, and the size of the following chunk.
+///
+/// # Example
+///
+/// ```
+/// let buf = b"4\r\nRust\r\n0\r\n\r\n";
+/// assert_eq!(httparse::parse_chunk_size(buf),
+///            Ok(httparse::Status::Complete((3, 4))));
+/// ```
+pub fn parse_chunk_size(buf: &[u8])
+        -> result::Result<Status<(usize, u64)>, InvalidChunkSize> {
+    const RADIX: u64 = 16;
+    let mut bytes = Bytes::new(buf);
+    let mut size = 0;
+    let mut in_chunk_size = true;
+    let mut in_ext = false;
+    let mut count = 0;
+    loop {
+        let b = next!(bytes);
+        match b {
+            b'0'...b'9' if in_chunk_size => {
+                if count > 15 {
+                    return Err(InvalidChunkSize);
+                }
+                count += 1;
+                size *= RADIX;
+                size += (b - b'0') as u64;
+            },
+            b'a'...b'f' if in_chunk_size => {
+                if count > 15 {
+                    return Err(InvalidChunkSize);
+                }
+                count += 1;
+                size *= RADIX;
+                size += (b + 10 - b'a') as u64;
+            }
+            b'A'...b'F' if in_chunk_size => {
+                if count > 15 {
+                    return Err(InvalidChunkSize);
+                }
+                count += 1;
+                size *= RADIX;
+                size += (b + 10 - b'A') as u64;
+            }
+            b'\r' => {
+                match next!(bytes) {
+                    b'\n' => break,
+                    _ => return Err(InvalidChunkSize),
+                }
+            }
+            // If we weren't in the extension yet, the ";" signals its start
+            b';' if !in_ext => {
+                in_ext = true;
+                in_chunk_size = false;
+            }
+            // "Linear white space" is ignored between the chunk size and the
+            // extension separator token (";") due to the "implied *LWS rule".
+            b'\t' | b' ' if !in_ext & !in_chunk_size => {}
+            // LWS can follow the chunk size, but no more digits can come
+            b'\t' | b' ' if in_chunk_size => in_chunk_size = false,
+            // We allow any arbitrary octet once we are in the extension, since
+            // they all get ignored anyway. According to the HTTP spec, valid
+            // extensions would have a more strict syntax:
+            //     (token ["=" (token | quoted-string)])
+            // but we gain nothing by rejecting an otherwise valid chunk size.
+            _ if in_ext => {}
+            // Finally, if we aren't in the extension and we're reading any
+            // other octet, the chunk size line is invalid!
+            _ => return Err(InvalidChunkSize),
+        }
+    }
+    Ok(Status::Complete((bytes.pos(), size)))
+}
+
+#[cfg(test)]
+mod tests {
+    use super::{Request, Response, Status, EMPTY_HEADER, shrink, parse_chunk_size};
+
+    const NUM_OF_HEADERS: usize = 4;
+
+    #[test]
+    fn test_shrink() {
+        let mut arr = [EMPTY_HEADER; 16];
+        {
+            let slice = &mut &mut arr[..];
+            assert_eq!(slice.len(), 16);
+            shrink(slice, 4);
+            assert_eq!(slice.len(), 4);
+        }
+        assert_eq!(arr.len(), 16);
+    }
+
+    macro_rules! req {
+        ($name:ident, $buf:expr, |$arg:ident| $body:expr) => (
+            req! {$name, $buf, Ok(Status::Complete($buf.len())), |$arg| $body }
+        );
+        ($name:ident, $buf:expr, $len:expr, |$arg:ident| $body:expr) => (
+        #[test]
+        fn $name() {
+            let mut headers = [EMPTY_HEADER; NUM_OF_HEADERS];
+            let mut req = Request::new(&mut headers[..]);
+            let status = req.parse($buf.as_ref());
+            assert_eq!(status, $len);
+            closure(req);
+
+            fn closure($arg: Request) {
+                $body
+            }
+        }
+        )
+    }
+
+    req! {
+        test_request_simple,
+        b"GET / HTTP/1.1\r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 0);
+        }
+    }
+
+    req! {
+        test_request_headers,
+        b"GET / HTTP/1.1\r\nHost: foo.com\r\nCookie: \r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 2);
+            assert_eq!(req.headers[0].name, "Host");
+            assert_eq!(req.headers[0].value, b"foo.com");
+            assert_eq!(req.headers[1].name, "Cookie");
+            assert_eq!(req.headers[1].value, b"");
+        }
+    }
+
+    req! {
+        test_request_headers_max,
+        b"GET / HTTP/1.1\r\nA: A\r\nB: B\r\nC: C\r\nD: D\r\n\r\n",
+        |req| {
+            assert_eq!(req.headers.len(), NUM_OF_HEADERS);
+        }
+    }
+
+    req! {
+        test_request_multibyte,
+        b"GET / HTTP/1.1\r\nHost: foo.com\r\nUser-Agent: \xe3\x81\xb2\xe3/1.0\r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers[0].name, "Host");
+            assert_eq!(req.headers[0].value, b"foo.com");
+            assert_eq!(req.headers[1].name, "User-Agent");
+            assert_eq!(req.headers[1].value, b"\xe3\x81\xb2\xe3/1.0");
+        }
+    }
+
+
+    req! {
+        test_request_partial,
+        b"GET / HTTP/1.1\r\n\r", Ok(Status::Partial),
+        |_req| {}
+    }
+
+    req! {
+        test_request_newlines,
+        b"GET / HTTP/1.1\nHost: foo.bar\n\n",
+        |_r| {}
+    }
+
+    req! {
+        test_request_empty_lines_prefix,
+        b"\r\n\r\nGET / HTTP/1.1\r\n\r\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 0);
+        }
+    }
+
+    req! {
+        test_request_empty_lines_prefix_lf_only,
+        b"\n\nGET / HTTP/1.1\n\n",
+        |req| {
+            assert_eq!(req.method.unwrap(), "GET");
+            assert_eq!(req.path.unwrap(), "/");
+            assert_eq!(req.version.unwrap(), 1);
+            assert_eq!(req.headers.len(), 0);
+        }
+    }
+
+    req! {
+        test_request_with_invalid_token_delimiter,
+        b"GET\n/ HTTP/1.1\r\nHost: foo.bar\r\n\r\n",
+        Err(::Error::Token),
+        |_r| {}
+    }
+
+    macro_rules! res {
+        ($name:ident, $buf:expr, |$arg:ident| $body:expr) => (
+            res! {$name, $buf, Ok(Status::Complete($buf.len())), |$arg| $body }
+        );
+        ($name:ident, $buf:expr, $len:expr, |$arg:ident| $body:expr) => (
+        #[test]
+        fn $name() {
+            let mut headers = [EMPTY_HEADER; NUM_OF_HEADERS];
+            let mut res = Response::new(&mut headers[..]);
+            let status = res.parse($buf.as_ref());
+            assert_eq!(status, $len);
+            closure(res);
+
+            fn closure($arg: Response) {
+                $body
+            }
+        }
+        )
+    }
+
+    res! {
+        test_response_simple,
+        b"HTTP/1.1 200 OK\r\n\r\n",
+        |res| {
+            assert_eq!(res.version.unwrap(), 1);
+            assert_eq!(res.code.unwrap(), 200);
+            assert_eq!(res.reason.unwrap(), "OK");
+        }
+    }
+
+    res! {
+        test_response_newlines,
+        b"HTTP/1.0 403 Forbidden\nServer: foo.bar\n\n",
+        |_r| {}
+    }
+
+    res! {
+        test_response_reason_missing,
+        b"HTTP/1.1 200 \r\n\r\n",
+        |res| {
+            assert_eq!(res.version.unwrap(), 1);
+            assert_eq!(res.code.unwrap(), 200);
+            assert_eq!(res.reason.unwrap(), "");
+        }
+    }
+
+    res! {
+        test_response_reason_missing_no_space,
+        b"HTTP/1.1 200\r\n\r\n",
+        |res| {
+            assert_eq!(res.version.unwrap(), 1);
+            assert_eq!(res.code.unwrap(), 200);
+            assert_eq!(res.reason.unwrap(), "");
+        }
+    }
+
+    res! {
+        test_response_reason_with_space_and_tab,
+        b"HTTP/1.1 101 Switching Protocols\t\r\n\r\n",
+        |res| {
+            assert_eq!(res.version.unwrap(), 1);
+            assert_eq!(res.code.unwrap(), 101);
+            assert_eq!(res.reason.unwrap(), "Switching Protocols\t");
+        }
+    }
+
+    static RESPONSE_REASON_WITH_OBS_TEXT_BYTE: &'static [u8] = b"HTTP/1.1 200 X\xFFZ\r\n\r\n";
+    res! {
+        test_response_reason_with_obsolete_text_byte,
+        RESPONSE_REASON_WITH_OBS_TEXT_BYTE,
+        Err(::Error::Status),
+        |_res| {}
+    }
+
+    res! {
+        test_response_reason_with_nul_byte,
+        b"HTTP/1.1 200 \x00\r\n\r\n",
+        Err(::Error::Status),
+        |_res| {}
+    }
+
+    res! {
+        test_response_version_missing_space,
+        b"HTTP/1.1",
+        Ok(Status::Partial),
+        |_res| {}
+    }
+
+    res! {
+        test_response_code_missing_space,
+        b"HTTP/1.1 200",
+        Ok(Status::Partial),
+        |_res| {}
+    }
+
+    res! {
+        test_response_empty_lines_prefix_lf_only,
+        b"\n\nHTTP/1.1 200 OK\n\n",
+        |_res| {}
+    }
+
+    #[test]
+    fn test_chunk_size() {
+        assert_eq!(parse_chunk_size(b"0\r\n"), Ok(Status::Complete((3, 0))));
+        assert_eq!(parse_chunk_size(b"12\r\nchunk"), Ok(Status::Complete((4, 18))));
+        assert_eq!(parse_chunk_size(b"3086d\r\n"), Ok(Status::Complete((7, 198765))));
+        assert_eq!(parse_chunk_size(b"3735AB1;foo bar*\r\n"), Ok(Status::Complete((18, 57891505))));
+        assert_eq!(parse_chunk_size(b"3735ab1 ; baz \r\n"), Ok(Status::Complete((16, 57891505))));
+        assert_eq!(parse_chunk_size(b"77a65\r"), Ok(Status::Partial));
+        assert_eq!(parse_chunk_size(b"ab"), Ok(Status::Partial));
+        assert_eq!(parse_chunk_size(b"567f8a\rfoo"), Err(::InvalidChunkSize));
+        assert_eq!(parse_chunk_size(b"567f8a\rfoo"), Err(::InvalidChunkSize));
+        assert_eq!(parse_chunk_size(b"567xf8a\r\n"), Err(::InvalidChunkSize));
+        assert_eq!(parse_chunk_size(b"ffffffffffffffff\r\n"), Ok(Status::Complete((18, ::core::u64::MAX))));
+        assert_eq!(parse_chunk_size(b"1ffffffffffffffff\r\n"), Err(::InvalidChunkSize));
+        assert_eq!(parse_chunk_size(b"Affffffffffffffff\r\n"), Err(::InvalidChunkSize));
+        assert_eq!(parse_chunk_size(b"fffffffffffffffff\r\n"), Err(::InvalidChunkSize));
+    }
+
+    #[cfg(feature = "std")]
+    #[test]
+    fn test_std_error() {
+        use super::Error;
+        use std::error::Error as StdError;
+        let err = Error::HeaderName;
+        assert_eq!(err.to_string(), err.description());
+    }
+}
copy from third_party/rust/hyper/.cargo-checksum.json
copy to third_party/rust/hyper-0.10.10/.cargo-checksum.json
copy from third_party/rust/hyper/Cargo.toml
copy to third_party/rust/hyper-0.10.10/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2014 Sean McArthur
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
rename from third_party/rust/hyper/build.rs
rename to third_party/rust/hyper-0.10.10/build.rs
copy from third_party/rust/hyper/src/buffer.rs
copy to third_party/rust/hyper-0.10.10/src/buffer.rs
copy from third_party/rust/hyper/src/client/mod.rs
copy to third_party/rust/hyper-0.10.10/src/client/mod.rs
copy from third_party/rust/hyper/src/client/pool.rs
copy to third_party/rust/hyper-0.10.10/src/client/pool.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/client/proxy.rs
@@ -0,0 +1,221 @@
+use std::borrow::Cow;
+use std::io;
+use std::net::{SocketAddr, Shutdown};
+use std::time::Duration;
+
+use client::scheme::Scheme;
+use method::Method;
+use net::{NetworkConnector, HttpConnector, NetworkStream, SslClient};
+
+pub fn tunnel(proxy: (Scheme, Cow<'static, str>, u16)) -> Proxy<HttpConnector, self::no_ssl::Plaintext> {
+    Proxy {
+        connector: HttpConnector,
+        proxy: proxy,
+        ssl: self::no_ssl::Plaintext,
+    }
+
+}
+
+pub struct Proxy<C, S>
+where C: NetworkConnector + Send + Sync + 'static,
+      C::Stream: NetworkStream + Send + Clone,
+      S: SslClient<C::Stream> {
+    pub connector: C,
+    pub proxy: (Scheme, Cow<'static, str>, u16),
+    pub ssl: S,
+}
+
+impl<C, S> NetworkConnector for Proxy<C, S>
+where C: NetworkConnector + Send + Sync + 'static,
+      C::Stream: NetworkStream + Send + Clone,
+      S: SslClient<C::Stream> {
+    type Stream = Proxied<C::Stream, S::Stream>;
+
+    fn connect(&self, host: &str, port: u16, scheme: &str) -> ::Result<Self::Stream> {
+        use httparse;
+        use std::io::{Read, Write};
+        use ::version::HttpVersion::Http11;
+        trace!("{:?} proxy for '{}://{}:{}'", self.proxy, scheme, host, port);
+        match scheme {
+            "http" => {
+                self.connector.connect(self.proxy.1.as_ref(), self.proxy.2, self.proxy.0.as_ref())
+                    .map(Proxied::Normal)
+            },
+            "https" => {
+                let mut stream = try!(self.connector.connect(self.proxy.1.as_ref(), self.proxy.2, self.proxy.0.as_ref()));
+                trace!("{:?} CONNECT {}:{}", self.proxy, host, port);
+                try!(write!(&mut stream, "{method} {host}:{port} {version}\r\nHost: {host}:{port}\r\n\r\n",
+                            method=Method::Connect, host=host, port=port, version=Http11));
+                try!(stream.flush());
+                let mut buf = [0; 1024];
+                let mut n = 0;
+                while n < buf.len() {
+                    n += try!(stream.read(&mut buf[n..]));
+                    let mut headers = [httparse::EMPTY_HEADER; 10];
+                    let mut res = httparse::Response::new(&mut headers);
+                    if try!(res.parse(&buf[..n])).is_complete() {
+                        let code = res.code.expect("complete parsing lost code");
+                        if code >= 200 && code < 300 {
+                            trace!("CONNECT success = {:?}", code);
+                            return self.ssl.wrap_client(stream, host)
+                                .map(Proxied::Tunneled)
+                        } else {
+                            trace!("CONNECT response = {:?}", code);
+                            return Err(::Error::Status);
+                        }
+                    }
+                }
+                Err(::Error::TooLarge)
+            },
+            _ => Err(io::Error::new(io::ErrorKind::InvalidInput, "invalid scheme").into())
+        }
+    }
+}
+
+#[derive(Debug)]
+pub enum Proxied<T1, T2> {
+    Normal(T1),
+    Tunneled(T2)
+}
+
+#[cfg(test)]
+impl<T1, T2> Proxied<T1, T2> {
+    pub fn into_normal(self) -> Result<T1, Self> {
+        match self {
+            Proxied::Normal(t1) => Ok(t1),
+            _ => Err(self)
+        }
+    }
+
+    pub fn into_tunneled(self) -> Result<T2, Self> {
+        match self {
+            Proxied::Tunneled(t2) => Ok(t2),
+            _ => Err(self)
+        }
+    }
+}
+
+impl<T1: NetworkStream, T2: NetworkStream> io::Read for Proxied<T1, T2> {
+    #[inline]
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        match *self {
+            Proxied::Normal(ref mut t) => io::Read::read(t, buf),
+            Proxied::Tunneled(ref mut t) => io::Read::read(t, buf),
+        }
+    }
+}
+
+impl<T1: NetworkStream, T2: NetworkStream> io::Write for Proxied<T1, T2> {
+    #[inline]
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        match *self {
+            Proxied::Normal(ref mut t) => io::Write::write(t, buf),
+            Proxied::Tunneled(ref mut t) => io::Write::write(t, buf),
+        }
+    }
+
+    #[inline]
+    fn flush(&mut self) -> io::Result<()> {
+        match *self {
+            Proxied::Normal(ref mut t) => io::Write::flush(t),
+            Proxied::Tunneled(ref mut t) => io::Write::flush(t),
+        }
+    }
+}
+
+impl<T1: NetworkStream, T2: NetworkStream> NetworkStream for Proxied<T1, T2> {
+    #[inline]
+    fn peer_addr(&mut self) -> io::Result<SocketAddr> {
+        match *self {
+            Proxied::Normal(ref mut s) => s.peer_addr(),
+            Proxied::Tunneled(ref mut s) => s.peer_addr()
+        }
+    }
+
+    #[inline]
+    fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
+        match *self {
+            Proxied::Normal(ref inner) => inner.set_read_timeout(dur),
+            Proxied::Tunneled(ref inner) => inner.set_read_timeout(dur)
+        }
+    }
+
+    #[inline]
+    fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
+        match *self {
+            Proxied::Normal(ref inner) => inner.set_write_timeout(dur),
+            Proxied::Tunneled(ref inner) => inner.set_write_timeout(dur)
+        }
+    }
+
+    #[inline]
+    fn close(&mut self, how: Shutdown) -> io::Result<()> {
+        match *self {
+            Proxied::Normal(ref mut s) => s.close(how),
+            Proxied::Tunneled(ref mut s) => s.close(how)
+        }
+    }
+}
+
+#[cfg(not(any(feature = "openssl", feature = "security-framework")))]
+mod no_ssl {
+    use std::io;
+    use std::net::{Shutdown, SocketAddr};
+    use std::time::Duration;
+
+    use net::{SslClient, NetworkStream};
+
+    pub struct Plaintext;
+
+    #[derive(Clone)]
+    pub enum Void {}
+
+    impl io::Read for Void {
+        #[inline]
+        fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> {
+            match *self {}
+        }
+    }
+
+    impl io::Write for Void {
+        #[inline]
+        fn write(&mut self, _buf: &[u8]) -> io::Result<usize> {
+            match *self {}
+        }
+
+        #[inline]
+        fn flush(&mut self) -> io::Result<()> {
+            match *self {}
+        }
+    }
+
+    impl NetworkStream for Void {
+        #[inline]
+        fn peer_addr(&mut self) -> io::Result<SocketAddr> {
+            match *self {}
+        }
+
+        #[inline]
+        fn set_read_timeout(&self, _dur: Option<Duration>) -> io::Result<()> {
+            match *self {}
+        }
+
+        #[inline]
+        fn set_write_timeout(&self, _dur: Option<Duration>) -> io::Result<()> {
+            match *self {}
+        }
+
+        #[inline]
+        fn close(&mut self, _how: Shutdown) -> io::Result<()> {
+            match *self {}
+        }
+    }
+
+    impl<T: NetworkStream + Send + Clone> SslClient<T> for Plaintext {
+        type Stream = Void;
+
+        fn wrap_client(&self, _stream: T, _host: &str) -> ::Result<Self::Stream> {
+            Err(io::Error::new(io::ErrorKind::InvalidInput, "invalid scheme").into())
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/client/request.rs
@@ -0,0 +1,314 @@
+//! Client Requests
+use std::marker::PhantomData;
+use std::io::{self, Write};
+
+use std::time::Duration;
+
+use url::Url;
+
+use method::Method;
+use header::Headers;
+use header::Host;
+use net::{NetworkStream, NetworkConnector, DefaultConnector, Fresh, Streaming};
+use version;
+use client::{Response, get_host_and_port};
+
+use http::{HttpMessage, RequestHead};
+use http::h1::Http11Message;
+
+
+/// A client request to a remote server.
+/// The W type tracks the state of the request, Fresh vs Streaming.
+pub struct Request<W> {
+    /// The target URI for this request.
+    pub url: Url,
+
+    /// The HTTP version of this request.
+    pub version: version::HttpVersion,
+
+    message: Box<HttpMessage>,
+    headers: Headers,
+    method: Method,
+
+    _marker: PhantomData<W>,
+}
+
+impl<W> Request<W> {
+    /// Read the Request headers.
+    #[inline]
+    pub fn headers(&self) -> &Headers { &self.headers }
+
+    /// Read the Request method.
+    #[inline]
+    pub fn method(&self) -> Method { self.method.clone() }
+
+    /// Set the write timeout.
+    #[inline]
+    pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
+        self.message.set_write_timeout(dur)
+    }
+
+    /// Set the read timeout.
+    #[inline]
+    pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
+        self.message.set_read_timeout(dur)
+    }
+}
+
+impl Request<Fresh> {
+    /// Create a new `Request<Fresh>` that will use the given `HttpMessage` for its communication
+    /// with the server. This implies that the given `HttpMessage` instance has already been
+    /// properly initialized by the caller (e.g. a TCP connection's already established).
+    pub fn with_message(method: Method, url: Url, message: Box<HttpMessage>)
+            -> ::Result<Request<Fresh>> {
+        let mut headers = Headers::new();
+        {
+            let (host, port) = try!(get_host_and_port(&url));
+            headers.set(Host {
+                hostname: host.to_owned(),
+                port: Some(port),
+            });
+        }
+
+        Ok(Request::with_headers_and_message(method, url, headers, message))
+    }
+
+    #[doc(hidden)]
+    pub fn with_headers_and_message(method: Method, url: Url, headers: Headers,  message: Box<HttpMessage>)
+                -> Request<Fresh> {
+        Request {
+            method: method,
+            headers: headers,
+            url: url,
+            version: version::HttpVersion::Http11,
+            message: message,
+            _marker: PhantomData,
+        }
+    }
+
+    /// Create a new client request.
+    pub fn new(method: Method, url: Url) -> ::Result<Request<Fresh>> {
+        let conn = DefaultConnector::default();
+        Request::with_connector(method, url, &conn)
+    }
+
+    /// Create a new client request with a specific underlying NetworkStream.
+    pub fn with_connector<C, S>(method: Method, url: Url, connector: &C)
+        -> ::Result<Request<Fresh>> where
+        C: NetworkConnector<Stream=S>,
+        S: Into<Box<NetworkStream + Send>> {
+        let stream = {
+            let (host, port) = try!(get_host_and_port(&url));
+            try!(connector.connect(host, port, url.scheme())).into()
+        };
+
+        Request::with_message(method, url, Box::new(Http11Message::with_stream(stream)))
+    }
+
+    /// Consume a Fresh Request, writing the headers and method,
+    /// returning a Streaming Request.
+    pub fn start(mut self) -> ::Result<Request<Streaming>> {
+        let head = match self.message.set_outgoing(RequestHead {
+            headers: self.headers,
+            method: self.method,
+            url: self.url,
+        }) {
+            Ok(head) => head,
+            Err(e) => {
+                let _ = self.message.close_connection();
+                return Err(From::from(e));
+            }
+        };
+
+        Ok(Request {
+            method: head.method,
+            headers: head.headers,
+            url: head.url,
+            version: self.version,
+            message: self.message,
+            _marker: PhantomData,
+        })
+    }
+
+    /// Get a mutable reference to the Request headers.
+    #[inline]
+    pub fn headers_mut(&mut self) -> &mut Headers { &mut self.headers }
+}
+
+
+
+impl Request<Streaming> {
+    /// Completes writing the request, and returns a response to read from.
+    ///
+    /// Consumes the Request.
+    pub fn send(self) -> ::Result<Response> {
+        Response::with_message(self.url, self.message)
+    }
+}
+
+impl Write for Request<Streaming> {
+    #[inline]
+    fn write(&mut self, msg: &[u8]) -> io::Result<usize> {
+        match self.message.write(msg) {
+            Ok(n) => Ok(n),
+            Err(e) => {
+                let _ = self.message.close_connection();
+                Err(e)
+            }
+        }
+    }
+
+    #[inline]
+    fn flush(&mut self) -> io::Result<()> {
+        match self.message.flush() {
+            Ok(r) => Ok(r),
+            Err(e) => {
+                let _ = self.message.close_connection();
+                Err(e)
+            }
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use std::io::Write;
+    use std::str::from_utf8;
+    use url::Url;
+    use method::Method::{Get, Head, Post};
+    use mock::{MockStream, MockConnector};
+    use net::Fresh;
+    use header::{ContentLength,TransferEncoding,Encoding};
+    use url::form_urlencoded;
+    use super::Request;
+    use http::h1::Http11Message;
+
+    fn run_request(req: Request<Fresh>) -> Vec<u8> {
+        let req = req.start().unwrap();
+        let message = req.message;
+        let mut message = message.downcast::<Http11Message>().ok().unwrap();
+        message.flush_outgoing().unwrap();
+        let stream = *message
+            .into_inner().downcast::<MockStream>().ok().unwrap();
+        stream.write
+    }
+
+    fn assert_no_body(s: &str) {
+        assert!(!s.contains("Content-Length:"));
+        assert!(!s.contains("Transfer-Encoding:"));
+    }
+
+    #[test]
+    fn test_get_empty_body() {
+        let req = Request::with_connector(
+            Get, Url::parse("http://example.dom").unwrap(), &mut MockConnector
+        ).unwrap();
+        let bytes = run_request(req);
+        let s = from_utf8(&bytes[..]).unwrap();
+        assert_no_body(s);
+    }
+
+    #[test]
+    fn test_head_empty_body() {
+        let req = Request::with_connector(
+            Head, Url::parse("http://example.dom").unwrap(), &mut MockConnector
+        ).unwrap();
+        let bytes = run_request(req);
+        let s = from_utf8(&bytes[..]).unwrap();
+        assert_no_body(s);
+    }
+
+    #[test]
+    fn test_url_query() {
+        let url = Url::parse("http://example.dom?q=value").unwrap();
+        let req = Request::with_connector(
+            Get, url, &mut MockConnector
+        ).unwrap();
+        let bytes = run_request(req);
+        let s = from_utf8(&bytes[..]).unwrap();
+        assert!(s.contains("?q=value"));
+    }
+
+    #[test]
+    fn test_post_content_length() {
+        let url = Url::parse("http://example.dom").unwrap();
+        let mut req = Request::with_connector(
+            Post, url, &mut MockConnector
+        ).unwrap();
+        let mut body = String::new();
+        form_urlencoded::Serializer::new(&mut body).append_pair("q", "value");
+        req.headers_mut().set(ContentLength(body.len() as u64));
+        let bytes = run_request(req);
+        let s = from_utf8(&bytes[..]).unwrap();
+        assert!(s.contains("Content-Length:"));
+    }
+
+    #[test]
+    fn test_post_chunked() {
+        let url = Url::parse("http://example.dom").unwrap();
+        let req = Request::with_connector(
+            Post, url, &mut MockConnector
+        ).unwrap();
+        let bytes = run_request(req);
+        let s = from_utf8(&bytes[..]).unwrap();
+        assert!(!s.contains("Content-Length:"));
+    }
+
+    #[test]
+    fn test_host_header() {
+        let url = Url::parse("http://example.dom").unwrap();
+        let req = Request::with_connector(
+            Get, url, &mut MockConnector
+        ).unwrap();
+        let bytes = run_request(req);
+        let s = from_utf8(&bytes[..]).unwrap();
+        assert!(s.contains("Host: example.dom"));
+    }
+
+    #[test]
+    fn test_proxy() {
+        let url = Url::parse("http://example.dom").unwrap();
+        let mut req = Request::with_connector(
+            Get, url, &mut MockConnector
+        ).unwrap();
+        req.message.set_proxied(true);
+        let bytes = run_request(req);
+        let s = from_utf8(&bytes[..]).unwrap();
+        let request_line = "GET http://example.dom/ HTTP/1.1";
+        assert_eq!(&s[..request_line.len()], request_line);
+        assert!(s.contains("Host: example.dom"));
+    }
+
+    #[test]
+    fn test_post_chunked_with_encoding() {
+        let url = Url::parse("http://example.dom").unwrap();
+        let mut req = Request::with_connector(
+            Post, url, &mut MockConnector
+        ).unwrap();
+        req.headers_mut().set(TransferEncoding(vec![Encoding::Chunked]));
+        let bytes = run_request(req);
+        let s = from_utf8(&bytes[..]).unwrap();
+        assert!(!s.contains("Content-Length:"));
+        assert!(s.contains("Transfer-Encoding:"));
+    }
+
+    #[test]
+    fn test_write_error_closes() {
+        let url = Url::parse("http://hyper.rs").unwrap();
+        let req = Request::with_connector(
+            Get, url, &mut MockConnector
+        ).unwrap();
+        let mut req = req.start().unwrap();
+
+        req.message.downcast_mut::<Http11Message>().unwrap()
+            .get_mut().downcast_mut::<MockStream>().unwrap()
+            .error_on_write = true;
+
+        req.write(b"foo").unwrap();
+        assert!(req.flush().is_err());
+
+        assert!(req.message.downcast_ref::<Http11Message>().unwrap()
+            .get_ref().downcast_ref::<MockStream>().unwrap()
+            .is_closed);
+    }
+}
copy from third_party/rust/hyper/src/client/response.rs
copy to third_party/rust/hyper-0.10.10/src/client/response.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/error.rs
@@ -0,0 +1,219 @@
+//! Error and Result module.
+use std::error::Error as StdError;
+use std::fmt;
+use std::io::Error as IoError;
+use std::str::Utf8Error;
+use std::string::FromUtf8Error;
+
+use httparse;
+use url;
+
+#[cfg(feature = "openssl")]
+use openssl::ssl::error::SslError;
+
+use self::Error::{
+    Method,
+    Uri,
+    Version,
+    Header,
+    Status,
+    Io,
+    Ssl,
+    TooLarge,
+    Utf8
+};
+
+pub use url::ParseError;
+
+/// Result type often returned from methods that can have hyper `Error`s.
+pub type Result<T> = ::std::result::Result<T, Error>;
+
+/// A set of errors that can occur parsing HTTP streams.
+#[derive(Debug)]
+pub enum Error {
+    /// An invalid `Method`, such as `GE,T`.
+    Method,
+    /// An invalid `RequestUri`, such as `exam ple.domain`.
+    Uri(url::ParseError),
+    /// An invalid `HttpVersion`, such as `HTP/1.1`
+    Version,
+    /// An invalid `Header`.
+    Header,
+    /// A message head is too large to be reasonable.
+    TooLarge,
+    /// An invalid `Status`, such as `1337 ELITE`.
+    Status,
+    /// An `io::Error` that occurred while trying to read or write to a network stream.
+    Io(IoError),
+    /// An error from a SSL library.
+    Ssl(Box<StdError + Send + Sync>),
+    /// Parsing a field as string failed
+    Utf8(Utf8Error),
+
+    #[doc(hidden)]
+    __Nonexhaustive(Void)
+}
+
+#[doc(hidden)]
+pub struct Void(());
+
+impl fmt::Debug for Void {
+    fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
+        unreachable!()
+    }
+}
+
+impl fmt::Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            Uri(ref e) => fmt::Display::fmt(e, f),
+            Io(ref e) => fmt::Display::fmt(e, f),
+            Ssl(ref e) => fmt::Display::fmt(e, f),
+            Utf8(ref e) => fmt::Display::fmt(e, f),
+            ref e => f.write_str(e.description()),
+        }
+    }
+}
+
+impl StdError for Error {
+    fn description(&self) -> &str {
+        match *self {
+            Method => "Invalid Method specified",
+            Version => "Invalid HTTP version specified",
+            Header => "Invalid Header provided",
+            TooLarge => "Message head is too large",
+            Status => "Invalid Status provided",
+            Uri(ref e) => e.description(),
+            Io(ref e) => e.description(),
+            Ssl(ref e) => e.description(),
+            Utf8(ref e) => e.description(),
+            Error::__Nonexhaustive(..) =>  unreachable!(),
+        }
+    }
+
+    fn cause(&self) -> Option<&StdError> {
+        match *self {
+            Io(ref error) => Some(error),
+            Ssl(ref error) => Some(&**error),
+            Uri(ref error) => Some(error),
+            Utf8(ref error) => Some(error),
+            _ => None,
+        }
+    }
+}
+
+impl From<IoError> for Error {
+    fn from(err: IoError) -> Error {
+        Io(err)
+    }
+}
+
+impl From<url::ParseError> for Error {
+    fn from(err: url::ParseError) -> Error {
+        Uri(err)
+    }
+}
+
+#[cfg(feature = "openssl")]
+impl From<SslError> for Error {
+    fn from(err: SslError) -> Error {
+        match err {
+            SslError::StreamError(err) => Io(err),
+            err => Ssl(Box::new(err)),
+        }
+    }
+}
+
+impl From<Utf8Error> for Error {
+    fn from(err: Utf8Error) -> Error {
+        Utf8(err)
+    }
+}
+
+impl From<FromUtf8Error> for Error {
+    fn from(err: FromUtf8Error) -> Error {
+        Utf8(err.utf8_error())
+    }
+}
+
+impl From<httparse::Error> for Error {
+    fn from(err: httparse::Error) -> Error {
+        match err {
+            httparse::Error::HeaderName => Header,
+            httparse::Error::HeaderValue => Header,
+            httparse::Error::NewLine => Header,
+            httparse::Error::Status => Status,
+            httparse::Error::Token => Header,
+            httparse::Error::TooManyHeaders => TooLarge,
+            httparse::Error::Version => Version,
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use std::error::Error as StdError;
+    use std::io;
+    use httparse;
+    use url;
+    use super::Error;
+    use super::Error::*;
+
+    #[test]
+    fn test_cause() {
+        let orig = io::Error::new(io::ErrorKind::Other, "other");
+        let desc = orig.description().to_owned();
+        let e = Io(orig);
+        assert_eq!(e.cause().unwrap().description(), desc);
+    }
+
+    macro_rules! from {
+        ($from:expr => $error:pat) => {
+            match Error::from($from) {
+                e @ $error => {
+                    assert!(e.description().len() > 5);
+                } ,
+                _ => panic!("{:?}", $from)
+            }
+        }
+    }
+
+    macro_rules! from_and_cause {
+        ($from:expr => $error:pat) => {
+            match Error::from($from) {
+                e @ $error => {
+                    let desc = e.cause().unwrap().description();
+                    assert_eq!(desc, $from.description().to_owned());
+                    assert_eq!(desc, e.description());
+                },
+                _ => panic!("{:?}", $from)
+            }
+        }
+    }
+
+    #[test]
+    fn test_from() {
+
+        from_and_cause!(io::Error::new(io::ErrorKind::Other, "other") => Io(..));
+        from_and_cause!(url::ParseError::EmptyHost => Uri(..));
+
+        from!(httparse::Error::HeaderName => Header);
+        from!(httparse::Error::HeaderName => Header);
+        from!(httparse::Error::HeaderValue => Header);
+        from!(httparse::Error::NewLine => Header);
+        from!(httparse::Error::Status => Status);
+        from!(httparse::Error::Token => Header);
+        from!(httparse::Error::TooManyHeaders => TooLarge);
+        from!(httparse::Error::Version => Version);
+    }
+
+    #[cfg(feature = "openssl")]
+    #[test]
+    fn test_from_ssl() {
+        use openssl::ssl::error::SslError;
+
+        from!(SslError::StreamError(
+            io::Error::new(io::ErrorKind::Other, "ssl negotiation")) => Io(..));
+        from_and_cause!(SslError::SslSessionClosed => Ssl(..));
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/accept.rs
@@ -0,0 +1,143 @@
+use mime::Mime;
+
+use header::{QualityItem, qitem};
+
+header! {
+    /// `Accept` header, defined in [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.2)
+    ///
+    /// The `Accept` header field can be used by user agents to specify
+    /// response media types that are acceptable.  Accept header fields can
+    /// be used to indicate that the request is specifically limited to a
+    /// small set of desired types, as in the case of a request for an
+    /// in-line image
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Accept = #( media-range [ accept-params ] )
+    ///
+    /// media-range    = ( "*/*"
+    ///                  / ( type "/" "*" )
+    ///                  / ( type "/" subtype )
+    ///                  ) *( OWS ";" OWS parameter )
+    /// accept-params  = weight *( accept-ext )
+    /// accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ]
+    /// ```
+    ///
+    /// # Example values
+    /// * `audio/*; q=0.2, audio/basic` (`*` value won't parse correctly)
+    /// * `text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, Accept, qitem};
+    /// use hyper::mime::{Mime, TopLevel, SubLevel};
+    ///
+    /// let mut headers = Headers::new();
+    ///
+    /// headers.set(
+    ///     Accept(vec![
+    ///         qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),
+    ///     ])
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, Accept, qitem};
+    /// use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     Accept(vec![
+    ///         qitem(Mime(TopLevel::Application, SubLevel::Json,
+    ///                    vec![(Attr::Charset, Value::Utf8)])),
+    ///     ])
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, Accept, QualityItem, Quality, qitem};
+    /// use hyper::mime::{Mime, TopLevel, SubLevel};
+    ///
+    /// let mut headers = Headers::new();
+    ///
+    /// headers.set(
+    ///     Accept(vec![
+    ///         qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),
+    ///         qitem(Mime(TopLevel::Application,
+    ///                    SubLevel::Ext("xhtml+xml".to_owned()), vec![])),
+    ///         QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]),
+    ///                          Quality(900)),
+    ///                          qitem(Mime(TopLevel::Image,
+    ///                                     SubLevel::Ext("webp".to_owned()), vec![])),
+    ///                          QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]),
+    ///                                           Quality(800))
+    ///     ])
+    /// );
+    /// ```
+    ///
+    /// # Notes
+    /// * Using always Mime types to represent `media-range` differs from the ABNF.
+    /// * **FIXME**: `accept-ext` is not supported.
+    (Accept, "Accept") => (QualityItem<Mime>)+
+
+    test_accept {
+        // Tests from the RFC
+        // FIXME: Test fails, first value containing a "*" fails to parse
+        // test_header!(
+        //    test1,
+        //    vec![b"audio/*; q=0.2, audio/basic"],
+        //    Some(HeaderField(vec![
+        //        QualityItem::new(Mime(TopLevel::Audio, SubLevel::Star, vec![]), Quality(200)),
+        //        qitem(Mime(TopLevel::Audio, SubLevel::Ext("basic".to_owned()), vec![])),
+        //        ])));
+        test_header!(
+            test2,
+            vec![b"text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c"],
+            Some(HeaderField(vec![
+                QualityItem::new(Mime(TopLevel::Text, SubLevel::Plain, vec![]), Quality(500)),
+                qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),
+                QualityItem::new(
+                    Mime(TopLevel::Text, SubLevel::Ext("x-dvi".to_owned()), vec![]),
+                    Quality(800)),
+                qitem(Mime(TopLevel::Text, SubLevel::Ext("x-c".to_owned()), vec![])),
+                ])));
+        // Custom tests
+        test_header!(
+            test3,
+            vec![b"text/plain; charset=utf-8"],
+            Some(Accept(vec![
+                qitem(Mime(TopLevel::Text, SubLevel::Plain, vec![(Attr::Charset, Value::Utf8)])),
+                ])));
+        test_header!(
+            test4,
+            vec![b"text/plain; charset=utf-8; q=0.5"],
+            Some(Accept(vec![
+                QualityItem::new(Mime(TopLevel::Text,
+                    SubLevel::Plain, vec![(Attr::Charset, Value::Utf8)]),
+                    Quality(500)),
+            ])));
+    }
+}
+
+impl Accept {
+    /// A constructor to easily create `Accept: */*`.
+    pub fn star() -> Accept {
+        Accept(vec![qitem(mime!(Star/Star))])
+    }
+
+    /// A constructor to easily create `Accept: application/json`.
+    pub fn json() -> Accept {
+        Accept(vec![qitem(mime!(Application/Json))])
+    }
+
+    /// A constructor to easily create `Accept: text/*`.
+    pub fn text() -> Accept {
+        Accept(vec![qitem(mime!(Text/Star))])
+    }
+
+    /// A constructor to easily create `Accept: image/*`.
+    pub fn image() -> Accept {
+        Accept(vec![qitem(mime!(Image/Star))])
+    }
+}
+
+
+bench_header!(bench, Accept, { vec![b"text/plain; q=0.5, text/html".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/accept_charset.rs
@@ -0,0 +1,56 @@
+use header::{Charset, QualityItem};
+
+header! {
+    /// `Accept-Charset` header, defined in
+    /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.3)
+    ///
+    /// The `Accept-Charset` header field can be sent by a user agent to
+    /// indicate what charsets are acceptable in textual response content.
+    /// This field allows user agents capable of understanding more
+    /// comprehensive or special-purpose charsets to signal that capability
+    /// to an origin server that is capable of representing information in
+    /// those charsets.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Accept-Charset = 1#( ( charset / "*" ) [ weight ] )
+    /// ```
+    ///
+    /// # Example values
+    /// * `iso-8859-5, unicode-1-1;q=0.8`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, AcceptCharset, Charset, qitem};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AcceptCharset(vec![qitem(Charset::Us_Ascii)])
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, AcceptCharset, Charset, Quality, QualityItem};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AcceptCharset(vec![
+    ///         QualityItem::new(Charset::Us_Ascii, Quality(900)),
+    ///         QualityItem::new(Charset::Iso_8859_10, Quality(200)),
+    ///     ])
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, AcceptCharset, Charset, qitem};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AcceptCharset(vec![qitem(Charset::Ext("utf-8".to_owned()))])
+    /// );
+    /// ```
+    (AcceptCharset, "Accept-Charset") => (QualityItem<Charset>)+
+
+    test_accept_charset {
+        /// Testcase from RFC
+        test_header!(test1, vec![b"iso-8859-5, unicode-1-1;q=0.8"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/accept_encoding.rs
@@ -0,0 +1,71 @@
+use header::{Encoding, QualityItem};
+
+header! {
+    /// `Accept-Encoding` header, defined in
+    /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.4)
+    ///
+    /// The `Accept-Encoding` header field can be used by user agents to
+    /// indicate what response content-codings are
+    /// acceptable in the response.  An  `identity` token is used as a synonym
+    /// for "no encoding" in order to communicate when no encoding is
+    /// preferred.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Accept-Encoding  = #( codings [ weight ] )
+    /// codings          = content-coding / "identity" / "*"
+    /// ```
+    ///
+    /// # Example values
+    /// * `compress, gzip`
+    /// * ``
+    /// * `*`
+    /// * `compress;q=0.5, gzip;q=1`
+    /// * `gzip;q=1.0, identity; q=0.5, *;q=0`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, AcceptEncoding, Encoding, qitem};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AcceptEncoding(vec![qitem(Encoding::Chunked)])
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, AcceptEncoding, Encoding, qitem};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AcceptEncoding(vec![
+    ///         qitem(Encoding::Chunked),
+    ///         qitem(Encoding::Gzip),
+    ///         qitem(Encoding::Deflate),
+    ///     ])
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, AcceptEncoding, Encoding, QualityItem, Quality, qitem};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AcceptEncoding(vec![
+    ///         qitem(Encoding::Chunked),
+    ///         QualityItem::new(Encoding::Gzip, Quality(600)),
+    ///         QualityItem::new(Encoding::EncodingExt("*".to_owned()), Quality(0)),
+    ///     ])
+    /// );
+    /// ```
+    (AcceptEncoding, "Accept-Encoding") => (QualityItem<Encoding>)*
+
+    test_accept_encoding {
+        // From the RFC
+        test_header!(test1, vec![b"compress, gzip"]);
+        test_header!(test2, vec![b""], Some(AcceptEncoding(vec![])));
+        test_header!(test3, vec![b"*"]);
+        // Note: Removed quality 1 from gzip
+        test_header!(test4, vec![b"compress;q=0.5, gzip"]);
+        // Note: Removed quality 1 from gzip
+        test_header!(test5, vec![b"gzip, identity; q=0.5, *;q=0"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/accept_language.rs
@@ -0,0 +1,70 @@
+use language_tags::LanguageTag;
+use header::QualityItem;
+
+header! {
+    /// `Accept-Language` header, defined in
+    /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.5)
+    ///
+    /// The `Accept-Language` header field can be used by user agents to
+    /// indicate the set of natural languages that are preferred in the
+    /// response.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Accept-Language = 1#( language-range [ weight ] )
+    /// language-range  = <language-range, see [RFC4647], Section 2.1>
+    /// ```
+    ///
+    /// # Example values
+    /// * `da, en-gb;q=0.8, en;q=0.7`
+    /// * `en-us;q=1.0, en;q=0.5, fr`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::LanguageTag;
+    /// use hyper::header::{Headers, AcceptLanguage, qitem};
+    ///
+    /// let mut headers = Headers::new();
+    /// let mut langtag: LanguageTag = Default::default();
+    /// langtag.language = Some("en".to_owned());
+    /// langtag.region = Some("US".to_owned());
+    /// headers.set(
+    ///     AcceptLanguage(vec![
+    ///         qitem(langtag),
+    ///     ])
+    /// );
+    /// ```
+    /// ```
+    /// # extern crate hyper;
+    /// # #[macro_use] extern crate language_tags;
+    /// # use hyper::header::{Headers, AcceptLanguage, QualityItem, Quality, qitem};
+    /// #
+    /// # fn main() {
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AcceptLanguage(vec![
+    ///         qitem(langtag!(da)),
+    ///         QualityItem::new(langtag!(en;;;GB), Quality(800)),
+    ///         QualityItem::new(langtag!(en), Quality(700)),
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    (AcceptLanguage, "Accept-Language") => (QualityItem<LanguageTag>)+
+
+    test_accept_language {
+        // From the RFC
+        test_header!(test1, vec![b"da, en-gb;q=0.8, en;q=0.7"]);
+        // Own test
+        test_header!(
+            test2, vec![b"en-US, en; q=0.5, fr"],
+            Some(AcceptLanguage(vec![
+                qitem(langtag!(en;;;US)),
+                QualityItem::new(langtag!(en), Quality(500)),
+                qitem(langtag!(fr)),
+        ])));
+    }
+}
+
+bench_header!(bench, AcceptLanguage,
+              { vec![b"en-us;q=1.0, en;q=0.5, fr".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/accept_ranges.rs
@@ -0,0 +1,101 @@
+use std::fmt::{self, Display};
+use std::str::FromStr;
+
+header! {
+    /// `Accept-Ranges` header, defined in
+    /// [RFC7233](http://tools.ietf.org/html/rfc7233#section-2.3)
+    ///
+    /// The `Accept-Ranges` header field allows a server to indicate that it
+    /// supports range requests for the target resource.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Accept-Ranges     = acceptable-ranges
+    /// acceptable-ranges = 1#range-unit / \"none\"
+    ///
+    /// # Example values
+    /// * `bytes`
+    /// * `none`
+    /// * `unknown-unit`
+    /// ```
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, AcceptRanges, RangeUnit};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(AcceptRanges(vec![RangeUnit::Bytes]));
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, AcceptRanges, RangeUnit};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(AcceptRanges(vec![RangeUnit::None]));
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, AcceptRanges, RangeUnit};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AcceptRanges(vec![
+    ///         RangeUnit::Unregistered("nibbles".to_owned()),
+    ///         RangeUnit::Bytes,
+    ///         RangeUnit::Unregistered("doublets".to_owned()),
+    ///         RangeUnit::Unregistered("quadlets".to_owned()),
+    ///     ])
+    /// );
+    /// ```
+    (AcceptRanges, "Accept-Ranges") => (RangeUnit)+
+
+    test_acccept_ranges {
+        test_header!(test1, vec![b"bytes"]);
+        test_header!(test2, vec![b"none"]);
+        test_header!(test3, vec![b"unknown-unit"]);
+        test_header!(test4, vec![b"bytes, unknown-unit"]);
+    }
+}
+
+/// Range Units, described in [RFC7233](http://tools.ietf.org/html/rfc7233#section-2)
+///
+/// A representation can be partitioned into subranges according to
+/// various structural units, depending on the structure inherent in the
+/// representation's media type.
+///
+/// # ABNF
+/// ```plain
+/// range-unit       = bytes-unit / other-range-unit
+/// bytes-unit       = "bytes"
+/// other-range-unit = token
+/// ```
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum RangeUnit {
+    /// Indicating byte-range requests are supported.
+    Bytes,
+    /// Reserved as keyword, indicating no ranges are supported.
+    None,
+    /// The given range unit is not registered at IANA.
+    Unregistered(String),
+}
+
+
+impl FromStr for RangeUnit {
+    type Err = ::Error;
+    fn from_str(s: &str) -> ::Result<Self> {
+        match s {
+            "bytes" => Ok(RangeUnit::Bytes),
+            "none" => Ok(RangeUnit::None),
+            // FIXME: Check if s is really a Token
+            _ => Ok(RangeUnit::Unregistered(s.to_owned())),
+        }
+    }
+}
+
+impl Display for RangeUnit {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            RangeUnit::Bytes => f.write_str("bytes"),
+            RangeUnit::None => f.write_str("none"),
+            RangeUnit::Unregistered(ref x) => f.write_str(&x),
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/access_control_allow_credentials.rs
@@ -0,0 +1,89 @@
+use std::fmt::{self, Display};
+use std::str;
+use unicase::UniCase;
+use header::{Header, HeaderFormat};
+
+/// `Access-Control-Allow-Credentials` header, part of
+/// [CORS](http://www.w3.org/TR/cors/#access-control-allow-headers-response-header)
+///
+/// > The Access-Control-Allow-Credentials HTTP response header indicates whether the
+/// > response to request can be exposed when the credentials flag is true. When part
+/// > of the response to an preflight request it indicates that the actual request can
+/// > be made with credentials. The Access-Control-Allow-Credentials HTTP header must
+/// > match the following ABNF:
+///
+/// # ABNF
+/// ```plain
+/// Access-Control-Allow-Credentials: "Access-Control-Allow-Credentials" ":" "true"
+/// ```
+///
+/// Since there is only one acceptable field value, the header struct does not accept
+/// any values at all. Setting an empty `AccessControlAllowCredentials` header is
+/// sufficient. See the examples below.
+///
+/// # Example values
+/// * "true"
+///
+/// # Examples
+/// ```
+/// # extern crate hyper;
+/// # fn main() {
+///
+/// use hyper::header::{Headers, AccessControlAllowCredentials};
+///
+/// let mut headers = Headers::new();
+/// headers.set(AccessControlAllowCredentials);
+/// # }
+/// ```
+#[derive(Clone, PartialEq, Debug)]
+pub struct AccessControlAllowCredentials;
+
+const ACCESS_CONTROL_ALLOW_CREDENTIALS_TRUE: UniCase<&'static str> = UniCase("true");
+
+impl Header for AccessControlAllowCredentials {
+    fn header_name() -> &'static str {
+        "Access-Control-Allow-Credentials"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<AccessControlAllowCredentials> {
+        if raw.len() == 1 {
+            let text = unsafe {
+                // safe because:
+                // 1. we just checked raw.len == 1
+                // 2. we don't actually care if it's utf8, we just want to
+                //    compare the bytes with the "case" normalized. If it's not
+                //    utf8, then the byte comparison will fail, and we'll return
+                //    None. No big deal.
+                str::from_utf8_unchecked(raw.get_unchecked(0))
+            };
+            if UniCase(text) == ACCESS_CONTROL_ALLOW_CREDENTIALS_TRUE {
+                return Ok(AccessControlAllowCredentials);
+            }
+        }
+        Err(::Error::Header)
+    }
+}
+
+impl HeaderFormat for AccessControlAllowCredentials {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str("true")
+    }
+}
+
+impl Display for AccessControlAllowCredentials {
+    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+        self.fmt_header(f)
+    }
+}
+
+#[cfg(test)]
+mod test_access_control_allow_credentials {
+    use std::str;
+    use header::*;
+    use super::AccessControlAllowCredentials as HeaderField;
+    test_header!(works,        vec![b"true"], Some(HeaderField));
+    test_header!(ignores_case, vec![b"True"]);
+    test_header!(not_bool,     vec![b"false"], None);
+    test_header!(only_single,  vec![b"true", b"true"], None);
+    test_header!(no_gibberish, vec!["\u{645}\u{631}\u{62d}\u{628}\u{627}".as_bytes()], None);
+}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/access_control_allow_headers.rs
@@ -0,0 +1,58 @@
+use unicase::UniCase;
+
+header! {
+    /// `Access-Control-Allow-Headers` header, part of
+    /// [CORS](http://www.w3.org/TR/cors/#access-control-allow-headers-response-header)
+    ///
+    /// The `Access-Control-Allow-Headers` header indicates, as part of the
+    /// response to a preflight request, which header field names can be used
+    /// during the actual request.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name
+    /// ```
+    ///
+    /// # Example values
+    /// * `accept-language, date`
+    ///
+    /// # Examples
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate unicase;
+    /// # fn main() {
+    /// // extern crate unicase;
+    ///
+    /// use hyper::header::{Headers, AccessControlAllowHeaders};
+    /// use unicase::UniCase;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AccessControlAllowHeaders(vec![UniCase("date".to_owned())])
+    /// );
+    /// # }
+    /// ```
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate unicase;
+    /// # fn main() {
+    /// // extern crate unicase;
+    ///
+    /// use hyper::header::{Headers, AccessControlAllowHeaders};
+    /// use unicase::UniCase;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AccessControlAllowHeaders(vec![
+    ///         UniCase("accept-language".to_owned()),
+    ///         UniCase("date".to_owned()),
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    (AccessControlAllowHeaders, "Access-Control-Allow-Headers") => (UniCase<String>)*
+
+    test_access_control_allow_headers {
+        test_header!(test1, vec![b"accept-language, date"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/access_control_allow_methods.rs
@@ -0,0 +1,48 @@
+use method::Method;
+
+header! {
+    /// `Access-Control-Allow-Methods` header, part of
+    /// [CORS](http://www.w3.org/TR/cors/#access-control-allow-methods-response-header)
+    ///
+    /// The `Access-Control-Allow-Methods` header indicates, as part of the
+    /// response to a preflight request, which methods can be used during the
+    /// actual request.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Access-Control-Allow-Methods: "Access-Control-Allow-Methods" ":" #Method
+    /// ```
+    ///
+    /// # Example values
+    /// * `PUT, DELETE, XMODIFY`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, AccessControlAllowMethods};
+    /// use hyper::method::Method;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AccessControlAllowMethods(vec![Method::Get])
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, AccessControlAllowMethods};
+    /// use hyper::method::Method;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AccessControlAllowMethods(vec![
+    ///         Method::Get,
+    ///         Method::Post,
+    ///         Method::Patch,
+    ///         Method::Extension("COPY".to_owned()),
+    ///     ])
+    /// );
+    /// ```
+    (AccessControlAllowMethods, "Access-Control-Allow-Methods") => (Method)*
+
+    test_access_control_allow_methods {
+        test_header!(test1, vec![b"PUT, DELETE, XMODIFY"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/access_control_allow_origin.rs
@@ -0,0 +1,98 @@
+use std::fmt::{self, Display};
+
+use header::{Header, HeaderFormat};
+
+/// The `Access-Control-Allow-Origin` response header,
+/// part of [CORS](http://www.w3.org/TR/cors/#access-control-allow-origin-response-header)
+///
+/// The `Access-Control-Allow-Origin` header indicates whether a resource
+/// can be shared based by returning the value of the Origin request header,
+/// "*", or "null" in the response.
+///
+/// # ABNF
+/// ```plain
+/// Access-Control-Allow-Origin = "Access-Control-Allow-Origin" ":" origin-list-or-null | "*"
+/// ```
+///
+/// # Example values
+/// * `null`
+/// * `*`
+/// * `http://google.com/`
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, AccessControlAllowOrigin};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     AccessControlAllowOrigin::Any
+/// );
+/// ```
+/// ```
+/// use hyper::header::{Headers, AccessControlAllowOrigin};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     AccessControlAllowOrigin::Null,
+/// );
+/// ```
+/// ```
+/// use hyper::header::{Headers, AccessControlAllowOrigin};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     AccessControlAllowOrigin::Value("http://hyper.rs".to_owned())
+/// );
+/// ```
+#[derive(Clone, PartialEq, Debug)]
+pub enum AccessControlAllowOrigin {
+    /// Allow all origins
+    Any,
+    /// A hidden origin
+    Null,
+    /// Allow one particular origin
+    Value(String),
+}
+
+impl Header for AccessControlAllowOrigin {
+    fn header_name() -> &'static str {
+        "Access-Control-Allow-Origin"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<AccessControlAllowOrigin> {
+        if raw.len() != 1 {
+            return Err(::Error::Header)
+        }
+        let value = unsafe { raw.get_unchecked(0) };
+        Ok(match &value[..] {
+            b"*" => AccessControlAllowOrigin::Any,
+            b"null" => AccessControlAllowOrigin::Null,
+            _ => AccessControlAllowOrigin::Value(try!(String::from_utf8(value.clone())))
+        })
+    }
+}
+
+impl HeaderFormat for AccessControlAllowOrigin {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            AccessControlAllowOrigin::Any => f.write_str("*"),
+            AccessControlAllowOrigin::Null => f.write_str("null"),
+            AccessControlAllowOrigin::Value(ref url) => Display::fmt(url, f),
+        }
+    }
+}
+
+impl Display for AccessControlAllowOrigin {
+    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+        self.fmt_header(f)
+    }
+}
+
+#[cfg(test)]
+mod test_access_control_allow_orgin {
+    use header::*;
+    use super::AccessControlAllowOrigin as HeaderField;
+    test_header!(test1, vec![b"null"]);
+    test_header!(test2, vec![b"*"]);
+    test_header!(test3, vec![b"http://google.com/"]);
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/access_control_expose_headers.rs
@@ -0,0 +1,60 @@
+use unicase::UniCase;
+
+header! {
+    /// `Access-Control-Expose-Headers` header, part of
+    /// [CORS](http://www.w3.org/TR/cors/#access-control-expose-headers-response-header)
+    ///
+    /// The Access-Control-Expose-Headers header indicates which headers are safe to expose to the
+    /// API of a CORS API specification.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Access-Control-Expose-Headers = "Access-Control-Expose-Headers" ":" #field-name
+    /// ```
+    ///
+    /// # Example values
+    /// * `ETag, Content-Length`
+    ///
+    /// # Examples
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate unicase;
+    /// # fn main() {
+    /// // extern crate unicase;
+    ///
+    /// use hyper::header::{Headers, AccessControlExposeHeaders};
+    /// use unicase::UniCase;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AccessControlExposeHeaders(vec![
+    ///         UniCase("etag".to_owned()),
+    ///         UniCase("content-length".to_owned())
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate unicase;
+    /// # fn main() {
+    /// // extern crate unicase;
+    ///
+    /// use hyper::header::{Headers, AccessControlExposeHeaders};
+    /// use unicase::UniCase;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AccessControlExposeHeaders(vec![
+    ///         UniCase("etag".to_owned()),
+    ///         UniCase("content-length".to_owned())
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    (AccessControlExposeHeaders, "Access-Control-Expose-Headers") => (UniCase<String>)*
+
+    test_access_control_expose_headers {
+        test_header!(test1, vec![b"etag, content-length"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/access_control_max_age.rs
@@ -0,0 +1,28 @@
+header! {
+    /// `Access-Control-Max-Age` header, part of
+    /// [CORS](http://www.w3.org/TR/cors/#access-control-max-age-response-header)
+    ///
+    /// The `Access-Control-Max-Age` header indicates how long the results of a
+    /// preflight request can be cached in a preflight result cache.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Access-Control-Max-Age = \"Access-Control-Max-Age\" \":\" delta-seconds
+    /// ```
+    ///
+    /// # Example values
+    /// * `531`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, AccessControlMaxAge};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(AccessControlMaxAge(1728000u32));
+    /// ```
+    (AccessControlMaxAge, "Access-Control-Max-Age") => [u32]
+
+    test_access_control_max_age {
+        test_header!(test1, vec![b"531"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/access_control_request_headers.rs
@@ -0,0 +1,58 @@
+use unicase::UniCase;
+
+header! {
+    /// `Access-Control-Request-Headers` header, part of
+    /// [CORS](http://www.w3.org/TR/cors/#access-control-request-headers-request-header)
+    ///
+    /// The `Access-Control-Request-Headers` header indicates which headers will
+    /// be used in the actual request as part of the preflight request.
+    /// during the actual request.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name
+    /// ```
+    ///
+    /// # Example values
+    /// * `accept-language, date`
+    ///
+    /// # Examples
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate unicase;
+    /// # fn main() {
+    /// // extern crate unicase;
+    ///
+    /// use hyper::header::{Headers, AccessControlRequestHeaders};
+    /// use unicase::UniCase;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AccessControlRequestHeaders(vec![UniCase("date".to_owned())])
+    /// );
+    /// # }
+    /// ```
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate unicase;
+    /// # fn main() {
+    /// // extern crate unicase;
+    ///
+    /// use hyper::header::{Headers, AccessControlRequestHeaders};
+    /// use unicase::UniCase;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     AccessControlRequestHeaders(vec![
+    ///         UniCase("accept-language".to_owned()),
+    ///         UniCase("date".to_owned()),
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    (AccessControlRequestHeaders, "Access-Control-Request-Headers") => (UniCase<String>)*
+
+    test_access_control_request_headers {
+        test_header!(test1, vec![b"accept-language, date"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/access_control_request_method.rs
@@ -0,0 +1,30 @@
+use method::Method;
+
+header! {
+    /// `Access-Control-Request-Method` header, part of
+    /// [CORS](http://www.w3.org/TR/cors/#access-control-request-method-request-header)
+    /// 
+    /// The `Access-Control-Request-Method` header indicates which method will be
+    /// used in the actual request as part of the preflight request.
+    /// # ABNF
+    /// ```plain
+    /// Access-Control-Request-Method: \"Access-Control-Request-Method\" \":\" Method
+    /// ```
+    /// 
+    /// # Example values
+    /// * `GET`
+    /// 
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, AccessControlRequestMethod};
+    /// use hyper::method::Method;
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(AccessControlRequestMethod(Method::Get));
+    /// ```
+    (AccessControlRequestMethod, "Access-Control-Request-Method") => [Method]
+
+    test_access_control_request_method {
+        test_header!(test1, vec![b"GET"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/allow.rs
@@ -0,0 +1,76 @@
+use method::Method;
+
+header! {
+    /// `Allow` header, defined in [RFC7231](http://tools.ietf.org/html/rfc7231#section-7.4.1)
+    ///
+    /// The `Allow` header field lists the set of methods advertised as
+    /// supported by the target resource.  The purpose of this field is
+    /// strictly to inform the recipient of valid request methods associated
+    /// with the resource.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Allow = #method
+    /// ```
+    ///
+    /// # Example values
+    /// * `GET, HEAD, PUT`
+    /// * `OPTIONS, GET, PUT, POST, DELETE, HEAD, TRACE, CONNECT, PATCH, fOObAr`
+    /// * ``
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, Allow};
+    /// use hyper::method::Method;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     Allow(vec![Method::Get])
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, Allow};
+    /// use hyper::method::Method;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     Allow(vec![
+    ///         Method::Get,
+    ///         Method::Post,
+    ///         Method::Patch,
+    ///         Method::Extension("COPY".to_owned()),
+    ///     ])
+    /// );
+    /// ```
+    (Allow, "Allow") => (Method)*
+
+    test_allow {
+        // From the RFC
+        test_header!(
+            test1,
+            vec![b"GET, HEAD, PUT"],
+            Some(HeaderField(vec![Method::Get, Method::Head, Method::Put])));
+        // Own tests
+        test_header!(
+            test2,
+            vec![b"OPTIONS, GET, PUT, POST, DELETE, HEAD, TRACE, CONNECT, PATCH, fOObAr"],
+            Some(HeaderField(vec![
+                Method::Options,
+                Method::Get,
+                Method::Put,
+                Method::Post,
+                Method::Delete,
+                Method::Head,
+                Method::Trace,
+                Method::Connect,
+                Method::Patch,
+                Method::Extension("fOObAr".to_owned())])));
+        test_header!(
+            test3,
+            vec![b""],
+            Some(HeaderField(Vec::<Method>::new())));
+    }
+}
+
+bench_header!(bench,
+    Allow, { vec![b"OPTIONS,GET,PUT,POST,DELETE,HEAD,TRACE,CONNECT,PATCH,fOObAr".to_vec()] });
copy from third_party/rust/hyper/src/header/common/authorization.rs
copy to third_party/rust/hyper-0.10.10/src/header/common/authorization.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/cache_control.rs
@@ -0,0 +1,211 @@
+use std::fmt;
+use std::str::FromStr;
+use header::{Header, HeaderFormat};
+use header::parsing::{from_comma_delimited, fmt_comma_delimited};
+
+/// `Cache-Control` header, defined in [RFC7234](https://tools.ietf.org/html/rfc7234#section-5.2)
+///
+/// The `Cache-Control` header field is used to specify directives for
+/// caches along the request/response chain.  Such cache directives are
+/// unidirectional in that the presence of a directive in a request does
+/// not imply that the same directive is to be given in the response.
+///
+/// # ABNF
+/// ```plain
+/// Cache-Control   = 1#cache-directive
+/// cache-directive = token [ "=" ( token / quoted-string ) ]
+/// ```
+///
+/// # Example values
+/// * `no-cache`
+/// * `private, community="UCI"`
+/// * `max-age=30`
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, CacheControl, CacheDirective};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     CacheControl(vec![CacheDirective::MaxAge(86400u32)])
+/// );
+/// ```
+/// ```
+/// use hyper::header::{Headers, CacheControl, CacheDirective};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     CacheControl(vec![
+///         CacheDirective::NoCache,
+///         CacheDirective::Private,
+///         CacheDirective::MaxAge(360u32),
+///         CacheDirective::Extension("foo".to_owned(),
+///                                   Some("bar".to_owned())),
+///     ])
+/// );
+/// ```
+#[derive(PartialEq, Clone, Debug)]
+pub struct CacheControl(pub Vec<CacheDirective>);
+
+__hyper__deref!(CacheControl => Vec<CacheDirective>);
+
+impl Header for CacheControl {
+    fn header_name() -> &'static str {
+        "Cache-Control"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<CacheControl> {
+        let directives = try!(from_comma_delimited(raw));
+        if !directives.is_empty() {
+            Ok(CacheControl(directives))
+        } else {
+            Err(::Error::Header)
+        }
+    }
+}
+
+impl HeaderFormat for CacheControl {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(self, f)
+    }
+}
+
+impl fmt::Display for CacheControl {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt_comma_delimited(f, &self[..])
+    }
+}
+
+/// `CacheControl` contains a list of these directives.
+#[derive(PartialEq, Clone, Debug)]
+pub enum CacheDirective {
+    /// "no-cache"
+    NoCache,
+    /// "no-store"
+    NoStore,
+    /// "no-transform"
+    NoTransform,
+    /// "only-if-cached"
+    OnlyIfCached,
+
+    // request directives
+    /// "max-age=delta"
+    MaxAge(u32),
+    /// "max-stale=delta"
+    MaxStale(u32),
+    /// "min-fresh=delta"
+    MinFresh(u32),
+
+    // response directives
+    /// "must-revalidate"
+    MustRevalidate,
+    /// "public"
+    Public,
+    /// "private"
+    Private,
+    /// "proxy-revalidate"
+    ProxyRevalidate,
+    /// "s-maxage=delta"
+    SMaxAge(u32),
+
+    /// Extension directives. Optionally include an argument.
+    Extension(String, Option<String>)
+}
+
+impl fmt::Display for CacheDirective {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::CacheDirective::*;
+        fmt::Display::fmt(match *self {
+            NoCache => "no-cache",
+            NoStore => "no-store",
+            NoTransform => "no-transform",
+            OnlyIfCached => "only-if-cached",
+
+            MaxAge(secs) => return write!(f, "max-age={}", secs),
+            MaxStale(secs) => return write!(f, "max-stale={}", secs),
+            MinFresh(secs) => return write!(f, "min-fresh={}", secs),
+
+            MustRevalidate => "must-revalidate",
+            Public => "public",
+            Private => "private",
+            ProxyRevalidate => "proxy-revalidate",
+            SMaxAge(secs) => return write!(f, "s-maxage={}", secs),
+
+            Extension(ref name, None) => &name[..],
+            Extension(ref name, Some(ref arg)) => return write!(f, "{}={}", name, arg),
+
+        }, f)
+    }
+}
+
+impl FromStr for CacheDirective {
+    type Err = Option<<u32 as FromStr>::Err>;
+    fn from_str(s: &str) -> Result<CacheDirective, Option<<u32 as FromStr>::Err>> {
+        use self::CacheDirective::*;
+        match s {
+            "no-cache" => Ok(NoCache),
+            "no-store" => Ok(NoStore),
+            "no-transform" => Ok(NoTransform),
+            "only-if-cached" => Ok(OnlyIfCached),
+            "must-revalidate" => Ok(MustRevalidate),
+            "public" => Ok(Public),
+            "private" => Ok(Private),
+            "proxy-revalidate" => Ok(ProxyRevalidate),
+            "" => Err(None),
+            _ => match s.find('=') {
+                Some(idx) if idx+1 < s.len() => match (&s[..idx], (&s[idx+1..]).trim_matches('"')) {
+                    ("max-age" , secs) => secs.parse().map(MaxAge).map_err(Some),
+                    ("max-stale", secs) => secs.parse().map(MaxStale).map_err(Some),
+                    ("min-fresh", secs) => secs.parse().map(MinFresh).map_err(Some),
+                    ("s-maxage", secs) => secs.parse().map(SMaxAge).map_err(Some),
+                    (left, right) => Ok(Extension(left.to_owned(), Some(right.to_owned())))
+                },
+                Some(_) => Err(None),
+                None => Ok(Extension(s.to_owned(), None))
+            }
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use header::Header;
+    use super::*;
+
+    #[test]
+    fn test_parse_multiple_headers() {
+        let cache = Header::parse_header(&[b"no-cache".to_vec(), b"private".to_vec()]);
+        assert_eq!(cache.ok(), Some(CacheControl(vec![CacheDirective::NoCache,
+                                                 CacheDirective::Private])))
+    }
+
+    #[test]
+    fn test_parse_argument() {
+        let cache = Header::parse_header(&[b"max-age=100, private".to_vec()]);
+        assert_eq!(cache.ok(), Some(CacheControl(vec![CacheDirective::MaxAge(100),
+                                                 CacheDirective::Private])))
+    }
+
+    #[test]
+    fn test_parse_quote_form() {
+        let cache = Header::parse_header(&[b"max-age=\"200\"".to_vec()]);
+        assert_eq!(cache.ok(), Some(CacheControl(vec![CacheDirective::MaxAge(200)])))
+    }
+
+    #[test]
+    fn test_parse_extension() {
+        let cache = Header::parse_header(&[b"foo, bar=baz".to_vec()]);
+        assert_eq!(cache.ok(), Some(CacheControl(vec![
+            CacheDirective::Extension("foo".to_owned(), None),
+            CacheDirective::Extension("bar".to_owned(), Some("baz".to_owned()))])))
+    }
+
+    #[test]
+    fn test_parse_bad_syntax() {
+        let cache: ::Result<CacheControl> = Header::parse_header(&[b"foo=".to_vec()]);
+        assert_eq!(cache.ok(), None)
+    }
+}
+
+bench_header!(normal,
+    CacheControl, { vec![b"no-cache, private".to_vec(), b"max-age=100".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/connection.rs
@@ -0,0 +1,143 @@
+use std::fmt::{self, Display};
+use std::str::FromStr;
+use unicase::UniCase;
+
+pub use self::ConnectionOption::{KeepAlive, Close, ConnectionHeader};
+
+const KEEP_ALIVE: UniCase<&'static str> = UniCase("keep-alive");
+const CLOSE: UniCase<&'static str> = UniCase("close");
+
+/// Values that can be in the `Connection` header.
+#[derive(Clone, PartialEq, Debug)]
+pub enum ConnectionOption {
+    /// The `keep-alive` connection value.
+    KeepAlive,
+    /// The `close` connection value.
+    Close,
+    /// Values in the Connection header that are supposed to be names of other Headers.
+    ///
+    /// > When a header field aside from Connection is used to supply control
+    /// > information for or about the current connection, the sender MUST list
+    /// > the corresponding field-name within the Connection header field.
+    // TODO: it would be nice if these "Strings" could be stronger types, since
+    // they are supposed to relate to other Header fields (which we have strong
+    // types for).
+    ConnectionHeader(UniCase<String>),
+}
+
+impl FromStr for ConnectionOption {
+    type Err = ();
+    fn from_str(s: &str) -> Result<ConnectionOption, ()> {
+        if UniCase(s) == KEEP_ALIVE {
+            Ok(KeepAlive)
+        } else if UniCase(s) == CLOSE {
+            Ok(Close)
+        } else {
+            Ok(ConnectionHeader(UniCase(s.to_owned())))
+        }
+    }
+}
+
+impl Display for ConnectionOption {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(match *self {
+            KeepAlive => "keep-alive",
+            Close => "close",
+            ConnectionHeader(UniCase(ref s)) => s.as_ref()
+        })
+    }
+}
+
+header! {
+    /// `Connection` header, defined in
+    /// [RFC7230](http://tools.ietf.org/html/rfc7230#section-6.1)
+    ///
+    /// The `Connection` header field allows the sender to indicate desired
+    /// control options for the current connection.  In order to avoid
+    /// confusing downstream recipients, a proxy or gateway MUST remove or
+    /// replace any received connection options before forwarding the
+    /// message.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Connection        = 1#connection-option
+    /// connection-option = token
+    ///
+    /// # Example values
+    /// * `close`
+    /// * `keep-alive`
+    /// * `upgrade`
+    /// ```
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, Connection};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(Connection::keep_alive());
+    /// ```
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate unicase;
+    /// # fn main() {
+    /// // extern crate unicase;
+    ///
+    /// use hyper::header::{Headers, Connection, ConnectionOption};
+    /// use unicase::UniCase;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     Connection(vec![
+    ///         ConnectionOption::ConnectionHeader(UniCase("upgrade".to_owned())),
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    (Connection, "Connection") => (ConnectionOption)+
+
+    test_connection {
+        test_header!(test1, vec![b"close"]);
+        test_header!(test2, vec![b"keep-alive"]);
+        test_header!(test3, vec![b"upgrade"]);
+    }
+}
+
+impl Connection {
+    /// A constructor to easily create a `Connection: close` header.
+    #[inline]
+    pub fn close() -> Connection {
+        Connection(vec![ConnectionOption::Close])
+    }
+
+    /// A constructor to easily create a `Connection: keep-alive` header.
+    #[inline]
+    pub fn keep_alive() -> Connection {
+        Connection(vec![ConnectionOption::KeepAlive])
+    }
+}
+
+bench_header!(close, Connection, { vec![b"close".to_vec()] });
+bench_header!(keep_alive, Connection, { vec![b"keep-alive".to_vec()] });
+bench_header!(header, Connection, { vec![b"authorization".to_vec()] });
+
+#[cfg(test)]
+mod tests {
+    use super::{Connection,ConnectionHeader};
+    use header::Header;
+    use unicase::UniCase;
+
+    fn parse_option(header: Vec<u8>) -> Connection {
+        let val = vec![header];
+        let connection: Connection = Header::parse_header(&val[..]).unwrap();
+        connection
+    }
+
+    #[test]
+    fn test_parse() {
+        assert_eq!(Connection::close(),parse_option(b"close".to_vec()));
+        assert_eq!(Connection::keep_alive(),parse_option(b"keep-alive".to_vec()));
+        assert_eq!(Connection::keep_alive(),parse_option(b"Keep-Alive".to_vec()));
+        assert_eq!(Connection(vec![ConnectionHeader(UniCase("upgrade".to_owned()))]),
+            parse_option(b"upgrade".to_vec()));
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/content_disposition.rs
@@ -0,0 +1,265 @@
+// # References
+//
+// "The Content-Disposition Header Field" https://www.ietf.org/rfc/rfc2183.txt
+// "The Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)" https://www.ietf.org/rfc/rfc6266.txt
+// "Returning Values from Forms: multipart/form-data" https://www.ietf.org/rfc/rfc2388.txt
+// Browser conformance tests at: http://greenbytes.de/tech/tc2231/
+// IANA assignment: http://www.iana.org/assignments/cont-disp/cont-disp.xhtml
+
+use language_tags::LanguageTag;
+use std::fmt;
+use unicase::UniCase;
+use url::percent_encoding;
+
+use header::{Header, HeaderFormat, parsing};
+use header::parsing::{parse_extended_value, HTTP_VALUE};
+use header::shared::Charset;
+
+/// The implied disposition of the content of the HTTP body
+#[derive(Clone, Debug, PartialEq)]
+pub enum DispositionType {
+    /// Inline implies default processing
+    Inline,
+    /// Attachment implies that the recipient should prompt the user to save the response locally,
+    /// rather than process it normally (as per its media type).
+    Attachment,
+    /// Extension type.  Should be handled by recipients the same way as Attachment
+    Ext(String)
+}
+
+/// A parameter to the disposition type
+#[derive(Clone, Debug, PartialEq)]
+pub enum DispositionParam {
+    /// A Filename consisting of a Charset, an optional LanguageTag, and finally a sequence of
+    /// bytes representing the filename
+    Filename(Charset, Option<LanguageTag>, Vec<u8>),
+    /// Extension type consisting of token and value.  Recipients should ignore unrecognized
+    /// parameters.
+    Ext(String, String)
+}
+
+/// A `Content-Disposition` header, (re)defined in [RFC6266](https://tools.ietf.org/html/rfc6266)
+///
+/// The Content-Disposition response header field is used to convey
+/// additional information about how to process the response payload, and
+/// also can be used to attach additional metadata, such as the filename
+/// to use when saving the response payload locally.
+///
+/// # ABNF
+/// ```plain
+/// content-disposition = "Content-Disposition" ":"
+///                       disposition-type *( ";" disposition-parm )
+///
+/// disposition-type    = "inline" | "attachment" | disp-ext-type
+///                       ; case-insensitive
+///
+/// disp-ext-type       = token
+///
+/// disposition-parm    = filename-parm | disp-ext-parm
+///
+/// filename-parm       = "filename" "=" value
+///                     | "filename*" "=" ext-value
+///
+/// disp-ext-parm       = token "=" value
+///                     | ext-token "=" ext-value
+///
+/// ext-token           = <the characters in token, followed by "*">
+/// ```
+///
+/// # Example
+/// ```
+/// use hyper::header::{Headers, ContentDisposition, DispositionType, DispositionParam, Charset};
+///
+/// let mut headers = Headers::new();
+/// headers.set(ContentDisposition {
+///     disposition: DispositionType::Attachment,
+///     parameters: vec![DispositionParam::Filename(
+///       Charset::Iso_8859_1, // The character set for the bytes of the filename
+///       None, // The optional language tag (see `language-tag` crate)
+///       b"\xa9 Copyright 1989.txt".to_vec() // the actual bytes of the filename
+///     )]
+/// });
+/// ```
+#[derive(Clone, Debug, PartialEq)]
+pub struct ContentDisposition {
+    /// The disposition
+    pub disposition: DispositionType,
+    /// Disposition parameters
+    pub parameters: Vec<DispositionParam>,
+}
+
+impl Header for ContentDisposition {
+    fn header_name() -> &'static str {
+        "Content-Disposition"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<ContentDisposition> {
+        parsing::from_one_raw_str(raw).and_then(|s: String| {
+            let mut sections = s.split(';');
+            let disposition = match sections.next() {
+                Some(s) => s.trim(),
+                None => return Err(::Error::Header),
+            };
+
+            let mut cd = ContentDisposition {
+                disposition: if UniCase(&*disposition) == UniCase("inline") {
+                    DispositionType::Inline
+                } else if UniCase(&*disposition) == UniCase("attachment") {
+                    DispositionType::Attachment
+                } else {
+                    DispositionType::Ext(disposition.to_owned())
+                },
+                parameters: Vec::new(),
+            };
+
+            for section in sections {
+                let mut parts = section.splitn(2, '=');
+
+                let key = if let Some(key) = parts.next() {
+                    key.trim()
+                } else {
+                    return Err(::Error::Header);
+                };
+
+                let val = if let Some(val) = parts.next() {
+                    val.trim()
+                } else {
+                    return Err(::Error::Header);
+                };
+
+                cd.parameters.push(
+                    if UniCase(&*key) == UniCase("filename") {
+                        DispositionParam::Filename(
+                            Charset::Ext("UTF-8".to_owned()), None,
+                            val.trim_matches('"').as_bytes().to_owned())
+                    } else if UniCase(&*key) == UniCase("filename*") {
+                        let extended_value = try!(parse_extended_value(val));
+                        DispositionParam::Filename(extended_value.charset, extended_value.language_tag, extended_value.value)
+                    } else {
+                        DispositionParam::Ext(key.to_owned(), val.trim_matches('"').to_owned())
+                    }
+                );
+            }
+
+            Ok(cd)
+        })
+    }
+}
+
+impl HeaderFormat for ContentDisposition {
+    #[inline]
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&self, f)
+    }
+}
+
+impl fmt::Display for ContentDisposition {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self.disposition {
+            DispositionType::Inline => try!(write!(f, "inline")),
+            DispositionType::Attachment => try!(write!(f, "attachment")),
+            DispositionType::Ext(ref s) => try!(write!(f, "{}", s)),
+        }
+        for param in &self.parameters {
+            match *param {
+                DispositionParam::Filename(ref charset, ref opt_lang, ref bytes) => {
+                    let mut use_simple_format: bool = false;
+                    if opt_lang.is_none() {
+                        if let Charset::Ext(ref ext) = *charset {
+                            if UniCase(&**ext) == UniCase("utf-8") {
+                                use_simple_format = true;
+                            }
+                        }
+                    }
+                    if use_simple_format {
+                        try!(write!(f, "; filename=\"{}\"",
+                                    match String::from_utf8(bytes.clone()) {
+                                        Ok(s) => s,
+                                        Err(_) => return Err(fmt::Error),
+                                    }));
+                    } else {
+                        try!(write!(f, "; filename*={}'", charset));
+                        if let Some(ref lang) = *opt_lang {
+                            try!(write!(f, "{}", lang));
+                        };
+                        try!(write!(f, "'"));
+                        try!(f.write_str(
+                            &percent_encoding::percent_encode(bytes, HTTP_VALUE).to_string()))
+                    }
+                },
+                DispositionParam::Ext(ref k, ref v) => try!(write!(f, "; {}=\"{}\"", k, v)),
+            }
+        }
+        Ok(())
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::{ContentDisposition,DispositionType,DispositionParam};
+    use ::header::Header;
+    use ::header::shared::Charset;
+
+    #[test]
+    fn test_parse_header() {
+        assert!(ContentDisposition::parse_header([b"".to_vec()].as_ref()).is_err());
+
+        let a = [b"form-data; dummy=3; name=upload;\r\n filename=\"sample.png\"".to_vec()];
+        let a: ContentDisposition = ContentDisposition::parse_header(a.as_ref()).unwrap();
+        let b = ContentDisposition {
+            disposition: DispositionType::Ext("form-data".to_owned()),
+            parameters: vec![
+                DispositionParam::Ext("dummy".to_owned(), "3".to_owned()),
+                DispositionParam::Ext("name".to_owned(), "upload".to_owned()),
+                DispositionParam::Filename(
+                    Charset::Ext("UTF-8".to_owned()),
+                    None,
+                    "sample.png".bytes().collect()) ]
+        };
+        assert_eq!(a, b);
+
+        let a = [b"attachment; filename=\"image.jpg\"".to_vec()];
+        let a: ContentDisposition = ContentDisposition::parse_header(a.as_ref()).unwrap();
+        let b = ContentDisposition {
+            disposition: DispositionType::Attachment,
+            parameters: vec![
+                DispositionParam::Filename(
+                    Charset::Ext("UTF-8".to_owned()),
+                    None,
+                    "image.jpg".bytes().collect()) ]
+        };
+        assert_eq!(a, b);
+
+        let a = [b"attachment; filename*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates".to_vec()];
+        let a: ContentDisposition = ContentDisposition::parse_header(a.as_ref()).unwrap();
+        let b = ContentDisposition {
+            disposition: DispositionType::Attachment,
+            parameters: vec![
+                DispositionParam::Filename(
+                    Charset::Ext("UTF-8".to_owned()),
+                    None,
+                    vec![0xc2, 0xa3, 0x20, b'a', b'n', b'd', 0x20,
+                         0xe2, 0x82, 0xac, 0x20, b'r', b'a', b't', b'e', b's']) ]
+        };
+        assert_eq!(a, b);
+    }
+
+    #[test]
+    fn test_display() {
+        let a = [b"attachment; filename*=UTF-8'en'%C2%A3%20and%20%E2%82%AC%20rates".to_vec()];
+        let as_string = ::std::str::from_utf8(&(a[0])).unwrap();
+        let a: ContentDisposition = ContentDisposition::parse_header(a.as_ref()).unwrap();
+        let display_rendered = format!("{}",a);
+        assert_eq!(as_string, display_rendered);
+
+        let a = [b"attachment; filename*=UTF-8''black%20and%20white.csv".to_vec()];
+        let a: ContentDisposition = ContentDisposition::parse_header(a.as_ref()).unwrap();
+        let display_rendered = format!("{}",a);
+        assert_eq!("attachment; filename=\"black and white.csv\"".to_owned(), display_rendered);
+
+        let a = [b"attachment; filename=colourful.csv".to_vec()];
+        let a: ContentDisposition = ContentDisposition::parse_header(a.as_ref()).unwrap();
+        let display_rendered = format!("{}",a);
+        assert_eq!("attachment; filename=\"colourful.csv\"".to_owned(), display_rendered);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/content_encoding.rs
@@ -0,0 +1,50 @@
+use header::Encoding;
+
+header! {
+    /// `Content-Encoding` header, defined in
+    /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-3.1.2.2)
+    /// 
+    /// The `Content-Encoding` header field indicates what content codings
+    /// have been applied to the representation, beyond those inherent in the
+    /// media type, and thus what decoding mechanisms have to be applied in
+    /// order to obtain data in the media type referenced by the Content-Type
+    /// header field.  Content-Encoding is primarily used to allow a
+    /// representation's data to be compressed without losing the identity of
+    /// its underlying media type.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// Content-Encoding = 1#content-coding
+    /// ```
+    /// 
+    /// # Example values
+    /// * `gzip`
+    /// 
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, ContentEncoding, Encoding};
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(ContentEncoding(vec![Encoding::Chunked]));
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, ContentEncoding, Encoding};
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     ContentEncoding(vec![
+    ///         Encoding::Gzip,
+    ///         Encoding::Chunked,
+    ///     ])
+    /// );
+    /// ```
+    (ContentEncoding, "Content-Encoding") => (Encoding)+
+
+    test_content_encoding {
+        /// Testcase from the RFC
+        test_header!(test1, vec![b"gzip"], Some(ContentEncoding(vec![Encoding::Gzip])));
+    }
+}
+
+bench_header!(single, ContentEncoding, { vec![b"gzip".to_vec()] });
+bench_header!(multiple, ContentEncoding, { vec![b"gzip, deflate".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/content_language.rs
@@ -0,0 +1,59 @@
+use language_tags::LanguageTag;
+use header::QualityItem;
+
+header! {
+    /// `Content-Language` header, defined in
+    /// [RFC7231](https://tools.ietf.org/html/rfc7231#section-3.1.3.2)
+    /// 
+    /// The `Content-Language` header field describes the natural language(s)
+    /// of the intended audience for the representation.  Note that this
+    /// might not be equivalent to all the languages used within the
+    /// representation.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// Content-Language = 1#language-tag
+    /// ```
+    /// 
+    /// # Example values
+    /// * `da`
+    /// * `mi, en`
+    /// 
+    /// # Examples
+    /// ```
+    /// # extern crate hyper;
+    /// # #[macro_use] extern crate language_tags;
+    /// # use hyper::header::{Headers, ContentLanguage, qitem};
+    /// # 
+    /// # fn main() {
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     ContentLanguage(vec![
+    ///         qitem(langtag!(en)),
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    /// ```
+    /// # extern crate hyper;
+    /// # #[macro_use] extern crate language_tags;
+    /// # use hyper::header::{Headers, ContentLanguage, qitem};
+    /// # 
+    /// # fn main() {
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     ContentLanguage(vec![
+    ///         qitem(langtag!(da)),
+    ///         qitem(langtag!(en;;;GB)),
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    (ContentLanguage, "Content-Language") => (QualityItem<LanguageTag>)+
+
+    test_content_language {
+        test_header!(test1, vec![b"da"]);
+        test_header!(test2, vec![b"mi, en"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/content_length.rs
@@ -0,0 +1,94 @@
+use std::fmt;
+
+use header::{HeaderFormat, Header, parsing};
+
+/// `Content-Length` header, defined in
+/// [RFC7230](http://tools.ietf.org/html/rfc7230#section-3.3.2)
+/// 
+/// When a message does not have a `Transfer-Encoding` header field, a
+/// Content-Length header field can provide the anticipated size, as a
+/// decimal number of octets, for a potential payload body.  For messages
+/// that do include a payload body, the Content-Length field-value
+/// provides the framing information necessary for determining where the
+/// body (and message) ends.  For messages that do not include a payload
+/// body, the Content-Length indicates the size of the selected
+/// representation.
+/// 
+/// # ABNF
+/// ```plain
+/// Content-Length = 1*DIGIT
+/// ```
+/// 
+/// # Example values
+/// * `3495`
+/// 
+/// # Example
+/// ```
+/// use hyper::header::{Headers, ContentLength};
+/// 
+/// let mut headers = Headers::new();
+/// headers.set(ContentLength(1024u64));
+/// ```
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct ContentLength(pub u64);
+
+impl Header for ContentLength {
+    #[inline]
+    fn header_name() -> &'static str {
+        "Content-Length"
+    }
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<ContentLength> {
+        // If multiple Content-Length headers were sent, everything can still
+        // be alright if they all contain the same value, and all parse
+        // correctly. If not, then it's an error.
+        raw.iter()
+            .map(::std::ops::Deref::deref)
+            .map(parsing::from_raw_str)
+            .fold(None, |prev, x| {
+                match (prev, x) {
+                    (None, x) => Some(x),
+                    (e@Some(Err(_)), _ ) => e,
+                    (Some(Ok(prev)), Ok(x)) if prev == x => Some(Ok(prev)),
+                    _ => Some(Err(::Error::Header))
+                }
+            })
+            .unwrap_or(Err(::Error::Header))
+            .map(ContentLength)
+    }
+}
+
+impl HeaderFormat for ContentLength {
+    #[inline]
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&self.0, f)
+    }
+}
+
+impl fmt::Display for ContentLength {
+    #[inline]
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&self.0, f)
+    }
+}
+
+__hyper__deref!(ContentLength => u64);
+
+__hyper__tm!(ContentLength, tests {
+    // Testcase from RFC
+    test_header!(test1, vec![b"3495"], Some(HeaderField(3495)));
+
+    test_header!(test_invalid, vec![b"34v95"], None);
+
+    // Can't use the test_header macro because "5, 5" gets cleaned to "5".
+    #[test]
+    fn test_duplicates() {
+        let parsed = HeaderField::parse_header(&[b"5"[..].into(),
+                                                 b"5"[..].into()]).unwrap();
+        assert_eq!(parsed, HeaderField(5));
+        assert_eq!(format!("{}", parsed), "5");
+    }
+
+    test_header!(test_duplicates_vary, vec![b"5", b"6", b"5"], None);
+});
+
+bench_header!(bench, ContentLength, { vec![b"42349984".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/content_range.rs
@@ -0,0 +1,189 @@
+use std::fmt::{self, Display};
+use std::str::FromStr;
+
+header! {
+    /// `Content-Range` header, defined in
+    /// [RFC7233](http://tools.ietf.org/html/rfc7233#section-4.2)
+    (ContentRange, "Content-Range") => [ContentRangeSpec]
+
+    test_content_range {
+        test_header!(test_bytes,
+            vec![b"bytes 0-499/500"],
+            Some(ContentRange(ContentRangeSpec::Bytes {
+                range: Some((0, 499)),
+                instance_length: Some(500)
+            })));
+
+        test_header!(test_bytes_unknown_len,
+            vec![b"bytes 0-499/*"],
+            Some(ContentRange(ContentRangeSpec::Bytes {
+                range: Some((0, 499)),
+                instance_length: None
+            })));
+
+        test_header!(test_bytes_unknown_range,
+            vec![b"bytes */500"],
+            Some(ContentRange(ContentRangeSpec::Bytes {
+                range: None,
+                instance_length: Some(500)
+            })));
+
+        test_header!(test_unregistered,
+            vec![b"seconds 1-2"],
+            Some(ContentRange(ContentRangeSpec::Unregistered {
+                unit: "seconds".to_owned(),
+                resp: "1-2".to_owned()
+            })));
+
+        test_header!(test_no_len,
+            vec![b"bytes 0-499"],
+            None::<ContentRange>);
+
+        test_header!(test_only_unit,
+            vec![b"bytes"],
+            None::<ContentRange>);
+
+        test_header!(test_end_less_than_start,
+            vec![b"bytes 499-0/500"],
+            None::<ContentRange>);
+
+        test_header!(test_blank,
+            vec![b""],
+            None::<ContentRange>);
+
+        test_header!(test_bytes_many_spaces,
+            vec![b"bytes 1-2/500 3"],
+            None::<ContentRange>);
+
+        test_header!(test_bytes_many_slashes,
+            vec![b"bytes 1-2/500/600"],
+            None::<ContentRange>);
+
+        test_header!(test_bytes_many_dashes,
+            vec![b"bytes 1-2-3/500"],
+            None::<ContentRange>);
+
+    }
+}
+
+
+/// Content-Range, described in [RFC7233](https://tools.ietf.org/html/rfc7233#section-4.2)
+///
+/// # ABNF
+/// ```plain
+/// Content-Range       = byte-content-range
+///                     / other-content-range
+///
+/// byte-content-range  = bytes-unit SP
+///                       ( byte-range-resp / unsatisfied-range )
+///
+/// byte-range-resp     = byte-range "/" ( complete-length / "*" )
+/// byte-range          = first-byte-pos "-" last-byte-pos
+/// unsatisfied-range   = "*/" complete-length
+///
+/// complete-length     = 1*DIGIT
+///
+/// other-content-range = other-range-unit SP other-range-resp
+/// other-range-resp    = *CHAR
+/// ```
+#[derive(PartialEq, Clone, Debug)]
+pub enum ContentRangeSpec {
+    /// Byte range
+    Bytes {
+        /// First and last bytes of the range, omitted if request could not be
+        /// satisfied
+        range: Option<(u64, u64)>,
+
+        /// Total length of the instance, can be omitted if unknown
+        instance_length: Option<u64>
+    },
+
+    /// Custom range, with unit not registered at IANA
+    Unregistered {
+        /// other-range-unit
+        unit: String,
+
+        /// other-range-resp
+        resp: String
+    }
+}
+
+fn split_in_two(s: &str, separator: char) -> Option<(&str, &str)> {
+    let mut iter = s.splitn(2, separator);
+    match (iter.next(), iter.next()) {
+        (Some(a), Some(b)) => Some((a, b)),
+        _ => None
+    }
+}
+
+impl FromStr for ContentRangeSpec {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<Self> {
+        let res = match split_in_two(s, ' ') {
+            Some(("bytes", resp)) => {
+                let (range, instance_length) = try!(split_in_two(resp, '/').ok_or(::Error::Header));
+
+                let instance_length = if instance_length == "*" {
+                    None
+                } else {
+                    Some(try!(instance_length.parse().map_err(|_| ::Error::Header)))
+                };
+
+                let range = if range == "*" {
+                    None
+                } else {
+                    let (first_byte, last_byte) = try!(split_in_two(range, '-').ok_or(::Error::Header));
+                    let first_byte = try!(first_byte.parse().map_err(|_| ::Error::Header));
+                    let last_byte = try!(last_byte.parse().map_err(|_| ::Error::Header));
+                    if last_byte < first_byte {
+                        return Err(::Error::Header);
+                    }
+                    Some((first_byte, last_byte))
+                };
+
+                ContentRangeSpec::Bytes {
+                    range: range,
+                    instance_length: instance_length
+                }
+            }
+            Some((unit, resp)) => {
+                ContentRangeSpec::Unregistered {
+                    unit: unit.to_owned(),
+                    resp: resp.to_owned()
+                }
+            }
+            _ => return Err(::Error::Header)
+        };
+        Ok(res)
+    }
+}
+
+impl Display for ContentRangeSpec {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            ContentRangeSpec::Bytes { range, instance_length } => {
+                try!(f.write_str("bytes "));
+                match range {
+                    Some((first_byte, last_byte)) => {
+                        try!(write!(f, "{}-{}", first_byte, last_byte));
+                    },
+                    None => {
+                        try!(f.write_str("*"));
+                    }
+                };
+                try!(f.write_str("/"));
+                if let Some(v) = instance_length {
+                    write!(f, "{}", v)
+                } else {
+                    f.write_str("*")
+                }
+            }
+            ContentRangeSpec::Unregistered { ref unit, ref resp } => {
+                try!(f.write_str(&unit));
+                try!(f.write_str(" "));
+                f.write_str(&resp)
+            }
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/content_type.rs
@@ -0,0 +1,97 @@
+use mime::Mime;
+
+header! {
+    /// `Content-Type` header, defined in
+    /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-3.1.1.5)
+    /// 
+    /// The `Content-Type` header field indicates the media type of the
+    /// associated representation: either the representation enclosed in the
+    /// message payload or the selected representation, as determined by the
+    /// message semantics.  The indicated media type defines both the data
+    /// format and how that data is intended to be processed by a recipient,
+    /// within the scope of the received message semantics, after any content
+    /// codings indicated by Content-Encoding are decoded.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// Content-Type = media-type
+    /// ```
+    /// 
+    /// # Example values
+    /// * `text/html; charset=ISO-8859-4`
+    /// 
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, ContentType};
+    /// use hyper::mime::{Mime, TopLevel, SubLevel};
+    /// 
+    /// let mut headers = Headers::new();
+    /// 
+    /// headers.set(
+    ///     ContentType(Mime(TopLevel::Text, SubLevel::Html, vec![]))
+    /// );
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, ContentType};
+    /// use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value};
+    /// 
+    /// let mut headers = Headers::new();
+    /// 
+    /// headers.set(
+    ///     ContentType(Mime(TopLevel::Application, SubLevel::Json,
+    ///                      vec![(Attr::Charset, Value::Utf8)]))
+    /// );
+    /// ```
+    (ContentType, "Content-Type") => [Mime]
+
+    test_content_type {
+        test_header!(
+            test1,
+            // FIXME: Should be b"text/html; charset=ISO-8859-4" but mime crate lowercases
+            // the whole value so parsing and formatting the value gives a different result
+            vec![b"text/html; charset=iso-8859-4"],
+            Some(HeaderField(Mime(
+                TopLevel::Text,
+                SubLevel::Html,
+                vec![(Attr::Charset, Value::Ext("iso-8859-4".to_owned()))]))));
+    }
+}
+
+impl ContentType {
+    /// A constructor  to easily create a `Content-Type: application/json` header.
+    #[inline]
+    pub fn json() -> ContentType {
+        ContentType(mime!(Application/Json))
+    }
+
+    /// A constructor  to easily create a `Content-Type: text/plain; charset=utf-8` header.
+    #[inline]
+    pub fn plaintext() -> ContentType {
+        ContentType(mime!(Text/Plain; Charset=Utf8))
+    }
+
+    /// A constructor  to easily create a `Content-Type: text/html; charset=utf-8` header.
+    #[inline]
+    pub fn html() -> ContentType {
+        ContentType(mime!(Text/Html; Charset=Utf8))
+    }
+
+    /// A constructor  to easily create a `Content-Type: application/www-form-url-encoded` header.
+    #[inline]
+    pub fn form_url_encoded() -> ContentType {
+        ContentType(mime!(Application/WwwFormUrlEncoded))
+    }
+    /// A constructor  to easily create a `Content-Type: image/jpeg` header.
+    #[inline]
+    pub fn jpeg() -> ContentType {
+        ContentType(mime!(Image/Jpeg))
+    }
+
+    /// A constructor  to easily create a `Content-Type: image/png` header.
+    #[inline]
+    pub fn png() -> ContentType {
+        ContentType(mime!(Image/Png))
+    }
+}
+
+bench_header!(bench, ContentType, { vec![b"application/json; charset=utf-8".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/cookie.rs
@@ -0,0 +1,70 @@
+use header::{Header, HeaderFormat};
+use std::fmt::{self, Display};
+use std::str::from_utf8;
+
+/// `Cookie` header, defined in [RFC6265](http://tools.ietf.org/html/rfc6265#section-5.4)
+///
+/// If the user agent does attach a Cookie header field to an HTTP
+/// request, the user agent must send the cookie-string
+/// as the value of the header field.
+///
+/// When the user agent generates an HTTP request, the user agent MUST NOT
+/// attach more than one Cookie header field.
+///
+/// # Example values
+/// * `SID=31d4d96e407aad42`
+/// * `SID=31d4d96e407aad42; lang=en-US`
+///
+/// # Example
+/// ```
+/// use hyper::header::{Headers, Cookie};
+///
+/// let mut headers = Headers::new();
+///
+/// headers.set(
+///    Cookie(vec![
+///        String::from("foo=bar")
+///    ])
+/// );
+/// ```
+#[derive(Clone, PartialEq, Debug)]
+pub struct Cookie(pub Vec<String>);
+
+__hyper__deref!(Cookie => Vec<String>);
+
+impl Header for Cookie {
+    fn header_name() -> &'static str {
+        "Cookie"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<Cookie> {
+        let mut cookies = Vec::with_capacity(raw.len());
+        for cookies_raw in raw.iter() {
+            let cookies_str = try!(from_utf8(&cookies_raw[..]));
+            for cookie_str in cookies_str.split(';') {
+                cookies.push(cookie_str.trim().to_owned())
+            }
+        }
+
+        if !cookies.is_empty() {
+            Ok(Cookie(cookies))
+        } else {
+            Err(::Error::Header)
+        }
+    }
+}
+
+impl HeaderFormat for Cookie {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let cookies = &self.0;
+        for (i, cookie) in cookies.iter().enumerate() {
+            if i != 0 {
+                try!(f.write_str("; "));
+            }
+            try!(Display::fmt(&cookie, f));
+        }
+        Ok(())
+    }
+}
+
+bench_header!(bench, Cookie, { vec![b"foo=bar; baz=quux".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/date.rs
@@ -0,0 +1,40 @@
+use header::HttpDate;
+
+header! {
+    /// `Date` header, defined in [RFC7231](http://tools.ietf.org/html/rfc7231#section-7.1.1.2)
+    /// 
+    /// The `Date` header field represents the date and time at which the
+    /// message was originated.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// Date = HTTP-date
+    /// ```
+    /// 
+    /// # Example values
+    /// * `Tue, 15 Nov 1994 08:12:31 GMT`
+    /// 
+    /// # Example
+    /// ```
+    /// # extern crate time;
+    /// # extern crate hyper;
+    /// # fn main() {
+    /// // extern crate time;
+    /// 
+    /// use hyper::header::{Headers, Date, HttpDate};
+    /// use time;
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(Date(HttpDate(time::now())));
+    /// # }
+    /// ```
+    (Date, "Date") => [HttpDate]
+
+    test_date {
+        test_header!(test1, vec![b"Tue, 15 Nov 1994 08:12:31 GMT"]);
+    }
+}
+
+bench_header!(imf_fixdate, Date, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
+bench_header!(rfc_850, Date, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
+bench_header!(asctime, Date, { vec![b"Sun Nov  6 08:49:37 1994".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/etag.rs
@@ -0,0 +1,89 @@
+use header::EntityTag;
+
+header! {
+    /// `ETag` header, defined in [RFC7232](http://tools.ietf.org/html/rfc7232#section-2.3)
+    ///
+    /// The `ETag` header field in a response provides the current entity-tag
+    /// for the selected representation, as determined at the conclusion of
+    /// handling the request.  An entity-tag is an opaque validator for
+    /// differentiating between multiple representations of the same
+    /// resource, regardless of whether those multiple representations are
+    /// due to resource state changes over time, content negotiation
+    /// resulting in multiple representations being valid at the same time,
+    /// or both.  An entity-tag consists of an opaque quoted string, possibly
+    /// prefixed by a weakness indicator.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// ETag       = entity-tag
+    /// ```
+    ///
+    /// # Example values
+    /// * `"xyzzy"`
+    /// * `W/"xyzzy"`
+    /// * `""`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, ETag, EntityTag};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(ETag(EntityTag::new(false, "xyzzy".to_owned())));
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, ETag, EntityTag};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(ETag(EntityTag::new(true, "xyzzy".to_owned())));
+    /// ```
+    (ETag, "ETag") => [EntityTag]
+
+    test_etag {
+        // From the RFC
+        test_header!(test1,
+            vec![b"\"xyzzy\""],
+            Some(ETag(EntityTag::new(false, "xyzzy".to_owned()))));
+        test_header!(test2,
+            vec![b"W/\"xyzzy\""],
+            Some(ETag(EntityTag::new(true, "xyzzy".to_owned()))));
+        test_header!(test3,
+            vec![b"\"\""],
+            Some(ETag(EntityTag::new(false, "".to_owned()))));
+        // Own tests
+        test_header!(test4,
+            vec![b"\"foobar\""],
+            Some(ETag(EntityTag::new(false, "foobar".to_owned()))));
+        test_header!(test5,
+            vec![b"\"\""],
+            Some(ETag(EntityTag::new(false, "".to_owned()))));
+        test_header!(test6,
+            vec![b"W/\"weak-etag\""],
+            Some(ETag(EntityTag::new(true, "weak-etag".to_owned()))));
+        test_header!(test7,
+            vec![b"W/\"\x65\x62\""],
+            Some(ETag(EntityTag::new(true, "\u{0065}\u{0062}".to_owned()))));
+        test_header!(test8,
+            vec![b"W/\"\""],
+            Some(ETag(EntityTag::new(true, "".to_owned()))));
+        test_header!(test9,
+            vec![b"no-dquotes"],
+            None::<ETag>);
+        test_header!(test10,
+            vec![b"w/\"the-first-w-is-case-sensitive\""],
+            None::<ETag>);
+        test_header!(test11,
+            vec![b""],
+            None::<ETag>);
+        test_header!(test12,
+            vec![b"\"unmatched-dquotes1"],
+            None::<ETag>);
+        test_header!(test13,
+            vec![b"unmatched-dquotes2\""],
+            None::<ETag>);
+        test_header!(test14,
+            vec![b"matched-\"dquotes\""],
+            None::<ETag>);
+    }
+}
+
+bench_header!(bench, ETag, { vec![b"W/\"nonemptytag\"".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/expect.rs
@@ -0,0 +1,68 @@
+use std::fmt;
+use std::str;
+
+use unicase::UniCase;
+
+use header::{Header, HeaderFormat};
+
+/// The `Expect` header.
+///
+/// > The "Expect" header field in a request indicates a certain set of
+/// > behaviors (expectations) that need to be supported by the server in
+/// > order to properly handle this request.  The only such expectation
+/// > defined by this specification is 100-continue.
+/// >
+/// >    Expect  = "100-continue"
+///
+/// # Example
+/// ```
+/// use hyper::header::{Headers, Expect};
+/// let mut headers = Headers::new();
+/// headers.set(Expect::Continue);
+/// ```
+#[derive(Copy, Clone, PartialEq, Debug)]
+pub enum Expect {
+    /// The value `100-continue`.
+    Continue
+}
+
+const EXPECT_CONTINUE: UniCase<&'static str> = UniCase("100-continue");
+
+impl Header for Expect {
+    fn header_name() -> &'static str {
+        "Expect"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<Expect> {
+        if raw.len() == 1 {
+            let text = unsafe {
+                // safe because:
+                // 1. we just checked raw.len == 1
+                // 2. we don't actually care if it's utf8, we just want to
+                //    compare the bytes with the "case" normalized. If it's not
+                //    utf8, then the byte comparison will fail, and we'll return
+                //    None. No big deal.
+                str::from_utf8_unchecked(raw.get_unchecked(0))
+            };
+            if UniCase(text) == EXPECT_CONTINUE {
+                Ok(Expect::Continue)
+            } else {
+                Err(::Error::Header)
+            }
+        } else {
+            Err(::Error::Header)
+        }
+    }
+}
+
+impl HeaderFormat for Expect {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(self, f)
+    }
+}
+
+impl fmt::Display for Expect {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str("100-continue")
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/expires.rs
@@ -0,0 +1,45 @@
+use header::HttpDate;
+
+header! {
+    /// `Expires` header, defined in [RFC7234](http://tools.ietf.org/html/rfc7234#section-5.3)
+    /// 
+    /// The `Expires` header field gives the date/time after which the
+    /// response is considered stale.
+    /// 
+    /// The presence of an Expires field does not imply that the original
+    /// resource will change or cease to exist at, before, or after that
+    /// time.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// Expires = HTTP-date
+    /// ```
+    /// 
+    /// # Example values
+    /// * `Thu, 01 Dec 1994 16:00:00 GMT`
+    /// 
+    /// # Example
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate time;
+    /// # fn main() {
+    /// // extern crate time;
+    /// 
+    /// use hyper::header::{Headers, Expires, HttpDate};
+    /// use time::{self, Duration};
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(Expires(HttpDate(time::now() + Duration::days(1))));
+    /// # }
+    /// ```
+    (Expires, "Expires") => [HttpDate]
+
+    test_expires {
+        // Testcase from RFC
+        test_header!(test1, vec![b"Thu, 01 Dec 1994 16:00:00 GMT"]);
+    }
+}
+
+bench_header!(imf_fixdate, Expires, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
+bench_header!(rfc_850, Expires, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
+bench_header!(asctime, Expires, { vec![b"Sun Nov  6 08:49:37 1994".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/from.rs
@@ -0,0 +1,26 @@
+header! {
+    /// `From` header, defined in [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.5.1)
+    ///
+    /// The `From` header field contains an Internet email address for a
+    /// human user who controls the requesting user agent.  The address ought
+    /// to be machine-usable.
+    /// # ABNF
+    /// ```plain
+    /// From    = mailbox
+    /// mailbox = <mailbox, see [RFC5322], Section 3.4>
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// use hyper::header::{Headers, From};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(From("webmaster@example.org".to_owned()));
+    /// ```
+    // FIXME: Maybe use mailbox?
+    (From, "From") => [String]
+
+    test_from {
+        test_header!(test1, vec![b"webmaster@example.org"]);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/host.rs
@@ -0,0 +1,145 @@
+use header::{Header, HeaderFormat};
+use std::fmt;
+use std::str::FromStr;
+use header::parsing::from_one_raw_str;
+use url::idna::domain_to_unicode;
+
+/// The `Host` header.
+///
+/// HTTP/1.1 requires that all requests include a `Host` header, and so hyper
+/// client requests add one automatically.
+///
+/// Currently is just a String, but it should probably become a better type,
+/// like `url::Host` or something.
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, Host};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     Host{
+///         hostname: "hyper.rs".to_owned(),
+///         port: None,
+///     }
+/// );
+/// ```
+/// ```
+/// use hyper::header::{Headers, Host};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     Host{
+///         hostname: "hyper.rs".to_owned(),
+///         port: Some(8080),
+///     }
+/// );
+/// ```
+#[derive(Clone, PartialEq, Debug)]
+pub struct Host {
+    /// The hostname, such a example.domain.
+    pub hostname: String,
+    /// An optional port number.
+    pub port: Option<u16>
+}
+
+impl Header for Host {
+    fn header_name() -> &'static str {
+        "Host"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<Host> {
+        from_one_raw_str(raw)
+    }
+}
+
+impl HeaderFormat for Host {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self.port {
+            None | Some(80) | Some(443) => f.write_str(&self.hostname[..]),
+            Some(port) => write!(f, "{}:{}", self.hostname, port)
+        }
+    }
+}
+
+impl fmt::Display for Host {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.fmt_header(f)
+    }
+}
+
+impl FromStr for Host {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<Host> {
+        let idx = s.rfind(':');
+        let port = idx.and_then(
+            |idx| s[idx + 1..].parse().ok()
+        );
+        let hostname_encoded = match port {
+            None => s,
+            Some(_) => &s[..idx.unwrap()]
+        };
+
+        let hostname = if hostname_encoded.starts_with("[") {
+            if !hostname_encoded.ends_with("]") {
+                return Err(::Error::Header)
+            }
+            hostname_encoded.to_owned()
+        } else {
+            let (hostname, res) = domain_to_unicode(hostname_encoded);
+            if res.is_err() {
+                return Err(::Error::Header)
+            }
+            hostname
+        };
+
+        Ok(Host {
+            hostname: hostname,
+            port: port
+        })
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::Host;
+    use header::Header;
+
+
+    #[test]
+    fn test_host() {
+        let host = Header::parse_header([b"foo.com".to_vec()].as_ref());
+        assert_eq!(host.ok(), Some(Host {
+            hostname: "foo.com".to_owned(),
+            port: None
+        }));
+
+
+        let host = Header::parse_header([b"foo.com:8080".to_vec()].as_ref());
+        assert_eq!(host.ok(), Some(Host {
+            hostname: "foo.com".to_owned(),
+            port: Some(8080)
+        }));
+
+        let host = Header::parse_header([b"foo.com".to_vec()].as_ref());
+        assert_eq!(host.ok(), Some(Host {
+            hostname: "foo.com".to_owned(),
+            port: None
+        }));
+
+        let host = Header::parse_header([b"[::1]:8080".to_vec()].as_ref());
+        assert_eq!(host.ok(), Some(Host {
+            hostname: "[::1]".to_owned(),
+            port: Some(8080)
+        }));
+
+        let host = Header::parse_header([b"[::1]".to_vec()].as_ref());
+        assert_eq!(host.ok(), Some(Host {
+            hostname: "[::1]".to_owned(),
+            port: None
+        }));
+    }
+}
+
+bench_header!(bench, Host, { vec![b"foo.com:3000".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/if_match.rs
@@ -0,0 +1,69 @@
+use header::EntityTag;
+
+header! {
+    /// `If-Match` header, defined in
+    /// [RFC7232](https://tools.ietf.org/html/rfc7232#section-3.1)
+    ///
+    /// The `If-Match` header field makes the request method conditional on
+    /// the recipient origin server either having at least one current
+    /// representation of the target resource, when the field-value is "*",
+    /// or having a current representation of the target resource that has an
+    /// entity-tag matching a member of the list of entity-tags provided in
+    /// the field-value.
+    ///
+    /// An origin server MUST use the strong comparison function when
+    /// comparing entity-tags for `If-Match`, since the client
+    /// intends this precondition to prevent the method from being applied if
+    /// there have been any changes to the representation data.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// If-Match = "*" / 1#entity-tag
+    /// ```
+    ///
+    /// # Example values
+    /// * `"xyzzy"`
+    /// * "xyzzy", "r2d2xxxx", "c3piozzzz"
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, IfMatch};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(IfMatch::Any);
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, IfMatch, EntityTag};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     IfMatch::Items(vec![
+    ///         EntityTag::new(false, "xyzzy".to_owned()),
+    ///         EntityTag::new(false, "foobar".to_owned()),
+    ///         EntityTag::new(false, "bazquux".to_owned()),
+    ///     ])
+    /// );
+    /// ```
+    (IfMatch, "If-Match") => {Any / (EntityTag)+}
+
+    test_if_match {
+        test_header!(
+            test1,
+            vec![b"\"xyzzy\""],
+            Some(HeaderField::Items(
+                vec![EntityTag::new(false, "xyzzy".to_owned())])));
+        test_header!(
+            test2,
+            vec![b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""],
+            Some(HeaderField::Items(
+                vec![EntityTag::new(false, "xyzzy".to_owned()),
+                     EntityTag::new(false, "r2d2xxxx".to_owned()),
+                     EntityTag::new(false, "c3piozzzz".to_owned())])));
+        test_header!(test3, vec![b"*"], Some(IfMatch::Any));
+    }
+}
+
+bench_header!(star, IfMatch, { vec![b"*".to_vec()] });
+bench_header!(single , IfMatch, { vec![b"\"xyzzy\"".to_vec()] });
+bench_header!(multi, IfMatch,
+              { vec![b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\"".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/if_modified_since.rs
@@ -0,0 +1,45 @@
+use header::HttpDate;
+
+header! {
+    /// `If-Modified-Since` header, defined in
+    /// [RFC7232](http://tools.ietf.org/html/rfc7232#section-3.3)
+    /// 
+    /// The `If-Modified-Since` header field makes a GET or HEAD request
+    /// method conditional on the selected representation's modification date
+    /// being more recent than the date provided in the field-value.
+    /// Transfer of the selected representation's data is avoided if that
+    /// data has not changed.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// If-Unmodified-Since = HTTP-date
+    /// ```
+    /// 
+    /// # Example values
+    /// * `Sat, 29 Oct 1994 19:43:31 GMT`
+    /// 
+    /// # Example
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate time;
+    /// # fn main() {
+    /// // extern crate time;
+    /// 
+    /// use hyper::header::{Headers, IfModifiedSince, HttpDate};
+    /// use time::{self, Duration};
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(IfModifiedSince(HttpDate(time::now() - Duration::days(1))));
+    /// # }
+    /// ```
+    (IfModifiedSince, "If-Modified-Since") => [HttpDate]
+
+    test_if_modified_since {
+        // Testcase from RFC
+        test_header!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]);
+    }
+}
+
+bench_header!(imf_fixdate, IfModifiedSince, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
+bench_header!(rfc_850, IfModifiedSince, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
+bench_header!(asctime, IfModifiedSince, { vec![b"Sun Nov  6 08:49:37 1994".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/if_none_match.rs
@@ -0,0 +1,83 @@
+use header::EntityTag;
+
+header! {
+    /// `If-None-Match` header, defined in
+    /// [RFC7232](https://tools.ietf.org/html/rfc7232#section-3.2)
+    ///
+    /// The `If-None-Match` header field makes the request method conditional
+    /// on a recipient cache or origin server either not having any current
+    /// representation of the target resource, when the field-value is "*",
+    /// or having a selected representation with an entity-tag that does not
+    /// match any of those listed in the field-value.
+    ///
+    /// A recipient MUST use the weak comparison function when comparing
+    /// entity-tags for If-None-Match (Section 2.3.2), since weak entity-tags
+    /// can be used for cache validation even if there have been changes to
+    /// the representation data.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// If-None-Match = "*" / 1#entity-tag
+    /// ```
+    ///
+    /// # Example values
+    /// * `"xyzzy"`
+    /// * `W/"xyzzy"`
+    /// * `"xyzzy", "r2d2xxxx", "c3piozzzz"`
+    /// * `W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"`
+    /// * `*`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, IfNoneMatch};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(IfNoneMatch::Any);
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, IfNoneMatch, EntityTag};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     IfNoneMatch::Items(vec![
+    ///         EntityTag::new(false, "xyzzy".to_owned()),
+    ///         EntityTag::new(false, "foobar".to_owned()),
+    ///         EntityTag::new(false, "bazquux".to_owned()),
+    ///     ])
+    /// );
+    /// ```
+    (IfNoneMatch, "If-None-Match") => {Any / (EntityTag)+}
+
+    test_if_none_match {
+        test_header!(test1, vec![b"\"xyzzy\""]);
+        test_header!(test2, vec![b"W/\"xyzzy\""]);
+        test_header!(test3, vec![b"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""]);
+        test_header!(test4, vec![b"W/\"xyzzy\", W/\"r2d2xxxx\", W/\"c3piozzzz\""]);
+        test_header!(test5, vec![b"*"]);
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::IfNoneMatch;
+    use header::Header;
+    use header::EntityTag;
+
+    #[test]
+    fn test_if_none_match() {
+        let mut if_none_match: ::Result<IfNoneMatch>;
+
+        if_none_match = Header::parse_header([b"*".to_vec()].as_ref());
+        assert_eq!(if_none_match.ok(), Some(IfNoneMatch::Any));
+
+        if_none_match = Header::parse_header([b"\"foobar\", W/\"weak-etag\"".to_vec()].as_ref());
+        let mut entities: Vec<EntityTag> = Vec::new();
+        let foobar_etag = EntityTag::new(false, "foobar".to_owned());
+        let weak_etag = EntityTag::new(true, "weak-etag".to_owned());
+        entities.push(foobar_etag);
+        entities.push(weak_etag);
+        assert_eq!(if_none_match.ok(), Some(IfNoneMatch::Items(entities)));
+    }
+}
+
+bench_header!(bench, IfNoneMatch, { vec![b"W/\"nonemptytag\"".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/if_range.rs
@@ -0,0 +1,96 @@
+use std::fmt::{self, Display};
+use header::{self, Header, HeaderFormat, EntityTag, HttpDate};
+
+/// `If-Range` header, defined in [RFC7233](http://tools.ietf.org/html/rfc7233#section-3.2)
+///
+/// If a client has a partial copy of a representation and wishes to have
+/// an up-to-date copy of the entire representation, it could use the
+/// Range header field with a conditional GET (using either or both of
+/// If-Unmodified-Since and If-Match.)  However, if the precondition
+/// fails because the representation has been modified, the client would
+/// then have to make a second request to obtain the entire current
+/// representation.
+///
+/// The `If-Range` header field allows a client to \"short-circuit\" the
+/// second request.  Informally, its meaning is as follows: if the
+/// representation is unchanged, send me the part(s) that I am requesting
+/// in Range; otherwise, send me the entire representation.
+///
+/// # ABNF
+/// ```plain
+/// If-Range = entity-tag / HTTP-date
+/// ```
+///
+/// # Example values
+/// * `Sat, 29 Oct 1994 19:43:31 GMT`
+/// * `\"xyzzy\"`
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, IfRange, EntityTag};
+///
+/// let mut headers = Headers::new();
+/// headers.set(IfRange::EntityTag(EntityTag::new(false, "xyzzy".to_owned())));
+/// ```
+/// ```
+/// # extern crate hyper;
+/// # extern crate time;
+/// # fn main() {
+/// // extern crate time;
+///
+/// use hyper::header::{Headers, IfRange, HttpDate};
+/// use time::{self, Duration};
+///
+/// let mut headers = Headers::new();
+/// headers.set(IfRange::Date(HttpDate(time::now() - Duration::days(1))));
+/// # }
+/// ```
+#[derive(Clone, Debug, PartialEq)]
+pub enum IfRange {
+    /// The entity-tag the client has of the resource
+    EntityTag(EntityTag),
+    /// The date when the client retrieved the resource
+    Date(HttpDate),
+}
+
+impl Header for IfRange {
+    fn header_name() -> &'static str {
+        "If-Range"
+    }
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<IfRange> {
+        let etag: ::Result<EntityTag> = header::parsing::from_one_raw_str(raw);
+        if etag.is_ok() {
+            return Ok(IfRange::EntityTag(etag.unwrap()));
+        }
+        let date: ::Result<HttpDate> = header::parsing::from_one_raw_str(raw);
+        if date.is_ok() {
+            return Ok(IfRange::Date(date.unwrap()));
+        }
+        Err(::Error::Header)
+    }
+}
+
+impl HeaderFormat for IfRange {
+    fn fmt_header(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+        match *self {
+            IfRange::EntityTag(ref x) => Display::fmt(x, f),
+            IfRange::Date(ref x) => Display::fmt(x, f),
+        }
+    }
+}
+
+impl Display for IfRange {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.fmt_header(f)
+    }
+}
+
+#[cfg(test)]
+mod test_if_range {
+    use std::str;
+    use header::*;
+    use super::IfRange as HeaderField;
+    test_header!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]);
+    test_header!(test2, vec![b"\"xyzzy\""]);
+    test_header!(test3, vec![b"this-is-invalid"], None::<IfRange>);
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/if_unmodified_since.rs
@@ -0,0 +1,45 @@
+use header::HttpDate;
+
+header! {
+    /// `If-Unmodified-Since` header, defined in
+    /// [RFC7232](http://tools.ietf.org/html/rfc7232#section-3.4)
+    /// 
+    /// The `If-Unmodified-Since` header field makes the request method
+    /// conditional on the selected representation's last modification date
+    /// being earlier than or equal to the date provided in the field-value.
+    /// This field accomplishes the same purpose as If-Match for cases where
+    /// the user agent does not have an entity-tag for the representation.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// If-Unmodified-Since = HTTP-date
+    /// ```
+    /// 
+    /// # Example values
+    /// * `Sat, 29 Oct 1994 19:43:31 GMT`
+    /// 
+    /// # Example
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate time;
+    /// # fn main() {
+    /// // extern crate time;
+    /// 
+    /// use hyper::header::{Headers, IfUnmodifiedSince, HttpDate};
+    /// use time::{self, Duration};
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(IfUnmodifiedSince(HttpDate(time::now() - Duration::days(1))));
+    /// # }
+    /// ```
+    (IfUnmodifiedSince, "If-Unmodified-Since") => [HttpDate]
+
+    test_if_unmodified_since {
+        // Testcase from RFC
+        test_header!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]);
+    }
+}
+
+bench_header!(imf_fixdate, IfUnmodifiedSince, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
+bench_header!(rfc_850, IfUnmodifiedSince, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
+bench_header!(asctime, IfUnmodifiedSince, { vec![b"Sun Nov  6 08:49:37 1994".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/last-event-id.rs
@@ -0,0 +1,30 @@
+header! {
+    /// `Last-Event-ID` header, defined in
+    /// [RFC3864](https://html.spec.whatwg.org/multipage/references.html#refsRFC3864)
+    ///
+    /// The `Last-Event-ID` header contains information about
+    /// the last event in an http interaction so that it's easier to
+    /// track of event state. This is helpful when working
+    /// with [Server-Sent-Events](http://www.html5rocks.com/en/tutorials/eventsource/basics/). If the connection were to be dropped, for example, it'd
+    /// be useful to let the server know what the last event you
+    /// recieved was.
+    ///
+    /// The spec is a String with the id of the last event, it can be
+    /// an empty string which acts a sort of "reset".
+    ///
+    /// # Example
+    /// ```
+    /// use hyper::header::{Headers, LastEventID};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(LastEventID("1".to_owned()));
+    /// ```
+    (LastEventID, "Last-Event-ID") => [String]
+
+    test_last_event_id {
+        // Initial state
+        test_header!(test1, vec![b""]);
+        // Own testcase
+        test_header!(test2, vec![b"1"], Some(LastEventID("1".to_owned())));
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/last_modified.rs
@@ -0,0 +1,43 @@
+use header::HttpDate;
+
+header! {
+    /// `Last-Modified` header, defined in
+    /// [RFC7232](http://tools.ietf.org/html/rfc7232#section-2.2)
+    /// 
+    /// The `Last-Modified` header field in a response provides a timestamp
+    /// indicating the date and time at which the origin server believes the
+    /// selected representation was last modified, as determined at the
+    /// conclusion of handling the request.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// Expires = HTTP-date
+    /// ```
+    /// 
+    /// # Example values
+    /// * `Sat, 29 Oct 1994 19:43:31 GMT`
+    /// 
+    /// # Example
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate time;
+    /// # fn main() {
+    /// // extern crate time;
+    /// 
+    /// use hyper::header::{Headers, LastModified, HttpDate};
+    /// use time::{self, Duration};
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(LastModified(HttpDate(time::now() - Duration::days(1))));
+    /// # }
+    /// ```
+    (LastModified, "Last-Modified") => [HttpDate]
+
+    test_last_modified {
+        // Testcase from RFC
+        test_header!(test1, vec![b"Sat, 29 Oct 1994 19:43:31 GMT"]);}
+}
+
+bench_header!(imf_fixdate, LastModified, { vec![b"Sun, 07 Nov 1994 08:48:37 GMT".to_vec()] });
+bench_header!(rfc_850, LastModified, { vec![b"Sunday, 06-Nov-94 08:49:37 GMT".to_vec()] });
+bench_header!(asctime, LastModified, { vec![b"Sun Nov  6 08:49:37 1994".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/location.rs
@@ -0,0 +1,43 @@
+header! {
+    /// `Location` header, defined in
+    /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-7.1.2)
+    ///
+    /// The `Location` header field is used in some responses to refer to a
+    /// specific resource in relation to the response.  The type of
+    /// relationship is defined by the combination of request method and
+    /// status code semantics.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Location = URI-reference
+    /// ```
+    ///
+    /// # Example values
+    /// * `/People.html#tim`
+    /// * `http://www.example.net/index.html`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, Location};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(Location("/People.html#tim".to_owned()));
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, Location};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(Location("http://www.example.com/index.html".to_owned()));
+    /// ```
+    // TODO: Use URL
+    (Location, "Location") => [String]
+
+    test_location {
+        // Testcase from RFC
+        test_header!(test1, vec![b"/People.html#tim"]);
+        test_header!(test2, vec![b"http://www.example.net/index.html"]);
+    }
+
+}
+
+bench_header!(bench, Location, { vec![b"http://foo.com/hello:3000".to_vec()] });
copy from third_party/rust/hyper/src/header/common/mod.rs
copy to third_party/rust/hyper-0.10.10/src/header/common/mod.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/origin.rs
@@ -0,0 +1,119 @@
+use header::{Header, Host, HeaderFormat};
+use std::fmt;
+use std::str::FromStr;
+use header::parsing::from_one_raw_str;
+
+/// The `Origin` header.
+///
+/// The `Origin` header is a version of the `Referer` header that is used for all HTTP fetches and `POST`s whose CORS flag is set.
+/// This header is often used to inform recipients of the security context of where the request was initiated.
+///
+///
+/// Following the spec, https://fetch.spec.whatwg.org/#origin-header, the value of this header is composed of
+/// a String (scheme), header::Host (host/port)
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, Origin};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     Origin::new("http", "hyper.rs", None)
+/// );
+/// ```
+/// ```
+/// use hyper::header::{Headers, Origin};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     Origin::new("https", "wikipedia.org", Some(443))
+/// );
+/// ```
+
+#[derive(Clone, Debug)]
+pub struct Origin {
+    /// The scheme, such as http or https
+    pub scheme: String,
+    /// The host, such as Host{hostname: "hyper.rs".to_owned(), port: None}
+    pub host: Host,
+}
+
+impl Origin {
+    /// Creates a new `Origin` header.
+    pub fn new<S: Into<String>, H: Into<String>>(scheme: S, hostname: H, port: Option<u16>) -> Origin{
+        Origin {
+            scheme: scheme.into(),
+            host: Host {
+                hostname: hostname.into(),
+                port: port
+            }
+        }
+    }
+}
+
+impl Header for Origin {
+    fn header_name() -> &'static str {
+        static NAME: &'static str = "Origin";
+        NAME
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<Origin> {
+        from_one_raw_str(raw)
+    }
+}
+
+impl FromStr for Origin {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<Origin> {
+        let idx = match s.find("://") {
+            Some(idx) => idx,
+            None => return Err(::Error::Header)
+        };
+        // idx + 3 because thats how long "://" is
+        let (scheme, etc) = (&s[..idx], &s[idx + 3..]);
+        let host = try!(Host::from_str(etc));
+
+
+        Ok(Origin{
+            scheme: scheme.to_owned(),
+            host: host
+        })
+    }
+}
+
+impl HeaderFormat for Origin {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(self, f)
+    }
+}
+
+impl fmt::Display for Origin {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{}://{}", self.scheme, self.host)
+    }
+}
+
+impl PartialEq for Origin {
+    fn eq(&self, other: &Origin) -> bool {
+        self.scheme == other.scheme && self.host == other.host
+    }
+}
+
+
+#[cfg(test)]
+mod tests {
+    use super::Origin;
+    use header::Header;
+
+    #[test]
+    fn test_origin() {
+        let origin = Header::parse_header([b"http://foo.com".to_vec()].as_ref());
+        assert_eq!(origin.ok(), Some(Origin::new("http", "foo.com", None)));
+
+        let origin = Header::parse_header([b"https://foo.com:443".to_vec()].as_ref());
+        assert_eq!(origin.ok(), Some(Origin::new("https", "foo.com", Some(443))));
+    }
+}
+
+bench_header!(bench, Origin, { vec![b"https://foo.com".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/pragma.rs
@@ -0,0 +1,82 @@
+use std::fmt;
+use std::ascii::AsciiExt;
+
+use header::{Header, HeaderFormat, parsing};
+
+/// The `Pragma` header defined by HTTP/1.0.
+///
+/// > The "Pragma" header field allows backwards compatibility with
+/// > HTTP/1.0 caches, so that clients can specify a "no-cache" request
+/// > that they will understand (as Cache-Control was not defined until
+/// > HTTP/1.1).  When the Cache-Control header field is also present and
+/// > understood in a request, Pragma is ignored.
+
+/// > In HTTP/1.0, Pragma was defined as an extensible field for
+/// > implementation-specified directives for recipients.  This
+/// > specification deprecates such extensions to improve interoperability.
+///
+/// Spec: https://tools.ietf.org/html/rfc7234#section-5.4
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, Pragma};
+///
+/// let mut headers = Headers::new();
+/// headers.set(Pragma::NoCache);
+/// ```
+/// ```
+/// use hyper::header::{Headers, Pragma};
+///
+/// let mut headers = Headers::new();
+/// headers.set(Pragma::Ext("foobar".to_owned()));
+/// ```
+#[derive(Clone, PartialEq, Debug)]
+pub enum Pragma {
+    /// Corresponds to the `no-cache` value.
+    NoCache,
+    /// Every value other than `no-cache`.
+    Ext(String),
+}
+
+impl Header for Pragma {
+    fn header_name() -> &'static str {
+        "Pragma"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<Pragma> {
+        parsing::from_one_raw_str(raw).and_then(|s: String| {
+            let slice = &s.to_ascii_lowercase()[..];
+            match slice {
+                "no-cache" => Ok(Pragma::NoCache),
+                _ => Ok(Pragma::Ext(s)),
+            }
+        })
+    }
+}
+
+impl HeaderFormat for Pragma {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(self, f)
+    }
+}
+
+impl fmt::Display for Pragma {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(match *self {
+            Pragma::NoCache => "no-cache",
+            Pragma::Ext(ref string) => &string[..],
+        })
+    }
+}
+
+#[test]
+fn test_parse_header() {
+    let a: Pragma = Header::parse_header([b"no-cache".to_vec()].as_ref()).unwrap();
+    let b = Pragma::NoCache;
+    assert_eq!(a, b);
+    let c: Pragma = Header::parse_header([b"FoObar".to_vec()].as_ref()).unwrap();
+    let d = Pragma::Ext("FoObar".to_owned());
+    assert_eq!(c, d);
+    let e: ::Result<Pragma> = Header::parse_header([b"".to_vec()].as_ref());
+    assert_eq!(e.ok(), None);
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/prefer.rs
@@ -0,0 +1,209 @@
+use std::fmt;
+use std::str::FromStr;
+use header::{Header, HeaderFormat};
+use header::parsing::{from_comma_delimited, fmt_comma_delimited};
+
+/// `Prefer` header, defined in [RFC7240](http://tools.ietf.org/html/rfc7240)
+///
+/// The `Prefer` header field is HTTP header field that can be used by a
+/// client to request that certain behaviors be employed by a server
+/// while processing a request.
+///
+/// # ABNF
+/// ```plain
+/// Prefer     = "Prefer" ":" 1#preference
+/// preference = token [ BWS "=" BWS word ]
+///              *( OWS ";" [ OWS parameter ] )
+/// parameter  = token [ BWS "=" BWS word ]
+/// ```
+///
+/// # Example values
+/// * `respond-async`
+/// * `return=minimal`
+/// * `wait=30`
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, Prefer, Preference};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     Prefer(vec![Preference::RespondAsync])
+/// );
+/// ```
+/// ```
+/// use hyper::header::{Headers, Prefer, Preference};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     Prefer(vec![
+///         Preference::RespondAsync,
+///         Preference::ReturnRepresentation,
+///         Preference::Wait(10u32),
+///         Preference::Extension("foo".to_owned(),
+///                               "bar".to_owned(),
+///                               vec![]),
+///     ])
+/// );
+/// ```
+#[derive(PartialEq, Clone, Debug)]
+pub struct Prefer(pub Vec<Preference>);
+
+__hyper__deref!(Prefer => Vec<Preference>);
+
+impl Header for Prefer {
+    fn header_name() -> &'static str {
+        "Prefer"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<Prefer> {
+        let preferences = try!(from_comma_delimited(raw));
+        if !preferences.is_empty() {
+            Ok(Prefer(preferences))
+        } else {
+            Err(::Error::Header)
+        }
+    }
+}
+
+impl HeaderFormat for Prefer {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(self, f)
+    }
+}
+
+impl fmt::Display for Prefer {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt_comma_delimited(f, &self[..])
+    }
+}
+
+/// Prefer contains a list of these preferences.
+#[derive(PartialEq, Clone, Debug)]
+pub enum Preference {
+    /// "respond-async"
+    RespondAsync,
+    /// "return=representation"
+    ReturnRepresentation,
+    /// "return=minimal"
+    ReturnMinimal,
+    /// "handling=strict"
+    HandlingStrict,
+    /// "handling=leniant"
+    HandlingLeniant,
+    /// "wait=delta"
+    Wait(u32),
+
+    /// Extension preferences. Always has a value, if none is specified it is
+    /// just "". A preference can also have a list of parameters.
+    Extension(String, String, Vec<(String, String)>)
+}
+
+impl fmt::Display for Preference {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::Preference::*;
+        fmt::Display::fmt(match *self {
+            RespondAsync => "respond-async",
+            ReturnRepresentation => "return=representation",
+            ReturnMinimal => "return=minimal",
+            HandlingStrict => "handling=strict",
+            HandlingLeniant => "handling=leniant",
+
+            Wait(secs) => return write!(f, "wait={}", secs),
+
+            Extension(ref name, ref value, ref params) => {
+                try!(write!(f, "{}", name));
+                if value != "" { try!(write!(f, "={}", value)); }
+                if params.len() > 0 {
+                    for &(ref name, ref value) in params {
+                        try!(write!(f, "; {}", name));
+                        if value != "" { try!(write!(f, "={}", value)); }
+                    }
+                }
+                return Ok(());
+            }
+        }, f)
+    }
+}
+
+impl FromStr for Preference {
+    type Err = Option<<u32 as FromStr>::Err>;
+    fn from_str(s: &str) -> Result<Preference, Option<<u32 as FromStr>::Err>> {
+        use self::Preference::*;
+        let mut params = s.split(';').map(|p| {
+            let mut param = p.splitn(2, '=');
+            match (param.next(), param.next()) {
+                (Some(name), Some(value)) => (name.trim(), value.trim().trim_matches('"')),
+                (Some(name), None) => (name.trim(), ""),
+                // This can safely be unreachable because the [`splitn`][1]
+                // function (used above) will always have at least one value.
+                //
+                // [1]: http://doc.rust-lang.org/std/primitive.str.html#method.splitn
+                _ => { unreachable!(); }
+            }
+        });
+        match params.nth(0) {
+            Some(param) => {
+                let rest: Vec<(String, String)> = params.map(|(l, r)| (l.to_owned(), r.to_owned())).collect();
+                match param {
+                    ("respond-async", "") => if rest.len() == 0 { Ok(RespondAsync) } else { Err(None) },
+                    ("return", "representation") => if rest.len() == 0 { Ok(ReturnRepresentation) } else { Err(None) },
+                    ("return", "minimal") => if rest.len() == 0 { Ok(ReturnMinimal) } else { Err(None) },
+                    ("handling", "strict") => if rest.len() == 0 { Ok(HandlingStrict) } else { Err(None) },
+                    ("handling", "leniant") => if rest.len() == 0 { Ok(HandlingLeniant) } else { Err(None) },
+                    ("wait", secs) => if rest.len() == 0 { secs.parse().map(Wait).map_err(Some) } else { Err(None) },
+                    (left, right) => Ok(Extension(left.to_owned(), right.to_owned(), rest))
+                }
+            },
+            None => Err(None)
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use header::Header;
+    use super::*;
+
+    #[test]
+    fn test_parse_multiple_headers() {
+        let prefer = Header::parse_header(&[b"respond-async, return=representation".to_vec()]);
+        assert_eq!(prefer.ok(), Some(Prefer(vec![Preference::RespondAsync,
+                                           Preference::ReturnRepresentation])))
+    }
+
+    #[test]
+    fn test_parse_argument() {
+        let prefer = Header::parse_header(&[b"wait=100, handling=leniant, respond-async".to_vec()]);
+        assert_eq!(prefer.ok(), Some(Prefer(vec![Preference::Wait(100),
+                                           Preference::HandlingLeniant,
+                                           Preference::RespondAsync])))
+    }
+
+    #[test]
+    fn test_parse_quote_form() {
+        let prefer = Header::parse_header(&[b"wait=\"200\", handling=\"strict\"".to_vec()]);
+        assert_eq!(prefer.ok(), Some(Prefer(vec![Preference::Wait(200),
+                                           Preference::HandlingStrict])))
+    }
+
+    #[test]
+    fn test_parse_extension() {
+        let prefer = Header::parse_header(&[b"foo, bar=baz, baz; foo; bar=baz, bux=\"\"; foo=\"\", buz=\"some parameter\"".to_vec()]);
+        assert_eq!(prefer.ok(), Some(Prefer(vec![
+            Preference::Extension("foo".to_owned(), "".to_owned(), vec![]),
+            Preference::Extension("bar".to_owned(), "baz".to_owned(), vec![]),
+            Preference::Extension("baz".to_owned(), "".to_owned(), vec![("foo".to_owned(), "".to_owned()), ("bar".to_owned(), "baz".to_owned())]),
+            Preference::Extension("bux".to_owned(), "".to_owned(), vec![("foo".to_owned(), "".to_owned())]),
+            Preference::Extension("buz".to_owned(), "some parameter".to_owned(), vec![])])))
+    }
+
+    #[test]
+    fn test_fail_with_args() {
+        let prefer: ::Result<Prefer> = Header::parse_header(&[b"respond-async; foo=bar".to_vec()]);
+        assert_eq!(prefer.ok(), None);
+    }
+}
+
+bench_header!(normal,
+    Prefer, { vec![b"respond-async, return=representation".to_vec(), b"wait=100".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/preference_applied.rs
@@ -0,0 +1,107 @@
+use std::fmt;
+use header::{Header, HeaderFormat, Preference};
+use header::parsing::{from_comma_delimited, fmt_comma_delimited};
+
+/// `Preference-Applied` header, defined in [RFC7240](http://tools.ietf.org/html/rfc7240)
+///
+/// The `Preference-Applied` response header may be included within a
+/// response message as an indication as to which `Prefer` header tokens were
+/// honored by the server and applied to the processing of a request.
+///
+/// # ABNF
+/// ```plain
+/// Preference-Applied = "Preference-Applied" ":" 1#applied-pref
+/// applied-pref = token [ BWS "=" BWS word ]
+/// ```
+///
+/// # Example values
+/// * `respond-async`
+/// * `return=minimal`
+/// * `wait=30`
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, PreferenceApplied, Preference};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     PreferenceApplied(vec![Preference::RespondAsync])
+/// );
+/// ```
+/// ```
+/// use hyper::header::{Headers, PreferenceApplied, Preference};
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     PreferenceApplied(vec![
+///         Preference::RespondAsync,
+///         Preference::ReturnRepresentation,
+///         Preference::Wait(10u32),
+///         Preference::Extension("foo".to_owned(),
+///                               "bar".to_owned(),
+///                               vec![]),
+///     ])
+/// );
+/// ```
+#[derive(PartialEq, Clone, Debug)]
+pub struct PreferenceApplied(pub Vec<Preference>);
+
+__hyper__deref!(PreferenceApplied => Vec<Preference>);
+
+impl Header for PreferenceApplied {
+    fn header_name() -> &'static str {
+        "Preference-Applied"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<PreferenceApplied> {
+        let preferences = try!(from_comma_delimited(raw));
+        if !preferences.is_empty() {
+            Ok(PreferenceApplied(preferences))
+        } else {
+            Err(::Error::Header)
+        }
+    }
+}
+
+impl HeaderFormat for PreferenceApplied {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(self, f)
+    }
+}
+
+impl fmt::Display for PreferenceApplied {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        //TODO: format this without allocating a Vec and cloning contents
+        let preferences: Vec<_> = self.0.iter().map(|pref| match pref {
+            // The spec ignores parameters in `Preferences-Applied`
+            &Preference::Extension(ref name, ref value, _) => Preference::Extension(
+              name.to_owned(),
+              value.to_owned(),
+              vec![]
+            ),
+            preference @ _ => preference.clone()
+        }).collect();
+        fmt_comma_delimited(f, &preferences)
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use header::{HeaderFormat, Preference};
+    use super::*;
+
+    #[test]
+    fn test_format_ignore_parameters() {
+        assert_eq!(
+            format!("{}", &PreferenceApplied(vec![Preference::Extension(
+                "foo".to_owned(),
+                "bar".to_owned(),
+                vec![("bar".to_owned(), "foo".to_owned()), ("buz".to_owned(), "".to_owned())]
+            )]) as &(HeaderFormat + Send + Sync)),
+            "foo=bar".to_owned()
+        );
+    }
+}
+
+bench_header!(normal,
+    PreferenceApplied, { vec![b"respond-async, return=representation".to_vec(), b"wait=100".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/range.rs
@@ -0,0 +1,288 @@
+use std::fmt::{self, Display};
+use std::str::FromStr;
+
+use header::{Header, HeaderFormat};
+use header::parsing::{from_one_raw_str, from_comma_delimited};
+
+/// `Range` header, defined in [RFC7233](https://tools.ietf.org/html/rfc7233#section-3.1)
+///
+/// The "Range" header field on a GET request modifies the method
+/// semantics to request transfer of only one or more subranges of the
+/// selected representation data, rather than the entire selected
+/// representation data.
+///
+/// # ABNF
+/// ```plain
+/// Range =	byte-ranges-specifier / other-ranges-specifier
+/// other-ranges-specifier = other-range-unit "=" other-range-set
+/// other-range-set = 1*VCHAR
+///
+/// bytes-unit = "bytes"
+///
+/// byte-ranges-specifier = bytes-unit "=" byte-range-set
+/// byte-range-set = 1#(byte-range-spec / suffix-byte-range-spec)
+/// byte-range-spec = first-byte-pos "-" [last-byte-pos]
+/// first-byte-pos = 1*DIGIT
+/// last-byte-pos = 1*DIGIT
+/// ```
+///
+/// # Example values
+/// * `bytes=1000-`
+/// * `bytes=-2000`
+/// * `bytes=0-1,30-40`
+/// * `bytes=0-10,20-90,-100`
+/// * `custom_unit=0-123`
+/// * `custom_unit=xxx-yyy`
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, Range, ByteRangeSpec};
+///
+/// let mut headers = Headers::new();
+/// headers.set(Range::Bytes(
+///     vec![ByteRangeSpec::FromTo(1, 100), ByteRangeSpec::AllFrom(200)]
+/// ));
+///
+/// headers.clear();
+/// headers.set(Range::Unregistered("letters".to_owned(), "a-f".to_owned()));
+/// ```
+/// ```
+/// use hyper::header::{Headers, Range};
+///
+/// let mut headers = Headers::new();
+/// headers.set(Range::bytes(1, 100));
+///
+/// headers.clear();
+/// headers.set(Range::bytes_multi(vec![(1, 100), (200, 300)]));
+/// ```
+#[derive(PartialEq, Clone, Debug)]
+pub enum Range {
+    /// Byte range
+    Bytes(Vec<ByteRangeSpec>),
+    /// Custom range, with unit not registered at IANA
+    /// (`other-range-unit`: String , `other-range-set`: String)
+    Unregistered(String, String)
+}
+
+/// Each `Range::Bytes` header can contain one or more `ByteRangeSpecs`.
+/// Each `ByteRangeSpec` defines a range of bytes to fetch
+#[derive(PartialEq, Clone, Debug)]
+pub enum ByteRangeSpec {
+    /// Get all bytes between x and y ("x-y")
+    FromTo(u64, u64),
+    /// Get all bytes starting from x ("x-")
+    AllFrom(u64),
+    /// Get last x bytes ("-x")
+    Last(u64)
+}
+
+impl Range {
+    /// Get the most common byte range header ("bytes=from-to")
+    pub fn bytes(from: u64, to: u64) -> Range {
+        Range::Bytes(vec![ByteRangeSpec::FromTo(from, to)])
+    }
+
+    /// Get byte range header with multiple subranges
+    /// ("bytes=from1-to1,from2-to2,fromX-toX")
+    pub fn bytes_multi(ranges: Vec<(u64, u64)>) -> Range {
+        Range::Bytes(ranges.iter().map(|r| ByteRangeSpec::FromTo(r.0, r.1)).collect())
+    }
+}
+
+
+impl fmt::Display for ByteRangeSpec {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            ByteRangeSpec::FromTo(from, to) => write!(f, "{}-{}", from, to),
+            ByteRangeSpec::Last(pos) => write!(f, "-{}", pos),
+            ByteRangeSpec::AllFrom(pos) => write!(f, "{}-", pos),
+        }
+    }
+}
+
+
+impl fmt::Display for Range {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            Range::Bytes(ref ranges) => {
+                try!(write!(f, "bytes="));
+
+                for (i, range) in ranges.iter().enumerate() {
+                    if i != 0 {
+                        try!(f.write_str(","));
+                    }
+                    try!(Display::fmt(range, f));
+                }
+                Ok(())
+            },
+            Range::Unregistered(ref unit, ref range_str) => {
+                write!(f, "{}={}", unit, range_str)
+            },
+        }
+    }
+}
+
+impl FromStr for Range {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<Range> {
+        let mut iter = s.splitn(2, "=");
+
+        match (iter.next(), iter.next()) {
+            (Some("bytes"), Some(ranges)) => {
+                match from_comma_delimited(&[ranges]) {
+                    Ok(ranges) => {
+                        if ranges.is_empty() {
+                            return Err(::Error::Header);
+                        }
+                        Ok(Range::Bytes(ranges))
+                    },
+                    Err(_) => Err(::Error::Header)
+                }
+            }
+            (Some(unit), Some(range_str)) if unit != "" && range_str != "" => {
+                Ok(Range::Unregistered(unit.to_owned(), range_str.to_owned()))
+
+            },
+            _ => Err(::Error::Header)
+        }
+    }
+}
+
+impl FromStr for ByteRangeSpec {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<ByteRangeSpec> {
+        let mut parts = s.splitn(2, "-");
+
+        match (parts.next(), parts.next()) {
+            (Some(""), Some(end)) => {
+                end.parse().or(Err(::Error::Header)).map(ByteRangeSpec::Last)
+            },
+            (Some(start), Some("")) => {
+                start.parse().or(Err(::Error::Header)).map(ByteRangeSpec::AllFrom)
+            },
+            (Some(start), Some(end)) => {
+                match (start.parse(), end.parse()) {
+                    (Ok(start), Ok(end)) if start <= end => Ok(ByteRangeSpec::FromTo(start, end)),
+                    _ => Err(::Error::Header)
+                }
+            },
+            _ => Err(::Error::Header)
+        }
+    }
+}
+
+impl Header for Range {
+
+    fn header_name() -> &'static str {
+        "Range"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<Range> {
+        from_one_raw_str(raw)
+    }
+}
+
+impl HeaderFormat for Range {
+
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Display::fmt(self, f)
+    }
+
+}
+
+#[test]
+fn test_parse_bytes_range_valid() {
+    let r: Range = Header::parse_header(&[b"bytes=1-100".to_vec()]).unwrap();
+    let r2: Range = Header::parse_header(&[b"bytes=1-100,-".to_vec()]).unwrap();
+    let r3 =  Range::bytes(1, 100);
+    assert_eq!(r, r2);
+    assert_eq!(r2, r3);
+
+    let r: Range = Header::parse_header(&[b"bytes=1-100,200-".to_vec()]).unwrap();
+    let r2: Range = Header::parse_header(&[b"bytes= 1-100 , 101-xxx,  200- ".to_vec()]).unwrap();
+    let r3 =  Range::Bytes(
+        vec![ByteRangeSpec::FromTo(1, 100), ByteRangeSpec::AllFrom(200)]
+    );
+    assert_eq!(r, r2);
+    assert_eq!(r2, r3);
+
+    let r: Range = Header::parse_header(&[b"bytes=1-100,-100".to_vec()]).unwrap();
+    let r2: Range = Header::parse_header(&[b"bytes=1-100, ,,-100".to_vec()]).unwrap();
+    let r3 =  Range::Bytes(
+        vec![ByteRangeSpec::FromTo(1, 100), ByteRangeSpec::Last(100)]
+    );
+    assert_eq!(r, r2);
+    assert_eq!(r2, r3);
+
+    let r: Range = Header::parse_header(&[b"custom=1-100,-100".to_vec()]).unwrap();
+    let r2 =  Range::Unregistered("custom".to_owned(), "1-100,-100".to_owned());
+    assert_eq!(r, r2);
+
+}
+
+#[test]
+fn test_parse_unregistered_range_valid() {
+    let r: Range = Header::parse_header(&[b"custom=1-100,-100".to_vec()]).unwrap();
+    let r2 =  Range::Unregistered("custom".to_owned(), "1-100,-100".to_owned());
+    assert_eq!(r, r2);
+
+    let r: Range = Header::parse_header(&[b"custom=abcd".to_vec()]).unwrap();
+    let r2 =  Range::Unregistered("custom".to_owned(), "abcd".to_owned());
+    assert_eq!(r, r2);
+
+    let r: Range = Header::parse_header(&[b"custom=xxx-yyy".to_vec()]).unwrap();
+    let r2 =  Range::Unregistered("custom".to_owned(), "xxx-yyy".to_owned());
+    assert_eq!(r, r2);
+}
+
+#[test]
+fn test_parse_invalid() {
+    let r: ::Result<Range> = Header::parse_header(&[b"bytes=1-a,-".to_vec()]);
+    assert_eq!(r.ok(), None);
+
+    let r: ::Result<Range> = Header::parse_header(&[b"bytes=1-2-3".to_vec()]);
+    assert_eq!(r.ok(), None);
+
+    let r: ::Result<Range> = Header::parse_header(&[b"abc".to_vec()]);
+    assert_eq!(r.ok(), None);
+
+    let r: ::Result<Range> = Header::parse_header(&[b"bytes=1-100=".to_vec()]);
+    assert_eq!(r.ok(), None);
+
+    let r: ::Result<Range> = Header::parse_header(&[b"bytes=".to_vec()]);
+    assert_eq!(r.ok(), None);
+
+    let r: ::Result<Range> = Header::parse_header(&[b"custom=".to_vec()]);
+    assert_eq!(r.ok(), None);
+
+    let r: ::Result<Range> = Header::parse_header(&[b"=1-100".to_vec()]);
+    assert_eq!(r.ok(), None);
+}
+
+#[test]
+fn test_fmt() {
+    use header::Headers;
+
+    let mut headers = Headers::new();
+
+    headers.set(
+        Range::Bytes(
+            vec![ByteRangeSpec::FromTo(0, 1000), ByteRangeSpec::AllFrom(2000)]
+    ));
+    assert_eq!(&headers.to_string(), "Range: bytes=0-1000,2000-\r\n");
+
+    headers.clear();
+    headers.set(Range::Bytes(vec![]));
+
+    assert_eq!(&headers.to_string(), "Range: bytes=\r\n");
+
+    headers.clear();
+    headers.set(Range::Unregistered("custom".to_owned(), "1-xxx".to_owned()));
+
+    assert_eq!(&headers.to_string(), "Range: custom=1-xxx\r\n");
+}
+
+bench_header!(bytes_multi, Range, { vec![b"bytes=1-1001,2001-3001,10001-".to_vec()]});
+bench_header!(custom_unit, Range, { vec![b"other=0-100000".to_vec()]});
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/referer.rs
@@ -0,0 +1,41 @@
+header! {
+    /// `Referer` header, defined in
+    /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.5.2)
+    ///
+    /// The `Referer` [sic] header field allows the user agent to specify a
+    /// URI reference for the resource from which the target URI was obtained
+    /// (i.e., the "referrer", though the field name is misspelled).  A user
+    /// agent MUST NOT include the fragment and userinfo components of the
+    /// URI reference, if any, when generating the Referer field value.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Referer = absolute-URI / partial-URI
+    /// ```
+    ///
+    /// # Example values
+    /// * `http://www.example.org/hypertext/Overview.html`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, Referer};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(Referer("/People.html#tim".to_owned()));
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, Referer};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(Referer("http://www.example.com/index.html".to_owned()));
+    /// ```
+    // TODO Use URL
+    (Referer, "Referer") => [String]
+
+    test_referer {
+        // Testcase from the RFC
+        test_header!(test1, vec![b"http://www.example.org/hypertext/Overview.html"]);
+    }
+}
+
+bench_header!(bench, Referer, { vec![b"http://foo.com/hello:3000".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/referrer_policy.rs
@@ -0,0 +1,119 @@
+use std::fmt;
+use std::ascii::AsciiExt;
+
+use header::{Header, HeaderFormat, parsing};
+
+/// `Referrer-Policy` header, part of
+/// [Referrer Policy](https://www.w3.org/TR/referrer-policy/#referrer-policy-header)
+///
+/// The `Referrer-Policy` HTTP header specifies the referrer
+/// policy that the user agent applies when determining what
+/// referrer information should be included with requests made,
+/// and with browsing contexts created from the context of the
+/// protected resource.
+///
+/// # ABNF
+/// ```plain
+/// Referrer-Policy: 1#policy-token
+/// policy-token   = "no-referrer" / "no-referrer-when-downgrade"
+///                  / "same-origin" / "origin"
+///                  / "origin-when-cross-origin" / "unsafe-url"
+/// ```
+///
+/// # Example values
+/// * `no-referrer`
+///
+/// # Example
+/// ```
+/// use hyper::header::{Headers, ReferrerPolicy};
+///
+/// let mut headers = Headers::new();
+/// headers.set(ReferrerPolicy::NoReferrer);
+/// ```
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub enum ReferrerPolicy {
+    /// `no-referrer`
+    NoReferrer,
+    /// `no-referrer-when-downgrade`
+    NoReferrerWhenDowngrade,
+    /// `same-origin`
+    SameOrigin,
+    /// `origin`
+    Origin,
+    /// `origin-when-cross-origin`
+    OriginWhenCrossOrigin,
+    /// `unsafe-url`
+    UnsafeUrl,
+     /// `strict-origin`
+    StrictOrigin,
+    ///`strict-origin-when-cross-origin`
+    StrictOriginWhenCrossOrigin,
+}
+
+impl Header for ReferrerPolicy {
+    fn header_name() -> &'static str {
+        static NAME: &'static str = "Referrer-Policy";
+        NAME
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<ReferrerPolicy> {
+        use self::ReferrerPolicy::*;
+        // See https://www.w3.org/TR/referrer-policy/#determine-policy-for-token
+        let headers: Vec<String> = try!(parsing::from_comma_delimited(raw));
+
+        for h in headers.iter().rev() {
+            let slice = &h.to_ascii_lowercase()[..];
+            match slice {
+                "no-referrer" | "never" => return Ok(NoReferrer),
+                "no-referrer-when-downgrade" | "default" => return Ok(NoReferrerWhenDowngrade),
+                "same-origin" => return Ok(SameOrigin),
+                "origin" => return Ok(Origin),
+                "origin-when-cross-origin" => return Ok(OriginWhenCrossOrigin),
+                "strict-origin" => return Ok(StrictOrigin),
+                "strict-origin-when-cross-origin" => return Ok(StrictOriginWhenCrossOrigin),
+                "unsafe-url" | "always" => return Ok(UnsafeUrl),
+                _ => continue,
+            }
+        }
+
+        Err(::Error::Header)
+    }
+}
+
+impl HeaderFormat for ReferrerPolicy {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(self, f)
+    }
+}
+
+impl fmt::Display for ReferrerPolicy {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use self::ReferrerPolicy::*;
+        f.write_str(match *self {
+            NoReferrer => "no-referrer",
+            NoReferrerWhenDowngrade => "no-referrer-when-downgrade",
+            SameOrigin => "same-origin",
+            Origin => "origin",
+            OriginWhenCrossOrigin => "origin-when-cross-origin",
+            StrictOrigin => "strict-origin",
+            StrictOriginWhenCrossOrigin => "strict-origin-when-cross-origin",
+            UnsafeUrl => "unsafe-url",
+        })
+    }
+}
+
+#[test]
+fn test_parse_header() {
+    let a: ReferrerPolicy = Header::parse_header([b"origin".to_vec()].as_ref()).unwrap();
+    let b = ReferrerPolicy::Origin;
+    assert_eq!(a, b);
+    let e: ::Result<ReferrerPolicy> = Header::parse_header([b"foobar".to_vec()].as_ref());
+    assert!(e.is_err());
+}
+
+#[test]
+fn test_rightmost_header() {
+    let a: ReferrerPolicy = Header::parse_header(&["same-origin, origin, foobar".into()]).unwrap();
+    let b = ReferrerPolicy::Origin;
+    assert_eq!(a, b);
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/server.rs
@@ -0,0 +1,36 @@
+header! {
+    /// `Server` header, defined in [RFC7231](http://tools.ietf.org/html/rfc7231#section-7.4.2)
+    ///
+    /// The `Server` header field contains information about the software
+    /// used by the origin server to handle the request, which is often used
+    /// by clients to help identify the scope of reported interoperability
+    /// problems, to work around or tailor requests to avoid particular
+    /// server limitations, and for analytics regarding server or operating
+    /// system use.  An origin server MAY generate a Server field in its
+    /// responses.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Server = product *( RWS ( product / comment ) )
+    /// ```
+    ///
+    /// # Example values
+    /// * `CERN/3.0 libwww/2.17`
+    ///
+    /// # Example
+    /// ```
+    /// use hyper::header::{Headers, Server};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(Server("hyper/0.5.2".to_owned()));
+    /// ```
+    // TODO: Maybe parse as defined in the spec?
+    (Server, "Server") => [String]
+
+    test_server {
+        // Testcase from RFC
+        test_header!(test1, vec![b"CERN/3.0 libwww/2.17"]);
+    }
+}
+
+bench_header!(bench, Server, { vec![b"Some String".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/set_cookie.rs
@@ -0,0 +1,121 @@
+use header::{Header, HeaderFormat};
+use std::fmt::{self};
+use std::str::from_utf8;
+
+
+/// `Set-Cookie` header, defined [RFC6265](http://tools.ietf.org/html/rfc6265#section-4.1)
+///
+/// The Set-Cookie HTTP response header is used to send cookies from the
+/// server to the user agent.
+///
+/// Informally, the Set-Cookie response header contains the header name
+/// "Set-Cookie" followed by a ":" and a cookie.  Each cookie begins with
+/// a name-value-pair, followed by zero or more attribute-value pairs.
+///
+/// # ABNF
+/// ```plain
+///  set-cookie-header = "Set-Cookie:" SP set-cookie-string
+/// set-cookie-string = cookie-pair *( ";" SP cookie-av )
+/// cookie-pair       = cookie-name "=" cookie-value
+/// cookie-name       = token
+/// cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
+/// cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
+///                       ; US-ASCII characters excluding CTLs,
+///                       ; whitespace DQUOTE, comma, semicolon,
+///                       ; and backslash
+/// token             = <token, defined in [RFC2616], Section 2.2>
+///
+/// cookie-av         = expires-av / max-age-av / domain-av /
+///                    path-av / secure-av / httponly-av /
+///                     extension-av
+/// expires-av        = "Expires=" sane-cookie-date
+/// sane-cookie-date  = <rfc1123-date, defined in [RFC2616], Section 3.3.1>
+/// max-age-av        = "Max-Age=" non-zero-digit *DIGIT
+///                       ; In practice, both expires-av and max-age-av
+///                       ; are limited to dates representable by the
+///                       ; user agent.
+/// non-zero-digit    = %x31-39
+///                       ; digits 1 through 9
+/// domain-av         = "Domain=" domain-value
+/// domain-value      = <subdomain>
+///                       ; defined in [RFC1034], Section 3.5, as
+///                       ; enhanced by [RFC1123], Section 2.1
+/// path-av           = "Path=" path-value
+/// path-value        = <any CHAR except CTLs or ";">
+/// secure-av         = "Secure"
+/// httponly-av       = "HttpOnly"
+/// extension-av      = <any CHAR except CTLs or ";">
+/// ```
+///
+/// # Example values
+/// * `SID=31d4d96e407aad42`
+/// * `lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT`
+/// * `lang=; Expires=Sun, 06 Nov 1994 08:49:37 GMT`
+/// * `lang=en-US; Path=/; Domain=example.com`
+///
+/// # Example
+/// ```
+/// use hyper::header::{Headers, SetCookie};
+///
+/// let mut headers = Headers::new();
+///
+/// headers.set(
+///     SetCookie(vec![
+///         String::from("foo=bar; Path=/path; Domain=example.com")
+///     ])
+/// );
+/// ```
+#[derive(Clone, PartialEq, Debug)]
+pub struct SetCookie(pub Vec<String>);
+
+__hyper__deref!(SetCookie => Vec<String>);
+
+impl Header for SetCookie {
+    fn header_name() -> &'static str {
+        "Set-Cookie"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<SetCookie> {
+        let mut set_cookies = Vec::with_capacity(raw.len());
+        for set_cookies_raw in raw {
+            if let Ok(s) = from_utf8(&set_cookies_raw[..]) {
+                set_cookies.push(s.trim().to_owned());
+            }
+        }
+
+        if !set_cookies.is_empty() {
+            Ok(SetCookie(set_cookies))
+        } else {
+            Err(::Error::Header)
+        }
+    }
+
+}
+
+impl HeaderFormat for SetCookie {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        if self.0.len() == 1 {
+            write!(f, "{}", &self.0[0])
+        } else {
+            panic!("SetCookie with multiple cookies cannot be used with fmt_header, must use fmt_multi_header");
+        }
+    }
+
+    fn fmt_multi_header(&self, f: &mut ::header::MultilineFormatter) -> fmt::Result {
+        for cookie in &self.0 {
+            try!(f.fmt_line(cookie));
+        }
+        Ok(())
+    }
+}
+
+#[test]
+fn test_set_cookie_fmt() {
+    use ::header::Headers;
+    let mut headers = Headers::new();
+    headers.set(SetCookie(vec![
+        "foo=bar".into(),
+        "baz=quux".into(),
+    ]));
+    assert_eq!(headers.to_string(), "Set-Cookie: foo=bar\r\nSet-Cookie: baz=quux\r\n");
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/strict_transport_security.rs
@@ -0,0 +1,201 @@
+use std::fmt;
+use std::str::{self, FromStr};
+
+use unicase::UniCase;
+
+use header::{Header, HeaderFormat, parsing};
+
+/// `StrictTransportSecurity` header, defined in [RFC6797](https://tools.ietf.org/html/rfc6797)
+///
+/// This specification defines a mechanism enabling web sites to declare
+/// themselves accessible only via secure connections and/or for users to be
+/// able to direct their user agent(s) to interact with given sites only over
+/// secure connections.  This overall policy is referred to as HTTP Strict
+/// Transport Security (HSTS).  The policy is declared by web sites via the
+/// Strict-Transport-Security HTTP response header field and/or by other means,
+/// such as user agent configuration, for example.
+///
+/// # ABNF
+///
+/// ```plain
+///      [ directive ]  *( ";" [ directive ] )
+///
+///      directive                 = directive-name [ "=" directive-value ]
+///      directive-name            = token
+///      directive-value           = token | quoted-string
+///
+/// ```
+///
+/// # Example values
+/// * `max-age=31536000`
+/// * `max-age=15768000 ; includeSubDomains`
+///
+/// # Example
+/// ```
+/// # extern crate hyper;
+/// # fn main() {
+/// use hyper::header::{Headers, StrictTransportSecurity};
+///
+/// let mut headers = Headers::new();
+///
+/// headers.set(
+///    StrictTransportSecurity::including_subdomains(31536000u64)
+/// );
+/// # }
+/// ```
+#[derive(Clone, PartialEq, Debug)]
+pub struct StrictTransportSecurity {
+    /// Signals the UA that the HSTS Policy applies to this HSTS Host as well as
+    /// any subdomains of the host's domain name.
+    pub include_subdomains: bool,
+
+    /// Specifies the number of seconds, after the reception of the STS header
+    /// field, during which the UA regards the host (from whom the message was
+    /// received) as a Known HSTS Host.
+    pub max_age: u64
+}
+
+impl StrictTransportSecurity {
+    /// Create an STS header that includes subdomains
+    pub fn including_subdomains(max_age: u64) -> StrictTransportSecurity {
+        StrictTransportSecurity {
+            max_age: max_age,
+            include_subdomains: true
+        }
+    }
+
+    /// Create an STS header that excludes subdomains
+    pub fn excluding_subdomains(max_age: u64) -> StrictTransportSecurity {
+        StrictTransportSecurity {
+            max_age: max_age,
+            include_subdomains: false
+        }
+    }
+}
+
+enum Directive {
+    MaxAge(u64),
+    IncludeSubdomains,
+    Unknown
+}
+
+impl FromStr for StrictTransportSecurity {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<StrictTransportSecurity> {
+        s.split(';')
+            .map(str::trim)
+            .map(|sub| if UniCase(sub) == UniCase("includeSubdomains") {
+                Ok(Directive::IncludeSubdomains)
+            } else {
+                let mut sub = sub.splitn(2, '=');
+                match (sub.next(), sub.next()) {
+                    (Some(left), Some(right))
+                    if UniCase(left.trim()) == UniCase("max-age") => {
+                        right
+                            .trim()
+                            .trim_matches('"')
+                            .parse()
+                            .map(Directive::MaxAge)
+                    },
+                    _ => Ok(Directive::Unknown)
+                }
+            })
+            .fold(Ok((None, None)), |res, dir| match (res, dir) {
+                (Ok((None, sub)), Ok(Directive::MaxAge(age))) => Ok((Some(age), sub)),
+                (Ok((age, None)), Ok(Directive::IncludeSubdomains)) => Ok((age, Some(()))),
+                (Ok((Some(_), _)), Ok(Directive::MaxAge(_))) => Err(::Error::Header),
+                (Ok((_, Some(_))), Ok(Directive::IncludeSubdomains)) => Err(::Error::Header),
+                (_, Err(_)) => Err(::Error::Header),
+                (res, _) => res
+            })
+            .and_then(|res| match res {
+                (Some(age), sub) => Ok(StrictTransportSecurity {
+                    max_age: age,
+                    include_subdomains: sub.is_some()
+                }),
+                _ => Err(::Error::Header)
+            })
+    }
+}
+
+impl Header for StrictTransportSecurity {
+    fn header_name() -> &'static str {
+        "Strict-Transport-Security"
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<StrictTransportSecurity> {
+        parsing::from_one_raw_str(raw)
+    }
+}
+
+impl HeaderFormat for StrictTransportSecurity {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(self, f)
+    }
+}
+
+impl fmt::Display for StrictTransportSecurity {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        if self.include_subdomains {
+            write!(f, "max-age={}; includeSubdomains", self.max_age)
+        } else {
+            write!(f, "max-age={}", self.max_age)
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::StrictTransportSecurity;
+    use header::Header;
+
+    #[test]
+    fn test_parse_max_age() {
+        let h = Header::parse_header(&[b"max-age=31536000".to_vec()][..]);
+        assert_eq!(h.ok(), Some(StrictTransportSecurity { include_subdomains: false, max_age: 31536000u64 }));
+    }
+
+    #[test]
+    fn test_parse_max_age_no_value() {
+        let h: ::Result<StrictTransportSecurity> = Header::parse_header(&[b"max-age".to_vec()][..]);
+        assert!(h.is_err());
+    }
+
+    #[test]
+    fn test_parse_quoted_max_age() {
+        let h = Header::parse_header(&[b"max-age=\"31536000\"".to_vec()][..]);
+        assert_eq!(h.ok(), Some(StrictTransportSecurity { include_subdomains: false, max_age: 31536000u64 }));
+    }
+
+    #[test]
+    fn test_parse_spaces_max_age() {
+        let h = Header::parse_header(&[b"max-age = 31536000".to_vec()][..]);
+        assert_eq!(h.ok(), Some(StrictTransportSecurity { include_subdomains: false, max_age: 31536000u64 }));
+    }
+
+    #[test]
+    fn test_parse_include_subdomains() {
+        let h = Header::parse_header(&[b"max-age=15768000 ; includeSubDomains".to_vec()][..]);
+        assert_eq!(h.ok(), Some(StrictTransportSecurity { include_subdomains: true, max_age: 15768000u64 }));
+    }
+
+    #[test]
+    fn test_parse_no_max_age() {
+        let h: ::Result<StrictTransportSecurity> = Header::parse_header(&[b"includeSubDomains".to_vec()][..]);
+        assert!(h.is_err());
+    }
+
+    #[test]
+    fn test_parse_max_age_nan() {
+        let h: ::Result<StrictTransportSecurity> = Header::parse_header(&[b"max-age = derp".to_vec()][..]);
+        assert!(h.is_err());
+    }
+
+    #[test]
+    fn test_parse_duplicate_directives() {
+        assert!(StrictTransportSecurity::parse_header(&[b"max-age=100; max-age=5; max-age=0".to_vec()][..]).is_err());
+    }
+}
+
+bench_header!(bench, StrictTransportSecurity, { vec![b"max-age=15768000 ; includeSubDomains".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/transfer_encoding.rs
@@ -0,0 +1,53 @@
+use header::Encoding;
+
+header! {
+    /// `Transfer-Encoding` header, defined in
+    /// [RFC7230](http://tools.ietf.org/html/rfc7230#section-3.3.1)
+    /// 
+    /// The `Transfer-Encoding` header field lists the transfer coding names
+    /// corresponding to the sequence of transfer codings that have been (or
+    /// will be) applied to the payload body in order to form the message
+    /// body.
+    /// 
+    /// # ABNF
+    /// ```plain
+    /// Transfer-Encoding = 1#transfer-coding
+    /// ```
+    /// 
+    /// # Example values
+    /// * `gzip, chunked`
+    /// 
+    /// # Example
+    /// ```
+    /// use hyper::header::{Headers, TransferEncoding, Encoding};
+    /// 
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     TransferEncoding(vec![
+    ///         Encoding::Gzip,
+    ///         Encoding::Chunked,
+    ///     ])
+    /// );
+    /// ```
+    (TransferEncoding, "Transfer-Encoding") => (Encoding)+
+
+    transfer_encoding {
+        test_header!(
+            test1,
+            vec![b"gzip, chunked"],
+            Some(HeaderField(
+                vec![Encoding::Gzip, Encoding::Chunked]
+                )));
+        // Issue: #683
+        test_header!(
+            test2,
+            vec![b"chunked", b"chunked"],
+            Some(HeaderField(
+                vec![Encoding::Chunked, Encoding::Chunked]
+            )));
+
+    }
+}
+
+bench_header!(normal, TransferEncoding, { vec![b"chunked, gzip".to_vec()] });
+bench_header!(ext, TransferEncoding, { vec![b"ext".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/upgrade.rs
@@ -0,0 +1,158 @@
+use std::fmt::{self, Display};
+use std::str::FromStr;
+use unicase::UniCase;
+
+header! {
+    /// `Upgrade` header, defined in [RFC7230](http://tools.ietf.org/html/rfc7230#section-6.7)
+    ///
+    /// The `Upgrade` header field is intended to provide a simple mechanism
+    /// for transitioning from HTTP/1.1 to some other protocol on the same
+    /// connection.  A client MAY send a list of protocols in the Upgrade
+    /// header field of a request to invite the server to switch to one or
+    /// more of those protocols, in order of descending preference, before
+    /// sending the final response.  A server MAY ignore a received Upgrade
+    /// header field if it wishes to continue using the current protocol on
+    /// that connection.  Upgrade cannot be used to insist on a protocol
+    /// change.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Upgrade          = 1#protocol
+    ///
+    /// protocol         = protocol-name ["/" protocol-version]
+    /// protocol-name    = token
+    /// protocol-version = token
+    /// ```
+    ///
+    /// # Example values
+    /// * `HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11`
+    ///
+    /// # Examples
+    /// ```
+    /// use hyper::header::{Headers, Upgrade, Protocol, ProtocolName};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(Upgrade(vec![Protocol::new(ProtocolName::WebSocket, None)]));
+    /// ```
+    /// ```
+    /// use hyper::header::{Headers, Upgrade, Protocol, ProtocolName};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     Upgrade(vec![
+    ///         Protocol::new(ProtocolName::Http, Some("2.0".to_owned())),
+    ///         Protocol::new(ProtocolName::Unregistered("SHTTP".to_owned()),
+    ///             Some("1.3".to_owned())),
+    ///         Protocol::new(ProtocolName::Unregistered("IRC".to_owned()),
+    ///             Some("6.9".to_owned())),
+    ///     ])
+    /// );
+    /// ```
+    (Upgrade, "Upgrade") => (Protocol)+
+
+    test_upgrade {
+        // Testcase from the RFC
+        test_header!(
+            test1,
+            vec![b"HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11"],
+            Some(Upgrade(vec![
+                Protocol::new(ProtocolName::Http, Some("2.0".to_owned())),
+                Protocol::new(ProtocolName::Unregistered("SHTTP".to_owned()),
+                    Some("1.3".to_owned())),
+                Protocol::new(ProtocolName::Unregistered("IRC".to_owned()), Some("6.9".to_owned())),
+                Protocol::new(ProtocolName::Unregistered("RTA".to_owned()), Some("x11".to_owned())),
+                ])));
+        // Own tests
+        test_header!(
+            test2, vec![b"websocket"],
+            Some(Upgrade(vec![Protocol::new(ProtocolName::WebSocket, None)])));
+        #[test]
+        fn test3() {
+            let x: ::Result<Upgrade> = Header::parse_header(&[b"WEbSOCKet".to_vec()]);
+            assert_eq!(x.ok(), Some(Upgrade(vec![Protocol::new(ProtocolName::WebSocket, None)])));
+        }
+    }
+}
+
+/// A protocol name used to identify a spefic protocol. Names are case-sensitive
+/// except for the `WebSocket` value.
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum ProtocolName {
+    /// `HTTP` value, Hypertext Transfer Protocol
+    Http,
+    /// `TLS` value, Transport Layer Security [RFC2817](http://tools.ietf.org/html/rfc2817)
+    Tls,
+    /// `WebSocket` value, matched case insensitively,Web Socket Protocol
+    /// [RFC6455](http://tools.ietf.org/html/rfc6455)
+    WebSocket,
+    /// `h2c` value, HTTP/2 over cleartext TCP
+    H2c,
+    /// Any other protocol name not known to hyper
+    Unregistered(String),
+}
+
+impl FromStr for ProtocolName {
+    type Err = ();
+    fn from_str(s: &str) -> Result<ProtocolName, ()> {
+        Ok(match s {
+            "HTTP" => ProtocolName::Http,
+            "TLS" => ProtocolName::Tls,
+            "h2c" => ProtocolName::H2c,
+            _ => {
+                if UniCase(s) == UniCase("websocket") {
+                    ProtocolName::WebSocket
+                } else {
+                    ProtocolName::Unregistered(s.to_owned())
+                }
+            }
+        })
+    }
+}
+
+impl Display for ProtocolName {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(match *self {
+            ProtocolName::Http => "HTTP",
+            ProtocolName::Tls => "TLS",
+            ProtocolName::WebSocket => "websocket",
+            ProtocolName::H2c => "h2c",
+            ProtocolName::Unregistered(ref s) => s,
+        })
+    }
+}
+
+/// Protocols that appear in the `Upgrade` header field
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub struct Protocol {
+    /// The protocol identifier
+    pub name: ProtocolName,
+    /// The optional version of the protocol, often in the format "DIGIT.DIGIT" (e.g.. "1.2")
+    pub version: Option<String>,
+}
+
+impl Protocol {
+    /// Creates a new Protocol with the given name and version
+    pub fn new(name: ProtocolName, version: Option<String>) -> Protocol {
+        Protocol { name: name, version: version }
+    }
+}
+
+impl FromStr for Protocol {
+    type Err =();
+    fn from_str(s: &str) -> Result<Protocol, ()> {
+        let mut parts = s.splitn(2, '/');
+        Ok(Protocol::new(try!(parts.next().unwrap().parse()), parts.next().map(|x| x.to_owned())))
+    }
+}
+
+impl Display for Protocol {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        try!(fmt::Display::fmt(&self.name, f));
+        if let Some(ref version) = self.version {
+            try!(write!(f, "/{}", version));
+        }
+        Ok(())
+    }
+}
+
+bench_header!(bench, Upgrade, { vec![b"HTTP/2.0, RTA/x11, websocket".to_vec()] });
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/user_agent.rs
@@ -0,0 +1,42 @@
+header! {
+    /// `User-Agent` header, defined in
+    /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.5.3)
+    ///
+    /// The `User-Agent` header field contains information about the user
+    /// agent originating the request, which is often used by servers to help
+    /// identify the scope of reported interoperability problems, to work
+    /// around or tailor responses to avoid particular user agent
+    /// limitations, and for analytics regarding browser or operating system
+    /// use.  A user agent SHOULD send a User-Agent field in each request
+    /// unless specifically configured not to do so.
+    ///
+    /// # ABNF
+    /// ```plain
+    /// User-Agent = product *( RWS ( product / comment ) )
+    /// product         = token ["/" product-version]
+    /// product-version = token
+    /// ```
+    ///
+    /// # Example values
+    /// * `CERN-LineMode/2.15 libwww/2.17b3`
+    /// * `Bunnies`
+    ///
+    /// # Notes
+    /// * The parser does not split the value
+    ///
+    /// # Example
+    /// ```
+    /// use hyper::header::{Headers, UserAgent};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(UserAgent("hyper/0.5.2".to_owned()));
+    /// ```
+    (UserAgent, "User-Agent") => [String]
+
+    test_user_agent {
+        // Testcase from RFC
+        test_header!(test1, vec![b"CERN-LineMode/2.15 libwww/2.17b3"]);
+        // Own testcase
+        test_header!(test2, vec![b"Bunnies"], Some(UserAgent("Bunnies".to_owned())));
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/common/vary.rs
@@ -0,0 +1,66 @@
+use unicase::UniCase;
+
+header! {
+    /// `Vary` header, defined in [RFC7231](https://tools.ietf.org/html/rfc7231#section-7.1.4)
+    ///
+    /// The "Vary" header field in a response describes what parts of a
+    /// request message, aside from the method, Host header field, and
+    /// request target, might influence the origin server's process for
+    /// selecting and representing this response.  The value consists of
+    /// either a single asterisk ("*") or a list of header field names
+    /// (case-insensitive).
+    ///
+    /// # ABNF
+    /// ```plain
+    /// Vary = "*" / 1#field-name
+    /// ```
+    ///
+    /// # Example values
+    /// * `accept-encoding, accept-language`
+    ///
+    /// # Example
+    /// ```
+    /// use hyper::header::{Headers, Vary};
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(Vary::Any);
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// # extern crate hyper;
+    /// # extern crate unicase;
+    /// # fn main() {
+    /// // extern crate unicase;
+    ///
+    /// use hyper::header::{Headers, Vary};
+    /// use unicase::UniCase;
+    ///
+    /// let mut headers = Headers::new();
+    /// headers.set(
+    ///     Vary::Items(vec![
+    ///         UniCase("accept-encoding".to_owned()),
+    ///         UniCase("accept-language".to_owned()),
+    ///     ])
+    /// );
+    /// # }
+    /// ```
+    (Vary, "Vary") => {Any / (UniCase<String>)+}
+
+    test_vary {
+        test_header!(test1, vec![b"accept-encoding, accept-language"]);
+
+        #[test]
+        fn test2() {
+            let mut vary: ::Result<Vary>;
+
+            vary = Header::parse_header([b"*".to_vec()].as_ref());
+            assert_eq!(vary.ok(), Some(Vary::Any));
+
+            vary = Header::parse_header([b"etag,cookie,allow".to_vec()].as_ref());
+            assert_eq!(vary.ok(), Some(Vary::Items(vec!["eTag".parse().unwrap(),
+                                                        "cookIE".parse().unwrap(),
+                                                        "AlLOw".parse().unwrap(),])));
+        }
+    }
+}
copy from third_party/rust/hyper/src/header/internals/cell.rs
copy to third_party/rust/hyper-0.10.10/src/header/internals/cell.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/internals/item.rs
@@ -0,0 +1,121 @@
+use std::any::Any;
+use std::any::TypeId;
+use std::fmt;
+use std::str::from_utf8;
+
+use super::cell::{OptCell, PtrMapCell};
+use header::{Header, HeaderFormat, MultilineFormatter};
+
+
+#[derive(Clone)]
+pub struct Item {
+    raw: OptCell<Vec<Vec<u8>>>,
+    typed: PtrMapCell<HeaderFormat + Send + Sync>
+}
+
+impl Item {
+    #[inline]
+    pub fn new_raw(data: Vec<Vec<u8>>) -> Item {
+        Item {
+            raw: OptCell::new(Some(data)),
+            typed: PtrMapCell::new(),
+        }
+    }
+
+    #[inline]
+    pub fn new_typed(ty: Box<HeaderFormat + Send + Sync>) -> Item {
+        let map = PtrMapCell::new();
+        unsafe { map.insert((*ty).get_type(), ty); }
+        Item {
+            raw: OptCell::new(None),
+            typed: map,
+        }
+    }
+
+    #[inline]
+    pub fn raw_mut(&mut self) -> &mut Vec<Vec<u8>> {
+        self.raw();
+        self.typed = PtrMapCell::new();
+        unsafe {
+            self.raw.get_mut()
+        }
+    }
+
+    pub fn raw(&self) -> &[Vec<u8>] {
+        if let Some(ref raw) = *self.raw {
+            return &raw[..];
+        }
+
+        let raw = vec![unsafe { self.typed.one() }.to_string().into_bytes()];
+        self.raw.set(raw);
+
+        let raw = self.raw.as_ref().unwrap();
+        &raw[..]
+    }
+
+    pub fn typed<H: Header + HeaderFormat + Any>(&self) -> Option<&H> {
+        let tid = TypeId::of::<H>();
+        match self.typed.get(tid) {
+            Some(val) => Some(val),
+            None => {
+                match parse::<H>(self.raw.as_ref().expect("item.raw must exist")) {
+                    Ok(typed) => {
+                        unsafe { self.typed.insert(tid, typed); }
+                        self.typed.get(tid)
+                    },
+                    Err(_) => None
+                }
+            }
+        }.map(|typed| unsafe { typed.downcast_ref_unchecked() })
+    }
+
+    pub fn typed_mut<H: Header + HeaderFormat>(&mut self) -> Option<&mut H> {
+        let tid = TypeId::of::<H>();
+        if self.typed.get_mut(tid).is_none() {
+            match parse::<H>(self.raw.as_ref().expect("item.raw must exist")) {
+                Ok(typed) => {
+                    unsafe { self.typed.insert(tid, typed); }
+                },
+                Err(_) => ()
+            }
+        }
+        if self.raw.is_some() && self.typed.get_mut(tid).is_some() {
+            self.raw = OptCell::new(None);
+        }
+        self.typed.get_mut(tid).map(|typed| unsafe { typed.downcast_mut_unchecked() })
+    }
+
+    pub fn write_h1(&self, f: &mut MultilineFormatter) -> fmt::Result {
+        match *self.raw {
+            Some(ref raw) => {
+                for part in raw.iter() {
+                    match from_utf8(&part[..]) {
+                        Ok(s) => {
+                            try!(f.fmt_line(&s));
+                        },
+                        Err(_) => {
+                            error!("raw header value is not utf8, value={:?}", part);
+                            return Err(fmt::Error);
+                        }
+                    }
+                }
+                Ok(())
+            },
+            None => {
+                let typed = unsafe { self.typed.one() };
+                typed.fmt_multi_header(f)
+            }
+        }
+    }
+}
+
+#[inline]
+fn parse<H: Header + HeaderFormat>(raw: &Vec<Vec<u8>>) ->
+        ::Result<Box<HeaderFormat + Send + Sync>> {
+    Header::parse_header(&raw[..]).map(|h: H| {
+        // FIXME: Use Type ascription
+        let h: Box<HeaderFormat + Send + Sync> = Box::new(h);
+        h
+    })
+}
+
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/internals/mod.rs
@@ -0,0 +1,6 @@
+pub use self::item::Item;
+pub use self::vec_map::{VecMap, Entry};
+
+mod cell;
+mod item;
+mod vec_map;
copy from third_party/rust/hyper/src/header/internals/vec_map.rs
copy to third_party/rust/hyper-0.10.10/src/header/internals/vec_map.rs
copy from third_party/rust/hyper/src/header/mod.rs
copy to third_party/rust/hyper-0.10.10/src/header/mod.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/parsing.rs
@@ -0,0 +1,224 @@
+//! Utility functions for Header implementations.
+
+use language_tags::LanguageTag;
+use std::str;
+use std::str::FromStr;
+use std::fmt::{self, Display};
+use url::percent_encoding;
+
+use header::shared::Charset;
+
+/// Reads a single raw string when parsing a header.
+pub fn from_one_raw_str<T: str::FromStr>(raw: &[Vec<u8>]) -> ::Result<T> {
+    if raw.len() != 1 || unsafe { raw.get_unchecked(0) } == b"" { return Err(::Error::Header) }
+    // we JUST checked that raw.len() == 1, so raw[0] WILL exist.
+    from_raw_str(& unsafe { raw.get_unchecked(0) })
+}
+
+/// Reads a raw string into a value.
+pub fn from_raw_str<T: str::FromStr>(raw: &[u8]) -> ::Result<T> {
+    let s = try!(str::from_utf8(raw));
+    T::from_str(s).or(Err(::Error::Header))
+}
+
+/// Reads a comma-delimited raw header into a Vec.
+#[inline]
+pub fn from_comma_delimited<T: str::FromStr, S: AsRef<[u8]>>(raw: &[S]) -> ::Result<Vec<T>> {
+    let mut result = Vec::new();
+    for s in raw {
+        let s = try!(str::from_utf8(s.as_ref()));
+        result.extend(s.split(',')
+                      .filter_map(|x| match x.trim() {
+                          "" => None,
+                          y => Some(y)
+                      })
+                      .filter_map(|x| x.parse().ok()))
+    }
+    Ok(result)
+}
+
+/// Format an array into a comma-delimited string.
+pub fn fmt_comma_delimited<T: Display>(f: &mut fmt::Formatter, parts: &[T]) -> fmt::Result {
+    for (i, part) in parts.iter().enumerate() {
+        if i != 0 {
+            try!(f.write_str(", "));
+        }
+        try!(Display::fmt(part, f));
+    }
+    Ok(())
+}
+
+/// An extended header parameter value (i.e., tagged with a character set and optionally,
+/// a language), as defined in [RFC 5987](https://tools.ietf.org/html/rfc5987#section-3.2).
+#[derive(Clone, Debug, PartialEq)]
+pub struct ExtendedValue {
+    /// The character set that is used to encode the `value` to a string.
+    pub charset: Charset,
+    /// The human language details of the `value`, if available.
+    pub language_tag: Option<LanguageTag>,
+    /// The parameter value, as expressed in octets.
+    pub value: Vec<u8>,
+}
+
+/// Parses extended header parameter values (`ext-value`), as defined in
+/// [RFC 5987](https://tools.ietf.org/html/rfc5987#section-3.2).
+///
+/// Extended values are denoted by parameter names that end with `*`.
+///
+/// ## ABNF
+/// ```plain
+/// ext-value     = charset  "'" [ language ] "'" value-chars
+///               ; like RFC 2231's <extended-initial-value>
+///               ; (see [RFC2231], Section 7)
+///
+/// charset       = "UTF-8" / "ISO-8859-1" / mime-charset
+///
+/// mime-charset  = 1*mime-charsetc
+/// mime-charsetc = ALPHA / DIGIT
+///               / "!" / "#" / "$" / "%" / "&"
+///               / "+" / "-" / "^" / "_" / "`"
+///               / "{" / "}" / "~"
+///               ; as <mime-charset> in Section 2.3 of [RFC2978]
+///               ; except that the single quote is not included
+///               ; SHOULD be registered in the IANA charset registry
+///
+/// language      = <Language-Tag, defined in [RFC5646], Section 2.1>
+///
+/// value-chars   = *( pct-encoded / attr-char )
+///
+/// pct-encoded   = "%" HEXDIG HEXDIG
+///               ; see [RFC3986], Section 2.1
+///
+/// attr-char     = ALPHA / DIGIT
+///               / "!" / "#" / "$" / "&" / "+" / "-" / "."
+///               / "^" / "_" / "`" / "|" / "~"
+///               ; token except ( "*" / "'" / "%" )
+/// ```
+pub fn parse_extended_value(val: &str) -> ::Result<ExtendedValue> {
+
+    // Break into three pieces separated by the single-quote character
+    let mut parts = val.splitn(3,'\'');
+
+    // Interpret the first piece as a Charset
+    let charset: Charset = match parts.next() {
+        None => return Err(::Error::Header),
+        Some(n) => try!(FromStr::from_str(n)),
+    };
+
+    // Interpret the second piece as a language tag
+    let lang: Option<LanguageTag> = match parts.next() {
+        None => return Err(::Error::Header),
+        Some("") => None,
+        Some(s) => match s.parse() {
+            Ok(lt) => Some(lt),
+            Err(_) => return Err(::Error::Header),
+        }
+    };
+
+    // Interpret the third piece as a sequence of value characters
+    let value: Vec<u8> = match parts.next() {
+        None => return Err(::Error::Header),
+        Some(v) => percent_encoding::percent_decode(v.as_bytes()).collect(),
+    };
+
+    Ok(ExtendedValue {
+        charset: charset,
+        language_tag: lang,
+        value: value,
+    })
+}
+
+define_encode_set! {
+    /// This encode set is used for HTTP header values and is defined at
+    /// https://tools.ietf.org/html/rfc5987#section-3.2
+    pub HTTP_VALUE = [percent_encoding::SIMPLE_ENCODE_SET] | {
+        ' ', '"', '%', '\'', '(', ')', '*', ',', '/', ':', ';', '<', '-', '>', '?',
+        '[', '\\', ']', '{', '}'
+    }
+}
+
+impl Display for ExtendedValue {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let encoded_value =
+            percent_encoding::percent_encode(&self.value[..], HTTP_VALUE);
+        if let Some(ref lang) = self.language_tag {
+            write!(f, "{}'{}'{}", self.charset, lang, encoded_value)
+        } else {
+            write!(f, "{}''{}", self.charset, encoded_value)
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use header::shared::Charset;
+    use super::{ExtendedValue, parse_extended_value};
+
+    #[test]
+    fn test_parse_extended_value_with_encoding_and_language_tag() {
+        let expected_language_tag = langtag!(en);
+        // RFC 5987, Section 3.2.2
+        // Extended notation, using the Unicode character U+00A3 (POUND SIGN)
+        let result = parse_extended_value("iso-8859-1'en'%A3%20rates");
+        assert!(result.is_ok());
+        let extended_value = result.unwrap();
+        assert_eq!(Charset::Iso_8859_1, extended_value.charset);
+        assert!(extended_value.language_tag.is_some());
+        assert_eq!(expected_language_tag, extended_value.language_tag.unwrap());
+        assert_eq!(vec![163, b' ', b'r', b'a', b't', b'e', b's'], extended_value.value);
+    }
+
+    #[test]
+    fn test_parse_extended_value_with_encoding() {
+        // RFC 5987, Section 3.2.2
+        // Extended notation, using the Unicode characters U+00A3 (POUND SIGN)
+        // and U+20AC (EURO SIGN)
+        let result = parse_extended_value("UTF-8''%c2%a3%20and%20%e2%82%ac%20rates");
+        assert!(result.is_ok());
+        let extended_value = result.unwrap();
+        assert_eq!(Charset::Ext("UTF-8".to_string()), extended_value.charset);
+        assert!(extended_value.language_tag.is_none());
+        assert_eq!(vec![194, 163, b' ', b'a', b'n', b'd', b' ', 226, 130, 172, b' ', b'r', b'a', b't', b'e', b's'], extended_value.value);
+    }
+
+    #[test]
+    fn test_parse_extended_value_missing_language_tag_and_encoding() {
+        // From: https://greenbytes.de/tech/tc2231/#attwithfn2231quot2
+        let result = parse_extended_value("foo%20bar.html");
+        assert!(result.is_err());
+    }
+
+    #[test]
+    fn test_parse_extended_value_partially_formatted() {
+        let result = parse_extended_value("UTF-8'missing third part");
+        assert!(result.is_err());
+    }
+
+    #[test]
+    fn test_parse_extended_value_partially_formatted_blank() {
+        let result = parse_extended_value("blank second part'");
+        assert!(result.is_err());
+    }
+
+    #[test]
+    fn test_fmt_extended_value_with_encoding_and_language_tag() {
+        let extended_value = ExtendedValue {
+            charset: Charset::Iso_8859_1,
+            language_tag: Some("en".parse().expect("Could not parse language tag")),
+            value: vec![163, b' ', b'r', b'a', b't', b'e', b's'],
+        };
+        assert_eq!("ISO-8859-1'en'%A3%20rates", format!("{}", extended_value));
+    }
+
+    #[test]
+    fn test_fmt_extended_value_with_encoding() {
+        let extended_value = ExtendedValue {
+            charset: Charset::Ext("UTF-8".to_string()),
+            language_tag: None,
+            value: vec![194, 163, b' ', b'a', b'n', b'd', b' ', 226, 130, 172, b' ', b'r', b'a',
+                        b't', b'e', b's'],
+        };
+        assert_eq!("UTF-8''%C2%A3%20and%20%E2%82%AC%20rates",
+                   format!("{}", extended_value));
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/shared/charset.rs
@@ -0,0 +1,151 @@
+use std::fmt::{self, Display};
+use std::str::FromStr;
+use std::ascii::AsciiExt;
+
+use self::Charset::*;
+
+/// A Mime charset.
+///
+/// The string representation is normalised to upper case.
+///
+/// See http://www.iana.org/assignments/character-sets/character-sets.xhtml
+#[derive(Clone,Debug,PartialEq)]
+#[allow(non_camel_case_types)]
+pub enum Charset{
+    /// US ASCII
+    Us_Ascii,
+    /// ISO-8859-1
+    Iso_8859_1,
+    /// ISO-8859-2
+    Iso_8859_2,
+    /// ISO-8859-3
+    Iso_8859_3,
+    /// ISO-8859-4
+    Iso_8859_4,
+    /// ISO-8859-5
+    Iso_8859_5,
+    /// ISO-8859-6
+    Iso_8859_6,
+    /// ISO-8859-7
+    Iso_8859_7,
+    /// ISO-8859-8
+    Iso_8859_8,
+    /// ISO-8859-9
+    Iso_8859_9,
+    /// ISO-8859-10
+    Iso_8859_10,
+    /// Shift_JIS
+    Shift_Jis,
+    /// EUC-JP
+    Euc_Jp,
+    /// ISO-2022-KR
+    Iso_2022_Kr,
+    /// EUC-KR
+    Euc_Kr,
+    /// ISO-2022-JP
+    Iso_2022_Jp,
+    /// ISO-2022-JP-2
+    Iso_2022_Jp_2,
+    /// ISO-8859-6-E
+    Iso_8859_6_E,
+    /// ISO-8859-6-I
+    Iso_8859_6_I,
+    /// ISO-8859-8-E
+    Iso_8859_8_E,
+    /// ISO-8859-8-I
+    Iso_8859_8_I,
+    /// GB2312
+    Gb2312,
+    /// Big5
+    Big5,
+    /// KOI8-R
+    Koi8_R,
+    /// An arbitrary charset specified as a string
+    Ext(String)
+}
+
+impl Charset {
+    fn name(&self) -> &str {
+        match *self {
+            Us_Ascii => "US-ASCII",
+            Iso_8859_1 => "ISO-8859-1",
+            Iso_8859_2 => "ISO-8859-2",
+            Iso_8859_3 => "ISO-8859-3",
+            Iso_8859_4 => "ISO-8859-4",
+            Iso_8859_5 => "ISO-8859-5",
+            Iso_8859_6 => "ISO-8859-6",
+            Iso_8859_7 => "ISO-8859-7",
+            Iso_8859_8 => "ISO-8859-8",
+            Iso_8859_9 => "ISO-8859-9",
+            Iso_8859_10 => "ISO-8859-10",
+            Shift_Jis => "Shift-JIS",
+            Euc_Jp => "EUC-JP",
+            Iso_2022_Kr => "ISO-2022-KR",
+            Euc_Kr => "EUC-KR",
+            Iso_2022_Jp => "ISO-2022-JP",
+            Iso_2022_Jp_2 => "ISO-2022-JP-2",
+            Iso_8859_6_E => "ISO-8859-6-E",
+            Iso_8859_6_I => "ISO-8859-6-I",
+            Iso_8859_8_E => "ISO-8859-8-E",
+            Iso_8859_8_I => "ISO-8859-8-I",
+            Gb2312 => "GB2312",
+            Big5 => "5",
+            Koi8_R => "KOI8-R",
+            Ext(ref s) => &s
+        }
+    }
+}
+
+impl Display for Charset {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(self.name())
+    }
+}
+
+impl FromStr for Charset {
+    type Err = ::Error;
+    fn from_str(s: &str) -> ::Result<Charset> {
+        Ok(match s.to_ascii_uppercase().as_ref() {
+            "US-ASCII" => Us_Ascii,
+            "ISO-8859-1" => Iso_8859_1,
+            "ISO-8859-2" => Iso_8859_2,
+            "ISO-8859-3" => Iso_8859_3,
+            "ISO-8859-4" => Iso_8859_4,
+            "ISO-8859-5" => Iso_8859_5,
+            "ISO-8859-6" => Iso_8859_6,
+            "ISO-8859-7" => Iso_8859_7,
+            "ISO-8859-8" => Iso_8859_8,
+            "ISO-8859-9" => Iso_8859_9,
+            "ISO-8859-10" => Iso_8859_10,
+            "SHIFT-JIS" => Shift_Jis,
+            "EUC-JP" => Euc_Jp,
+            "ISO-2022-KR" => Iso_2022_Kr,
+            "EUC-KR" => Euc_Kr,
+            "ISO-2022-JP" => Iso_2022_Jp,
+            "ISO-2022-JP-2" => Iso_2022_Jp_2,
+            "ISO-8859-6-E" => Iso_8859_6_E,
+            "ISO-8859-6-I" => Iso_8859_6_I,
+            "ISO-8859-8-E" => Iso_8859_8_E,
+            "ISO-8859-8-I" => Iso_8859_8_I,
+            "GB2312" => Gb2312,
+            "5" => Big5,
+            "KOI8-R" => Koi8_R,
+            s => Ext(s.to_owned())
+        })
+    }
+}
+
+#[test]
+fn test_parse() {
+    assert_eq!(Us_Ascii,"us-ascii".parse().unwrap());
+    assert_eq!(Us_Ascii,"US-Ascii".parse().unwrap());
+    assert_eq!(Us_Ascii,"US-ASCII".parse().unwrap());
+    assert_eq!(Shift_Jis,"Shift-JIS".parse().unwrap());
+    assert_eq!(Ext("ABCD".to_owned()),"abcd".parse().unwrap());
+}
+
+#[test]
+fn test_display() {
+    assert_eq!("US-ASCII", format!("{}", Us_Ascii));
+    assert_eq!("ABCD", format!("{}", Ext("ABCD".to_owned())));
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/shared/encoding.rs
@@ -0,0 +1,49 @@
+use std::fmt;
+use std::str;
+
+pub use self::Encoding::{Chunked, Gzip, Deflate, Compress, Identity, EncodingExt};
+
+/// A value to represent an encoding used in `Transfer-Encoding`
+/// or `Accept-Encoding` header.
+#[derive(Clone, PartialEq, Debug)]
+pub enum Encoding {
+    /// The `chunked` encoding.
+    Chunked,
+    /// The `gzip` encoding.
+    Gzip,
+    /// The `deflate` encoding.
+    Deflate,
+    /// The `compress` encoding.
+    Compress,
+    /// The `identity` encoding.
+    Identity,
+    /// Some other encoding that is less common, can be any String.
+    EncodingExt(String)
+}
+
+impl fmt::Display for Encoding {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(match *self {
+            Chunked => "chunked",
+            Gzip => "gzip",
+            Deflate => "deflate",
+            Compress => "compress",
+            Identity => "identity",
+            EncodingExt(ref s) => s.as_ref()
+        })
+    }
+}
+
+impl str::FromStr for Encoding {
+    type Err = ::Error;
+    fn from_str(s: &str) -> ::Result<Encoding> {
+        match s {
+            "chunked" => Ok(Chunked),
+            "deflate" => Ok(Deflate),
+            "gzip" => Ok(Gzip),
+            "compress" => Ok(Compress),
+            "identity" => Ok(Identity),
+            _ => Ok(EncodingExt(s.to_owned()))
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/shared/entity.rs
@@ -0,0 +1,215 @@
+use std::str::FromStr;
+use std::fmt::{self, Display};
+
+// check that each char in the slice is either:
+// 1. %x21, or
+// 2. in the range %x23 to %x7E, or
+// 3. in the range %x80 to %xFF
+fn check_slice_validity(slice: &str) -> bool {
+    slice.bytes().all(|c|
+        c == b'\x21' || (c >= b'\x23' && c <= b'\x7e') | (c >= b'\x80' && c <= b'\xff'))
+}
+
+/// An entity tag, defined in [RFC7232](https://tools.ietf.org/html/rfc7232#section-2.3)
+///
+/// An entity tag consists of a string enclosed by two literal double quotes.
+/// Preceding the first double quote is an optional weakness indicator,
+/// which always looks like `W/`. Examples for valid tags are `"xyzzy"` and `W/"xyzzy"`.
+///
+/// # ABNF
+/// ```plain
+/// entity-tag = [ weak ] opaque-tag
+/// weak       = %x57.2F ; "W/", case-sensitive
+/// opaque-tag = DQUOTE *etagc DQUOTE
+/// etagc      = %x21 / %x23-7E / obs-text
+///            ; VCHAR except double quotes, plus obs-text
+/// ```
+///
+/// # Comparison
+/// To check if two entity tags are equivalent in an application always use the `strong_eq` or
+/// `weak_eq` methods based on the context of the Tag. Only use `==` to check if two tags are
+/// identical.
+///
+/// The example below shows the results for a set of entity-tag pairs and
+/// both the weak and strong comparison function results:
+///
+/// | ETag 1  | ETag 2  | Strong Comparison | Weak Comparison |
+/// |---------|---------|-------------------|-----------------|
+/// | `W/"1"` | `W/"1"` | no match          | match           |
+/// | `W/"1"` | `W/"2"` | no match          | no match        |
+/// | `W/"1"` | `"1"`   | no match          | match           |
+/// | `"1"`   | `"1"`   | match             | match           |
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub struct EntityTag {
+    /// Weakness indicator for the tag
+    pub weak: bool,
+    /// The opaque string in between the DQUOTEs
+    tag: String
+}
+
+impl EntityTag {
+    /// Constructs a new EntityTag.
+    /// # Panics
+    /// If the tag contains invalid characters.
+    pub fn new(weak: bool, tag: String) -> EntityTag {
+        assert!(check_slice_validity(&tag), "Invalid tag: {:?}", tag);
+        EntityTag { weak: weak, tag: tag }
+    }
+
+    /// Constructs a new weak EntityTag.
+    /// # Panics
+    /// If the tag contains invalid characters.
+    pub fn weak(tag: String) -> EntityTag {
+        EntityTag::new(true, tag)
+    }
+
+    /// Constructs a new strong EntityTag.
+    /// # Panics
+    /// If the tag contains invalid characters.
+    pub fn strong(tag: String) -> EntityTag {
+        EntityTag::new(false, tag)
+    }
+
+    /// Get the tag.
+    pub fn tag(&self) -> &str {
+        self.tag.as_ref()
+    }
+
+    /// Set the tag.
+    /// # Panics
+    /// If the tag contains invalid characters.
+    pub fn set_tag(&mut self, tag: String) {
+        assert!(check_slice_validity(&tag), "Invalid tag: {:?}", tag);
+        self.tag = tag
+    }
+
+    /// For strong comparison two entity-tags are equivalent if both are not weak and their
+    /// opaque-tags match character-by-character.
+    pub fn strong_eq(&self, other: &EntityTag) -> bool {
+        !self.weak && !other.weak && self.tag == other.tag
+    }
+
+    /// For weak comparison two entity-tags are equivalent if their
+    /// opaque-tags match character-by-character, regardless of either or
+    /// both being tagged as "weak".
+    pub fn weak_eq(&self, other: &EntityTag) -> bool {
+        self.tag == other.tag
+    }
+
+    /// The inverse of `EntityTag.strong_eq()`.
+    pub fn strong_ne(&self, other: &EntityTag) -> bool {
+        !self.strong_eq(other)
+    }
+
+    /// The inverse of `EntityTag.weak_eq()`.
+    pub fn weak_ne(&self, other: &EntityTag) -> bool {
+        !self.weak_eq(other)
+    }
+}
+
+impl Display for EntityTag {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        if self.weak {
+            write!(f, "W/\"{}\"", self.tag)
+        } else {
+            write!(f, "\"{}\"", self.tag)
+        }
+    }
+}
+
+impl FromStr for EntityTag {
+    type Err = ::Error;
+    fn from_str(s: &str) -> ::Result<EntityTag> {
+        let length: usize = s.len();
+        let slice = &s[..];
+        // Early exits if it doesn't terminate in a DQUOTE.
+        if !slice.ends_with('"') {
+            return Err(::Error::Header);
+        }
+        // The etag is weak if its first char is not a DQUOTE.
+        if slice.starts_with('"') && check_slice_validity(&slice[1..length-1]) {
+            // No need to check if the last char is a DQUOTE,
+            // we already did that above.
+            return Ok(EntityTag { weak: false, tag: slice[1..length-1].to_owned() });
+        } else if slice.starts_with("W/\"") && check_slice_validity(&slice[3..length-1]) {
+            return Ok(EntityTag { weak: true, tag: slice[3..length-1].to_owned() });
+        }
+        Err(::Error::Header)
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::EntityTag;
+
+    #[test]
+    fn test_etag_parse_success() {
+        // Expected success
+        assert_eq!("\"foobar\"".parse::<EntityTag>().unwrap(),
+            EntityTag::strong("foobar".to_owned()));
+        assert_eq!("\"\"".parse::<EntityTag>().unwrap(),
+            EntityTag::strong("".to_owned()));
+        assert_eq!("W/\"weaktag\"".parse::<EntityTag>().unwrap(),
+            EntityTag::weak("weaktag".to_owned()));
+        assert_eq!("W/\"\x65\x62\"".parse::<EntityTag>().unwrap(),
+            EntityTag::weak("\x65\x62".to_owned()));
+        assert_eq!("W/\"\"".parse::<EntityTag>().unwrap(), EntityTag::weak("".to_owned()));
+    }
+
+    #[test]
+    fn test_etag_parse_failures() {
+        // Expected failures
+        assert!("no-dquotes".parse::<EntityTag>().is_err());
+        assert!("w/\"the-first-w-is-case-sensitive\"".parse::<EntityTag>().is_err());
+        assert!("".parse::<EntityTag>().is_err());
+        assert!("\"unmatched-dquotes1".parse::<EntityTag>().is_err());
+        assert!("unmatched-dquotes2\"".parse::<EntityTag>().is_err());
+        assert!("matched-\"dquotes\"".parse::<EntityTag>().is_err());
+    }
+
+    #[test]
+    fn test_etag_fmt() {
+        assert_eq!(format!("{}", EntityTag::strong("foobar".to_owned())), "\"foobar\"");
+        assert_eq!(format!("{}", EntityTag::strong("".to_owned())), "\"\"");
+        assert_eq!(format!("{}", EntityTag::weak("weak-etag".to_owned())), "W/\"weak-etag\"");
+        assert_eq!(format!("{}", EntityTag::weak("\u{0065}".to_owned())), "W/\"\x65\"");
+        assert_eq!(format!("{}", EntityTag::weak("".to_owned())), "W/\"\"");
+    }
+
+    #[test]
+    fn test_cmp() {
+        // | ETag 1  | ETag 2  | Strong Comparison | Weak Comparison |
+        // |---------|---------|-------------------|-----------------|
+        // | `W/"1"` | `W/"1"` | no match          | match           |
+        // | `W/"1"` | `W/"2"` | no match          | no match        |
+        // | `W/"1"` | `"1"`   | no match          | match           |
+        // | `"1"`   | `"1"`   | match             | match           |
+        let mut etag1 = EntityTag::weak("1".to_owned());
+        let mut etag2 = EntityTag::weak("1".to_owned());
+        assert!(!etag1.strong_eq(&etag2));
+        assert!(etag1.weak_eq(&etag2));
+        assert!(etag1.strong_ne(&etag2));
+        assert!(!etag1.weak_ne(&etag2));
+
+        etag1 = EntityTag::weak("1".to_owned());
+        etag2 = EntityTag::weak("2".to_owned());
+        assert!(!etag1.strong_eq(&etag2));
+        assert!(!etag1.weak_eq(&etag2));
+        assert!(etag1.strong_ne(&etag2));
+        assert!(etag1.weak_ne(&etag2));
+
+        etag1 = EntityTag::weak("1".to_owned());
+        etag2 = EntityTag::strong("1".to_owned());
+        assert!(!etag1.strong_eq(&etag2));
+        assert!(etag1.weak_eq(&etag2));
+        assert!(etag1.strong_ne(&etag2));
+        assert!(!etag1.weak_ne(&etag2));
+
+        etag1 = EntityTag::strong("1".to_owned());
+        etag2 = EntityTag::strong("1".to_owned());
+        assert!(etag1.strong_eq(&etag2));
+        assert!(etag1.weak_eq(&etag2));
+        assert!(!etag1.strong_ne(&etag2));
+        assert!(!etag1.weak_ne(&etag2));
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/shared/httpdate.rs
@@ -0,0 +1,91 @@
+use std::str::FromStr;
+use std::fmt::{self, Display};
+
+use time;
+
+/// A `time::Time` with HTTP formatting and parsing
+///
+//   Prior to 1995, there were three different formats commonly used by
+//   servers to communicate timestamps.  For compatibility with old
+//   implementations, all three are defined here.  The preferred format is
+//   a fixed-length and single-zone subset of the date and time
+//   specification used by the Internet Message Format [RFC5322].
+//
+//     HTTP-date    = IMF-fixdate / obs-date
+//
+//   An example of the preferred format is
+//
+//     Sun, 06 Nov 1994 08:49:37 GMT    ; IMF-fixdate
+//
+//   Examples of the two obsolete formats are
+//
+//     Sunday, 06-Nov-94 08:49:37 GMT   ; obsolete RFC 850 format
+//     Sun Nov  6 08:49:37 1994         ; ANSI C's asctime() format
+//
+//   A recipient that parses a timestamp value in an HTTP header field
+//   MUST accept all three HTTP-date formats.  When a sender generates a
+//   header field that contains one or more timestamps defined as
+//   HTTP-date, the sender MUST generate those timestamps in the
+//   IMF-fixdate format.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
+pub struct HttpDate(pub time::Tm);
+
+impl FromStr for HttpDate {
+    type Err = ::Error;
+    fn from_str(s: &str) -> ::Result<HttpDate> {
+        match time::strptime(s, "%a, %d %b %Y %T %Z").or_else(|_| {
+            time::strptime(s, "%A, %d-%b-%y %T %Z")
+            }).or_else(|_| {
+                time::strptime(s, "%c")
+                }) {
+                    Ok(t) => Ok(HttpDate(t)),
+                    Err(_) => Err(::Error::Header),
+                    }
+    }
+}
+
+impl Display for HttpDate {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&self.0.to_utc().rfc822(), f)
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use time::Tm;
+    use super::HttpDate;
+
+    const NOV_07: HttpDate = HttpDate(Tm {
+        tm_nsec: 0,
+        tm_sec: 37,
+        tm_min: 48,
+        tm_hour: 8,
+        tm_mday: 7,
+        tm_mon: 10,
+        tm_year: 94,
+        tm_wday: 0,
+        tm_isdst: 0,
+        tm_yday: 0,
+        tm_utcoff: 0,
+    });
+
+    #[test]
+    fn test_imf_fixdate() {
+        assert_eq!("Sun, 07 Nov 1994 08:48:37 GMT".parse::<HttpDate>().unwrap(), NOV_07);
+    }
+
+    #[test]
+    fn test_rfc_850() {
+        assert_eq!("Sunday, 07-Nov-94 08:48:37 GMT".parse::<HttpDate>().unwrap(), NOV_07);
+    }
+
+    #[test]
+    fn test_asctime() {
+        assert_eq!("Sun Nov  7 08:48:37 1994".parse::<HttpDate>().unwrap(), NOV_07);
+    }
+
+    #[test]
+    fn test_no_date() {
+        assert!("this-is-no-date".parse::<HttpDate>().is_err());
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/shared/mod.rs
@@ -0,0 +1,11 @@
+pub use self::charset::Charset;
+pub use self::encoding::Encoding;
+pub use self::entity::EntityTag;
+pub use self::httpdate::HttpDate;
+pub use self::quality_item::{Quality, QualityItem, qitem, q};
+
+mod charset;
+mod encoding;
+mod entity;
+mod httpdate;
+mod quality_item;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/header/shared/quality_item.rs
@@ -0,0 +1,215 @@
+use std::cmp;
+use std::default::Default;
+use std::fmt;
+use std::str;
+
+/// Represents a quality used in quality values.
+///
+/// Can be created with the `q` function.
+///
+/// # Implementation notes
+///
+/// The quality value is defined as a number between 0 and 1 with three decimal places. This means
+/// there are 1000 possible values. Since floating point numbers are not exact and the smallest
+/// floating point data type (`f32`) consumes four bytes, hyper uses an `u16` value to store the
+/// quality internally. For performance reasons you may set quality directly to a value between
+/// 0 and 1000 e.g. `Quality(532)` matches the quality `q=0.532`.
+///
+/// [RFC7231 Section 5.3.1](https://tools.ietf.org/html/rfc7231#section-5.3.1)
+/// gives more information on quality values in HTTP header fields.
+#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
+pub struct Quality(pub u16);
+
+impl fmt::Display for Quality {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self.0 {
+            1000 => Ok(()),
+            0 => f.write_str("; q=0"),
+            x => write!(f, "; q=0.{}", format!("{:03}", x).trim_right_matches('0'))
+        }
+    }
+}
+
+impl Default for Quality {
+    fn default() -> Quality {
+        Quality(1000)
+    }
+}
+
+/// Represents an item with a quality value as defined in
+/// [RFC7231](https://tools.ietf.org/html/rfc7231#section-5.3.1).
+#[derive(Clone, PartialEq, Debug)]
+pub struct QualityItem<T> {
+    /// The actual contents of the field.
+    pub item: T,
+    /// The quality (client or server preference) for the value.
+    pub quality: Quality,
+}
+
+impl<T> QualityItem<T> {
+    /// Creates a new `QualityItem` from an item and a quality.
+    /// The item can be of any type.
+    /// The quality should be a value in the range [0, 1].
+    pub fn new(item: T, quality: Quality) -> QualityItem<T> {
+        QualityItem {
+            item: item,
+            quality: quality
+        }
+    }
+}
+
+impl<T: PartialEq> cmp::PartialOrd for QualityItem<T> {
+    fn partial_cmp(&self, other: &QualityItem<T>) -> Option<cmp::Ordering> {
+        self.quality.partial_cmp(&other.quality)
+    }
+}
+
+impl<T: fmt::Display> fmt::Display for QualityItem<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{}{}", self.item, format!("{}", self.quality))
+    }
+}
+
+impl<T: str::FromStr> str::FromStr for QualityItem<T> {
+    type Err = ::Error;
+    fn from_str(s: &str) -> ::Result<QualityItem<T>> {
+        // Set defaults used if parsing fails.
+        let mut raw_item = s;
+        let mut quality = 1f32;
+
+        let parts: Vec<&str> = s.rsplitn(2, ';').map(|x| x.trim()).collect();
+        if parts.len() == 2 {
+            let start = &parts[0][0..2];
+            if start == "q=" || start == "Q=" {
+                let q_part = &parts[0][2..parts[0].len()];
+                if q_part.len() > 5 {
+                    return Err(::Error::Header);
+                }
+                match q_part.parse::<f32>() {
+                    Ok(q_value) => {
+                        if 0f32 <= q_value && q_value <= 1f32 {
+                            quality = q_value;
+                            raw_item = parts[1];
+                            } else {
+                                return Err(::Error::Header);
+                            }
+                        },
+                    Err(_) => return Err(::Error::Header),
+                }
+            }
+        }
+        match raw_item.parse::<T>() {
+            // we already checked above that the quality is within range
+            Ok(item) => Ok(QualityItem::new(item, from_f32(quality))),
+            Err(_) => Err(::Error::Header),
+        }
+    }
+}
+
+fn from_f32(f: f32) -> Quality {
+    // this function is only used internally. A check that `f` is within range
+    // should be done before calling this method. Just in case, this
+    // debug_assert should catch if we were forgetful
+    debug_assert!(f >= 0f32 && f <= 1f32, "q value must be between 0.0 and 1.0");
+    Quality((f * 1000f32) as u16)
+}
+
+/// Convinience function to wrap a value in a `QualityItem`
+/// Sets `q` to the default 1.0
+pub fn qitem<T>(item: T) -> QualityItem<T> {
+    QualityItem::new(item, Default::default())
+}
+
+/// Convenience function to create a `Quality` from a float.
+pub fn q(f: f32) -> Quality {
+    assert!(f >= 0f32 && f <= 1f32, "q value must be between 0.0 and 1.0");
+    from_f32(f)
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use super::super::encoding::*;
+
+    #[test]
+    fn test_quality_item_show1() {
+        let x = qitem(Chunked);
+        assert_eq!(format!("{}", x), "chunked");
+    }
+    #[test]
+    fn test_quality_item_show2() {
+        let x = QualityItem::new(Chunked, Quality(1));
+        assert_eq!(format!("{}", x), "chunked; q=0.001");
+    }
+    #[test]
+    fn test_quality_item_show3() {
+        // Custom value
+        let x = QualityItem{
+            item: EncodingExt("identity".to_owned()),
+            quality: Quality(500),
+        };
+        assert_eq!(format!("{}", x), "identity; q=0.5");
+    }
+
+    #[test]
+    fn test_quality_item_from_str1() {
+        let x: ::Result<QualityItem<Encoding>> = "chunked".parse();
+        assert_eq!(x.unwrap(), QualityItem{ item: Chunked, quality: Quality(1000), });
+    }
+    #[test]
+    fn test_quality_item_from_str2() {
+        let x: ::Result<QualityItem<Encoding>> = "chunked; q=1".parse();
+        assert_eq!(x.unwrap(), QualityItem{ item: Chunked, quality: Quality(1000), });
+    }
+    #[test]
+    fn test_quality_item_from_str3() {
+        let x: ::Result<QualityItem<Encoding>> = "gzip; q=0.5".parse();
+        assert_eq!(x.unwrap(), QualityItem{ item: Gzip, quality: Quality(500), });
+    }
+    #[test]
+    fn test_quality_item_from_str4() {
+        let x: ::Result<QualityItem<Encoding>> = "gzip; q=0.273".parse();
+        assert_eq!(x.unwrap(), QualityItem{ item: Gzip, quality: Quality(273), });
+    }
+    #[test]
+    fn test_quality_item_from_str5() {
+        let x: ::Result<QualityItem<Encoding>> = "gzip; q=0.2739999".parse();
+        assert!(x.is_err());
+    }
+    #[test]
+    fn test_quality_item_from_str6() {
+        let x: ::Result<QualityItem<Encoding>> = "gzip; q=2".parse();
+        assert!(x.is_err());
+    }
+    #[test]
+    fn test_quality_item_ordering() {
+        let x: QualityItem<Encoding> = "gzip; q=0.5".parse().ok().unwrap();
+        let y: QualityItem<Encoding> = "gzip; q=0.273".parse().ok().unwrap();
+        let comparision_result: bool = x.gt(&y);
+        assert!(comparision_result)
+    }
+
+    #[test]
+    fn test_quality() {
+        assert_eq!(q(0.5), Quality(500));
+    }
+
+    #[test]
+    fn test_quality2() {
+        assert_eq!(format!("{}", q(0.0)), "; q=0");
+    }
+
+    #[test]
+    #[should_panic] // FIXME - 32-bit msvc unwinding broken
+    #[cfg_attr(all(target_arch="x86", target_env="msvc"), ignore)]
+    fn test_quality_invalid() {
+        q(-1.0);
+    }
+
+    #[test]
+    #[should_panic] // FIXME - 32-bit msvc unwinding broken
+    #[cfg_attr(all(target_arch="x86", target_env="msvc"), ignore)]
+    fn test_quality_invalid2() {
+        q(2.0);
+    }
+}
copy from third_party/rust/hyper/src/http/h1.rs
copy to third_party/rust/hyper-0.10.10/src/http/h1.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/http/message.rs
@@ -0,0 +1,133 @@
+//! Defines the `HttpMessage` trait that serves to encapsulate the operations of a single
+//! request-response cycle on any HTTP connection.
+
+use std::any::{Any, TypeId};
+use std::fmt::Debug;
+use std::io::{Read, Write};
+use std::mem;
+
+use std::io;
+use std::time::Duration;
+
+use typeable::Typeable;
+
+use header::Headers;
+use http::RawStatus;
+use url::Url;
+
+use method;
+use version;
+use traitobject;
+
+/// The trait provides an API for creating new `HttpMessage`s depending on the underlying HTTP
+/// protocol.
+pub trait Protocol {
+    /// Creates a fresh `HttpMessage` bound to the given host, based on the given protocol scheme.
+    fn new_message(&self, host: &str, port: u16, scheme: &str) -> ::Result<Box<HttpMessage>>;
+}
+
+/// Describes a request.
+#[derive(Clone, Debug)]
+pub struct RequestHead {
+    /// The headers of the request
+    pub headers: Headers,
+    /// The method of the request
+    pub method: method::Method,
+    /// The URL of the request
+    pub url: Url,
+}
+
+/// Describes a response.
+#[derive(Clone, Debug)]
+pub struct ResponseHead {
+    /// The headers of the reponse
+    pub headers: Headers,
+    /// The raw status line of the response
+    pub raw_status: RawStatus,
+    /// The HTTP/2 version which generated the response
+    pub version: version::HttpVersion,
+}
+
+/// The trait provides an API for sending an receiving HTTP messages.
+pub trait HttpMessage: Write + Read + Send + Any + Typeable + Debug {
+    /// Initiates a new outgoing request.
+    ///
+    /// Only the request's head is provided (in terms of the `RequestHead` struct).
+    ///
+    /// After this, the `HttpMessage` instance can be used as an `io::Write` in order to write the
+    /// body of the request.
+    fn set_outgoing(&mut self, head: RequestHead) -> ::Result<RequestHead>;
+    /// Obtains the incoming response and returns its head (i.e. the `ResponseHead` struct)
+    ///
+    /// After this, the `HttpMessage` instance can be used as an `io::Read` in order to read out
+    /// the response body.
+    fn get_incoming(&mut self) -> ::Result<ResponseHead>;
+    /// Set the read timeout duration for this message.
+    fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()>;
+    /// Set the write timeout duration for this message.
+    fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()>;
+    /// Closes the underlying HTTP connection.
+    fn close_connection(&mut self) -> ::Result<()>;
+    /// Returns whether the incoming message has a body.
+    fn has_body(&self) -> bool;
+    /// Called when the Client wishes to use a Proxy.
+    fn set_proxied(&mut self, val: bool) {
+        // default implementation so as to not be a breaking change.
+        warn!("default set_proxied({:?})", val);
+    }
+}
+
+impl HttpMessage {
+    unsafe fn downcast_ref_unchecked<T: 'static>(&self) -> &T {
+        mem::transmute(traitobject::data(self))
+    }
+
+    unsafe fn downcast_mut_unchecked<T: 'static>(&mut self) -> &mut T {
+        mem::transmute(traitobject::data_mut(self))
+    }
+
+    unsafe fn downcast_unchecked<T: 'static>(self: Box<HttpMessage>) -> Box<T>  {
+        let raw: *mut HttpMessage = mem::transmute(self);
+        mem::transmute(traitobject::data_mut(raw))
+    }
+}
+
+impl HttpMessage {
+    /// Is the underlying type in this trait object a T?
+    #[inline]
+    pub fn is<T: Any>(&self) -> bool {
+        (*self).get_type() == TypeId::of::<T>()
+    }
+
+    /// If the underlying type is T, get a reference to the contained data.
+    #[inline]
+    pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
+        if self.is::<T>() {
+            Some(unsafe { self.downcast_ref_unchecked() })
+        } else {
+            None
+        }
+    }
+
+    /// If the underlying type is T, get a mutable reference to the contained
+    /// data.
+    #[inline]
+    pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T> {
+        if self.is::<T>() {
+            Some(unsafe { self.downcast_mut_unchecked() })
+        } else {
+            None
+        }
+    }
+
+    /// If the underlying type is T, extract it.
+    #[inline]
+    pub fn downcast<T: Any>(self: Box<HttpMessage>)
+            -> Result<Box<T>, Box<HttpMessage>> {
+        if self.is::<T>() {
+            Ok(unsafe { self.downcast_unchecked() })
+        } else {
+            Err(self)
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/http/mod.rs
@@ -0,0 +1,46 @@
+//! Pieces pertaining to the HTTP message protocol.
+use std::borrow::Cow;
+
+use header::Connection;
+use header::ConnectionOption::{KeepAlive, Close};
+use header::Headers;
+use version::HttpVersion;
+use version::HttpVersion::{Http10, Http11};
+
+
+pub use self::message::{HttpMessage, RequestHead, ResponseHead, Protocol};
+
+pub mod h1;
+pub mod message;
+
+/// The raw status code and reason-phrase.
+#[derive(Clone, PartialEq, Debug)]
+pub struct RawStatus(pub u16, pub Cow<'static, str>);
+
+/// Checks if a connection should be kept alive.
+#[inline]
+pub fn should_keep_alive(version: HttpVersion, headers: &Headers) -> bool {
+    trace!("should_keep_alive( {:?}, {:?} )", version, headers.get::<Connection>());
+    match (version, headers.get::<Connection>()) {
+        (Http10, None) => false,
+        (Http10, Some(conn)) if !conn.contains(&KeepAlive) => false,
+        (Http11, Some(conn)) if conn.contains(&Close)  => false,
+        _ => true
+    }
+}
+
+#[test]
+fn test_should_keep_alive() {
+    let mut headers = Headers::new();
+
+    assert!(!should_keep_alive(Http10, &headers));
+    assert!(should_keep_alive(Http11, &headers));
+
+    headers.set(Connection::close());
+    assert!(!should_keep_alive(Http10, &headers));
+    assert!(!should_keep_alive(Http11, &headers));
+
+    headers.set(Connection::keep_alive());
+    assert!(should_keep_alive(Http10, &headers));
+    assert!(should_keep_alive(Http11, &headers));
+}
copy from third_party/rust/hyper/src/lib.rs
copy to third_party/rust/hyper-0.10.10/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/method.rs
@@ -0,0 +1,183 @@
+//! The HTTP request method
+use std::fmt;
+use std::str::FromStr;
+use std::convert::AsRef;
+
+use error::Error;
+use self::Method::{Options, Get, Post, Put, Delete, Head, Trace, Connect, Patch,
+                   Extension};
+
+
+/// The Request Method (VERB)
+///
+/// Currently includes 8 variants representing the 8 methods defined in
+/// [RFC 7230](https://tools.ietf.org/html/rfc7231#section-4.1), plus PATCH,
+/// and an Extension variant for all extensions.
+///
+/// It may make sense to grow this to include all variants currently
+/// registered with IANA, if they are at all common to use.
+#[derive(Clone, PartialEq, Eq, Hash, Debug)]
+pub enum Method {
+    /// OPTIONS
+    Options,
+    /// GET
+    Get,
+    /// POST
+    Post,
+    /// PUT
+    Put,
+    /// DELETE
+    Delete,
+    /// HEAD
+    Head,
+    /// TRACE
+    Trace,
+    /// CONNECT
+    Connect,
+    /// PATCH
+    Patch,
+    /// Method extensions. An example would be `let m = Extension("FOO".to_string())`.
+    Extension(String)
+}
+
+impl AsRef<str> for Method {
+    fn as_ref(&self) -> &str {
+        match *self {
+            Options => "OPTIONS",
+            Get => "GET",
+            Post => "POST",
+            Put => "PUT",
+            Delete => "DELETE",
+            Head => "HEAD",
+            Trace => "TRACE",
+            Connect => "CONNECT",
+            Patch => "PATCH",
+            Extension(ref s) => s.as_ref()
+        }
+    }
+}
+
+impl Method {
+    /// Whether a method is considered "safe", meaning the request is
+    /// essentially read-only.
+    ///
+    /// See [the spec](https://tools.ietf.org/html/rfc7231#section-4.2.1)
+    /// for more words.
+    pub fn safe(&self) -> bool {
+        match *self {
+            Get | Head | Options | Trace => true,
+            _ => false
+        }
+    }
+
+    /// Whether a method is considered "idempotent", meaning the request has
+    /// the same result is executed multiple times.
+    ///
+    /// See [the spec](https://tools.ietf.org/html/rfc7231#section-4.2.2) for
+    /// more words.
+    pub fn idempotent(&self) -> bool {
+        if self.safe() {
+            true
+        } else {
+            match *self {
+                Put | Delete => true,
+                _ => false
+            }
+        }
+    }
+}
+
+impl FromStr for Method {
+    type Err = Error;
+    fn from_str(s: &str) -> Result<Method, Error> {
+        if s == "" {
+            Err(Error::Method)
+        } else {
+            Ok(match s {
+                "OPTIONS" => Options,
+                "GET" => Get,
+                "POST" => Post,
+                "PUT" => Put,
+                "DELETE" => Delete,
+                "HEAD" => Head,
+                "TRACE" => Trace,
+                "CONNECT" => Connect,
+                "PATCH" => Patch,
+                _ => Extension(s.to_owned())
+            })
+        }
+    }
+}
+
+impl fmt::Display for Method {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+        fmt.write_str(match *self {
+            Options => "OPTIONS",
+            Get => "GET",
+            Post => "POST",
+            Put => "PUT",
+            Delete => "DELETE",
+            Head => "HEAD",
+            Trace => "TRACE",
+            Connect => "CONNECT",
+            Patch => "PATCH",
+            Extension(ref s) => s.as_ref()
+        })
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use std::collections::HashMap;
+    use std::str::FromStr;
+    use error::Error;
+    use super::Method;
+    use super::Method::{Get, Post, Put, Extension};
+
+    #[test]
+    fn test_safe() {
+        assert_eq!(true, Get.safe());
+        assert_eq!(false, Post.safe());
+    }
+
+    #[test]
+    fn test_idempotent() {
+        assert_eq!(true, Get.idempotent());
+        assert_eq!(true, Put.idempotent());
+        assert_eq!(false, Post.idempotent());
+    }
+
+    #[test]
+    fn test_from_str() {
+        assert_eq!(Get, FromStr::from_str("GET").unwrap());
+        assert_eq!(Extension("MOVE".to_owned()),
+                   FromStr::from_str("MOVE").unwrap());
+        let x: Result<Method, _> = FromStr::from_str("");
+        if let Err(Error::Method) = x {
+        } else {
+            panic!("An empty method is invalid!")
+        }
+    }
+
+    #[test]
+    fn test_fmt() {
+        assert_eq!("GET".to_owned(), format!("{}", Get));
+        assert_eq!("MOVE".to_owned(),
+                   format!("{}", Extension("MOVE".to_owned())));
+    }
+
+    #[test]
+    fn test_hashable() {
+        let mut counter: HashMap<Method,usize> = HashMap::new();
+        counter.insert(Get, 1);
+        assert_eq!(Some(&1), counter.get(&Get));
+    }
+
+    #[test]
+    fn test_as_str() {
+        assert_eq!(Get.as_ref(), "GET");
+        assert_eq!(Post.as_ref(), "POST");
+        assert_eq!(Put.as_ref(), "PUT");
+        assert_eq!(Extension("MOVE".to_owned()).as_ref(), "MOVE");
+    }
+}
copy from third_party/rust/hyper/src/mock.rs
copy to third_party/rust/hyper-0.10.10/src/mock.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/net.rs
@@ -0,0 +1,638 @@
+//! A collection of traits abstracting over Listeners and Streams.
+use std::any::{Any, TypeId};
+use std::fmt;
+use std::io::{self, ErrorKind, Read, Write};
+use std::net::{SocketAddr, ToSocketAddrs, TcpStream, TcpListener, Shutdown};
+use std::mem;
+use std::sync::Arc;
+
+use std::time::Duration;
+
+use typeable::Typeable;
+use traitobject;
+
+/// The write-status indicating headers have not been written.
+pub enum Fresh {}
+
+/// The write-status indicating headers have been written.
+pub enum Streaming {}
+
+/// An abstraction to listen for connections on a certain port.
+pub trait NetworkListener: Clone {
+    /// The stream produced for each connection.
+    type Stream: NetworkStream + Send + Clone;
+
+    /// Returns an iterator of streams.
+    fn accept(&mut self) -> ::Result<Self::Stream>;
+
+    /// Get the address this Listener ended up listening on.
+    fn local_addr(&mut self) -> io::Result<SocketAddr>;
+
+    /// Returns an iterator over incoming connections.
+    fn incoming(&mut self) -> NetworkConnections<Self> {
+        NetworkConnections(self)
+    }
+
+    /// Sets the read timeout for all streams that are accepted
+    fn set_read_timeout(&mut self, _: Option<Duration>) {
+        // This default implementation is only here to prevent the addition of
+        // these methods from being a breaking change. They should be removed
+        // when the next breaking release is made.
+        warn!("Ignoring read timeout");
+    }
+
+    /// Sets the write timeout for all streams that are accepted
+    fn set_write_timeout(&mut self, _: Option<Duration>) {
+        // This default implementation is only here to prevent the addition of
+        // these methods from being a breaking change. They should be removed
+        // when the next breaking release is made.
+        warn!("Ignoring write timeout");
+    }
+}
+
+/// An iterator wrapper over a `NetworkAcceptor`.
+pub struct NetworkConnections<'a, N: NetworkListener + 'a>(&'a mut N);
+
+impl<'a, N: NetworkListener + 'a> Iterator for NetworkConnections<'a, N> {
+    type Item = ::Result<N::Stream>;
+    fn next(&mut self) -> Option<::Result<N::Stream>> {
+        Some(self.0.accept())
+    }
+}
+
+/// An abstraction over streams that a `Server` can utilize.
+pub trait NetworkStream: Read + Write + Any + Send + Typeable {
+    /// Get the remote address of the underlying connection.
+    fn peer_addr(&mut self) -> io::Result<SocketAddr>;
+
+    /// Set the maximum time to wait for a read to complete.
+    fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()>;
+
+    /// Set the maximum time to wait for a write to complete.
+    fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()>;
+
+    /// This will be called when Stream should no longer be kept alive.
+    #[inline]
+    fn close(&mut self, _how: Shutdown) -> io::Result<()> {
+        Ok(())
+    }
+
+    // Unsure about name and implementation...
+
+    #[doc(hidden)]
+    fn set_previous_response_expected_no_content(&mut self, _expected: bool) { }
+
+    #[doc(hidden)]
+    fn previous_response_expected_no_content(&self) -> bool {
+        false
+    }
+}
+
+/// A connector creates a NetworkStream.
+pub trait NetworkConnector {
+    /// Type of `Stream` to create
+    type Stream: Into<Box<NetworkStream + Send>>;
+
+    /// Connect to a remote address.
+    fn connect(&self, host: &str, port: u16, scheme: &str) -> ::Result<Self::Stream>;
+}
+
+impl<T: NetworkStream + Send> From<T> for Box<NetworkStream + Send> {
+    fn from(s: T) -> Box<NetworkStream + Send> {
+        Box::new(s)
+    }
+}
+
+impl fmt::Debug for Box<NetworkStream + Send> {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+        fmt.pad("Box<NetworkStream>")
+    }
+}
+
+impl NetworkStream {
+    unsafe fn downcast_ref_unchecked<T: 'static>(&self) -> &T {
+        mem::transmute(traitobject::data(self))
+    }
+
+    unsafe fn downcast_mut_unchecked<T: 'static>(&mut self) -> &mut T {
+        mem::transmute(traitobject::data_mut(self))
+    }
+
+    unsafe fn downcast_unchecked<T: 'static>(self: Box<NetworkStream>) -> Box<T>  {
+        let raw: *mut NetworkStream = mem::transmute(self);
+        mem::transmute(traitobject::data_mut(raw))
+    }
+}
+
+impl NetworkStream {
+    /// Is the underlying type in this trait object a `T`?
+    #[inline]
+    pub fn is<T: Any>(&self) -> bool {
+        (*self).get_type() == TypeId::of::<T>()
+    }
+
+    /// If the underlying type is `T`, get a reference to the contained data.
+    #[inline]
+    pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
+        if self.is::<T>() {
+            Some(unsafe { self.downcast_ref_unchecked() })
+        } else {
+            None
+        }
+    }
+
+    /// If the underlying type is `T`, get a mutable reference to the contained
+    /// data.
+    #[inline]
+    pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T> {
+        if self.is::<T>() {
+            Some(unsafe { self.downcast_mut_unchecked() })
+        } else {
+            None
+        }
+    }
+
+    /// If the underlying type is `T`, extract it.
+    #[inline]
+    pub fn downcast<T: Any>(self: Box<NetworkStream>)
+            -> Result<Box<T>, Box<NetworkStream>> {
+        if self.is::<T>() {
+            Ok(unsafe { self.downcast_unchecked() })
+        } else {
+            Err(self)
+        }
+    }
+}
+
+impl NetworkStream + Send {
+    unsafe fn downcast_ref_unchecked<T: 'static>(&self) -> &T {
+        mem::transmute(traitobject::data(self))
+    }
+
+    unsafe fn downcast_mut_unchecked<T: 'static>(&mut self) -> &mut T {
+        mem::transmute(traitobject::data_mut(self))
+    }
+
+    unsafe fn downcast_unchecked<T: 'static>(self: Box<NetworkStream + Send>) -> Box<T>  {
+        let raw: *mut NetworkStream = mem::transmute(self);
+        mem::transmute(traitobject::data_mut(raw))
+    }
+}
+
+impl NetworkStream + Send {
+    /// Is the underlying type in this trait object a `T`?
+    #[inline]
+    pub fn is<T: Any>(&self) -> bool {
+        (*self).get_type() == TypeId::of::<T>()
+    }
+
+    /// If the underlying type is `T`, get a reference to the contained data.
+    #[inline]
+    pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
+        if self.is::<T>() {
+            Some(unsafe { self.downcast_ref_unchecked() })
+        } else {
+            None
+        }
+    }
+
+    /// If the underlying type is `T`, get a mutable reference to the contained
+    /// data.
+    #[inline]
+    pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T> {
+        if self.is::<T>() {
+            Some(unsafe { self.downcast_mut_unchecked() })
+        } else {
+            None
+        }
+    }
+
+    /// If the underlying type is `T`, extract it.
+    #[inline]
+    pub fn downcast<T: Any>(self: Box<NetworkStream + Send>)
+            -> Result<Box<T>, Box<NetworkStream + Send>> {
+        if self.is::<T>() {
+            Ok(unsafe { self.downcast_unchecked() })
+        } else {
+            Err(self)
+        }
+    }
+}
+
+/// A `NetworkListener` for `HttpStream`s.
+#[derive(Clone)]
+pub struct HttpListener {
+    listener: Arc<TcpListener>,
+
+    read_timeout : Option<Duration>,
+    write_timeout: Option<Duration>,
+}
+
+impl From<TcpListener> for HttpListener {
+    fn from(listener: TcpListener) -> HttpListener {
+        HttpListener {
+            listener: Arc::new(listener),
+
+            read_timeout : None,
+            write_timeout: None,
+        }
+    }
+}
+
+impl HttpListener {
+    /// Start listening to an address over HTTP.
+    pub fn new<To: ToSocketAddrs>(addr: To) -> ::Result<HttpListener> {
+        Ok(HttpListener::from(try!(TcpListener::bind(addr))))
+    }
+}
+
+impl NetworkListener for HttpListener {
+    type Stream = HttpStream;
+
+    #[inline]
+    fn accept(&mut self) -> ::Result<HttpStream> {
+        let stream = HttpStream(try!(self.listener.accept()).0);
+        try!(stream.set_read_timeout(self.read_timeout));
+        try!(stream.set_write_timeout(self.write_timeout));
+        Ok(stream)
+    }
+
+    #[inline]
+    fn local_addr(&mut self) -> io::Result<SocketAddr> {
+        self.listener.local_addr()
+    }
+
+    fn set_read_timeout(&mut self, duration: Option<Duration>) {
+        self.read_timeout = duration;
+    }
+
+    fn set_write_timeout(&mut self, duration: Option<Duration>) {
+        self.write_timeout = duration;
+    }
+}
+
+#[cfg(windows)]
+impl ::std::os::windows::io::AsRawSocket for HttpListener {
+    fn as_raw_socket(&self) -> ::std::os::windows::io::RawSocket {
+        self.listener.as_raw_socket()
+    }
+}
+
+#[cfg(windows)]
+impl ::std::os::windows::io::FromRawSocket for HttpListener {
+    unsafe fn from_raw_socket(sock: ::std::os::windows::io::RawSocket) -> HttpListener {
+        HttpListener::from(TcpListener::from_raw_socket(sock))
+    }
+}
+
+#[cfg(unix)]
+impl ::std::os::unix::io::AsRawFd for HttpListener {
+    fn as_raw_fd(&self) -> ::std::os::unix::io::RawFd {
+        self.listener.as_raw_fd()
+    }
+}
+
+#[cfg(unix)]
+impl ::std::os::unix::io::FromRawFd for HttpListener {
+    unsafe fn from_raw_fd(fd: ::std::os::unix::io::RawFd) -> HttpListener {
+        HttpListener::from(TcpListener::from_raw_fd(fd))
+    }
+}
+
+/// A wrapper around a `TcpStream`.
+pub struct HttpStream(pub TcpStream);
+
+impl Clone for HttpStream {
+    #[inline]
+    fn clone(&self) -> HttpStream {
+        HttpStream(self.0.try_clone().unwrap())
+    }
+}
+
+impl fmt::Debug for HttpStream {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str("HttpStream(_)")
+    }
+}
+
+impl Read for HttpStream {
+    #[inline]
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.0.read(buf)
+    }
+}
+
+impl Write for HttpStream {
+    #[inline]
+    fn write(&mut self, msg: &[u8]) -> io::Result<usize> {
+        self.0.write(msg)
+    }
+    #[inline]
+    fn flush(&mut self) -> io::Result<()> {
+        self.0.flush()
+    }
+}
+
+#[cfg(windows)]
+impl ::std::os::windows::io::AsRawSocket for HttpStream {
+    fn as_raw_socket(&self) -> ::std::os::windows::io::RawSocket {
+        self.0.as_raw_socket()
+    }
+}
+
+#[cfg(windows)]
+impl ::std::os::windows::io::FromRawSocket for HttpStream {
+    unsafe fn from_raw_socket(sock: ::std::os::windows::io::RawSocket) -> HttpStream {
+        HttpStream(TcpStream::from_raw_socket(sock))
+    }
+}
+
+#[cfg(unix)]
+impl ::std::os::unix::io::AsRawFd for HttpStream {
+    fn as_raw_fd(&self) -> ::std::os::unix::io::RawFd {
+        self.0.as_raw_fd()
+    }
+}
+
+#[cfg(unix)]
+impl ::std::os::unix::io::FromRawFd for HttpStream {
+    unsafe fn from_raw_fd(fd: ::std::os::unix::io::RawFd) -> HttpStream {
+        HttpStream(TcpStream::from_raw_fd(fd))
+    }
+}
+
+impl NetworkStream for HttpStream {
+    #[inline]
+    fn peer_addr(&mut self) -> io::Result<SocketAddr> {
+            self.0.peer_addr()
+    }
+
+    #[inline]
+    fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
+        self.0.set_read_timeout(dur)
+    }
+
+    #[inline]
+    fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
+        self.0.set_write_timeout(dur)
+    }
+
+    #[inline]
+    fn close(&mut self, how: Shutdown) -> io::Result<()> {
+        match self.0.shutdown(how) {
+            Ok(_) => Ok(()),
+            // see https://github.com/hyperium/hyper/issues/508
+            Err(ref e) if e.kind() == ErrorKind::NotConnected => Ok(()),
+            err => err
+        }
+    }
+}
+
+/// A connector that will produce HttpStreams.
+#[derive(Debug, Clone, Default)]
+pub struct HttpConnector;
+
+impl NetworkConnector for HttpConnector {
+    type Stream = HttpStream;
+
+    fn connect(&self, host: &str, port: u16, scheme: &str) -> ::Result<HttpStream> {
+        let addr = &(host, port);
+        Ok(try!(match scheme {
+            "http" => {
+                debug!("http scheme");
+                Ok(HttpStream(try!(TcpStream::connect(addr))))
+            },
+            _ => {
+                Err(io::Error::new(io::ErrorKind::InvalidInput,
+                                "Invalid scheme for Http"))
+            }
+        }))
+    }
+}
+
+/// A closure as a connector used to generate `TcpStream`s per request
+///
+/// # Example
+///
+/// Basic example:
+///
+/// ```norun
+/// Client::with_connector(|addr: &str, port: u16, scheme: &str| {
+///     TcpStream::connect(&(addr, port))
+/// });
+/// ```
+///
+/// Example using `TcpBuilder` from the net2 crate if you want to configure your source socket:
+///
+/// ```norun
+/// Client::with_connector(|addr: &str, port: u16, scheme: &str| {
+///     let b = try!(TcpBuilder::new_v4());
+///     try!(b.bind("127.0.0.1:0"));
+///     b.connect(&(addr, port))
+/// });
+/// ```
+impl<F> NetworkConnector for F where F: Fn(&str, u16, &str) -> io::Result<TcpStream> {
+    type Stream = HttpStream;
+
+    fn connect(&self, host: &str, port: u16, scheme: &str) -> ::Result<HttpStream> {
+        Ok(HttpStream(try!((*self)(host, port, scheme))))
+    }
+}
+
+/// An abstraction to allow any SSL implementation to be used with client-side HttpsStreams.
+pub trait SslClient<T: NetworkStream + Send + Clone = HttpStream> {
+    /// The protected stream.
+    type Stream: NetworkStream + Send + Clone;
+    /// Wrap a client stream with SSL.
+    fn wrap_client(&self, stream: T, host: &str) -> ::Result<Self::Stream>;
+}
+
+/// An abstraction to allow any SSL implementation to be used with server-side HttpsStreams.
+pub trait SslServer<T: NetworkStream + Send + Clone = HttpStream> {
+    /// The protected stream.
+    type Stream: NetworkStream + Send + Clone;
+    /// Wrap a server stream with SSL.
+    fn wrap_server(&self, stream: T) -> ::Result<Self::Stream>;
+}
+
+/// A stream over the HTTP protocol, possibly protected by SSL.
+#[derive(Debug, Clone)]
+pub enum HttpsStream<S: NetworkStream> {
+    /// A plain text stream.
+    Http(HttpStream),
+    /// A stream protected by SSL.
+    Https(S)
+}
+
+impl<S: NetworkStream> Read for HttpsStream<S> {
+    #[inline]
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        match *self {
+            HttpsStream::Http(ref mut s) => s.read(buf),
+            HttpsStream::Https(ref mut s) => s.read(buf)
+        }
+    }
+}
+
+impl<S: NetworkStream> Write for HttpsStream<S> {
+    #[inline]
+    fn write(&mut self, msg: &[u8]) -> io::Result<usize> {
+        match *self {
+            HttpsStream::Http(ref mut s) => s.write(msg),
+            HttpsStream::Https(ref mut s) => s.write(msg)
+        }
+    }
+
+    #[inline]
+    fn flush(&mut self) -> io::Result<()> {
+        match *self {
+            HttpsStream::Http(ref mut s) => s.flush(),
+            HttpsStream::Https(ref mut s) => s.flush()
+        }
+    }
+}
+
+impl<S: NetworkStream> NetworkStream for HttpsStream<S> {
+    #[inline]
+    fn peer_addr(&mut self) -> io::Result<SocketAddr> {
+        match *self {
+            HttpsStream::Http(ref mut s) => s.peer_addr(),
+            HttpsStream::Https(ref mut s) => s.peer_addr()
+        }
+    }
+
+    #[inline]
+    fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
+        match *self {
+            HttpsStream::Http(ref inner) => inner.0.set_read_timeout(dur),
+            HttpsStream::Https(ref inner) => inner.set_read_timeout(dur)
+        }
+    }
+
+    #[inline]
+    fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
+        match *self {
+            HttpsStream::Http(ref inner) => inner.0.set_write_timeout(dur),
+            HttpsStream::Https(ref inner) => inner.set_write_timeout(dur)
+        }
+    }
+
+    #[inline]
+    fn close(&mut self, how: Shutdown) -> io::Result<()> {
+        match *self {
+            HttpsStream::Http(ref mut s) => s.close(how),
+            HttpsStream::Https(ref mut s) => s.close(how)
+        }
+    }
+}
+
+/// A Http Listener over SSL.
+#[derive(Clone)]
+pub struct HttpsListener<S: SslServer> {
+    listener: HttpListener,
+    ssl: S,
+}
+
+impl<S: SslServer> HttpsListener<S> {
+    /// Start listening to an address over HTTPS.
+    pub fn new<To: ToSocketAddrs>(addr: To, ssl: S) -> ::Result<HttpsListener<S>> {
+        HttpListener::new(addr).map(|l| HttpsListener {
+            listener: l,
+            ssl: ssl
+        })
+    }
+
+    /// Construct an HttpsListener from a bound `TcpListener`.
+    pub fn with_listener(listener: HttpListener, ssl: S) -> HttpsListener<S> {
+        HttpsListener {
+            listener: listener,
+            ssl: ssl
+        }
+    }
+}
+
+impl<S: SslServer + Clone> NetworkListener for HttpsListener<S> {
+    type Stream = S::Stream;
+
+    #[inline]
+    fn accept(&mut self) -> ::Result<S::Stream> {
+        self.listener.accept().and_then(|s| self.ssl.wrap_server(s))
+    }
+
+    #[inline]
+    fn local_addr(&mut self) -> io::Result<SocketAddr> {
+        self.listener.local_addr()
+    }
+
+    fn set_read_timeout(&mut self, duration: Option<Duration>) {
+        self.listener.set_read_timeout(duration)
+    }
+
+    fn set_write_timeout(&mut self, duration: Option<Duration>) {
+        self.listener.set_write_timeout(duration)
+    }
+}
+
+/// A connector that can protect HTTP streams using SSL.
+#[derive(Debug, Default)]
+pub struct HttpsConnector<S: SslClient, C: NetworkConnector = HttpConnector> {
+    ssl: S,
+    connector: C,
+}
+
+impl<S: SslClient> HttpsConnector<S, HttpConnector> {
+    /// Create a new connector using the provided SSL implementation.
+    pub fn new(s: S) -> HttpsConnector<S, HttpConnector> {
+        HttpsConnector::with_connector(s, HttpConnector)
+    }
+}
+
+impl<S: SslClient, C: NetworkConnector> HttpsConnector<S, C> {
+    /// Create a new connector using the provided SSL implementation.
+    pub fn with_connector(s: S, connector: C) -> HttpsConnector<S, C> {
+        HttpsConnector { ssl: s, connector: connector }
+    }
+}
+
+impl<S: SslClient, C: NetworkConnector<Stream=HttpStream>> NetworkConnector for HttpsConnector<S, C> {
+    type Stream = HttpsStream<S::Stream>;
+
+    fn connect(&self, host: &str, port: u16, scheme: &str) -> ::Result<Self::Stream> {
+        let stream = try!(self.connector.connect(host, port, "http"));
+        if scheme == "https" {
+            debug!("https scheme");
+            self.ssl.wrap_client(stream, host).map(HttpsStream::Https)
+        } else {
+            Ok(HttpsStream::Http(stream))
+        }
+    }
+}
+
+
+#[doc(hidden)]
+pub type DefaultConnector = HttpConnector;
+
+#[cfg(test)]
+mod tests {
+    use mock::MockStream;
+    use super::{NetworkStream};
+
+    #[test]
+    fn test_downcast_box_stream() {
+        // FIXME: Use Type ascription
+        let stream: Box<NetworkStream + Send> = Box::new(MockStream::new());
+
+        let mock = stream.downcast::<MockStream>().ok().unwrap();
+        assert_eq!(mock, Box::new(MockStream::new()));
+    }
+
+    #[test]
+    fn test_downcast_unchecked_box_stream() {
+        // FIXME: Use Type ascription
+        let stream: Box<NetworkStream + Send> = Box::new(MockStream::new());
+
+        let mock = unsafe { stream.downcast_unchecked::<MockStream>() };
+        assert_eq!(mock, Box::new(MockStream::new()));
+    }
+}
+
copy from third_party/rust/hyper/src/server/listener.rs
copy to third_party/rust/hyper-0.10.10/src/server/listener.rs
copy from third_party/rust/hyper/src/server/mod.rs
copy to third_party/rust/hyper-0.10.10/src/server/mod.rs
copy from third_party/rust/hyper/src/server/request.rs
copy to third_party/rust/hyper-0.10.10/src/server/request.rs
copy from third_party/rust/hyper/src/server/response.rs
copy to third_party/rust/hyper-0.10.10/src/server/response.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper-0.10.10/src/status.rs
@@ -0,0 +1,748 @@
+//! HTTP status codes
+use std::fmt;
+use std::cmp::Ordering;
+
+// shamelessly lifted from Teepee. I tried a few schemes, this really
+// does seem like the best. Improved scheme to support arbitrary status codes.
+
+/// An HTTP status code (`status-code` in RFC 7230 et al.).
+///
+/// This enum contains all common status codes and an Unregistered
+/// extension variant. It allows status codes in the range [0, 65535], as any
+/// `u16` integer may be used as a status code for XHR requests. It is
+/// recommended to only use values between [100, 599], since only these are
+/// defined as valid status codes with a status class by HTTP.
+///
+/// If you encounter a status code that you do not know how to deal with, you
+/// should treat it as the `x00` status code—e.g. for code 123, treat it as
+/// 100 (Continue). This can be achieved with
+/// `self.class().default_code()`:
+///
+/// ```rust
+/// # use hyper::status::StatusCode;
+/// let status = StatusCode::Unregistered(123);
+/// assert_eq!(status.class().default_code(), StatusCode::Continue);
+/// ```
+///
+/// IANA maintain the [Hypertext Transfer Protocol (HTTP) Status Code
+/// Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml) which is
+/// the source for this enum (with one exception, 418 I'm a teapot, which is
+/// inexplicably not in the register).
+#[derive(Debug, Hash)]
+pub enum StatusCode {
+    /// 100 Continue
+    /// [[RFC7231, Section 6.2.1](https://tools.ietf.org/html/rfc7231#section-6.2.1)]
+    Continue,
+    /// 101 Switching Protocols
+    /// [[RFC7231, Section 6.2.2](https://tools.ietf.org/html/rfc7231#section-6.2.2)]
+    SwitchingProtocols,
+    /// 102 Processing
+    /// [[RFC2518](https://tools.ietf.org/html/rfc2518)]
+    Processing,
+
+    /// 200 OK
+    /// [[RFC7231, Section 6.3.1](https://tools.ietf.org/html/rfc7231#section-6.3.1)]
+    Ok,
+    /// 201 Created
+    /// [[RFC7231, Section 6.3.2](https://tools.ietf.org/html/rfc7231#section-6.3.2)]
+    Created,
+    /// 202 Accepted
+    /// [[RFC7231, Section 6.3.3](https://tools.ietf.org/html/rfc7231#section-6.3.3)]
+    Accepted,
+    /// 203 Non-Authoritative Information
+    /// [[RFC7231, Section 6.3.4](https://tools.ietf.org/html/rfc7231#section-6.3.4)]
+    NonAuthoritativeInformation,
+    /// 204 No Content
+    /// [[RFC7231, Section 6.3.5](https://tools.ietf.org/html/rfc7231#section-6.3.5)]
+    NoContent,
+    /// 205 Reset Content
+    /// [[RFC7231, Section 6.3.6](https://tools.ietf.org/html/rfc7231#section-6.3.6)]
+    ResetContent,
+    /// 206 Partial Content
+    /// [[RFC7233, Section 4.1](https://tools.ietf.org/html/rfc7233#section-4.1)]
+    PartialContent,
+    /// 207 Multi-Status
+    /// [[RFC4918](https://tools.ietf.org/html/rfc4918)]
+    MultiStatus,
+    /// 208 Already Reported
+    /// [[RFC5842](https://tools.ietf.org/html/rfc5842)]
+    AlreadyReported,
+
+    /// 226 IM Used
+    /// [[RFC3229](https://tools.ietf.org/html/rfc3229)]
+    ImUsed,
+
+    /// 300 Multiple Choices
+    /// [[RFC7231, Section 6.4.1](https://tools.ietf.org/html/rfc7231#section-6.4.1)]
+    MultipleChoices,
+    /// 301 Moved Permanently
+    /// [[RFC7231, Section 6.4.2](https://tools.ietf.org/html/rfc7231#section-6.4.2)]
+    MovedPermanently,
+    /// 302 Found
+    /// [[RFC7231, Section 6.4.3](https://tools.ietf.org/html/rfc7231#section-6.4.3)]
+    Found,
+    /// 303 See Other
+    /// [[RFC7231, Section 6.4.4](https://tools.ietf.org/html/rfc7231#section-6.4.4)]
+    SeeOther,
+    /// 304 Not Modified
+    /// [[RFC7232, Section 4.1](https://tools.ietf.org/html/rfc7232#section-4.1)]
+    NotModified,
+    /// 305 Use Proxy
+    /// [[RFC7231, Section 6.4.5](https://tools.ietf.org/html/rfc7231#section-6.4.5)]
+    UseProxy,
+    /// 307 Temporary Redirect
+    /// [[RFC7231, Section 6.4.7](https://tools.ietf.org/html/rfc7231#section-6.4.7)]
+    TemporaryRedirect,
+    /// 308 Permanent Redirect
+    /// [[RFC7238](https://tools.ietf.org/html/rfc7238)]
+    PermanentRedirect,
+
+    /// 400 Bad Request
+    /// [[RFC7231, Section 6.5.1](https://tools.ietf.org/html/rfc7231#section-6.5.1)]
+    BadRequest,
+    /// 401 Unauthorized
+    /// [[RFC7235, Section 3.1](https://tools.ietf.org/html/rfc7235#section-3.1)]
+    Unauthorized,
+    /// 402 Payment Required
+    /// [[RFC7231, Section 6.5.2](https://tools.ietf.org/html/rfc7231#section-6.5.2)]
+    PaymentRequired,
+    /// 403 Forbidden
+    /// [[RFC7231, Section 6.5.3](https://tools.ietf.org/html/rfc7231#section-6.5.3)]
+    Forbidden,
+    /// 404 Not Found
+    /// [[RFC7231, Section 6.5.4](https://tools.ietf.org/html/rfc7231#section-6.5.4)]
+    NotFound,
+    /// 405 Method Not Allowed
+    /// [[RFC7231, Section 6.5.5](https://tools.ietf.org/html/rfc7231#section-6.5.5)]
+    MethodNotAllowed,
+    /// 406 Not Acceptable
+    /// [[RFC7231, Section 6.5.6](https://tools.ietf.org/html/rfc7231#section-6.5.6)]
+    NotAcceptable,
+    /// 407 Proxy Authentication Required
+    /// [[RFC7235, Section 3.2](https://tools.ietf.org/html/rfc7235#section-3.2)]
+    ProxyAuthenticationRequired,
+    /// 408 Request Timeout
+    /// [[RFC7231, Section 6.5.7](https://tools.ietf.org/html/rfc7231#section-6.5.7)]
+    RequestTimeout,
+    /// 409 Conflict
+    /// [[RFC7231, Section 6.5.8](https://tools.ietf.org/html/rfc7231#section-6.5.8)]
+    Conflict,
+    /// 410 Gone
+    /// [[RFC7231, Section 6.5.9](https://tools.ietf.org/html/rfc7231#section-6.5.9)]
+    Gone,
+    /// 411 Length Required
+    /// [[RFC7231, Section 6.5.10](https://tools.ietf.org/html/rfc7231#section-6.5.10)]
+    LengthRequired,
+    /// 412 Precondition Failed
+    /// [[RFC7232, Section 4.2](https://tools.ietf.org/html/rfc7232#section-4.2)]
+    PreconditionFailed,
+    /// 413 Payload Too Large
+    /// [[RFC7231, Section 6.5.11](https://tools.ietf.org/html/rfc7231#section-6.5.11)]
+    PayloadTooLarge,
+    /// 414 URI Too Long
+    /// [[RFC7231, Section 6.5.12](https://tools.ietf.org/html/rfc7231#section-6.5.12)]
+    UriTooLong,
+    /// 415 Unsupported Media Type
+    /// [[RFC7231, Section 6.5.13](https://tools.ietf.org/html/rfc7231#section-6.5.13)]
+    UnsupportedMediaType,
+    /// 416 Range Not Satisfiable
+    /// [[RFC7233, Section 4.4](https://tools.ietf.org/html/rfc7233#section-4.4)]
+    RangeNotSatisfiable,
+    /// 417 Expectation Failed
+    /// [[RFC7231, Section 6.5.14](https://tools.ietf.org/html/rfc7231#section-6.5.14)]
+    ExpectationFailed,
+    /// 418 I'm a teapot
+    /// [curiously, not registered by IANA, but [RFC2324](https://tools.ietf.org/html/rfc2324)]
+    ImATeapot,
+
+    /// 421 Misdirected Request
+    /// [RFC7540, Section 9.1.2](http://tools.ietf.org/html/rfc7540#section-9.1.2)
+    MisdirectedRequest,
+    /// 422 Unprocessable Entity
+    /// [[RFC4918](https://tools.ietf.org/html/rfc4918)]
+    UnprocessableEntity,
+    /// 423 Locked
+    /// [[RFC4918](https://tools.ietf.org/html/rfc4918)]
+    Locked,
+    /// 424 Failed Dependency
+    /// [[RFC4918](https://tools.ietf.org/html/rfc4918)]
+    FailedDependency,
+
+    /// 426 Upgrade Required
+    /// [[RFC7231, Section 6.5.15](https://tools.ietf.org/html/rfc7231#section-6.5.15)]
+    UpgradeRequired,
+
+    /// 428 Precondition Required
+    /// [[RFC6585](https://tools.ietf.org/html/rfc6585)]
+    PreconditionRequired,
+    /// 429 Too Many Requests
+    /// [[RFC6585](https://tools.ietf.org/html/rfc6585)]
+    TooManyRequests,
+
+    /// 431 Request Header Fields Too Large
+    /// [[RFC6585](https://tools.ietf.org/html/rfc6585)]
+    RequestHeaderFieldsTooLarge,
+
+    /// 451 Unavailable For Legal Reasons
+    /// [[RFC7725](http://tools.ietf.org/html/rfc7725)]
+    UnavailableForLegalReasons,
+
+    /// 500 Internal Server Error
+    /// [[RFC7231, Section 6.6.1](https://tools.ietf.org/html/rfc7231#section-6.6.1)]
+    InternalServerError,
+    /// 501 Not Implemented
+    /// [[RFC7231, Section 6.6.2](https://tools.ietf.org/html/rfc7231#section-6.6.2)]
+    NotImplemented,
+    /// 502 Bad Gateway
+    /// [[RFC7231, Section 6.6.3](https://tools.ietf.org/html/rfc7231#section-6.6.3)]
+    BadGateway,
+    /// 503 Service Unavailable
+    /// [[RFC7231, Section 6.6.4](https://tools.ietf.org/html/rfc7231#section-6.6.4)]
+    ServiceUnavailable,
+    /// 504 Gateway Timeout
+    /// [[RFC7231, Section 6.6.5](https://tools.ietf.org/html/rfc7231#section-6.6.5)]
+    GatewayTimeout,
+    /// 505 HTTP Version Not Supported
+    /// [[RFC7231, Section 6.6.6](https://tools.ietf.org/html/rfc7231#section-6.6.6)]
+    HttpVersionNotSupported,
+    /// 506 Variant Also Negotiates
+    /// [[RFC2295](https://tools.ietf.org/html/rfc2295)]
+    VariantAlsoNegotiates,
+    /// 507 Insufficient Storage
+    /// [[RFC4918](https://tools.ietf.org/html/rfc4918)]
+    InsufficientStorage,
+    /// 508 Loop Detected
+    /// [[RFC5842](https://tools.ietf.org/html/rfc5842)]
+    LoopDetected,
+
+    /// 510 Not Extended
+    /// [[RFC2774](https://tools.ietf.org/html/rfc2774)]
+    NotExtended,
+    /// 511 Network Authentication Required
+    /// [[RFC6585](https://tools.ietf.org/html/rfc6585)]
+    NetworkAuthenticationRequired,
+
+    /// A status code not in the IANA HTTP status code registry or very well known
+    // `ImATeapot` is not registered.
+    Unregistered(u16),
+}
+
+impl StatusCode {
+
+    #[doc(hidden)]
+    pub fn from_u16(n: u16) -> StatusCode {
+        match n {
+            100 => StatusCode::Continue,
+            101 => StatusCode::SwitchingProtocols,
+            102 => StatusCode::Processing,
+            200 => StatusCode::Ok,
+            201 => StatusCode::Created,
+            202 => StatusCode::Accepted,
+            203 => StatusCode::NonAuthoritativeInformation,
+            204 => StatusCode::NoContent,
+            205 => StatusCode::ResetContent,
+            206 => StatusCode::PartialContent,
+            207 => StatusCode::MultiStatus,
+            208 => StatusCode::AlreadyReported,
+            226 => StatusCode::ImUsed,
+            300 => StatusCode::MultipleChoices,
+            301 => StatusCode::MovedPermanently,
+            302 => StatusCode::Found,
+            303 => StatusCode::SeeOther,
+            304 => StatusCode::NotModified,
+            305 => StatusCode::UseProxy,
+            307 => StatusCode::TemporaryRedirect,
+            308 => StatusCode::PermanentRedirect,
+            400 => StatusCode::BadRequest,
+            401 => StatusCode::Unauthorized,
+            402 => StatusCode::PaymentRequired,
+            403 => StatusCode::Forbidden,
+            404 => StatusCode::NotFound,
+            405 => StatusCode::MethodNotAllowed,
+            406 => StatusCode::NotAcceptable,
+            407 => StatusCode::ProxyAuthenticationRequired,
+            408 => StatusCode::RequestTimeout,
+            409 => StatusCode::Conflict,
+            410 => StatusCode::Gone,
+            411 => StatusCode::LengthRequired,
+            412 => StatusCode::PreconditionFailed,
+            413 => StatusCode::PayloadTooLarge,
+            414 => StatusCode::UriTooLong,
+            415 => StatusCode::UnsupportedMediaType,
+            416 => StatusCode::RangeNotSatisfiable,
+            417 => StatusCode::ExpectationFailed,
+            418 => StatusCode::ImATeapot,
+            421 => StatusCode::MisdirectedRequest,
+            422 => StatusCode::UnprocessableEntity,
+            423 => StatusCode::Locked,
+            424 => StatusCode::FailedDependency,
+            426 => StatusCode::UpgradeRequired,
+            428 => StatusCode::PreconditionRequired,
+            429 => StatusCode::TooManyRequests,
+            431 => StatusCode::RequestHeaderFieldsTooLarge,
+            451 => StatusCode::UnavailableForLegalReasons,
+            500 => StatusCode::InternalServerError,
+            501 => StatusCode::NotImplemented,
+            502 => StatusCode::BadGateway,
+            503 => StatusCode::ServiceUnavailable,
+            504 => StatusCode::GatewayTimeout,
+            505 => StatusCode::HttpVersionNotSupported,
+            506 => StatusCode::VariantAlsoNegotiates,
+            507 => StatusCode::InsufficientStorage,
+            508 => StatusCode::LoopDetected,
+            510 => StatusCode::NotExtended,
+            511 => StatusCode::NetworkAuthenticationRequired,
+            _ => StatusCode::Unregistered(n),
+        }
+    }
+
+    #[doc(hidden)]
+    pub fn to_u16(&self) -> u16 {
+        match *self {
+            StatusCode::Continue => 100,
+            StatusCode::SwitchingProtocols => 101,
+            StatusCode::Processing => 102,
+            StatusCode::Ok => 200,
+            StatusCode::Created => 201,
+            StatusCode::Accepted => 202,
+            StatusCode::NonAuthoritativeInformation => 203,
+            StatusCode::NoContent => 204,
+            StatusCode::ResetContent => 205,
+            StatusCode::PartialContent => 206,
+            StatusCode::MultiStatus => 207,
+            StatusCode::AlreadyReported => 208,
+            StatusCode::ImUsed => 226,
+            StatusCode::MultipleChoices => 300,
+            StatusCode::MovedPermanently => 301,
+            StatusCode::Found => 302,
+            StatusCode::SeeOther => 303,
+            StatusCode::NotModified => 304,
+            StatusCode::UseProxy => 305,
+            StatusCode::TemporaryRedirect => 307,
+            StatusCode::PermanentRedirect => 308,
+            StatusCode::BadRequest => 400,
+            StatusCode::Unauthorized => 401,
+            StatusCode::PaymentRequired => 402,
+            StatusCode::Forbidden => 403,
+            StatusCode::NotFound => 404,
+            StatusCode::MethodNotAllowed => 405,
+            StatusCode::NotAcceptable => 406,
+            StatusCode::ProxyAuthenticationRequired => 407,
+            StatusCode::RequestTimeout => 408,
+            StatusCode::Conflict => 409,
+            StatusCode::Gone => 410,
+            StatusCode::LengthRequired => 411,
+            StatusCode::PreconditionFailed => 412,
+            StatusCode::PayloadTooLarge => 413,
+            StatusCode::UriTooLong => 414,
+            StatusCode::UnsupportedMediaType => 415,
+            StatusCode::RangeNotSatisfiable => 416,
+            StatusCode::ExpectationFailed => 417,
+            StatusCode::ImATeapot => 418,
+            StatusCode::MisdirectedRequest => 421,
+            StatusCode::UnprocessableEntity => 422,
+            StatusCode::Locked => 423,
+            StatusCode::FailedDependency => 424,
+            StatusCode::UpgradeRequired => 426,
+            StatusCode::PreconditionRequired => 428,
+            StatusCode::TooManyRequests => 429,
+            StatusCode::RequestHeaderFieldsTooLarge => 431,
+            StatusCode::UnavailableForLegalReasons => 451,
+            StatusCode::InternalServerError => 500,
+            StatusCode::NotImplemented => 501,
+            StatusCode::BadGateway => 502,
+            StatusCode::ServiceUnavailable => 503,
+            StatusCode::GatewayTimeout => 504,
+            StatusCode::HttpVersionNotSupported => 505,
+            StatusCode::VariantAlsoNegotiates => 506,
+            StatusCode::InsufficientStorage => 507,
+            StatusCode::LoopDetected => 508,
+            StatusCode::NotExtended => 510,
+            StatusCode::NetworkAuthenticationRequired => 511,
+            StatusCode::Unregistered(n) => n,
+        }
+    }
+
+    /// Get the standardised `reason-phrase` for this status code.
+    ///
+    /// This is mostly here for servers writing responses, but could potentially have application
+    /// at other times.
+    ///
+    /// The reason phrase is defined as being exclusively for human readers. You should avoid
+    /// deriving any meaning from it at all costs.
+    ///
+    /// Bear in mind also that in HTTP/2.0 the reason phrase is abolished from transmission, and so
+    /// this canonical reason phrase really is the only reason phrase you’ll find.
+    pub fn canonical_reason(&self) -> Option<&'static str> {
+        match *self {
+            StatusCode::Continue => Some("Continue"),
+            StatusCode::SwitchingProtocols => Some("Switching Protocols"),
+            StatusCode::Processing => Some("Processing"),
+
+            StatusCode::Ok => Some("OK"),
+            StatusCode::Created => Some("Created"),
+            StatusCode::Accepted => Some("Accepted"),
+            StatusCode::NonAuthoritativeInformation => Some("Non-Authoritative Information"),
+            StatusCode::NoContent => Some("No Content"),
+            StatusCode::ResetContent => Some("Reset Content"),
+            StatusCode::PartialContent => Some("Partial Content"),
+            StatusCode::MultiStatus => Some("Multi-Status"),
+            StatusCode::AlreadyReported => Some("Already Reported"),
+
+            StatusCode::ImUsed => Some("IM Used"),
+
+            StatusCode::MultipleChoices => Some("Multiple Choices"),
+            StatusCode::MovedPermanently => Some("Moved Permanently"),
+            StatusCode::Found => Some("Found"),
+            StatusCode::SeeOther => Some("See Other"),
+            StatusCode::NotModified => Some("Not Modified"),
+            StatusCode::UseProxy => Some("Use Proxy"),
+
+            StatusCode::TemporaryRedirect => Some("Temporary Redirect"),
+            StatusCode::PermanentRedirect => Some("Permanent Redirect"),
+
+            StatusCode::BadRequest => Some("Bad Request"),
+            StatusCode::Unauthorized => Some("Unauthorized"),
+            StatusCode::PaymentRequired => Some("Payment Required"),
+            StatusCode::Forbidden => Some("Forbidden"),
+            StatusCode::NotFound => Some("Not Found"),
+            StatusCode::MethodNotAllowed => Some("Method Not Allowed"),
+            StatusCode::NotAcceptable => Some("Not Acceptable"),
+            StatusCode::ProxyAuthenticationRequired => Some("Proxy Authentication Required"),
+            StatusCode::RequestTimeout => Some("Request Timeout"),
+            StatusCode::Conflict => Some("Conflict"),
+            StatusCode::Gone => Some("Gone"),
+            StatusCode::LengthRequired => Some("Length Required"),
+            StatusCode::PreconditionFailed => Some("Precondition Failed"),
+            StatusCode::PayloadTooLarge => Some("Payload Too Large"),
+            StatusCode::UriTooLong => Some("URI Too Long"),
+            StatusCode::UnsupportedMediaType => Some("Unsupported Media Type"),
+            StatusCode::RangeNotSatisfiable => Some("Range Not Satisfiable"),
+            StatusCode::ExpectationFailed => Some("Expectation Failed"),
+            StatusCode::ImATeapot => Some("I'm a teapot"),
+
+            StatusCode::MisdirectedRequest => Some("Misdirected Request"),
+            StatusCode::UnprocessableEntity => Some("Unprocessable Entity"),
+            StatusCode::Locked => Some("Locked"),
+            StatusCode::FailedDependency => Some("Failed Dependency"),
+
+            StatusCode::UpgradeRequired => Some("Upgrade Required"),
+
+            StatusCode::PreconditionRequired => Some("Precondition Required"),
+            StatusCode::TooManyRequests => Some("Too Many Requests"),
+
+            StatusCode::RequestHeaderFieldsTooLarge => Some("Request Header Fields Too Large"),
+
+            StatusCode::UnavailableForLegalReasons => Some("Unavailable For Legal Reasons"),
+
+            StatusCode::InternalServerError => Some("Internal Server Error"),
+            StatusCode::NotImplemented => Some("Not Implemented"),
+            StatusCode::BadGateway => Some("Bad Gateway"),
+            StatusCode::ServiceUnavailable => Some("Service Unavailable"),
+            StatusCode::GatewayTimeout => Some("Gateway Timeout"),
+            StatusCode::HttpVersionNotSupported => Some("HTTP Version Not Supported"),
+            StatusCode::VariantAlsoNegotiates => Some("Variant Also Negotiates"),
+            StatusCode::InsufficientStorage => Some("Insufficient Storage"),
+            StatusCode::LoopDetected => Some("Loop Detected"),
+
+            StatusCode::NotExtended => Some("Not Extended"),
+            StatusCode::NetworkAuthenticationRequired => Some("Network Authentication Required"),
+            StatusCode::Unregistered(..) => None
+        }
+    }
+
+    /// Determine the class of a status code, based on its first digit.
+    pub fn class(&self) -> StatusClass {
+        match self.to_u16() {
+            100...199 => StatusClass::Informational,
+            200...299 => StatusClass::Success,
+            300...399 => StatusClass::Redirection,
+            400...499 => StatusClass::ClientError,
+            500...599 => StatusClass::ServerError,
+            _ => StatusClass::NoClass,
+        }
+    }
+
+    /// Check if class is Informational.
+    pub fn is_informational(&self) -> bool {
+        self.class() == StatusClass::Informational
+    }
+
+    /// Check if class is Success.
+    pub fn is_success(&self) -> bool {
+        self.class() == StatusClass::Success
+    }
+
+    /// Check if class is Redirection.
+    pub fn is_redirection(&self) -> bool {
+        self.class() == StatusClass::Redirection
+    }
+
+    /// Check if class is ClientError.
+    pub fn is_client_error(&self) -> bool {
+        self.class() == StatusClass::ClientError
+    }
+
+    /// Check if class is ServerError.
+    pub fn is_server_error(&self) -> bool {
+        self.class() == StatusClass::ServerError
+    }
+
+    /// Check if class is NoClass
+    pub fn is_strange_status(&self) -> bool {
+        self.class() == StatusClass::NoClass
+    }
+}
+
+impl Copy for StatusCode {}
+
+/// Formats the status code, *including* the canonical reason.
+///
+/// ```rust
+/// # use hyper::status::StatusCode::{ImATeapot, Unregistered};
+/// assert_eq!(format!("{}", ImATeapot), "418 I'm a teapot");
+/// assert_eq!(format!("{}", Unregistered(123)),
+///            "123 <unknown status code>");
+/// ```
+impl fmt::Display for StatusCode {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{} {}", self.to_u16(),
+               self.canonical_reason().unwrap_or("<unknown status code>"))
+    }
+}
+
+impl PartialEq for StatusCode {
+    #[inline]
+    fn eq(&self, other: &StatusCode) -> bool {
+        self.to_u16() == other.to_u16()
+    }
+}
+
+impl Eq for StatusCode {}
+
+impl Clone for StatusCode {
+    #[inline]
+    fn clone(&self) -> StatusCode {
+        *self
+    }
+}
+
+impl PartialOrd for StatusCode {
+    #[inline]
+    fn partial_cmp(&self, other: &StatusCode) -> Option<Ordering> {
+        self.to_u16().partial_cmp(&(other.to_u16()))
+    }
+}
+
+impl Ord for StatusCode {
+    #[inline]
+    fn cmp(&self, other: &StatusCode) -> Ordering {
+        if *self < *other {
+            Ordering::Less
+        } else if *self > *other {
+            Ordering::Greater
+        } else {
+            Ordering::Equal
+        }
+    }
+}
+
+/// The class of an HTTP `status-code`.
+///
+/// [RFC 7231, section 6 (Response Status Codes)](https://tools.ietf.org/html/rfc7231#section-6):
+///
+/// > The first digit of the status-code defines the class of response.
+/// > The last two digits do not have any categorization role.
+///
+/// And:
+///
+/// > HTTP status codes are extensible.  HTTP clients are not required to
+/// > understand the meaning of all registered status codes, though such
+/// > understanding is obviously desirable.  However, a client MUST
+/// > understand the class of any status code, as indicated by the first
+/// > digit, and treat an unrecognized status code as being equivalent to
+/// > the x00 status code of that class, with the exception that a
+/// > recipient MUST NOT cache a response with an unrecognized status code.
+/// >
+/// > For example, if an unrecognized status code of 471 is received by a
+/// > client, the client can assume that there was something wrong with its
+/// > request and treat the response as if it had received a 400 (Bad
+/// > Request) status code.  The response message will usually contain a
+/// > representation that explains the status.
+///
+/// This can be used in cases where a status code’s meaning is unknown, also,
+/// to get the appropriate *category* of status.
+#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Copy)]
+pub enum StatusClass {
+    /// 1xx (Informational): The request was received, continuing process
+    Informational,
+
+    /// 2xx (Success): The request was successfully received, understood, and accepted
+    Success,
+
+    /// 3xx (Redirection): Further action needs to be taken in order to complete the request
+    Redirection,
+
+    /// 4xx (Client Error): The request contains bad syntax or cannot be fulfilled
+    ClientError,
+
+    /// 5xx (Server Error): The server failed to fulfill an apparently valid request
+    ServerError,
+
+    /// A status code lower than 100 or higher than 599. These codes do no belong to any class.
+    NoClass,
+}
+
+impl StatusClass {
+    /// Get the default status code for the class.
+    ///
+    /// This produces the x00 status code; thus, for `ClientError` (4xx), for
+    /// example, this will produce `BadRequest` (400):
+    ///
+    /// ```rust
+    /// # use hyper::status::StatusClass::ClientError;
+    /// # use hyper::status::StatusCode::BadRequest;
+    /// assert_eq!(ClientError.default_code(), BadRequest);
+    /// ```
+    ///
+    /// The use for this is outlined in [RFC 7231, section 6 (Response Status
+    /// Codes)](https://tools.ietf.org/html/rfc7231#section-6):
+    ///
+    /// > HTTP status codes are extensible.  HTTP clients are not required to
+    /// > understand the meaning of all registered status codes, though such
+    /// > understanding is obviously desirable.  However, a client MUST
+    /// > understand the class of any status code, as indicated by the first
+    /// > digit, and treat an unrecognized status code as being equivalent to
+    /// > the x00 status code of that class, with the exception that a
+    /// > recipient MUST NOT cache a response with an unrecognized status code.
+    /// >
+    /// > For example, if an unrecognized status code of 471 is received by a
+    /// > client, the client can assume that there was something wrong with its
+    /// > request and treat the response as if it had received a 400 (Bad
+    /// > Request) status code.  The response message will usually contain a
+    /// > representation that explains the status.
+    ///
+    /// This is demonstrated thusly:
+    ///
+    /// ```rust
+    /// # use hyper::status::StatusCode::{Unregistered, BadRequest};
+    /// // Suppose we have received this status code.
+    /// // You will never directly create an unregistered status code.
+    /// let status = Unregistered(471);
+    ///
+    /// // Uh oh! Don’t know what to do with it.
+    /// // Let’s fall back to the default:
+    /// let status = status.class().default_code();
+    ///
+    /// // And look! That is 400 Bad Request.
+    /// assert_eq!(status, BadRequest);
+    /// // So now let’s treat it as that.
+    /// ```
+    /// All status codes that do not map to an existing status class are matched
+    /// by a `NoClass`, variant that resolves to 200 (Ok) as default code.
+    /// This is a common handling for unknown status codes in major browsers.
+    pub fn default_code(&self) -> StatusCode {
+        match *self {
+            StatusClass::Informational => StatusCode::Continue,
+            StatusClass::Success => StatusCode::Ok,
+            StatusClass::Redirection => StatusCode::MultipleChoices,
+            StatusClass::ClientError => StatusCode::BadRequest,
+            StatusClass::ServerError => StatusCode::InternalServerError,
+            StatusClass::NoClass => StatusCode::Ok,
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use super::StatusCode::*;
+
+    // Check that the following entities are properly inter-connected:
+    //   - numerical code
+    //   - status code
+    //   - default code (for the given status code)
+    //   - canonical reason
+    fn validate(num: u16, status_code: StatusCode, default_code: StatusCode, reason: Option<&str>) {
+        assert_eq!(StatusCode::from_u16(num), status_code);
+        assert_eq!(status_code.to_u16(), num);
+        assert_eq!(status_code.class().default_code(), default_code);
+        assert_eq!(status_code.canonical_reason(), reason);
+    }
+
+    #[test]
+    fn test_status_code() {
+        validate(99, Unregistered(99), Ok, None);
+
+        validate(100, Continue, Continue, Some("Continue"));
+        validate(101, SwitchingProtocols, Continue, Some("Switching Protocols"));
+        validate(102, Processing, Continue, Some("Processing"));
+
+        validate(200, Ok, Ok, Some("OK"));
+        validate(201, Created, Ok, Some("Created"));
+        validate(202, Accepted, Ok, Some("Accepted"));
+        validate(203, NonAuthoritativeInformation, Ok, Some("Non-Authoritative Information"));
+        validate(204, NoContent, Ok, Some("No Content"));
+        validate(205, ResetContent, Ok, Some("Reset Content"));
+        validate(206, PartialContent, Ok, Some("Partial Content"));
+        validate(207, MultiStatus, Ok, Some("Multi-Status"));
+        validate(208, AlreadyReported, Ok, Some("Already Reported"));
+        validate(226, ImUsed, Ok, Some("IM Used"));
+
+        validate(300, MultipleChoices, MultipleChoices, Some("Multiple Choices"));
+        validate(301, MovedPermanently, MultipleChoices, Some("Moved Permanently"));
+        validate(302, Found, MultipleChoices, Some("Found"));
+        validate(303, SeeOther, MultipleChoices, Some("See Other"));
+        validate(304, NotModified, MultipleChoices, Some("Not Modified"));
+        validate(305, UseProxy, MultipleChoices, Some("Use Proxy"));
+        validate(307, TemporaryRedirect, MultipleChoices, Some("Temporary Redirect"));
+        validate(308, PermanentRedirect, MultipleChoices, Some("Permanent Redirect"));
+
+        validate(400, BadRequest, BadRequest, Some("Bad Request"));
+        validate(401, Unauthorized, BadRequest, Some("Unauthorized"));
+        validate(402, PaymentRequired, BadRequest, Some("Payment Required"));
+        validate(403, Forbidden, BadRequest, Some("Forbidden"));
+        validate(404, NotFound, BadRequest, Some("Not Found"));
+        validate(405, MethodNotAllowed, BadRequest, Some("Method Not Allowed"));
+        validate(406, NotAcceptable, BadRequest, Some("Not Acceptable"));
+        validate(407, ProxyAuthenticationRequired, BadRequest,
+            Some("Proxy Authentication Required"));
+        validate(408, RequestTimeout, BadRequest, Some("Request Timeout"));
+        validate(409, Conflict, BadRequest, Some("Conflict"));
+        validate(410, Gone, BadRequest, Some("Gone"));
+        validate(411, LengthRequired, BadRequest, Some("Length Required"));
+        validate(412, PreconditionFailed, BadRequest, Some("Precondition Failed"));
+        validate(413, PayloadTooLarge, BadRequest, Some("Payload Too Large"));
+        validate(414, UriTooLong, BadRequest, Some("URI Too Long"));
+        validate(415, UnsupportedMediaType, BadRequest, Some("Unsupported Media Type"));
+        validate(416, RangeNotSatisfiable, BadRequest, Some("Range Not Satisfiable"));
+        validate(417, ExpectationFailed, BadRequest, Some("Expectation Failed"));
+        validate(418, ImATeapot, BadRequest, Some("I'm a teapot"));
+        validate(421, MisdirectedRequest, BadRequest, Some("Misdirected Request"));
+        validate(422, UnprocessableEntity, BadRequest, Some("Unprocessable Entity"));
+        validate(423, Locked, BadRequest, Some("Locked"));
+        validate(424, FailedDependency, BadRequest, Some("Failed Dependency"));
+        validate(426, UpgradeRequired, BadRequest, Some("Upgrade Required"));
+        validate(428, PreconditionRequired, BadRequest, Some("Precondition Required"));
+        validate(429, TooManyRequests, BadRequest, Some("Too Many Requests"));
+        validate(431, RequestHeaderFieldsTooLarge, BadRequest,
+            Some("Request Header Fields Too Large"));
+        validate(451, UnavailableForLegalReasons, BadRequest,
+            Some("Unavailable For Legal Reasons"));
+
+        validate(500, InternalServerError, InternalServerError, Some("Internal Server Error"));
+        validate(501, NotImplemented, InternalServerError, Some("Not Implemented"));
+        validate(502, BadGateway, InternalServerError, Some("Bad Gateway"));
+        validate(503, ServiceUnavailable, InternalServerError, Some("Service Unavailable"));
+        validate(504, GatewayTimeout, InternalServerError, Some("Gateway Timeout"));
+        validate(505, HttpVersionNotSupported, InternalServerError,
+            Some("HTTP Version Not Supported"));
+        validate(506, VariantAlsoNegotiates, InternalServerError, Some("Variant Also Negotiates"));
+        validate(507, InsufficientStorage, InternalServerError, Some("Insufficient Storage"));
+        validate(508, LoopDetected, InternalServerError, Some("Loop Detected"));
+        validate(510, NotExtended, InternalServerError, Some("Not Extended"));
+        validate(511, NetworkAuthenticationRequired, InternalServerError,
+            Some("Network Authentication Required"));
+
+    }
+}
copy from third_party/rust/hyper/src/uri.rs
copy to third_party/rust/hyper-0.10.10/src/uri.rs
copy from third_party/rust/hyper/src/version.rs
copy to third_party/rust/hyper-0.10.10/src/version.rs
--- a/third_party/rust/hyper/.cargo-checksum.json
+++ b/third_party/rust/hyper/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"fdead335b20982f9530d61f0bc2049b61af773ec712d1895a780478abbcf4dfd","LICENSE":"df9cfd06d8a44d9a671eadd39ffd97f166481da015a30f45dfd27886209c5922","build.rs":"5b349037786f2f81402943423213d8c63e8fc8e321937da85f6d854ed825a84f","src/buffer.rs":"c8c7dbbb1d848b2c08a18c38b5214bfbd8aa457557c31a9a6f1de2f5aadc3d6a","src/client/mod.rs":"adca4f6090c9806641ace04488a4b28a56e8cd60411bbd9cc856b349fdb19797","src/client/pool.rs":"7c22c8e09af9d56e05a6caaf174b78043e10171982143b8e64118d0dd401efab","src/client/proxy.rs":"0fb671fddb1c377646dc86b620b086941d56354659eace4eb387f414c345fe6b","src/client/request.rs":"c9029bbf1c27ad11d78f61e1f1175b6417eecbc3b9053c33d8c08daf61f72570","src/client/response.rs":"64fa127a3d0f5b234a921eb3be26f89021a06f03e8770f7cbe64047ec40522e5","src/error.rs":"3b3d27425118d08b1205fe7a1c91037b6ad5791cb7ccfbf53207388cb4edca1b","src/header/common/accept.rs":"d4203a24788e23fcf1ef081e9d5ab010e95d48b67532417600b6f4ff7b4a103b","src/header/common/accept_charset.rs":"f2664acc80c429c32325b4128feedc12e47357be17550821929f8002c85af214","src/header/common/accept_encoding.rs":"bea61eb5cd40564a01a0cbbd139e8b070fd8b8489c7af08de9541f607e50fbb2","src/header/common/accept_language.rs":"2e0155b85d991a0b917be1e54a9eda019597aeb4bf61cbd841fbe92f186262a3","src/header/common/accept_ranges.rs":"df351621f0753340697b0a0ceab030580c8604d6a3a5c3c3415b9fca55c04330","src/header/common/access_control_allow_credentials.rs":"c68a618d51235be37d12746fad6248c07d6c904106cd0a97be2239efab8ce941","src/header/common/access_control_allow_headers.rs":"4781e3ce4ef2ee4e90a9f775742d55751c5403b0b11539f96c9e5c76d7a3029e","src/header/common/access_control_allow_methods.rs":"0f72c4e70e74f0be8ddae576220b2cea11e2d848512e5ffb329206275908383d","src/header/common/access_control_allow_origin.rs":"933fdc7d147f7706b191ad6943b341887d9260ef7480384deb2563cd31a43cd1","src/header/common/access_control_expose_headers.rs":"f026676e762ac5c5e6ae33543ceba4e484406e89306d0b3873507814675f408a","src/header/common/access_control_max_age.rs":"1c5970cfaf15ab3ab602b215ab119f100343a7f9e4f85a6711ea21a12f369402","src/header/common/access_control_request_headers.rs":"879810240d82544c581b5057808657f9445bf823e19a990e5e88d43d28b88ce6","src/header/common/access_control_request_method.rs":"fd5bc2396dbf0977c616d7b262f2441e60d3e2806c54d0838195cdedd992e7f1","src/header/common/allow.rs":"8b12d0c7f9a76f2aec826ba80097efa784304f50e2e0ce330d8ffd810bb7dd7d","src/header/common/authorization.rs":"888cca057e0c45757ccbe31c7fdf34b9fa4b62285869e4d525f338d7003ac67c","src/header/common/cache_control.rs":"de2c876b78b83ce080007d3413a13e7770963cec49cd0202a8ffb0259185f95f","src/header/common/connection.rs":"5584948f8baae51a480ab6badf23fcb2aa2df6f3db5bd12ba09dcd08d1d01643","src/header/common/content_disposition.rs":"b6be5e65ec73113e045b73a0f69f63204942e25a3b9469f2f59c032c587e111f","src/header/common/content_encoding.rs":"636e07b326036f0d903fe7bce4e49da56dc43ed53d7dd158a906c06bd7466ad2","src/header/common/content_language.rs":"0c42bebf462b570a6dae46580685cb931feaf83b8fd6a0e89a29f7383397f393","src/header/common/content_length.rs":"c792029182c0213d4e2cc90f66210c01f164a4a8b25abadaa74ce51947ad4c76","src/header/common/content_range.rs":"5fab7832b985489b76c698654a4891aaaff6b671b7174dc25c2c4abeeb0d14eb","src/header/common/content_type.rs":"cd6db1ac9159317a467df0feebf66fa0f2e976f81aa339f3e1402110ee16cdad","src/header/common/cookie.rs":"f38e0ece0f4ddf6f5bacd7b1199aab289a5943dd1151c525970837b24fb7e59c","src/header/common/date.rs":"b3516aee3bb26ee5b2a97829ea45d6440512cbd9ef862f9e7f65a39f282e207e","src/header/common/etag.rs":"d7548c554751bb74c5ef53095cd30074e48bb39802190d8caec90621d16c6e9b","src/header/common/expect.rs":"754c5d648086429d6d9c7cebcd86d59703893d6ff904ae5de5217bb71a860496","src/header/common/expires.rs":"351a28af03596aa5ae7dbe97485ef2e717bb5567d8a5ae830e8c1968bbb236ec","src/header/common/from.rs":"05d9f1675c7d3f2caa7082fe44f5e89c3a4104af26ff21b9846443ccde0df12a","src/header/common/host.rs":"f296d9c92c0462a937636190bc3aae8a8f9e3473bd8b7cd5963870fc03686bc2","src/header/common/if_match.rs":"a0919e71b40b51e447d21fce6b9fbe779de84ae228dc4769a237a2aa34cbb201","src/header/common/if_modified_since.rs":"b722b471531740b4e200da3f53182fea6d0b750931664d233674d99f7f92767f","src/header/common/if_none_match.rs":"f810a9fc0161bd293b8ea6f18d84120d7950557c46fb07028e7351c0fbaed0fa","src/header/common/if_range.rs":"bdc77ca3c6b392aaf38c778f69756933f8a59cb946839e801508548aef891153","src/header/common/if_unmodified_since.rs":"9783ab6133cab3b38800c0049338ff697390f0915f6b7d9b81a485f028ae2dbc","src/header/common/last-event-id.rs":"e773661a46c926b2ecd93cd1a1ca5a6c361b1b8d0c9d004c9ba0bb6b96995e4a","src/header/common/last_modified.rs":"26949ae19bb17e660a3c2c967a7e066c1cc79ea987e5c5b8627a211952d18eb0","src/header/common/location.rs":"ed3482f4f806e6241d70aabbc5ce409022ab5d85aa33d7c1e8a50385aec31a7a","src/header/common/mod.rs":"2af70a911729077f2bfa4fc5da46bf9adf122426ce78ef529de9317069d28117","src/header/common/origin.rs":"c5d38d5c47494038badf85154eae5aa529821adbb8d91e04845cd1939a3acb70","src/header/common/pragma.rs":"024f6d401d6a2c363fb81afcf57dd4cfb164a7ce5a5e4dc9f9b7a95d1ea829d1","src/header/common/prefer.rs":"e680be23a4ed754e357d607a3cbdd9e00d2591fd26058f7f43f7757a86be32f5","src/header/common/preference_applied.rs":"13841597fcd9f1049fc515ea0a401975b3a0c4851c6664e9e4afcba987184680","src/header/common/range.rs":"553a3cb2ba7531418ca56f39f20a6f03b7cb07258b8a70a9ff52c224ae410e93","src/header/common/referer.rs":"e40aebce1e21a8a939df1cb331ed6ab84c37a261fde83b788be1f82710bdb2ba","src/header/common/referrer_policy.rs":"a72fd93ae042aaa5ecfe548a12b6ac07dcd8efdc375591f6f851332f4398684c","src/header/common/server.rs":"e3c7963bd341573c513bf1a1a15bbe38a78f5d8029f6783a8d679ce17969cbe0","src/header/common/set_cookie.rs":"ca02d00f2ec18b4059b1979e3f66a4fadcacacb0f9a8c7faf7a2535f7ad0d6e8","src/header/common/strict_transport_security.rs":"16d20d713979143c9a22326bffc29b31d15e51937f150888c5cdf5b844c881bb","src/header/common/transfer_encoding.rs":"0ae112334bba0b5bb64e4a67059209ed5fb8f034cd24966d63cbfff714480df1","src/header/common/upgrade.rs":"caa2777900ebbd1239a322e0f84b745b688d270fac331d86b0979fe0140cfe63","src/header/common/user_agent.rs":"3f8396206a2cad8d925d391321ebc2d7625f18ea2efcb8562958748369f83111","src/header/common/vary.rs":"ea9ca2d338f01b3a60cb7734532e8717a85c93c15eb1f4701c620fee42a5e9f5","src/header/internals/cell.rs":"0dcc63cf60ce028cf5bfabfcf3e04cb295b474174807c7ea9a97e9f6b7bfadb7","src/header/internals/item.rs":"05973f19f40deaccf9b363645cc13cf4c702c4d22ddebb5e6af9a14d592e5a24","src/header/internals/mod.rs":"a7584044f256ee1be3ba1542c7ce32263aa9d62700571430b1d723c5cf53f383","src/header/internals/vec_map.rs":"5ff364116d9864d05a8488291def3b754844c082aea4cd58d6243ddae7277ce0","src/header/mod.rs":"df6412ebd012881dc188ffff1b5c4a3a0f7f271845760fdd7ffb2d8f97a67e77","src/header/parsing.rs":"5cb02c694b2bdd16abf9b6bc6af3c01b143f01e26f60ce2fb69c6b0c0c19017f","src/header/shared/charset.rs":"71087f535a425d7d17cb3de69f1016e6602032b957d49fe121f6e56f1bf26e2f","src/header/shared/encoding.rs":"9c3b39f074bcadab68e158beea5e35d43de0c717971839d2e1ae43468d7bd7f7","src/header/shared/entity.rs":"b70b08c6511f7fd5539e4e42685423bf2f5fb3d5333fe3175e9010b890d0b654","src/header/shared/httpdate.rs":"6401ebff650228ddc457e3d4b008208254c62a478ea98367e87ffe6cbb106992","src/header/shared/mod.rs":"7216081f6253959364d9aa3abf16f17462baab48f16d174078c61c71ad023c0f","src/header/shared/quality_item.rs":"284d1b35af35d2244459f4ade87c1897a949ef047d4e784738635d558ea157b4","src/http/h1.rs":"1d607c89a390d629648a2ff38ae95059a698ad0b36b925d9c7bbad7c764c8538","src/http/message.rs":"c09939bb38c40d5a8124f5b60b8fc539aa10a11b4a46c1c3f74d097fa8ecc088","src/http/mod.rs":"9112fb2e59070d105fb361afc600f85cd6a5e21d4d007eaa821145e9b7e63f55","src/lib.rs":"0c130e83db8da5d631cb10c364b879aa0b0b7926d8025a4c874de496b87fa900","src/method.rs":"f6fbd5f697cb28f073881cca26004ea3e97638a4b0e44c6192a426b9e762e9cc","src/mock.rs":"e366916d8c55099b1b9dee5cdbe26f1f2faff6ff9d659e476cbe578263dda2c6","src/net.rs":"15d6e3c20ca97641cca8bdf80a67296823e79be28b4492b48b0f74411439a105","src/server/listener.rs":"6bd4abda51fde6e38087923dff198aef7b5bc119add2e81d59173a215c512b9d","src/server/mod.rs":"d9f8796114740b08592621d9f461eb6c7d6baf692f409ebce4f0c44588148cdd","src/server/request.rs":"ce125e73bd3b9bf8b75af94c31a85fb5a5e8d3d11f7e758ecbbd51a4b2670af0","src/server/response.rs":"7b1e40ba04f2321a62042c13723596729e69883abc4912a5371911d9a0e2a474","src/status.rs":"6c3af3f4cac43748be938bfc7c2aeabe63f32fef233d7c2a7ea7a933c7c19699","src/uri.rs":"26c357704a80d5c8ffd28123617862ffff0213613f1aec6a5758be49244379c8","src/version.rs":"e56f6962a2ae701f3923bfce0a3d150f9caea28e8880598affb723190776cd4a"},"package":"36e108e0b1fa2d17491cbaac4bc460dc0956029d10ccf83c913dd0e5db3e7f07"}
\ No newline at end of file
+{"files":{"Cargo.toml":"88c441ef43515d199714599d4222c3735df869d3909f5d2d8dcb2f7775784e6a","LICENSE":"df9cfd06d8a44d9a671eadd39ffd97f166481da015a30f45dfd27886209c5922","src/buffer.rs":"bb0334bcb2fa63a8f9b20cfb662a52f76a8556a5a326f5d44e6885d80fbd406d","src/client/mod.rs":"67bef422959f1c8deb1216d9bdc2e578137859ae8ecca3dd54110aa444191024","src/client/pool.rs":"652072fbcc210d551c95695ed71042ae2a80a594d01e17d8e7983626620de815","src/client/proxy.rs":"0fb671fddb1c377646dc86b620b086941d56354659eace4eb387f414c345fe6b","src/client/request.rs":"c9029bbf1c27ad11d78f61e1f1175b6417eecbc3b9053c33d8c08daf61f72570","src/client/response.rs":"25a39147177e838b7e73d073583cc4a1623b7b8d682a1acdbca4a5eb720c9c97","src/error.rs":"3b3d27425118d08b1205fe7a1c91037b6ad5791cb7ccfbf53207388cb4edca1b","src/header/common/accept.rs":"d4203a24788e23fcf1ef081e9d5ab010e95d48b67532417600b6f4ff7b4a103b","src/header/common/accept_charset.rs":"f2664acc80c429c32325b4128feedc12e47357be17550821929f8002c85af214","src/header/common/accept_encoding.rs":"bea61eb5cd40564a01a0cbbd139e8b070fd8b8489c7af08de9541f607e50fbb2","src/header/common/accept_language.rs":"2e0155b85d991a0b917be1e54a9eda019597aeb4bf61cbd841fbe92f186262a3","src/header/common/accept_ranges.rs":"df351621f0753340697b0a0ceab030580c8604d6a3a5c3c3415b9fca55c04330","src/header/common/access_control_allow_credentials.rs":"c68a618d51235be37d12746fad6248c07d6c904106cd0a97be2239efab8ce941","src/header/common/access_control_allow_headers.rs":"4781e3ce4ef2ee4e90a9f775742d55751c5403b0b11539f96c9e5c76d7a3029e","src/header/common/access_control_allow_methods.rs":"0f72c4e70e74f0be8ddae576220b2cea11e2d848512e5ffb329206275908383d","src/header/common/access_control_allow_origin.rs":"933fdc7d147f7706b191ad6943b341887d9260ef7480384deb2563cd31a43cd1","src/header/common/access_control_expose_headers.rs":"f026676e762ac5c5e6ae33543ceba4e484406e89306d0b3873507814675f408a","src/header/common/access_control_max_age.rs":"1c5970cfaf15ab3ab602b215ab119f100343a7f9e4f85a6711ea21a12f369402","src/header/common/access_control_request_headers.rs":"879810240d82544c581b5057808657f9445bf823e19a990e5e88d43d28b88ce6","src/header/common/access_control_request_method.rs":"fd5bc2396dbf0977c616d7b262f2441e60d3e2806c54d0838195cdedd992e7f1","src/header/common/allow.rs":"8b12d0c7f9a76f2aec826ba80097efa784304f50e2e0ce330d8ffd810bb7dd7d","src/header/common/authorization.rs":"e1a6df10a3ee74fbb4ccaa68d0e13d1f93170510a0a0884372d5b29e289795f1","src/header/common/cache_control.rs":"de2c876b78b83ce080007d3413a13e7770963cec49cd0202a8ffb0259185f95f","src/header/common/connection.rs":"5584948f8baae51a480ab6badf23fcb2aa2df6f3db5bd12ba09dcd08d1d01643","src/header/common/content_disposition.rs":"b6be5e65ec73113e045b73a0f69f63204942e25a3b9469f2f59c032c587e111f","src/header/common/content_encoding.rs":"636e07b326036f0d903fe7bce4e49da56dc43ed53d7dd158a906c06bd7466ad2","src/header/common/content_language.rs":"0c42bebf462b570a6dae46580685cb931feaf83b8fd6a0e89a29f7383397f393","src/header/common/content_length.rs":"c792029182c0213d4e2cc90f66210c01f164a4a8b25abadaa74ce51947ad4c76","src/header/common/content_range.rs":"5fab7832b985489b76c698654a4891aaaff6b671b7174dc25c2c4abeeb0d14eb","src/header/common/content_type.rs":"cd6db1ac9159317a467df0feebf66fa0f2e976f81aa339f3e1402110ee16cdad","src/header/common/cookie.rs":"f38e0ece0f4ddf6f5bacd7b1199aab289a5943dd1151c525970837b24fb7e59c","src/header/common/date.rs":"b3516aee3bb26ee5b2a97829ea45d6440512cbd9ef862f9e7f65a39f282e207e","src/header/common/etag.rs":"d7548c554751bb74c5ef53095cd30074e48bb39802190d8caec90621d16c6e9b","src/header/common/expect.rs":"754c5d648086429d6d9c7cebcd86d59703893d6ff904ae5de5217bb71a860496","src/header/common/expires.rs":"351a28af03596aa5ae7dbe97485ef2e717bb5567d8a5ae830e8c1968bbb236ec","src/header/common/from.rs":"05d9f1675c7d3f2caa7082fe44f5e89c3a4104af26ff21b9846443ccde0df12a","src/header/common/host.rs":"f296d9c92c0462a937636190bc3aae8a8f9e3473bd8b7cd5963870fc03686bc2","src/header/common/if_match.rs":"a0919e71b40b51e447d21fce6b9fbe779de84ae228dc4769a237a2aa34cbb201","src/header/common/if_modified_since.rs":"b722b471531740b4e200da3f53182fea6d0b750931664d233674d99f7f92767f","src/header/common/if_none_match.rs":"f810a9fc0161bd293b8ea6f18d84120d7950557c46fb07028e7351c0fbaed0fa","src/header/common/if_range.rs":"bdc77ca3c6b392aaf38c778f69756933f8a59cb946839e801508548aef891153","src/header/common/if_unmodified_since.rs":"9783ab6133cab3b38800c0049338ff697390f0915f6b7d9b81a485f028ae2dbc","src/header/common/last-event-id.rs":"e773661a46c926b2ecd93cd1a1ca5a6c361b1b8d0c9d004c9ba0bb6b96995e4a","src/header/common/last_modified.rs":"26949ae19bb17e660a3c2c967a7e066c1cc79ea987e5c5b8627a211952d18eb0","src/header/common/link.rs":"a32fabe5b796d8a541c7440ad521612a4fba8cf8e5006d48bca44d02e0108a3c","src/header/common/location.rs":"ed3482f4f806e6241d70aabbc5ce409022ab5d85aa33d7c1e8a50385aec31a7a","src/header/common/mod.rs":"c461990cdc26ad38cc0f31e5a92c8f6a84cbf1c887c39d65b6a92b65d08af071","src/header/common/origin.rs":"c5d38d5c47494038badf85154eae5aa529821adbb8d91e04845cd1939a3acb70","src/header/common/pragma.rs":"024f6d401d6a2c363fb81afcf57dd4cfb164a7ce5a5e4dc9f9b7a95d1ea829d1","src/header/common/prefer.rs":"e680be23a4ed754e357d607a3cbdd9e00d2591fd26058f7f43f7757a86be32f5","src/header/common/preference_applied.rs":"13841597fcd9f1049fc515ea0a401975b3a0c4851c6664e9e4afcba987184680","src/header/common/range.rs":"553a3cb2ba7531418ca56f39f20a6f03b7cb07258b8a70a9ff52c224ae410e93","src/header/common/referer.rs":"e40aebce1e21a8a939df1cb331ed6ab84c37a261fde83b788be1f82710bdb2ba","src/header/common/referrer_policy.rs":"a72fd93ae042aaa5ecfe548a12b6ac07dcd8efdc375591f6f851332f4398684c","src/header/common/server.rs":"e3c7963bd341573c513bf1a1a15bbe38a78f5d8029f6783a8d679ce17969cbe0","src/header/common/set_cookie.rs":"ca02d00f2ec18b4059b1979e3f66a4fadcacacb0f9a8c7faf7a2535f7ad0d6e8","src/header/common/strict_transport_security.rs":"16d20d713979143c9a22326bffc29b31d15e51937f150888c5cdf5b844c881bb","src/header/common/transfer_encoding.rs":"0ae112334bba0b5bb64e4a67059209ed5fb8f034cd24966d63cbfff714480df1","src/header/common/upgrade.rs":"caa2777900ebbd1239a322e0f84b745b688d270fac331d86b0979fe0140cfe63","src/header/common/user_agent.rs":"3f8396206a2cad8d925d391321ebc2d7625f18ea2efcb8562958748369f83111","src/header/common/vary.rs":"ea9ca2d338f01b3a60cb7734532e8717a85c93c15eb1f4701c620fee42a5e9f5","src/header/internals/cell.rs":"f9d023d725b5ccc78a9566202292a59d7ef42c27d42a0e5c99460273e687fffe","src/header/internals/item.rs":"05973f19f40deaccf9b363645cc13cf4c702c4d22ddebb5e6af9a14d592e5a24","src/header/internals/mod.rs":"a7584044f256ee1be3ba1542c7ce32263aa9d62700571430b1d723c5cf53f383","src/header/internals/vec_map.rs":"0e2209a731eba7868d362c5e0f0bf74849baf8e293a0253bd6c5f7207f388ee4","src/header/mod.rs":"60f84113fb7a65c9295e0d9467d37c1229025d884f0df50b9a9dc31af5b4cc5f","src/header/parsing.rs":"5cb02c694b2bdd16abf9b6bc6af3c01b143f01e26f60ce2fb69c6b0c0c19017f","src/header/shared/charset.rs":"71087f535a425d7d17cb3de69f1016e6602032b957d49fe121f6e56f1bf26e2f","src/header/shared/encoding.rs":"9c3b39f074bcadab68e158beea5e35d43de0c717971839d2e1ae43468d7bd7f7","src/header/shared/entity.rs":"b70b08c6511f7fd5539e4e42685423bf2f5fb3d5333fe3175e9010b890d0b654","src/header/shared/httpdate.rs":"6401ebff650228ddc457e3d4b008208254c62a478ea98367e87ffe6cbb106992","src/header/shared/mod.rs":"7216081f6253959364d9aa3abf16f17462baab48f16d174078c61c71ad023c0f","src/header/shared/quality_item.rs":"284d1b35af35d2244459f4ade87c1897a949ef047d4e784738635d558ea157b4","src/http/h1.rs":"4026eec0c2f49fc28cdcba67d8133e0473cec1807e49a6d5f3d77fcde83ab20f","src/http/message.rs":"c09939bb38c40d5a8124f5b60b8fc539aa10a11b4a46c1c3f74d097fa8ecc088","src/http/mod.rs":"9112fb2e59070d105fb361afc600f85cd6a5e21d4d007eaa821145e9b7e63f55","src/lib.rs":"0d5f7558dc4995d553835df43bd3412193ffbf2841be0ed4e6454122838904cb","src/method.rs":"f6fbd5f697cb28f073881cca26004ea3e97638a4b0e44c6192a426b9e762e9cc","src/mock.rs":"dbaa5c2c3bd4a160bac72fe09982605b783086ad8f5500cba3caddbbf804c7a2","src/net.rs":"15d6e3c20ca97641cca8bdf80a67296823e79be28b4492b48b0f74411439a105","src/server/listener.rs":"3c3d7c658a5cee2ba0ebb4703ca86d02474dbb074a1f57415cd7331803adee3d","src/server/mod.rs":"f4454713769cbad49b62150915031f4db047f5a09603c5f1b7ea8685eab7814f","src/server/request.rs":"49f0d044ed9173d4e3f434112ba88f113feb4b592e5a2a36d442fa26481969f6","src/server/response.rs":"c8ad551860d8404c12d3c12c5932ec536dc1c8b34f428ba613728c6c9c4979b1","src/status.rs":"6c3af3f4cac43748be938bfc7c2aeabe63f32fef233d7c2a7ea7a933c7c19699","src/uri.rs":"ec3eb7595f7842f67a9449e4dbe2d949e1eb86dd3322ee890c3c116ded1a59d9","src/version.rs":"cd422615a8ef3e9e223b3fd68df475bba59dce1e0503ef879c4d88b51832e8db"},"package":"368cb56b2740ebf4230520e2b90ebb0461e69034d85d1945febd9b3971426db2"}
\ No newline at end of file
--- a/third_party/rust/hyper/Cargo.toml
+++ b/third_party/rust/hyper/Cargo.toml
@@ -1,44 +1,62 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
-
 name = "hyper"
-version = "0.10.10"
+version = "0.10.13"
+authors = ["Sean McArthur <sean.monstar@gmail.com>", "Jonathan Reem <jonathan.reem@gmail.com>"]
+include = ["Cargo.toml", "LICENSE", "src/**/*"]
 description = "A modern HTTP library."
+homepage = "http://hyper.rs"
+documentation = "https://docs.rs/hyper"
 readme = "README.md"
-homepage = "http://hyper.rs"
-documentation = "http://hyper.rs/hyper"
-repository = "https://github.com/hyperium/hyper"
-license = "MIT"
-authors = ["Sean McArthur <sean.monstar@gmail.com>",
-           "Jonathan Reem <jonathan.reem@gmail.com>"]
 keywords = ["http", "hyper", "hyperium"]
 categories = ["web-programming::http-client", "web-programming::http-server"]
-build = "build.rs"
+license = "MIT"
+repository = "https://github.com/hyperium/hyper"
+[dependencies.mime]
+version = "0.2"
+
+[dependencies.traitobject]
+version = "0.1"
 
-include = [
-  "build.rs",
-  "Cargo.toml",
-  "LICENSE",
-  "src/**/*"
-]
+[dependencies.unicase]
+version = "1.0"
+
+[dependencies.language-tags]
+version = "0.2"
+
+[dependencies.httparse]
+version = "1.0"
 
-[dependencies]
-base64 = "0.5.2"
-httparse = "1.0"
-language-tags = "0.2"
-log = "0.3"
-mime = "0.2"
-num_cpus = "1.0"
-time = "0.1"
-traitobject = "0.1"
-typeable = "0.1"
-unicase = "1.0"
-url = "1.0"
+[dependencies.typeable]
+version = "0.1"
+
+[dependencies.time]
+version = "0.1"
+
+[dependencies.url]
+version = "1.0"
 
-[dev-dependencies]
-env_logger = "0.3"
+[dependencies.log]
+version = "0.3"
 
-[build-dependencies]
-rustc_version = "0.1"
+[dependencies.num_cpus]
+version = "1.0"
+
+[dependencies.base64]
+version = "0.6.0"
+[dev-dependencies.env_logger]
+version = "0.4"
 
 [features]
 nightly = []
--- a/third_party/rust/hyper/src/buffer.rs
+++ b/third_party/rust/hyper/src/buffer.rs
@@ -4,17 +4,17 @@ use std::io::{self, Read, BufRead};
 pub struct BufReader<R> {
     inner: R,
     buf: Vec<u8>,
     pos: usize,
     cap: usize,
 }
 
 const INIT_BUFFER_SIZE: usize = 4096;
-const MAX_BUFFER_SIZE: usize = 8192 + 4096 * 100;
+pub const MAX_BUFFER_SIZE: usize = 8192 + 4096 * 100;
 
 impl<R: Read> BufReader<R> {
     #[inline]
     pub fn new(rdr: R) -> BufReader<R> {
         BufReader::with_capacity(rdr, INIT_BUFFER_SIZE)
     }
 
     #[inline]
--- a/third_party/rust/hyper/src/client/mod.rs
+++ b/third_party/rust/hyper/src/client/mod.rs
@@ -265,17 +265,17 @@ impl<'a> RequestBuilder<'a> {
     pub fn headers(mut self, headers: Headers) -> RequestBuilder<'a> {
         self.headers = Some(headers);
         self
     }
 
     /// Add an individual new header to the request.
     pub fn header<H: Header + HeaderFormat>(mut self, header: H) -> RequestBuilder<'a> {
         {
-            let mut headers = match self.headers {
+            let headers = match self.headers {
                 Some(ref mut h) => h,
                 None => {
                     self.headers = Some(Headers::new());
                     self.headers.as_mut().unwrap()
                 }
             };
 
             headers.set(header);
@@ -327,17 +327,19 @@ impl<'a> RequestBuilder<'a> {
                 (true, Some(body)) => match body.size() {
                     Some(size) => req.headers_mut().set(ContentLength(size)),
                     None => (), // chunked, Request will add it automatically
                 },
                 (true, None) => req.headers_mut().set(ContentLength(0)),
                 _ => () // neither
             }
             let mut streaming = try!(req.start());
-            body.take().map(|mut rdr| copy(&mut rdr, &mut streaming));
+            if let Some(mut rdr) = body.take() {
+                try!(copy(&mut rdr, &mut streaming));
+            }
             let res = try!(streaming.send());
             if !res.status.is_redirection() {
                 return Ok(res)
             }
             debug!("redirect code {:?} for {}", res.status, url);
 
             let loc = {
                 // punching borrowck here
@@ -716,9 +718,29 @@ mod tests {
         let mut s = String::new();
         client.head("http://127.0.0.1").send().unwrap().read_to_string(&mut s).unwrap();
         assert_eq!(s, "");
 
         let mut s = String::new();
         client.post("http://127.0.0.1").send().unwrap().read_to_string(&mut s).unwrap();
         assert_eq!(s, "POST");
     }
+
+    #[test]
+    fn test_request_body_error_is_returned() {
+        mock_connector!(Connector {
+            b"HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n",
+            b"HELLO"
+        });
+
+        struct BadBody;
+
+        impl ::std::io::Read for BadBody {
+            fn read(&mut self, _buf: &mut [u8]) -> ::std::io::Result<usize> {
+                Err(::std::io::Error::new(::std::io::ErrorKind::Other, "BadBody read"))
+            }
+        }
+
+        let client = Client::with_connector(Connector);
+        let err = client.post("http://127.0.0.1").body(&mut BadBody).send().unwrap_err();
+        assert_eq!(err.to_string(), "BadBody read");
+    }
 }
--- a/third_party/rust/hyper/src/client/pool.rs
+++ b/third_party/rust/hyper/src/client/pool.rs
@@ -2,25 +2,28 @@
 use std::borrow::ToOwned;
 use std::collections::HashMap;
 use std::fmt;
 use std::io::{self, Read, Write};
 use std::net::{SocketAddr, Shutdown};
 use std::sync::{Arc, Mutex};
 use std::sync::atomic::{AtomicBool, Ordering};
 
-use std::time::Duration;
+use std::time::{Duration, Instant};
 
 use net::{NetworkConnector, NetworkStream, DefaultConnector};
 use client::scheme::Scheme;
 
+use self::stale::{StaleCheck, Stale};
+
 /// The `NetworkConnector` that behaves as a connection pool used by hyper's `Client`.
 pub struct Pool<C: NetworkConnector> {
     connector: C,
-    inner: Arc<Mutex<PoolImpl<<C as NetworkConnector>::Stream>>>
+    inner: Arc<Mutex<PoolImpl<<C as NetworkConnector>::Stream>>>,
+    stale_check: Option<StaleCallback<C::Stream>>,
 }
 
 /// Config options for the `Pool`.
 #[derive(Debug)]
 pub struct Config {
     /// The maximum idle connections *per host*.
     pub max_idle: usize,
 }
@@ -29,20 +32,29 @@ impl Default for Config {
     #[inline]
     fn default() -> Config {
         Config {
             max_idle: 5,
         }
     }
 }
 
+// Because `Config` has all its properties public, it would be a breaking
+// change to add new ones. Sigh.
+#[derive(Debug)]
+struct Config2 {
+    idle_timeout: Option<Duration>,
+    max_idle: usize,
+}
+
+
 #[derive(Debug)]
 struct PoolImpl<S> {
     conns: HashMap<Key, Vec<PooledStreamInner<S>>>,
-    config: Config,
+    config: Config2,
 }
 
 type Key = (String, u16, Scheme);
 
 fn key<T: Into<Scheme>>(host: &str, port: u16, scheme: T) -> Key {
     (host.to_owned(), port, scheme.into())
 }
 
@@ -57,124 +69,253 @@ impl Pool<DefaultConnector> {
 impl<C: NetworkConnector> Pool<C> {
     /// Creates a `Pool` with a specified `NetworkConnector`.
     #[inline]
     pub fn with_connector(config: Config, connector: C) -> Pool<C> {
         Pool {
             connector: connector,
             inner: Arc::new(Mutex::new(PoolImpl {
                 conns: HashMap::new(),
-                config: config,
-            }))
+                config: Config2 {
+                    idle_timeout: None,
+                    max_idle: config.max_idle,
+                }
+            })),
+            stale_check: None,
         }
     }
 
+    /// Set a duration for how long an idle connection is still valid.
+    pub fn set_idle_timeout(&mut self, timeout: Option<Duration>) {
+        self.inner.lock().unwrap().config.idle_timeout = timeout;
+    }
+
+    pub fn set_stale_check<F>(&mut self, callback: F)
+    where F: Fn(StaleCheck<C::Stream>) -> Stale + Send + Sync + 'static {
+        self.stale_check = Some(Box::new(callback));
+    }
+
     /// Clear all idle connections from the Pool, closing them.
     #[inline]
     pub fn clear_idle(&mut self) {
         self.inner.lock().unwrap().conns.clear();
     }
+
+    // private
+
+    fn checkout(&self, key: &Key) -> Option<PooledStreamInner<C::Stream>> {
+        while let Some(mut inner) = self.lookup(key) {
+            if let Some(ref stale_check) = self.stale_check {
+                let dur = inner.idle.expect("idle is never missing inside pool").elapsed();
+                let arg = stale::check(&mut inner.stream, dur);
+                if stale_check(arg).is_stale() {
+                    trace!("ejecting stale connection");
+                    continue;
+                }
+            }
+            return Some(inner);
+        }
+        None
+    }
+
+
+    fn lookup(&self, key: &Key) -> Option<PooledStreamInner<C::Stream>> {
+        let mut locked = self.inner.lock().unwrap();
+        let mut should_remove = false;
+        let deadline = locked.config.idle_timeout.map(|dur| Instant::now() - dur);
+        let inner = locked.conns.get_mut(key).and_then(|vec| {
+            while let Some(inner) = vec.pop() {
+                should_remove = vec.is_empty();
+                if let Some(deadline) = deadline {
+                    if inner.idle.expect("idle is never missing inside pool") < deadline {
+                        trace!("ejecting expired connection");
+                        continue;
+                    }
+                }
+                return Some(inner);
+            }
+            None
+        });
+        if should_remove {
+            locked.conns.remove(key);
+        }
+        inner
+    }
 }
 
 impl<S> PoolImpl<S> {
     fn reuse(&mut self, key: Key, conn: PooledStreamInner<S>) {
         trace!("reuse {:?}", key);
         let conns = self.conns.entry(key).or_insert(vec![]);
         if conns.len() < self.config.max_idle {
             conns.push(conn);
         }
     }
 }
 
 impl<C: NetworkConnector<Stream=S>, S: NetworkStream + Send> NetworkConnector for Pool<C> {
     type Stream = PooledStream<S>;
     fn connect(&self, host: &str, port: u16, scheme: &str) -> ::Result<PooledStream<S>> {
         let key = key(host, port, scheme);
-
-        let inner = {
-            // keep the mutex locked only in this block
-            let mut locked = self.inner.lock().unwrap();
-            let mut should_remove = false;
-            let inner = locked.conns.get_mut(&key).map(|vec| {
+        let inner = match self.checkout(&key) {
+            Some(inner) => {
                 trace!("Pool had connection, using");
-                should_remove = vec.len() == 1;
-                vec.pop().unwrap()
-            });
-            if should_remove {
-                locked.conns.remove(&key);
-            }
-            inner
-        };
-
-        let inner = match inner {
-            Some(inner) => inner,
+                inner
+            },
             None => PooledStreamInner {
                 key: key.clone(),
+                idle: None,
                 stream: try!(self.connector.connect(host, port, scheme)),
                 previous_response_expected_no_content: false,
             }
 
         };
         Ok(PooledStream {
+            has_read: false,
             inner: Some(inner),
             is_closed: AtomicBool::new(false),
             pool: self.inner.clone(),
         })
     }
 }
 
+type StaleCallback<S> = Box<Fn(StaleCheck<S>) -> Stale + Send + Sync + 'static>;
+
+// private on purpose
+//
+// Yes, I know! Shame on me! This hurts docs! And it means it only
+// works with closures! I know!
+//
+// The thing is, this is experiemental. I'm not certain about the naming.
+// Or other things. So I don't really want it in the docs, yet.
+//
+// As for only working with closures, that's fine. A closure is probably
+// enough, and if it isn't, well you can grab the stream and duration and
+// pass those to a function, and then figure out whether to call stale()
+// or fresh() based on the return value.
+//
+// Point is, it's not that bad. And it's not ready to publicize.
+mod stale {
+    use std::time::Duration;
+
+    pub struct StaleCheck<'a, S: 'a> {
+        stream: &'a mut S,
+        duration: Duration,
+    }
+
+    #[inline]
+    pub fn check<'a, S: 'a>(stream: &'a mut S, dur: Duration) -> StaleCheck<'a, S> {
+        StaleCheck {
+            stream: stream,
+            duration: dur,
+        }
+    }
+
+    impl<'a, S: 'a> StaleCheck<'a, S> {
+        pub fn stream(&mut self) -> &mut S {
+            self.stream
+        }
+
+        pub fn idle_duration(&self) -> Duration {
+            self.duration
+        }
+
+        pub fn stale(self) -> Stale {
+            Stale(true)
+        }
+
+        pub fn fresh(self) -> Stale {
+            Stale(false)
+        }
+    }
+
+    pub struct Stale(bool);
+
+
+    impl Stale {
+        #[inline]
+        pub fn is_stale(self) -> bool {
+            self.0
+        }
+    }
+}
+
+
 /// A Stream that will try to be returned to the Pool when dropped.
 pub struct PooledStream<S> {
+    has_read: bool,
     inner: Option<PooledStreamInner<S>>,
+    // mutated in &self methods
     is_closed: AtomicBool,
     pool: Arc<Mutex<PoolImpl<S>>>,
 }
 
 // manual impl to add the 'static bound for 1.7 compat
 impl<S> fmt::Debug for PooledStream<S> where S: fmt::Debug + 'static {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
         fmt.debug_struct("PooledStream")
            .field("inner", &self.inner)
+           .field("has_read", &self.has_read)
            .field("is_closed", &self.is_closed.load(Ordering::Relaxed))
            .field("pool", &self.pool)
            .finish()
     }
 }
 
 impl<S: NetworkStream> PooledStream<S> {
     /// Take the wrapped stream out of the pool completely.
     pub fn into_inner(mut self) -> S {
         self.inner.take().expect("PooledStream lost its inner stream").stream
     }
 
     /// Gets a borrowed reference to the underlying stream.
     pub fn get_ref(&self) -> &S {
         &self.inner.as_ref().expect("PooledStream lost its inner stream").stream
     }
+
+    #[cfg(test)]
+    fn get_mut(&mut self) -> &mut S {
+        &mut self.inner.as_mut().expect("PooledStream lost its inner stream").stream
+    }
 }
 
 #[derive(Debug)]
 struct PooledStreamInner<S> {
     key: Key,
+    idle: Option<Instant>,
     stream: S,
     previous_response_expected_no_content: bool,
 }
 
 impl<S: NetworkStream> Read for PooledStream<S> {
     #[inline]
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
-        match self.inner.as_mut().unwrap().stream.read(buf) {
-            Ok(0) => {
-                // if the wrapped stream returns EOF (Ok(0)), that means the
-                // server has closed the stream. we must be sure this stream
-                // is dropped and not put back into the pool.
-                self.is_closed.store(true, Ordering::Relaxed);
+        let inner = self.inner.as_mut().unwrap();
+        let n = try!(inner.stream.read(buf));
+        if n == 0 {
+            // if the wrapped stream returns EOF (Ok(0)), that means the
+            // server has closed the stream. we must be sure this stream
+            // is dropped and not put back into the pool.
+            self.is_closed.store(true, Ordering::Relaxed);
+
+            // if the stream has never read bytes before, then the pooled
+            // stream may have been disconnected by the server while
+            // we checked it back out
+            if !self.has_read && inner.idle.is_some() {
+                // idle being some means this is a reused stream
+                Err(io::Error::new(
+                    io::ErrorKind::ConnectionAborted,
+                    "Pooled stream disconnected"
+                ))
+            } else {
                 Ok(0)
-            },
-            r => r
+            }
+        } else {
+            self.has_read = true;
+            Ok(n)
         }
     }
 }
 
 impl<S: NetworkStream> Write for PooledStream<S> {
     #[inline]
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         self.inner.as_mut().unwrap().stream.write(buf)
@@ -234,60 +375,87 @@ impl<S: NetworkStream> NetworkStream for
     }
 }
 
 impl<S> Drop for PooledStream<S> {
     fn drop(&mut self) {
         let is_closed = self.is_closed.load(Ordering::Relaxed);
         trace!("PooledStream.drop, is_closed={}", is_closed);
         if !is_closed {
-            self.inner.take().map(|inner| {
+            self.inner.take().map(|mut inner| {
+                let now = Instant::now();
+                inner.idle = Some(now);
                 if let Ok(mut pool) = self.pool.lock() {
                     pool.reuse(inner.key.clone(), inner);
                 }
                 // else poisoned, give up
             });
         }
     }
 }
 
 #[cfg(test)]
 mod tests {
     use std::net::Shutdown;
     use std::io::Read;
+    use std::time::Duration;
     use mock::{MockConnector};
     use net::{NetworkConnector, NetworkStream};
 
     use super::{Pool, key};
 
     macro_rules! mocked {
         () => ({
             Pool::with_connector(Default::default(), MockConnector)
         })
     }
 
     #[test]
     fn test_connect_and_drop() {
-        let pool = mocked!();
+        let mut pool = mocked!();
+        pool.set_idle_timeout(Some(Duration::from_millis(100)));
         let key = key("127.0.0.1", 3000, "http");
-        pool.connect("127.0.0.1", 3000, "http").unwrap();
+        let mut stream = pool.connect("127.0.0.1", 3000, "http").unwrap();
+        assert_eq!(stream.get_ref().id, 0);
+        stream.get_mut().id = 9;
+        drop(stream);
         {
             let locked = pool.inner.lock().unwrap();
             assert_eq!(locked.conns.len(), 1);
             assert_eq!(locked.conns.get(&key).unwrap().len(), 1);
         }
-        pool.connect("127.0.0.1", 3000, "http").unwrap(); //reused
+        let stream = pool.connect("127.0.0.1", 3000, "http").unwrap(); //reused
+        assert_eq!(stream.get_ref().id, 9);
+        drop(stream);
         {
             let locked = pool.inner.lock().unwrap();
             assert_eq!(locked.conns.len(), 1);
             assert_eq!(locked.conns.get(&key).unwrap().len(), 1);
         }
     }
 
     #[test]
+    fn test_double_connect_reuse() {
+        let mut pool = mocked!();
+        pool.set_idle_timeout(Some(Duration::from_millis(100)));
+        let key = key("127.0.0.1", 3000, "http");
+        let stream1 = pool.connect("127.0.0.1", 3000, "http").unwrap();
+        let stream2 = pool.connect("127.0.0.1", 3000, "http").unwrap();
+        drop(stream1);
+        drop(stream2);
+        let stream1 = pool.connect("127.0.0.1", 3000, "http").unwrap();
+        {
+            let locked = pool.inner.lock().unwrap();
+            assert_eq!(locked.conns.len(), 1);
+            assert_eq!(locked.conns.get(&key).unwrap().len(), 1);
+        }
+        let _ = stream1;
+    }
+
+    #[test]
     fn test_closed() {
         let pool = mocked!();
         let mut stream = pool.connect("127.0.0.1", 3000, "http").unwrap();
         stream.close(Shutdown::Both).unwrap();
         drop(stream);
         let locked = pool.inner.lock().unwrap();
         assert_eq!(locked.conns.len(), 0);
     }
@@ -297,9 +465,35 @@ mod tests {
         let pool = mocked!();
 
         let mut stream = pool.connect("127.0.0.1", 3000, "http").unwrap();
         assert_eq!(stream.read(&mut [0]).unwrap(), 0);
         drop(stream);
         let locked = pool.inner.lock().unwrap();
         assert_eq!(locked.conns.len(), 0);
     }
+
+    #[test]
+    fn test_read_conn_aborted() {
+        let pool = mocked!();
+
+        pool.connect("127.0.0.1", 3000, "http").unwrap();
+        let mut stream = pool.connect("127.0.0.1", 3000, "http").unwrap();
+        let err = stream.read(&mut [0]).unwrap_err();
+        assert_eq!(err.kind(), ::std::io::ErrorKind::ConnectionAborted);
+        drop(stream);
+        let locked = pool.inner.lock().unwrap();
+        assert_eq!(locked.conns.len(), 0);
+    }
+
+    #[test]
+    fn test_idle_timeout() {
+        let mut pool = mocked!();
+        pool.set_idle_timeout(Some(Duration::from_millis(10)));
+        let mut stream = pool.connect("127.0.0.1", 3000, "http").unwrap();
+        assert_eq!(stream.get_ref().id, 0);
+        stream.get_mut().id = 1337;
+        drop(stream);
+        ::std::thread::sleep(Duration::from_millis(100));
+        let stream = pool.connect("127.0.0.1", 3000, "http").unwrap();
+        assert_eq!(stream.get_ref().id, 0);
+    }
 }
--- a/third_party/rust/hyper/src/client/response.rs
+++ b/third_party/rust/hyper/src/client/response.rs
@@ -90,17 +90,17 @@ impl Drop for Response {
         //
         // otherwise, the response has been drained. we should check that the
         // server has agreed to keep the connection open
         let is_drained = !self.message.has_body();
         trace!("Response.drop is_drained={}", is_drained);
         if !(is_drained && http::should_keep_alive(self.version, &self.headers)) {
             trace!("Response.drop closing connection");
             if let Err(e) = self.message.close_connection() {
-                error!("Response.drop error closing connection: {}", e);
+                info!("Response.drop error closing connection: {}", e);
             }
         }
     }
 }
 
 #[cfg(test)]
 mod tests {
     use std::io::{self, Read};
--- a/third_party/rust/hyper/src/header/common/authorization.rs
+++ b/third_party/rust/hyper/src/header/common/authorization.rs
@@ -158,17 +158,17 @@ impl Scheme for Basic {
 }
 
 impl FromStr for Basic {
     type Err = ::Error;
     fn from_str(s: &str) -> ::Result<Basic> {
         match decode(s) {
             Ok(decoded) => match String::from_utf8(decoded) {
                 Ok(text) => {
-                    let mut parts = &mut text.split(':');
+                    let parts = &mut text.split(':');
                     let user = match parts.next() {
                         Some(part) => part.to_owned(),
                         None => return Err(::Error::Header)
                     };
                     let password = match parts.next() {
                         Some(part) => Some(part.to_owned()),
                         None => None
                     };
new file mode 100644
--- /dev/null
+++ b/third_party/rust/hyper/src/header/common/link.rs
@@ -0,0 +1,1110 @@
+use std::fmt;
+use std::borrow::Cow;
+use std::str::FromStr;
+use std::ascii::AsciiExt;
+
+use mime::Mime;
+use language_tags::LanguageTag;
+
+use header::parsing;
+use header::{Header, HeaderFormat};
+
+/// The `Link` header, defined in
+/// [RFC5988](http://tools.ietf.org/html/rfc5988#section-5)
+///
+/// # ABNF
+/// ```plain
+/// Link           = "Link" ":" #link-value
+/// link-value     = "<" URI-Reference ">" *( ";" link-param )
+/// link-param     = ( ( "rel" "=" relation-types )
+///                | ( "anchor" "=" <"> URI-Reference <"> )
+///                | ( "rev" "=" relation-types )
+///                | ( "hreflang" "=" Language-Tag )
+///                | ( "media" "=" ( MediaDesc | ( <"> MediaDesc <"> ) ) )
+///                | ( "title" "=" quoted-string )
+///                | ( "title*" "=" ext-value )
+///                | ( "type" "=" ( media-type | quoted-mt ) )
+///                | ( link-extension ) )
+/// link-extension = ( parmname [ "=" ( ptoken | quoted-string ) ] )
+///                | ( ext-name-star "=" ext-value )
+/// ext-name-star  = parmname "*" ; reserved for RFC2231-profiled
+/// ; extensions.  Whitespace NOT
+/// ; allowed in between.
+/// ptoken         = 1*ptokenchar
+/// ptokenchar     = "!" | "#" | "$" | "%" | "&" | "'" | "("
+///                | ")" | "*" | "+" | "-" | "." | "/" | DIGIT
+///                | ":" | "<" | "=" | ">" | "?" | "@" | ALPHA
+///                | "[" | "]" | "^" | "_" | "`" | "{" | "|"
+///                | "}" | "~"
+/// media-type     = type-name "/" subtype-name
+/// quoted-mt      = <"> media-type <">
+/// relation-types = relation-type
+///                | <"> relation-type *( 1*SP relation-type ) <">
+/// relation-type  = reg-rel-type | ext-rel-type
+/// reg-rel-type   = LOALPHA *( LOALPHA | DIGIT | "." | "-" )
+/// ext-rel-type   = URI
+/// ```
+///
+/// # Example values
+///
+/// `Link: <http://example.com/TheBook/chapter2>; rel="previous";
+///        title="previous chapter"`
+///
+/// `Link: </TheBook/chapter2>; rel="previous"; title*=UTF-8'de'letztes%20Kapitel,
+///        </TheBook/chapter4>; rel="next"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel`
+///
+/// # Examples
+/// ```
+/// use hyper::header::{Headers, Link, LinkValue, RelationType};
+///
+/// let link_value = LinkValue::new("http://example.com/TheBook/chapter2")
+///     .push_rel(RelationType::Previous)
+///     .set_title("previous chapter");
+///
+/// let mut headers = Headers::new();
+/// headers.set(
+///     Link::new(vec![link_value])
+/// );
+/// ```
+#[derive(Clone, PartialEq, Debug)]
+pub struct Link {
+    /// A list of the `link-value`s of the Link entity-header.
+    values: Vec<LinkValue>
+}
+
+/// A single `link-value` of a `Link` header, based on:
+/// [RFC5988](http://tools.ietf.org/html/rfc5988#section-5)
+#[derive(Clone, PartialEq, Debug)]
+pub struct LinkValue {
+    /// Target IRI: `link-value`.
+    link: Cow<'static, str>,
+
+    /// Forward Relation Types: `rel`.
+    rel: Option<Vec<RelationType>>,
+
+    /// Context IRI: `anchor`.
+    anchor: Option<String>,
+
+    /// Reverse Relation Types: `rev`.
+    rev: Option<Vec<RelationType>>,
+
+    /// Hint on the language of the result of dereferencing
+    /// the link: `hreflang`.
+    href_lang: Option<Vec<LanguageTag>>,
+
+    /// Destination medium or media: `media`.
+    media_desc: Option<Vec<MediaDesc>>,
+
+    /// Label of the destination of a Link: `title`.
+    title: Option<String>,
+
+    /// The `title` encoded in a different charset: `title*`.
+    title_star: Option<String>,
+
+    /// Hint on the media type of the result of dereferencing
+    /// the link: `type`.
+    media_type: Option<Mime>,
+}
+
+/// A Media Descriptors Enum based on:
+/// https://www.w3.org/TR/html401/types.html#h-6.13
+#[derive(Clone, PartialEq, Debug)]
+pub enum MediaDesc {
+    /// screen.
+    Screen,
+    /// tty.
+    Tty,
+    /// tv.
+    Tv,
+    /// projection.
+    Projection,
+    /// handheld.
+    Handheld,
+    /// print.
+    Print,
+    /// braille.
+    Braille,
+    /// aural.
+    Aural,
+    /// all.
+    All,
+    /// Unrecognized media descriptor extension.
+    Extension(String)
+}
+
+/// A Link Relation Type Enum based on:
+/// [RFC5988](https://tools.ietf.org/html/rfc5988#section-6.2.2)
+#[derive(Clone, PartialEq, Debug)]
+pub enum RelationType {
+    /// alternate.
+    Alternate,
+    /// appendix.
+    Appendix,
+    /// bookmark.
+    Bookmark,
+    /// chapter.
+    Chapter,
+    /// contents.
+    Contents,
+    /// copyright.
+    Copyright,
+    /// current.
+    Current,
+    /// describedby.
+    DescribedBy,
+    /// edit.
+    Edit,
+    /// edit-media.
+    EditMedia,
+    /// enclosure.
+    Enclosure,
+    /// first.
+    First,
+    /// glossary.
+    Glossary,
+    /// help.
+    Help,
+    /// hub.
+    Hub,
+    /// index.
+    Index,
+    /// last.
+    Last,
+    /// latest-version.
+    LatestVersion,
+    /// license.
+    License,
+    /// next.
+    Next,
+    /// next-archive.
+    NextArchive,
+    /// payment.
+    Payment,
+    /// prev.
+    Prev,
+    /// predecessor-version.
+    PredecessorVersion,
+    /// previous.
+    Previous,
+    /// prev-archive.
+    PrevArchive,
+    /// related.
+    Related,
+    /// replies.
+    Replies,
+    /// section.
+    Section,
+    /// self.
+    RelationTypeSelf,
+    /// service.
+    Service,
+    /// start.
+    Start,
+    /// stylesheet.
+    Stylesheet,
+    /// subsection.
+    Subsection,
+    /// successor-version.
+    SuccessorVersion,
+    /// up.
+    Up,
+    /// versionHistory.
+    VersionHistory,
+    /// via.
+    Via,
+    /// working-copy.
+    WorkingCopy,
+    /// working-copy-of.
+    WorkingCopyOf,
+    /// ext-rel-type.
+    ExtRelType(String)
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Struct methods
+////////////////////////////////////////////////////////////////////////////////
+
+impl Link {
+    /// Create `Link` from a `Vec<LinkValue>`.
+    pub fn new(link_values: Vec<LinkValue>) -> Link {
+        Link { values: link_values }
+    }
+
+    /// Get the `Link` header's `LinkValue`s.
+    pub fn values(&self) -> &[LinkValue] {
+        self.values.as_ref()
+    }
+
+    /// Add a `LinkValue` instance to the `Link` header's values.
+    pub fn push_value(&mut self, link_value: LinkValue) {
+        self.values.push(link_value);
+    }
+}
+
+impl LinkValue {
+    /// Create `LinkValue` from URI-Reference.
+    pub fn new<T>(uri: T) -> LinkValue
+        where T: Into<Cow<'static, str>> {
+        LinkValue {
+            link: uri.into(),
+            rel: None,
+            anchor: None,
+            rev: None,
+            href_lang: None,
+            media_desc: None,
+            title: None,
+            title_star: None,
+            media_type: None,
+        }
+    }
+
+    /// Get the `LinkValue`'s value.
+    pub fn link(&self) -> &str {
+        self.link.as_ref()
+    }
+
+    /// Get the `LinkValue`'s `rel` parameter(s).
+    pub fn rel(&self) -> Option<&[RelationType]> {
+        self.rel.as_ref().map(AsRef::as_ref)
+    }
+
+    /// Get the `LinkValue`'s `anchor` parameter.
+    pub fn anchor(&self) -> Option<&str> {
+        self.anchor.as_ref().map(AsRef::as_ref)
+    }
+
+    /// Get the `LinkValue`'s `rev` parameter(s).
+    pub fn rev(&self) -> Option<&[RelationType]> {
+        self.rev.as_ref().map(AsRef::as_ref)
+    }
+
+    /// Get the `LinkValue`'s `hreflang` parameter(s).
+    pub fn href_lang(&self) -> Option<&[LanguageTag]> {
+        self.href_lang.as_ref().map(AsRef::as_ref)
+    }
+
+    /// Get the `LinkValue`'s `media` parameter(s).
+    pub fn media_desc(&self) -> Option<&[MediaDesc]> {
+        self.media_desc.as_ref().map(AsRef::as_ref)
+    }
+
+    /// Get the `LinkValue`'s `title` parameter.
+    pub fn title(&self) -> Option<&str> {
+        self.title.as_ref().map(AsRef::as_ref)
+    }
+
+    /// Get the `LinkValue`'s `title*` parameter.
+    pub fn title_star(&self) -> Option<&str> {
+        self.title_star.as_ref().map(AsRef::as_ref)
+    }
+
+    /// Get the `LinkValue`'s `type` parameter.
+    pub fn media_type(&self) -> Option<&Mime> {
+        self.media_type.as_ref()
+    }
+
+    /// Add a `RelationType` to the `LinkValue`'s `rel` parameter.
+    pub fn push_rel(mut self, rel: RelationType) -> LinkValue {
+        let mut v = self.rel.take().unwrap_or(Vec::new());
+
+        v.push(rel);
+
+        self.rel = Some(v);
+
+        self
+    }
+
+    /// Set `LinkValue`'s `anchor` parameter.
+    pub fn set_anchor<T: Into<String>>(mut self, anchor: T) -> LinkValue {
+        self.anchor = Some(anchor.into());
+
+        self
+    }
+
+    /// Add a `RelationType` to the `LinkValue`'s `rev` parameter.
+    pub fn push_rev(mut self, rev: RelationType) -> LinkValue {
+        let mut v = self.rev.take().unwrap_or(Vec::new());
+
+        v.push(rev);
+
+        self.rev = Some(v);
+
+        self
+    }
+
+    /// Add a `LanguageTag` to the `LinkValue`'s `hreflang` parameter.
+    pub fn push_href_lang(mut self, language_tag: LanguageTag) -> LinkValue {
+        let mut v = self.href_lang.take().unwrap_or(Vec::new());
+
+        v.push(language_tag);
+
+        self.href_lang = Some(v);
+
+        self
+    }
+
+    /// Add a `MediaDesc` to the `LinkValue`'s `media_desc` parameter.
+    pub fn push_media_desc(mut self, media_desc: MediaDesc) -> LinkValue {
+        let mut v = self.media_desc.take().unwrap_or(Vec::new());
+
+        v.push(media_desc);
+
+        self.media_desc = Some(v);
+
+        self
+    }
+
+    /// Set `LinkValue`'s `title` parameter.
+    pub fn set_title<T: Into<String>>(mut self, title: T) -> LinkValue {
+        self.title = Some(title.into());
+
+        self
+    }
+
+    /// Set `LinkValue`'s `title*` parameter.
+    pub fn set_title_star<T: Into<String>>(mut self, title_star: T) -> LinkValue {
+        self.title_star = Some(title_star.into());
+
+        self
+    }
+
+    /// Set `LinkValue`'s `type` parameter.
+    pub fn set_media_type(mut self, media_type: Mime) -> LinkValue {
+        self.media_type = Some(media_type);
+
+        self
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Trait implementations
+////////////////////////////////////////////////////////////////////////////////
+
+impl Header for Link {
+    fn header_name() -> &'static str {
+        static NAME: &'static str = "Link";
+        NAME
+    }
+
+    fn parse_header(raw: &[Vec<u8>]) -> ::Result<Link> {
+        // If more that one `Link` headers are present in a request's
+        // headers they are combined in a single `Link` header containing
+        // all the `link-value`s present in each of those `Link` headers.
+        raw.iter()
+            .map(|v| parsing::from_raw_str::<Link>(&v))
+            .fold(None, |p, c| match (p, c) {
+                (None, c) => Some(c),
+                (e @ Some(Err(_)), _) => e,
+                (Some(Ok(mut p)), Ok(c)) => {
+                    p.values.extend(c.values);
+
+                    Some(Ok(p))
+                }
+                _ => Some(Err(::Error::Header)),
+            })
+            .unwrap_or(Err(::Error::Header))
+    }
+}
+impl HeaderFormat for Link {
+    fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt_delimited(f, self.values.as_slice(), ", ", ("", ""))
+    }
+}
+
+impl fmt::Display for Link {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.fmt_header(f)
+    }
+}
+
+impl fmt::Display for LinkValue {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        try!(write!(f, "<{}>", self.link));
+
+        if let Some(ref rel) = self.rel {
+            try!(fmt_delimited(f, rel.as_slice(), " ", ("; rel=\"", "\"")));
+        }
+        if let Some(ref anchor) = self.anchor {
+            try!(write!(f, "; anchor=\"{}\"", anchor));
+        }
+        if let Some(ref rev) = self.rev {
+            try!(fmt_delimited(f, rev.as_slice(), " ", ("; rev=\"", "\"")));
+        }
+        if let Some(ref href_lang) = self.href_lang {
+            for tag in href_lang {
+                try!(write!(f, "; hreflang={}", tag));
+            }
+        }
+        if let Some(ref media_desc) = self.media_desc {
+            try!(fmt_delimited(f, media_desc.as_slice(), ", ", ("; media=\"", "\"")));
+        }
+        if let Some(ref title) = self.title {
+            try!(write!(f, "; title=\"{}\"", title));
+        }
+        if let Some(ref title_star) = self.title_star {
+            try!(write!(f, "; title*={}", title_star));
+        }
+        if let Some(ref media_type) = self.media_type {
+            try!(write!(f, "; type=\"{}\"", media_type));
+        }
+
+        Ok(())
+    }
+}
+
+impl FromStr for Link {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<Link> {
+        // Create a split iterator with delimiters: `;`, `,`
+        let link_split = SplitAsciiUnquoted::new(s, ";,");
+
+        let mut link_values: Vec<LinkValue> = Vec::new();
+
+        // Loop over the splits parsing the Link header into
+        // a `Vec<LinkValue>`
+        for segment in link_split {
+            // Parse the `Target IRI`
+            // https://tools.ietf.org/html/rfc5988#section-5.1
+            if segment.trim().starts_with('<') {
+                link_values.push(
+                    match verify_and_trim(segment.trim(), (b'<', b'>')) {
+                        Err(_) => return Err(::Error::Header),
+                        Ok(s) => {
+                            LinkValue {
+                                link: s.to_owned().into(),
+                                rel: None,
+                                anchor: None,
+                                rev: None,
+                                href_lang: None,
+                                media_desc: None,
+                                title: None,
+                                title_star: None,
+                                media_type: None,
+                            }
+                        },
+                    }
+                );
+            } else {
+                // Parse the current link-value's parameters
+                let mut link_param_split = segment.splitn(2, '=');
+
+                let link_param_name = match link_param_split.next() {
+                    None => return Err(::Error::Header),
+                    Some(p) => p.trim(),
+                };
+
+                let link_header = match link_values.last_mut() {
+                    None => return Err(::Error::Header),
+                    Some(l) => l,
+                };
+
+                if "rel".eq_ignore_ascii_case(link_param_name) {
+                    // Parse relation type: `rel`.
+                    // https://tools.ietf.org/html/rfc5988#section-5.3
+                    if link_header.rel.is_none() {
+                        link_header.rel = match link_param_split.next() {
+                            None => return Err(::Error::Header),
+                            Some("") =>  return Err(::Error::Header),
+                            Some(s) => {
+                                s.trim_matches(|c: char| c == '"' || c.is_whitespace())
+                                    .split(' ')
+                                    .map(|t| t.trim().parse())
+                                    .collect::<Result<Vec<RelationType>, _>>()
+                                    .or_else(|_| return Err(::Error::Header))
+                                    .ok()
+                            },
+                        };
+                    }
+                } else if "anchor".eq_ignore_ascii_case(link_param_name) {
+                    // Parse the `Context IRI`.
+                    // https://tools.ietf.org/html/rfc5988#section-5.2
+                    link_header.anchor = match link_param_split.next() {
+                        None => return Err(::Error::Header),
+                        Some("") =>  return Err(::Error::Header),
+                        Some(s) => match verify_and_trim(s.trim(), (b'"', b'"')) {
+                            Err(_) => return Err(::Error::Header),
+                            Ok(a) => Some(String::from(a)),
+                        },
+                    };
+                } else if "rev".eq_ignore_ascii_case(link_param_name) {
+                    // Parse relation type: `rev`.
+                    // https://tools.ietf.org/html/rfc5988#section-5.3
+                    if link_header.rev.is_none() {
+                        link_header.rev = match link_param_split.next() {
+                            None => return Err(::Error::Header),
+                            Some("") =>  return Err(::Error::Header),
+                            Some(s) => {
+                                s.trim_matches(|c: char| c == '"' || c.is_whitespace())
+                                    .split(' ')
+                                    .map(|t| t.trim().parse())
+                                    .collect::<Result<Vec<RelationType>, _>>()
+                                    .or_else(|_| return Err(::Error::Header))
+                                    .ok()
+                            },
+                        }
+                    }
+                } else if "hreflang".eq_ignore_ascii_case(link_param_name) {
+                    // Parse target attribute: `hreflang`.
+                    // https://tools.ietf.org/html/rfc5988#section-5.4
+                    let mut v = link_header.href_lang.take().unwrap_or(Vec::new());
+
+                    v.push(
+                        match link_param_split.next() {
+                            None => return Err(::Error::Header),
+                            Some("") =>  return Err(::Error::Header),
+                            Some(s) => match s.trim().parse() {
+                                Err(_) => return Err(::Error::Header),
+                                Ok(t) => t,
+                            },
+                        }
+                    );
+
+                    link_header.href_lang = Some(v);
+                } else if "media".eq_ignore_ascii_case(link_param_name) {
+                    // Parse target attribute: `media`.
+                    // https://tools.ietf.org/html/rfc5988#section-5.4
+                    if link_header.media_desc.is_none() {
+                        link_header.media_desc = match link_param_split.next() {
+                            None => return Err(::Error::Header),
+                            Some("") =>  return Err(::Error::Header),
+                            Some(s) => {
+                                s.trim_matches(|c: char| c == '"' || c.is_whitespace())
+                                    .split(',')
+                                    .map(|t| t.trim().parse())
+                                    .collect::<Result<Vec<MediaDesc>, _>>()
+                                    .or_else(|_| return Err(::Error::Header))
+                                    .ok()
+                            },
+                        };
+                    }
+                } else if "title".eq_ignore_ascii_case(link_param_name) {
+                    // Parse target attribute: `title`.
+                    // https://tools.ietf.org/html/rfc5988#section-5.4
+                    if link_header.title.is_none() {
+                        link_header.title = match link_param_split.next() {
+                            None => return Err(::Error::Header),
+                            Some("") =>  return Err(::Error::Header),
+                            Some(s) => match verify_and_trim(s.trim(), (b'"', b'"')) {
+                                Err(_) => return Err(::Error::Header),
+                                Ok(t) => Some(String::from(t)),
+                            },
+                        };
+                    }
+                } else if "title*".eq_ignore_ascii_case(link_param_name) {
+                    // Parse target attribute: `title*`.
+                    // https://tools.ietf.org/html/rfc5988#section-5.4
+                    //
+                    // Definition of `ext-value`:
+                    //       https://tools.ietf.org/html/rfc5987#section-3.2.1
+                    if link_header.title_star.is_none() {
+                        link_header.title_star = match link_param_split.next() {
+                            None => return Err(::Error::Header),
+                            Some("") =>  return Err(::Error::Header),
+                            Some(s) => Some(String::from(s.trim())),
+                        };
+                    }
+                } else if "type".eq_ignore_ascii_case(link_param_name) {
+                    // Parse target attribute: `type`.
+                    // https://tools.ietf.org/html/rfc5988#section-5.4
+                    if link_header.media_type.is_none() {
+                        link_header.media_type = match link_param_split.next() {
+                            None => return Err(::Error::Header),
+                            Some("") =>  return Err(::Error::Header),
+                            Some(s) => match verify_and_trim(s.trim(), (b'"', b'"')) {
+                                Err(_) => return Err(::Error::Header),
+                                Ok(t) => match t.parse() {
+                                    Err(_) => return Err(::Error::Header),
+                                    Ok(m) => Some(m),
+                                },
+                            },
+
+                        };
+                    }
+                } else {
+                    return Err(::Error::Header);
+                }
+            }
+        }
+
+        Ok(Link::new(link_values))
+    }
+}
+
+impl fmt::Display for MediaDesc {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            MediaDesc::Screen => write!(f, "screen"),
+            MediaDesc::Tty => write!(f, "tty"),
+            MediaDesc::Tv => write!(f, "tv"),
+            MediaDesc::Projection => write!(f, "projection"),
+            MediaDesc::Handheld => write!(f, "handheld"),
+            MediaDesc::Print => write!(f, "print"),
+            MediaDesc::Braille => write!(f, "braille"),
+            MediaDesc::Aural => write!(f, "aural"),
+            MediaDesc::All => write!(f, "all"),
+            MediaDesc::Extension(ref other) => write!(f, "{}", other),
+         }
+    }
+}
+
+impl FromStr for MediaDesc {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<MediaDesc> {
+        match s {
+            "screen" => Ok(MediaDesc::Screen),
+            "tty" => Ok(MediaDesc::Tty),
+            "tv" => Ok(MediaDesc::Tv),
+            "projection" => Ok(MediaDesc::Projection),
+            "handheld" => Ok(MediaDesc::Handheld),
+            "print" => Ok(MediaDesc::Print),
+            "braille" => Ok(MediaDesc::Braille),
+            "aural" => Ok(MediaDesc::Aural),
+            "all" => Ok(MediaDesc::All),
+             _ => Ok(MediaDesc::Extension(String::from(s))),
+        }
+    }
+}
+
+impl fmt::Display for RelationType {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            RelationType::Alternate => write!(f, "alternate"),
+            RelationType::Appendix => write!(f, "appendix"),
+            RelationType::Bookmark => write!(f, "bookmark"),
+            RelationType::Chapter => write!(f, "chapter"),
+            RelationType::Contents => write!(f, "contents"),
+            RelationType::Copyright => write!(f, "copyright"),
+            RelationType::Current => write!(f, "current"),
+            RelationType::DescribedBy => write!(f, "describedby"),
+            RelationType::Edit => write!(f, "edit"),
+            RelationType::EditMedia => write!(f, "edit-media"),
+            RelationType::Enclosure => write!(f, "enclosure"),
+            RelationType::First => write!(f, "first"),
+            RelationType::Glossary => write!(f, "glossary"),
+            RelationType::Help => write!(f, "help"),
+            RelationType::Hub => write!(f, "hub"),
+            RelationType::Index => write!(f, "index"),
+            RelationType::Last => write!(f, "last"),
+            RelationType::LatestVersion => write!(f, "latest-version"),
+            RelationType::License => write!(f, "license"),
+            RelationType::Next => write!(f, "next"),
+            RelationType::NextArchive => write!(f, "next-archive"),
+            RelationType::Payment => write!(f, "payment"),
+            RelationType::Prev => write!(f, "prev"),
+            RelationType::PredecessorVersion => write!(f, "predecessor-version"),
+            RelationType::Previous => write!(f, "previous"),
+            RelationType::PrevArchive => write!(f, "prev-archive"),
+            RelationType::Related => write!(f, "related"),
+            RelationType::Replies => write!(f, "replies"),
+            RelationType::Section => write!(f, "section"),
+            RelationType::RelationTypeSelf => write!(f, "self"),
+            RelationType::Service => write!(f, "service"),
+            RelationType::Start => write!(f, "start"),
+            RelationType::Stylesheet => write!(f, "stylesheet"),
+            RelationType::Subsection => write!(f, "subsection"),
+            RelationType::SuccessorVersion => write!(f, "successor-version"),
+            RelationType::Up => write!(f, "up"),
+            RelationType::VersionHistory => write!(f, "version-history"),
+            RelationType::Via => write!(f, "via"),
+            RelationType::WorkingCopy => write!(f, "working-copy"),
+            RelationType::WorkingCopyOf => write!(f, "working-copy-of"),
+            RelationType::ExtRelType(ref uri) => write!(f, "{}", uri),
+         }
+    }
+}
+
+impl FromStr for RelationType {
+    type Err = ::Error;
+
+    fn from_str(s: &str) -> ::Result<RelationType> {
+        if "alternate".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Alternate)
+        } else if "appendix".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Appendix)
+        } else if "bookmark".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Bookmark)
+        } else if "chapter".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Chapter)
+        } else if "contents".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Contents)
+        } else if "copyright".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Copyright)
+        } else if "current".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Current)
+        } else if "describedby".eq_ignore_ascii_case(s) {
+            Ok(RelationType::DescribedBy)
+        } else if "edit".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Edit)
+        } else if "edit-media".eq_ignore_ascii_case(s) {
+            Ok(RelationType::EditMedia)
+        } else if "enclosure".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Enclosure)
+        } else if "first".eq_ignore_ascii_case(s) {
+            Ok(RelationType::First)
+        } else if "glossary".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Glossary)
+        } else if "help".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Help)
+        } else if "hub".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Hub)
+        } else if "index".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Index)
+        } else if "last".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Last)
+        } else if "latest-version".eq_ignore_ascii_case(s) {
+            Ok(RelationType::LatestVersion)
+        } else if "license".eq_ignore_ascii_case(s) {
+            Ok(RelationType::License)
+        } else if "next".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Next)
+        } else if "next-archive".eq_ignore_ascii_case(s) {
+            Ok(RelationType::NextArchive)
+        } else if "payment".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Payment)
+        } else if "prev".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Prev)
+        } else if "predecessor-version".eq_ignore_ascii_case(s) {
+            Ok(RelationType::PredecessorVersion)
+        } else if "previous".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Previous)
+        } else if "prev-archive".eq_ignore_ascii_case(s) {
+            Ok(RelationType::PrevArchive)
+        } else if "related".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Related)
+        } else if "replies".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Replies)
+        } else if "section".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Section)
+        } else if "self".eq_ignore_ascii_case(s) {
+            Ok(RelationType::RelationTypeSelf)
+        } else if "service".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Service)
+        } else if "start".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Start)
+        } else if "stylesheet".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Stylesheet)
+        } else if "subsection".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Subsection)
+        } else if "successor-version".eq_ignore_ascii_case(s) {
+            Ok(RelationType::SuccessorVersion)
+        } else if "up".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Up)
+        } else if "version-history".eq_ignore_ascii_case(s) {
+            Ok(RelationType::VersionHistory)
+        } else if "via".eq_ignore_ascii_case(s) {
+            Ok(RelationType::Via)
+        } else if "working-copy".eq_ignore_ascii_case(s) {
+            Ok(RelationType::WorkingCopy)
+        } else if "working-copy-of".eq_ignore_ascii_case(s) {
+            Ok(RelationType::WorkingCopyOf)
+        } else {
+            Ok(RelationType::ExtRelType(String::from(s)))
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Utilities
+////////////////////////////////////////////////////////////////////////////////
+
+struct SplitAsciiUnquoted<'a> {
+    src: &'a str,
+    pos: usize,
+    del: &'a str
+}
+
+impl<'a> SplitAsciiUnquoted<'a> {
+    fn new(s: &'a str, d: &'a str) -> SplitAsciiUnquoted<'a> {
+        SplitAsciiUnquoted{
+            src: s,
+            pos: 0,
+            del: d,
+        }
+    }
+}
+
+impl<'a> Iterator for SplitAsciiUnquoted<'a> {
+    type Item = &'a str;
+
+    fn next(&mut self) -> Option<&'a str> {
+        if self.pos < self.src.len() {
+            let prev_pos = self.pos;
+            let mut pos = self.pos;
+
+            let mut in_quotes = false;
+
+            for c in self.src[prev_pos..].as_bytes().iter() {
+                in_quotes ^= *c == b'"';
+
+                // Ignore `c` if we're `in_quotes`.
+                if !in_quotes && self.del.as_bytes().contains(c) {
+                    break;
+                }
+
+                pos += 1;
+            }
+
+            self.pos = pos + 1;
+
+            Some(&self.src[prev_pos..pos])
+        } else {
+            None
+        }
+    }
+}
+
+fn fmt_delimited<T: fmt::Display>(f: &mut fmt::Formatter, p: &[T], d: &str, b: (&str, &str)) -> fmt::Result {
+    if p.len() != 0 {
+        // Write a starting string `b.0` before the first element
+        try!(write!(f, "{}{}", b.0, p[0]));
+
+        for i in &p[1..] {
+            // Write the next element preceded by the delimiter `d`
+            try!(write!(f, "{}{}", d, i));
+        }
+
+        // Write a ending string `b.1` before the first element
+        try!(write!(f, "{}", b.1));
+    }
+
+    Ok(())
+}
+
+fn verify_and_trim(s: &str, b: (u8, u8)) -> ::Result<&str> {
+    let length = s.len();
+    let byte_array = s.as_bytes();
+
+    // Verify that `s` starts with `b.0` and ends with `b.1` and return
+    // the contained substring after triming whitespace.
+    if length > 1 && b.0 == byte_array[0] && b.1 == byte_array[length - 1] {
+        Ok(s.trim_matches(
+            |c: char| c == b.0 as char || c == b.1 as char || c.is_whitespace())
+        )
+    } else {
+        Err(::Error::Header)
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Tests
+////////////////////////////////////////////////////////////////////////////////
+
+#[cfg(test)]
+mod tests {
+    use std::fmt;
+    use std::fmt::Write;
+
+    use super::{Link, LinkValue, MediaDesc, RelationType, SplitAsciiUnquoted};
+    use super::{fmt_delimited, verify_and_trim};
+
+    use header::Header;
+
+    use buffer::BufReader;
+    use mock::MockStream;
+    use http::h1::parse_request;
+
+    use mime::Mime;
+    use mime::TopLevel::Text;
+    use mime::SubLevel::Plain;
+
+    #[test]
+    fn test_link() {
+        let link_value = LinkValue::new("http://example.com/TheBook/chapter2")
+            .push_rel(RelationType::Previous)
+            .push_rev(RelationType::Next)
+            .set_title("previous chapter");
+
+        let link_header = b"<http://example.com/TheBook/chapter2>; \
+            rel=\"previous\"; rev=next; title=\"previous chapter\"";
+
+        let expected_link = Link::new(vec![link_value]);
+
+        let link = Header::parse_header(&vec![link_header.to_vec()]);
+        assert_eq!(link.ok(), Some(expected_link));
+    }
+
+    #[test]
+    fn test_link_multiple_values() {
+        let first_link = LinkValue::new("/TheBook/chapter2")
+            .push_rel(RelationType::Previous)
+            .set_title_star("UTF-8'de'letztes%20Kapitel");
+
+        let second_link = LinkValue::new("/TheBook/chapter4")
+            .push_rel(RelationType::Next)
+            .set_title_star("UTF-8'de'n%c3%a4chstes%20Kapitel");
+
+        let link_header = b"</TheBook/chapter2>; \
+            rel=\"previous\"; title*=UTF-8'de'letztes%20Kapitel, \
+            </TheBook/chapter4>; \
+            rel=\"next\"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel";
+
+        let expected_link = Link::new(vec![first_link, second_link]);
+
+        let link = Header::parse_header(&vec![link_header.to_vec()]);
+        assert_eq!(link.ok(), Some(expected_link));
+    }
+
+    #[test]
+    fn test_link_all_attributes() {
+        let link_value = LinkValue::new("http://example.com/TheBook/chapter2")
+            .push_rel(RelationType::Previous)
+            .set_anchor("../anchor/example/")
+            .push_rev(RelationType::Next)
+            .push_href_lang(langtag!(de))
+            .push_media_desc(MediaDesc::Screen)
+            .set_title("previous chapter")
+            .set_title_star("title* unparsed")
+            .set_media_type(Mime(Text, Plain, vec![]));
+
+        let link_header = b"<http://example.com/TheBook/chapter2>; \
+            rel=\"previous\"; anchor=\"../anchor/example/\"; \
+            rev=\"next\"; hreflang=de; media=\"screen\"; \
+            title=\"previous chapter\"; title*=title* unparsed; \
+            type=\"text/plain\"";
+
+        let expected_link = Link::new(vec![link_value]);
+
+        let link = Header::parse_header(&vec![link_header.to_vec()]);
+        assert_eq!(link.ok(), Some(expected_link));
+    }
+
+    #[test]
+    fn test_link_multiple_link_headers() {
+        let first_link = LinkValue::new("/TheBook/chapter2")
+            .push_rel(RelationType::Previous)
+            .set_title_star("UTF-8'de'letztes%20Kapitel");
+
+        let second_link = LinkValue::new("/TheBook/chapter4")
+            .push_rel(RelationType::Next)
+            .set_title_star("UTF-8'de'n%c3%a4chstes%20Kapitel");
+
+        let third_link = LinkValue::new("http://example.com/TheBook/chapter2")
+            .push_rel(RelationType::Previous)
+            .push_rev(RelationType::Next)
+            .set_title("previous chapter");
+
+        let expected_link = Link::new(vec![first_link, second_link, third_link]);
+
+        let mut raw = MockStream::with_input(b"GET /super_short_uri/and_whatever HTTP/1.1\r\nHost: \
+                                  hyper.rs\r\nAccept: a lot of things\r\nAccept-Charset: \
+                                  utf8\r\nAccept-Encoding: *\r\nLink: </TheBook/chapter2>; \
+                                  rel=\"previous\"; title*=UTF-8'de'letztes%20Kapitel, \
+                                  </TheBook/chapter4>; rel=\"next\"; title*=\
+                                  UTF-8'de'n%c3%a4chstes%20Kapitel\r\n\
+                                  Access-Control-Allow-Credentials: None\r\nLink: \
+                                  <http://example.com/TheBook/chapter2>; \
+                                  rel=\"previous\"; rev=next; title=\"previous chapter\"\
+                                  \r\n\r\n");
+
+        let mut buf = BufReader::new(&mut raw);
+        let res = parse_request(&mut buf).unwrap();
+
+        let link = res.headers.get::<Link>().unwrap();
+
+        assert_eq!(*link, expected_link);
+    }
+
+    #[test]
+    fn test_link_display() {
+        let link_value = LinkValue::new("http://example.com/TheBook/chapter2")
+            .push_rel(RelationType::Previous)
+            .set_anchor("/anchor/example/")
+            .push_rev(RelationType::Next)
+            .push_href_lang(langtag!(de))
+            .push_media_desc(MediaDesc::Screen)
+            .set_title("previous chapter")
+            .set_title_star("title* unparsed")
+            .set_media_type(Mime(Text, Plain, vec![]));
+
+        let link = Link::new(vec![link_value]);
+
+        let mut link_header = String::new();
+        write!(&mut link_header, "{}", link).unwrap();
+
+        let expected_link_header = "<http://example.com/TheBook/chapter2>; \
+            rel=\"previous\"; anchor=\"/anchor/example/\"; \
+            rev=\"next\"; hreflang=de; media=\"screen\"; \
+            title=\"previous chapter\"; title*=title* unparsed; \
+            type=\"text/plain\"";
+
+        assert_eq!(link_header, expected_link_header);
+    }
+
+    #[test]
+    fn test_link_parsing_errors() {
+        let link_a = b"http://example.com/TheBook/chapter2; \
+            rel=\"previous\"; rev=next; title=\"previous chapter\"";
+
+        let mut err: Result<Link, _> = Header::parse_header(&vec![link_a.to_vec()]);
+        assert_eq!(err.is_err(), true);
+
+        let link_b = b"<http://example.com/TheBook/chapter2>; \
+            =\"previous\"; rev=next; title=\"previous chapter\"";
+
+        err = Header::parse_header(&vec![link_b.to_vec()]);
+        assert_eq!(err.is_err(), true);
+
+        let link_c = b"<http://example.com/TheBook/chapter2>; \
+            rel=; rev=next; title=\"previous chapter\"";
+
+        err = Header::parse_header(&vec![link_c.to_vec()]);
+        assert_eq!(err.is_err(), true);
+
+        let link_d = b"<http://example.com/TheBook/chapter2>; \
+            rel=\"previous\"; rev=next; title=";
+
+        err = Header::parse_header(&vec![link_d.to_vec()]);
+        assert_eq!(err.is_err(), true);
+
+        let link_e = b"<http://example.com/TheBook/chapter2>; \
+            rel=\"previous\"; rev=next; attr=unknown";
+
+        err = Header::parse_header(&vec![link_e.to_vec()]);
+        assert_eq!(err.is_err(), true);
+    }
+
+    #[test]
+    fn test_link_split_ascii_unquoted_iterator() {
+        let string = "some, text; \"and, more; in quotes\", or not";
+        let mut string_split = SplitAsciiUnquoted::new(string, ";,");
+
+        assert_eq!(Some("some"), string_split.next());
+        assert_eq!(Some(" text"), string_split.next());
+        assert_eq!(Some(" \"and, more; in quotes\""), string_split.next());
+        assert_eq!(Some(" or not"), string_split.next());
+        assert_eq!(None, string_split.next());
+    }
+
+    #[test]
+    fn test_link_fmt_delimited() {
+        struct TestFormatterStruct<'a> { v: Vec<&'a str> };
+
+        impl<'a> fmt::Display for TestFormatterStruct<'a> {
+            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                fmt_delimited(f, self.v.as_slice(), ", ", (">>", "<<"))
+            }
+        }
+
+        let test_formatter = TestFormatterStruct { v: vec!["first", "second"] };
+
+        let mut string = String::new();
+        write!(&mut string, "{}", test_formatter).unwrap();
+
+        let expected_string = ">>first, second<<";
+
+        assert_eq!(string, expected_string);
+    }
+
+    #[test]
+    fn test_link_verify_and_trim() {
+        let string = verify_and_trim(">  some string   <", (b'>', b'<'));
+        assert_eq!(string.ok(), Some("some string"));
+
+        let err = verify_and_trim(" >  some string   <", (b'>', b'<'));
+        assert_eq!(err.is_err(), true);
+    }
+}
+
+bench_header!(bench_link, Link, { vec![b"<http://example.com/TheBook/chapter2>; rel=\"previous\"; rev=next; title=\"previous chapter\"; type=\"text/html\"; media=\"screen, tty\"".to_vec()] });
--- a/third_party/rust/hyper/src/header/common/mod.rs
+++ b/third_party/rust/hyper/src/header/common/mod.rs
@@ -52,16 +52,17 @@ pub use self::referer::Referer;
 pub use self::referrer_policy::ReferrerPolicy;
 pub use self::server::Server;
 pub use self::set_cookie::SetCookie;
 pub use self::strict_transport_security::StrictTransportSecurity;
 pub use self::transfer_encoding::TransferEncoding;
 pub use self::upgrade::{Upgrade, Protocol, ProtocolName};
 pub use self::user_agent::UserAgent;
 pub use self::vary::Vary;
+pub use self::link::{Link, LinkValue, RelationType, MediaDesc};
 
 #[doc(hidden)]
 #[macro_export]
 macro_rules! bench_header(
     ($name:ident, $ty:ty, $value:expr) => {
         #[cfg(test)]
         #[cfg(feature = "nightly")]
         #[allow(deprecated)]
@@ -386,8 +387,9 @@ mod referer;
 mod referrer_policy;
 mod server;
 mod set_cookie;
 mod strict_transport_security;
 mod transfer_encoding;
 mod upgrade;
 mod user_agent;
 mod vary;
+mod link;
--- a/third_party/rust/hyper/src/header/internals/cell.rs
+++ b/third_party/rust/hyper/src/header/internals/cell.rs
@@ -70,31 +70,31 @@ impl<V: ?Sized + fmt::Debug + Any + 'sta
                 None
             },
             PtrMap::Many(ref hm) => hm.get(&key)
         }.map(|val| &**val)
     }
 
     #[inline]
     pub fn get_mut(&mut self, key: TypeId) -> Option<&mut V> {
-        let mut map = unsafe { &mut *self.0.get() };
+        let map = unsafe { &mut *self.0.get() };
         match *map {
             PtrMap::Empty => None,
             PtrMap::One(id, ref mut v) => if id == key {
                 Some(v)
             } else {
                 None
             },
             PtrMap::Many(ref mut hm) => hm.get_mut(&key)
         }.map(|val| &mut **val)
     }
 
     #[inline]
     pub unsafe fn insert(&self, key: TypeId, val: Box<V>) {
-        let mut map = &mut *self.0.get();
+        let map = &mut *self.0.get();
         match *map {
             PtrMap::Empty => *map = PtrMap::One(key, val),
             PtrMap::One(..) => {
                 let one = mem::replace(map, PtrMap::Empty);
                 match one {
                     PtrMap::One(id, one) => {
                         debug_assert!(id != key);
                         let mut hm = HashMap::with_capacity(2);
--- a/third_party/rust/hyper/src/header/internals/vec_map.rs
+++ b/third_party/rust/hyper/src/header/internals/vec_map.rs
@@ -65,17 +65,17 @@ pub enum Entry<'a, K: 'a, V: 'a> {
 
 pub struct VacantEntry<'a, K: 'a, V: 'a> {
     vec: &'a mut VecMap<K, V>,
     key: K,
 }
 
 impl<'a, K, V> VacantEntry<'a, K, V> {
     pub fn insert(self, val: V) -> &'a mut V {
-        let mut vec = self.vec;
+        let vec = self.vec;
         vec.vec.push((self.key, val));
         let pos = vec.vec.len() - 1;
         &mut vec.vec[pos].1
     }
 }
 
 pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
     vec: &'a mut VecMap<K, V>,
--- a/third_party/rust/hyper/src/header/mod.rs
+++ b/third_party/rust/hyper/src/header/mod.rs
@@ -86,16 +86,17 @@ use std::iter::{FromIterator, IntoIterat
 use std::ops::{Deref, DerefMut};
 use std::{mem, fmt};
 
 use {httparse, traitobject};
 use typeable::Typeable;
 use unicase::UniCase;
 
 use self::internals::{Item, VecMap, Entry};
+use self::sealed::Sealed;
 
 pub use self::shared::*;
 pub use self::common::*;
 
 mod common;
 mod internals;
 mod shared;
 pub mod parsing;
@@ -210,25 +211,39 @@ impl<'a, 'b> fmt::Write for NewlineRepla
         if since < s.len() {
             self.0.write_str(&s[since..])
         } else {
             Ok(())
         }
     }
 }
 
-#[doc(hidden)]
-pub trait HeaderClone {
-    fn clone_box(&self) -> Box<HeaderFormat + Send + Sync>;
-}
+/// Internal implementation detail.
+///
+/// This trait is automatically implemented for all types that implement
+/// `HeaderFormat + Clone`. No methods are exposed, and so is not useful
+/// outside this crate.
+pub trait HeaderClone: Sealed {}
+impl<T: Sealed> HeaderClone for T {}
+
+mod sealed {
+    use super::HeaderFormat;
 
-impl<T: HeaderFormat + Clone> HeaderClone for T {
-    #[inline]
-    fn clone_box(&self) -> Box<HeaderFormat + Send + Sync> {
-        Box::new(self.clone())
+    #[doc(hidden)]
+    pub trait Sealed {
+        #[doc(hidden)]
+        fn clone_box(&self) -> Box<HeaderFormat + Send + Sync>;
+    }
+
+    #[doc(hidden)]
+    impl<T: HeaderFormat + Clone> Sealed for T {
+        #[inline]
+        fn clone_box(&self) -> Box<HeaderFormat + Send + Sync> {
+            Box::new(self.clone())
+        }
     }
 }
 
 impl HeaderFormat + Send + Sync {
     #[inline]
     unsafe fn downcast_ref_unchecked<T: 'static>(&self) -> &T {
         mem::transmute(traitobject::data(self))
     }
@@ -268,17 +283,17 @@ impl Headers {
     }
 
     #[doc(hidden)]
     pub fn from_raw(raw: &[httparse::Header]) -> ::Result<Headers> {
         let mut headers = Headers::new();
         for header in raw {
             trace!("raw header: {:?}={:?}", header.name, &header.value[..]);
             let name = UniCase(CowStr(Cow::Owned(header.name.to_owned())));
-            let mut item = match headers.data.entry(name) {
+            let item = match headers.data.entry(name) {
                 Entry::Vacant(entry) => entry.insert(Item::new_raw(vec![])),
                 Entry::Occupied(entry) => entry.into_mut()
             };
             let trim = header.value.iter().rev().take_while(|&&x| x == b' ').count();
             let value = &header.value[.. header.value.len() - trim];
             item.raw_mut().push(value.to_vec());
         }
         Ok(headers)
@@ -520,38 +535,34 @@ impl<'a> Extend<HeaderView<'a>> for Head
 impl<'a> FromIterator<HeaderView<'a>> for Headers {
     fn from_iter<I: IntoIterator<Item=HeaderView<'a>>>(iter: I) -> Headers {
         let mut headers = Headers::new();
         headers.extend(iter);
         headers
     }
 }
 
-deprecated! {
-    #[deprecated(note="The semantics of formatting a HeaderFormat directly are not clear")]
-    impl<'a> fmt::Display for &'a (HeaderFormat + Send + Sync) {
-        #[inline]
-        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-            let mut multi = MultilineFormatter(Multi::Join(true, f));
-            self.fmt_multi_header(&mut multi)
-        }
+#[deprecated(note="The semantics of formatting a HeaderFormat directly are not clear")]
+impl<'a> fmt::Display for &'a (HeaderFormat + Send + Sync) {
+    #[inline]
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let mut multi = MultilineFormatter(Multi::Join(true, f));
+        self.fmt_multi_header(&mut multi)
     }
 }
 
 /// A wrapper around any Header with a Display impl that calls fmt_header.
 ///
 /// This can be used like so: `format!("{}", HeaderFormatter(&header))` to
 /// get the 'value string' representation of this Header.
 ///
 /// Note: This may not necessarily be the value written to stream, such
 /// as with the SetCookie header.
-deprecated! {
-    #[deprecated(note="The semantics of formatting a HeaderFormat directly are not clear")]
-    pub struct HeaderFormatter<'a, H: HeaderFormat>(pub &'a H);
-}
+#[deprecated(note="The semantics of formatting a HeaderFormat directly are not clear")]
+pub struct HeaderFormatter<'a, H: HeaderFormat>(pub &'a H);
 
 #[allow(deprecated)]
 impl<'a, H: HeaderFormat> fmt::Display for HeaderFormatter<'a, H> {
     #[inline]
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let mut multi = MultilineFormatter(Multi::Join(true, f));
         self.0.fmt_multi_header(&mut multi)
     }
--- a/third_party/rust/hyper/src/http/h1.rs
+++ b/third_party/rust/hyper/src/http/h1.rs
@@ -878,25 +878,27 @@ fn parse<R: Read, T: TryParse<Subject=I>
     loop {
         match try!(try_parse::<R, T, I>(rdr)) {
             httparse::Status::Complete((inc, len)) => {
                 rdr.consume(len);
                 return Ok(inc);
             },
             _partial => ()
         }
-        match try!(rdr.read_into_buf()) {
-            0 if rdr.get_buf().is_empty() => {
+        let n = try!(rdr.read_into_buf());
+        if n == 0 {
+            let buffered = rdr.get_buf().len();
+            if buffered == ::buffer::MAX_BUFFER_SIZE {
+                return Err(Error::TooLarge);
+            } else {
                 return Err(Error::Io(io::Error::new(
-                    io::ErrorKind::ConnectionAborted,
-                    "Connection closed"
-                )))
-            },
-            0 => return Err(Error::TooLarge),
-            _ => ()
+                    io::ErrorKind::UnexpectedEof,
+                    "end of stream before headers finished"
+                )));
+            }
         }
     }
 }
 
 fn try_parse<R: Read, T: TryParse<Subject=I>, I>(rdr: &mut BufReader<R>) -> TryParseResult<I> {
     let mut headers = [httparse::EMPTY_HEADER; MAX_HEADERS];
     let buf = rdr.get_buf();
     if buf.len() == 0 {
@@ -1151,17 +1153,17 @@ mod tests {
     #[test]
     fn test_parse_tcp_closed() {
         use std::io::ErrorKind;
         use error::Error;
 
         let mut empty = MockStream::new();
         let mut buf = BufReader::new(&mut empty);
         match parse_request(&mut buf) {
-            Err(Error::Io(ref e)) if e.kind() == ErrorKind::ConnectionAborted => (),
+            Err(Error::Io(ref e)) if e.kind() == ErrorKind::UnexpectedEof => (),
             other => panic!("unexpected result: {:?}", other)
         }
     }
 
     #[cfg(feature = "nightly")]
     use test::Bencher;
 
     #[cfg(feature = "nightly")]
--- a/third_party/rust/hyper/src/lib.rs
+++ b/third_party/rust/hyper/src/lib.rs
@@ -1,9 +1,9 @@
-#![doc(html_root_url = "https://hyper.rs/hyper/v0.10.10/hyper")]
+#![doc(html_root_url = "https://docs.rs/hyper/v0.10.13")]
 #![cfg_attr(test, deny(missing_docs))]
 #![cfg_attr(test, deny(warnings))]
 #![cfg_attr(all(test, feature = "nightly"), feature(test))]
 
 //! # Hyper
 //!
 //! Hyper is a fast, modern HTTP implementation written in and for Rust. It
 //! is a low-level typesafe abstraction over raw HTTP, providing an elegant
@@ -159,31 +159,16 @@ pub use server::Server;
 pub use language_tags::LanguageTag;
 
 macro_rules! todo(
     ($($arg:tt)*) => (if cfg!(not(ndebug)) {
         trace!("TODO: {:?}", format_args!($($arg)*))
     })
 );
 
-macro_rules! inspect(
-    ($name:expr, $value:expr) => ({
-        let v = $value;
-        trace!("inspect: {:?} = {:?}", $name, v);
-        v
-    })
-);
-
-macro_rules! deprecated {
-    (#[$note:meta] $i:item) => (
-        #[cfg_attr(has_deprecated, $note)]
-        $i
-    );
-}
-
 #[cfg(test)]
 #[macro_use]
 mod mock;
 #[doc(hidden)]
 pub mod buffer;
 pub mod client;
 pub mod error;
 pub mod method;
@@ -195,21 +180,23 @@ pub mod status;
 pub mod uri;
 pub mod version;
 
 /// Re-exporting the mime crate, for convenience.
 pub mod mime {
     pub use mime_crate::*;
 }
 
-#[allow(unconditional_recursion)]
-fn _assert_send<T: Send>() {
+
+fn _assert_types() {
+    fn _assert_send<T: Send>() {}
+    fn _assert_sync<T: Sync>() {}
+
     _assert_send::<Client>();
     _assert_send::<client::Request<net::Fresh>>();
     _assert_send::<client::Response>();
     _assert_send::<error::Error>();
-}
+    _assert_send::<::client::pool::Pool<::net::DefaultConnector>>();
 
-#[allow(unconditional_recursion)]
-fn _assert_sync<T: Sync>() {
     _assert_sync::<Client>();
     _assert_sync::<error::Error>();
+    _assert_sync::<::client::pool::Pool<::net::DefaultConnector>>();
 }
--- a/third_party/rust/hyper/src/mock.rs
+++ b/third_party/rust/hyper/src/mock.rs
@@ -10,16 +10,17 @@ pub struct MockStream {
     pub read: Cursor<Vec<u8>>,
     next_reads: Vec<Vec<u8>>,
     pub write: Vec<u8>,
     pub is_closed: bool,
     pub error_on_write: bool,
     pub error_on_read: bool,
     pub read_timeout: Cell<Option<Duration>>,
     pub write_timeout: Cell<Option<Duration>>,
+    pub id: u64,
 }
 
 impl PartialEq for MockStream {
     fn eq(&self, other: &MockStream) -> bool {
         self.read.get_ref() == other.read.get_ref() && self.write == other.write
     }
 }
 
@@ -37,16 +38,17 @@ impl MockStream {
             read: Cursor::new(responses.remove(0).to_vec()),
             next_reads: responses.into_iter().map(|arr| arr.to_vec()).collect(),
             write: vec![],
             is_closed: false,
             error_on_write: false,
             error_on_read: false,
             read_timeout: Cell::new(None),
             write_timeout: Cell::new(None),
+            id: 0,
         }
     }
 }
 
 impl Read for MockStream {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         if self.error_on_read {
             Err(io::Error::new(io::ErrorKind::Other, "mock error"))
--- a/third_party/rust/hyper/src/server/listener.rs
+++ b/third_party/rust/hyper/src/server/listener.rs
@@ -44,17 +44,17 @@ where A: NetworkListener + Send + 'stati
       F: Fn(<A as NetworkListener>::Stream) + Send + Sync + 'static {
     thread::spawn(move || {
         let _sentinel = Sentinel::new(supervisor, ());
 
         loop {
             match acceptor.accept() {
                 Ok(stream) => work(stream),
                 Err(e) => {
-                    error!("Connection failed: {}", e);
+                    info!("Connection failed: {}", e);
                 }
             }
         }
     });
 }
 
 struct Sentinel<T: Send + 'static> {
     value: Option<T>,
--- a/third_party/rust/hyper/src/server/mod.rs
+++ b/third_party/rust/hyper/src/server/mod.rs
@@ -157,25 +157,16 @@ impl Default for Timeouts {
     fn default() -> Timeouts {
         Timeouts {
             read: None,
             keep_alive: Some(Duration::from_secs(5))
         }
     }
 }
 
-macro_rules! try_option(
-    ($e:expr) => {{
-        match $e {
-            Some(v) => v,
-            None => return None
-        }
-    }}
-);
-
 impl<L: NetworkListener> Server<L> {
     /// Creates a new server with the provided handler.
     #[inline]
     pub fn new(listener: L) -> Server<L> {
         Server {
             listener: listener,
             timeouts: Timeouts::default()
         }
@@ -266,75 +257,75 @@ struct Worker<H: Handler + 'static> {
 impl<H: Handler + 'static> Worker<H> {
     fn new(handler: H, timeouts: Timeouts) -> Worker<H> {
         Worker {
             handler: handler,
             timeouts: timeouts,
         }
     }
 
-    fn handle_connection<S>(&self, mut stream: &mut S) where S: NetworkStream + Clone {
+    fn handle_connection<S>(&self, stream: &mut S) where S: NetworkStream + Clone {
         debug!("Incoming stream");
 
         self.handler.on_connection_start();
 
         let addr = match stream.peer_addr() {
             Ok(addr) => addr,
             Err(e) => {
-                error!("Peer Name error: {:?}", e);
+                info!("Peer Name error: {:?}", e);
                 return;
             }
         };
 
         // FIXME: Use Type ascription
         let stream_clone: &mut NetworkStream = &mut stream.clone();
         let mut rdr = BufReader::new(stream_clone);
         let mut wrt = BufWriter::new(stream);
 
         while self.keep_alive_loop(&mut rdr, &mut wrt, addr) {
             if let Err(e) = self.set_read_timeout(*rdr.get_ref(), self.timeouts.keep_alive) {
-                error!("set_read_timeout keep_alive {:?}", e);
+                info!("set_read_timeout keep_alive {:?}", e);
                 break;
             }
         }
 
         self.handler.on_connection_end();
 
         debug!("keep_alive loop ending for {}", addr);
     }
 
     fn set_read_timeout(&self, s: &NetworkStream, timeout: Option<Duration>) -> io::Result<()> {
         s.set_read_timeout(timeout)
     }
 
-    fn keep_alive_loop<W: Write>(&self, mut rdr: &mut BufReader<&mut NetworkStream>,
+    fn keep_alive_loop<W: Write>(&self, rdr: &mut BufReader<&mut NetworkStream>,
             wrt: &mut W, addr: SocketAddr) -> bool {
         let req = match Request::new(rdr, addr) {
             Ok(req) => req,
             Err(Error::Io(ref e)) if e.kind() == ErrorKind::ConnectionAborted => {
                 trace!("tcp closed, cancelling keep-alive loop");
                 return false;
             }
             Err(Error::Io(e)) => {
                 debug!("ioerror in keepalive loop = {:?}", e);
                 return false;
             }
             Err(e) => {
                 //TODO: send a 400 response
-                error!("request error = {:?}", e);
+                info!("request error = {:?}", e);
                 return false;
             }
         };
 
         if !self.handle_expect(&req, wrt) {
             return false;
         }
 
         if let Err(e) = req.set_read_timeout(self.timeouts.read) {
-            error!("set_read_timeout {:?}", e);
+            info!("set_read_timeout {:?}", e);
             return false;
         }
 
         let mut keep_alive = self.timeouts.keep_alive.is_some() &&
             http::should_keep_alive(req.version, &req.headers);
         let version = req.version;
         let mut res_headers = Headers::new();
         if !keep_alive {
@@ -357,17 +348,17 @@ impl<H: Handler + 'static> Worker<H> {
     }
 
     fn handle_expect<W: Write>(&self, req: &Request, wrt: &mut W) -> bool {
          if req.version == Http11 && req.headers.get() == Some(&Expect::Continue) {
             let status = self.handler.check_continue((&req.method, &req.uri, &req.headers));
             match write!(wrt, "{} {}\r\n\r\n", Http11, status).and_then(|_| wrt.flush()) {
                 Ok(..) => (),
                 Err(e) => {
-                    error!("error writing 100-continue: {:?}", e);
+                    info!("error writing 100-continue: {:?}", e);
                     return false;
                 }
             }
 
             if status != StatusCode::Continue {
                 debug!("non-100 status ({}) for Expect 100 request", status);
                 return false;
             }
--- a/third_party/rust/hyper/src/server/request.rs
+++ b/third_party/rust/hyper/src/server/request.rs
@@ -29,17 +29,17 @@ pub struct Request<'a, 'b: 'a> {
     pub version: HttpVersion,
     body: HttpReader<&'a mut BufReader<&'b mut NetworkStream>>
 }
 
 
 impl<'a, 'b: 'a> Request<'a, 'b> {
     /// Create a new Request, reading the StartLine and Headers so they are
     /// immediately useful.
-    pub fn new(mut stream: &'a mut BufReader<&'b mut NetworkStream>, addr: SocketAddr)
+    pub fn new(stream: &'a mut BufReader<&'b mut NetworkStream>, addr: SocketAddr)
         -> ::Result<Request<'a, 'b>> {
 
         let Incoming { version, subject: (method, uri), headers } = try!(h1::parse_request(stream));
         debug!("Request Line: {:?} {:?} {:?}", method, uri, version);
         debug!("{:?}", headers);
 
         let body = if headers.has::<ContentLength>() {
             match headers.get::<ContentLength>() {
--- a/third_party/rust/hyper/src/server/response.rs
+++ b/third_party/rust/hyper/src/server/response.rs
@@ -161,17 +161,17 @@ impl<'a> Response<'a, Fresh> {
     /// fn handler(mut res: Response) {
     ///     let body = b"Hello World!";
     ///     res.headers_mut().set(ContentLength(body.len() as u64));
     ///     let mut res = res.start().unwrap();
     ///     res.write_all(body).unwrap();
     /// }
     /// ```
     #[inline]
-    pub fn send(mut self, body: &[u8]) -> io::Result<()> {
+    pub fn send(self, body: &[u8]) -> io::Result<()> {
         self.headers.set(header::ContentLength(body.len() as u64));
         let mut stream = try!(self.start());
         try!(stream.write_all(body));
         stream.end()
     }
 
     /// Consume this Response<Fresh>, writing the Headers and Status and
     /// creating a Response<Streaming>
--- a/third_party/rust/hyper/src/uri.rs
+++ b/third_party/rust/hyper/src/uri.rs
@@ -50,17 +50,17 @@ pub enum RequestUri {
     Star,
 }
 
 impl FromStr for RequestUri {
     type Err = Error;
 
     fn from_str(s: &str) -> Result<RequestUri, Error> {
         let bytes = s.as_bytes();
-        if bytes == [] {
+        if bytes.is_empty() {
             Err(Error::Uri(UrlError::RelativeUrlWithoutBase))
         } else if bytes == b"*" {
             Ok(RequestUri::Star)
         } else if bytes.starts_with(b"/") {
             Ok(RequestUri::AbsolutePath(s.to_owned()))
         } else if bytes.contains(&b'/') {
             Ok(RequestUri::AbsoluteUri(try!(Url::parse(s))))
         } else {
--- a/third_party/rust/hyper/src/version.rs
+++ b/third_party/rust/hyper/src/version.rs
@@ -1,31 +1,53 @@
 //! HTTP Versions enum
 //!
 //! Instead of relying on typo-prone Strings, use expected HTTP versions as
 //! the `HttpVersion` enum.
 use std::fmt;
+use std::str::FromStr;
 
+use error::Error;
 use self::HttpVersion::{Http09, Http10, Http11, Http20};
 
 /// Represents a version of the HTTP spec.
 #[derive(PartialEq, PartialOrd, Copy, Clone, Eq, Ord, Hash, Debug)]
 pub enum HttpVersion {
     /// `HTTP/0.9`
     Http09,
     /// `HTTP/1.0`
     Http10,
     /// `HTTP/1.1`
     Http11,
     /// `HTTP/2.0`
-    Http20
+    Http20,
 }
 
 impl fmt::Display for HttpVersion {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        fmt.write_str(match *self {
+        fmt.write_str(self.as_ref())
+    }
+}
+
+impl AsRef<str> for HttpVersion {
+    fn as_ref(&self) -> &str {
+        match *self {
             Http09 => "HTTP/0.9",
             Http10 => "HTTP/1.0",
             Http11 => "HTTP/1.1",
             Http20 => "HTTP/2.0",
-        })
+        }
     }
 }
+
+impl FromStr for HttpVersion {
+    type Err = Error;
+
+    fn from_str(s: &str) -> Result<Self, Self::Err> {
+        match s {
+            "HTTP/0.9" => Ok(Http09),
+            "HTTP/1.0" => Ok(Http10),
+            "HTTP/1.1" => Ok(Http11),
+            "HTTP/2.0" => Ok(Http20),
+            _ => Err(Error::Version),
+        }
+    }
+}
copy from third_party/rust/libc/.cargo-checksum.json
copy to third_party/rust/libc-0.2.24/.cargo-checksum.json
copy from third_party/rust/libc/.travis.yml
copy to third_party/rust/libc-0.2.24/.travis.yml
copy from third_party/rust/libc/Cargo.toml
copy to third_party/rust/libc-0.2.24/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
copy from third_party/rust/libc/README.md
copy to third_party/rust/libc-0.2.24/README.md
copy from third_party/rust/libc/appveyor.yml
copy to third_party/rust/libc-0.2.24/appveyor.yml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/README.md
@@ -0,0 +1,203 @@
+The goal of the libc crate is to have CI running everywhere to have the
+strongest guarantees about the definitions that this library contains, and as a
+result the CI is pretty complicated and also pretty large! Hopefully this can
+serve as a guide through the sea of scripts in this directory and elsewhere in
+this project.
+
+# Files
+
+First up, let's talk about the files in this directory:
+
+* `run-travis.sh` - a shell script run by all Travis builders, this is
+  responsible for setting up the rest of the environment such as installing new
+  packages, downloading Rust target libraries, etc.
+
+* `run.sh` - the actual script which runs tests for a particular architecture.
+  Called from the `run-travis.sh` script this will run all tests for the target
+  specified.
+
+* `cargo-config` - Cargo configuration of linkers to use copied into place by
+  the `run-travis.sh` script before builds are run.
+
+* `dox.sh` - script called from `run-travis.sh` on only the linux 64-bit nightly
+  Travis bots to build documentation for this crate.
+
+* `landing-page-*.html` - used by `dox.sh` to generate a landing page for all
+  architectures' documentation.
+
+* `run-qemu.sh` - see discussion about QEMU below
+
+* `mips`, `rumprun` - instructions to build the docker image for each respective
+  CI target
+
+# CI Systems
+
+Currently this repository leverages a combination of Travis CI and AppVeyor for
+running tests. The triples tested are:
+
+* AppVeyor
+  * `{i686,x86_64}-pc-windows-{msvc,gnu}`
+* Travis
+  * `{i686,x86_64,mips,aarch64}-unknown-linux-gnu`
+  * `x86_64-unknown-linux-musl`
+  * `arm-unknown-linux-gnueabihf`
+  * `arm-linux-androideabi`
+  * `{i686,x86_64}-apple-{darwin,ios}`
+  * `x86_64-rumprun-netbsd`
+  * `x86_64-unknown-freebsd`
+  * `x86_64-unknown-openbsd`
+
+The Windows triples are all pretty standard, they just set up their environment
+then run tests, no need for downloading any extra target libs (we just download
+the right installer). The Intel Linux/OSX builds are similar in that we just
+download the right target libs and run tests. Note that the Intel Linux/OSX
+builds are run on stable/beta/nightly, but are the only ones that do so.
+
+The remaining architectures look like:
+
+* Android runs in a [docker image][android-docker] with an emulator, the NDK,
+  and the SDK already set up. The entire build happens within the docker image.
+* The MIPS, ARM, and AArch64 builds all use the QEMU userspace emulator to run
+  the generated binary to actually verify the tests pass.
+* The MUSL build just has to download a MUSL compiler and target libraries and
+  then otherwise runs tests normally.
+* iOS builds need an extra linker flag currently, but beyond that they're built
+  as standard as everything else.
+* The rumprun target builds an entire kernel from the test suite and then runs
+  it inside QEMU using the serial console to test whether it succeeded or
+  failed.
+* The BSD builds, currently OpenBSD and FreeBSD, use QEMU to boot up a system
+  and compile/run tests. More information on that below.
+
+[android-docker]: https://github.com/rust-lang/rust-buildbot/blob/master/slaves/android/Dockerfile
+
+## QEMU
+
+Lots of the architectures tested here use QEMU in the tests, so it's worth going
+over all the crazy capabilities QEMU has and the various flavors in which we use
+it!
+
+First up, QEMU has userspace emulation where it doesn't boot a full kernel, it
+just runs a binary from another architecture (using the `qemu-<arch>` wrappers).
+We provide it the runtime path for the dynamically loaded system libraries,
+however. This strategy is used for all Linux architectures that aren't intel.
+Note that one downside of this QEMU system is that threads are barely
+implemented, so we're careful to not spawn many threads.
+
+For the rumprun target the only output is a kernel image, so we just use that
+plus the `rumpbake` command to create a full kernel image which is then run from
+within QEMU.
+
+Finally, the fun part, the BSDs. Quite a few hoops are jumped through to get CI
+working for these platforms, but the gist of it looks like:
+
+* Cross compiling from Linux to any of the BSDs seems to be quite non-standard.
+  We may be able to get it working but it might be difficult at that point to
+  ensure that the libc definitions align with what you'd get on the BSD itself.
+  As a result, we try to do compiles within the BSD distro.
+* On Travis we can't run a VM-in-a-VM, so we resort to userspace emulation
+  (QEMU).
+* Unfortunately on Travis we also can't use KVM, so the emulation is super slow.
+
+With all that in mind, the way BSD is tested looks like:
+
+1. Download a pre-prepared image for the OS being tested.
+2. Generate the tests for the OS being tested. This involves running the `ctest`
+   library over libc to generate a Rust file and a C file which will then be
+   compiled into the final test.
+3. Generate a disk image which will later be mounted by the OS being tested.
+   This image is mostly just the libc directory, but some modifications are made
+   to compile the generated files from step 2.
+4. The kernel is booted in QEMU, and it is configured to detect the libc-test
+   image being available, run the test script, and then shut down afterwards.
+5. Look for whether the tests passed in the serial console output of the kernel.
+
+There's some pretty specific instructions for setting up each image (detailed
+below), but the main gist of this is that we must avoid a vanilla `cargo run`
+inside of the `libc-test` directory (which is what it's intended for) because
+that would compile `syntex_syntax`, a large library, with userspace emulation.
+This invariably times out on Travis, so we can't do that.
+
+Once all those hoops are jumped through, however, we can be happy that we're
+testing almost everything!
+
+Below are some details of how to set up the initial OS images which are
+downloaded. Each image must be enabled have input/output over the serial
+console, log in automatically at the serial console, detect if a second drive in
+QEMU is available, and if so mount it, run a script (it'll specifically be
+`run-qemu.sh` in this folder which is copied into the generated image talked
+about above), and then shut down.
+
+### QEMU setup - FreeBSD
+
+1. Download CD installer (most minimal is fine)
+2. `qemu-img create -f qcow2 foo.qcow2 2G`
+3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user`
+4. run installer
+5. `echo 'console="comconsole"' >> /boot/loader.conf`
+6. `echo 'autoboot_delay="0"' >> /boot/loader.conf`
+7. look at /etc/ttys, see what getty argument is for ttyu0
+8. edit /etc/gettytab, look for ttyu0 argument, prepend `:al=root` to line
+   beneath
+
+(note that the current image has a `freebsd` user, but this isn't really
+necessary)
+
+Once that's done, arrange for this script to run at login:
+
+```
+#!/bin/sh
+
+sudo kldload ext2fs
+[ -e /dev/vtbd1 ] || exit 0
+sudo mount -t ext2fs /dev/vtbd1 /mnt
+sh /mnt/run.sh /mnt
+sudo poweroff
+```
+
+Helpful links
+
+* https://en.wikibooks.org/wiki/QEMU/Images
+* https://blog.nekoconeko.nl/blog/2015/06/04/creating-an-openstack-freebsd-image.html
+* https://www.freebsd.org/doc/handbook/serialconsole-setup.html
+
+
+### QEMU setup - OpenBSD
+
+1. Download CD installer
+2. `qemu-img create -f qcow2 foo.qcow2 2G`
+3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user`
+4. run installer
+5. `echo 'set tty com0' >> /etc/boot.conf`
+6. `echo 'boot' >> /etc/boot.conf`
+7. Modify /etc/ttys, change the `tty00` at the end from 'unknown off' to
+   'vt220 on secure'
+8. Modify same line in /etc/ttys to have `"/root/foo.sh"` as the shell
+9. Add this script to `/root/foo.sh`
+
+```
+#!/bin/sh
+exec 1>/dev/tty00
+exec 2>&1
+
+if mount -t ext2fs /dev/sd1c /mnt; then
+  sh /mnt/run.sh /mnt
+  shutdown -ph now
+fi
+
+# limited shell...
+exec /bin/sh < /dev/tty00
+```
+
+10. `chmod +x /root/foo.sh`
+
+Helpful links:
+
+* https://en.wikibooks.org/wiki/QEMU/Images
+* http://www.openbsd.org/faq/faq7.html#SerCon
+
+# Questions?
+
+Hopefully that's at least somewhat of an introduction to everything going on
+here, and feel free to ping @alexcrichton with questions!
+
new file mode 100755
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/android-accept-licenses.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/expect -f
+# ignore-license
+
+set timeout 1800
+set cmd [lindex $argv 0]
+set licenses [lindex $argv 1]
+
+spawn {*}$cmd
+expect {
+  "Do you accept the license '*'*" {
+        exp_send "y\r"
+        exp_continue
+  }
+  eof
+}
copy from third_party/rust/libc/ci/android-install-ndk.sh
copy to third_party/rust/libc-0.2.24/ci/android-install-ndk.sh
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/android-install-sdk.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+# Prep the SDK and emulator
+#
+# Note that the update process requires that we accept a bunch of licenses, and
+# we can't just pipe `yes` into it for some reason, so we take the same strategy
+# located in https://github.com/appunite/docker by just wrapping it in a script
+# which apparently magically accepts the licenses.
+
+mkdir sdk
+curl https://dl.google.com/android/repository/tools_r25.2.5-linux.zip -O
+unzip -d sdk tools_r25.2.5-linux.zip
+
+filter="platform-tools,android-24"
+
+case "$1" in
+  arm | armv7)
+    abi=armeabi-v7a
+    ;;
+
+  aarch64)
+    abi=arm64-v8a
+    ;;
+
+  i686)
+    abi=x86
+    ;;
+
+  x86_64)
+    abi=x86_64
+    ;;
+
+  *)
+    echo "invalid arch: $1"
+    exit 1
+    ;;
+esac;
+
+filter="$filter,sys-img-$abi-android-24"
+
+./android-accept-licenses.sh "android - update sdk -a --no-ui --filter $filter"
+
+echo "no" | android create avd \
+                --name $1 \
+                --target android-24 \
+                --abi $abi
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/android-sysimage.sh
@@ -0,0 +1,52 @@
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+URL=https://dl.google.com/android/repository/sys-img/android
+
+main() {
+    local arch=$1
+    local name=$2
+    local dest=/system
+    local td=$(mktemp -d)
+
+    apt-get install --no-install-recommends e2tools
+
+    pushd $td
+    curl -O $URL/$name
+    unzip -q $name
+
+    local system=$(find . -name system.img)
+    mkdir -p $dest/{bin,lib,lib64}
+
+    # Extract android linker and libraries to /system
+    # This allows android executables to be run directly (or with qemu)
+    if [ $arch = "x86_64" -o $arch = "arm64" ]; then
+        e2cp -p $system:/bin/linker64 $dest/bin/
+        e2cp -p $system:/lib64/libdl.so $dest/lib64/
+        e2cp -p $system:/lib64/libc.so $dest/lib64/
+        e2cp -p $system:/lib64/libm.so $dest/lib64/
+    else
+        e2cp -p $system:/bin/linker $dest/bin/
+        e2cp -p $system:/lib/libdl.so $dest/lib/
+        e2cp -p $system:/lib/libc.so $dest/lib/
+        e2cp -p $system:/lib/libm.so $dest/lib/
+    fi
+
+    # clean up
+    apt-get purge --auto-remove -y e2tools
+
+    popd
+
+    rm -rf $td
+}
+
+main "${@}"
copy from third_party/rust/libc/ci/docker/aarch64-linux-android/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/aarch64-linux-android/Dockerfile
copy from third_party/rust/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
copy from third_party/rust/libc/ci/docker/arm-linux-androideabi/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/arm-linux-androideabi/Dockerfile
copy from third_party/rust/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
copy from third_party/rust/libc/ci/docker/i686-linux-android/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/i686-linux-android/Dockerfile
copy from third_party/rust/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/i686-unknown-linux-gnu/Dockerfile
copy from third_party/rust/libc/ci/docker/i686-unknown-linux-musl/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/i686-unknown-linux-musl/Dockerfile
copy from third_party/rust/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/mips-unknown-linux-gnu/Dockerfile
copy from third_party/rust/libc/ci/docker/mips-unknown-linux-musl/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/mips-unknown-linux-musl/Dockerfile
copy from third_party/rust/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
copy from third_party/rust/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/mipsel-unknown-linux-musl/Dockerfile
copy from third_party/rust/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
copy from third_party/rust/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
copy from third_party/rust/libc/ci/docker/x86_64-linux-android/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/x86_64-linux-android/Dockerfile
copy from third_party/rust/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/x86_64-rumprun-netbsd/Dockerfile
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/docker/x86_64-unknown-freebsd/Dockerfile
@@ -0,0 +1,13 @@
+FROM alexcrichton/rust-slave-linux-cross:2016-04-15
+USER root
+
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends \
+  qemu genext2fs
+
+ENTRYPOINT ["sh"]
+
+ENV PATH=$PATH:/rust/bin \
+    QEMU=2016-11-06/freebsd.qcow2.gz \
+    CAN_CROSS=1 \
+    CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc
copy from third_party/rust/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
copy from third_party/rust/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile
copy to third_party/rust/libc-0.2.24/ci/docker/x86_64-unknown-linux-musl/Dockerfile
rename from third_party/rust/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile
rename to third_party/rust/libc-0.2.24/ci/docker/x86_64-unknown-openbsd/Dockerfile
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/dox.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# Builds documentation for all target triples that we have a registered URL for
+# in liblibc. This scrapes the list of triples to document from `src/lib.rs`
+# which has a bunch of `html_root_url` directives we pick up.
+
+set -e
+
+TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'`
+
+rm -rf target/doc
+mkdir -p target/doc
+
+cp ci/landing-page-head.html target/doc/index.html
+
+for target in $TARGETS; do
+  echo documenting $target
+
+  rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \
+    --crate-name libc
+
+  echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \
+    >> target/doc/index.html
+done
+
+cat ci/landing-page-footer.html >> target/doc/index.html
+
+# If we're on travis, not a PR, and on the right branch, publish!
+if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
+  pip install ghp_import --install-option="--prefix=$HOME/.local"
+  $HOME/.local/bin/ghp-import -n target/doc
+  git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
+fi
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/ios/deploy_and_run_on_ios_simulator.rs
@@ -0,0 +1,171 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This is a script to deploy and execute a binary on an iOS simulator.
+// The primary use of this is to be able to run unit tests on the simulator and
+// retrieve the results.
+//
+// To do this through Cargo instead, use Dinghy
+// (https://github.com/snipsco/dinghy): cargo dinghy install, then cargo dinghy
+// test.
+
+use std::env;
+use std::fs::{self, File};
+use std::io::Write;
+use std::path::Path;
+use std::process;
+use std::process::Command;
+
+macro_rules! t {
+    ($e:expr) => (match $e {
+        Ok(e) => e,
+        Err(e) => panic!("{} failed with: {}", stringify!($e), e),
+    })
+}
+
+// Step one: Wrap as an app
+fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) {
+    println!("Packaging simulator app");
+    drop(fs::remove_dir_all("ios_simulator_app"));
+    t!(fs::create_dir("ios_simulator_app"));
+    t!(fs::copy(test_binary_path,
+                Path::new("ios_simulator_app").join(crate_name)));
+
+    let mut f = t!(File::create("ios_simulator_app/Info.plist"));
+    t!(f.write_all(format!(r#"
+        <?xml version="1.0" encoding="UTF-8"?>
+        <!DOCTYPE plist PUBLIC
+                "-//Apple//DTD PLIST 1.0//EN"
+                "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+        <plist version="1.0">
+            <dict>
+                <key>CFBundleExecutable</key>
+                <string>{}</string>
+                <key>CFBundleIdentifier</key>
+                <string>com.rust.unittests</string>
+            </dict>
+        </plist>
+    "#, crate_name).as_bytes()));
+}
+
+// Step two: Start the iOS simulator
+fn start_simulator() {
+    println!("Looking for iOS simulator");
+    let output = t!(Command::new("xcrun").arg("simctl").arg("list").output());
+    assert!(output.status.success());
+    let mut simulator_exists = false;
+    let mut simulator_booted = false;
+    let mut found_rust_sim = false;
+    let stdout = t!(String::from_utf8(output.stdout));
+    for line in stdout.lines() {
+        if line.contains("rust_ios") {
+            if found_rust_sim {
+                panic!("Duplicate rust_ios simulators found. Please \
+                        double-check xcrun simctl list.");
+            }
+            simulator_exists = true;
+            simulator_booted = line.contains("(Booted)");
+            found_rust_sim = true;
+        }
+    }
+
+    if simulator_exists == false {
+        println!("Creating iOS simulator");
+        Command::new("xcrun")
+                .arg("simctl")
+                .arg("create")
+                .arg("rust_ios")
+                .arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE")
+                .arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2")
+                .check_status();
+    } else if simulator_booted == true {
+        println!("Shutting down already-booted simulator");
+        Command::new("xcrun")
+                .arg("simctl")
+                .arg("shutdown")
+                .arg("rust_ios")
+                .check_status();
+    }
+
+    println!("Starting iOS simulator");
+    // We can't uninstall the app (if present) as that will hang if the
+    // simulator isn't completely booted; just erase the simulator instead.
+    Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status();
+    Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status();
+}
+
+// Step three: Install the app
+fn install_app_to_simulator() {
+    println!("Installing app to simulator");
+    Command::new("xcrun")
+            .arg("simctl")
+            .arg("install")
+            .arg("booted")
+            .arg("ios_simulator_app/")
+            .check_status();
+}
+
+// Step four: Run the app
+fn run_app_on_simulator() {
+    println!("Running app");
+    let output = t!(Command::new("xcrun")
+                    .arg("simctl")
+                    .arg("launch")
+                    .arg("--console")
+                    .arg("booted")
+                    .arg("com.rust.unittests")
+                    .output());
+
+    println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
+    println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));
+
+    let stdout = String::from_utf8_lossy(&output.stdout);
+    let passed = stdout.lines()
+                       .find(|l| l.contains("PASSED"))
+                       .map(|l| l.contains("tests"))
+                       .unwrap_or(false);
+
+    println!("Shutting down simulator");
+    Command::new("xcrun")
+        .arg("simctl")
+        .arg("shutdown")
+        .arg("rust_ios")
+        .check_status();
+    if !passed {
+        panic!("tests didn't pass");
+    }
+}
+
+trait CheckStatus {
+    fn check_status(&mut self);
+}
+
+impl CheckStatus for Command {
+    fn check_status(&mut self) {
+        println!("\trunning: {:?}", self);
+        assert!(t!(self.status()).success());
+    }
+}
+
+fn main() {
+    let args: Vec<String> = env::args().collect();
+    if args.len() != 2 {
+        println!("Usage: {} <executable>", args[0]);
+        process::exit(-1);
+    }
+
+    let test_binary_path = Path::new(&args[1]);
+    let crate_name = test_binary_path.file_name().unwrap();
+
+    package_as_simulator_app(crate_name.to_str().unwrap(), test_binary_path);
+    start_simulator();
+    install_app_to_simulator();
+    run_app_on_simulator();
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/landing-page-footer.html
@@ -0,0 +1,3 @@
+    </ul>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/landing-page-head.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+  </head>
+  <body>
+    <ul>
copy from third_party/rust/libc/ci/run-docker.sh
copy to third_party/rust/libc-0.2.24/ci/run-docker.sh
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/run-qemu.sh
@@ -0,0 +1,32 @@
+# Initial script which is run inside of all qemu images. The first argument to
+# this script (as arranged by the qemu image itself) is the path to where the
+# libc crate is mounted.
+#
+# For qemu images we currently need to install Rust manually as this wasn't done
+# by the initial run-travis.sh script
+#
+# FIXME: feels like run-travis.sh should be responsible for downloading the
+#        compiler.
+
+set -ex
+
+ROOT=$1
+cp -r $ROOT/libc /tmp/libc
+cd /tmp/libc
+
+TARGET=$(cat $ROOT/TARGET)
+export CARGO_TARGET_DIR=/tmp
+
+case $TARGET in
+  *-openbsd)
+    pkg_add cargo gcc%4.9 rust
+    export CC=egcc
+    ;;
+
+  *)
+    echo "Unknown target: $TARGET"
+    exit 1
+    ;;
+esac
+
+exec sh ci/run.sh $TARGET
copy from third_party/rust/libc/ci/run.sh
copy to third_party/rust/libc-0.2.24/ci/run.sh
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/ci/style.rs
@@ -0,0 +1,204 @@
+//! Simple script to verify the coding style of this library
+//!
+//! ## How to run
+//!
+//! The first argument to this script is the directory to run on, so running
+//! this script should be as simple as:
+//!
+//! ```notrust
+//! rustc ci/style.rs
+//! ./style src
+//! ```
+//!
+//! ## Guidelines
+//!
+//! The current style is:
+//!
+//! * No trailing whitespace
+//! * No tabs
+//! * 80-character lines
+//! * `extern` instead of `extern "C"`
+//! * Specific module layout:
+//!     1. use directives
+//!     2. typedefs
+//!     3. structs
+//!     4. constants
+//!     5. f! { ... } functions
+//!     6. extern functions
+//!     7. modules + pub use
+//!
+//! Things not verified:
+//!
+//! * alignment
+//! * 4-space tabs
+//! * leading colons on paths
+
+use std::env;
+use std::fs;
+use std::io::prelude::*;
+use std::path::Path;
+
+macro_rules! t {
+    ($e:expr) => (match $e {
+        Ok(e) => e,
+        Err(e) => panic!("{} failed with {}", stringify!($e), e),
+    })
+}
+
+fn main() {
+    let arg = env::args().skip(1).next().unwrap_or(".".to_string());
+
+    let mut errors = Errors { errs: false };
+    walk(Path::new(&arg), &mut errors);
+
+    if errors.errs {
+        panic!("found some lint errors");
+    } else {
+        println!("good style!");
+    }
+}
+
+fn walk(path: &Path, err: &mut Errors) {
+    for entry in t!(path.read_dir()).map(|e| t!(e)) {
+        let path = entry.path();
+        if t!(entry.file_type()).is_dir() {
+            walk(&path, err);
+            continue
+        }
+
+        let name = entry.file_name().into_string().unwrap();
+        match &name[..] {
+            n if !n.ends_with(".rs") => continue,
+
+            "dox.rs" |
+            "lib.rs" |
+            "macros.rs" => continue,
+
+            _ => {}
+        }
+
+        let mut contents = String::new();
+        t!(t!(fs::File::open(&path)).read_to_string(&mut contents));
+
+        check_style(&contents, &path, err);
+    }
+}
+
+struct Errors {
+    errs: bool,
+}
+
+#[derive(Clone, Copy, PartialEq)]
+enum State {
+    Start,
+    Imports,
+    Typedefs,
+    Structs,
+    Constants,
+    FunctionDefinitions,
+    Functions,
+    Modules,
+}
+
+fn check_style(file: &str, path: &Path, err: &mut Errors) {
+    let mut state = State::Start;
+    let mut s_macros = 0;
+    let mut f_macros = 0;
+    let mut prev_blank = false;
+
+    for (i, line) in file.lines().enumerate() {
+        if line == "" {
+            if prev_blank {
+                err.error(path, i, "double blank line");
+            }
+            prev_blank = true;
+        } else {
+            prev_blank = false;
+        }
+        if line != line.trim_right() {
+            err.error(path, i, "trailing whitespace");
+        }
+        if line.contains("\t") {
+            err.error(path, i, "tab character");
+        }
+        if line.len() > 80 {
+            err.error(path, i, "line longer than 80 chars");
+        }
+        if line.contains("extern \"C\"") {
+            err.error(path, i, "use `extern` instead of `extern \"C\"");
+        }
+        if line.contains("#[cfg(") && !line.contains(" if ") {
+            if state != State::Structs {
+                err.error(path, i, "use cfg_if! and submodules \
+                                    instead of #[cfg]");
+            }
+        }
+
+        let line = line.trim_left();
+        let is_pub = line.starts_with("pub ");
+        let line = if is_pub {&line[4..]} else {line};
+
+        let line_state = if line.starts_with("use ") {
+            if is_pub {
+                State::Modules
+            } else {
+                State::Imports
+            }
+        } else if line.starts_with("const ") {
+            State::Constants
+        } else if line.starts_with("type ") {
+            State::Typedefs
+        } else if line.starts_with("s! {") {
+            s_macros += 1;
+            State::Structs
+        } else if line.starts_with("f! {") {
+            f_macros += 1;
+            State::FunctionDefinitions
+        } else if line.starts_with("extern ") {
+            State::Functions
+        } else if line.starts_with("mod ") {
+            State::Modules
+        } else {
+            continue
+        };
+
+        if state as usize > line_state as usize {
+            err.error(path, i, &format!("{} found after {} when \
+                                         it belongs before",
+                                        line_state.desc(), state.desc()));
+        }
+
+        if f_macros == 2 {
+            f_macros += 1;
+            err.error(path, i, "multiple f! macros in one module");
+        }
+        if s_macros == 2 {
+            s_macros += 1;
+            err.error(path, i, "multiple s! macros in one module");
+        }
+
+        state = line_state;
+    }
+}
+
+impl State {
+    fn desc(&self) -> &str {
+        match *self {
+            State::Start => "start",
+            State::Imports => "import",
+            State::Typedefs => "typedef",
+            State::Structs => "struct",
+            State::Constants => "constant",
+            State::FunctionDefinitions => "function definition",
+            State::Functions => "extern function",
+            State::Modules => "module",
+        }
+    }
+}
+
+impl Errors {
+    fn error(&mut self, path: &Path, line: usize, msg: &str) {
+        self.errs = true;
+        println!("{}:{} - {}", path.display(), line + 1, msg);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/dox.rs
@@ -0,0 +1,175 @@
+pub use self::imp::*;
+
+#[cfg(not(dox))]
+mod imp {
+    pub use core::option::Option;
+    pub use core::clone::Clone;
+    pub use core::marker::Copy;
+    pub use core::mem;
+}
+
+#[cfg(dox)]
+mod imp {
+    pub enum Option<T> {
+        Some(T),
+        None,
+    }
+    impl<T: Copy> Copy for Option<T> {}
+    impl<T: Clone> Clone for Option<T> {
+        fn clone(&self) -> Option<T> { loop {} }
+    }
+
+    pub trait Clone {
+        fn clone(&self) -> Self;
+    }
+
+    #[lang = "copy"]
+    pub trait Copy {}
+
+    #[lang = "freeze"]
+    pub trait Freeze {}
+
+    #[lang = "sync"]
+    pub trait Sync {}
+    impl<T> Sync for T {}
+
+    #[lang = "sized"]
+    pub trait Sized {}
+
+    macro_rules! each_int {
+        ($mac:ident) => (
+            $mac!(u8);
+            $mac!(u16);
+            $mac!(u32);
+            $mac!(u64);
+            $mac!(usize);
+            each_signed_int!($mac);
+        )
+    }
+
+    macro_rules! each_signed_int {
+        ($mac:ident) => (
+            $mac!(i8);
+            $mac!(i16);
+            $mac!(i32);
+            $mac!(i64);
+            $mac!(isize);
+        )
+    }
+
+    #[lang = "div"]
+    pub trait Div<RHS> {
+        type Output;
+        fn div(self, rhs: RHS) -> Self::Output;
+    }
+
+    macro_rules! impl_div {
+        ($($i:ident)*) => ($(
+            impl Div<$i> for $i {
+                type Output = $i;
+                fn div(self, rhs: $i) -> $i { self / rhs }
+            }
+        )*)
+    }
+    each_int!(impl_div);
+
+    #[lang = "shl"]
+    pub trait Shl<RHS> {
+        type Output;
+        fn shl(self, rhs: RHS) -> Self::Output;
+    }
+
+    macro_rules! impl_shl {
+        ($($i:ident)*) => ($(
+            impl Shl<$i> for $i {
+                type Output = $i;
+                fn shl(self, rhs: $i) -> $i { self << rhs }
+            }
+        )*)
+    }
+    each_int!(impl_shl);
+
+    #[lang = "mul"]
+    pub trait Mul<RHS=Self> {
+        type Output;
+        fn mul(self, rhs: RHS) -> Self::Output;
+    }
+
+    macro_rules! impl_mul {
+        ($($i:ident)*) => ($(
+            impl Mul for $i {
+                type Output = $i;
+                fn mul(self, rhs: $i) -> $i { self * rhs }
+            }
+        )*)
+    }
+    each_int!(impl_mul);
+
+    #[lang = "sub"]
+    pub trait Sub<RHS=Self> {
+        type Output;
+        fn sub(self, rhs: RHS) -> Self::Output;
+    }
+
+    macro_rules! impl_sub {
+        ($($i:ident)*) => ($(
+            impl Sub for $i {
+                type Output = $i;
+                fn sub(self, rhs: $i) -> $i { self - rhs }
+            }
+        )*)
+    }
+    each_int!(impl_sub);
+
+    #[lang = "bitor"]
+    pub trait Bitor<RHS=Self> {
+        type Output;
+        fn bitor(self, rhs: RHS) -> Self::Output;
+    }
+
+    macro_rules! impl_bitor {
+        ($($i:ident)*) => ($(
+            impl Bitor for $i {
+                type Output = $i;
+                fn bitor(self, rhs: $i) -> $i { self | rhs }
+            }
+        )*)
+    }
+    each_int!(impl_bitor);
+
+    #[lang = "neg"]
+    pub trait Neg {
+        type Output;
+        fn neg(self) -> Self::Output;
+    }
+
+    macro_rules! impl_neg {
+        ($($i:ident)*) => ($(
+            impl Neg for $i {
+                type Output = $i;
+                fn neg(self) -> $i { -self }
+            }
+        )*)
+    }
+    each_signed_int!(impl_neg);
+
+    #[lang = "not"]
+    pub trait Not {
+        type Output;
+        fn not(self) -> Self::Output;
+    }
+
+    macro_rules! impl_not {
+        ($($i:ident)*) => ($(
+            impl Not for $i {
+                type Output = $i;
+                fn not(self) -> $i { !self }
+            }
+        )*)
+    }
+    each_int!(impl_not);
+
+    pub mod mem {
+        pub fn size_of_val<T>(_: &T) -> usize { 4 }
+    }
+}
copy from third_party/rust/libc/src/lib.rs
copy to third_party/rust/libc-0.2.24/src/lib.rs
copy from third_party/rust/libc/src/macros.rs
copy to third_party/rust/libc-0.2.24/src/macros.rs
copy from third_party/rust/libc/src/redox.rs
copy to third_party/rust/libc-0.2.24/src/redox.rs
copy from third_party/rust/libc/src/unix/bsd/apple/b32.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/apple/b32.rs
copy from third_party/rust/libc/src/unix/bsd/apple/b64.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/apple/b64.rs
copy from third_party/rust/libc/src/unix/bsd/apple/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/apple/mod.rs
copy from third_party/rust/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/dragonfly/mod.rs
copy from third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
copy from third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/freebsd/mod.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/freebsd/x86.rs
@@ -0,0 +1,31 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
+pub type time_t = i32;
+pub type suseconds_t = i32;
+
+s! {
+    pub struct stat {
+        pub st_dev: ::dev_t,
+        pub st_ino: ::ino_t,
+        pub st_mode: ::mode_t,
+        pub st_nlink: ::nlink_t,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
+        pub st_rdev: ::dev_t,
+        pub st_atime: ::time_t,
+        pub st_atime_nsec: ::c_long,
+        pub st_mtime: ::time_t,
+        pub st_mtime_nsec: ::c_long,
+        pub st_ctime: ::time_t,
+        pub st_ctime_nsec: ::c_long,
+        pub st_size: ::off_t,
+        pub st_blocks: ::blkcnt_t,
+        pub st_blksize: ::blksize_t,
+        pub st_flags: ::fflags_t,
+        pub st_gen: ::uint32_t,
+        pub st_lspare: ::int32_t,
+        pub st_birthtime: ::time_t,
+        pub st_birthtime_nsec: ::c_long,
+        __unused: [u8; 8],
+    }
+}
copy from third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
copy from third_party/rust/libc/src/unix/bsd/freebsdlike/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/freebsdlike/mod.rs
copy from third_party/rust/libc/src/unix/bsd/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/mod.rs
copy from third_party/rust/libc/src/unix/bsd/netbsdlike/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/mod.rs
copy from third_party/rust/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/netbsd/mod.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs
@@ -0,0 +1,2 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs
@@ -0,0 +1,2 @@
+pub type c_long = i64;
+pub type c_ulong = u64;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/netbsd/other/mod.rs
@@ -0,0 +1,14 @@
+cfg_if! {
+    if #[cfg(any(target_arch = "sparc64",
+                 target_arch = "x86_64"))] {
+        mod b64;
+        pub use self::b64::*;
+    } else if #[cfg(any(target_arch = "arm",
+                        target_arch = "powerpc",
+                        target_arch = "x86"))] {
+        mod b32;
+        pub use self::b32::*;
+    } else {
+        // Unknown target_arch
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs
@@ -0,0 +1,75 @@
+s! {
+    pub struct lconv {
+        pub decimal_point: *mut ::c_char,
+        pub thousands_sep: *mut ::c_char,
+        pub grouping: *mut ::c_char,
+        pub int_curr_symbol: *mut ::c_char,
+        pub currency_symbol: *mut ::c_char,
+        pub mon_decimal_point: *mut ::c_char,
+        pub mon_thousands_sep: *mut ::c_char,
+        pub mon_grouping: *mut ::c_char,
+        pub positive_sign: *mut ::c_char,
+        pub negative_sign: *mut ::c_char,
+        pub int_frac_digits: ::c_char,
+        pub frac_digits: ::c_char,
+        pub p_cs_precedes: ::c_char,
+        pub p_sep_by_space: ::c_char,
+        pub n_cs_precedes: ::c_char,
+        pub n_sep_by_space: ::c_char,
+        pub p_sign_posn: ::c_char,
+        pub n_sign_posn: ::c_char,
+        pub int_p_cs_precedes: ::c_char,
+        pub int_n_cs_precedes: ::c_char,
+        pub int_p_sep_by_space: ::c_char,
+        pub int_n_sep_by_space: ::c_char,
+        pub int_p_sign_posn: ::c_char,
+        pub int_n_sign_posn: ::c_char,
+    }
+}
+
+pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
+pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
+pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
+pub const LC_TIME_MASK: ::c_int = (1 << 5);
+pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
+                               | LC_CTYPE_MASK
+                               | LC_MESSAGES_MASK
+                               | LC_MONETARY_MASK
+                               | LC_NUMERIC_MASK
+                               | LC_TIME_MASK;
+
+pub const ERA: ::nl_item = 52;
+pub const ERA_D_FMT: ::nl_item = 53;
+pub const ERA_D_T_FMT: ::nl_item = 54;
+pub const ERA_T_FMT: ::nl_item = 55;
+pub const ALT_DIGITS: ::nl_item = 56;
+
+pub const D_MD_ORDER: ::nl_item = 57;
+
+pub const ALTMON_1: ::nl_item = 58;
+pub const ALTMON_2: ::nl_item = 59;
+pub const ALTMON_3: ::nl_item = 60;
+pub const ALTMON_4: ::nl_item = 61;
+pub const ALTMON_5: ::nl_item = 62;
+pub const ALTMON_6: ::nl_item = 63;
+pub const ALTMON_7: ::nl_item = 64;
+pub const ALTMON_8: ::nl_item = 65;
+pub const ALTMON_9: ::nl_item = 66;
+pub const ALTMON_10: ::nl_item = 67;
+pub const ALTMON_11: ::nl_item = 68;
+pub const ALTMON_12: ::nl_item = 69;
+
+pub const KERN_RND: ::c_int = 31;
+
+extern {
+    pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+    pub fn duplocale(base: ::locale_t) -> ::locale_t;
+    pub fn freelocale(loc: ::locale_t) -> ::c_int;
+    pub fn newlocale(mask: ::c_int,
+                     locale: *const ::c_char,
+                     base: ::locale_t) -> ::locale_t;
+    pub fn uselocale(loc: ::locale_t) -> ::locale_t;
+    pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
+}
copy from third_party/rust/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
copy from third_party/rust/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
copy to third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs
@@ -0,0 +1,2 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs
@@ -0,0 +1,2 @@
+pub type c_long = i64;
+pub type c_ulong = u64;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs
@@ -0,0 +1,11 @@
+cfg_if! {
+    if #[cfg(target_arch = "x86_64")] {
+        mod b64;
+        pub use self::b64::*;
+    } else if #[cfg(target_arch = "x86")] {
+        mod b32;
+        pub use self::b32::*;
+    } else {
+        // Unknown target_arch
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/haiku/b32.rs
@@ -0,0 +1,2 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/haiku/b64.rs
@@ -0,0 +1,2 @@
+pub type c_ulong = u64;
+pub type c_long = i64;
copy from third_party/rust/libc/src/unix/haiku/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/haiku/mod.rs
copy from third_party/rust/libc/src/unix/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/android/b32/arm.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/android/b32/arm.rs
copy from third_party/rust/libc/src/unix/notbsd/android/b32/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/android/b32/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/android/b32/x86.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/android/b32/x86.rs
copy from third_party/rust/libc/src/unix/notbsd/android/b64/aarch64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/android/b64/aarch64.rs
copy from third_party/rust/libc/src/unix/notbsd/android/b64/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/android/b64/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/android/b64/x86_64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/android/b64/x86_64.rs
copy from third_party/rust/libc/src/unix/notbsd/android/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/android/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/mips/mips32.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/mips/mips32.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/mips/mips64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/mips/mips64.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/mips/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/mips/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/b32/arm.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/arm.rs
rename from third_party/rust/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs
rename to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/asmjs.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/b32/mips.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/mips.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/b32/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/b32/x86.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b32/x86.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b64/aarch64.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/b64/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b64/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b64/powerpc64.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/b64/x86_64.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/musl/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/musl/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b32/arm.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b32/arm.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b32/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b32/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b32/powerpc.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b32/powerpc.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b32/x86.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b32/x86.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b64/aarch64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/aarch64.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b64/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/powerpc64.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b64/sparc64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/sparc64.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/b64/x86_64.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/b64/x86_64.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/other/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/other/mod.rs
copy from third_party/rust/libc/src/unix/notbsd/linux/s390x.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/linux/s390x.rs
copy from third_party/rust/libc/src/unix/notbsd/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/notbsd/mod.rs
copy from third_party/rust/libc/src/unix/solaris/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/solaris/mod.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/uclibc/mips/mips32.rs
@@ -0,0 +1,269 @@
+pub type c_char = i8;
+pub type c_long = i32;
+pub type c_ulong = u32;
+pub type clock_t = i32;
+pub type time_t = i32;
+pub type suseconds_t = i32;
+pub type wchar_t = i32;
+pub type off_t = i32;
+pub type ino_t = u32;
+pub type blkcnt_t = i32;
+pub type blksize_t = i32;
+pub type nlink_t = u32;
+pub type fsblkcnt_t = ::c_ulong;
+pub type fsfilcnt_t = ::c_ulong;
+pub type rlim_t = c_ulong;
+
+s! {
+    pub struct stat {
+        pub st_dev: ::dev_t,
+        st_pad1: [::c_long; 2],
+        pub st_ino: ::ino_t,
+        pub st_mode: ::mode_t,
+        pub st_nlink: ::nlink_t,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
+        pub st_rdev: ::dev_t,
+        pub st_pad2: [::c_long; 1],
+        pub st_size: ::off_t,
+        st_pad3: ::c_long,
+        pub st_atime: ::time_t,
+        pub st_atime_nsec: ::c_long,
+        pub st_mtime: ::time_t,
+        pub st_mtime_nsec: ::c_long,
+        pub st_ctime: ::time_t,
+        pub st_ctime_nsec: ::c_long,
+        pub st_blksize: ::blksize_t,
+        pub st_blocks: ::blkcnt_t,
+        st_pad5: [::c_long; 14],
+    }
+
+    pub struct stat64 {
+        pub st_dev: ::dev_t,
+        st_pad1: [::c_long; 2],
+        pub st_ino: ::ino64_t,
+        pub st_mode: ::mode_t,
+        pub st_nlink: ::nlink_t,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
+        pub st_rdev: ::dev_t,
+        st_pad2: [::c_long; 2],
+        pub st_size: ::off64_t,
+        pub st_atime: ::time_t,
+        pub st_atime_nsec: ::c_long,
+        pub st_mtime: ::time_t,
+        pub st_mtime_nsec: ::c_long,
+        pub st_ctime: ::time_t,
+        pub st_ctime_nsec: ::c_long,
+        pub st_blksize: ::blksize_t,
+        st_pad3: ::c_long,
+        pub st_blocks: ::blkcnt64_t,
+        st_pad5: [::c_long; 14],
+    }
+
+    pub struct pthread_attr_t {
+        __size: [u32; 9]
+    }
+
+    pub struct sigaction {
+        pub sa_flags: ::c_uint,
+        pub sa_sigaction: ::sighandler_t,
+        pub sa_mask: sigset_t,
+        _restorer: *mut ::c_void,
+    }
+
+    pub struct stack_t {
+        pub ss_sp: *mut ::c_void,
+        pub ss_size: ::size_t,
+        pub ss_flags: ::c_int,
+    }
+
+    pub struct sigset_t {
+        __val: [::c_ulong; 4],
+    }
+
+    pub struct siginfo_t {
+        pub si_signo: ::c_int,
+        pub si_code: ::c_int,
+        pub si_errno: ::c_int,
+        pub _pad: [::c_int; 29],
+    }
+
+    pub struct glob64_t {
+        pub gl_pathc: ::size_t,
+        pub gl_pathv: *mut *mut ::c_char,
+        pub gl_offs: ::size_t,
+        pub gl_flags: ::c_int,
+
+        __unused1: *mut ::c_void,
+        __unused2: *mut ::c_void,
+        __unused3: *mut ::c_void,
+        __unused4: *mut ::c_void,
+        __unused5: *mut ::c_void,
+    }
+
+    pub struct ipc_perm {
+        pub __key: ::key_t,
+        pub uid: ::uid_t,
+        pub gid: ::gid_t,
+        pub cuid: ::uid_t,
+        pub cgid: ::gid_t,
+        pub mode: ::c_uint,
+        pub __seq: ::c_ushort,
+        __pad1: ::c_ushort,
+        __unused1: ::c_ulong,
+        __unused2: ::c_ulong
+    }
+
+    pub struct shmid_ds {
+        pub shm_perm: ::ipc_perm,
+        pub shm_segsz: ::size_t,
+        pub shm_atime: ::time_t,
+        pub shm_dtime: ::time_t,
+        pub shm_ctime: ::time_t,
+        pub shm_cpid: ::pid_t,
+        pub shm_lpid: ::pid_t,
+        pub shm_nattch: ::shmatt_t,
+        __unused4: ::c_ulong,
+        __unused5: ::c_ulong
+    }
+
+    pub struct msqid_ds {
+        pub msg_perm: ::ipc_perm,
+        #[cfg(target_endian = "big")]
+        __glibc_reserved1: ::c_ulong,
+        pub msg_stime: ::time_t,
+        #[cfg(target_endian = "little")]
+        __glibc_reserved1: ::c_ulong,
+        #[cfg(target_endian = "big")]
+        __glibc_reserved2: ::c_ulong,
+        pub msg_rtime: ::time_t,
+        #[cfg(target_endian = "little")]
+        __glibc_reserved2: ::c_ulong,
+        #[cfg(target_endian = "big")]
+        __glibc_reserved3: ::c_ulong,
+        pub msg_ctime: ::time_t,
+        #[cfg(target_endian = "little")]
+        __glibc_reserved3: ::c_ulong,
+        __msg_cbytes: ::c_ulong,
+        pub msg_qnum: ::msgqnum_t,
+        pub msg_qbytes: ::msglen_t,
+        pub msg_lspid: ::pid_t,
+        pub msg_lrpid: ::pid_t,
+        __glibc_reserved4: ::c_ulong,
+        __glibc_reserved5: ::c_ulong,
+    }
+
+    pub struct statfs {
+        pub f_type: ::c_long,
+        pub f_bsize: ::c_long,
+        pub f_frsize: ::c_long,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_files: ::fsblkcnt_t,
+        pub f_ffree: ::fsblkcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_fsid: ::fsid_t,
+
+        pub f_namelen: ::c_long,
+        f_spare: [::c_long; 6],
+    }
+
+    pub struct msghdr {
+        pub msg_name: *mut ::c_void,
+        pub msg_namelen: ::socklen_t,
+        pub msg_iov: *mut ::iovec,
+        pub msg_iovlen: ::c_int,
+        pub msg_control: *mut ::c_void,
+        pub msg_controllen: ::size_t,
+        pub msg_flags: ::c_int,
+    }
+
+    pub struct cmsghdr {
+        pub cmsg_len: ::size_t,
+        pub cmsg_level: ::c_int,
+        pub cmsg_type: ::c_int,
+    }
+
+    pub struct termios {
+        pub c_iflag: ::tcflag_t,
+        pub c_oflag: ::tcflag_t,
+        pub c_cflag: ::tcflag_t,
+        pub c_lflag: ::tcflag_t,
+        pub c_line: ::cc_t,
+        pub c_cc: [::cc_t; ::NCCS],
+    }
+
+    pub struct flock {
+        pub l_type: ::c_short,
+        pub l_whence: ::c_short,
+        pub l_start: ::off_t,
+        pub l_len: ::off_t,
+        pub l_sysid: ::c_long,
+        pub l_pid: ::pid_t,
+        pad: [::c_long; 4],
+    }
+
+    pub struct sysinfo {
+        pub uptime: ::c_long,
+        pub loads: [::c_ulong; 3],
+        pub totalram: ::c_ulong,
+        pub freeram: ::c_ulong,
+        pub sharedram: ::c_ulong,
+        pub bufferram: ::c_ulong,
+        pub totalswap: ::c_ulong,
+        pub freeswap: ::c_ulong,
+        pub procs: ::c_ushort,
+        pub pad: ::c_ushort,
+        pub totalhigh: ::c_ulong,
+        pub freehigh: ::c_ulong,
+        pub mem_unit: ::c_uint,
+        pub _f: [::c_char; 8],
+    }
+
+    // FIXME this is actually a union
+    pub struct sem_t {
+        #[cfg(target_pointer_width = "32")]
+        __size: [::c_char; 16],
+        #[cfg(target_pointer_width = "64")]
+        __size: [::c_char; 32],
+        __align: [::c_long; 0],
+    }
+}
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+
+pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
+
+pub const SYS_gettid: ::c_long = 4222;   // Valid for O32
+
+#[link(name = "util")]
+extern {
+    pub fn sysctl(name: *mut ::c_int,
+                  namelen: ::c_int,
+                  oldp: *mut ::c_void,
+                  oldlenp: *mut ::size_t,
+                  newp: *mut ::c_void,
+                  newlen: ::size_t)
+                  -> ::c_int;
+    pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+    pub fn backtrace(buf: *mut *mut ::c_void,
+                     sz: ::c_int) -> ::c_int;
+    pub fn glob64(pattern: *const ::c_char,
+                  flags: ::c_int,
+                  errfunc: ::dox::Option<extern fn(epath: *const ::c_char,
+                                                   errno: ::c_int)
+                                                   -> ::c_int>,
+                  pglob: *mut glob64_t) -> ::c_int;
+    pub fn globfree64(pglob: *mut glob64_t);
+    pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
+    pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t,
+                                       cpusetsize: ::size_t,
+                                       cpuset: *mut ::cpu_set_t) -> ::c_int;
+    pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t,
+                                       cpusetsize: ::size_t,
+                                       cpuset: *const ::cpu_set_t) -> ::c_int;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/uclibc/mips/mips64.rs
@@ -0,0 +1,209 @@
+pub type blkcnt_t = i64;
+pub type blksize_t = i64;
+pub type c_char = i8;
+pub type c_long = i64;
+pub type c_ulong = u64;
+pub type fsblkcnt_t = ::c_ulong;
+pub type fsfilcnt_t = ::c_ulong;
+pub type ino_t = u64;
+pub type nlink_t = u64;
+pub type off_t = i64;
+pub type rlim_t = ::c_ulong;
+pub type suseconds_t = i64;
+pub type time_t = i64;
+pub type wchar_t = i32;
+
+s! {
+    pub struct stat {
+        pub st_dev: ::c_ulong,
+        st_pad1: [::c_long; 2],
+        pub st_ino: ::ino_t,
+        pub st_mode: ::mode_t,
+        pub st_nlink: ::nlink_t,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
+        pub st_rdev: ::c_ulong,
+        st_pad2: [::c_ulong; 1],
+        pub st_size: ::off_t,
+        st_pad3: ::c_long,
+        pub st_atime: ::time_t,
+        pub st_atime_nsec: ::c_long,
+        pub st_mtime: ::time_t,
+        pub st_mtime_nsec: ::c_long,
+        pub st_ctime: ::time_t,
+        pub st_ctime_nsec: ::c_long,
+        pub st_blksize: ::blksize_t,
+        st_pad4: ::c_long,
+        pub st_blocks: ::blkcnt_t,
+        st_pad5: [::c_long; 7],
+    }
+
+    pub struct stat64 {
+        pub st_dev: ::c_ulong,
+        st_pad1: [::c_long; 2],
+        pub st_ino: ::ino64_t,
+        pub st_mode: ::mode_t,
+        pub st_nlink: ::nlink_t,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
+        pub st_rdev: ::c_ulong,
+        st_pad2: [::c_long; 2],
+        pub st_size: ::off64_t,
+        pub st_atime: ::time_t,
+        pub st_atime_nsec: ::c_long,
+        pub st_mtime: ::time_t,
+        pub st_mtime_nsec: ::c_long,
+        pub st_ctime: ::time_t,
+        pub st_ctime_nsec: ::c_long,
+        pub st_blksize: ::blksize_t,
+        st_pad3: ::c_long,
+        pub st_blocks: ::blkcnt64_t,
+        st_pad5: [::c_long; 7],
+    }
+
+    pub struct pthread_attr_t {
+        __size: [::c_ulong; 7]
+    }
+
+    pub struct sigaction {
+        pub sa_flags: ::c_int,
+        pub sa_sigaction: ::sighandler_t,
+        pub sa_mask: sigset_t,
+        _restorer: *mut ::c_void,
+    }
+
+    pub struct stack_t {
+        pub ss_sp: *mut ::c_void,
+        pub ss_size: ::size_t,
+        pub ss_flags: ::c_int,
+    }
+
+    pub struct sigset_t {
+        __size: [::c_ulong; 16],
+    }
+
+    pub struct siginfo_t {
+        pub si_signo: ::c_int,
+        pub si_code: ::c_int,
+        pub si_errno: ::c_int,
+        _pad: ::c_int,
+        _pad2: [::c_long; 14],
+    }
+
+    pub struct ipc_perm {
+        pub __key: ::key_t,
+        pub uid: ::uid_t,
+        pub gid: ::gid_t,
+        pub cuid: ::uid_t,
+        pub cgid: ::gid_t,
+        pub mode: ::c_uint,
+        pub __seq: ::c_ushort,
+        __pad1: ::c_ushort,
+        __unused1: ::c_ulong,
+        __unused2: ::c_ulong
+    }
+
+    pub struct shmid_ds {
+        pub shm_perm: ::ipc_perm,
+        pub shm_segsz: ::size_t,
+        pub shm_atime: ::time_t,
+        pub shm_dtime: ::time_t,
+        pub shm_ctime: ::time_t,
+        pub shm_cpid: ::pid_t,
+        pub shm_lpid: ::pid_t,
+        pub shm_nattch: ::shmatt_t,
+        __unused4: ::c_ulong,
+        __unused5: ::c_ulong
+    }
+
+    pub struct msqid_ds {
+        pub msg_perm: ::ipc_perm,
+        pub msg_stime: ::time_t,
+        pub msg_rtime: ::time_t,
+        pub msg_ctime: ::time_t,
+        __msg_cbytes: ::c_ulong,
+        pub msg_qnum: ::msgqnum_t,
+        pub msg_qbytes: ::msglen_t,
+        pub msg_lspid: ::pid_t,
+        pub msg_lrpid: ::pid_t,
+        __glibc_reserved4: ::c_ulong,
+        __glibc_reserved5: ::c_ulong,
+    }
+
+    pub struct statfs {
+        pub f_type: ::c_long,
+        pub f_bsize: ::c_long,
+        pub f_frsize: ::c_long,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_files: ::fsblkcnt_t,
+        pub f_ffree: ::fsblkcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_fsid: ::fsid_t,
+
+        pub f_namelen: ::c_long,
+        f_spare: [::c_long; 6],
+    }
+
+    pub struct msghdr {
+        pub msg_name: *mut ::c_void,
+        pub msg_namelen: ::socklen_t,
+        pub msg_iov: *mut ::iovec,
+        pub msg_iovlen: ::size_t,
+        pub msg_control: *mut ::c_void,
+        pub msg_controllen: ::size_t,
+        pub msg_flags: ::c_int,
+    }
+
+    pub struct cmsghdr {
+        pub cmsg_len: ::size_t,
+        pub cmsg_level: ::c_int,
+        pub cmsg_type: ::c_int,
+    }
+
+    pub struct termios {
+        pub c_iflag: ::tcflag_t,
+        pub c_oflag: ::tcflag_t,
+        pub c_cflag: ::tcflag_t,
+        pub c_lflag: ::tcflag_t,
+        pub c_line: ::cc_t,
+        pub c_cc: [::cc_t; ::NCCS],
+    }
+
+    pub struct sysinfo {
+        pub uptime: ::c_long,
+        pub loads: [::c_ulong; 3],
+        pub totalram: ::c_ulong,
+        pub freeram: ::c_ulong,
+        pub sharedram: ::c_ulong,
+        pub bufferram: ::c_ulong,
+        pub totalswap: ::c_ulong,
+        pub freeswap: ::c_ulong,
+        pub procs: ::c_ushort,
+        pub pad: ::c_ushort,
+        pub totalhigh: ::c_ulong,
+        pub freehigh: ::c_ulong,
+        pub mem_unit: ::c_uint,
+        pub _f: [::c_char; 0],
+    }
+
+    // FIXME this is actually a union
+    pub struct sem_t {
+        __size: [::c_char; 32],
+        __align: [::c_long; 0],
+    }
+}
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+
+pub const RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff;
+
+pub const SYS_gettid: ::c_long = 5178;   // Valid for n64
+
+#[link(name = "util")]
+extern {
+    pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc-0.2.24/src/unix/uclibc/mips/mod.rs
@@ -0,0 +1,476 @@
+pub const SFD_CLOEXEC: ::c_int = 0x080000;
+
+pub const NCCS: usize = 32;
+
+pub const O_TRUNC: ::c_int = 512;
+
+pub const O_CLOEXEC: ::c_int = 0x80000;
+
+pub const EBFONT: ::c_int = 59;
+pub const ENOSTR: ::c_int = 60;
+pub const ENODATA: ::c_int = 61;
+pub const ETIME: ::c_int = 62;
+pub const ENOSR: ::c_int = 63;
+pub const ENONET: ::c_int = 64;
+pub const ENOPKG: ::c_int = 65;
+pub const EREMOTE: ::c_int = 66;
+pub const ENOLINK: ::c_int = 67;
+pub const EADV: ::c_int = 68;
+pub const ESRMNT: ::c_int = 69;
+pub const ECOMM: ::c_int = 70;
+pub const EPROTO: ::c_int = 71;
+pub const EDOTDOT: ::c_int = 73;
+
+pub const SA_NODEFER: ::c_int = 0x40000000;
+pub const SA_RESETHAND: ::c_int = 0x80000000;
+pub const SA_RESTART: ::c_int = 0x10000000;
+pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
+
+pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
+
+pub const EFD_CLOEXEC: ::c_int = 0x80000;
+
+pub const BUFSIZ: ::c_uint = 4096;
+pub const TMP_MAX: ::c_uint = 238328;
+pub const FOPEN_MAX: ::c_uint = 16;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
+pub const POSIX_MADV_DONTNEED: ::c_int = 4;
+pub const _SC_2_C_VERSION: ::c_int = 96;
+pub const O_ACCMODE: ::c_int = 3;
+pub const O_DIRECT: ::c_int = 0x8000;
+pub const O_DIRECTORY: ::c_int = 0x10000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const ST_RELATIME: ::c_ulong = 4096;
+pub const NI_MAXHOST: ::socklen_t = 1025;
+
+pub const RLIMIT_NOFILE: ::c_int = 5;
+pub const RLIMIT_AS: ::c_int = 6;
+pub const RLIMIT_RSS: ::c_int = 7;
+pub const RLIMIT_NPROC: ::c_int = 8;
+pub const RLIMIT_MEMLOCK: ::c_int = 9;
+pub const RLIMIT_NLIMITS: ::c_int = 15;
+
+pub const O_APPEND: ::c_int = 8;
+pub const O_CREAT: ::c_int = 256;
+pub const O_EXCL: ::c_int = 1024;
+pub const O_NOCTTY: ::c_int = 2048;
+pub const O_NONBLOCK: ::c_int = 128;
+pub const O_SYNC: ::c_int = 0x10;
+pub const O_RSYNC: ::c_int = 0x10;
+pub const O_DSYNC: ::c_int = 0x10;
+pub const O_FSYNC: ::c_int = 0x10;
+pub const O_ASYNC: ::c_int = 0x1000;
+pub const O_NDELAY: ::c_int = 0x80;
+
+pub const SOCK_NONBLOCK: ::c_int = 128;
+
+pub const EDEADLK: ::c_int = 45;
+pub const ENAMETOOLONG: ::c_int = 78;
+pub const ENOLCK: ::c_int = 46;
+pub const ENOSYS: ::c_int = 89;
+pub const ENOTEMPTY: ::c_int = 93;
+pub const ELOOP: ::c_int = 90;
+pub const ENOMSG: ::c_int = 35;
+pub const EIDRM: ::c_int = 36;
+pub const ECHRNG: ::c_int = 37;
+pub const EL2NSYNC: ::c_int = 38;
+pub const EL3HLT: ::c_int = 39;
+pub const EL3RST: ::c_int = 40;
+pub const ELNRNG: ::c_int = 41;
+pub const EUNATCH: ::c_int = 42;
+pub const ENOCSI: ::c_int = 43;
+pub const EL2HLT: ::c_int = 44;
+pub const EBADE: ::c_int = 50;
+pub const EBADR: ::c_int = 51;
+pub const EXFULL: ::c_int = 52;
+pub const ENOANO: ::c_int = 53;
+pub const EBADRQC: ::c_int = 54;
+pub const EBADSLT: ::c_int = 55;
+pub const EDEADLOCK: ::c_int = 56;
+pub const EMULTIHOP: ::c_int = 74;
+pub const EOVERFLOW: ::c_int = 79;
+pub const ENOTUNIQ: ::c_int = 80;
+pub const EBADFD: ::c_int = 81;
+pub const EBADMSG: ::c_int = 77;
+pub const EREMCHG: ::c_int = 82;
+pub const ELIBACC: ::c_int = 83;
+pub const ELIBBAD: ::c_int = 84;
+pub const ELIBSCN: ::c_int = 85;
+pub const ELIBMAX: ::c_int = 86;
+pub const ELIBEXEC: ::c_int = 87;
+pub const EILSEQ: ::c_int = 88;
+pub const ERESTART: ::c_int = 91;
+pub const ESTRPIPE: ::c_int = 92;
+pub const EUSERS: ::c_int = 94;
+pub const ENOTSOCK: ::c_int = 95;
+pub const EDESTADDRREQ: ::c_int = 96;
+pub const EMSGSIZE: ::c_int = 97;
+pub const EPROTOTYPE: ::c_int = 98;
+pub const ENOPROTOOPT: ::c_int = 99;
+pub const EPROTONOSUPPORT: ::c_int = 120;
+pub const ESOCKTNOSUPPORT: ::c_int = 121;
+pub const EOPNOTSUPP: ::c_int = 122;
+pub const ENOTSUP: ::c_int = EOPNOTSUPP;
+pub const EPFNOSUPPORT: ::c_int = 123;
+pub const EAFNOSUPPORT: ::c_int = 124;
+pub const EADDRINUSE: ::c_int = 125;
+pub const EADDRNOTAVAIL: ::c_int = 126;
+pub const ENETDOWN: ::c_int = 127;
+pub const ENETUNREACH: ::c_int = 128;
+pub const ENETRESET: ::c_int = 129;
+pub const ECONNABORTED: ::c_int = 130;
+pub const ECONNRESET: ::c_int = 131;
+pub const ENOBUFS: ::c_int = 132;
+pub const EISCONN: ::c_int = 133;
+pub const ENOTCONN: ::c_int = 134;
+pub const ESHUTDOWN: ::c_int = 143;
+pub const ETOOMANYREFS: ::c_int = 144;
+pub const ETIMEDOUT: ::c_int = 145;
+pub const ECONNREFUSED: ::c_int = 146;
+pub const EHOSTDOWN: ::c_int = 147;
+pub const EHOSTUNREACH: ::c_int = 148;
+pub const EALREADY: ::c_int = 149;
+pub const EINPROGRESS: ::c_int = 150;
+pub const ESTALE: ::c_int = 151;
+pub const EUCLEAN: ::c_int = 135;
+pub const ENOTNAM: ::c_int = 137;
+pub const ENAVAIL: ::c_int = 138;
+pub const EISNAM: ::c_int = 139;
+pub const EREMOTEIO: ::c_int = 140;
+pub const EDQUOT: ::c_int = 1133;
+pub const ENOMEDIUM: ::c_int = 159;
+pub const EMEDIUMTYPE: ::c_int = 160;
+pub const ECANCELED: ::c_int = 158;
+pub const ENOKEY: ::c_int = 161;
+pub const EKEYEXPIRED: ::c_int = 162;
+pub const EKEYREVOKED: ::c_int = 163;
+pub const EKEYREJECTED: ::c_int = 164;
+pub const EOWNERDEAD: ::c_int = 165;
+pub const ENOTRECOVERABLE: ::c_int = 166;
+pub const ERFKILL: ::c_int = 167;
+
+pub const MAP_NORESERVE: ::c_int = 0x400;
+pub const MAP_ANON: ::c_int = 0x800;
+pub const MAP_ANONYMOUS: ::c_int = 0x800;
+pub const MAP_GROWSDOWN: ::c_int = 0x1000;
+pub const MAP_DENYWRITE: ::c_int = 0x2000;
+pub const MAP_EXECUTABLE: ::c_int = 0x4000;
+pub const MAP_LOCKED: ::c_int = 0x8000;
+pub const MAP_POPULATE: ::c_int = 0x10000;
+pub const MAP_NONBLOCK: ::c_int = 0x20000;
+pub const MAP_STACK: ::c_int = 0x40000;
+
+pub const SOCK_STREAM: ::c_int = 2;
+pub const SOCK_DGRAM: ::c_int = 1;
+pub const SOCK_SEQPACKET: ::c_int = 5;
+
+pub const SOL_SOCKET: ::c_int = 0xffff;
+
+pub const SO_REUSEADDR: ::c_int = 0x0004;
+pub const SO_KEEPALIVE: ::c_int = 0x0008;
+pub const SO_DONTROUTE: ::c_int = 0x0010;
+pub const SO_BROADCAST: ::c_int = 0x0020;
+pub const SO_LINGER: ::c_int = 0x0080;
+pub const SO_OOBINLINE: ::c_int = 0x0100;
+pub const SO_REUSEPORT: ::c_int = 0x0200;
+pub const SO_TYPE: ::c_int = 0x1008;
+pub const SO_STYLE: ::c_int = SO_TYPE;
+pub const SO_ERROR: ::c_int = 0x1007;
+pub const SO_SNDBUF: ::c_int = 0x1001;
+pub const SO_RCVBUF: ::c_int = 0x1002;
+pub const SO_SNDLOWAT: ::c_int = 0x1003;
+pub const SO_RCVLOWAT: ::c_int = 0x1004;
+pub const SO_SNDTIMEO: ::c_int = 0x1005;
+pub const SO_RCVTIMEO: ::c_int = 0x1006;
+pub const SO_ACCEPTCONN: ::c_int = 0x1009;
+pub const SO_PROTOCOL: ::c_int = 0x1028;
+pub const SO_DOMAIN: ::c_int = 0x1029;
+pub const SO_NO_CHECK: ::c_int = 11;
+pub const SO_PRIORITY: ::c_int = 12;
+pub const SO_BSDCOMPAT: ::c_int = 14;
+pub const SO_PASSCRED: ::c_int = 17;
+pub const SO_PEERCRED: ::c_int = 18;
+pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
+pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
+pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_ATTACH_FILTER: ::c_int = 26;
+pub const SO_DETACH_FILTER: ::c_int = 27;
+pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
+pub const SO_PEERNAME: ::c_int = 28;
+pub const SO_TIMESTAMP: ::c_int = 29;
+pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
+pub const SO_PEERSEC: ::c_int = 30;
+pub const SO_SNDBUFFORCE: ::c_int = 31;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
+pub const SO_PASSSEC: ::c_int = 34;
+pub const SO_TIMESTAMPNS: ::c_int = 35;
+pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_TIMESTAMPING: ::c_int = 37;
+pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_WIFI_STATUS: ::c_int = 41;
+pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_NOFCS: ::c_int = 43;
+pub const SO_LOCK_FILTER: ::c_int = 44;
+pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
+pub const SO_BUSY_POLL: ::c_int = 46;
+pub const SO_MAX_PACING_RATE: ::c_int = 47;
+pub const SO_BPF_EXTENSIONS: ::c_int = 48;
+
+pub const FIOCLEX: ::c_ulong = 0x6601;
+pub const FIONBIO: ::c_ulong = 0x667e;
+
+pub const SA_ONSTACK: ::c_int = 0x08000000;
+pub const SA_SIGINFO: ::c_int = 0x00000008;
+pub const SA_NOCLDWAIT: ::c_int = 0x00010000;
+
+pub const SIGCHLD: ::c_int = 18;
+pub const SIGBUS: ::c_int = 10;
+pub const SIGTTIN: ::c_int = 26;
+pub const SIGTTOU: ::c_int = 27;
+pub const SIGXCPU: ::c_int = 30;
+pub const SIGXFSZ: ::c_int = 31;
+pub const SIGVTALRM: ::c_int = 28;
+pub const SIGPROF: ::c_int = 29;
+pub const SIGWINCH: ::c_int = 20;
+pub const SIGUSR1: ::c_int = 16;
+pub const SIGUSR2: ::c_int = 17;
+pub const SIGCONT: ::c_int = 25;
+pub const SIGSTOP: ::c_int = 23;
+pub const SIGTSTP: ::c_int = 24;
+pub const SIGURG: ::c_int = 21;
+pub const SIGIO: ::c_int = 22;
+pub const SIGSYS: ::c_int = 12;
+pub const SIGPOLL: ::c_int = 22;
+pub const SIGPWR: ::c_int = 19;
+pub const SIG_SETMASK: ::c_int = 3;
+pub const SIG_BLOCK: ::c_int = 0x1;
+pub const SIG_UNBLOCK: ::c_int = 0x2;
+
+pub const POLLRDNORM: ::c_short = 0x040;
+pub const POLLWRNORM: ::c_short = 0x004;
+pub const POLLRDBAND: ::c_short = 0x080;
+pub const POLLWRBAND: ::c_short = 0x100;
+
+pub const PTHREAD_STACK_MIN: ::size_t = 16384;
+
+pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
+pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
+pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
+pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
+pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
+pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
+pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
+pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
+pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
+pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
+pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
+pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
+pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
+pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
+pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
+pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
+pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
+pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
+pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
+pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
+pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
+pub const TMPFS_MAGIC: ::c_long = 0x01021994;
+pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
+
+pub const VEOF: usize = 16;
+pub const VEOL: usize = 17;
+pub const VEOL2: usize = 6;
+pub const VMIN: usize = 4;
+pub const IEXTEN: ::tcflag_t = 0x00000100;
+pub const TOSTOP: ::tcflag_t = 0x00008000;
+pub const FLUSHO: ::tcflag_t = 0x00002000;
+pub const IUTF8: ::tcflag_t = 0x00004000;
+pub const TCSANOW: ::c_int = 0x540e;
+pub const TCSADRAIN: ::c_int = 0x540f;
+pub const TCSAFLUSH: ::c_int = 0x5410;
+
+pub const CPU_SETSIZE: ::c_int = 0x400;
+
+pub const PTRACE_TRACEME: ::c_uint = 0;
+pub const PTRACE_PEEKTEXT: ::c_uint = 1;
+pub const PTRACE_PEEKDATA: ::c_uint = 2;
+pub const PTRACE_PEEKUSER: ::c_uint = 3;
+pub const PTRACE_POKETEXT: ::c_uint = 4;
+pub const PTRACE_POKEDATA: ::c_uint = 5;
+pub const PTRACE_POKEUSER: ::c_uint = 6;
+pub const PTRACE_CONT: ::c_uint = 7;
+pub const PTRACE_KILL: ::c_uint = 8;
+pub const PTRACE_SINGLESTEP: ::c_uint = 9;
+pub const PTRACE_ATTACH: ::c_uint = 16;
+pub const PTRACE_DETACH: ::c_uint = 17;
+pub const PTRACE_SYSCALL: ::c_uint = 24;
+pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
+pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
+pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
+pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
+pub const PTRACE_GETFPREGS: ::c_uint = 14;
+pub const PTRACE_SETFPREGS: ::c_uint = 15;
+pub const PTRACE_GETFPXREGS: ::c_uint = 18;
+pub const PTRACE_SETFPXREGS: ::c_uint = 19;
+pub const PTRACE_GETREGS: ::c_uint = 12;
+pub const PTRACE_SETREGS: ::c_uint = 13;
+
+pub const EFD_NONBLOCK: ::c_int = 0x80;
+
+pub const F_GETLK: ::c_int = 14;
+pub const F_GETOWN: ::c_int = 23;
+pub const F_SETOWN: ::c_int = 24;
+pub const F_SETLK: ::c_int = 6;
+pub const F_SETLKW: ::c_int = 7;
+
+pub const SFD_NONBLOCK: ::c_int = 0x80;
+
+pub const TCGETS: ::c_ulong = 0x540d;
+pub const TCSETS: ::c_ulong = 0x540e;
+pub const TCSETSW: ::c_ulong = 0x540f;
+pub const TCSETSF: ::c_ulong = 0x5410;
+pub const TCGETA: ::c_ulong = 0x5401;
+pub const TCSETA: ::c_ulong = 0x5402;
+pub const TCSETAW: ::c_ulong = 0x5403;
+pub const TCSETAF: ::c_ulong = 0x5404;
+pub const TCSBRK: ::c_ulong = 0x5405;
+pub const TCXONC: ::c_ulong = 0x5406;
+pub const TCFLSH: ::c_ulong = 0x5407;
+pub const TIOCGSOFTCAR: ::c_ulong = 0x5481;
+pub const TIOCSSOFTCAR: ::c_ulong = 0x5482;
+pub const TIOCINQ: ::c_ulong = 0x467f;
+pub const TIOCLINUX: ::c_ulong = 0x5483;
+pub const TIOCGSERIAL: ::c_ulong = 0x5484;
+pub const TIOCEXCL: ::c_ulong = 0x740d;
+pub const TIOCNXCL: ::c_ulong = 0x740e;
+pub const TIOCSCTTY: ::c_ulong = 0x5480;
+pub const TIOCGPGRP: ::c_ulong = 0x40047477;
+pub const TIOCSPGRP: ::c_ulong = 0x80047476;
+pub const TIOCOUTQ: ::c_ulong = 0x7472;
+pub const TIOCSTI: ::c_ulong = 0x5472;
+pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
+pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
+pub const TIOCMGET: ::c_ulong = 0x741d;
+pub const TIOCMBIS: ::c_ulong = 0x741b;
+pub const TIOCMBIC: ::c_ulong = 0x741c;
+pub const TIOCMSET: ::c_ulong = 0x741a;
+pub const FIONREAD: ::c_ulong = 0x467f;
+pub const TIOCCONS: ::c_ulong = 0x80047478;
+
+pub const RTLD_DEEPBIND: ::c_int = 0x10;
+pub const RTLD_GLOBAL: ::c_int = 0x4;
+pub const RTLD_NOLOAD: ::c_int = 0x8;
+
+pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
+pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
+pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
+pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
+pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
+
+pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
+pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
+pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
+pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
+pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
+pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
+pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
+pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
+
+pub const MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const CBAUD: ::tcflag_t = 0o0010017;
+pub const TAB1: ::c_int = 0x00000800;
+pub const TAB2: ::c_int = 0x00001000;
+pub const TAB3: ::c_int = 0x00001800;
+pub const CR1: ::c_int  = 0x00000200;
+pub const CR2: ::c_int  = 0x00000400;
+pub const CR3: ::c_int  = 0x00000600;
+pub const FF1: ::c_int  = 0x00008000;
+pub const BS1: ::c_int  = 0x00002000;
+pub const VT1: ::c_int  = 0x00004000;
+pub const VWERASE: usize = 14;
+pub const VREPRINT: usize = 12;
+pub const VSUSP: usize = 10;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VDISCARD: usize = 13;
+pub const VTIME: usize = 5;
+pub const IXON: ::tcflag_t = 0x00000400;
+pub const IXOFF: ::tcflag_t = 0x00001000;
+pub const ONLCR: ::tcflag_t = 0x4;
+pub const CSIZE: ::tcflag_t = 0x00000030;
+pub const CS6: ::tcflag_t = 0x00000010;
+pub const CS7: ::tcflag_t = 0x00000020;
+pub const CS8: ::tcflag_t = 0x00000030;
+pub const CSTOPB: ::tcflag_t = 0x00000040;
+pub const CREAD: ::tcflag_t = 0x00000080;
+pub const PARENB: ::tcflag_t = 0x00000100;
+pub const PARODD: ::tcflag_t = 0x00000200;
+pub const HUPCL: ::tcflag_t = 0x00000400;
+pub const CLOCAL: ::tcflag_t = 0x00000800;
+pub const ECHOKE: ::tcflag_t = 0x00000800;
+pub const ECHOE: ::tcflag_t = 0x00000010;
+pub const ECHOK: ::tcflag_t = 0x00000020;
+pub const ECHONL: ::tcflag_t = 0x00000040;
+pub const ECHOPRT: ::tcflag_t = 0x00000400;
+pub const ECHOCTL: ::tcflag_t = 0x00000200;
+pub const ISIG: ::tcflag_t = 0x00000001;
+pub const ICANON: ::tcflag_t = 0x00000002;
+pub const PENDIN: ::tcflag_t = 0x00004000;
+pub const NOFLSH: ::tcflag_t = 0x00000080;
+
+pub const B0: ::speed_t = 0o000000;
+pub const B50: ::speed_t = 0o000001;
+pub const B75: ::speed_t = 0o000002;
+pub const B110: ::speed_t = 0o000003;
+pub const B134: ::speed_t = 0o000004;
+pub const B150: ::speed_t = 0o000005;
+pub const B200: ::speed_t = 0o000006;
+pub const B300: ::speed_t = 0o000007;
+pub const B600: ::speed_t = 0o000010;
+pub const B1200: ::speed_t = 0o000011;
+pub const B1800: ::speed_t = 0o000012;
+pub const B2400: ::speed_t = 0o000013;
+pub const B4800: ::speed_t = 0o000014;
+pub const B9600: ::speed_t = 0o000015;
+pub const B19200: ::speed_t = 0o000016;
+pub const B38400: ::speed_t = 0o000017;
+pub const EXTA: ::speed_t = B19200;
+pub const EXTB: ::speed_t = B38400;
+pub const B57600: ::speed_t = 0o010001;
+pub const B115200: ::speed_t = 0o010002;
+pub const B230400: ::speed_t = 0o010003;
+pub const B460800: ::speed_t = 0o010004;
+pub const B500000: ::speed_t = 0o010005;
+pub const B576000: ::speed_t = 0o010006;
+pub const B921600: ::speed_t = 0o010007;
+pub const B1000000: ::speed_t = 0o010010;
+pub const B1152000: ::speed_t = 0o010011;
+pub const B1500000: ::speed_t = 0o010012;
+pub const B2000000: ::speed_t = 0o010013;
+pub const B2500000: ::speed_t = 0o010014;
+pub const B3000000: ::speed_t = 0o010015;
+pub const B3500000: ::speed_t = 0o010016;
+pub const B4000000: ::speed_t = 0o010017;
+
+cfg_if! {
+    if #[cfg(target_arch = "mips")] {
+        mod mips32;
+        pub use self::mips32::*;
+    } else if #[cfg(target_arch = "mips64")] {
+        mod mips64;
+        pub use self::mips64::*;
+    } else {
+        // Unknown target_arch
+    }
+}
copy from third_party/rust/libc/src/unix/uclibc/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/uclibc/mod.rs
copy from third_party/rust/libc/src/unix/uclibc/x86_64/mod.rs
copy to third_party/rust/libc-0.2.24/src/unix/uclibc/x86_64/mod.rs
copy from third_party/rust/libc/src/windows.rs
copy to third_party/rust/libc-0.2.24/src/windows.rs
--- a/third_party/rust/libc/.cargo-checksum.json
+++ b/third_party/rust/libc/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"85d7a35a85a0653ea7072811fd0ba37cf00df4e0b2bcc3781bfc171220046001","Cargo.toml":"7ea5ce66ef7d756befcc155bdeb4135171920a934ecd384eb9f54359a4ce547a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"8a9859c60f78d9075e22bc9f85b40e0b0216cccaeb7025c9f464cc33dcddaf5c","appveyor.yml":"483ae27670e061eb91f055699a9ad88255050b7b300f183b8580340407751bb4","ci/README.md":"be804f15e2128e5fd4b160cb0b13cff5f19e7d77b55ec5254aa6fd8731c84f0d","ci/android-accept-licenses.sh":"84ad00815f628005ed22c5d6cd14990ebc97812a7163bd275b2877904eddab53","ci/android-install-ndk.sh":"73c5f21438c024ce1b8c793184447ff9aecd83c87cbde8de580b782842b3563f","ci/android-install-sdk.sh":"891900fe4e4ceb04717b91a253753858270defc6d6401936d08c09801c1de178","ci/android-sysimage.sh":"901415631752827454c827e8c51906ba4260612e4021eda98eb7fff771c7d0e8","ci/docker/aarch64-linux-android/Dockerfile":"68f375c6e0b3716f8c0b6ed217bc6c3631fa2b86c578b983a0bf60d0344efd74","ci/docker/aarch64-unknown-linux-gnu/Dockerfile":"62ca7317439f9c303990e897450a91cd467be05eb75dfc01456d417932ac8672","ci/docker/arm-linux-androideabi/Dockerfile":"1193bf048efbeb9be3c9fac0836dcf6ae07e12cdf09b36b386dd4cbd62abbffa","ci/docker/arm-unknown-linux-gnueabihf/Dockerfile":"e349f7caa463adbde8d6ec4d2b9f7720ed81c77f48d75bbfb78c89751f55c2dc","ci/docker/i686-linux-android/Dockerfile":"7c353aecdf0b21d8584392cc6ea31d455adad769034c3ea09191a1b26a2521e1","ci/docker/i686-unknown-linux-gnu/Dockerfile":"07e9df6ba91025cbec7ae81ade63f8cfb8a54c5e1e5a8f8def0617e17bd59db0","ci/docker/i686-unknown-linux-musl/Dockerfile":"fcaedc90fbb90375186b36b4324bff0a042aae70695be0f2b632e3cf7479eae6","ci/docker/mips-unknown-linux-gnu/Dockerfile":"860299d96ee50ebdbd788e65eb6ba1f561ef66107647bddffcb2567ac350896b","ci/docker/mips-unknown-linux-musl/Dockerfile":"711c43122fa34cee83a69944493213924b0ff1fccd78c7a141cb2b2127526484","ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile":"163776e0fd38f66df7415421202ac29efc7d345a628947434e573c3885594ab5","ci/docker/mipsel-unknown-linux-musl/Dockerfile":"aef213df08da03ab6a723c3e6e5594a0586251950d81482cf53179d8e64e95c7","ci/docker/powerpc-unknown-linux-gnu/Dockerfile":"08b846a338c2ee70100f4e80db812668dc58bfb536c44a95cd1cf004d965186b","ci/docker/powerpc64-unknown-linux-gnu/Dockerfile":"4da285ffd035d16f5da9e3701841eb86049c8cfa417fa81e53da4ef74152eac0","ci/docker/x86_64-linux-android/Dockerfile":"a73a344c60575b8ef78b0178f93285ffa2e2d9aa5eb0d2e86d4bad3cab63276f","ci/docker/x86_64-rumprun-netbsd/Dockerfile":"44c3107fb30380785aaed6ff73fa334017a5bb4e3b5c7d4876154f09023a2b99","ci/docker/x86_64-unknown-freebsd/Dockerfile":"ef0f9f63065218728d2daafaa5ba71b17e4ccc23d72e859e0a7133fc64c0815e","ci/docker/x86_64-unknown-linux-gnu/Dockerfile":"67fabbc8c6ac02376cf9344251ad49ecdac396b71accb572fd1ae65225325bc0","ci/docker/x86_64-unknown-linux-musl/Dockerfile":"f71019fed5204b950843ef5e56144161fda7e27fad68ed0e8bc4353c388c7bcf","ci/docker/x86_64-unknown-openbsd/Dockerfile":"dfa5c23a6cff8c7a9a846668118c71a8406a360801fd3632fb12e8fbda6b7338","ci/dox.sh":"9ea240a4a607036235fd68c01b5d2a59f365768d103d3be774dcf34aa3ff563e","ci/ios/deploy_and_run_on_ios_simulator.rs":"3175066fd7f82390f6226d881e1a1dda9767ea2705656870e0d7774e2731800e","ci/landing-page-footer.html":"b70b3112c2147f5c967e7481061ef38bc2d79a28dd55a16fb916d9c9426da2c4","ci/landing-page-head.html":"ad69663fac7924f27d0209bc519d55838e86edfc4133713a6fd08caadac1b142","ci/run-docker.sh":"655712ba6127eb2efe2c641cf4cf1246f3e485096d72ec57b423e9d2bff6fb73","ci/run-qemu.sh":"bb859421170871ef23a8940c5e150efec0c01b95e32d2ce2d37b79a45d9d346c","ci/run.sh":"48c0318287f02889cb73a55e3e2058e79c556d11797d47a1ed66d7c55d1be12f","ci/style.rs":"60564abc1d5197ed1598426dd0d6ee9939a16d2875b03373538f58843bb616c4","src/dox.rs":"bb9a85519e0d4a8d3bfb81301759b9b938435d79da9ce2918248fb2b0df19638","src/lib.rs":"651696755aed40230cde8a505a2dfef61bea52d6349c9b9343497a5c7158ec92","src/macros.rs":"bd9802772b0e5c8b3c550d1c24307f06c0d1e4ce656b4ae1cf092142bbe5412c","src/redox.rs":"3dd158ba9fbbabe96ce2607e91dbf07b93b37c0427734118702dcb4901fe8964","src/unix/bsd/apple/b32.rs":"110ecff78da0e8d405d861447904da403d8b3f6da1f0f9dc9987633f3f04fe46","src/unix/bsd/apple/b64.rs":"2c51c1c063bfb5076ecf08fbc9371ce9473878d2e046c186eb9433955f6f8ba6","src/unix/bsd/apple/mod.rs":"8e437addefb32336671f46b93a5a8827260163abcf623c0f1613d4d685faca34","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"54b3b30c4cac35ced9197e7267f209b0f168de8a6899ab0cba290c5ae399f0e7","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"c7f46b9ae23fde5a9e245a28ed1380066e67f081323b4d253a18e9da3b97b860","src/unix/bsd/freebsdlike/freebsd/mod.rs":"ba1bd1487b41be91115a21e3968d15e4d877043ba4946cd11ed2be2ee66afc19","src/unix/bsd/freebsdlike/freebsd/x86.rs":"54311d3ebf2bb091ab22361e377e6ef9224aec2ecfe459fbfcedde4932db9c58","src/unix/bsd/freebsdlike/freebsd/x86_64.rs":"c7f46b9ae23fde5a9e245a28ed1380066e67f081323b4d253a18e9da3b97b860","src/unix/bsd/freebsdlike/mod.rs":"6b184872bf7979e5da042399a8aa3a46fff6716301f3d068912a2d6296c6ab94","src/unix/bsd/mod.rs":"c75c328dc62a621ce2a9408cb8764206e365e6f14db1bfe535a23c4728521d97","src/unix/bsd/netbsdlike/mod.rs":"50ca4e29f06669a0ebff72f2f24b2b08ff55478f580b1684e16a0cf6938a6a50","src/unix/bsd/netbsdlike/netbsd/mod.rs":"51f6f2309d59f8fb5dbd6b29ac4aa7ad431f1dddae151aef2db9f66c5f3362b0","src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/netbsd/other/mod.rs":"4d9f7091af8e166943ac6f42ce85558909e5b6e61325039bff7adfbcf4b90212","src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs":"f8cd05dacd3a3136c58da5a2fbe26f703767823b28e74fe8a2b57a7bd98d6d5c","src/unix/bsd/netbsdlike/openbsdlike/mod.rs":"97a7cdb8824949e6ca7202691bde4e1c46c2cfdeb5f3735a033448b52da1bb59","src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs":"31686679c2df5f11437a338b9281fa0dd4f8d061dcd895d67619992171e115c9","src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs":"f5d8db6f54efd05520b31b764a6bacbf612e1aebce097d2d5bfaaef3b91f37b5","src/unix/haiku/b32.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/haiku/b64.rs":"b422430c550c0ba833c9206d1350861e344e3a2eb33d7d58693efb35044be1cc","src/unix/haiku/mod.rs":"f0daa9910d2beade8be1d67bab652c239e779a27e4be54f93b7bceb7afe45d30","src/unix/mod.rs":"841d523014553865ee35355425da44fe1a31944a991831efc7c046263ad44a89","src/unix/notbsd/android/b32/arm.rs":"d63a234f3a2399bdef1fa13c6a209386cb5ddac04c90f2c6d42badc8235dc49d","src/unix/notbsd/android/b32/mod.rs":"c09b53e42b286a7ec56fb28d0a3e71ec42fecaec39b2015d1d4a3338b172c570","src/unix/notbsd/android/b32/x86.rs":"10e6879dcbf136f0e907337987a0609b357e27e0f24ccb907525fcad881c24c3","src/unix/notbsd/android/b64/aarch64.rs":"d0a25e73f8d02f8412fa9237e41d3f4993b45603a2a8f8d1690bc6624a190d42","src/unix/notbsd/android/b64/mod.rs":"172d704a50d6fb9f67683c7e66ff15b5c9f7b11e7064aa8bd129228ff074393f","src/unix/notbsd/android/b64/x86_64.rs":"a2b048dad18c60ede035645bbfea2ba3dd75197c1ee0d54fb5fcab14d6c35194","src/unix/notbsd/android/mod.rs":"25d09d308f0beb7925a3efdf1fae8412251ea04f595f6852e52114df51b6747e","src/unix/notbsd/linux/mips/mips32.rs":"003b4e204e13380cd7f1ce783a0eded0f520f4e7d25634738e8ee50fc09b07c9","src/unix/notbsd/linux/mips/mips64.rs":"a8d3e38e9f9359233db04c66d7a8de957530ad2b8596661d3ac25ea81ee44a78","src/unix/notbsd/linux/mips/mod.rs":"7157a427fabff6e970288c75cb246981e316f76f3c2bb59b254d613a8389f859","src/unix/notbsd/linux/mod.rs":"c200ff5e7c7ad5d0b4c01531384acd408057665cb49175fba0d453b08c166bcf","src/unix/notbsd/linux/musl/b32/arm.rs":"d43ba5c528926261b1ccd529ab55636254360a084ab84a7ec22a4eb5afddb8f8","src/unix/notbsd/linux/musl/b32/asmjs.rs":"085e410f990312de76f74cb9bbf9fcc27d686e94334143b34511f565d1b8bb91","src/unix/notbsd/linux/musl/b32/mips.rs":"941c88bc413ba2b87eb6a6cfe03355ee148b865f39598456965b3d04b3adbbe6","src/unix/notbsd/linux/musl/b32/mod.rs":"fc7e055edbe6fa170c2bda6b3415066c1871b3e60ebb70a6329d008f77100f0b","src/unix/notbsd/linux/musl/b32/x86.rs":"ffa5781b52a7d2774a34b1e3e2034a498b919fd96eb85e88098dba2e674a3797","src/unix/notbsd/linux/musl/b64/aarch64.rs":"4009c7eaf703472daef2a70bdac910d9fc395a33689ef2e8cf1c4e692445d3f0","src/unix/notbsd/linux/musl/b64/mod.rs":"d9b03a59a54a568b07ffa4380103a926cbb45dbfd87745edef79cd971ef31283","src/unix/notbsd/linux/musl/b64/powerpc64.rs":"dc28f5b7284235d6cf5519053cac59a1c16dc39223b71cca0871e4880755f852","src/unix/notbsd/linux/musl/b64/x86_64.rs":"43291acc0dfc92c2fec8ba6ce77ee9ca3c20bcdccec18e149f95ba911cee704b","src/unix/notbsd/linux/musl/mod.rs":"0bd97702f5c84181c53f45466fb04afb9441f6950580b6ad59257e5c73089796","src/unix/notbsd/linux/other/b32/arm.rs":"d373022fd152341ec8f5d106937c7898dd68fb4c0346bd94a37526542a605e9a","src/unix/notbsd/linux/other/b32/mod.rs":"6122be151c5d85b9df6a3aaefc5cafd0657b371cafa9cb31ed9b1a394976af45","src/unix/notbsd/linux/other/b32/powerpc.rs":"cc85e75675abc37414fc7701dda7c3f6396e7b2d3c52eea7febdc41f7b033ea9","src/unix/notbsd/linux/other/b32/x86.rs":"5a6c789355da5abf64c2a0c867d2dfd4f72f004d0bd6c476fd34172b340ea1c3","src/unix/notbsd/linux/other/b64/aarch64.rs":"ce342b37a4a60c216625c8e177a50b3f328bdfd5c527e32e06c73f4aa5926829","src/unix/notbsd/linux/other/b64/mod.rs":"bee90e8d9217ee344d0e99fd483766a1b28e8b1ded930d44a0400a5e5224bb6a","src/unix/notbsd/linux/other/b64/powerpc64.rs":"fc7131f39a75a9e35d474d70b0bc829c52590dadf472ae5785972a94ffb95f12","src/unix/notbsd/linux/other/b64/sparc64.rs":"0ba7f399349bc586ebb73d0caef5c67f195c9e3a942eabfb2efd133b4cea9872","src/unix/notbsd/linux/other/b64/x86_64.rs":"bf17645b237d8059da5e9cc0f6d2d56bc665b0946a6deb8aedf46e5b44578fa6","src/unix/notbsd/linux/other/mod.rs":"46b060787a60493e71406be35b77c24048cdc54326b65c9961fbb1fb9d354de3","src/unix/notbsd/linux/s390x.rs":"2dec96036cadd8354cd56ef8dd7018e75ae92326ec7b5963bc9cdbba0c7d694b","src/unix/notbsd/mod.rs":"bb4550e749328a3aebc450a1684c136821babc3fc161093eecb231f3998cfe8c","src/unix/solaris/mod.rs":"ba70c4ebd371f2580c1fb8f3f6cd32a391ec017e1eed9812137caa94e5149a03","src/unix/uclibc/mips/mips32.rs":"31b23e466cffb86116421ec9240b86e7419aacd84b0b1b04d23c7142c8717566","src/unix/uclibc/mips/mips64.rs":"e67eec1636a998b047d89a4cda1c99cb6bc3071db017762675179a68201c4438","src/unix/uclibc/mips/mod.rs":"74817a9b1ee3998d8e0b751a555d57225f70fd979c283c94ada344a162a8b856","src/unix/uclibc/mod.rs":"3cef4087b743e5af239a8c699c2eeaeda4e19bb57a3683736c8bd87dc71e0a2d","src/unix/uclibc/x86_64/mod.rs":"98e6685519372f7b247e3bb0008ed2ee8d94fd7cca0ed2f0b9336485c734d8a9","src/windows.rs":"acccbd341e81206cb1dc66af41762c193ac0dd719d700b64f7e26c967ee7d670"},"package":"38f5c2b18a287cf78b4097db62e20f43cace381dc76ae5c0a3073067f78b7ddc"}
\ No newline at end of file
+{"files":{".travis.yml":"33e3da6639246eb3212ea9bd97faef5e79e62e5a3d5f99645c4db09ad2a5765b","Cargo.toml":"f9db49bdc868dfb8cd96896e7d7f3cdd3bb565f8dd771d4ac91fb41817fa4444","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"c8e2baa0e92a1760d9141c9542723e19748f241fd523014b1eee289cd467650b","appveyor.yml":"7e6d9391c542881ed2a471cb80c4be2d1ce9aff313a7b5e432f899bf00e99ecc","ci/README.md":"be804f15e2128e5fd4b160cb0b13cff5f19e7d77b55ec5254aa6fd8731c84f0d","ci/android-accept-licenses.sh":"84ad00815f628005ed22c5d6cd14990ebc97812a7163bd275b2877904eddab53","ci/android-install-ndk.sh":"725db9025c5905849916bf7c910f98ff0e753484397c2a1f836d48a576d10890","ci/android-install-sdk.sh":"891900fe4e4ceb04717b91a253753858270defc6d6401936d08c09801c1de178","ci/android-sysimage.sh":"901415631752827454c827e8c51906ba4260612e4021eda98eb7fff771c7d0e8","ci/docker/aarch64-linux-android/Dockerfile":"65e4a517d4f46b8104ea3e7a322912161dec4c7c1cce1fb0d6ef3ea8ad56c7e2","ci/docker/aarch64-unknown-linux-gnu/Dockerfile":"5f430271941e1eecdf9d1a5fb701dd5622e2c4b9da03140fd829bf216e55529d","ci/docker/arm-linux-androideabi/Dockerfile":"3ea1cded5b2950abcd75d59a7ee81ef8c3de66af822c510f787ac7ead0ead4ab","ci/docker/arm-unknown-linux-gnueabihf/Dockerfile":"dbb025b53b27e406893184290836a50133ecae8295711d5e05b4e41fac9bd262","ci/docker/asmjs-unknown-emscripten/Dockerfile":"0d9aea5119c2cd136cc2c0a578105d91210e45901ac49b17c5e45f458b1c7551","ci/docker/i686-linux-android/Dockerfile":"015b2188c8baacb24eeba7cdfbe2852134a0f43d99feb859657cebce6a4959b1","ci/docker/i686-unknown-linux-gnu/Dockerfile":"c3ba1da87558ba31889a60742b938f4162c17383929da6a8d8fbcf0bbfa9dcb7","ci/docker/i686-unknown-linux-musl/Dockerfile":"4ac86fe9e159d454616396a9f3f07ce0f5d99cc4b49898b8d2486e6bdbfed9e9","ci/docker/mips-unknown-linux-gnu/Dockerfile":"6d2a9daa299003497c1d441d07b69f730ad75ee49f34520f959b5158e60072e0","ci/docker/mips-unknown-linux-musl/Dockerfile":"f9e198c21b37b930758178a1a923c9478218c49c375b01d805b339b7a458b632","ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile":"7c4d26232f1c1553a6612d9b0b3faac9887e139eaffa025f70d34113dcee812f","ci/docker/mipsel-unknown-linux-musl/Dockerfile":"519c5468e223784809de41292480ffc5d7a141c8abe0457664d38af5f49969f7","ci/docker/powerpc-unknown-linux-gnu/Dockerfile":"4b247dcc399395815ec9153c1247cc03d764896c484eddcb196d0bf8650d6311","ci/docker/powerpc64-unknown-linux-gnu/Dockerfile":"e949717a8ba5e123940729ff47ce1c45989c8b8247c576f1488f698b534e0283","ci/docker/s390x-unknown-linux-gnu/Dockerfile":"63bb605e333b8351ee2366def0cfb77f206c66f43bc2d5d9ca18ee0119fa5672","ci/docker/wasm32-unknown-emscripten/Dockerfile":"bd072d6ae91a9160693e402dd77462d3c9dd0716711e719a62af330ae479eb4e","ci/docker/wasm32-unknown-emscripten/node-wrapper.sh":"6ec19745e08690b7b5d7f882004a8a63b69ac815d66e3f8c5a38d2c3e78b962e","ci/docker/x86_64-linux-android/Dockerfile":"aeeaa540189ca712369c564c9a14cbace63217dadcfaf879a2cb40fbdeb08199","ci/docker/x86_64-rumprun-netbsd/Dockerfile":"e8f9287b267c6058eec42d1bca0007cb9a78a1d244dd8e11088368cb61fb17d6","ci/docker/x86_64-rumprun-netbsd/runtest.rs":"53302e9ed39293c1ec68ab56287593907d4aaf5bac9c1c2857b29f754a71d62b","ci/docker/x86_64-unknown-freebsd/Dockerfile":"ef0f9f63065218728d2daafaa5ba71b17e4ccc23d72e859e0a7133fc64c0815e","ci/docker/x86_64-unknown-linux-gnu/Dockerfile":"72e629004d5e1f12ed13056e91ea8a767ff3139b9ba929532a52f2163b12710b","ci/docker/x86_64-unknown-linux-musl/Dockerfile":"e145784741473150473b1bef7cc3c2cf0c6339d4fc480113ac41b4247a9b38ec","ci/dox.sh":"9ea240a4a607036235fd68c01b5d2a59f365768d103d3be774dcf34aa3ff563e","ci/emscripten-entry.sh":"1c1384b4a8b0c055d8095d9d9b2c9dccbdcdb2d5f90fdca34a1976ca8fc379c6","ci/emscripten.sh":"6f66c7b5c3d34a41afc59ceb0a8c3b0880cd6fd9a6344b874ae80bac0639ccb2","ci/ios/deploy_and_run_on_ios_simulator.rs":"3175066fd7f82390f6226d881e1a1dda9767ea2705656870e0d7774e2731800e","ci/landing-page-footer.html":"b70b3112c2147f5c967e7481061ef38bc2d79a28dd55a16fb916d9c9426da2c4","ci/landing-page-head.html":"ad69663fac7924f27d0209bc519d55838e86edfc4133713a6fd08caadac1b142","ci/run-docker.sh":"be83bc5a8b5ef913a7c9941ffca24734716028650c9a876123c4c160672c18de","ci/run-qemu.sh":"bb859421170871ef23a8940c5e150efec0c01b95e32d2ce2d37b79a45d9d346c","ci/run.sh":"60588b98057151522d0717b6e7f1c740b12c88630984a3aaf1b3c768f84ebc2e","ci/runtest-android.rs":"a07ddbdd276aedda7876c7e676774178a60d9aeab95df01275a4ee95f59e3044","ci/style.rs":"60564abc1d5197ed1598426dd0d6ee9939a16d2875b03373538f58843bb616c4","src/dox.rs":"bb9a85519e0d4a8d3bfb81301759b9b938435d79da9ce2918248fb2b0df19638","src/lib.rs":"d748ddb88f68a78de6b5c7582bd048372882ac43fa7db5b3459ece84871ee0c4","src/macros.rs":"e1b0bf5db89faa8fcb39a3fd46cdb5fdcfabb7f3524eb2192157f0188b8a764b","src/redox.rs":"40b3eb15c9fcbd3b636c8f647d0b83624359f0cc10776db944303ee35c28bfc6","src/unix/bsd/apple/b32.rs":"d107376452f731f5d8a1e6b544bdcaac826c95a383d4b20e2032f115eb9f3256","src/unix/bsd/apple/b64.rs":"ab141ad0c8c58342c06858f6f34b75eef70e58cb58e7375d460a9be6739b5e6a","src/unix/bsd/apple/mod.rs":"62113d95e0fb5463a0410d0ac2cd67c2744e629021af98908bb903a22abf55fa","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"ec88ddec5253b8dba3d56a31d8c12767c5c3e2e471e6467fde642bae868a1193","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/freebsd/mod.rs":"6a1f7dbe5b31eb9038b4e69f90c2597e37138dfb623c35786e8dd8f7ce5c8592","src/unix/bsd/freebsdlike/freebsd/x86.rs":"54311d3ebf2bb091ab22361e377e6ef9224aec2ecfe459fbfcedde4932db9c58","src/unix/bsd/freebsdlike/freebsd/x86_64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/mod.rs":"c9895c61e4b01f0b397cbd9d40c977e71774888cad85455bbb23eded85311284","src/unix/bsd/mod.rs":"d76857a17ce882ca2937105c81dd654a54ea22f69f8bb81b614a96f36dbe0bb8","src/unix/bsd/netbsdlike/mod.rs":"1b5519578130b8a525778406b6f51e783e5c8f7e4382503fb0427559967753e6","src/unix/bsd/netbsdlike/netbsd/mod.rs":"1c3c1668258762d28358000a28f68ec0f37688762bcdb373946349c531e354dc","src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/netbsd/other/mod.rs":"4d9f7091af8e166943ac6f42ce85558909e5b6e61325039bff7adfbcf4b90212","src/unix/bsd/netbsdlike/openbsdlike/bitrig.rs":"f8cd05dacd3a3136c58da5a2fbe26f703767823b28e74fe8a2b57a7bd98d6d5c","src/unix/bsd/netbsdlike/openbsdlike/mod.rs":"b1db1069f6c088fb3149e17d700c4f1cb1d969e950044044d9295916c755ec6f","src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs":"302817036aa7e7afbc82248cf66b040ef1edfbcb136c9ad243fe20f98df8d6f8","src/unix/bsd/netbsdlike/openbsdlike/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/openbsdlike/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/openbsdlike/other/mod.rs":"f5d8db6f54efd05520b31b764a6bacbf612e1aebce097d2d5bfaaef3b91f37b5","src/unix/haiku/b32.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/haiku/b64.rs":"b422430c550c0ba833c9206d1350861e344e3a2eb33d7d58693efb35044be1cc","src/unix/haiku/mod.rs":"7a5332562caf7c2d0cc17ad1947505b6ec7c1a887c53332cec0da25e7475d8b5","src/unix/mod.rs":"e7f50e86b7e32c4d4857fc5e05e64bfe9ff9a7b09b543514b22808c6096e9e7f","src/unix/newlib/arm/mod.rs":"2b6dba2e697ab9b4f4bc4dd5f28057249e9b596d1cb395a9322ec87605c4a5c4","src/unix/newlib/mod.rs":"5f10bb7d8d180bdd975f8aa2a4bd05d4d810970c6a7d1251ae46948213867ebc","src/unix/notbsd/android/b32/arm.rs":"a81acfebb008ad7a717539929dd204cfac4f82b2cffbbb665b57686ad692db64","src/unix/notbsd/android/b32/mod.rs":"e9ec6f08e20ea235cd7095604ea6e37c739c1276e9f40fa31a4db4951fa005af","src/unix/notbsd/android/b32/x86.rs":"ae2b7f1d6278caddc007749bb1d09ca33f7593478a0fd7fe98b457dae86c7814","src/unix/notbsd/android/b64/aarch64.rs":"0d8aa97b80f7790baf6f2f43defb5028fbf91cea6564bb28ed114a4e2d68bfbd","src/unix/notbsd/android/b64/mod.rs":"63290adc8122c040f9be369ef4180975bcf1a967a717aa75d30371162d5d5fa9","src/unix/notbsd/android/b64/x86_64.rs":"5547aef8dcbaa5a932559f34606fd8d89f6c9c15173d2b1412c12d39b3c1045f","src/unix/notbsd/android/mod.rs":"c642848963d685f236d57427a4a2be503e286142eca0bede8799c133be56ff1d","src/unix/notbsd/emscripten.rs":"f8d8acf5cef1acd1a6bdd41299054120820865d072c4c2e3c740fbd0c6e9b3e7","src/unix/notbsd/linux/mips/mips32.rs":"121a585f9189b28fff35c7345083dff9cc0f2dd5dadc9fa00f1669399ec7ca24","src/unix/notbsd/linux/mips/mips64.rs":"d3c232e548445eb96da07b262dd5ada4a1305e20b296c452c903803202971c27","src/unix/notbsd/linux/mips/mod.rs":"8ab59f91ac112bc4cf3f616fe4bcdb17869636e2c39f142ede9eab4fba842ebf","src/unix/notbsd/linux/mod.rs":"2508d5cb77c29fc04aa52b27dd2c287e1cfd570385fa753f6ef218aa47c95551","src/unix/notbsd/linux/musl/b32/arm.rs":"16b3aa4be930223cf7c6017ddc935638f8324d35680fa3736702a6eccdc26899","src/unix/notbsd/linux/musl/b32/mips.rs":"b1c198e9076933624de92ff3059283df863ad69aaa200160ac2c9c6a62822bc2","src/unix/notbsd/linux/musl/b32/mod.rs":"2f4d5fb5c0a93e2c572d4e86be06e240e3cd95357dd8b8cee799f0d1de588694","src/unix/notbsd/linux/musl/b32/x86.rs":"b4e8b810d694a12ccb4a9df9896b5a0ed6ebf2a69ff450c3940daa4a2bb60778","src/unix/notbsd/linux/musl/b64/aarch64.rs":"1afb00c4ebb1dfacf2b3b051ffa1ccb248a6645879ec044f0b34688104a3f173","src/unix/notbsd/linux/musl/b64/mod.rs":"3482855b3af80b665846b712ecca92c64aa345de1301f1a02e25fed2a0bf4cb6","src/unix/notbsd/linux/musl/b64/powerpc64.rs":"c5a432d9e8e2c2620d738b123d85934da16c09c1002ce0473464aba638fc3731","src/unix/notbsd/linux/musl/b64/x86_64.rs":"8156abebf9446ed90c007c72e7f0d56f831f26e601e6fe81dc07abbec3ac057d","src/unix/notbsd/linux/musl/mod.rs":"fa917a4023255e9e741553155a89a13300a2cda71489c3f4edbea5698857e9eb","src/unix/notbsd/linux/other/b32/arm.rs":"5164bc8942eb6b58bfaaf77e5b420697bea5dfe0d94072d01cc51c59fe06d053","src/unix/notbsd/linux/other/b32/mod.rs":"2c9ee30b16e469bf9e0248ab3c18cfb263f38ee802570b7fed7a85ccd8df62d7","src/unix/notbsd/linux/other/b32/powerpc.rs":"99a2dd72974d9cd32d2c308f789788c062660b883f723744e0a10db4ef234b57","src/unix/notbsd/linux/other/b32/x86.rs":"7cd050575d8b468070e69555b5e5efeee947edfaa38a2b31a6d38be396cc1214","src/unix/notbsd/linux/other/b64/aarch64.rs":"7e47143b7c06f03d644a98887f0787e48f0db1bc915e5a092f9552c7b1c70713","src/unix/notbsd/linux/other/b64/mod.rs":"c8f8ecbe6ef3edf90ddab38f8449d86f482972fa07aaa82cc9a0f78e8b63b3e2","src/unix/notbsd/linux/other/b64/powerpc64.rs":"63173445e6c463da04aeacc91ef2e83b83695f9c9be31f8634be4cd33a835c70","src/unix/notbsd/linux/other/b64/sparc64.rs":"3d5106c11130af83d022e7b265b18964069f69bbfc56d4c9cf1f449dd4a5e1bb","src/unix/notbsd/linux/other/b64/x86_64.rs":"0193dbc33521074e408360b77a9e30f242c13117138f6882695e07b334f65724","src/unix/notbsd/linux/other/mod.rs":"53a83ca2512f8c34529c6e897c26c7f06b162e3000970992645198e56f8b05bf","src/unix/notbsd/linux/s390x.rs":"5184beecb8180713664e367748050a08fd67970469340d892453f7e629822c07","src/unix/notbsd/mod.rs":"a18d1389ee1cd34752174c451f62e307ec391924d6f70f0993f3dc52de40e871","src/unix/solaris/mod.rs":"9b367b10f736b7d59b63ea4022719229331a9e081c42990d44ad8292052a275d","src/unix/uclibc/mips/mips32.rs":"31b23e466cffb86116421ec9240b86e7419aacd84b0b1b04d23c7142c8717566","src/unix/uclibc/mips/mips64.rs":"e67eec1636a998b047d89a4cda1c99cb6bc3071db017762675179a68201c4438","src/unix/uclibc/mips/mod.rs":"74817a9b1ee3998d8e0b751a555d57225f70fd979c283c94ada344a162a8b856","src/unix/uclibc/mod.rs":"7043abc1b1db74c05a73a59d853c9541c6743641575426c6cc60883e002222f4","src/unix/uclibc/x86_64/l4re.rs":"54b4e58ce5a671348c32bc41c1607dbc5c13fa6818cc3e0e0e2b409c300a305e","src/unix/uclibc/x86_64/mod.rs":"963aedbcf87972d7ac0dd3abf1e795476e13dd80a8382ef9b09c72831fc6a868","src/windows.rs":"6a79e13e727b8c7277ebcc65b390ad5494d70c65b6578cb468c5565a166048d0"},"package":"2370ca07ec338939e356443dac2296f581453c35fe1e3a3ed06023c49435f915"}
\ No newline at end of file
--- a/third_party/rust/libc/.travis.yml
+++ b/third_party/rust/libc/.travis.yml
@@ -1,9 +1,10 @@
 language: rust
+rust: stable
 sudo: required
 dist: trusty
 services:
   - docker
 install:
   - if [ -z "$NO_ADD" ]; then rustup target add $TARGET; fi
 script:
   - cargo build
@@ -17,120 +18,81 @@ script:
     fi
   - rustc ci/style.rs && ./style src
 env:
   global:
     secure: "e2/3QjgRN9atOuSHp22TrYG7QVKcYUWY48Hi9b60w+r1+BhPkTseIJLte7WefRhdXtqpjjUJTooKDhnurFOeHaCT+nmBgiv+FPU893sBl4bhesY4m0vgUJVbNZcs6lTImYekWVb+aqjGdgV/XAgCw7c3kPmrZV0MzGDWL64Xaps="
 matrix:
   include:
     # 1.0.0 compat
-    - os: linux
-      env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+    - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
       rust: 1.0.0
       script: cargo build
       install:
 
     # build documentation
-    - os: linux
-      env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+    - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
       rust: nightly
       script: sh ci/dox.sh
 
     # stable compat
-    - os: linux
-      env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
-      rust: stable
-    - os: linux
-      env: TARGET=i686-unknown-linux-gnu
-      rust: stable
+    - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+    - env: TARGET=i686-unknown-linux-gnu
     - os: osx
       env: TARGET=x86_64-apple-darwin NO_ADD=1
-      rust: stable
     - os: osx
       env: TARGET=i686-apple-darwin
-      rust: stable
-    - os: linux
-      env: TARGET=arm-linux-androideabi
-      rust: stable
-    - os: linux
-      env: TARGET=aarch64-linux-android
-      rust: stable
-    - os: linux
-      env: TARGET=i686-linux-android
-      rust: stable
-    # as of 2017/05/03 x86_64-linux-android are not on stable
-    - os: linux
-      env: TARGET=x86_64-linux-android
-      rust: beta
-    - os: linux
-      env: TARGET=x86_64-unknown-linux-musl
-      rust: stable
-    - os: linux
-      env: TARGET=i686-unknown-linux-musl
-      rust: stable
-    - os: linux
-      env: TARGET=arm-unknown-linux-gnueabihf
-      rust: stable
-    - os: linux
-      env: TARGET=aarch64-unknown-linux-gnu
-      rust: stable
+    - env: TARGET=arm-linux-androideabi
+    - env: TARGET=aarch64-linux-android
+    - env: TARGET=i686-linux-android
+    - env: TARGET=x86_64-linux-android
+    - env: TARGET=x86_64-unknown-linux-musl
+    - env: TARGET=i686-unknown-linux-musl
+    - env: TARGET=arm-unknown-linux-gnueabihf
+    - env: TARGET=aarch64-unknown-linux-gnu
     - os: osx
       osx_image: xcode8.2
       env: TARGET=i386-apple-ios
-      rust: stable
+           CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
+           RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
+      before_install:
+        rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
     - os: osx
       osx_image: xcode8.2
       env: TARGET=x86_64-apple-ios
-      rust: stable
-    - os: linux
-      env: TARGET=x86_64-rumprun-netbsd
-      rust: stable
-    - os: linux
-      env: TARGET=powerpc-unknown-linux-gnu
-      rust: stable
-    - os: linux
-      env: TARGET=powerpc64-unknown-linux-gnu
-      rust: beta
-    - os: linux
-      env: TARGET=mips-unknown-linux-musl
-      rust: stable
-    - os: linux
-      env: TARGET=mipsel-unknown-linux-musl
-      rust: stable
-    - os: linux
-      env: TARGET=mips64-unknown-linux-gnuabi64
-      rust: beta
-    - os: linux
-      env: TARGET=mips-unknown-linux-gnu
-      rust: beta
+           CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
+           RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
+      before_install:
+        rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
+    - env: TARGET=x86_64-rumprun-netbsd
+    - env: TARGET=powerpc-unknown-linux-gnu
+    - env: TARGET=powerpc64-unknown-linux-gnu
+    - env: TARGET=mips-unknown-linux-musl
+    - env: TARGET=mipsel-unknown-linux-musl
+    - env: TARGET=mips64-unknown-linux-gnuabi64
+    - env: TARGET=mips-unknown-linux-gnu
+    - env: TARGET=s390x-unknown-linux-gnu
+    - env: TARGET=asmjs-unknown-emscripten
+    - env: TARGET=wasm32-unknown-emscripten
 
     # beta
-    - os: linux
-      env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+    - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
       rust: beta
     - os: osx
       env: TARGET=x86_64-apple-darwin NO_ADD=1
       rust: beta
 
     # nightly
-    - os: linux
-      env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+    - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
       rust: nightly
     - os: osx
       env: TARGET=x86_64-apple-darwin NO_ADD=1
       rust: nightly
 
     # QEMU based targets that compile in an emulator
-    - os: linux
-      env: TARGET=x86_64-unknown-freebsd
-      rust: stable
-    - os: linux
-      env: TARGET=x86_64-unknown-openbsd QEMU=openbsd.qcow2
-      rust: stable
-      script: sh ci/run-docker.sh $TARGET
-      install:
+    - env: TARGET=x86_64-unknown-freebsd
 
 cache: cargo
 
 notifications:
   email:
     on_success: never
   webhooks: https://buildbot.rust-lang.org/homu/travis
--- a/third_party/rust/libc/Cargo.toml
+++ b/third_party/rust/libc/Cargo.toml
@@ -1,21 +1,31 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
-
 name = "libc"
-version = "0.2.24"
+version = "0.2.30"
 authors = ["The Rust Project Developers"]
-license = "MIT/Apache-2.0"
-readme = "README.md"
-repository = "https://github.com/rust-lang/libc"
+description = "A library for types and bindings to native C functions often found in libc or\nother common platform libraries.\n"
 homepage = "https://github.com/rust-lang/libc"
 documentation = "http://doc.rust-lang.org/libc"
-description = """
-A library for types and bindings to native C functions often found in libc or
-other common platform libraries.
-"""
+readme = "README.md"
+license = "MIT/Apache-2.0"
+repository = "https://github.com/rust-lang/libc"
 
 [features]
 default = ["use_std"]
 use_std = []
+[badges.travis-ci]
+repository = "rust-lang/libc"
 
-[workspace]
-members = ["libc-test", "libc-test/generate-files"]
+[badges.appveyor]
+repository = "rust-lang-libs/libc"
--- a/third_party/rust/libc/README.md
+++ b/third_party/rust/libc/README.md
@@ -88,17 +88,17 @@ 3. Send a PR to this repo.
 4. Wait for CI to pass, fixing errors.
 5. Wait for a merge!
 
 ### Test before you commit
 
 We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc):
 
 1. [`libc-test`](https://github.com/alexcrichton/ctest)
-  - `cd libc-test && cargo run`
+  - `cd libc-test && cargo test`
   - Use the `skip_*()` functions in `build.rs` if you really need a workaround.
 2. Style checker
   - `rustc ci/style.rs && ./style src`
 
 ### Releasing your change to crates.io
 
 Now that you've done the amazing job of landing your new API or your new
 platform in this crate, the next step is to get that sweet, sweet usage from
--- a/third_party/rust/libc/appveyor.yml
+++ b/third_party/rust/libc/appveyor.yml
@@ -1,9 +1,15 @@
 environment:
+  # When this was added there were revocation check failures when using the
+  # libcurl backend as libcurl checks by default, but rustup doesn't provide the
+  # switch to turn this off. Switch to Hyper which looks to not check for
+  # revocation by default like libcurl does.
+  RUSTUP_USE_HYPER: 1
+  CARGO_HTTP_CHECK_REVOKE: false
   matrix:
   - TARGET: x86_64-pc-windows-gnu
     MSYS2_BITS: 64
   - TARGET: i686-pc-windows-gnu
     MSYS2_BITS: 32
   - TARGET: x86_64-pc-windows-msvc
   - TARGET: i686-pc-windows-msvc
 install:
@@ -13,13 +19,13 @@ install:
   - if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin
   - rustc -V
   - cargo -V
 
 build: false
 
 test_script:
   - cargo test --target %TARGET%
-  - cargo run --manifest-path libc-test/Cargo.toml --target %TARGET%
+  - cargo test --manifest-path libc-test/Cargo.toml --target %TARGET%
 
 cache:
   - target
   - C:\Users\appveyor\.cargo\registry
--- a/third_party/rust/libc/ci/android-install-ndk.sh
+++ b/third_party/rust/libc/ci/android-install-ndk.sh
@@ -6,31 +6,32 @@
 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 # option. This file may not be copied, modified, or distributed
 # except according to those terms.
 
 set -ex
 
-curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
-unzip -q android-ndk-r13b-linux-x86_64.zip
+curl -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip
+unzip -q android-ndk-r15b-linux-x86_64.zip
 
 case "$1" in
   aarch64)
     arch=arm64
     ;;
 
   i686)
     arch=x86
     ;;
 
   *)
     arch=$1
     ;;
 esac;
 
-android-ndk-r13b/build/tools/make_standalone_toolchain.py \
+android-ndk-r15b/build/tools/make_standalone_toolchain.py \
+        --unified-headers \
         --install-dir /android/ndk-$1 \
         --arch $arch \
         --api 24
 
-rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b
+rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b
--- a/third_party/rust/libc/ci/docker/aarch64-linux-android/Dockerfile
+++ b/third_party/rust/libc/ci/docker/aarch64-linux-android/Dockerfile
@@ -24,9 +24,22 @@ ENV PATH=$PATH:/android/ndk-$ANDROID_ARC
 RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
 RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
 RUN mv /root/.android /tmp
 RUN chmod 777 -R /tmp/.android
 RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
 
 ENV PATH=$PATH:/rust/bin \
     CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
+    CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \
     HOME=/tmp
+
+ADD runtest-android.rs /tmp/runtest.rs
+ENTRYPOINT [ \
+  "bash", \
+  "-c", \
+  # set SHELL so android can detect a 64bits system, see
+  # http://stackoverflow.com/a/41789144
+  "SHELL=/bin/dash emulator @aarch64 -no-window & \
+   rustc /tmp/runtest.rs -o /tmp/runtest && \
+   exec \"$@\"", \
+  "--" \
+]
--- a/third_party/rust/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
+++ b/third_party/rust/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
@@ -1,7 +1,7 @@
-FROM ubuntu:16.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+FROM ubuntu:17.10
+RUN apt-get update && apt-get install -y --no-install-recommends \
   gcc libc6-dev ca-certificates \
   gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
 ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
+    CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \
     PATH=$PATH:/rust/bin
--- a/third_party/rust/libc/ci/docker/arm-linux-androideabi/Dockerfile
+++ b/third_party/rust/libc/ci/docker/arm-linux-androideabi/Dockerfile
@@ -24,9 +24,22 @@ ENV PATH=$PATH:/android/ndk-$ANDROID_ARC
 RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
 RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
 RUN mv /root/.android /tmp
 RUN chmod 777 -R /tmp/.android
 RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
 
 ENV PATH=$PATH:/rust/bin \
     CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
+    CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
     HOME=/tmp
+
+ADD runtest-android.rs /tmp/runtest.rs
+ENTRYPOINT [ \
+  "bash", \
+  "-c", \
+  # set SHELL so android can detect a 64bits system, see
+  # http://stackoverflow.com/a/41789144
+  "SHELL=/bin/dash emulator @arm -no-window & \
+   rustc /tmp/runtest.rs -o /tmp/runtest && \
+   exec \"$@\"", \
+  "--" \
+]
--- a/third_party/rust/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
+++ b/third_party/rust/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
@@ -1,7 +1,7 @@
-FROM ubuntu:16.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+FROM ubuntu:17.10
+RUN apt-get update && apt-get install -y --no-install-recommends \
   gcc libc6-dev ca-certificates \
   gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user
 ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
+    CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \
     PATH=$PATH:/rust/bin
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile
@@ -0,0 +1,20 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+    ca-certificates \
+    curl \
+    gcc \
+    git \
+    libc6-dev \
+    python \
+    xz-utils
+
+COPY emscripten.sh /
+RUN bash /emscripten.sh
+
+ENV PATH=$PATH:/rust/bin \
+    CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node
+
+COPY emscripten-entry.sh /
+ENTRYPOINT ["/emscripten-entry.sh"]
--- a/third_party/rust/libc/ci/docker/i686-linux-android/Dockerfile
+++ b/third_party/rust/libc/ci/docker/i686-linux-android/Dockerfile
@@ -24,9 +24,22 @@ ENV PATH=$PATH:/android/ndk-$ANDROID_ARC
 RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
 RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
 RUN mv /root/.android /tmp
 RUN chmod 777 -R /tmp/.android
 RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
 
 ENV PATH=$PATH:/rust/bin \
     CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
+    CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
     HOME=/tmp
+
+ADD runtest-android.rs /tmp/runtest.rs
+ENTRYPOINT [ \
+  "bash", \
+  "-c", \
+  # set SHELL so android can detect a 64bits system, see
+  # http://stackoverflow.com/a/41789144
+  "SHELL=/bin/dash emulator @i686 -no-window -no-accel & \
+   rustc /tmp/runtest.rs -o /tmp/runtest && \
+   exec \"$@\"", \
+  "--" \
+]
--- a/third_party/rust/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile
+++ b/third_party/rust/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile
@@ -1,5 +1,5 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 RUN apt-get update
 RUN apt-get install -y --no-install-recommends \
   gcc-multilib libc6-dev ca-certificates
 ENV PATH=$PATH:/rust/bin
--- a/third_party/rust/libc/ci/docker/i686-unknown-linux-musl/Dockerfile
+++ b/third_party/rust/libc/ci/docker/i686-unknown-linux-musl/Dockerfile
@@ -1,9 +1,9 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 
 RUN dpkg --add-architecture i386
 RUN apt-get update
 RUN apt-get install -y --no-install-recommends \
   gcc-multilib make libc6-dev git curl ca-certificates libc6:i386
 # Below we're cross-compiling musl for i686 using the system compiler on an
 # x86_64 system. This is an awkward thing to be doing and so we have to jump
 # through a couple hoops to get musl to be happy. In particular:
@@ -13,11 +13,18 @@ RUN apt-get install -y --no-install-reco
 # * We manually unset CROSS_COMPILE when running make; otherwise the makefile
 #   will call the non-existent binary 'i686-ar'.
 RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
     tar xzf - && \
     cd musl-1.1.15 && \
     CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
     make CROSS_COMPILE= install -j4 && \
     cd .. && \
-    rm -rf musl-1.1.15
+    rm -rf musl-1.1.15 && \
+# Install linux kernel headers sanitized for use with musl
+    curl -L  https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
+    tar xzf - && \
+    cd kernel-headers-3.12.6-5 && \
+    make ARCH=i386 prefix=/musl-i686 install -j4 && \
+    cd .. && \
+    rm -rf kernel-headers-3.12.6-5
 ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
     CC_i686_unknown_linux_musl=musl-gcc
--- a/third_party/rust/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile
+++ b/third_party/rust/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile
@@ -1,10 +1,10 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
         gcc libc6-dev qemu-user ca-certificates \
         gcc-mips-linux-gnu libc6-dev-mips-cross \
         qemu-system-mips
 
 ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
+    CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \
     PATH=$PATH:/rust/bin
--- a/third_party/rust/libc/ci/docker/mips-unknown-linux-musl/Dockerfile
+++ b/third_party/rust/libc/ci/docker/mips-unknown-linux-musl/Dockerfile
@@ -1,17 +1,17 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
         gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
         bzip2
 
 RUN mkdir /toolchain
 
 # Note that this originally came from:
 # https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
 RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
       tar xjf - -C /toolchain --strip-components=1
 
 ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \
     CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
-    CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc
+    CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \
+    CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15"
--- a/third_party/rust/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
+++ b/third_party/rust/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
@@ -1,11 +1,11 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
         gcc libc6-dev qemu-user ca-certificates \
         gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
         qemu-system-mips64
 
 ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
+    CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \
     CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
     PATH=$PATH:/rust/bin
--- a/third_party/rust/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile
+++ b/third_party/rust/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile
@@ -1,17 +1,17 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
         gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
         bzip2
 
 RUN mkdir /toolchain
 
 # Note that this originally came from:
 # https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
 RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
       tar xjf - -C /toolchain --strip-components=2
 
 ENV PATH=$PATH:/rust/bin:/toolchain/bin \
     CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
-    CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc
+    CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \
+    CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain"
--- a/third_party/rust/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
+++ b/third_party/rust/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
@@ -1,10 +1,10 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
         gcc libc6-dev qemu-user ca-certificates \
         gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \
         qemu-system-ppc
 
 ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
+    CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \
     PATH=$PATH:/rust/bin
--- a/third_party/rust/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
+++ b/third_party/rust/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
@@ -1,11 +1,11 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
         gcc libc6-dev qemu-user ca-certificates \
         gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \
         qemu-system-ppc
 
 ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
+    CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \
     CC=powerpc64-linux-gnu-gcc \
     PATH=$PATH:/rust/bin
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile
@@ -0,0 +1,12 @@
+FROM ubuntu:17.10
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+        gcc libc6-dev qemu-user ca-certificates \
+        gcc-s390x-linux-gnu libc6-dev-s390x-cross
+
+ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
+    # TODO: in theory we should execute this, but qemu segfaults immediately :(
+    # CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu" \
+    CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER=true \
+    CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \
+    PATH=$PATH:/rust/bin
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile
@@ -0,0 +1,21 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+    ca-certificates \
+    curl \
+    gcc \
+    git \
+    libc6-dev \
+    python \
+    xz-utils
+
+COPY emscripten.sh /
+RUN bash /emscripten.sh
+
+ENV PATH=$PATH:/rust/bin \
+    CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh
+
+COPY emscripten-entry.sh /
+COPY docker/wasm32-unknown-emscripten/node-wrapper.sh /usr/local/bin/node-wrapper.sh
+ENTRYPOINT ["/emscripten-entry.sh"]
new file mode 100755
--- /dev/null
+++ b/third_party/rust/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+me=$1
+shift
+dir=$(dirname $me)
+file=$(basename $me)
+
+cd $dir
+exec node $file "$@"
--- a/third_party/rust/libc/ci/docker/x86_64-linux-android/Dockerfile
+++ b/third_party/rust/libc/ci/docker/x86_64-linux-android/Dockerfile
@@ -12,15 +12,15 @@ RUN apt-get update && \
 WORKDIR /android/
 ENV ANDROID_ARCH=x86_64
 COPY android-install-ndk.sh /android/
 RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
 
 # We do not run x86_64-linux-android tests on an android emulator.
 # See ci/android-sysimage.sh for informations about how tests are run.
 COPY android-sysimage.sh /android/
-RUN bash /android/android-sysimage.sh x86_64 x86_64-21_r04.zip
+RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip
 
 ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \
     CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
     CC_x86_64_linux_android=x86_64-linux-android-gcc \
     CXX_x86_64_linux_android=x86_64-linux-android-g++ \
     HOME=/tmp
--- a/third_party/rust/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile
+++ b/third_party/rust/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile
@@ -1,6 +1,10 @@
 FROM mato/rumprun-toolchain-hw-x86_64
 USER root
 RUN apt-get update
 RUN apt-get install -y --no-install-recommends \
   qemu
-ENV PATH=$PATH:/rust/bin
+ENV PATH=$PATH:/rust/bin \
+    CARGO_TARGET_X86_64_RUMPRUN_NETBSD_RUNNER=/tmp/runtest
+
+ADD docker/x86_64-rumprun-netbsd/runtest.rs /tmp/
+ENTRYPOINT ["sh", "-c", "rustc /tmp/runtest.rs -o /tmp/runtest && exec \"$@\"", "--"]
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs
@@ -0,0 +1,54 @@
+use std::env;
+use std::process::{Command, Stdio};
+use std::sync::mpsc;
+use std::thread;
+use std::time::Duration;
+use std::io::{BufRead, BufReader, Read};
+
+fn main() {
+    assert_eq!(env::args().len(), 2);
+
+    let status = Command::new("rumprun-bake")
+        .arg("hw_virtio")
+        .arg("/tmp/libc-test.img")
+        .arg(env::args().nth(1).unwrap())
+        .status()
+        .expect("failed to run rumprun-bake");
+    assert!(status.success());
+
+    let mut child = Command::new("qemu-system-x86_64")
+        .arg("-nographic")
+        .arg("-vga").arg("none")
+        .arg("-m").arg("64")
+        .arg("-kernel").arg("/tmp/libc-test.img")
+        .stdout(Stdio::piped())
+        .stderr(Stdio::piped())
+        .spawn()
+        .expect("failed to spawn qemu");
+
+    let mut stdout = child.stdout.take().unwrap();
+    let mut stderr = child.stderr.take().unwrap();
+    let (tx, rx) = mpsc::channel();
+    let tx2 = tx.clone();
+    let t1 = thread::spawn(move || find_ok(&mut stdout, tx));
+    let t2 = thread::spawn(move || find_ok(&mut stderr, tx2));
+
+    let res = rx.recv_timeout(Duration::new(5, 0));
+    child.kill().unwrap();
+    t1.join().unwrap();
+    t2.join().unwrap();
+
+    if res.is_err() {
+        panic!("didn't find success");
+    }
+}
+
+fn find_ok(input: &mut Read, tx: mpsc::Sender<()>) {
+    for line in BufReader::new(input).lines() {
+        let line = line.unwrap();
+        println!("{}", line);
+        if line.starts_with("PASSED ") && line.contains(" tests") {
+            tx.send(()).unwrap();
+        }
+    }
+}
--- a/third_party/rust/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
+++ b/third_party/rust/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
@@ -1,5 +1,5 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 RUN apt-get update
 RUN apt-get install -y --no-install-recommends \
   gcc libc6-dev ca-certificates
 ENV PATH=$PATH:/rust/bin
--- a/third_party/rust/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile
+++ b/third_party/rust/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile
@@ -1,13 +1,20 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
 
 RUN apt-get update
 RUN apt-get install -y --no-install-recommends \
   gcc make libc6-dev git curl ca-certificates
 RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
     tar xzf - && \
     cd musl-1.1.15 && \
     ./configure --prefix=/musl-x86_64 && \
     make install -j4 && \
     cd .. && \
-    rm -rf musl-1.1.15
+    rm -rf musl-1.1.15 && \
+# Install linux kernel headers sanitized for use with musl
+    curl -L  https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
+    tar xzf - && \
+    cd kernel-headers-3.12.6-5 && \
+    make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \
+    cd .. && \
+    rm -rf kernel-headers-3.12.6-5
 ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin
new file mode 100755
--- /dev/null
+++ b/third_party/rust/libc/ci/emscripten-entry.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+source /emsdk-portable/emsdk_env.sh &> /dev/null
+
+# emsdk-portable provides a node binary, but we need version 8 to run wasm
+export PATH="/node-v8.0.0-linux-x64/bin:$PATH"
+
+exec "$@"
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/ci/emscripten.sh
@@ -0,0 +1,54 @@
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+hide_output() {
+  set +x
+  on_err="
+echo ERROR: An error was encountered with the build.
+cat /tmp/build.log
+exit 1
+"
+  trap "$on_err" ERR
+  bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
+  PING_LOOP_PID=$!
+  $@ &> /tmp/build.log
+  trap - ERR
+  kill $PING_LOOP_PID
+  rm -f /tmp/build.log
+  set -x
+}
+
+cd /
+curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
+    tar -xz
+
+cd /emsdk-portable
+./emsdk update
+hide_output ./emsdk install sdk-1.37.20-64bit
+./emsdk activate sdk-1.37.20-64bit
+
+# Compile and cache libc
+source ./emsdk_env.sh
+echo "main(){}" > a.c
+HOME=/emsdk-portable/ emcc a.c
+HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
+rm -f a.*
+
+# Make emsdk usable by any user
+cp /root/.emscripten /emsdk-portable
+chmod a+rxw -R /emsdk-portable
+
+# node 8 is required to run wasm
+cd /
+curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
+    tar -xJ
+
old mode 100644
new mode 100755
--- a/third_party/rust/libc/ci/run-docker.sh
+++ b/third_party/rust/libc/ci/run-docker.sh
@@ -9,25 +9,25 @@ run() {
     docker build -t libc -f ci/docker/$1/Dockerfile ci/
     mkdir -p target
     if [ -w /dev/kvm ]; then
       kvm="--volume /dev/kvm:/dev/kvm"
     fi
     docker run \
       --user `id -u`:`id -g` \
       --rm \
+      --init \
       --volume $HOME/.cargo:/cargo \
       $kvm \
       --env CARGO_HOME=/cargo \
       --volume `rustc --print sysroot`:/rust:ro \
       --volume `pwd`:/checkout:ro \
       --volume `pwd`/target:/checkout/target \
       --env CARGO_TARGET_DIR=/checkout/target \
       --workdir /checkout \
-      --privileged \
       libc \
       ci/run.sh $1
 }
 
 if [ -z "$1" ]; then
   for d in `ls ci/docker/`; do
     run $d
   done
--- a/third_party/rust/libc/ci/run.sh
+++ b/third_party/rust/libc/ci/run.sh
@@ -34,46 +34,21 @@ if [ "$QEMU" != "" ]; then
   fi
 
   # Create a mount a fresh new filesystem image that we'll later pass to QEMU.
   # This will have a `run.sh` script will which use the artifacts inside to run
   # on the host.
   rm -f $tmpdir/libc-test.img
   mkdir $tmpdir/mount
 
-  # If we have a cross compiler, then we just do the standard rigamarole of
-  # cross-compiling an executable and then the script to run just executes the
-  # binary.
-  #
-  # If we don't have a cross-compiler, however, then we need to do some crazy
-  # acrobatics to get this to work.  Generate all.{c,rs} on the host which will
-  # be compiled inside QEMU. Do this here because compiling syntex_syntax in
-  # QEMU would time out basically everywhere.
-  if [ "$CAN_CROSS" = "1" ]; then
-    cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
-    cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/
-    echo 'exec $1/libc-test' > $tmpdir/mount/run.sh
-  else
-    rm -rf $tmpdir/generated
-    mkdir -p $tmpdir/generated
-    cargo build --manifest-path libc-test/generate-files/Cargo.toml
-    (cd libc-test && TARGET=$TARGET OUT_DIR=$tmpdir/generated SKIP_COMPILE=1 \
-      $CARGO_TARGET_DIR/debug/generate-files)
-
-    # Copy this folder into the mounted image, the `run.sh` entry point, and
-    # overwrite the standard libc-test Cargo.toml with the overlay one which will
-    # assume the all.{c,rs} test files have already been generated
-    mkdir $tmpdir/mount/libc
-    cp -r Cargo.* libc-test src ci $tmpdir/mount/libc/
-    ln -s libc-test/target $tmpdir/mount/libc/target
-    cp ci/run-qemu.sh $tmpdir/mount/run.sh
-    echo $TARGET | tee -a $tmpdir/mount/TARGET
-    cp $tmpdir/generated/* $tmpdir/mount/libc/libc-test
-    cp libc-test/run-generated-Cargo.toml $tmpdir/mount/libc/libc-test/Cargo.toml
-  fi
+  # Do the standard rigamarole of cross-compiling an executable and then the
+  # script to run just executes the binary.
+  cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
+  cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/
+  echo 'exec $1/libc-test' > $tmpdir/mount/run.sh
 
   du -sh $tmpdir/mount
   genext2fs \
       --root $tmpdir/mount \
       --size-in-blocks 100000 \
       $tmpdir/libc-test.img
 
   # Pass -snapshot to prevent tampering with the disk images, this helps when
@@ -88,95 +63,9 @@ if [ "$QEMU" != "" ]; then
     -drive if=virtio,file=$tmpdir/libc-test.img \
     -net nic,model=virtio \
     -net user \
     -nographic \
     -vga none 2>&1 | tee $CARGO_TARGET_DIR/out.log
   exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
 fi
 
-case "$TARGET" in
-  *-apple-ios)
-    cargo rustc --manifest-path libc-test/Cargo.toml --target $TARGET -- \
-        -C link-args=-mios-simulator-version-min=7.0
-    ;;
-
-  *)
-    cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
-    ;;
-esac
-
-case "$TARGET" in
-  # Android emulator for x86_64 does not work on travis (missing hardware
-  # acceleration). Tests are run on case *). See ci/android-sysimage.sh for
-  # informations about how tests are run.
-  arm-linux-androideabi | aarch64-linux-android | i686-linux-android)
-    # set SHELL so android can detect a 64bits system, see
-    # http://stackoverflow.com/a/41789144
-    # https://issues.jenkins-ci.org/browse/JENKINS-26930?focusedCommentId=230791&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230791
-    export SHELL=/bin/dash
-    arch=$(echo $TARGET | cut -d- -f1)
-    accel="-no-accel"
-    if emulator -accel-check; then
-      accel=""
-    fi
-    emulator @$arch -no-window $accel &
-    adb wait-for-device
-    adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/local/tmp/libc-test
-    adb shell /data/local/tmp/libc-test 2>&1 | tee /tmp/out
-    grep "^PASSED .* tests" /tmp/out
-    ;;
-
-  i386-apple-ios)
-    rustc -O ./ci/ios/deploy_and_run_on_ios_simulator.rs
-    ./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  x86_64-apple-ios)
-    rustc -O ./ci/ios/deploy_and_run_on_ios_simulator.rs
-    ./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  arm-unknown-linux-gnueabihf)
-    qemu-arm -L /usr/arm-linux-gnueabihf $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  mips-unknown-linux-gnu)
-    qemu-mips -L /usr/mips-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  mips64-unknown-linux-gnuabi64)
-    qemu-mips64 -L /usr/mips64-linux-gnuabi64 $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  mips-unknown-linux-musl)
-    qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15 \
-              $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  mipsel-unknown-linux-musl)
-      qemu-mipsel -L /toolchain $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-      ;;
-
-  powerpc-unknown-linux-gnu)
-    qemu-ppc -L /usr/powerpc-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  powerpc64-unknown-linux-gnu)
-    qemu-ppc64 -L /usr/powerpc64-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  aarch64-unknown-linux-gnu)
-    qemu-aarch64 -L /usr/aarch64-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-
-  *-rumprun-netbsd)
-    rumprun-bake hw_virtio /tmp/libc-test.img $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    qemu-system-x86_64 -nographic -vga none -m 64 \
-        -kernel /tmp/libc-test.img 2>&1 | tee /tmp/out &
-    sleep 5
-    grep "^PASSED .* tests" /tmp/out
-    ;;
-
-  *)
-    $CARGO_TARGET_DIR/$TARGET/debug/libc-test
-    ;;
-esac
+exec cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/ci/runtest-android.rs
@@ -0,0 +1,41 @@
+use std::env;
+use std::process::Command;
+use std::path::{Path, PathBuf};
+
+fn main() {
+    assert_eq!(env::args_os().len(), 2);
+    let test = PathBuf::from(env::args_os().nth(1).unwrap());
+    let dst = Path::new("/data/local/tmp").join(test.file_name().unwrap());
+
+    let status = Command::new("adb")
+        .arg("wait-for-device")
+        .status()
+        .expect("failed to run rumprun-bake");
+    assert!(status.success());
+
+    let status = Command::new("adb")
+        .arg("push")
+        .arg(&test)
+        .arg(&dst)
+        .status()
+        .expect("failed to run rumprun-bake");
+    assert!(status.success());
+
+    let output = Command::new("adb")
+        .arg("shell")
+        .arg(&dst)
+        .output()
+        .expect("failed to run rumprun-bake");
+    assert!(status.success());
+
+    println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
+             output.status,
+             String::from_utf8_lossy(&output.stdout),
+             String::from_utf8_lossy(&output.stderr));
+
+    let stdout = String::from_utf8_lossy(&output.stdout);
+    let mut lines = stdout.lines().filter(|l| l.starts_with("PASSED "));
+    if !lines.any(|l| l.contains(" tests")) {
+        panic!("failed to find successful test run");
+    }
+}
--- a/third_party/rust/libc/src/lib.rs
+++ b/third_party/rust/libc/src/lib.rs
@@ -67,16 +67,22 @@
     html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-bitrig"
 ))]
 #![cfg_attr(target_os = "netbsd", doc(
     html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-netbsd"
 ))]
 #![cfg_attr(target_os = "dragonfly", doc(
     html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly"
 ))]
+#![cfg_attr(all(target_os = "emscripten", target_arch = "asmjs"), doc(
+    html_root_url = "https://doc.rust-lang.org/libc/asmjs-unknown-emscripten"
+))]
+#![cfg_attr(all(target_os = "emscripten", target_arch = "wasm32"), doc(
+    html_root_url = "https://doc.rust-lang.org/libc/wasm32-unknown-emscripten"
+))]
 
 // Attributes needed when building as part of the standard library
 #![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))]
 #![cfg_attr(stdbuild, feature(link_cfg))]
 #![cfg_attr(stdbuild, no_std)]
 #![cfg_attr(stdbuild, staged_api)]
 #![cfg_attr(stdbuild, allow(warnings))]
 #![cfg_attr(stdbuild, unstable(feature = "libc",
--- a/third_party/rust/libc/src/macros.rs
+++ b/third_party/rust/libc/src/macros.rs
@@ -64,45 +64,8 @@ macro_rules! f {
             loop {}
         }
     )*)
 }
 
 macro_rules! __item {
     ($i:item) => ($i)
 }
-
-#[cfg(test)]
-mod tests {
-    cfg_if! {
-        if #[cfg(test)] {
-            use std::option::Option as Option2;
-            fn works1() -> Option2<u32> { Some(1) }
-        } else {
-            fn works1() -> Option<u32> { None }
-        }
-    }
-
-    cfg_if! {
-        if #[cfg(foo)] {
-            fn works2() -> bool { false }
-        } else if #[cfg(test)] {
-            fn works2() -> bool { true }
-        } else {
-            fn works2() -> bool { false }
-        }
-    }
-
-    cfg_if! {
-        if #[cfg(foo)] {
-            fn works3() -> bool { false }
-        } else {
-            fn works3() -> bool { true }
-        }
-    }
-
-    #[test]
-    fn it_works() {
-        assert!(works1().is_some());
-        assert!(works2());
-        assert!(works3());
-    }
-}
--- a/third_party/rust/libc/src/redox.rs
+++ b/third_party/rust/libc/src/redox.rs
@@ -1,15 +1,15 @@
 pub type c_char = i8;
 pub type c_long = i64;
 pub type c_ulong = u64;
 
 pub type wchar_t = i16;
 
-pub type off_t = usize;
+pub type off_t = c_long;
 pub type mode_t = u16;
 pub type time_t = i64;
 pub type pid_t = usize;
 pub type gid_t = usize;
 pub type uid_t = usize;
 
 pub type in_addr_t = u32;
 pub type in_port_t = u16;
@@ -43,15 +43,54 @@ s! {
         pub sin6_family: sa_family_t,
         pub sin6_port: in_port_t,
         pub sin6_flowinfo: u32,
         pub sin6_addr: ::in6_addr,
         pub sin6_scope_id: u32,
     }
 }
 
+pub const STDIN_FILENO: ::c_int = 0;
+pub const STDOUT_FILENO: ::c_int = 1;
+pub const STDERR_FILENO: ::c_int = 2;
+
+pub const EXIT_FAILURE: ::c_int = 1;
+pub const EXIT_SUCCESS: ::c_int = 0;
+
+pub const S_ISUID: ::c_int = 0x800;
+pub const S_ISGID: ::c_int = 0x400;
+pub const S_ISVTX: ::c_int = 0x200;
+
+pub const S_IFIFO: mode_t = 0x1000;
+pub const S_IFCHR: mode_t = 0x2000;
+pub const S_IFBLK: mode_t = 0x6000;
+pub const S_IFDIR: mode_t = 0x4000;
+pub const S_IFREG: mode_t = 0x8000;
+pub const S_IFLNK: mode_t = 0xA000;
+pub const S_IFSOCK: mode_t = 0xC000;
+pub const S_IFMT: mode_t = 0xF000;
+pub const S_IEXEC: mode_t = 0x40;
+pub const S_IWRITE: mode_t = 0x80;
+pub const S_IREAD: mode_t = 0x100;
+pub const S_IRWXU: mode_t = 0x1C0;
+pub const S_IXUSR: mode_t = 0x40;
+pub const S_IWUSR: mode_t = 0x80;
+pub const S_IRUSR: mode_t = 0x100;
+pub const S_IRWXG: mode_t = 0x38;
+pub const S_IXGRP: mode_t = 0x8;
+pub const S_IWGRP: mode_t = 0x10;
+pub const S_IRGRP: mode_t = 0x20;
+pub const S_IRWXO: mode_t = 0x7;
+pub const S_IXOTH: mode_t = 0x1;
+pub const S_IWOTH: mode_t = 0x2;
+pub const S_IROTH: mode_t = 0x4;
+
 extern {
     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
+    pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
+                -> ::ssize_t;
+    pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
+                 -> ::ssize_t;
 }
 
 #[link(name = "c")]
 #[link(name = "m")]
 extern {}
--- a/third_party/rust/libc/src/unix/bsd/apple/b32.rs
+++ b/third_party/rust/libc/src/unix/bsd/apple/b32.rs
@@ -1,19 +1,53 @@
 //! 32-bit specific Apple (ios/darwin) definitions
 
 pub type c_long = i32;
 pub type c_ulong = u32;
+pub type boolean_t = ::c_int;
 
 s! {
     pub struct pthread_attr_t {
         __sig: c_long,
         __opaque: [::c_char; 36]
     }
+
+    pub struct if_data {
+        pub ifi_type: ::c_uchar,
+        pub ifi_typelen: ::c_uchar,
+        pub ifi_physical: ::c_uchar,
+        pub ifi_addrlen: ::c_uchar,
+        pub ifi_hdrlen: ::c_uchar,
+        pub ifi_recvquota: ::c_uchar,
+        pub ifi_xmitquota: ::c_uchar,
+        pub ifi_unused1: ::c_uchar,
+        pub ifi_mtu: u32,
+        pub ifi_metric: u32,
+        pub ifi_baudrate: u32,
+        pub ifi_ipackets: u32,
+        pub ifi_ierrors: u32,
+        pub ifi_opackets: u32,
+        pub ifi_oerrors: u32,
+        pub ifi_collisions: u32,
+        pub ifi_ibytes: u32,
+        pub ifi_obytes: u32,
+        pub ifi_imcasts: u32,
+        pub ifi_omcasts: u32,
+        pub ifi_iqdrops: u32,
+        pub ifi_noproto: u32,
+        pub ifi_recvtiming: u32,
+        pub ifi_xmittiming: u32,
+        pub ifi_lastchange: ::timeval,
+        pub ifi_unused2: u32,
+        pub ifi_hwassist: u32,
+        pub ifi_reserved1: u32,
+        pub ifi_reserved2: u32,
+    }
 }
 
 pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
 pub const __PTHREAD_COND_SIZE__: usize = 24;
 pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
 pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
+pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12;
 
 pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
 pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458;
--- a/third_party/rust/libc/src/unix/bsd/apple/b64.rs
+++ b/third_party/rust/libc/src/unix/bsd/apple/b64.rs
@@ -1,21 +1,60 @@
 //! 64-bit specific Apple (ios/darwin) definitions
 
 pub type c_long = i64;
 pub type c_ulong = u64;
+pub type boolean_t = ::c_uint;
 
 s! {
     pub struct pthread_attr_t {
         __sig: c_long,
         __opaque: [::c_char; 56]
     }
+
+    pub struct timeval32 {
+        pub tv_sec: i32,
+        pub tv_usec: i32,
+    }
+
+    pub struct if_data {
+        pub ifi_type: ::c_uchar,
+        pub ifi_typelen: ::c_uchar,
+        pub ifi_physical: ::c_uchar,
+        pub ifi_addrlen: ::c_uchar,
+        pub ifi_hdrlen: ::c_uchar,
+        pub ifi_recvquota: ::c_uchar,
+        pub ifi_xmitquota: ::c_uchar,
+        pub ifi_unused1: ::c_uchar,
+        pub ifi_mtu: u32,
+        pub ifi_metric: u32,
+        pub ifi_baudrate: u32,
+        pub ifi_ipackets: u32,
+        pub ifi_ierrors: u32,
+        pub ifi_opackets: u32,
+        pub ifi_oerrors: u32,
+        pub ifi_collisions: u32,
+        pub ifi_ibytes: u32,
+        pub ifi_obytes: u32,
+        pub ifi_imcasts: u32,
+        pub ifi_omcasts: u32,
+        pub ifi_iqdrops: u32,
+        pub ifi_noproto: u32,
+        pub ifi_recvtiming: u32,
+        pub ifi_xmittiming: u32,
+        pub ifi_lastchange: timeval32,
+        pub ifi_unused2: u32,
+        pub ifi_hwassist: u32,
+        pub ifi_reserved1: u32,
+        pub ifi_reserved2: u32,
+    }
 }
 
 pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
 pub const __PTHREAD_COND_SIZE__: usize = 40;
 pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
 pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
+pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
 
 pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
 pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;
 
 pub const FIONREAD: ::c_ulong = 0x4004667f;
--- a/third_party/rust/libc/src/unix/bsd/apple/mod.rs
+++ b/third_party/rust/libc/src/unix/bsd/apple/mod.rs
@@ -141,16 +141,21 @@ s! {
         __opaque: [u8; __PTHREAD_CONDATTR_SIZE__],
     }
 
     pub struct pthread_rwlock_t {
         __sig: ::c_long,
         __opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
     }
 
+    pub struct pthread_rwlockattr_t {
+        __sig: ::c_long,
+        __opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
+    }
+
     pub struct siginfo_t {
         pub si_signo: ::c_int,
         pub si_errno: ::c_int,
         pub si_code: ::c_int,
         pub si_pid: ::pid_t,
         pub si_uid: ::uid_t,
         pub si_status: ::c_int,
         pub si_addr: *mut ::c_void,
@@ -258,16 +263,26 @@ s! {
         pub dqb_isoftlimit: ::uint32_t,
         pub dqb_curinodes: ::uint32_t,
         pub dqb_btime: ::uint32_t,
         pub dqb_itime: ::uint32_t,
         pub dqb_id: ::uint32_t,
         pub dqb_spare: [::uint32_t; 4],
     }
 
+    pub struct if_msghdr {
+        pub ifm_msglen: ::c_ushort,
+        pub ifm_version: ::c_uchar,
+        pub ifm_type: ::c_uchar,
+        pub ifm_addrs: ::c_int,
+        pub ifm_flags: ::c_int,
+        pub ifm_index: ::c_ushort,
+        pub ifm_data: if_data,
+    }
+
     pub struct termios {
         pub c_iflag: ::tcflag_t,
         pub c_oflag: ::tcflag_t,
         pub c_cflag: ::tcflag_t,
         pub c_lflag: ::tcflag_t,
         pub c_cc: [::cc_t; ::NCCS],
         pub c_ispeed: ::speed_t,
         pub c_ospeed: ::speed_t,
@@ -317,16 +332,89 @@ s! {
 
     pub struct sigevent {
         pub sigev_notify: ::c_int,
         pub sigev_signo: ::c_int,
         pub sigev_value: ::sigval,
         __unused1: *mut ::c_void,       //actually a function pointer
         pub sigev_notify_attributes: *mut ::pthread_attr_t
     }
+
+    pub struct proc_taskinfo {
+        pub pti_virtual_size: u64,
+        pub pti_resident_size: u64,
+        pub pti_total_user: u64,
+        pub pti_total_system: u64,
+        pub pti_threads_user: u64,
+        pub pti_threads_system: u64,
+        pub pti_policy: i32,
+        pub pti_faults: i32,
+        pub pti_pageins: i32,
+        pub pti_cow_faults: i32,
+        pub pti_messages_sent: i32,
+        pub pti_messages_received: i32,
+        pub pti_syscalls_mach: i32,
+        pub pti_syscalls_unix: i32,
+        pub pti_csw: i32,
+        pub pti_threadnum: i32,
+        pub pti_numrunning: i32,
+        pub pti_priority: i32,
+    }
+
+    pub struct proc_bsdinfo {
+        pub pbi_flags: u32,
+        pub pbi_status: u32,
+        pub pbi_xstatus: u32,
+        pub pbi_pid: u32,
+        pub pbi_ppid: u32,
+        pub pbi_uid: ::uid_t,
+        pub pbi_gid: ::gid_t,
+        pub pbi_ruid: ::uid_t,
+        pub pbi_rgid: ::gid_t,
+        pub pbi_svuid: ::uid_t,
+        pub pbi_svgid: ::gid_t,
+        pub rfu_1: u32,
+        pub pbi_comm: [::c_char; MAXCOMLEN],
+        pub pbi_name: [::c_char; 32], // MAXCOMLEN * 2, but macro isn't happy...
+        pub pbi_nfiles: u32,
+        pub pbi_pgid: u32,
+        pub pbi_pjobc: u32,
+        pub e_tdev: u32,
+        pub e_tpgid: u32,
+        pub pbi_nice: i32,
+        pub pbi_start_tvsec: u64,
+        pub pbi_start_tvusec: u64,
+    }
+
+    pub struct proc_taskallinfo {
+        pub pbsd: proc_bsdinfo,
+        pub ptinfo: proc_taskinfo,
+    }
+
+    pub struct proc_threadinfo {
+        pub pth_user_time: u64,
+        pub pth_system_time: u64,
+        pub pth_cpu_usage: i32,
+        pub pth_policy: i32,
+        pub pth_run_state: i32,
+        pub pth_flags: i32,
+        pub pth_sleep_time: i32,
+        pub pth_curpri: i32,
+        pub pth_priority: i32,
+        pub pth_maxpriority: i32,
+        pub pth_name: [::c_char; MAXTHREADNAMESIZE],
+    }
+
+    pub struct xsw_usage {
+        pub xsu_total: u64,
+        pub xsu_avail: u64,
+        pub xsu_used: u64,
+        pub xsu_pagesize: u32,
+        pub xsu_encrypted: ::boolean_t,
+    }
 }
 
 pub const _UTX_USERSIZE: usize = 256;
 pub const _UTX_LINESIZE: usize = 32;
 pub const _UTX_IDSIZE: usize = 4;
 pub const _UTX_HOSTSIZE: usize = 256;
 
 pub const EMPTY: ::c_short = 0;
@@ -443,24 +531,18 @@ pub const _PC_LINK_MAX: ::c_int = 1;
 pub const _PC_MAX_CANON: ::c_int = 2;
 pub const _PC_MAX_INPUT: ::c_int = 3;
 pub const _PC_NAME_MAX: ::c_int = 4;
 pub const _PC_PATH_MAX: ::c_int = 5;
 pub const _PC_PIPE_BUF: ::c_int = 6;
 pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
 pub const _PC_NO_TRUNC: ::c_int = 8;
 pub const _PC_VDISABLE: ::c_int = 9;
-pub const O_RDONLY: ::c_int = 0;
-pub const O_WRONLY: ::c_int = 1;
-pub const O_RDWR: ::c_int = 2;
-pub const O_APPEND: ::c_int = 8;
-pub const O_CREAT: ::c_int = 512;
-pub const O_EXCL: ::c_int = 2048;
-pub const O_NOCTTY: ::c_int = 131072;
-pub const O_TRUNC: ::c_int = 1024;
+pub const O_DSYNC: ::c_int = 0x400000;
+pub const O_NOCTTY: ::c_int = 0x20000;
 pub const O_CLOEXEC: ::c_int = 0x1000000;
 pub const O_DIRECTORY: ::c_int = 0x100000;
 pub const S_IFIFO: mode_t = 4096;
 pub const S_IFCHR: mode_t = 8192;
 pub const S_IFBLK: mode_t = 24576;
 pub const S_IFDIR: mode_t = 16384;
 pub const S_IFREG: mode_t = 32768;
 pub const S_IFLNK: mode_t = 40960;
@@ -666,18 +748,16 @@ pub const F_PEOFPOSMODE: ::c_int = 3;
 pub const F_VOLPOSMODE: ::c_int = 4;
 
 pub const AT_FDCWD: ::c_int = -2;
 pub const AT_EACCESS: ::c_int = 0x0010;
 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020;
 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040;
 pub const AT_REMOVEDIR: ::c_int = 0x0080;
 
-pub const O_ACCMODE: ::c_int = 3;
-
 pub const TIOCMODG: ::c_ulong = 0x40047403;
 pub const TIOCMODS: ::c_ulong = 0x80047404;
 pub const TIOCM_LE: ::c_int = 0x1;
 pub const TIOCM_DTR: ::c_int = 0x2;
 pub const TIOCM_RTS: ::c_int = 0x4;
 pub const TIOCM_ST: ::c_int = 0x8;
 pub const TIOCM_SR: ::c_int = 0x10;
 pub const TIOCM_CTS: ::c_int = 0x20;
@@ -807,16 +887,18 @@ pub const _SC_XOPEN_ENH_I18N: ::c_int = 
 pub const _SC_XOPEN_LEGACY: ::c_int = 110;
 pub const _SC_XOPEN_REALTIME: ::c_int = 111;
 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
 pub const _SC_XOPEN_SHM: ::c_int = 113;
 pub const _SC_XOPEN_UNIX: ::c_int = 115;
 pub const _SC_XOPEN_VERSION: ::c_int = 116;
 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;
 
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 2;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
 pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
 pub const PTHREAD_STACK_MIN: ::size_t = 8192;
 
 pub const RLIMIT_CPU: ::c_int = 0;
 pub const RLIMIT_FSIZE: ::c_int = 1;
 pub const RLIMIT_DATA: ::c_int = 2;
 pub const RLIMIT_STACK: ::c_int = 3;
@@ -885,16 +967,20 @@ pub const pseudo_AF_KEY: ::c_int = 29;
 pub const AF_INET6: ::c_int = 30;
 pub const AF_NATM: ::c_int = 31;
 pub const AF_SYSTEM: ::c_int = 32;
 pub const AF_NETBIOS: ::c_int = 33;
 pub const AF_PPP: ::c_int = 34;
 pub const pseudo_AF_HDRCMPLT: ::c_int = 35;
 #[doc(hidden)]
 pub const AF_MAX: ::c_int = 40;
+pub const AF_SYS_CONTROL: ::c_int = 2;
+
+pub const SYSPROTO_EVENT: ::c_int = 1;
+pub const SYSPROTO_CONTROL: ::c_int = 2;
 
 pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
 pub const PF_LOCAL: ::c_int = AF_LOCAL;
 pub const PF_UNIX: ::c_int =  PF_LOCAL;
 pub const PF_INET: ::c_int =  AF_INET;
 pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
 pub const PF_PUP: ::c_int =  AF_PUP;
 pub const PF_CHAOS: ::c_int = AF_CHAOS;
@@ -942,23 +1028,16 @@ pub const SOMAXCONN: ::c_int = 128;
 
 pub const SOCK_MAXADDRLEN: ::c_int = 255;
 
 pub const SOCK_STREAM: ::c_int = 1;
 pub const SOCK_DGRAM: ::c_int = 2;
 pub const SOCK_RAW: ::c_int = 3;
 pub const SOCK_RDM: ::c_int = 4;
 pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
-pub const IP_MULTICAST_TTL: ::c_int = 10;
-pub const IP_MULTICAST_LOOP: ::c_int = 11;
 pub const IP_TTL: ::c_int = 4;
 pub const IP_HDRINCL: ::c_int = 2;
 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
 pub const IPV6_JOIN_GROUP: ::c_int = 12;
 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
 
 pub const TCP_NODELAY: ::c_int = 0x01;
@@ -971,32 +1050,39 @@ pub const SO_REUSEADDR: ::c_int = 0x0004
 pub const SO_KEEPALIVE: ::c_int = 0x0008;
 pub const SO_DONTROUTE: ::c_int = 0x0010;
 pub const SO_BROADCAST: ::c_int = 0x0020;
 pub const SO_USELOOPBACK: ::c_int = 0x0040;
 pub const SO_LINGER: ::c_int = 0x0080;
 pub const SO_OOBINLINE: ::c_int = 0x0100;
 pub const SO_REUSEPORT: ::c_int = 0x0200;
 pub const SO_TIMESTAMP: ::c_int = 0x0400;
+pub const SO_TIMESTAMP_MONOTONIC: ::c_int = 0x0800;
 pub const SO_DONTTRUNC: ::c_int = 0x2000;
 pub const SO_WANTMORE: ::c_int = 0x4000;
 pub const SO_WANTOOBFLAG: ::c_int = 0x8000;
 pub const SO_SNDBUF: ::c_int = 0x1001;
 pub const SO_RCVBUF: ::c_int = 0x1002;
 pub const SO_SNDLOWAT: ::c_int = 0x1003;
 pub const SO_RCVLOWAT: ::c_int = 0x1004;
 pub const SO_SNDTIMEO: ::c_int = 0x1005;
 pub const SO_RCVTIMEO: ::c_int = 0x1006;
 pub const SO_ERROR: ::c_int = 0x1007;
 pub const SO_TYPE: ::c_int = 0x1008;
+pub const SO_LABEL: ::c_int = 0x1010;
+pub const SO_PEERLABEL: ::c_int = 0x1011;
 pub const SO_NREAD: ::c_int = 0x1020;
 pub const SO_NKE: ::c_int = 0x1021;
 pub const SO_NOSIGPIPE: ::c_int = 0x1022;
 pub const SO_NOADDRERR: ::c_int = 0x1023;
 pub const SO_NWRITE: ::c_int = 0x1024;
+pub const SO_REUSESHAREUID: ::c_int = 0x1025;
+pub const SO_NOTIFYCONFLICT: ::c_int = 0x1026;
+pub const SO_RANDOMPORT: ::c_int = 0x1082;
+pub const SO_NP_EXTENSIONS: ::c_int = 0x1083;
 
 pub const MSG_OOB: ::c_int =  0x1;
 pub const MSG_PEEK: ::c_int = 0x2;
 pub const MSG_DONTROUTE: ::c_int = 0x4;
 pub const MSG_EOR: ::c_int =  0x8;
 pub const MSG_TRUNC: ::c_int = 0x10;
 pub const MSG_CTRUNC: ::c_int = 0x20;
 pub const MSG_WAITALL: ::c_int = 0x40;
@@ -1004,35 +1090,30 @@ pub const MSG_DONTWAIT: ::c_int = 0x80;
 pub const MSG_EOF: ::c_int =  0x100;
 pub const MSG_FLUSH: ::c_int = 0x400;
 pub const MSG_HOLD: ::c_int = 0x800;
 pub const MSG_SEND: ::c_int = 0x1000;
 pub const MSG_HAVEMORE: ::c_int = 0x2000;
 pub const MSG_RCVMORE: ::c_int = 0x4000;
 // pub const MSG_COMPAT: ::c_int = 0x8000;
 
-pub const SCM_RIGHTS: ::c_int = 0x01;
 pub const SCM_TIMESTAMP: ::c_int = 0x02;
 pub const SCM_CREDS: ::c_int = 0x03;
 
 pub const IFF_LOOPBACK: ::c_int = 0x8;
 
 pub const SHUT_RD: ::c_int = 0;
 pub const SHUT_WR: ::c_int = 1;
 pub const SHUT_RDWR: ::c_int = 2;
 
 pub const LOCK_SH: ::c_int = 1;
 pub const LOCK_EX: ::c_int = 2;
 pub const LOCK_NB: ::c_int = 4;
 pub const LOCK_UN: ::c_int = 8;
 
-pub const O_DSYNC: ::c_int = 4194304;
-pub const O_SYNC: ::c_int = 128;
-pub const O_NONBLOCK: ::c_int = 4;
-
 pub const MAP_COPY: ::c_int = 0x0002;
 pub const MAP_RENAME: ::c_int = 0x0020;
 pub const MAP_NORESERVE: ::c_int = 0x0040;
 pub const MAP_NOEXTEND: ::c_int = 0x0100;
 pub const MAP_HASSEMAPHORE: ::c_int = 0x0200;
 pub const MAP_NOCACHE: ::c_int = 0x0400;
 pub const MAP_JIT: ::c_int = 0x0800;
 
@@ -1233,16 +1314,28 @@ pub const NOTE_NSECONDS: ::uint32_t = 0x
 pub const NOTE_ABSOLUTE: ::uint32_t = 0x00000008;
 pub const NOTE_LEEWAY: ::uint32_t = 0x00000010;
 pub const NOTE_CRITICAL: ::uint32_t = 0x00000020;
 pub const NOTE_BACKGROUND: ::uint32_t = 0x00000040;
 pub const NOTE_TRACK: ::uint32_t = 0x00000001;
 pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
 pub const NOTE_CHILD: ::uint32_t = 0x00000004;
 
+pub const OCRNL: ::c_int = 0x00000010;
+pub const ONOCR: ::c_int = 0x00000020;
+pub const ONLRET: ::c_int = 0x00000040;
+pub const OFILL: ::c_int = 0x00000080;
+pub const NLDLY: ::c_int = 0x00000300;
+pub const TABDLY: ::c_int = 0x00000c04;
+pub const CRDLY: ::c_int = 0x00003000;
+pub const FFDLY: ::c_int = 0x00004000;
+pub const BSDLY: ::c_int = 0x00008000;
+pub const VTDLY: ::c_int = 0x00010000;
+pub const OFDEL: ::c_int = 0x00020000;
+
 pub const NL0: ::c_int  = 0x00000000;
 pub const NL1: ::c_int  = 0x00000100;
 pub const TAB0: ::c_int = 0x00000000;
 pub const TAB1: ::c_int = 0x00000400;
 pub const TAB2: ::c_int = 0x00000800;
 pub const CR0: ::c_int  = 0x00000000;
 pub const CR1: ::c_int  = 0x00001000;
 pub const CR2: ::c_int  = 0x00002000;
@@ -1476,21 +1569,16 @@ pub const USER_POSIX2_SW_DEV: ::c_int = 
 pub const USER_POSIX2_UPE: ::c_int = 18;
 pub const USER_STREAM_MAX: ::c_int = 19;
 pub const USER_TZNAME_MAX: ::c_int = 20;
 pub const USER_MAXID: ::c_int = 21;
 pub const CTL_DEBUG_NAME: ::c_int = 0;
 pub const CTL_DEBUG_VALUE: ::c_int = 1;
 pub const CTL_DEBUG_MAXID: ::c_int = 20;
 
-pub const POLLRDNORM: ::c_short = 0x040;
-pub const POLLWRNORM: ::c_short = 0x004;
-pub const POLLRDBAND: ::c_short = 0x080;
-pub const POLLWRBAND: ::c_short = 0x100;
-
 pub const PRIO_DARWIN_THREAD: ::c_int = 3;
 pub const PRIO_DARWIN_PROCESS: ::c_int = 4;
 pub const PRIO_DARWIN_BG: ::c_int = 0x1000;
 pub const PRIO_DARWIN_NONUI: ::c_int = 0x1001;
 
 pub const SEM_FAILED: *mut sem_t = -1isize as *mut ::sem_t;
 
 pub const SIGEV_NONE: ::c_int = 0;
@@ -1518,16 +1606,27 @@ pub const P_PGID: idtype_t = 2;
 
 pub const XATTR_NOFOLLOW: ::c_int = 0x0001;
 pub const XATTR_CREATE: ::c_int = 0x0002;
 pub const XATTR_REPLACE: ::c_int = 0x0004;
 pub const XATTR_NOSECURITY: ::c_int = 0x0008;
 pub const XATTR_NODEFAULT: ::c_int = 0x0010;
 pub const XATTR_SHOWCOMPRESSION: ::c_int = 0x0020;
 
+pub const NET_RT_IFLIST2: ::c_int = 0x0006;
+pub const RTM_IFINFO2: ::c_int = 0x0012;
+
+pub const KERN_PROCARGS2: ::c_int = 49;
+
+pub const PROC_PIDTASKALLINFO: ::c_int = 2;
+pub const PROC_PIDTASKINFO: ::c_int = 4;
+pub const PROC_PIDTHREADINFO: ::c_int = 5;
+pub const MAXCOMLEN: usize = 16;
+pub const MAXTHREADNAMESIZE: usize = 64;
+
 f! {
     pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
         status >> 8
     }
 
     pub fn _WSTATUS(status: ::c_int) -> ::c_int {
         status & 0x7f
     }
@@ -1610,16 +1709,20 @@ extern {
     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
                                        pshared: ::c_int) -> ::c_int;
     pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
                                        pshared: *mut ::c_int) -> ::c_int;
     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
                                         pshared: ::c_int) -> ::c_int;
     pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
                                         pshared: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+                                         val: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+                                         val: ::c_int) -> ::c_int;
     pub fn __error() -> *mut ::c_int;
     pub fn backtrace(buf: *mut *mut ::c_void,
                      sz: ::c_int) -> ::c_int;
     #[cfg_attr(target_os = "macos", link_name = "statfs$INODE64")]
     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
     #[cfg_attr(target_os = "macos", link_name = "fstatfs$INODE64")]
     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
     pub fn kevent(kq: ::c_int,
@@ -1634,17 +1737,17 @@ extern {
                     eventlist: *mut ::kevent64_s,
                     nevents: ::c_int,
                     flags: ::c_uint,
                     timeout: *const ::timespec) -> ::c_int;
     pub fn mount(src: *const ::c_char,
                  target: *const ::c_char,
                  flags: ::c_int,
                  data: *mut ::c_void) -> ::c_int;
-    pub fn ptrace(requeset: ::c_int,
+    pub fn ptrace(request: ::c_int,
                   pid: ::pid_t,
                   addr: *mut ::c_char,
                   data: ::c_int) -> ::c_int;
     pub fn quotactl(special: *const ::c_char,
                     cmd: ::c_int,
                     id: ::c_int,
                     data: *mut ::c_char) -> ::c_int;
     pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
@@ -1690,16 +1793,20 @@ extern {
                      size: ::size_t, flags: ::c_int) -> ::ssize_t;
     pub fn flistxattr(filedes: ::c_int, list: *mut ::c_char,
                       size: ::size_t, flags: ::c_int) -> ::ssize_t;
     pub fn removexattr(path: *const ::c_char, name: *const ::c_char,
                        flags: ::c_int) -> ::c_int;
     pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char,
                         flags: ::c_int) -> ::c_int;
 
+    pub fn getgrouplist(name: *const ::c_char,
+                        basegid: ::c_int,
+                        groups: *mut ::c_int,
+                        ngroups: *mut ::c_int) -> ::c_int;
     pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int;
 
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "waitid$UNIX2003")]
     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
                   options: ::c_int) -> ::c_int;
     pub fn brk(addr: *const ::c_void) -> *mut ::c_void;
     pub fn sbrk(increment: ::c_int) -> *mut ::c_void;
--- a/third_party/rust/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/third_party/rust/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -126,47 +126,85 @@ s! {
         pub st_blocks: ::int64_t,
         pub st_blksize: ::uint32_t,
         pub st_flags: ::uint32_t,
         pub st_gen: ::uint32_t,
         pub st_lspare: ::int32_t,
         pub st_qspare1: ::int64_t,
         pub st_qspare2: ::int64_t,
     }
+
+    pub struct if_data {
+        pub ifi_type: ::c_uchar,
+        pub ifi_physical: ::c_uchar,
+        pub ifi_addrlen: ::c_uchar,
+        pub ifi_hdrlen: ::c_uchar,
+        pub ifi_recvquota: ::c_uchar,
+        pub ifi_xmitquota: ::c_uchar,
+        pub ifi_mtu: ::c_ulong,
+        pub ifi_metric: ::c_ulong,
+        pub ifi_link_state: ::c_ulong,
+        pub ifi_baudrate: u64,
+        pub ifi_ipackets: ::c_ulong,
+        pub ifi_ierrors: ::c_ulong,
+        pub ifi_opackets: ::c_ulong,
+        pub ifi_oerrors: ::c_ulong,
+        pub ifi_collisions: ::c_ulong,
+        pub ifi_ibytes: ::c_ulong,
+        pub ifi_obytes: ::c_ulong,
+        pub ifi_imcasts: ::c_ulong,
+        pub ifi_omcasts: ::c_ulong,
+        pub ifi_iqdrops: ::c_ulong,
+        pub ifi_noproto: ::c_ulong,
+        pub ifi_hwassist: ::c_ulong,
+        pub ifi_oqdrops: ::c_ulong,
+        pub ifi_lastchange: ::timeval,
+    }
+
+    pub struct if_msghdr {
+        pub ifm_msglen: ::c_ushort,
+        pub ifm_version: ::c_uchar,
+        pub ifm_type: ::c_uchar,
+        pub ifm_addrs: ::c_int,
+        pub ifm_flags: ::c_int,
+        pub ifm_index: ::c_ushort,
+        pub ifm_data: if_data,
+    }
 }
 
 pub const RAND_MAX: ::c_int = 0x7fff_ffff;
-pub const PTHREAD_STACK_MIN: ::size_t = 1024;
+pub const PTHREAD_STACK_MIN: ::size_t = 16384;
 pub const SIGSTKSZ: ::size_t = 40960;
 pub const MADV_INVAL: ::c_int = 10;
 pub const O_CLOEXEC: ::c_int = 0x00020000;
+pub const O_DIRECTORY: ::c_int = 0x08000000;
 pub const F_GETLK: ::c_int = 7;
 pub const F_SETLK: ::c_int = 8;
 pub const F_SETLKW: ::c_int = 9;
 pub const ELAST: ::c_int = 99;
 pub const RLIMIT_POSIXLOCKS: ::c_int = 11;
 pub const RLIM_NLIMITS: ::rlim_t = 12;
 
 pub const Q_GETQUOTA: ::c_int = 0x300;
 pub const Q_SETQUOTA: ::c_int = 0x400;
 
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_VIRTUAL: clockid_t = 1;
-pub const CLOCK_PROF: clockid_t = 2;
-pub const CLOCK_MONOTONIC: clockid_t = 4;
-pub const CLOCK_UPTIME: clockid_t = 5;
-pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
-pub const CLOCK_UPTIME_FAST: clockid_t = 8;
-pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
-pub const CLOCK_REALTIME_FAST: clockid_t = 10;
-pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
-pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
-pub const CLOCK_SECOND: clockid_t = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_VIRTUAL: ::clockid_t = 1;
+pub const CLOCK_PROF: ::clockid_t = 2;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
+pub const CLOCK_UPTIME: ::clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
+pub const CLOCK_SECOND: ::clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
 
 pub const CTL_UNSPEC: ::c_int = 0;
 pub const CTL_KERN: ::c_int = 1;
 pub const CTL_VM: ::c_int = 2;
 pub const CTL_VFS: ::c_int = 3;
 pub const CTL_NET: ::c_int = 4;
 pub const CTL_DEBUG: ::c_int = 5;
 pub const CTL_HW: ::c_int = 6;
@@ -297,16 +335,17 @@ pub const CTL_P1003_1B_MAXID: ::c_int = 
 
 pub const EVFILT_READ: ::int16_t = -1;
 pub const EVFILT_WRITE: ::int16_t = -2;
 pub const EVFILT_AIO: ::int16_t = -3;
 pub const EVFILT_VNODE: ::int16_t = -4;
 pub const EVFILT_PROC: ::int16_t = -5;
 pub const EVFILT_SIGNAL: ::int16_t = -6;
 pub const EVFILT_TIMER: ::int16_t = -7;
+pub const EVFILT_EXCEPT: ::int16_t = -8;
 pub const EVFILT_USER: ::int16_t = -9;
 pub const EVFILT_FS: ::int16_t = -10;
 
 pub const EV_ADD: ::uint16_t = 0x1;
 pub const EV_DELETE: ::uint16_t = 0x2;
 pub const EV_ENABLE: ::uint16_t = 0x4;
 pub const EV_DISABLE: ::uint16_t = 0x8;
 pub const EV_ONESHOT: ::uint16_t = 0x10;
@@ -399,22 +438,41 @@ pub const LC_ALL_MASK: ::c_int = LC_COLL
 pub const TIOCSIG: ::c_uint = 0x2000745f;
 pub const BTUARTDISC: ::c_int = 0x7;
 pub const TIOCDCDTIMESTAMP: ::c_uint = 0x40107458;
 pub const TIOCISPTMASTER: ::c_uint = 0x20007455;
 pub const TIOCMODG: ::c_uint = 0x40047403;
 pub const TIOCMODS: ::c_ulong = 0x80047404;
 pub const TIOCREMOTE: ::c_ulong = 0x80047469;
 
+// Constants used by "at" family of system calls.
+pub const AT_FDCWD:            ::c_int = 0xFFFAFDCD; // invalid file descriptor
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 1;
+pub const AT_REMOVEDIR:        ::c_int = 2;
+pub const AT_EACCESS:          ::c_int = 4;
+pub const AT_SYMLINK_FOLLOW:   ::c_int = 8;
+
+pub const VCHECKPT: usize = 19;
+
+pub const _PC_2_SYMLINKS: ::c_int = 22;
+pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 23;
+
+pub const _SC_V7_ILP32_OFF32: ::c_int = 122;
+pub const _SC_V7_ILP32_OFFBIG: ::c_int = 123;
+pub const _SC_V7_LP64_OFF64: ::c_int = 124;
+pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 125;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 126;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 127;
+
 extern {
     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
                     -> ::c_int;
-    pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+    pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
 
     pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;
 
     pub fn aio_waitcomplete(iocbp: *mut *mut aiocb,
                             timeout: *mut ::timespec) -> ::c_int;
 
     pub fn freelocale(loc: ::locale_t);
 }
--- a/third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
+++ b/third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
@@ -23,8 +23,10 @@ s! {
         pub st_blksize: ::blksize_t,
         pub st_flags: ::fflags_t,
         pub st_gen: ::uint32_t,
         pub st_lspare: ::int32_t,
         pub st_birthtime: ::time_t,
         pub st_birthtime_nsec: ::c_long,
     }
 }
+
+pub const MAP_32BIT: ::c_int = 0x00080000;
--- a/third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -134,16 +134,19 @@ pub const SIGEV_THREAD_ID: ::c_int = 4;
 pub const RAND_MAX: ::c_int = 0x7fff_fffd;
 pub const PTHREAD_STACK_MIN: ::size_t = 2048;
 pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
 pub const SIGSTKSZ: ::size_t = 34816;
 pub const SF_NODISKIO: ::c_int = 0x00000001;
 pub const SF_MNOWAIT: ::c_int = 0x00000002;
 pub const SF_SYNC: ::c_int = 0x00000004;
 pub const O_CLOEXEC: ::c_int = 0x00100000;
+pub const O_DIRECTORY: ::c_int = 0x00020000;
+pub const O_EXEC: ::c_int = 0x00040000;
+pub const O_TTY_INIT: ::c_int = 0x00080000;
 pub const F_GETLK: ::c_int = 11;
 pub const F_SETLK: ::c_int = 12;
 pub const F_SETLKW: ::c_int = 13;
 pub const ELAST: ::c_int = 96;
 pub const RLIMIT_NPTS: ::c_int = 11;
 pub const RLIMIT_SWAP: ::c_int = 12;
 pub const RLIM_NLIMITS: ::rlim_t = 13;
 
@@ -152,16 +155,18 @@ pub const Q_SETQUOTA: ::c_int = 0x800;
 
 pub const POSIX_FADV_NORMAL: ::c_int = 0;
 pub const POSIX_FADV_RANDOM: ::c_int = 1;
 pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
 pub const POSIX_FADV_WILLNEED: ::c_int = 3;
 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
 
+pub const POLLINIGNEOF: ::c_short = 0x2000;
+
 pub const EVFILT_READ: ::int16_t = -1;
 pub const EVFILT_WRITE: ::int16_t = -2;
 pub const EVFILT_AIO: ::int16_t = -3;
 pub const EVFILT_VNODE: ::int16_t = -4;
 pub const EVFILT_PROC: ::int16_t = -5;
 pub const EVFILT_SIGNAL: ::int16_t = -6;
 pub const EVFILT_TIMER: ::int16_t = -7;
 pub const EVFILT_FS: ::int16_t = -9;
@@ -208,30 +213,30 @@ pub const NOTE_CHILD: ::uint32_t = 0x000
 pub const NOTE_SECONDS: ::uint32_t = 0x00000001;
 pub const NOTE_MSECONDS: ::uint32_t = 0x00000002;
 pub const NOTE_USECONDS: ::uint32_t = 0x00000004;
 pub const NOTE_NSECONDS: ::uint32_t = 0x00000008;
 
 pub const MADV_PROTECT: ::c_int = 10;
 pub const RUSAGE_THREAD: ::c_int = 1;
 
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_VIRTUAL: clockid_t = 1;
-pub const CLOCK_PROF: clockid_t = 2;
-pub const CLOCK_MONOTONIC: clockid_t = 4;
-pub const CLOCK_UPTIME: clockid_t = 5;
-pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
-pub const CLOCK_UPTIME_FAST: clockid_t = 8;
-pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
-pub const CLOCK_REALTIME_FAST: clockid_t = 10;
-pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
-pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
-pub const CLOCK_SECOND: clockid_t = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_VIRTUAL: ::clockid_t = 1;
+pub const CLOCK_PROF: ::clockid_t = 2;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
+pub const CLOCK_UPTIME: ::clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
+pub const CLOCK_SECOND: ::clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
 
 pub const CTL_UNSPEC: ::c_int = 0;
 pub const CTL_KERN: ::c_int = 1;
 pub const CTL_VM: ::c_int = 2;
 pub const CTL_VFS: ::c_int = 3;
 pub const CTL_NET: ::c_int = 4;
 pub const CTL_DEBUG: ::c_int = 5;
 pub const CTL_HW: ::c_int = 6;
@@ -503,25 +508,39 @@ pub const WTRAPPED: ::c_int = 32;
 // standardized ones.
 pub const P_PID: idtype_t = 0;
 pub const P_PGID: idtype_t = 2;
 pub const P_ALL: idtype_t = 7;
 
 pub const B460800: ::speed_t = 460800;
 pub const B921600: ::speed_t = 921600;
 
+pub const AT_FDCWD: ::c_int = -100;
+pub const AT_EACCESS: ::c_int = 0x100;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
+pub const AT_REMOVEDIR: ::c_int = 0x800;
+
+pub const TABDLY: ::tcflag_t = 0x00000004;
+pub const TAB0: ::tcflag_t = 0x00000000;
+pub const TAB3: ::tcflag_t = 0x00000004;
+
+pub const _PC_ACL_NFS4: ::c_int = 64;
+
+pub const _SC_CPUSET_SIZE: ::c_int = 122;
+
 extern {
     pub fn __error() -> *mut ::c_int;
 
     pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
                     -> ::c_int;
 
-    pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+    pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
 
     pub fn jail(jail: *mut ::jail) -> ::c_int;
     pub fn jail_attach(jid: ::c_int) -> ::c_int;
     pub fn jail_remove(jid: ::c_int) -> ::c_int;
     pub fn jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int)
                     -> ::c_int;
     pub fn jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int)
                     -> ::c_int;
@@ -554,16 +573,17 @@ extern {
         buf: *mut ::shmid_ds) -> ::c_int;
     pub fn msgctl(msqid: ::c_int, cmd: ::c_int,
         buf: *mut ::msqid_ds) -> ::c_int;
     pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
     pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
         msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int;
     pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
         msgflg: ::c_int) -> ::c_int;
+    pub fn cfmakesane(termios: *mut ::termios);
 }
 
 cfg_if! {
     if #[cfg(target_arch = "x86")] {
         mod x86;
         pub use self::x86::*;
     } else if #[cfg(target_arch = "x86_64")] {
         mod x86_64;
--- a/third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
+++ b/third_party/rust/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
@@ -23,8 +23,10 @@ s! {
         pub st_blksize: ::blksize_t,
         pub st_flags: ::fflags_t,
         pub st_gen: ::uint32_t,
         pub st_lspare: ::int32_t,
         pub st_birthtime: ::time_t,
         pub st_birthtime_nsec: ::c_long,
     }
 }
+
+pub const MAP_32BIT: ::c_int = 0x00080000;
--- a/third_party/rust/libc/src/unix/bsd/freebsdlike/mod.rs
+++ b/third_party/rust/libc/src/unix/bsd/freebsdlike/mod.rs
@@ -2,16 +2,17 @@ pub type dev_t = u32;
 pub type mode_t = u16;
 pub type pthread_attr_t = *mut ::c_void;
 pub type rlim_t = i64;
 pub type pthread_mutex_t = *mut ::c_void;
 pub type pthread_mutexattr_t = *mut ::c_void;
 pub type pthread_cond_t = *mut ::c_void;
 pub type pthread_condattr_t = *mut ::c_void;
 pub type pthread_rwlock_t = *mut ::c_void;
+pub type pthread_rwlockattr_t = *mut ::c_void;
 pub type pthread_key_t = ::c_int;
 pub type tcflag_t = ::c_uint;
 pub type speed_t = ::c_uint;
 pub type nl_item = ::c_int;
 pub type id_t = i64;
 
 pub enum timezone {}
 
@@ -258,34 +259,30 @@ pub const ALTMON_11: ::nl_item = 68;
 pub const ALTMON_12: ::nl_item = 69;
 
 pub const EXIT_FAILURE: ::c_int = 1;
 pub const EXIT_SUCCESS: ::c_int = 0;
 pub const EOF: ::c_int = -1;
 pub const SEEK_SET: ::c_int = 0;
 pub const SEEK_CUR: ::c_int = 1;
 pub const SEEK_END: ::c_int = 2;
+pub const SEEK_DATA: ::c_int = 3;
+pub const SEEK_HOLE: ::c_int = 4;
 pub const _IOFBF: ::c_int = 0;
 pub const _IONBF: ::c_int = 2;
 pub const _IOLBF: ::c_int = 1;
 pub const BUFSIZ: ::c_uint = 1024;
 pub const FOPEN_MAX: ::c_uint = 20;
 pub const FILENAME_MAX: ::c_uint = 1024;
 pub const L_tmpnam: ::c_uint = 1024;
 pub const TMP_MAX: ::c_uint = 308915776;
 
-pub const O_RDONLY: ::c_int = 0;
-pub const O_WRONLY: ::c_int = 1;
-pub const O_RDWR: ::c_int = 2;
-pub const O_ACCMODE: ::c_int = 3;
-pub const O_APPEND: ::c_int = 8;
-pub const O_CREAT: ::c_int = 512;
-pub const O_EXCL: ::c_int = 2048;
 pub const O_NOCTTY: ::c_int = 32768;
-pub const O_TRUNC: ::c_int = 1024;
+pub const O_DIRECT: ::c_int = 0x00010000;
+
 pub const S_IFIFO: mode_t = 4096;
 pub const S_IFCHR: mode_t = 8192;
 pub const S_IFBLK: mode_t = 24576;
 pub const S_IFDIR: mode_t = 16384;
 pub const S_IFREG: mode_t = 32768;
 pub const S_IFLNK: mode_t = 40960;
 pub const S_IFSOCK: mode_t = 49152;
 pub const S_IFMT: mode_t = 61440;
@@ -334,16 +331,17 @@ pub const PROT_READ: ::c_int = 1;
 pub const PROT_WRITE: ::c_int = 2;
 pub const PROT_EXEC: ::c_int = 4;
 
 pub const MAP_FILE: ::c_int = 0x0000;
 pub const MAP_SHARED: ::c_int = 0x0001;
 pub const MAP_PRIVATE: ::c_int = 0x0002;
 pub const MAP_FIXED: ::c_int = 0x0010;
 pub const MAP_ANON: ::c_int = 0x1000;
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
 
 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
 
 pub const MCL_CURRENT: ::c_int = 0x0001;
 pub const MCL_FUTURE: ::c_int = 0x0002;
 
 pub const MS_SYNC: ::c_int = 0x0000;
 pub const MS_ASYNC: ::c_int = 0x0001;
@@ -439,29 +437,28 @@ pub const ECANCELED: ::c_int = 85;
 pub const EILSEQ: ::c_int = 86;
 pub const ENOATTR: ::c_int = 87;
 pub const EDOOFUS: ::c_int = 88;
 pub const EBADMSG: ::c_int = 89;
 pub const EMULTIHOP: ::c_int = 90;
 pub const ENOLINK: ::c_int = 91;
 pub const EPROTO: ::c_int = 92;
 
+pub const POLLSTANDARD: ::c_short = ::POLLIN | ::POLLPRI | ::POLLOUT |
+    ::POLLRDNORM | ::POLLRDBAND | ::POLLWRBAND | ::POLLERR |
+    ::POLLHUP | ::POLLNVAL;
+
 pub const EAI_SYSTEM: ::c_int = 11;
 
 pub const F_DUPFD: ::c_int = 0;
 pub const F_GETFD: ::c_int = 1;
 pub const F_SETFD: ::c_int = 2;
 pub const F_GETFL: ::c_int = 3;
 pub const F_SETFL: ::c_int = 4;
 
-pub const AT_EACCESS: ::c_int = 0x100;
-pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
-pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
-pub const AT_REMOVEDIR: ::c_int = 0x800;
-
 pub const SIGTRAP: ::c_int = 5;
 
 pub const GLOB_APPEND  : ::c_int = 0x0001;
 pub const GLOB_DOOFFS  : ::c_int = 0x0002;
 pub const GLOB_ERR     : ::c_int = 0x0004;
 pub const GLOB_MARK    : ::c_int = 0x0008;
 pub const GLOB_NOCHECK : ::c_int = 0x0010;
 pub const GLOB_NOSORT  : ::c_int = 0x0020;
@@ -472,46 +469,18 @@ pub const GLOB_ABORTED : ::c_int = -2;
 pub const GLOB_NOMATCH : ::c_int = -3;
 
 pub const POSIX_MADV_NORMAL: ::c_int = 0;
 pub const POSIX_MADV_RANDOM: ::c_int = 1;
 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
 
-pub const _SC_IOV_MAX: ::c_int = 56;
-pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
-pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
-pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
-pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
-pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
-pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
-pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
-pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
-pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
-pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
-pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
-pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
-pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
-pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
-pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
-pub const _SC_THREADS: ::c_int = 96;
-pub const _SC_TTY_NAME_MAX: ::c_int = 101;
-pub const _SC_ATEXIT_MAX: ::c_int = 107;
-pub const _SC_XOPEN_CRYPT: ::c_int = 108;
-pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
-pub const _SC_XOPEN_LEGACY: ::c_int = 110;
-pub const _SC_XOPEN_REALTIME: ::c_int = 111;
-pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
-pub const _SC_XOPEN_SHM: ::c_int = 113;
-pub const _SC_XOPEN_UNIX: ::c_int = 115;
-pub const _SC_XOPEN_VERSION: ::c_int = 116;
-pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117;
-
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
 
 pub const RLIMIT_CPU: ::c_int = 0;
 pub const RLIMIT_FSIZE: ::c_int = 1;
 pub const RLIMIT_DATA: ::c_int = 2;
 pub const RLIMIT_STACK: ::c_int = 3;
 pub const RLIMIT_CORE: ::c_int = 4;
@@ -624,31 +593,26 @@ pub const MSG_PEEK: ::c_int = 0x00000002
 pub const MSG_DONTROUTE: ::c_int = 0x00000004;
 pub const MSG_EOR: ::c_int =  0x00000008;
 pub const MSG_TRUNC: ::c_int = 0x00000010;
 pub const MSG_CTRUNC: ::c_int = 0x00000020;
 pub const MSG_WAITALL: ::c_int = 0x00000040;
 pub const MSG_DONTWAIT: ::c_int = 0x00000080;
 pub const MSG_EOF: ::c_int = 0x00000100;
 
+pub const SCM_TIMESTAMP: ::c_int = 0x02;
+
 pub const SOCK_STREAM: ::c_int = 1;
 pub const SOCK_DGRAM: ::c_int = 2;
 pub const SOCK_RAW: ::c_int = 3;
 pub const SOCK_RDM: ::c_int = 4;
 pub const SOCK_SEQPACKET: ::c_int = 5;
 pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
 pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
 pub const SOCK_MAXADDRLEN: ::c_int = 255;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
-pub const IP_MULTICAST_TTL: ::c_int = 10;
-pub const IP_MULTICAST_LOOP: ::c_int = 11;
 pub const IP_TTL: ::c_int = 4;
 pub const IP_HDRINCL: ::c_int = 2;
 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
 pub const IPV6_JOIN_GROUP: ::c_int = 12;
 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
 
 pub const TCP_NODELAY: ::c_int = 1;
@@ -682,29 +646,52 @@ pub const SHUT_RD: ::c_int = 0;
 pub const SHUT_WR: ::c_int = 1;
 pub const SHUT_RDWR: ::c_int = 2;
 
 pub const LOCK_SH: ::c_int = 1;
 pub const LOCK_EX: ::c_int = 2;
 pub const LOCK_NB: ::c_int = 4;
 pub const LOCK_UN: ::c_int = 8;
 
-pub const O_SYNC: ::c_int = 128;
-pub const O_NONBLOCK: ::c_int = 4;
-
 pub const MAP_COPY: ::c_int = 0x0002;
 pub const MAP_RENAME: ::c_int = 0x0020;
 pub const MAP_NORESERVE: ::c_int = 0x0040;
 pub const MAP_HASSEMAPHORE: ::c_int = 0x0200;
 pub const MAP_STACK: ::c_int = 0x0400;
 pub const MAP_NOSYNC: ::c_int = 0x0800;
 pub const MAP_NOCORE: ::c_int = 0x020000;
 
 pub const IPPROTO_RAW: ::c_int = 255;
 
+pub const _PC_LINK_MAX: ::c_int = 1;
+pub const _PC_MAX_CANON: ::c_int = 2;
+pub const _PC_MAX_INPUT: ::c_int = 3;
+pub const _PC_NAME_MAX: ::c_int = 4;
+pub const _PC_PATH_MAX: ::c_int = 5;
+pub const _PC_PIPE_BUF: ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
+pub const _PC_NO_TRUNC: ::c_int = 8;
+pub const _PC_VDISABLE: ::c_int = 9;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 10;
+pub const _PC_FILESIZEBITS: ::c_int = 12;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_SYMLINK_MAX: ::c_int = 18;
+pub const _PC_MIN_HOLE_SIZE: ::c_int = 21;
+pub const _PC_ASYNC_IO: ::c_int = 53;
+pub const _PC_PRIO_IO: ::c_int = 54;
+pub const _PC_SYNC_IO: ::c_int = 55;
+pub const _PC_ACL_EXTENDED: ::c_int = 59;
+pub const _PC_ACL_PATH_MAX: ::c_int = 60;
+pub const _PC_CAP_PRESENT: ::c_int = 61;
+pub const _PC_INF_PRESENT: ::c_int = 62;
+pub const _PC_MAC_PRESENT: ::c_int = 63;
+
 pub const _SC_ARG_MAX: ::c_int = 1;
 pub const _SC_CHILD_MAX: ::c_int = 2;
 pub const _SC_CLK_TCK: ::c_int = 3;
 pub const _SC_NGROUPS_MAX: ::c_int = 4;
 pub const _SC_OPEN_MAX: ::c_int = 5;
 pub const _SC_JOB_CONTROL: ::c_int = 6;
 pub const _SC_SAVED_IDS: ::c_int = 7;
 pub const _SC_VERSION: ::c_int = 8;
@@ -748,17 +735,81 @@ pub const _SC_DELAYTIMER_MAX: ::c_int = 
 pub const _SC_MQ_OPEN_MAX: ::c_int = 46;
 pub const _SC_PAGESIZE: ::c_int = 47;
 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
 pub const _SC_RTSIG_MAX: ::c_int = 48;
 pub const _SC_SEM_NSEMS_MAX: ::c_int = 49;
 pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
 pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
 pub const _SC_TIMER_MAX: ::c_int = 52;
+pub const _SC_IOV_MAX: ::c_int = 56;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 57;
+pub const _SC_2_PBS: ::c_int = 59;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 60;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 61;
+pub const _SC_2_PBS_LOCATE: ::c_int = 62;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 63;
+pub const _SC_2_PBS_TRACK: ::c_int = 64;
+pub const _SC_ADVISORY_INFO: ::c_int = 65;
+pub const _SC_BARRIERS: ::c_int = 66;
+pub const _SC_CLOCK_SELECTION: ::c_int = 67;
+pub const _SC_CPUTIME: ::c_int = 68;
+pub const _SC_FILE_LOCKING: ::c_int = 69;
+pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
+pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
+pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
 pub const _SC_HOST_NAME_MAX: ::c_int = 72;
+pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 74;
+pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 76;
+pub const _SC_REGEXP: ::c_int = 77;
+pub const _SC_SHELL: ::c_int = 78;
+pub const _SC_SPAWN: ::c_int = 79;
+pub const _SC_SPIN_LOCKS: ::c_int = 80;
+pub const _SC_SPORADIC_SERVER: ::c_int = 81;
+pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
+pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
+pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
+pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
+pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
+pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
+pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 92;
+pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
+pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
+pub const _SC_TIMEOUTS: ::c_int = 95;
+pub const _SC_THREADS: ::c_int = 96;
+pub const _SC_TRACE: ::c_int = 97;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 98;
+pub const _SC_TRACE_INHERIT: ::c_int = 99;
+pub const _SC_TRACE_LOG: ::c_int = 100;
+pub const _SC_TTY_NAME_MAX: ::c_int = 101;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 102;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 103;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 104;
+pub const _SC_V6_LP64_OFF64: ::c_int = 105;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 106;
+pub const _SC_ATEXIT_MAX: ::c_int = 107;
+pub const _SC_XOPEN_CRYPT: ::c_int = 108;
+pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
+pub const _SC_XOPEN_LEGACY: ::c_int = 110;
+pub const _SC_XOPEN_REALTIME: ::c_int = 111;
+pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
+pub const _SC_XOPEN_SHM: ::c_int = 113;
+pub const _SC_XOPEN_STREAMS: ::c_int = 114;
+pub const _SC_XOPEN_UNIX: ::c_int = 115;
+pub const _SC_XOPEN_VERSION: ::c_int = 116;
+pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117;
+pub const _SC_IPV6: ::c_int = 118;
+pub const _SC_RAW_SOCKETS: ::c_int = 119;
+pub const _SC_SYMLOOP_MAX: ::c_int = 120;
+pub const _SC_PHYS_PAGES: ::c_int = 121;
 
 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 1;
 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3;
 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_ERRORCHECK;
@@ -870,18 +921,25 @@ pub const B76800: speed_t = 76800;
 pub const B115200: speed_t = 115200;
 pub const B230400: speed_t = 230400;
 pub const EXTA: speed_t = 19200;
 pub const EXTB: speed_t = 38400;
 
 pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
 
 pub const CRTSCTS: ::tcflag_t = 0x00030000;
-
-pub const AT_FDCWD: ::c_int = -100;
+pub const CCTS_OFLOW: ::tcflag_t = 0x00010000;
+pub const CRTS_IFLOW: ::tcflag_t = 0x00020000;
+pub const CDTR_IFLOW: ::tcflag_t = 0x00040000;
+pub const CDSR_OFLOW: ::tcflag_t = 0x00080000;
+pub const CCAR_OFLOW: ::tcflag_t = 0x00100000;
+pub const VERASE2: usize = 7;
+pub const OCRNL: ::tcflag_t = 0x10;
+pub const ONOCR: ::tcflag_t = 0x20;
+pub const ONLRET: ::tcflag_t = 0x40;
 
 f! {
     pub fn WIFCONTINUED(status: ::c_int) -> bool {
         status == 0x13
     }
 
     pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
         status >> 8
@@ -899,16 +957,23 @@ f! {
 extern {
     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
     pub fn endutxent();
     pub fn getutxent() -> *mut utmpx;
     pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
     pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
     pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
     pub fn setutxent();
+    pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
+    pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
+    pub fn getgrouplist(name: *const ::c_char,
+                        basegid: ::gid_t,
+                        groups: *mut ::gid_t,
+                        ngroups: *mut ::c_int) -> ::c_int;
+    pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
 }
 
 #[link(name = "util")]
 extern {
     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
@@ -929,16 +994,24 @@ extern {
     pub fn kevent(kq: ::c_int,
                   changelist: *const ::kevent,
                   nchanges: ::c_int,
                   eventlist: *mut ::kevent,
                   nevents: ::c_int,
                   timeout: *const ::timespec) -> ::c_int;
     pub fn mincore(addr: *const ::c_void, len: ::size_t,
                    vec: *mut ::c_char) -> ::c_int;
+    pub fn pwritev(fd: ::c_int,
+                   iov: *const ::iovec,
+                   iovcnt: ::c_int,
+                   offset: ::off_t) -> ::ssize_t;
+    pub fn preadv(fd: ::c_int,
+                  iov: *const ::iovec,
+                  iovcnt: ::c_int,
+                  offset: ::off_t) -> ::ssize_t;
     pub fn sysctlnametomib(name: *const ::c_char,
                            mibp: *mut ::c_int,
                            sizep: *mut ::size_t)
                            -> ::c_int;
     pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
                     -> ::c_int;
     pub fn sysctl(name: *const ::c_int,
                   namelen: ::c_uint,
@@ -950,17 +1023,17 @@ extern {
     pub fn sysctlbyname(name: *const ::c_char,
                         oldp: *mut ::c_void,
                         oldlenp: *mut ::size_t,
                         newp: *const ::c_void,
                         newlen: ::size_t)
                         -> ::c_int;
     pub fn sched_setscheduler(pid: ::pid_t,
                               policy: ::c_int,
-                              param: *const sched_param) -> ::c_int;
+                              param: *const ::sched_param) -> ::c_int;
     pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
     pub fn memrchr(cx: *const ::c_void,
                    c: ::c_int,
                    n: ::size_t) -> *mut ::c_void;
     pub fn sendfile(fd: ::c_int,
                     s: ::c_int,
                     offset: ::off_t,
                     nbytes: ::size_t,
@@ -1001,40 +1074,47 @@ extern {
     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
                                        pshared: ::c_int) -> ::c_int;
     pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
                                        pshared: *mut ::c_int) -> ::c_int;
     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
                                         pshared: ::c_int) -> ::c_int;
     pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
                                         pshared: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+                                         val: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+                                         val: ::c_int) -> ::c_int;
     pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
     pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
 
     pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
 
     pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
                   mode: ::mode_t, dev: dev_t) -> ::c_int;
     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
                     mode: ::mode_t) -> ::c_int;
     pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
                                      clock_id: *mut clockid_t) -> ::c_int;
     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
-                                     clock_id: clockid_t) -> ::c_int;
+                                     clock_id: ::clockid_t) -> ::c_int;
     pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
     pub fn sem_timedwait(sem: *mut sem_t,
                          abstime: *const ::timespec) -> ::c_int;
     pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
                                    abstime: *const ::timespec) -> ::c_int;
     pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
     pub fn ppoll(fds: *mut ::pollfd,
                  nfds: ::nfds_t,
                  timeout: *const ::timespec,
                  sigmask: *const sigset_t) -> ::c_int;
     pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+    pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+                   envp: *const *const ::c_char)
+                   -> ::c_int;
 }
 
 cfg_if! {
     if #[cfg(target_os = "freebsd")] {
         mod freebsd;
         pub use self::freebsd::*;
     } else if #[cfg(target_os = "dragonfly")] {
         mod dragonfly;
--- a/third_party/rust/libc/src/unix/bsd/mod.rs
+++ b/third_party/rust/libc/src/unix/bsd/mod.rs
@@ -175,27 +175,45 @@ pub const SIGVTALRM: ::c_int = 26;
 pub const SIGPROF: ::c_int = 27;
 pub const SIGWINCH: ::c_int = 28;
 pub const SIGINFO: ::c_int = 29;
 
 pub const SIG_SETMASK: ::c_int = 3;
 pub const SIG_BLOCK: ::c_int = 0x1;
 pub const SIG_UNBLOCK: ::c_int = 0x2;
 
+pub const IP_MULTICAST_IF: ::c_int = 9;
+pub const IP_MULTICAST_TTL: ::c_int = 10;
+pub const IP_MULTICAST_LOOP: ::c_int = 11;
+
 pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
 pub const IPV6_V6ONLY: ::c_int = 27;
 
 pub const ST_RDONLY: ::c_ulong = 1;
 
+pub const SCM_RIGHTS: ::c_int = 0x01;
+
 pub const NCCS: usize = 20;
 
+pub const O_ACCMODE: ::c_int = 0x3;
+pub const O_RDONLY: ::c_int = 0;
+pub const O_WRONLY: ::c_int = 1;
+pub const O_RDWR: ::c_int = 2;
+pub const O_APPEND: ::c_int = 8;
+pub const O_CREAT: ::c_int = 512;
+pub const O_TRUNC: ::c_int = 1024;
+pub const O_EXCL: ::c_int = 2048;
 pub const O_ASYNC: ::c_int = 0x40;
-pub const O_FSYNC: ::c_int = 0x80;
-pub const O_NDELAY: ::c_int = 0x4;
+pub const O_SYNC: ::c_int = 0x80;
+pub const O_NONBLOCK: ::c_int = 0x4;
 pub const O_NOFOLLOW: ::c_int = 0x100;
+pub const O_SHLOCK: ::c_int = 0x10;
+pub const O_EXLOCK: ::c_int = 0x20;
+pub const O_FSYNC: ::c_int = O_SYNC;
+pub const O_NDELAY: ::c_int = O_NONBLOCK;
 
 pub const F_GETOWN: ::c_int = 5;
 pub const F_SETOWN: ::c_int = 6;
 
 pub const MNT_FORCE: ::c_int = 0x80000;
 
 pub const Q_SYNC: ::c_int = 0x600;
 pub const Q_QUOTAON: ::c_int = 0x100;
@@ -216,22 +234,25 @@ pub const VEOL: usize = 1;
 pub const VEOL2: usize = 2;
 pub const VERASE: usize = 3;
 pub const VWERASE: usize = 4;
 pub const VKILL: usize = 5;
 pub const VREPRINT: usize = 6;
 pub const VINTR: usize = 8;
 pub const VQUIT: usize = 9;
 pub const VSUSP: usize = 10;
+pub const VDSUSP: usize = 11;
 pub const VSTART: usize = 12;
 pub const VSTOP: usize = 13;
 pub const VLNEXT: usize = 14;
 pub const VDISCARD: usize = 15;
 pub const VMIN: usize = 16;
 pub const VTIME: usize = 17;
+pub const VSTATUS: usize = 18;
+pub const _POSIX_VDISABLE: ::cc_t = 0xff;
 pub const IGNBRK: ::tcflag_t = 0x00000001;
 pub const BRKINT: ::tcflag_t = 0x00000002;
 pub const IGNPAR: ::tcflag_t = 0x00000004;
 pub const PARMRK: ::tcflag_t = 0x00000008;
 pub const INPCK: ::tcflag_t = 0x00000010;
 pub const ISTRIP: ::tcflag_t = 0x00000020;
 pub const INLCR: ::tcflag_t = 0x00000040;
 pub const IGNCR: ::tcflag_t = 0x00000080;
@@ -239,16 +260,17 @@ pub const ICRNL: ::tcflag_t = 0x00000100
 pub const IXON: ::tcflag_t = 0x00000200;
 pub const IXOFF: ::tcflag_t = 0x00000400;
 pub const IXANY: ::tcflag_t = 0x00000800;
 pub const IMAXBEL: ::tcflag_t = 0x00002000;
 pub const OPOST: ::tcflag_t = 0x1;
 pub const ONLCR: ::tcflag_t = 0x2;
 pub const OXTABS: ::tcflag_t = 0x4;
 pub const ONOEOT: ::tcflag_t = 0x8;
+pub const CIGNORE: ::tcflag_t = 0x00000001;
 pub const CSIZE: ::tcflag_t = 0x00000300;
 pub const CS5: ::tcflag_t = 0x00000000;
 pub const CS6: ::tcflag_t = 0x00000100;
 pub const CS7: ::tcflag_t = 0x00000200;
 pub const CS8: ::tcflag_t = 0x00000300;
 pub const CSTOPB: ::tcflag_t = 0x00000400;
 pub const CREAD: ::tcflag_t = 0x00000800;
 pub const PARENB: ::tcflag_t = 0x00001000;
@@ -259,38 +281,48 @@ pub const ECHOKE: ::tcflag_t = 0x0000000
 pub const ECHOE: ::tcflag_t = 0x00000002;
 pub const ECHOK: ::tcflag_t = 0x00000004;
 pub const ECHO: ::tcflag_t = 0x00000008;
 pub const ECHONL: ::tcflag_t = 0x00000010;
 pub const ECHOPRT: ::tcflag_t = 0x00000020;
 pub const ECHOCTL: ::tcflag_t = 0x00000040;
 pub const ISIG: ::tcflag_t = 0x00000080;
 pub const ICANON: ::tcflag_t = 0x00000100;
+pub const ALTWERASE: ::tcflag_t = 0x00000200;
 pub const IEXTEN: ::tcflag_t = 0x00000400;
 pub const EXTPROC: ::tcflag_t = 0x00000800;
 pub const TOSTOP: ::tcflag_t = 0x00400000;
 pub const FLUSHO: ::tcflag_t = 0x00800000;
+pub const NOKERNINFO: ::tcflag_t = 0x02000000;
 pub const PENDIN: ::tcflag_t = 0x20000000;
 pub const NOFLSH: ::tcflag_t = 0x80000000;
+pub const MDMBUF: ::tcflag_t = 0x00100000;
 
 pub const WNOHANG: ::c_int = 0x00000001;
 pub const WUNTRACED: ::c_int = 0x00000002;
 
 pub const RTLD_NOW: ::c_int = 0x2;
 pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void;
 pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
 pub const RTLD_SELF: *mut ::c_void = -3isize as *mut ::c_void;
 
 pub const LOG_CRON: ::c_int = 9 << 3;
 pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
 pub const LOG_FTP: ::c_int = 11 << 3;
 pub const LOG_PERROR: ::c_int = 0x20;
 
+pub const TCP_MAXSEG: ::c_int = 2;
+
 pub const PIPE_BUF: usize = 512;
 
+pub const POLLRDNORM: ::c_short = 0x040;
+pub const POLLWRNORM: ::c_short = 0x004;
+pub const POLLRDBAND: ::c_short = 0x080;
+pub const POLLWRBAND: ::c_short = 0x100;
+
 f! {
     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
         let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
         let fd = fd as usize;
         (*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
         return
     }
 
@@ -334,31 +366,20 @@ extern {
     pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
     pub fn freeifaddrs(ifa: *mut ::ifaddrs);
     pub fn setgroups(ngroups: ::c_int,
                      ptr: *const ::gid_t) -> ::c_int;
     pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
     pub fn kqueue() -> ::c_int;
     pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;
     pub fn syscall(num: ::c_int, ...) -> ::c_int;
-    #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
-    pub fn getpwnam_r(name: *const ::c_char,
-                      pwd: *mut passwd,
-                      buf: *mut ::c_char,
-                      buflen: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
-    #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
-    pub fn getpwuid_r(uid: ::uid_t,
-                      pwd: *mut passwd,
-                      buf: *mut ::c_char,
-                      buflen: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
     #[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")]
     pub fn getpwent() -> *mut passwd;
     pub fn setpwent();
+    pub fn endpwent();
     pub fn getprogname() -> *const ::c_char;
     pub fn setprogname(name: *const ::c_char);
     pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
     pub fn if_nameindex() -> *mut if_nameindex;
     pub fn if_freenameindex(ptr: *mut if_nameindex);
 
     pub fn getpeereid(socket: ::c_int,
                       euid: *mut ::uid_t,
@@ -429,16 +450,77 @@ extern {
                    msg: *const ::msghdr,
                    flags: ::c_int) -> ::ssize_t;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "recvmsg$UNIX2003")]
     pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
                    -> ::ssize_t;
 
     pub fn sync();
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+    pub fn getgrgid_r(uid: ::uid_t,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "sigaltstack$UNIX2003")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+    pub fn sigaltstack(ss: *const stack_t,
+                       oss: *mut stack_t) -> ::c_int;
+    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+    pub fn getdtablesize() -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+    pub fn getgrnam_r(name: *const ::c_char,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "pthread_sigmask$UNIX2003")]
+    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+                           oldset: *mut sigset_t) -> ::c_int;
+    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+    pub fn getpwnam_r(name: *const ::c_char,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+    pub fn getpwuid_r(uid: ::uid_t,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+               link_name = "sigwait$UNIX2003")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+    pub fn sigwait(set: *const sigset_t,
+                   sig: *mut ::c_int) -> ::c_int;
+    pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+                          parent: Option<unsafe extern fn()>,
+                          child: Option<unsafe extern fn()>) -> ::c_int;
+    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "popen$UNIX2003")]
+    pub fn popen(command: *const c_char,
+                 mode: *const c_char) -> *mut ::FILE;
+    pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
+                     mode: ::c_int, flags: ::c_int) -> ::c_int;
+    pub fn pthread_create(native: *mut ::pthread_t,
+                          attr: *const ::pthread_attr_t,
+                          f: extern fn(*mut ::c_void) -> *mut ::c_void,
+                          value: *mut ::c_void) -> ::c_int;
 }
 
 cfg_if! {
     if #[cfg(any(target_os = "macos", target_os = "ios"))] {
         mod apple;
         pub use self::apple::*;
     } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd",
                         target_os = "bitrig"))] {
--- a/third_party/rust/libc/src/unix/bsd/netbsdlike/mod.rs
+++ b/third_party/rust/libc/src/unix/bsd/netbsdlike/mod.rs
@@ -122,26 +122,17 @@ pub const SEEK_CUR : ::c_int = 1;
 pub const SEEK_END : ::c_int = 2;
 pub const _IOFBF : ::c_int = 0;
 pub const _IONBF : ::c_int = 2;
 pub const _IOLBF : ::c_int = 1;
 pub const BUFSIZ : ::c_uint = 1024;
 pub const FOPEN_MAX : ::c_uint = 20;
 pub const FILENAME_MAX : ::c_uint = 1024;
 pub const L_tmpnam : ::c_uint = 1024;
-pub const O_RDONLY : ::c_int = 0;
-pub const O_WRONLY : ::c_int = 1;
-pub const O_RDWR : ::c_int = 2;
-pub const O_ACCMODE : ::c_int = 3;
-pub const O_APPEND : ::c_int = 8;
-pub const O_CREAT : ::c_int = 512;
-pub const O_EXCL : ::c_int = 2048;
 pub const O_NOCTTY : ::c_int = 32768;
-pub const O_TRUNC : ::c_int = 1024;
-pub const O_SYNC : ::c_int = 128;
 pub const S_IFIFO : mode_t = 4096;
 pub const S_IFCHR : mode_t = 8192;
 pub const S_IFBLK : mode_t = 24576;
 pub const S_IFDIR : mode_t = 16384;
 pub const S_IFREG : mode_t = 32768;
 pub const S_IFLNK : mode_t = 40960;
 pub const S_IFSOCK : mode_t = 49152;
 pub const S_IFMT : mode_t = 61440;
@@ -311,31 +302,29 @@ pub const GLOB_NOMATCH  : ::c_int = -3;
 pub const GLOB_NOSYS : ::c_int = -4;
 
 pub const POSIX_MADV_NORMAL : ::c_int = 0;
 pub const POSIX_MADV_RANDOM : ::c_int = 1;
 pub const POSIX_MADV_SEQUENTIAL : ::c_int = 2;
 pub const POSIX_MADV_WILLNEED : ::c_int = 3;
 pub const POSIX_MADV_DONTNEED : ::c_int = 4;
 
-pub const _SC_XOPEN_SHM : ::c_int = 30;
-
 pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0;
 pub const PTHREAD_CREATE_DETACHED : ::c_int = 1;
 
 // http://man.openbsd.org/OpenBSD-current/man2/clock_getres.2
 // The man page says clock_gettime(3) can accept various values as clockid_t but
 // http://fxr.watson.org/fxr/source/kern/kern_time.c?v=OPENBSD;im=excerpts#L161
 // the implementation rejects anything other than the below two
 //
 // http://netbsd.gw.com/cgi-bin/man-cgi?clock_gettime
 // https://github.com/jsonn/src/blob/HEAD/sys/kern/subr_time.c#L222
 // Basically the same goes for NetBSD
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 3;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 3;
 
 pub const RLIMIT_CPU: ::c_int = 0;
 pub const RLIMIT_FSIZE: ::c_int = 1;
 pub const RLIMIT_DATA: ::c_int = 2;
 pub const RLIMIT_STACK: ::c_int = 3;
 pub const RLIMIT_CORE: ::c_int = 4;
 pub const RLIMIT_RSS: ::c_int = 5;
 pub const RLIMIT_MEMLOCK: ::c_int = 6;
@@ -413,24 +402,18 @@ pub const PF_INET6: ::c_int = AF_INET6;
 pub const PF_RTIP: ::c_int = pseudo_AF_RTIP;
 pub const PF_PIP: ::c_int = pseudo_AF_PIP;
 pub const PF_ISDN: ::c_int = AF_ISDN;
 pub const PF_NATM: ::c_int = AF_NATM;
 
 pub const SOCK_STREAM: ::c_int = 1;
 pub const SOCK_DGRAM: ::c_int = 2;
 pub const SOCK_RAW: ::c_int = 3;
+pub const SOCK_RDM: ::c_int = 4;
 pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
-pub const IP_MULTICAST_TTL: ::c_int = 10;
-pub const IP_MULTICAST_LOOP: ::c_int = 11;
 pub const IP_TTL: ::c_int = 4;
 pub const IP_HDRINCL: ::c_int = 2;
 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
 
 pub const TCP_NODELAY: ::c_int = 0x01;
 pub const SOL_SOCKET: ::c_int = 0xffff;
 pub const SO_DEBUG: ::c_int = 0x01;
@@ -460,31 +443,27 @@ pub const MSG_TRUNC: ::c_int = 0x10;
 pub const MSG_CTRUNC: ::c_int = 0x20;
 pub const MSG_WAITALL: ::c_int = 0x40;
 pub const MSG_DONTWAIT: ::c_int = 0x80;
 pub const MSG_BCAST: ::c_int = 0x100;
 pub const MSG_MCAST: ::c_int = 0x200;
 pub const MSG_NOSIGNAL: ::c_int = 0x400;
 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
 
-pub const SCM_RIGHTS: ::c_int = 0x01;
-
 pub const IFF_LOOPBACK: ::c_int = 0x8;
 
 pub const SHUT_RD: ::c_int = 0;
 pub const SHUT_WR: ::c_int = 1;
 pub const SHUT_RDWR: ::c_int = 2;
 
 pub const LOCK_SH: ::c_int = 1;
 pub const LOCK_EX: ::c_int = 2;
 pub const LOCK_NB: ::c_int = 4;
 pub const LOCK_UN: ::c_int = 8;
 
-pub const O_NONBLOCK : ::c_int = 4;
-
 pub const IPPROTO_RAW : ::c_int = 255;
 
 pub const _SC_ARG_MAX : ::c_int = 1;
 pub const _SC_CHILD_MAX : ::c_int = 2;
 pub const _SC_NGROUPS_MAX : ::c_int = 4;
 pub const _SC_OPEN_MAX : ::c_int = 5;
 pub const _SC_JOB_CONTROL : ::c_int = 6;
 pub const _SC_SAVED_IDS : ::c_int = 7;
@@ -506,16 +485,17 @@ pub const _SC_2_FORT_RUN : ::c_int = 22;
 pub const _SC_2_LOCALEDEF : ::c_int = 23;
 pub const _SC_2_SW_DEV : ::c_int = 24;
 pub const _SC_2_UPE : ::c_int = 25;
 pub const _SC_STREAM_MAX : ::c_int = 26;
 pub const _SC_TZNAME_MAX : ::c_int = 27;
 pub const _SC_PAGESIZE : ::c_int = 28;
 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
 pub const _SC_FSYNC : ::c_int = 29;
+pub const _SC_XOPEN_SHM : ::c_int = 30;
 
 pub const Q_GETQUOTA: ::c_int = 0x300;
 pub const Q_SETQUOTA: ::c_int = 0x400;
 
 pub const RTLD_GLOBAL: ::c_int = 0x100;
 
 pub const LOG_NFACILITIES: ::c_int = 24;
 
@@ -544,16 +524,33 @@ pub const B57600: speed_t = 57600;
 pub const B76800: speed_t = 76800;
 pub const B115200: speed_t = 115200;
 pub const B230400: speed_t = 230400;
 pub const EXTA: speed_t = 19200;
 pub const EXTB: speed_t = 38400;
 
 pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
 
+pub const CRTSCTS: ::tcflag_t = 0x00010000;
+pub const CRTS_IFLOW: ::tcflag_t = CRTSCTS;
+pub const CCTS_OFLOW: ::tcflag_t = CRTSCTS;
+pub const OCRNL: ::tcflag_t = 0x10;
+
+pub const TIOCM_LE: ::c_int = 0o0001;
+pub const TIOCM_DTR: ::c_int = 0o0002;
+pub const TIOCM_RTS: ::c_int = 0o0004;
+pub const TIOCM_ST: ::c_int = 0o0010;
+pub const TIOCM_SR: ::c_int = 0o0020;
+pub const TIOCM_CTS: ::c_int = 0o0040;
+pub const TIOCM_CAR: ::c_int = 0o0100;
+pub const TIOCM_RNG: ::c_int = 0o0200;
+pub const TIOCM_DSR: ::c_int = 0o0400;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
 f! {
     pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
         status >> 8
     }
 
     pub fn WIFSIGNALED(status: ::c_int) -> bool {
         (status & 0o177) != 0o177 && (status & 0o177) != 0
     }
@@ -563,31 +560,39 @@ f! {
     }
 }
 
 #[link(name = "util")]
 extern {
     pub fn mincore(addr: *mut ::c_void, len: ::size_t,
                    vec: *mut ::c_char) -> ::c_int;
     #[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
-    pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
     #[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
-    pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
     #[cfg_attr(target_os = "netbsd", link_name = "__clock_settime50")]
-    pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+    pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
     pub fn __errno() -> *mut ::c_int;
     pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
                     -> ::c_int;
     pub fn memrchr(cx: *const ::c_void,
                    c: ::c_int,
                    n: ::size_t) -> *mut ::c_void;
     pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
     pub fn mkostemps(template: *mut ::c_char,
                      suffixlen: ::c_int,
                      flags: ::c_int) -> ::c_int;
+    pub fn pwritev(fd: ::c_int,
+                   iov: *const ::iovec,
+                   iovcnt: ::c_int,
+                   offset: ::off_t) -> ::ssize_t;
+    pub fn preadv(fd: ::c_int,
+                  iov: *const ::iovec,
+                  iovcnt: ::c_int,
+                  offset: ::off_t) -> ::ssize_t;
     pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
     pub fn fdatasync(fd: ::c_int) -> ::c_int;
     pub fn openpty(amaster: *mut ::c_int,
                    aslave: *mut ::c_int,
                    name: *mut ::c_char,
                    termp: *mut termios,
                    winp: *mut ::winsize) -> ::c_int;
     pub fn forkpty(amaster: *mut ::c_int,
@@ -601,21 +606,30 @@ extern {
 
     pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
                    mode: ::mode_t, dev: dev_t) -> ::c_int;
     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
                     mode: ::mode_t) -> ::c_int;
     pub fn sem_timedwait(sem: *mut sem_t,
                          abstime: *const ::timespec) -> ::c_int;
     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
-                                     clock_id: clockid_t) -> ::c_int;
+                                     clock_id: ::clockid_t) -> ::c_int;
     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
     pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
                                    abstime: *const ::timespec) -> ::c_int;
     pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
+
+    pub fn getgrouplist(name: *const ::c_char,
+                        basegid: ::gid_t,
+                        groups: *mut ::gid_t,
+                        ngroups: *mut ::c_int) -> ::c_int;
+    pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
+    pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+                   envp: *const *const ::c_char)
+                   -> ::c_int;
 }
 
 cfg_if! {
     if #[cfg(target_os = "netbsd")] {
         mod netbsd;
         pub use self::netbsd::*;
     } else if #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] {
         mod openbsdlike;
--- a/third_party/rust/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/third_party/rust/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -160,16 +160,21 @@ s! {
         ptm_spare2: *mut ::c_void,
     }
 
     pub struct pthread_mutexattr_t {
         ptma_magic: ::c_uint,
         ptma_private: *mut ::c_void,
     }
 
+    pub struct pthread_rwlockattr_t {
+        ptra_magic: ::c_uint,
+        ptra_private: *mut ::c_void,
+    }
+
     pub struct pthread_cond_t {
         ptc_magic: ::c_uint,
         ptc_lock: ::c_uchar,
         ptc_waiters_first: *mut u8,
         ptc_waiters_last: *mut u8,
         ptc_mutex: *mut ::pthread_mutex_t,
         ptc_private: *mut ::c_void,
     }
@@ -239,16 +244,48 @@ s! {
         pub n_sign_posn: ::c_char,
         pub int_p_cs_precedes: ::c_char,
         pub int_n_cs_precedes: ::c_char,
         pub int_p_sep_by_space: ::c_char,
         pub int_n_sep_by_space: ::c_char,
         pub int_p_sign_posn: ::c_char,
         pub int_n_sign_posn: ::c_char,
     }
+
+    pub struct if_data {
+        pub ifi_type: ::c_uchar,
+        pub ifi_addrlen: ::c_uchar,
+        pub ifi_hdrlen: ::c_uchar,
+        pub ifi_link_state: ::c_int,
+        pub ifi_mtu: u64,
+        pub ifi_metric: u64,
+        pub ifi_baudrate: u64,
+        pub ifi_ipackets: u64,
+        pub ifi_ierrors: u64,
+        pub ifi_opackets: u64,
+        pub ifi_oerrors: u64,
+        pub ifi_collisions: u64,
+        pub ifi_ibytes: u64,
+        pub ifi_obytes: u64,
+        pub ifi_imcasts: u64,
+        pub ifi_omcasts: u64,
+        pub ifi_iqdrops: u64,
+        pub ifi_noproto: u64,
+        pub ifi_lastchange: ::timespec,
+    }
+
+    pub struct if_msghdr {
+        pub ifm_msglen: ::c_ushort,
+        pub ifm_version: ::c_uchar,
+        pub ifm_type: ::c_uchar,
+        pub ifm_addrs: ::c_int,
+        pub ifm_flags: ::c_int,
+        pub ifm_index: ::c_ushort,
+        pub ifm_data: if_data,
+    }
 }
 
 pub const AT_FDCWD: ::c_int = -100;
 pub const AT_EACCESS: ::c_int = 0x100;
 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
 pub const AT_REMOVEDIR: ::c_int = 0x800;
 
@@ -265,19 +302,19 @@ pub const ERA_D_FMT: ::nl_item = 53;
 pub const ERA_D_T_FMT: ::nl_item = 54;
 pub const ERA_T_FMT: ::nl_item = 55;
 pub const ALT_DIGITS: ::nl_item = 56;
 
 pub const O_CLOEXEC: ::c_int = 0x400000;
 pub const O_ALT_IO: ::c_int = 0x40000;
 pub const O_NOSIGPIPE: ::c_int = 0x1000000;
 pub const O_SEARCH: ::c_int = 0x800000;
-pub const O_EXLOCK: ::c_int = 0x20;
-pub const O_SHLOCK: ::c_int = 0x10;
 pub const O_DIRECTORY: ::c_int = 0x200000;
+pub const O_DIRECT : ::c_int = 0x00080000;
+pub const O_RSYNC : ::c_int = 0x00020000;
 
 pub const MS_SYNC : ::c_int = 0x4;
 pub const MS_INVALIDATE : ::c_int = 0x2;
 
 pub const RLIM_NLIMITS: ::c_int = 12;
 
 pub const ENOATTR : ::c_int = 93;
 pub const EILSEQ : ::c_int = 85;
@@ -344,52 +381,101 @@ pub const SCM_CREDS: ::c_int = 0x10;
 
 pub const O_DSYNC : ::c_int = 0x10000;
 
 pub const MAP_RENAME : ::c_int = 0x20;
 pub const MAP_NORESERVE : ::c_int = 0x40;
 pub const MAP_HASSEMAPHORE : ::c_int = 0x200;
 pub const MAP_WIRED: ::c_int = 0x800;
 
+pub const _PC_LINK_MAX : ::c_int = 1;
+pub const _PC_MAX_CANON : ::c_int = 2;
+pub const _PC_MAX_INPUT : ::c_int = 3;
+pub const _PC_NAME_MAX : ::c_int = 4;
+pub const _PC_PATH_MAX : ::c_int = 5;
+pub const _PC_PIPE_BUF : ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED : ::c_int = 7;
+pub const _PC_NO_TRUNC : ::c_int = 8;
+pub const _PC_VDISABLE : ::c_int = 9;
+pub const _PC_SYNC_IO : ::c_int = 10;
+pub const _PC_FILESIZEBITS : ::c_int = 11;
+pub const _PC_SYMLINK_MAX : ::c_int = 12;
+pub const _PC_2_SYMLINKS : ::c_int = 13;
+pub const _PC_ACL_EXTENDED : ::c_int = 14;
+pub const _PC_MIN_HOLE_SIZE : ::c_int = 15;
+
+pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
 pub const _SC_IOV_MAX : ::c_int = 32;
-pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47;
-pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 48;
-pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
-pub const _SC_MQ_PRIO_MAX : ::c_int = 55;
-pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002;
-pub const _SC_THREADS : ::c_int = 41;
-pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
-pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 57;
-pub const _SC_THREAD_KEYS_MAX : ::c_int = 58;
-pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 64;
-pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 65;
-pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
-pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 66;
-pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 67;
-pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
-pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
-pub const _SC_TTY_NAME_MAX : ::c_int = 68;
-pub const _SC_ATEXIT_MAX : ::c_int = 40;
-pub const _SC_CLK_TCK : ::c_int = 39;
-pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
-pub const _SC_AIO_MAX : ::c_int = 52;
-pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
 pub const _SC_MAPPED_FILES : ::c_int = 33;
 pub const _SC_MEMLOCK : ::c_int = 34;
 pub const _SC_MEMLOCK_RANGE : ::c_int = 35;
 pub const _SC_MEMORY_PROTECTION : ::c_int = 36;
+pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
+pub const _SC_MONOTONIC_CLOCK : ::c_int = 38;
+pub const _SC_CLK_TCK : ::c_int = 39;
+pub const _SC_ATEXIT_MAX : ::c_int = 40;
+pub const _SC_THREADS : ::c_int = 41;
+pub const _SC_SEMAPHORES : ::c_int = 42;
+pub const _SC_BARRIERS : ::c_int = 43;
+pub const _SC_TIMERS : ::c_int = 44;
+pub const _SC_SPIN_LOCKS : ::c_int = 45;
+pub const _SC_READER_WRITER_LOCKS : ::c_int = 46;
+pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47;
+pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 48;
+pub const _SC_CLOCK_SELECTION : ::c_int = 49;
+pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
+pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
+pub const _SC_AIO_MAX : ::c_int = 52;
 pub const _SC_MESSAGE_PASSING : ::c_int = 53;
 pub const _SC_MQ_OPEN_MAX : ::c_int = 54;
+pub const _SC_MQ_PRIO_MAX : ::c_int = 55;
 pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56;
-pub const _SC_SEMAPHORES : ::c_int = 42;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 57;
+pub const _SC_THREAD_KEYS_MAX : ::c_int = 58;
+pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
+pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
+pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
+pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
+pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
+pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 64;
+pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 65;
+pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 66;
+pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 67;
+pub const _SC_TTY_NAME_MAX : ::c_int = 68;
+pub const _SC_HOST_NAME_MAX : ::c_int = 69;
+pub const _SC_PASS_MAX : ::c_int = 70;
+pub const _SC_REGEXP : ::c_int = 71;
+pub const _SC_SHELL : ::c_int = 72;
+pub const _SC_SYMLOOP_MAX : ::c_int = 73;
+pub const _SC_V6_ILP32_OFF32 : ::c_int = 74;
+pub const _SC_V6_ILP32_OFFBIG : ::c_int = 75;
+pub const _SC_V6_LP64_OFF64 : ::c_int = 76;
+pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 77;
+pub const _SC_2_PBS : ::c_int = 80;
+pub const _SC_2_PBS_ACCOUNTING : ::c_int = 81;
+pub const _SC_2_PBS_CHECKPOINT : ::c_int = 82;
+pub const _SC_2_PBS_LOCATE : ::c_int = 83;
+pub const _SC_2_PBS_MESSAGE : ::c_int = 84;
+pub const _SC_2_PBS_TRACK : ::c_int = 85;
+pub const _SC_SPAWN : ::c_int = 86;
 pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87;
-pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
-pub const _SC_TIMERS : ::c_int = 44;
-pub const _SC_HOST_NAME_MAX : ::c_int = 69;
+pub const _SC_TIMER_MAX : ::c_int = 88;
+pub const _SC_SEM_NSEMS_MAX : ::c_int = 89;
+pub const _SC_CPUTIME : ::c_int = 90;
+pub const _SC_THREAD_CPUTIME : ::c_int = 91;
+pub const _SC_DELAYTIMER_MAX : ::c_int = 92;
+// These two variables will be supported in NetBSD 8.0
+// pub const _SC_SIGQUEUE_MAX : ::c_int = 93;
+// pub const _SC_REALTIME_SIGNALS : ::c_int = 94;
+pub const _SC_PHYS_PAGES : ::c_int = 121;
+pub const _SC_NPROCESSORS_CONF : ::c_int = 1001;
+pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002;
+pub const _SC_SCHED_RT_TS : ::c_int = 2001;
+pub const _SC_SCHED_PRI_MIN : ::c_int = 2002;
+pub const _SC_SCHED_PRI_MAX : ::c_int = 2003;
 
 pub const FD_SETSIZE: usize = 0x100;
 
 pub const ST_NOSUID: ::c_ulong = 8;
 
 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
     ptm_magic: 0x33330003,
     ptm_errorcheck: 0,
@@ -458,18 +544,16 @@ pub const NOTE_EXIT: ::uint32_t = 0x8000
 pub const NOTE_FORK: ::uint32_t = 0x40000000;
 pub const NOTE_EXEC: ::uint32_t = 0x20000000;
 pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
 pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
 pub const NOTE_TRACK: ::uint32_t = 0x00000001;
 pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
 pub const NOTE_CHILD: ::uint32_t = 0x00000004;
 
-pub const CRTSCTS: ::tcflag_t = 0x00010000;
-
 pub const TMP_MAX : ::c_uint = 308915776;
 
 pub const NI_MAXHOST: ::socklen_t = 1025;
 
 pub const RTLD_NOLOAD: ::c_int = 0x2000;
 pub const RTLD_LOCAL: ::c_int = 0x200;
 
 pub const CTL_MAXNAME: ::c_int = 12;
@@ -639,23 +723,35 @@ pub const WNOWAIT: ::c_int = 0x00010000;
 
 pub const P_ALL: idtype_t = 0;
 pub const P_PID: idtype_t = 1;
 pub const P_PGID: idtype_t = 4;
 
 pub const B460800: ::speed_t = 460800;
 pub const B921600: ::speed_t = 921600;
 
+pub const ONOCR: ::tcflag_t = 0x20;
+pub const ONLRET: ::tcflag_t = 0x40;
+pub const CDTRCTS: ::tcflag_t = 0x00020000;
+pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
+
+pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
+pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
+
 // dirfd() is a macro on netbsd to access
 // the first field of the struct where dirp points to:
 // http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
 f! {
     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
         unsafe { *(dirp as *const ::c_int) }
     }
+
+    pub fn WIFCONTINUED(status: ::c_int) -> bool {
+        status == 0xffff
+    }
 }
 
 extern {
     pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
     pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
     pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
     pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
     pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
@@ -697,17 +793,17 @@ extern {
                   nevents: ::size_t,
                   timeout: *const ::timespec) -> ::c_int;
     #[link_name = "__mount50"]
     pub fn mount(src: *const ::c_char,
                  target: *const ::c_char,
                  flags: ::c_int,
                  data: *mut ::c_void,
                  size: ::size_t) -> ::c_int;
-    pub fn ptrace(requeset: ::c_int,
+    pub fn ptrace(request: ::c_int,
                   pid: ::pid_t,
                   addr: *mut ::c_void,
                   data: ::c_int) -> ::c_int;
     pub fn pthread_setname_np(t: ::pthread_t,
                               name: *const ::c_char,
                               arg: *mut ::c_void) -> ::c_int;
     pub fn pthread_getattr_np(native: ::pthread_t,
                               attr: *mut ::pthread_attr_t) -> ::c_int;
--- a/third_party/rust/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/third_party/rust/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
@@ -1,21 +1,24 @@
+use unix::bsd::O_SYNC;
+
 pub type clock_t = i64;
 pub type suseconds_t = ::c_long;
 pub type dev_t = i32;
 pub type sigset_t = ::c_uint;
 pub type blksize_t = ::int32_t;
 pub type fsblkcnt_t = ::uint64_t;
 pub type fsfilcnt_t = ::uint64_t;
 pub type pthread_attr_t = *mut ::c_void;
 pub type pthread_mutex_t = *mut ::c_void;
 pub type pthread_mutexattr_t = *mut ::c_void;
 pub type pthread_cond_t = *mut ::c_void;
 pub type pthread_condattr_t = *mut ::c_void;
 pub type pthread_rwlock_t = *mut ::c_void;
+pub type pthread_rwlockattr_t = *mut ::c_void;
 
 s! {
     pub struct dirent {
         pub d_fileno: ::ino_t,
         pub d_off: ::off_t,
         pub d_reclen: u16,
         pub d_type: u8,
         pub d_namlen: u8,
@@ -128,29 +131,73 @@ s! {
     }
 
     pub struct utmp {
         pub ut_line: [::c_char; UT_LINESIZE],
         pub ut_name: [::c_char; UT_NAMESIZE],
         pub ut_host: [::c_char; UT_HOSTSIZE],
         pub ut_time: ::time_t,
     }
+
+    pub struct if_data {
+        pub ifi_type: ::c_uchar,
+        pub ifi_addrlen: ::c_uchar,
+        pub ifi_hdrlen: ::c_uchar,
+        pub ifi_link_state: ::c_uchar,
+        pub ifi_mtu: u32,
+        pub ifi_metric: u32,
+        pub ifi_rdomain: u32,
+        pub ifi_baudrate: u64,
+        pub ifi_ipackets: u64,
+        pub ifi_ierrors: u64,
+        pub ifi_opackets: u64,
+        pub ifi_oerrors: u64,
+        pub ifi_collisions: u64,
+        pub ifi_ibytes: u64,
+        pub ifi_obytes: u64,
+        pub ifi_imcasts: u64,
+        pub ifi_omcasts: u64,
+        pub ifi_iqdrops: u64,
+        pub ifi_oqdrops: u64,
+        pub ifi_noproto: u64,
+        pub ifi_capabilities: u32,
+        pub ifi_lastchange: ::timeval,
+    }
+
+    pub struct if_msghdr {
+        pub ifm_msglen: ::c_ushort,
+        pub ifm_version: ::c_uchar,
+        pub ifm_type: ::c_uchar,
+        pub ifm_hdrlen: ::c_ushort,
+        pub ifm_index: ::c_ushort,
+        pub ifm_tableid: ::c_ushort,
+        pub ifm_pad1: ::c_uchar,
+        pub ifm_pad2: ::c_uchar,
+        pub ifm_addrs: ::c_int,
+        pub ifm_flags: ::c_int,
+        pub ifm_xflags: ::c_int,
+        pub ifm_data: if_data,
+    }
 }
 
 pub const UT_NAMESIZE: usize = 32;
 pub const UT_LINESIZE: usize = 8;
 pub const UT_HOSTSIZE: usize = 256;
 
 pub const O_CLOEXEC: ::c_int = 0x10000;
+pub const O_DIRECTORY: ::c_int = 0x20000;
+pub const O_RSYNC: ::c_int = O_SYNC;
 
 pub const MS_SYNC : ::c_int = 0x0002;
 pub const MS_INVALIDATE : ::c_int = 0x0004;
 
 pub const PTHREAD_STACK_MIN : ::size_t = 2048;
 
+pub const POLLNORM: ::c_short = ::POLLRDNORM;
+
 pub const ENOATTR : ::c_int = 83;
 pub const EILSEQ : ::c_int = 84;
 pub const EOVERFLOW : ::c_int = 87;
 pub const ECANCELED : ::c_int = 88;
 pub const EIDRM : ::c_int = 89;
 pub const ENOMSG : ::c_int = 90;
 pub const ENOTSUP : ::c_int = 91;
 pub const ELAST : ::c_int = 91;
@@ -160,16 +207,17 @@ pub const F_DUPFD_CLOEXEC : ::c_int = 10
 pub const AT_FDCWD: ::c_int = -100;
 pub const AT_EACCESS: ::c_int = 0x01;
 pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x02;
 pub const AT_SYMLINK_FOLLOW: ::c_int = 0x04;
 pub const AT_REMOVEDIR: ::c_int = 0x08;
 
 pub const RLIM_NLIMITS: ::c_int = 9;
 
+pub const SO_TIMESTAMP: ::c_int = 0x0800;
 pub const SO_SNDTIMEO: ::c_int = 0x1005;
 pub const SO_RCVTIMEO: ::c_int = 0x1006;
 pub const SO_BINDANY: ::c_int = 0x1000;
 pub const SO_NETPROC: ::c_int = 0x1020;
 pub const SO_RTABLE: ::c_int = 0x1021;
 pub const SO_PEERCRED: ::c_int = 0x1022;
 pub const SO_SPLICE: ::c_int = 0x1023;
 
@@ -227,68 +275,138 @@ pub const EMEDIUMTYPE : ::c_int = 86;
 
 pub const EAI_SYSTEM: ::c_int = -11;
 
 pub const RUSAGE_THREAD: ::c_int = 1;
 
 pub const MAP_COPY : ::c_int = 0x0002;
 pub const MAP_NOEXTEND : ::c_int = 0x0000;
 
+pub const _PC_LINK_MAX : ::c_int = 1;
+pub const _PC_MAX_CANON : ::c_int = 2;
+pub const _PC_MAX_INPUT : ::c_int = 3;
+pub const _PC_NAME_MAX : ::c_int = 4;
+pub const _PC_PATH_MAX : ::c_int = 5;
+pub const _PC_PIPE_BUF : ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED : ::c_int = 7;
+pub const _PC_NO_TRUNC : ::c_int = 8;
+pub const _PC_VDISABLE : ::c_int = 9;
+pub const _PC_2_SYMLINKS : ::c_int = 10;
+pub const _PC_ALLOC_SIZE_MIN : ::c_int = 11;
+pub const _PC_ASYNC_IO : ::c_int = 12;
+pub const _PC_FILESIZEBITS : ::c_int = 13;
+pub const _PC_PRIO_IO : ::c_int = 14;
+pub const _PC_REC_INCR_XFER_SIZE : ::c_int = 15;
+pub const _PC_REC_MAX_XFER_SIZE : ::c_int = 16;
+pub const _PC_REC_MIN_XFER_SIZE : ::c_int = 17;
+pub const _PC_REC_XFER_ALIGN : ::c_int = 18;
+pub const _PC_SYMLINK_MAX : ::c_int = 19;
+pub const _PC_SYNC_IO : ::c_int = 20;
+pub const _PC_TIMESTAMP_RESOLUTION : ::c_int = 21;
+
 pub const _SC_CLK_TCK : ::c_int = 3;
+pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
+pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
+pub const _SC_HOST_NAME_MAX : ::c_int = 33;
+pub const _SC_MONOTONIC_CLOCK : ::c_int = 34;
+pub const _SC_2_PBS : ::c_int = 35;
+pub const _SC_2_PBS_ACCOUNTING : ::c_int = 36;
+pub const _SC_2_PBS_CHECKPOINT : ::c_int = 37;
+pub const _SC_2_PBS_LOCATE : ::c_int = 38;
+pub const _SC_2_PBS_MESSAGE : ::c_int = 39;
+pub const _SC_2_PBS_TRACK : ::c_int = 40;
+pub const _SC_ADVISORY_INFO : ::c_int = 41;
+pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
+pub const _SC_AIO_MAX : ::c_int = 43;
+pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
+pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
+pub const _SC_ATEXIT_MAX : ::c_int = 46;
+pub const _SC_BARRIERS : ::c_int = 47;
+pub const _SC_CLOCK_SELECTION : ::c_int = 48;
+pub const _SC_CPUTIME : ::c_int = 49;
+pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
 pub const _SC_IOV_MAX : ::c_int = 51;
-pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
-pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
-pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
+pub const _SC_IPV6 : ::c_int = 52;
+pub const _SC_MAPPED_FILES : ::c_int = 53;
+pub const _SC_MEMLOCK : ::c_int = 54;
+pub const _SC_MEMLOCK_RANGE : ::c_int = 55;
+pub const _SC_MEMORY_PROTECTION : ::c_int = 56;
+pub const _SC_MESSAGE_PASSING : ::c_int = 57;
+pub const _SC_MQ_OPEN_MAX : ::c_int = 58;
 pub const _SC_MQ_PRIO_MAX : ::c_int = 59;
-pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
-pub const _SC_THREADS : ::c_int = 91;
+pub const _SC_PRIORITIZED_IO : ::c_int = 60;
+pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61;
+pub const _SC_RAW_SOCKETS : ::c_int = 62;
+pub const _SC_READER_WRITER_LOCKS : ::c_int = 63;
+pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
+pub const _SC_REGEXP : ::c_int = 65;
+pub const _SC_RTSIG_MAX : ::c_int = 66;
+pub const _SC_SEMAPHORES : ::c_int = 67;
+pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
+pub const _SC_SHELL : ::c_int = 69;
+pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
+pub const _SC_SPAWN : ::c_int = 71;
+pub const _SC_SPIN_LOCKS : ::c_int = 72;
+pub const _SC_SPORADIC_SERVER : ::c_int = 73;
+pub const _SC_SS_REPL_MAX : ::c_int = 74;
+pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
+pub const _SC_SYMLOOP_MAX : ::c_int = 76;
 pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77;
 pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78;
+pub const _SC_THREAD_CPUTIME : ::c_int = 79;
 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80;
 pub const _SC_THREAD_KEYS_MAX : ::c_int = 81;
 pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82;
 pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83;
 pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84;
 pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85;
-pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT : ::c_int = 86;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT : ::c_int = 87;
+pub const _SC_THREAD_SPORADIC_SERVER : ::c_int = 88;
 pub const _SC_THREAD_STACK_MIN : ::c_int = 89;
 pub const _SC_THREAD_THREADS_MAX : ::c_int = 90;
+pub const _SC_THREADS : ::c_int = 91;
+pub const _SC_TIMEOUTS : ::c_int = 92;
+pub const _SC_TIMER_MAX : ::c_int = 93;
+pub const _SC_TIMERS : ::c_int = 94;
+pub const _SC_TRACE : ::c_int = 95;
+pub const _SC_TRACE_EVENT_FILTER : ::c_int = 96;
+pub const _SC_TRACE_EVENT_NAME_MAX : ::c_int = 97;
+pub const _SC_TRACE_INHERIT : ::c_int = 98;
+pub const _SC_TRACE_LOG : ::c_int = 99;
+pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
+pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
+pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
+pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
+pub const _SC_TRACE_NAME_MAX : ::c_int = 104;
+pub const _SC_TRACE_SYS_MAX : ::c_int = 105;
+pub const _SC_TRACE_USER_EVENT_MAX : ::c_int = 106;
 pub const _SC_TTY_NAME_MAX : ::c_int = 107;
-pub const _SC_ATEXIT_MAX : ::c_int = 46;
-pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
-pub const _SC_AIO_MAX : ::c_int = 43;
-pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
-pub const _SC_MAPPED_FILES : ::c_int = 53;
-pub const _SC_MEMLOCK : ::c_int = 54;
-pub const _SC_MEMLOCK_RANGE : ::c_int = 55;
-pub const _SC_MEMORY_PROTECTION : ::c_int = 56;
-pub const _SC_MESSAGE_PASSING : ::c_int = 57;
-pub const _SC_MQ_OPEN_MAX : ::c_int = 58;
-pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61;
-pub const _SC_SEMAPHORES : ::c_int = 67;
-pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
-pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
-pub const _SC_TIMERS : ::c_int = 94;
+pub const _SC_TYPED_MEMORY_OBJECTS : ::c_int = 108;
+pub const _SC_V6_ILP32_OFF32 : ::c_int = 109;
+pub const _SC_V6_ILP32_OFFBIG : ::c_int = 110;
+pub const _SC_V6_LP64_OFF64 : ::c_int = 111;
+pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 112;
+pub const _SC_V7_ILP32_OFF32 : ::c_int = 113;
+pub const _SC_V7_ILP32_OFFBIG : ::c_int = 114;
+pub const _SC_V7_LP64_OFF64 : ::c_int = 115;
+pub const _SC_V7_LPBIG_OFFBIG : ::c_int = 116;
 pub const _SC_XOPEN_CRYPT : ::c_int = 117;
 pub const _SC_XOPEN_ENH_I18N : ::c_int = 118;
 pub const _SC_XOPEN_LEGACY : ::c_int = 119;
 pub const _SC_XOPEN_REALTIME : ::c_int = 120;
 pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121;
+pub const _SC_XOPEN_STREAMS : ::c_int = 122;
 pub const _SC_XOPEN_UNIX : ::c_int = 123;
+pub const _SC_XOPEN_UUCP : ::c_int = 124;
 pub const _SC_XOPEN_VERSION : ::c_int = 125;
-pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
-pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
-pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
-pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
-pub const _SC_PRIORITIZED_IO : ::c_int = 60;
-pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
-pub const _SC_RTSIG_MAX : ::c_int = 66;
-pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
-pub const _SC_TIMER_MAX : ::c_int = 93;
-pub const _SC_HOST_NAME_MAX : ::c_int = 33;
+pub const _SC_PHYS_PAGES : ::c_int = 500;
+pub const _SC_AVPHYS_PAGES : ::c_int = 501;
+pub const _SC_NPROCESSORS_CONF : ::c_int = 502;
+pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
 
 pub const FD_SETSIZE: usize = 1024;
 
 pub const ST_NOSUID: ::c_ulong = 2;
 
 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
@@ -308,16 +426,18 @@ pub const EVFILT_VNODE: ::int16_t = -4;
 pub const EVFILT_WRITE: ::int16_t = -2;
 
 pub const EV_ADD: ::uint16_t = 0x1;
 pub const EV_DELETE: ::uint16_t = 0x2;
 pub const EV_ENABLE: ::uint16_t = 0x4;
 pub const EV_DISABLE: ::uint16_t = 0x8;
 pub const EV_ONESHOT: ::uint16_t = 0x10;
 pub const EV_CLEAR: ::uint16_t = 0x20;
+pub const EV_RECEIPT: ::uint16_t = 0x40;
+pub const EV_DISPATCH: ::uint16_t = 0x80;
 pub const EV_FLAG1: ::uint16_t = 0x2000;
 pub const EV_ERROR: ::uint16_t = 0x4000;
 pub const EV_EOF: ::uint16_t = 0x8000;
 pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
 
 pub const NOTE_LOWAT: ::uint32_t = 0x00000001;
 pub const NOTE_EOF: ::uint32_t = 0x00000002;
 pub const NOTE_DELETE: ::uint32_t = 0x00000001;
@@ -451,16 +571,31 @@ pub const KERN_PROC_NARGV: ::c_int = 2;
 pub const KERN_PROC_ENV: ::c_int = 3;
 pub const KERN_PROC_NENV: ::c_int = 4;
 pub const KI_NGROUPS: ::c_int = 16;
 pub const KI_MAXCOMLEN: ::c_int = 24;
 pub const KI_WMESGLEN: ::c_int = 8;
 pub const KI_MAXLOGNAME: ::c_int = 32;
 pub const KI_EMULNAMELEN: ::c_int = 8;
 
+pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS;
+pub const OLCUC: ::tcflag_t = 0x20;
+pub const ONOCR: ::tcflag_t = 0x40;
+pub const ONLRET: ::tcflag_t = 0x80;
+
+pub const SOCK_CLOEXEC: ::c_int = 0x8000;
+pub const SOCK_NONBLOCK: ::c_int = 0x4000;
+pub const SOCK_DNS: ::c_int = 0x1000;
+
+f! {
+    pub fn WIFCONTINUED(status: ::c_int) -> bool {
+        status & 0o177777 == 0o177777
+    }
+}
+
 extern {
     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
     pub fn getnameinfo(sa: *const ::sockaddr,
                        salen: ::socklen_t,
                        host: *mut ::c_char,
                        hostlen: ::size_t,
                        serv: *mut ::c_char,
                        servlen: ::size_t,
@@ -482,16 +617,18 @@ extern {
                   oldp: *mut ::c_void,
                   oldlenp: *mut ::size_t,
                   newp: *mut ::c_void,
                   newlen: ::size_t)
                   -> ::c_int;
     pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
     pub fn pledge(promises: *const ::c_char,
                   paths: *mut *const ::c_char) -> ::c_int;
+    pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
+    pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
 }
 
 cfg_if! {
     if #[cfg(target_os = "openbsd")] {
         mod openbsd;
         pub use self::openbsd::*;
     } else if #[cfg(target_os = "bitrig")] {
         mod bitrig;
--- a/third_party/rust/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
+++ b/third_party/rust/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
@@ -25,9 +25,11 @@ s! {
         pub int_p_sign_posn: ::c_char,
         pub int_n_sign_posn: ::c_char,
     }
 }
 
 extern {
     pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
                    addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
+    pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
+                   envp: *const *const ::c_char) -> ::c_int;
 }
--- a/third_party/rust/libc/src/unix/haiku/mod.rs
+++ b/third_party/rust/libc/src/unix/haiku/mod.rs
@@ -18,16 +18,17 @@ pub type blkcnt_t = i64;
 pub type blksize_t = i32;
 pub type dev_t = i32;
 pub type mode_t = u32;
 pub type nlink_t = i32;
 pub type useconds_t = u32;
 pub type socklen_t = u32;
 pub type pthread_t = ::uintptr_t;
 pub type pthread_mutexattr_t = ::uintptr_t;
+pub type pthread_rwlockattr_t = ::uintptr_t;
 pub type sigset_t = u64;
 pub type fsblkcnt_t = i64;
 pub type fsfilcnt_t = i64;
 pub type pthread_attr_t = *mut ::c_void;
 pub type nl_item = ::c_int;
 pub type id_t = i32;
 pub type idtype_t = ::c_uint;
 
@@ -326,18 +327,16 @@ pub const _IONBF: ::c_int = 2;
 pub const _IOLBF: ::c_int = 1;
 
 pub const F_DUPFD: ::c_int = 0x0001;
 pub const F_GETFD: ::c_int = 0x0002;
 pub const F_SETFD: ::c_int = 0x0004;
 pub const F_GETFL: ::c_int = 0x0008;
 pub const F_SETFL: ::c_int = 0x0010;
 
-pub const SIGTRAP: ::c_int = 22;
-
 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
 
 pub const CLOCK_REALTIME: ::c_int = -1;
 pub const CLOCK_MONOTONIC: ::c_int = 0;
 
 pub const RLIMIT_CORE: ::c_int = 0;
 pub const RLIMIT_CPU: ::c_int = 1;
@@ -396,27 +395,47 @@ pub const S_IWOTH: ::mode_t = 2;
 pub const S_IROTH: ::mode_t = 4;
 pub const F_OK: ::c_int = 0;
 pub const R_OK: ::c_int = 4;
 pub const W_OK: ::c_int = 2;
 pub const X_OK: ::c_int = 1;
 pub const STDIN_FILENO: ::c_int = 0;
 pub const STDOUT_FILENO: ::c_int = 1;
 pub const STDERR_FILENO: ::c_int = 2;
+
 pub const SIGHUP: ::c_int = 1;
 pub const SIGINT: ::c_int = 2;
 pub const SIGQUIT: ::c_int = 3;
 pub const SIGILL: ::c_int = 4;
+pub const SIGCHLD: ::c_int = 5;
 pub const SIGABRT: ::c_int = 6;
+pub const SIGPIPE: ::c_int = 7;
 pub const SIGFPE: ::c_int = 8;
 pub const SIGKILL: ::c_int = 9;
+pub const SIGSTOP: ::c_int = 10;
 pub const SIGSEGV: ::c_int = 11;
-pub const SIGPIPE: ::c_int = 7;
+pub const SIGCONT: ::c_int = 12;
+pub const SIGTSTP: ::c_int = 13;
 pub const SIGALRM: ::c_int = 14;
 pub const SIGTERM: ::c_int = 15;
+pub const SIGTTIN: ::c_int = 16;
+pub const SIGTTOU: ::c_int = 17;
+pub const SIGUSR1: ::c_int = 18;
+pub const SIGUSR2: ::c_int = 19;
+pub const SIGWINCH: ::c_int = 20;
+pub const SIGKILLTHR: ::c_int = 21;
+pub const SIGTRAP: ::c_int = 22;
+pub const SIGPOLL: ::c_int = 23;
+pub const SIGPROF: ::c_int = 24;
+pub const SIGSYS: ::c_int = 25;
+pub const SIGURG: ::c_int = 26;
+pub const SIGVTALRM: ::c_int = 27;
+pub const SIGXCPU: ::c_int = 28;
+pub const SIGXFSZ: ::c_int = 29;
+pub const SIGBUS: ::c_int = 30;
 
 pub const EAI_SYSTEM: ::c_int = 11;
 
 pub const PROT_NONE: ::c_int = 0;
 pub const PROT_READ: ::c_int = 1;
 pub const PROT_WRITE: ::c_int = 2;
 pub const PROT_EXEC: ::c_int = 4;
 
@@ -531,21 +550,16 @@ pub const MADV_WILLNEED: ::c_int = 4;
 pub const MADV_DONTNEED: ::c_int = 5;
 
 pub const IFF_LOOPBACK: ::c_int = 0x0008;
 
 pub const AF_UNIX: ::c_int = 9;
 pub const AF_INET: ::c_int = 1;
 pub const AF_INET6: ::c_int = 6;
 pub const SOCK_RAW: ::c_int = 3;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
 pub const IP_MULTICAST_TTL: ::c_int = 10;
 pub const IP_MULTICAST_LOOP: ::c_int = 11;
 pub const IP_TTL: ::c_int = 4;
 pub const IP_HDRINCL: ::c_int = 2;
 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
 
 pub const TCP_NODELAY: ::c_int = 0x01;
@@ -637,18 +651,16 @@ pub const PTHREAD_MUTEX_ERRORCHECK: ::c_
 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
 
 pub const FIOCLEX: c_ulong = 0; // TODO: does not exist on Haiku!
 
 pub const SA_ONSTACK: c_ulong = 0x20;
 pub const SA_SIGINFO: c_ulong = 0x40;
 pub const SA_NOCLDWAIT: c_ulong = 0x02;
 
-pub const SIGCHLD: ::c_int = 5;
-pub const SIGBUS: ::c_int = 30;
 pub const SIG_SETMASK: ::c_int = 3;
 
 pub const RUSAGE_CHILDREN: ::c_int = -1;
 
 pub const SOCK_STREAM: ::c_int = 1;
 pub const SOCK_DGRAM: ::c_int = 2;
 
 pub const SOL_SOCKET: ::c_int = -1;
@@ -681,16 +693,70 @@ pub const WCONTINUED: ::c_int = 0x04;
 pub const WEXITED: ::c_int = 0x08;
 pub const WSTOPPED: ::c_int = 0x10;
 pub const WNOWAIT: ::c_int = 0x20;
 
 pub const P_ALL: idtype_t = 0;
 pub const P_PID: idtype_t = 1;
 pub const P_PGID: idtype_t = 2;
 
+pub const VINTR: usize = 0;
+pub const VQUIT: usize = 1;
+pub const VERASE: usize = 2;
+pub const VKILL: usize = 3;
+pub const VEOF: usize = 4;
+pub const VEOL: usize = 5;
+pub const VMIN: usize = 4;
+pub const VTIME: usize = 5;
+pub const VEOL2: usize = 6;
+pub const VSWTCH: usize = 7;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VSUSP: usize = 10;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const OCRNL:  ::tcflag_t = 0o000010;
+pub const ONOCR:  ::tcflag_t = 0o000020;
+pub const ONLRET: ::tcflag_t = 0o000040;
+pub const OFILL:  ::tcflag_t = 0o000100;
+pub const OFDEL:  ::tcflag_t = 0o000200;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const NL0:    ::tcflag_t = 0o000000;
+pub const NL1:    ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const CR0:    ::tcflag_t = 0o000000;
+pub const CR1:    ::tcflag_t = 0o001000;
+pub const CR2:    ::tcflag_t = 0o002000;
+pub const CR3:    ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const TAB0:   ::tcflag_t = 0o000000;
+pub const TAB1:   ::tcflag_t = 0o004000;
+pub const TAB2:   ::tcflag_t = 0o010000;
+pub const TAB3:   ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const BS0:    ::tcflag_t = 0o000000;
+pub const BS1:    ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const FF0:    ::tcflag_t = 0o000000;
+pub const FF1:    ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const VT0:    ::tcflag_t = 0o000000;
+pub const VT1:    ::tcflag_t = 0o040000;
+
+pub const TCGB_CTS: ::c_int = 0x01;
+pub const TCGB_DSR: ::c_int = 0x02;
+pub const TCGB_RI: ::c_int = 0x04;
+pub const TCGB_DCD: ::c_int = 0x08;
+pub const TIOCM_CTS: ::c_int = TCGB_CTS;
+pub const TIOCM_CD: ::c_int = TCGB_DCD;
+pub const TIOCM_CAR: ::c_int = TIOCM_CD;
+pub const TIOCM_RI: ::c_int = TCGB_RI;
+pub const TIOCM_DSR: ::c_int = TCGB_DSR;
+pub const TIOCM_DTR: ::c_int = 0x10;
+pub const TIOCM_RTS: ::c_int = 0x20;
+
 f! {
     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
         let fd = fd as usize;
         let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
         (*set).fds_bits[fd / size] &= !(1 << (fd % size));
         return
     }
 
@@ -732,25 +798,20 @@ extern {
     pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
                                      guardsize: *mut ::size_t) -> ::c_int;
     pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
                                  stackaddr: *mut *mut ::c_void,
                                  stacksize: *mut ::size_t) -> ::c_int;
     pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
                                      clock_id: *mut clockid_t) -> ::c_int;
     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
-                                     clock_id: clockid_t) -> ::c_int;
+                                     clock_id: ::clockid_t) -> ::c_int;
     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
     pub fn setgroups(ngroups: ::size_t,
                      ptr: *const ::gid_t) -> ::c_int;
-    pub fn getpwuid_r(uid: ::uid_t,
-                      pwd: *mut passwd,
-                      buffer: *mut ::c_char,
-                      bufferSize: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
     pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
                     -> ::c_int;
     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
     pub fn getnameinfo(sa: *const ::sockaddr,
                        salen: ::socklen_t,
                        host: *mut ::c_char,
                        hostlen: ::size_t,
@@ -800,16 +861,73 @@ extern {
                  iov: *const ::iovec,
                  iovcnt: ::c_int) -> ::ssize_t;
 
     pub fn sendmsg(fd: ::c_int,
                    msg: *const ::msghdr,
                    flags: ::c_int) -> ::ssize_t;
     pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
                    -> ::ssize_t;
+    pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
+                   environment: *const *const ::c_char) -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+    pub fn getgrgid_r(uid: ::uid_t,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "sigaltstack$UNIX2003")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+    pub fn sigaltstack(ss: *const stack_t,
+                       oss: *mut stack_t) -> ::c_int;
+    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+    pub fn getdtablesize() -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+    pub fn getgrnam_r(name: *const ::c_char,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "pthread_sigmask$UNIX2003")]
+    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+                           oldset: *mut sigset_t) -> ::c_int;
+    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+    pub fn getpwnam_r(name: *const ::c_char,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+    pub fn getpwuid_r(uid: ::uid_t,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+               link_name = "sigwait$UNIX2003")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+    pub fn sigwait(set: *const sigset_t,
+                   sig: *mut ::c_int) -> ::c_int;
+    pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+                          parent: Option<unsafe extern fn()>,
+                          child: Option<unsafe extern fn()>) -> ::c_int;
+    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "popen$UNIX2003")]
+    pub fn popen(command: *const c_char,
+                 mode: *const c_char) -> *mut ::FILE;
 }
 
 cfg_if! {
     if #[cfg(target_pointer_width = "64")] {
         mod b64;
         pub use self::b64::*;
     } else {
         mod b32;
--- a/third_party/rust/libc/src/unix/mod.rs
+++ b/third_party/rust/libc/src/unix/mod.rs
@@ -57,17 +57,17 @@ s! {
         pub ru_inblock: c_long,
         pub ru_oublock: c_long,
         pub ru_msgsnd: c_long,
         pub ru_msgrcv: c_long,
         pub ru_nsignals: c_long,
         pub ru_nvcsw: c_long,
         pub ru_nivcsw: c_long,
 
-        #[cfg(any(target_env = "musl"))]
+        #[cfg(any(target_env = "musl", target_os = "emscripten"))]
         __reserved: [c_long; 16],
     }
 
     #[cfg_attr(target_os = "netbsd", repr(packed))]
     pub struct in_addr {
         pub s_addr: in_addr_t,
     }
 
@@ -212,19 +212,33 @@ pub const LOG_FACMASK: ::c_int = 0x3f8;
 
 pub const PRIO_PROCESS: ::c_int = 0;
 pub const PRIO_PGRP: ::c_int = 1;
 pub const PRIO_USER: ::c_int = 2;
 
 pub const PRIO_MIN: ::c_int = -20;
 pub const PRIO_MAX: ::c_int = 20;
 
+pub const IPPROTO_ICMP: ::c_int = 1;
+pub const IPPROTO_ICMPV6: ::c_int = 58;
+pub const IPPROTO_TCP: ::c_int = 6;
+pub const IPPROTO_UDP: ::c_int = 17;
+pub const IPPROTO_IP: ::c_int = 0;
+pub const IPPROTO_IPV6: ::c_int = 41;
+
+pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
+pub const INADDR_ANY: in_addr_t = 0;
+pub const INADDR_BROADCAST: in_addr_t = 4294967295;
+pub const INADDR_NONE: in_addr_t = 4294967295;
+
 cfg_if! {
     if #[cfg(dox)] {
         // on dox builds don't pull in anything
+    } else if #[cfg(target_os = "l4re")] {
+        // required libraries for L4Re are linked externally, ATM
     } else if #[cfg(all(not(stdbuild), feature = "use_std"))] {
         // cargo build, don't pull in anything extra as the libstd  dep
         // already pulls in all libs.
     } else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] {
         #[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))]
         #[link(name = "c", cfg(not(target_feature = "crt-static")))]
         extern {}
     } else if #[cfg(target_os = "emscripten")] {
@@ -247,30 +261,30 @@ cfg_if! {
     } else if #[cfg(target_os = "haiku")] {
         #[link(name = "root")]
         #[link(name = "network")]
         extern {}
     } else if #[cfg(target_os = "fuchsia")] {
         #[link(name = "c")]
         #[link(name = "mxio")]
         extern {}
+    } else if #[cfg(target_env = "newlib")] {
+        #[link(name = "c")]
+        #[link(name = "m")]
+        extern {}
     } else {
         #[link(name = "c")]
         #[link(name = "m")]
         #[link(name = "rt")]
         #[link(name = "pthread")]
         extern {}
     }
 }
 
 extern {
-    pub fn getgrnam(name: *const ::c_char) -> *mut group;
-    pub fn getgrgid(gid: ::gid_t) -> *mut group;
-
-    pub fn endpwent();
     #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
     pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
     #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
     pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
 
     pub fn fprintf(stream: *mut ::FILE,
                    format: *const ::c_char, ...) -> ::c_int;
     pub fn printf(format: *const ::c_char, ...) -> ::c_int;
@@ -330,20 +344,16 @@ extern {
     pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
 
     pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
 
     #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
     #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
     pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
 
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "popen$UNIX2003")]
-    pub fn popen(command: *const c_char,
-                 mode: *const c_char) -> *mut ::FILE;
     pub fn pclose(stream: *mut ::FILE) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "fdopen$UNIX2003")]
     pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
     pub fn fileno(stream: *mut ::FILE) -> ::c_int;
 
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "open$UNIX2003")]
@@ -375,18 +385,16 @@ extern {
     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
                link_name = "rewinddir$INODE64")]
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "rewinddir$INODE64$UNIX2003")]
     pub fn rewinddir(dirp: *mut ::DIR);
 
     pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
                   flags: ::c_int, ...) -> ::c_int;
-    pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
-                     mode: ::c_int, flags: ::c_int) -> ::c_int;
     pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
                     mode: ::mode_t, flags: ::c_int) -> ::c_int;
     pub fn fchown(fd: ::c_int,
                   owner: ::uid_t,
                   group: ::gid_t) -> ::c_int;
     pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
                     owner: ::uid_t, group: ::gid_t,
                     flags: ::c_int) -> ::c_int;
@@ -567,42 +575,34 @@ extern {
                link_name = "getrlimit$UNIX2003")]
     pub fn getrlimit(resource: ::c_int, rlim: *mut rlimit) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "setrlimit$UNIX2003")]
     pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int;
     #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
     pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
 
-    pub fn getdtablesize() -> ::c_int;
     #[cfg_attr(any(target_os = "macos", target_os = "ios"),
                link_name = "realpath$DARWIN_EXTSN")]
     pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char)
                     -> *mut ::c_char;
 
     pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
 
     #[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")]
     pub fn gettimeofday(tp: *mut ::timeval,
                         tz: *mut ::c_void) -> ::c_int;
     #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
     pub fn times(buf: *mut ::tms) -> ::clock_t;
 
     pub fn pthread_self() -> ::pthread_t;
-    pub fn pthread_create(native: *mut ::pthread_t,
-                          attr: *const ::pthread_attr_t,
-                          f: extern fn(*mut ::c_void) -> *mut ::c_void,
-                          value: *mut ::c_void) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "pthread_join$UNIX2003")]
     pub fn pthread_join(native: ::pthread_t,
                         value: *mut *mut ::c_void) -> ::c_int;
-    pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
-                          parent: Option<unsafe extern fn()>,
-                          child: Option<unsafe extern fn()>) -> ::c_int;
     pub fn pthread_exit(value: *mut ::c_void);
     pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
     pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
     pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t,
                                      stack_size: ::size_t) -> ::c_int;
     pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t,
                                        state: ::c_int) -> ::c_int;
     pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
@@ -643,16 +643,20 @@ extern {
                               lock: *mut pthread_mutex_t,
                               abstime: *const ::timespec) -> ::c_int;
     pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
     pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
     pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
     pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
     pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "pthread_rwlock_init$UNIX2003")]
+    pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t,
+                               attr: *const pthread_rwlockattr_t) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "pthread_rwlock_destroy$UNIX2003")]
     pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "pthread_rwlock_rdlock$UNIX2003")]
     pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "pthread_rwlock_tryrdlock$UNIX2003")]
     pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
@@ -660,46 +664,34 @@ extern {
                link_name = "pthread_rwlock_wrlock$UNIX2003")]
     pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "pthread_rwlock_trywrlock$UNIX2003")]
     pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "pthread_rwlock_unlock$UNIX2003")]
     pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "pthread_sigmask$UNIX2003")]
-    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
-                           oldset: *mut sigset_t) -> ::c_int;
-    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
+    pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t)
+                                      -> ::c_int;
     #[cfg_attr(all(target_os = "linux", not(target_env = "musl")),
                link_name = "__xpg_strerror_r")]
     pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
                       buflen: ::size_t) -> ::c_int;
 
     pub fn getsockopt(sockfd: ::c_int,
                       level: ::c_int,
                       optname: ::c_int,
                       optval: *mut ::c_void,
                       optlen: *mut ::socklen_t) -> ::c_int;
     pub fn raise(signum: ::c_int) -> ::c_int;
     #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
     pub fn sigaction(signum: ::c_int,
                      act: *const sigaction,
                      oldact: *mut sigaction) -> ::c_int;
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "sigaltstack$UNIX2003")]
-    #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
-    pub fn sigaltstack(ss: *const stack_t,
-                       oss: *mut stack_t) -> ::c_int;
-    #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
-               link_name = "sigwait$UNIX2003")]
-    #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
-    pub fn sigwait(set: *const sigset_t,
-                   sig: *mut ::c_int) -> ::c_int;
 
     #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
     pub fn utimes(filename: *const ::c_char,
                   times: *const ::timeval) -> ::c_int;
     pub fn dlopen(filename: *const ::c_char,
                   flag: ::c_int) -> *mut ::c_void;
     pub fn dlerror() -> *mut ::c_char;
     pub fn dlsym(handle: *mut ::c_void,
@@ -736,17 +728,16 @@ extern {
     pub fn gmtime(time_p: *const time_t) -> *mut tm;
     #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
     pub fn localtime(time_p: *const time_t) -> *mut tm;
 
     #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
     pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
                  dev: ::dev_t) -> ::c_int;
     pub fn uname(buf: *mut ::utsname) -> ::c_int;
-    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
     pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
     pub fn chroot(name: *const ::c_char) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "usleep$UNIX2003")]
     pub fn usleep(secs: ::c_uint) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "send$UNIX2003")]
     pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
@@ -773,19 +764,16 @@ extern {
                   errorfds: *mut fd_set,
                   timeout: *mut timeval) -> ::c_int;
     #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
     pub fn setlocale(category: ::c_int,
                      locale: *const ::c_char) -> *mut ::c_char;
     pub fn localeconv() -> *mut lconv;
 
     pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
-    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
-    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
-    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "sem_wait$UNIX2003")]
     pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
     pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
     pub fn sem_post(sem: *mut sem_t) -> ::c_int;
     pub fn sem_init(sem: *mut sem_t,
                     pshared: ::c_int,
                     value: ::c_uint)
@@ -851,16 +839,17 @@ extern {
     pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
     pub fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
     pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
     pub fn tcsetattr(fd: ::c_int,
                      optional_actions: ::c_int,
                      termios: *const ::termios) -> ::c_int;
     pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
     pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
+    pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
     pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
     pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
     pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
 
     pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
 
     pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
     pub fn closelog();
@@ -875,16 +864,19 @@ extern {
     pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
     pub fn unlockpt(fd: ::c_int) -> ::c_int;
 }
 
 cfg_if! {
     if #[cfg(target_env = "uclibc")] {
         mod uclibc;
         pub use self::uclibc::*;
+    } else if #[cfg(target_env = "newlib")] {
+        mod newlib;
+        pub use self::newlib::*;
     } else if #[cfg(any(target_os = "linux",
                         target_os = "android",
                         target_os = "emscripten",
                         target_os = "fuchsia"))] {
         mod notbsd;
         pub use self::notbsd::*;
     } else if #[cfg(any(target_os = "macos",
                         target_os = "ios",
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/src/unix/newlib/arm/mod.rs
@@ -0,0 +1,5 @@
+pub type c_char = u8;
+pub type wchar_t = u32;
+
+pub type c_long = i32;
+pub type c_ulong = u32;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/src/unix/newlib/mod.rs
@@ -0,0 +1,658 @@
+use dox::mem;
+
+pub type blkcnt_t = i32;
+pub type blksize_t = i32;
+pub type clock_t = i32;
+pub type clockid_t = ::c_ulong;
+pub type dev_t = u32;
+pub type fsblkcnt_t = u64;
+pub type fsfilcnt_t = u32;
+pub type id_t = u32;
+pub type ino_t = u32;
+pub type key_t = ::c_int;
+pub type loff_t = ::c_longlong;
+pub type mode_t = ::c_uint;
+pub type nfds_t = u32;
+pub type nlink_t = ::c_ushort;
+pub type off_t = i64;
+pub type pthread_t = ::c_ulong;
+pub type pthread_key_t = ::c_uint;
+pub type rlim_t = u32;
+pub type sa_family_t = u8;
+pub type socklen_t = u32;
+pub type speed_t = u32;
+pub type suseconds_t = i32;
+pub type tcflag_t = ::c_uint;
+pub type time_t = i32;
+pub type useconds_t = u32;
+
+s! {
+    pub struct sockaddr {
+        pub sa_family: sa_family_t,
+        pub sa_data: [::c_char; 14],
+    }
+
+    pub struct sockaddr_in {
+        pub sin_family: sa_family_t,
+        pub sin_port: ::in_port_t,
+        pub sin_addr: ::in_addr,
+        pub sin_zero: [u8; 8],
+    }
+
+    pub struct sockaddr_in6 { // Unverified
+        pub sin6_family: sa_family_t,
+        pub sin6_port: ::in_port_t,
+        pub sin6_flowinfo: u32,
+        pub sin6_addr: ::in6_addr,
+        pub sin6_scope_id: u32,
+    }
+
+    pub struct sockaddr_storage {
+        pub ss_family: sa_family_t,
+        pub __ss_padding: [u8; 26],
+    }
+
+    pub struct addrinfo {
+        pub ai_flags: ::c_int,
+        pub ai_family: ::c_int,
+        pub ai_socktype: ::c_int,
+        pub ai_protocol: ::c_int,
+        pub ai_addrlen: socklen_t,
+        pub ai_canonname: *mut ::c_char,
+        pub ai_addr: *mut sockaddr,
+        pub ai_next: *mut addrinfo,
+    }
+
+    pub struct ip_mreq {
+        pub imr_multiaddr: in_addr,
+        pub imr_interface: in_addr,
+    }
+
+    pub struct linger {
+        pub l_onoff: ::c_int,
+        pub l_linger: ::c_int,
+    }
+
+    pub struct in_addr {
+            pub s_addr: ::in_addr_t,
+    }
+
+    pub struct hostent {
+            pub h_name: *mut ::c_char,
+            pub h_aliases: *mut *mut ::c_char,
+            pub h_addrtype: ::c_int,
+            pub h_length: ::c_int,
+            pub h_addr_list: *mut *mut ::c_char,
+            pub h_addr: *mut ::c_char,
+    }
+
+    pub struct pollfd {
+        pub fd: ::c_int,
+        pub events: ::c_int,
+        pub revents: ::c_int,
+    }
+
+    pub struct lconv {
+        pub decimal_point: *mut ::c_char,
+        pub thousands_sep: *mut ::c_char,
+        pub grouping: *mut ::c_char,
+        pub int_curr_symbol: *mut ::c_char,
+        pub currency_symbol: *mut ::c_char,
+        pub mon_decimal_point: *mut ::c_char,
+        pub mon_thousands_sep: *mut ::c_char,
+        pub mon_grouping: *mut ::c_char,
+        pub positive_sign: *mut ::c_char,
+        pub negative_sign: *mut ::c_char,
+        pub int_frac_digits: ::c_char,
+        pub frac_digits: ::c_char,
+        pub p_cs_precedes: ::c_char,
+        pub p_sep_by_space: ::c_char,
+        pub n_cs_precedes: ::c_char,
+        pub n_sep_by_space: ::c_char,
+        pub p_sign_posn: ::c_char,
+        pub n_sign_posn: ::c_char,
+        pub int_n_cs_precedes: ::c_char,
+        pub int_n_sep_by_space: ::c_char,
+        pub int_n_sign_posn: ::c_char,
+        pub int_p_cs_precedes: ::c_char,
+        pub int_p_sep_by_space: ::c_char,
+        pub int_p_sign_posn: ::c_char,
+    }
+
+    pub struct tm {
+        pub tm_sec: ::c_int,
+        pub tm_min: ::c_int,
+        pub tm_hour: ::c_int,
+        pub tm_mday: ::c_int,
+        pub tm_mon: ::c_int,
+        pub tm_year: ::c_int,
+        pub tm_wday: ::c_int,
+        pub tm_yday: ::c_int,
+        pub tm_isdst: ::c_int,
+    }
+
+    pub struct stat {
+        pub st_dev: ::dev_t,
+        pub st_ino: ::ino_t,
+        pub st_mode: ::mode_t,
+        pub st_nlink: ::nlink_t,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
+        pub st_rdev: dev_t,
+        pub st_size: off_t,
+        pub st_atime: time_t,
+        pub st_spare1: ::c_long,
+        pub st_mtime: time_t,
+        pub st_spare2: ::c_long,
+        pub st_ctime: time_t,
+        pub st_spare3: ::c_long,
+        pub st_blksize: blksize_t,
+        pub st_blocks: blkcnt_t,
+        pub st_spare4: [::c_long; 2usize],
+    }
+
+    pub struct statvfs {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: fsblkcnt_t,
+        pub f_bfree: fsblkcnt_t,
+        pub f_bavail: fsblkcnt_t,
+        pub f_files: fsfilcnt_t,
+        pub f_ffree: fsfilcnt_t,
+        pub f_favail: fsfilcnt_t,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+    }
+
+    pub struct sigset_t {
+        __val: [::c_ulong; 16],
+    }
+
+    pub struct sigaction {
+        pub sa_handler: extern fn(arg1: ::c_int),
+        pub sa_mask: sigset_t,
+        pub sa_flags: ::c_int,
+    }
+
+    pub struct dirent {
+        pub d_ino: ino_t,
+        pub d_type: ::c_uchar,
+        pub d_name: [::c_char; 256usize],
+    }
+
+    pub struct stack_t {
+        pub ss_sp: *mut ::c_void,
+        pub ss_flags: ::c_int,
+        pub ss_size: usize,
+    }
+
+    pub struct fd_set { // Unverified
+        fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
+    }
+
+    pub struct passwd { // Unverified
+        pub pw_name: *mut ::c_char,
+        pub pw_passwd: *mut ::c_char,
+        pub pw_uid: ::uid_t,
+        pub pw_gid: ::gid_t,
+        pub pw_gecos: *mut ::c_char,
+        pub pw_dir: *mut ::c_char,
+        pub pw_shell: *mut ::c_char,
+    }
+
+    pub struct termios { // Unverified
+        pub c_iflag: ::tcflag_t,
+        pub c_oflag: ::tcflag_t,
+        pub c_cflag: ::tcflag_t,
+        pub c_lflag: ::tcflag_t,
+        pub c_line: ::cc_t,
+        pub c_cc: [::cc_t; ::NCCS],
+    }
+
+    pub struct sem_t { // Unverified
+        __size: [::c_char; 16],
+    }
+
+    pub struct Dl_info { // Unverified
+        pub dli_fname: *const ::c_char,
+        pub dli_fbase: *mut ::c_void,
+        pub dli_sname: *const ::c_char,
+        pub dli_saddr: *mut ::c_void,
+    }
+
+    pub struct utsname { // Unverified
+        pub sysname: [::c_char; 65],
+        pub nodename: [::c_char; 65],
+        pub release: [::c_char; 65],
+        pub version: [::c_char; 65],
+        pub machine: [::c_char; 65],
+        pub domainname: [::c_char; 65]
+    }
+
+    pub struct cpu_set_t { // Unverified
+        bits: [u32; 32],
+    }
+
+    pub struct pthread_attr_t { // Unverified
+        __size: [u64; 7]
+    }
+
+    pub struct pthread_mutex_t { // Unverified
+        #[cfg(any(target_arch = "mips", target_arch = "arm",
+                  target_arch = "powerpc"))]
+        __align: [::c_long; 0],
+        #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+                      target_arch = "powerpc")))]
+        __align: [::c_longlong; 0],
+        size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
+    }
+
+    pub struct pthread_rwlock_t { // Unverified
+        #[cfg(any(target_arch = "mips", target_arch = "arm",
+                  target_arch = "powerpc"))]
+        __align: [::c_long; 0],
+        #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+                      target_arch = "powerpc")))]
+        __align: [::c_longlong; 0],
+        size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
+    }
+
+    pub struct pthread_mutexattr_t { // Unverified
+        #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
+                  target_arch = "mips64", target_arch = "s390x",
+                  target_arch = "sparc64"))]
+        __align: [::c_int; 0],
+        #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
+                      target_arch = "mips64", target_arch = "s390x",
+                      target_arch = "sparc64")))]
+        __align: [::c_long; 0],
+        size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
+    }
+
+    pub struct pthread_rwlockattr_t { // Unverified
+        __lockkind: ::c_int,
+        __pshared: ::c_int,
+    }
+
+    pub struct pthread_cond_t { // Unverified
+        __align: [::c_longlong; 0],
+        size: [u8; __SIZEOF_PTHREAD_COND_T],
+    }
+
+    pub struct pthread_condattr_t { // Unverified
+        __align: [::c_int; 0],
+        size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
+    }
+
+}
+
+// unverified constants
+pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+    __align: [],
+    size: [0; __SIZEOF_PTHREAD_MUTEX_T],
+};
+pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+    __align: [],
+    size: [0; __SIZEOF_PTHREAD_COND_T],
+};
+pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+    __align: [],
+    size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
+};
+pub const NCCS: usize = 32;
+pub const __SIZEOF_PTHREAD_ATTR_T: usize = 56;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
+pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
+pub const __PTHREAD_MUTEX_HAVE_PREV: usize = 1;
+pub const __PTHREAD_RWLOCK_INT_FLAGS_SHARED: usize = 1;
+pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
+pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
+pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
+pub const FD_SETSIZE: usize = 1024;
+// intentionally not public, only used for fd_set
+const ULONG_SIZE: usize = 32;
+
+// Other constants
+pub const EPERM: ::c_int = 1;
+pub const ENOENT: ::c_int = 2;
+pub const ESRCH: ::c_int = 3;
+pub const EINTR: ::c_int = 4;
+pub const EIO: ::c_int = 5;
+pub const ENXIO: ::c_int = 6;
+pub const E2BIG: ::c_int = 7;
+pub const ENOEXEC: ::c_int = 8;
+pub const EBADF: ::c_int = 9;
+pub const ECHILD: ::c_int = 10;
+pub const EAGAIN: ::c_int = 11;
+pub const ENOMEM: ::c_int = 12;
+pub const EACCES: ::c_int = 13;
+pub const EFAULT: ::c_int = 14;
+pub const EBUSY: ::c_int = 16;
+pub const EEXIST: ::c_int = 17;
+pub const EXDEV: ::c_int = 18;
+pub const ENODEV: ::c_int = 19;
+pub const ENOTDIR: ::c_int = 20;
+pub const EISDIR: ::c_int = 21;
+pub const EINVAL: ::c_int = 22;
+pub const ENFILE: ::c_int = 23;
+pub const EMFILE: ::c_int = 24;
+pub const ENOTTY: ::c_int = 25;
+pub const ETXTBSY: ::c_int = 26;
+pub const EFBIG: ::c_int = 27;
+pub const ENOSPC: ::c_int = 28;
+pub const ESPIPE: ::c_int = 29;
+pub const EROFS: ::c_int = 30;
+pub const EMLINK: ::c_int = 31;
+pub const EPIPE: ::c_int = 32;
+pub const EDOM: ::c_int = 33;
+pub const ERANGE: ::c_int = 34;
+pub const ENOMSG: ::c_int = 35;
+pub const EIDRM: ::c_int = 36;
+pub const EDEADLK: ::c_int = 45;
+pub const ENOLCK: ::c_int = 46;
+pub const ENOSTR: ::c_int = 60;
+pub const ENODATA: ::c_int = 61;
+pub const ETIME: ::c_int = 62;
+pub const ENOSR: ::c_int = 63;
+pub const ENOLINK: ::c_int = 67;
+pub const EPROTO: ::c_int = 71;
+pub const EMULTIHOP: ::c_int = 74;
+pub const EBADMSG: ::c_int = 77;
+pub const EFTYPE: ::c_int = 79;
+pub const ENOSYS: ::c_int = 88;
+pub const ENOTEMPTY: ::c_int = 90;
+pub const ENAMETOOLONG: ::c_int = 91;
+pub const ELOOP: ::c_int = 92;
+pub const EOPNOTSUPP: ::c_int = 95;
+pub const EPFNOSUPPORT: ::c_int = 96;
+pub const ECONNRESET: ::c_int = 104;
+pub const ENOBUFS: ::c_int = 105;
+pub const EAFNOSUPPORT: ::c_int = 106;
+pub const EPROTOTYPE: ::c_int = 107;
+pub const ENOTSOCK: ::c_int = 108;
+pub const ENOPROTOOPT: ::c_int = 109;
+pub const ECONNREFUSED: ::c_int = 111;
+pub const EADDRINUSE: ::c_int = 112;
+pub const ECONNABORTED: ::c_int = 113;
+pub const ENETUNREACH: ::c_int = 114;
+pub const ENETDOWN: ::c_int = 115;
+pub const ETIMEDOUT: ::c_int = 116;
+pub const EHOSTDOWN: ::c_int = 117;
+pub const EHOSTUNREACH: ::c_int = 118;
+pub const EINPROGRESS: ::c_int = 119;
+pub const EALREADY: ::c_int = 120;
+pub const EDESTADDRREQ: ::c_int = 121;
+pub const EMSGSIZE: ::c_int = 122;
+pub const EPROTONOSUPPORT: ::c_int = 123;
+pub const EADDRNOTAVAIL: ::c_int = 125;
+pub const ENETRESET: ::c_int = 126;
+pub const EISCONN: ::c_int = 127;
+pub const ENOTCONN: ::c_int = 128;
+pub const ETOOMANYREFS: ::c_int = 129;
+pub const EDQUOT: ::c_int = 132;
+pub const ESTALE: ::c_int = 133;
+pub const ENOTSUP: ::c_int = 134;
+pub const EILSEQ: ::c_int = 138;
+pub const EOVERFLOW: ::c_int = 139;
+pub const ECANCELED: ::c_int = 140;
+pub const ENOTRECOVERABLE: ::c_int = 141;
+pub const EOWNERDEAD: ::c_int = 142;
+pub const EWOULDBLOCK: ::c_int = 11;
+
+pub const F_DUPFD: ::c_int = 0;
+pub const F_GETFD: ::c_int = 1;
+pub const F_SETFD: ::c_int = 2;
+pub const F_GETFL: ::c_int = 3;
+pub const F_SETFL: ::c_int = 4;
+pub const F_GETOWN: ::c_int = 5;
+pub const F_SETOWN: ::c_int = 6;
+pub const F_GETLK: ::c_int = 7;
+pub const F_SETLK: ::c_int = 8;
+pub const F_SETLKW: ::c_int = 9;
+pub const F_RGETLK: ::c_int = 10;
+pub const F_RSETLK: ::c_int = 11;
+pub const F_CNVT: ::c_int = 12;
+pub const F_RSETLKW: ::c_int = 13;
+pub const F_DUPFD_CLOEXEC: ::c_int = 14;
+
+pub const O_RDONLY: ::c_int = 0;
+pub const O_WRONLY: ::c_int = 1;
+pub const O_RDWR: ::c_int = 2;
+pub const O_APPEND: ::c_int = 8;
+pub const O_CREAT: ::c_int = 512;
+pub const O_TRUNC: ::c_int = 1024;
+pub const O_EXCL: ::c_int = 2048;
+pub const O_SYNC: ::c_int = 8192;
+pub const O_NONBLOCK: ::c_int = 16384;
+
+pub const O_ACCMODE: ::c_int = 3;
+pub const O_CLOEXEC: ::c_int = 0x80000;
+
+pub const STDIN_FILENO: ::c_int = 0;
+pub const STDOUT_FILENO: ::c_int = 1;
+pub const STDERR_FILENO: ::c_int = 2;
+
+pub const SEEK_SET: ::c_int = 0;
+pub const SEEK_CUR: ::c_int = 1;
+pub const SEEK_END: ::c_int = 2;
+
+pub const FIONBIO: ::c_int = 1;
+
+pub const S_BLKSIZE: ::mode_t = 1024;
+pub const S_IREAD: ::mode_t = 256;
+pub const S_IWRITE: ::mode_t = 128;
+pub const S_IEXEC: ::mode_t = 64;
+pub const S_ENFMT: ::mode_t = 1024;
+pub const S_IFMT: ::mode_t = 61440;
+pub const S_IFDIR: ::mode_t = 16384;
+pub const S_IFCHR: ::mode_t = 8192;
+pub const S_IFBLK: ::mode_t = 24576;
+pub const S_IFREG: ::mode_t = 32768;
+pub const S_IFLNK: ::mode_t = 40960;
+pub const S_IFSOCK: ::mode_t = 49152;
+pub const S_IFIFO: ::mode_t = 4096;
+pub const S_IRUSR: ::mode_t = 256;
+pub const S_IWUSR: ::mode_t = 128;
+pub const S_IXUSR: ::mode_t = 64;
+pub const S_IRGRP: ::mode_t = 32;
+pub const S_IWGRP: ::mode_t = 16;
+pub const S_IXGRP: ::mode_t = 8;
+pub const S_IROTH: ::mode_t = 4;
+pub const S_IWOTH: ::mode_t = 2;
+pub const S_IXOTH: ::mode_t = 1;
+
+pub const SOL_SOCKET: ::c_int = 65535;
+pub const SOL_TCP: ::c_int = 6;
+
+pub const PF_UNSPEC: ::c_int = 0;
+pub const PF_INET: ::c_int = 2;
+pub const PF_INET6: ::c_int = 23;
+
+pub const AF_UNSPEC: ::c_int = 0;
+pub const AF_INET: ::c_int = 2;
+pub const AF_INET6: ::c_int = 23;
+
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+
+pub const MSG_OOB: ::c_int = 1;
+pub const MSG_PEEK: ::c_int = 2;
+pub const MSG_DONTWAIT: ::c_int = 4;
+pub const MSG_DONTROUTE: ::c_int = 0;
+pub const MSG_WAITALL: ::c_int = 0;
+pub const MSG_MORE: ::c_int = 0;
+pub const MSG_NOSIGNAL: ::c_int = 0;
+
+pub const SHUT_RD: ::c_int = 0;
+pub const SHUT_WR: ::c_int = 1;
+pub const SHUT_RDWR: ::c_int = 2;
+
+pub const SO_REUSEADDR: ::c_int = 4;
+pub const SO_LINGER: ::c_int = 128;
+pub const SO_OOBINLINE: ::c_int = 256;
+pub const SO_SNDBUF: ::c_int = 4097;
+pub const SO_RCVBUF: ::c_int = 4098;
+pub const SO_SNDLOWAT: ::c_int = 4099;
+pub const SO_RCVLOWAT: ::c_int = 4100;
+pub const SO_TYPE: ::c_int = 4104;
+pub const SO_ERROR: ::c_int = 4105;
+
+pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
+
+pub const INET_ADDRSTRLEN: ::c_int = 16;
+
+pub const IPPROTO_IP: ::c_int = 0;
+pub const IPPROTO_UDP: ::c_int = 17;
+pub const IPPROTO_TCP: ::c_int = 6;
+
+pub const TCP_NODELAY: ::c_int = 8193;
+pub const TCP_MAXSEG: ::c_int = 8194;
+
+pub const IP_TOS: ::c_int = 7;
+pub const IP_TTL: ::c_int = 8;
+pub const IP_MULTICAST_LOOP: ::c_int = 9;
+pub const IP_MULTICAST_TTL: ::c_int = 10;
+pub const IP_ADD_MEMBERSHIP: ::c_int = 11;
+pub const IP_DROP_MEMBERSHIP: ::c_int = 12;
+
+pub const HOST_NOT_FOUND: ::c_int = 1;
+pub const NO_DATA: ::c_int = 2;
+pub const NO_ADDRESS: ::c_int = 2;
+pub const NO_RECOVERY: ::c_int = 3;
+pub const TRY_AGAIN: ::c_int = 4;
+
+pub const AI_PASSIVE: ::c_int = 1;
+pub const AI_CANONNAME: ::c_int = 2;
+pub const AI_NUMERICHOST: ::c_int = 4;
+pub const AI_NUMERICSERV: ::c_int = 0;
+pub const AI_ADDRCONFIG: ::c_int = 0;
+
+pub const NI_MAXHOST: ::c_int = 1025;
+pub const NI_MAXSERV: ::c_int = 32;
+pub const NI_NOFQDN: ::c_int = 1;
+pub const NI_NUMERICHOST: ::c_int = 2;
+pub const NI_NAMEREQD: ::c_int = 4;
+pub const NI_NUMERICSERV: ::c_int = 0;
+pub const NI_DGRAM: ::c_int = 0;
+
+pub const EAI_FAMILY: ::c_int = -303;
+pub const EAI_MEMORY: ::c_int = -304;
+pub const EAI_NONAME: ::c_int = -305;
+pub const EAI_SOCKTYPE: ::c_int = -307;
+
+f! {
+    pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
+        let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+        let fd = fd as usize;
+        (*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
+        return
+    }
+
+    pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
+        let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+        let fd = fd as usize;
+        return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0
+    }
+
+    pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
+        let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+        let fd = fd as usize;
+        (*set).fds_bits[fd / bits] |= 1 << (fd % bits);
+        return
+    }
+
+    pub fn FD_ZERO(set: *mut fd_set) -> () {
+        for slot in (*set).fds_bits.iter_mut() {
+            *slot = 0;
+        }
+    }
+}
+
+extern {
+    pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int;
+    pub fn closesocket(sockfd: ::c_int) -> ::c_int;
+    pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+    pub fn recvfrom(fd: ::c_int, buf: *mut ::c_void, n: usize, flags: ::c_int,
+                    addr: *mut sockaddr, addr_len: *mut socklen_t) -> isize;
+    pub fn getnameinfo(sa: *const sockaddr, salen: socklen_t,
+                       host: *mut ::c_char, hostlen: socklen_t,
+                       serv: *mut ::c_char, servlen: socklen_t,
+                       flags: ::c_int) -> ::c_int;
+    pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
+    pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+                   envp: *const *const ::c_char)
+                   -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+    pub fn getgrgid_r(uid: ::uid_t,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "sigaltstack$UNIX2003")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+    pub fn sigaltstack(ss: *const stack_t,
+                       oss: *mut stack_t) -> ::c_int;
+    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+    pub fn getdtablesize() -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+    pub fn getgrnam_r(name: *const ::c_char,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "pthread_sigmask$UNIX2003")]
+    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+                           oldset: *mut sigset_t) -> ::c_int;
+    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+    pub fn getpwnam_r(name: *const ::c_char,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+    pub fn getpwuid_r(uid: ::uid_t,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+               link_name = "sigwait$UNIX2003")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+    pub fn sigwait(set: *const sigset_t,
+                   sig: *mut ::c_int) -> ::c_int;
+    pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+                          parent: Option<unsafe extern fn()>,
+                          child: Option<unsafe extern fn()>) -> ::c_int;
+    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "popen$UNIX2003")]
+    pub fn popen(command: *const c_char,
+                 mode: *const c_char) -> *mut ::FILE;
+}
+
+cfg_if! {
+    if #[cfg(target_arch = "arm")] {
+        mod arm;
+        pub use self::arm::*;
+    } else {
+        // Only tested on ARM so far. Other platforms might have different
+        // definitions for types and constants.
+        pub use target_arch_not_implemented;
+    }
+}
--- a/third_party/rust/libc/src/unix/notbsd/android/b32/arm.rs
+++ b/third_party/rust/libc/src/unix/notbsd/android/b32/arm.rs
@@ -1,6 +1,12 @@
 pub type c_char = u8;
 pub type wchar_t = u32;
 
 pub const O_DIRECT: ::c_int = 0x10000;
 pub const O_DIRECTORY: ::c_int = 0x4000;
 pub const O_NOFOLLOW: ::c_int = 0x8000;
+pub const O_LARGEFILE: ::c_int = 0o400000;
+
+pub const SYS_pivot_root: ::c_long = 218;
+pub const SYS_gettid: ::c_long = 224;
+pub const SYS_perf_event_open: ::c_long = 364;
+pub const SYS_memfd_create: ::c_long = 385;
--- a/third_party/rust/libc/src/unix/notbsd/android/b32/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/android/b32/mod.rs
@@ -61,16 +61,45 @@ s! {
         pub st_atime_nsec: ::c_ulong,
         pub st_mtime: ::c_ulong,
         pub st_mtime_nsec: ::c_ulong,
         pub st_ctime: ::c_ulong,
         pub st_ctime_nsec: ::c_ulong,
         pub st_ino: ::c_ulonglong,
     }
 
+    pub struct statfs64 {
+        pub f_type: u32,
+        pub f_bsize: u32,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        f_fsid: [u32; 2],
+        pub f_namelen: u32,
+        pub f_frsize: u32,
+        pub f_flags: u32,
+        pub f_spare: [u32; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: ::c_ulong,
+        pub f_bfree: ::c_ulong,
+        pub f_bavail: ::c_ulong,
+        pub f_files: ::c_ulong,
+        pub f_ffree: ::c_ulong,
+        pub f_favail: ::c_ulong,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+    }
+
     pub struct pthread_attr_t {
         pub flags: ::uint32_t,
         pub stack_base: *mut ::c_void,
         pub stack_size: ::size_t,
         pub guard_size: ::size_t,
         pub sched_policy: ::int32_t,
         pub sched_priority: ::int32_t,
     }
@@ -136,17 +165,16 @@ pub const RTLD_GLOBAL: ::c_int = 2;
 pub const RTLD_NOW: ::c_int = 0;
 pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void;
 
 pub const PTRACE_GETFPREGS: ::c_int = 14;
 pub const PTRACE_SETFPREGS: ::c_int = 15;
 pub const PTRACE_GETREGS: ::c_int = 12;
 pub const PTRACE_SETREGS: ::c_int = 13;
 
-pub const SYS_gettid: ::c_long = 224;
 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
     value: 0,
 };
 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
     value: 0,
 };
 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
     lock: PTHREAD_MUTEX_INITIALIZER,
@@ -161,16 +189,19 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pt
 pub const PTHREAD_STACK_MIN: ::size_t = 4096 * 2;
 pub const CPU_SETSIZE: ::size_t = 32;
 pub const __CPU_BITS: ::size_t = 32;
 
 pub const UT_LINESIZE: usize = 8;
 pub const UT_NAMESIZE: usize = 8;
 pub const UT_HOSTSIZE: usize = 16;
 
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+
 extern {
     pub fn bind(socket: ::c_int, address: *const ::sockaddr,
                 address_len: socklen_t) -> ::c_int;
 
     pub fn writev(fd: ::c_int,
                   iov: *const ::iovec,
                   iovcnt: ::c_int) -> ::ssize_t;
     pub fn readv(fd: ::c_int,
--- a/third_party/rust/libc/src/unix/notbsd/android/b32/x86.rs
+++ b/third_party/rust/libc/src/unix/notbsd/android/b32/x86.rs
@@ -1,6 +1,415 @@
 pub type c_char = i8;
 pub type wchar_t = i32;
 
 pub const O_DIRECT: ::c_int = 0x4000;
 pub const O_DIRECTORY: ::c_int = 0x10000;
 pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
+
+pub const MAP_32BIT: ::c_int = 0x40;
+
+// Syscall table
+pub const SYS_restart_syscall: ::c_long = 0;
+pub const SYS_exit: ::c_long = 1;
+pub const SYS_fork: ::c_long = 2;
+pub const SYS_read: ::c_long = 3;
+pub const SYS_write: ::c_long = 4;
+pub const SYS_open: ::c_long = 5;
+pub const SYS_close: ::c_long = 6;
+pub const SYS_waitpid: ::c_long = 7;
+pub const SYS_creat: ::c_long = 8;
+pub const SYS_link: ::c_long = 9;
+pub const SYS_unlink: ::c_long = 10;
+pub const SYS_execve: ::c_long = 11;
+pub const SYS_chdir: ::c_long = 12;
+pub const SYS_time: ::c_long = 13;
+pub const SYS_mknod: ::c_long = 14;
+pub const SYS_chmod: ::c_long = 15;
+pub const SYS_lchown: ::c_long = 16;
+pub const SYS_break: ::c_long = 17;
+pub const SYS_oldstat: ::c_long = 18;
+pub const SYS_lseek: ::c_long = 19;
+pub const SYS_getpid: ::c_long = 20;
+pub const SYS_mount: ::c_long = 21;
+pub const SYS_umount: ::c_long = 22;
+pub const SYS_setuid: ::c_long = 23;
+pub const SYS_getuid: ::c_long = 24;
+pub const SYS_stime: ::c_long = 25;
+pub const SYS_ptrace: ::c_long = 26;
+pub const SYS_alarm: ::c_long = 27;
+pub const SYS_oldfstat: ::c_long = 28;
+pub const SYS_pause: ::c_long = 29;
+pub const SYS_utime: ::c_long = 30;
+pub const SYS_stty: ::c_long = 31;
+pub const SYS_gtty: ::c_long = 32;
+pub const SYS_access: ::c_long = 33;
+pub const SYS_nice: ::c_long = 34;
+pub const SYS_ftime: ::c_long = 35;
+pub const SYS_sync: ::c_long = 36;
+pub const SYS_kill: ::c_long = 37;
+pub const SYS_rename: ::c_long = 38;
+pub const SYS_mkdir: ::c_long = 39;
+pub const SYS_rmdir: ::c_long = 40;
+pub const SYS_dup: ::c_long = 41;
+pub const SYS_pipe: ::c_long = 42;
+pub const SYS_times: ::c_long = 43;
+pub const SYS_prof: ::c_long = 44;
+pub const SYS_brk: ::c_long = 45;
+pub const SYS_setgid: ::c_long = 46;
+pub const SYS_getgid: ::c_long = 47;
+pub const SYS_signal: ::c_long = 48;
+pub const SYS_geteuid: ::c_long = 49;
+pub const SYS_getegid: ::c_long = 50;
+pub const SYS_acct: ::c_long = 51;
+pub const SYS_umount2: ::c_long = 52;
+pub const SYS_lock: ::c_long = 53;
+pub const SYS_ioctl: ::c_long = 54;
+pub const SYS_fcntl: ::c_long = 55;
+pub const SYS_mpx: ::c_long = 56;
+pub const SYS_setpgid: ::c_long = 57;
+pub const SYS_ulimit: ::c_long = 58;
+pub const SYS_oldolduname: ::c_long = 59;
+pub const SYS_umask: ::c_long = 60;
+pub const SYS_chroot: ::c_long = 61;
+pub const SYS_ustat: ::c_long = 62;
+pub const SYS_dup2: ::c_long = 63;
+pub const SYS_getppid: ::c_long = 64;
+pub const SYS_getpgrp: ::c_long = 65;
+pub const SYS_setsid: ::c_long = 66;
+pub const SYS_sigaction: ::c_long = 67;
+pub const SYS_sgetmask: ::c_long = 68;
+pub const SYS_ssetmask: ::c_long = 69;
+pub const SYS_setreuid: ::c_long = 70;
+pub const SYS_setregid: ::c_long = 71;
+pub const SYS_sigsuspend: ::c_long = 72;
+pub const SYS_sigpending: ::c_long = 73;
+pub const SYS_sethostname: ::c_long = 74;
+pub const SYS_setrlimit: ::c_long = 75;
+pub const SYS_getrlimit: ::c_long = 76;
+pub const SYS_getrusage: ::c_long = 77;
+pub const SYS_gettimeofday: ::c_long = 78;
+pub const SYS_settimeofday: ::c_long = 79;
+pub const SYS_getgroups: ::c_long = 80;
+pub const SYS_setgroups: ::c_long = 81;
+pub const SYS_select: ::c_long = 82;
+pub const SYS_symlink: ::c_long = 83;
+pub const SYS_oldlstat: ::c_long = 84;
+pub const SYS_readlink: ::c_long = 85;
+pub const SYS_uselib: ::c_long = 86;
+pub const SYS_swapon: ::c_long = 87;
+pub const SYS_reboot: ::c_long = 88;
+pub const SYS_readdir: ::c_long = 89;
+pub const SYS_mmap: ::c_long = 90;
+pub const SYS_munmap: ::c_long = 91;
+pub const SYS_truncate: ::c_long = 92;
+pub const SYS_ftruncate: ::c_long = 93;
+pub const SYS_fchmod: ::c_long = 94;
+pub const SYS_fchown: ::c_long = 95;
+pub const SYS_getpriority: ::c_long = 96;
+pub const SYS_setpriority: ::c_long = 97;
+pub const SYS_profil: ::c_long = 98;
+pub const SYS_statfs: ::c_long = 99;
+pub const SYS_fstatfs: ::c_long = 100;
+pub const SYS_ioperm: ::c_long = 101;
+pub const SYS_socketcall: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_setitimer: ::c_long = 104;
+pub const SYS_getitimer: ::c_long = 105;
+pub const SYS_stat: ::c_long = 106;
+pub const SYS_lstat: ::c_long = 107;
+pub const SYS_fstat: ::c_long = 108;
+pub const SYS_olduname: ::c_long = 109;
+pub const SYS_iopl: ::c_long = 110;
+pub const SYS_vhangup: ::c_long = 111;
+pub const SYS_idle: ::c_long = 112;
+pub const SYS_vm86old: ::c_long = 113;
+pub const SYS_wait4: ::c_long = 114;
+pub const SYS_swapoff: ::c_long = 115;
+pub const SYS_sysinfo: ::c_long = 116;
+pub const SYS_ipc: ::c_long = 117;
+pub const SYS_fsync: ::c_long = 118;
+pub const SYS_sigreturn: ::c_long = 119;
+pub const SYS_clone: ::c_long = 120;
+pub const SYS_setdomainname: ::c_long = 121;
+pub const SYS_uname: ::c_long = 122;
+pub const SYS_modify_ldt: ::c_long = 123;
+pub const SYS_adjtimex: ::c_long = 124;
+pub const SYS_mprotect: ::c_long = 125;
+pub const SYS_sigprocmask: ::c_long = 126;
+pub const SYS_create_module: ::c_long = 127;
+pub const SYS_init_module: ::c_long = 128;
+pub const SYS_delete_module: ::c_long = 129;
+pub const SYS_get_kernel_syms: ::c_long = 130;
+pub const SYS_quotactl: ::c_long = 131;
+pub const SYS_getpgid: ::c_long = 132;
+pub const SYS_fchdir: ::c_long = 133;
+pub const SYS_bdflush: ::c_long = 134;
+pub const SYS_sysfs: ::c_long = 135;
+pub const SYS_personality: ::c_long = 136;
+pub const SYS_afs_syscall: ::c_long = 137;
+pub const SYS_setfsuid: ::c_long = 138;
+pub const SYS_setfsgid: ::c_long = 139;
+// FIXME: SYS__llseek is in the NDK sources but for some reason is
+//        not available in the tests
+// pub const SYS__llseek: ::c_long = 140;
+pub const SYS_getdents: ::c_long = 141;
+// FIXME: SYS__newselect is in the NDK sources but for some reason is
+//        not available in the tests
+// pub const SYS__newselect: ::c_long = 142;
+pub const SYS_flock: ::c_long = 143;
+pub const SYS_msync: ::c_long = 144;
+pub const SYS_readv: ::c_long = 145;
+pub const SYS_writev: ::c_long = 146;
+pub const SYS_getsid: ::c_long = 147;
+pub const SYS_fdatasync: ::c_long = 148;
+// FIXME: SYS__llseek is in the NDK sources but for some reason is
+//        not available in the tests
+// pub const SYS__sysctl: ::c_long = 149;
+pub const SYS_mlock: ::c_long = 150;
+pub const SYS_munlock: ::c_long = 151;
+pub const SYS_mlockall: ::c_long = 152;
+pub const SYS_munlockall: ::c_long = 153;
+pub const SYS_sched_setparam: ::c_long = 154;
+pub const SYS_sched_getparam: ::c_long = 155;
+pub const SYS_sched_setscheduler: ::c_long = 156;
+pub const SYS_sched_getscheduler: ::c_long = 157;
+pub const SYS_sched_yield: ::c_long = 158;
+pub const SYS_sched_get_priority_max: ::c_long = 159;
+pub const SYS_sched_get_priority_min: ::c_long = 160;
+pub const SYS_sched_rr_get_interval: ::c_long = 161;
+pub const SYS_nanosleep: ::c_long = 162;
+pub const SYS_mremap: ::c_long = 163;
+pub const SYS_setresuid: ::c_long = 164;
+pub const SYS_getresuid: ::c_long = 165;
+pub const SYS_vm86: ::c_long = 166;
+pub const SYS_query_module: ::c_long = 167;
+pub const SYS_poll: ::c_long = 168;
+pub const SYS_nfsservctl: ::c_long = 169;
+pub const SYS_setresgid: ::c_long = 170;
+pub const SYS_getresgid: ::c_long = 171;
+pub const SYS_prctl: ::c_long = 172;
+pub const SYS_rt_sigreturn: ::c_long = 173;
+pub const SYS_rt_sigaction: ::c_long = 174;
+pub const SYS_rt_sigprocmask: ::c_long = 175;
+pub const SYS_rt_sigpending: ::c_long = 176;
+pub const SYS_rt_sigtimedwait: ::c_long = 177;
+pub const SYS_rt_sigqueueinfo: ::c_long = 178;
+pub const SYS_rt_sigsuspend: ::c_long = 179;
+pub const SYS_pread64: ::c_long = 180;
+pub const SYS_pwrite64: ::c_long = 181;
+pub const SYS_chown: ::c_long = 182;
+pub const SYS_getcwd: ::c_long = 183;
+pub const SYS_capget: ::c_long = 184;
+pub const SYS_capset: ::c_long = 185;
+pub const SYS_sigaltstack: ::c_long = 186;
+pub const SYS_sendfile: ::c_long = 187;
+pub const SYS_getpmsg: ::c_long = 188;
+pub const SYS_putpmsg: ::c_long = 189;
+pub const SYS_vfork: ::c_long = 190;
+pub const SYS_ugetrlimit: ::c_long = 191;
+pub const SYS_mmap2: ::c_long = 192;
+pub const SYS_truncate64: ::c_long = 193;
+pub const SYS_ftruncate64: ::c_long = 194;
+pub const SYS_stat64: ::c_long = 195;
+pub const SYS_lstat64: ::c_long = 196;
+pub const SYS_fstat64: ::c_long = 197;
+pub const SYS_lchown32: ::c_long = 198;
+pub const SYS_getuid32: ::c_long = 199;
+pub const SYS_getgid32: ::c_long = 200;
+pub const SYS_geteuid32: ::c_long = 201;
+pub const SYS_getegid32: ::c_long = 202;
+pub const SYS_setreuid32: ::c_long = 203;
+pub const SYS_setregid32: ::c_long = 204;
+pub const SYS_getgroups32: ::c_long = 205;
+pub const SYS_setgroups32: ::c_long = 206;
+pub const SYS_fchown32: ::c_long = 207;
+pub const SYS_setresuid32: ::c_long = 208;
+pub const SYS_getresuid32: ::c_long = 209;
+pub const SYS_setresgid32: ::c_long = 210;
+pub const SYS_getresgid32: ::c_long = 211;
+pub const SYS_chown32: ::c_long = 212;
+pub const SYS_setuid32: ::c_long = 213;
+pub const SYS_setgid32: ::c_long = 214;
+pub const SYS_setfsuid32: ::c_long = 215;
+pub const SYS_setfsgid32: ::c_long = 216;
+pub const SYS_pivot_root: ::c_long = 217;
+pub const SYS_mincore: ::c_long = 218;
+pub const SYS_madvise: ::c_long = 219;
+pub const SYS_getdents64: ::c_long = 220;
+pub const SYS_fcntl64: ::c_long = 221;
+pub const SYS_gettid: ::c_long = 224;
+pub const SYS_readahead: ::c_long = 225;
+pub const SYS_setxattr: ::c_long = 226;
+pub const SYS_lsetxattr: ::c_long = 227;
+pub const SYS_fsetxattr: ::c_long = 228;
+pub const SYS_getxattr: ::c_long = 229;
+pub const SYS_lgetxattr: ::c_long = 230;
+pub const SYS_fgetxattr: ::c_long = 231;
+pub const SYS_listxattr: ::c_long = 232;
+pub const SYS_llistxattr: ::c_long = 233;
+pub const SYS_flistxattr: ::c_long = 234;
+pub const SYS_removexattr: ::c_long = 235;
+pub const SYS_lremovexattr: ::c_long = 236;
+pub const SYS_fremovexattr: ::c_long = 237;
+pub const SYS_tkill: ::c_long = 238;
+pub const SYS_sendfile64: ::c_long = 239;
+pub const SYS_futex: ::c_long = 240;
+pub const SYS_sched_setaffinity: ::c_long = 241;
+pub const SYS_sched_getaffinity: ::c_long = 242;
+pub const SYS_set_thread_area: ::c_long = 243;
+pub const SYS_get_thread_area: ::c_long = 244;
+pub const SYS_io_setup: ::c_long = 245;
+pub const SYS_io_destroy: ::c_long = 246;
+pub const SYS_io_getevents: ::c_long = 247;
+pub const SYS_io_submit: ::c_long = 248;
+pub const SYS_io_cancel: ::c_long = 249;
+pub const SYS_fadvise64: ::c_long = 250;
+pub const SYS_exit_group: ::c_long = 252;
+pub const SYS_lookup_dcookie: ::c_long = 253;
+pub const SYS_epoll_create: ::c_long = 254;
+pub const SYS_epoll_ctl: ::c_long = 255;
+pub const SYS_epoll_wait: ::c_long = 256;
+pub const SYS_remap_file_pages: ::c_long = 257;
+pub const SYS_set_tid_address: ::c_long = 258;
+pub const SYS_timer_create: ::c_long = 259;
+pub const SYS_timer_settime: ::c_long = 260;
+pub const SYS_timer_gettime: ::c_long = 261;
+pub const SYS_timer_getoverrun: ::c_long = 262;
+pub const SYS_timer_delete: ::c_long = 263;
+pub const SYS_clock_settime: ::c_long = 264;
+pub const SYS_clock_gettime: ::c_long = 265;
+pub const SYS_clock_getres: ::c_long = 266;
+pub const SYS_clock_nanosleep: ::c_long = 267;
+pub const SYS_statfs64: ::c_long = 268;
+pub const SYS_fstatfs64: ::c_long = 269;
+pub const SYS_tgkill: ::c_long = 270;
+pub const SYS_utimes: ::c_long = 271;
+pub const SYS_fadvise64_64: ::c_long = 272;
+pub const SYS_vserver: ::c_long = 273;
+pub const SYS_mbind: ::c_long = 274;
+pub const SYS_get_mempolicy: ::c_long = 275;
+pub const SYS_set_mempolicy: ::c_long = 276;
+pub const SYS_mq_open: ::c_long = 277;
+pub const SYS_mq_unlink: ::c_long = 278;
+pub const SYS_mq_timedsend: ::c_long = 279;
+pub const SYS_mq_timedreceive: ::c_long = 280;
+pub const SYS_mq_notify: ::c_long = 281;
+pub const SYS_mq_getsetattr: ::c_long = 282;
+pub const SYS_kexec_load: ::c_long = 283;
+pub const SYS_waitid: ::c_long = 284;
+pub const SYS_add_key: ::c_long = 286;
+pub const SYS_request_key: ::c_long = 287;
+pub const SYS_keyctl: ::c_long = 288;
+pub const SYS_ioprio_set: ::c_long = 289;
+pub const SYS_ioprio_get: ::c_long = 290;
+pub const SYS_inotify_init: ::c_long = 291;
+pub const SYS_inotify_add_watch: ::c_long = 292;
+pub const SYS_inotify_rm_watch: ::c_long = 293;
+pub const SYS_migrate_pages: ::c_long = 294;
+pub const SYS_openat: ::c_long = 295;
+pub const SYS_mkdirat: ::c_long = 296;
+pub const SYS_mknodat: ::c_long = 297;
+pub const SYS_fchownat: ::c_long = 298;
+pub const SYS_futimesat: ::c_long = 299;
+pub const SYS_fstatat64: ::c_long = 300;
+pub const SYS_unlinkat: ::c_long = 301;
+pub const SYS_renameat: ::c_long = 302;
+pub const SYS_linkat: ::c_long = 303;
+pub const SYS_symlinkat: ::c_long = 304;
+pub const SYS_readlinkat: ::c_long = 305;
+pub const SYS_fchmodat: ::c_long = 306;
+pub const SYS_faccessat: ::c_long = 307;
+pub const SYS_pselect6: ::c_long = 308;
+pub const SYS_ppoll: ::c_long = 309;
+pub const SYS_unshare: ::c_long = 310;
+pub const SYS_set_robust_list: ::c_long = 311;
+pub const SYS_get_robust_list: ::c_long = 312;
+pub const SYS_splice: ::c_long = 313;
+pub const SYS_sync_file_range: ::c_long = 314;
+pub const SYS_tee: ::c_long = 315;
+pub const SYS_vmsplice: ::c_long = 316;
+pub const SYS_move_pages: ::c_long = 317;
+pub const SYS_getcpu: ::c_long = 318;
+pub const SYS_epoll_pwait: ::c_long = 319;
+pub const SYS_utimensat: ::c_long = 320;
+pub const SYS_signalfd: ::c_long = 321;
+pub const SYS_timerfd_create: ::c_long = 322;
+pub const SYS_eventfd: ::c_long = 323;
+pub const SYS_fallocate: ::c_long = 324;
+pub const SYS_timerfd_settime: ::c_long = 325;
+pub const SYS_timerfd_gettime: ::c_long = 326;
+pub const SYS_signalfd4: ::c_long = 327;
+pub const SYS_eventfd2: ::c_long = 328;
+pub const SYS_epoll_create1: ::c_long = 329;
+pub const SYS_dup3: ::c_long = 330;
+pub const SYS_pipe2: ::c_long = 331;
+pub const SYS_inotify_init1: ::c_long = 332;
+pub const SYS_preadv: ::c_long = 333;
+pub const SYS_pwritev: ::c_long = 334;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 335;
+pub const SYS_perf_event_open: ::c_long = 336;
+pub const SYS_recvmmsg: ::c_long = 337;
+pub const SYS_fanotify_init: ::c_long = 338;
+pub const SYS_fanotify_mark: ::c_long = 339;
+pub const SYS_prlimit64: ::c_long = 340;
+pub const SYS_name_to_handle_at: ::c_long = 341;
+pub const SYS_open_by_handle_at: ::c_long = 342;
+pub const SYS_clock_adjtime: ::c_long = 343;
+pub const SYS_syncfs: ::c_long = 344;
+pub const SYS_sendmmsg: ::c_long = 345;
+pub const SYS_setns: ::c_long = 346;
+pub const SYS_process_vm_readv: ::c_long = 347;
+pub const SYS_process_vm_writev: ::c_long = 348;
+pub const SYS_kcmp: ::c_long = 349;
+pub const SYS_finit_module: ::c_long = 350;
+pub const SYS_sched_setattr: ::c_long = 351;
+pub const SYS_sched_getattr: ::c_long = 352;
+pub const SYS_renameat2: ::c_long = 353;
+pub const SYS_seccomp: ::c_long = 354;
+pub const SYS_getrandom: ::c_long = 355;
+pub const SYS_memfd_create: ::c_long = 356;
+pub const SYS_bpf: ::c_long = 357;
+pub const SYS_execveat: ::c_long = 358;
+pub const SYS_socket: ::c_long = 359;
+pub const SYS_socketpair: ::c_long = 360;
+pub const SYS_bind: ::c_long = 361;
+pub const SYS_connect: ::c_long = 362;
+pub const SYS_listen: ::c_long = 363;
+pub const SYS_accept4: ::c_long = 364;
+pub const SYS_getsockopt: ::c_long = 365;
+pub const SYS_setsockopt: ::c_long = 366;
+pub const SYS_getsockname: ::c_long = 367;
+pub const SYS_getpeername: ::c_long = 368;
+pub const SYS_sendto: ::c_long = 369;
+pub const SYS_sendmsg: ::c_long = 370;
+pub const SYS_recvfrom: ::c_long = 371;
+pub const SYS_recvmsg: ::c_long = 372;
+pub const SYS_shutdown: ::c_long = 373;
+pub const SYS_userfaultfd: ::c_long = 374;
+pub const SYS_membarrier: ::c_long = 375;
+pub const SYS_mlock2: ::c_long = 376;
+pub const SYS_copy_file_range: ::c_long = 377;
+pub const SYS_preadv2: ::c_long = 378;
+pub const SYS_pwritev2: ::c_long = 379;
+pub const SYS_pkey_mprotect: ::c_long = 380;
+pub const SYS_pkey_alloc: ::c_long = 381;
+pub const SYS_pkey_free: ::c_long = 382;
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const EBX: ::c_int = 0;
+pub const ECX: ::c_int = 1;
+pub const EDX: ::c_int = 2;
+pub const ESI: ::c_int = 3;
+pub const EDI: ::c_int = 4;
+pub const EBP: ::c_int = 5;
+pub const EAX: ::c_int = 6;
+pub const DS: ::c_int = 7;
+pub const ES: ::c_int = 8;
+pub const FS: ::c_int = 9;
+pub const GS: ::c_int = 10;
+pub const ORIG_EAX: ::c_int = 11;
+pub const EIP: ::c_int = 12;
+pub const CS: ::c_int = 13;
+pub const EFL: ::c_int = 14;
+pub const UESP: ::c_int = 15;
+pub const SS: ::c_int = 16;
--- a/third_party/rust/libc/src/unix/notbsd/android/b64/aarch64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/android/b64/aarch64.rs
@@ -47,10 +47,17 @@ s! {
         __unused4: ::c_uint,
         __unused5: ::c_uint,
     }
 }
 
 pub const O_DIRECT: ::c_int = 0x10000;
 pub const O_DIRECTORY: ::c_int = 0x4000;
 pub const O_NOFOLLOW: ::c_int = 0x8000;
+pub const O_LARGEFILE: ::c_int = 0o400000;
 
+pub const SYS_pivot_root: ::c_long = 41;
 pub const SYS_gettid: ::c_long = 178;
+pub const SYS_perf_event_open: ::c_long = 241;
+pub const SYS_memfd_create: ::c_long = 279;
+
+pub const SIGSTKSZ: ::size_t = 16384;
+pub const MINSIGSTKSZ: ::size_t = 5120;
--- a/third_party/rust/libc/src/unix/notbsd/android/b64/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/android/b64/mod.rs
@@ -89,16 +89,46 @@ s! {
         pub freeswap: ::c_ulong,
         pub procs: ::c_ushort,
         pub pad: ::c_ushort,
         pub totalhigh: ::c_ulong,
         pub freehigh: ::c_ulong,
         pub mem_unit: ::c_uint,
         pub _f: [::c_char; 0],
     }
+
+    pub struct statfs64 {
+        pub f_type: u64,
+        pub f_bsize: u64,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        f_fsid: [u32; 2],
+        pub f_namelen: u64,
+        pub f_frsize: u64,
+        pub f_flags: u64,
+        pub f_spare: [u64; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
 }
 
 pub const RTLD_GLOBAL: ::c_int = 0x00100;
 pub const RTLD_NOW: ::c_int = 2;
 pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
 
 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
     value: 0,
--- a/third_party/rust/libc/src/unix/notbsd/android/b64/x86_64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/android/b64/x86_64.rs
@@ -41,10 +41,380 @@ s! {
         pub st_ctime_nsec: ::c_ulong,
         __unused: [::c_long; 3],
     }
 }
 
 pub const O_DIRECT: ::c_int = 0x4000;
 pub const O_DIRECTORY: ::c_int = 0x10000;
 pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
 
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+
+pub const MAP_32BIT: ::c_int = 0x40;
+
+// Syscall table
+
+pub const SYS_read: ::c_long = 0;
+pub const SYS_write: ::c_long = 1;
+pub const SYS_open: ::c_long = 2;
+pub const SYS_close: ::c_long = 3;
+pub const SYS_stat: ::c_long = 4;
+pub const SYS_fstat: ::c_long = 5;
+pub const SYS_lstat: ::c_long = 6;
+pub const SYS_poll: ::c_long = 7;
+pub const SYS_lseek: ::c_long = 8;
+pub const SYS_mmap: ::c_long = 9;
+pub const SYS_mprotect: ::c_long = 10;
+pub const SYS_munmap: ::c_long = 11;
+pub const SYS_brk: ::c_long = 12;
+pub const SYS_rt_sigaction: ::c_long = 13;
+pub const SYS_rt_sigprocmask: ::c_long = 14;
+pub const SYS_rt_sigreturn: ::c_long = 15;
+pub const SYS_ioctl: ::c_long = 16;
+pub const SYS_pread64: ::c_long = 17;
+pub const SYS_pwrite64: ::c_long = 18;
+pub const SYS_readv: ::c_long = 19;
+pub const SYS_writev: ::c_long = 20;
+pub const SYS_access: ::c_long = 21;
+pub const SYS_pipe: ::c_long = 22;
+pub const SYS_select: ::c_long = 23;
+pub const SYS_sched_yield: ::c_long = 24;
+pub const SYS_mremap: ::c_long = 25;
+pub const SYS_msync: ::c_long = 26;
+pub const SYS_mincore: ::c_long = 27;
+pub const SYS_madvise: ::c_long = 28;
+pub const SYS_shmget: ::c_long = 29;
+pub const SYS_shmat: ::c_long = 30;
+pub const SYS_shmctl: ::c_long = 31;
+pub const SYS_dup: ::c_long = 32;
+pub const SYS_dup2: ::c_long = 33;
+pub const SYS_pause: ::c_long = 34;
+pub const SYS_nanosleep: ::c_long = 35;
+pub const SYS_getitimer: ::c_long = 36;
+pub const SYS_alarm: ::c_long = 37;
+pub const SYS_setitimer: ::c_long = 38;
+pub const SYS_getpid: ::c_long = 39;
+pub const SYS_sendfile: ::c_long = 40;
+pub const SYS_socket: ::c_long = 41;
+pub const SYS_connect: ::c_long = 42;
+pub const SYS_accept: ::c_long = 43;
+pub const SYS_sendto: ::c_long = 44;
+pub const SYS_recvfrom: ::c_long = 45;
+pub const SYS_sendmsg: ::c_long = 46;
+pub const SYS_recvmsg: ::c_long = 47;
+pub const SYS_shutdown: ::c_long = 48;
+pub const SYS_bind: ::c_long = 49;
+pub const SYS_listen: ::c_long = 50;
+pub const SYS_getsockname: ::c_long = 51;
+pub const SYS_getpeername: ::c_long = 52;
+pub const SYS_socketpair: ::c_long = 53;
+pub const SYS_setsockopt: ::c_long = 54;
+pub const SYS_getsockopt: ::c_long = 55;
+pub const SYS_clone: ::c_long = 56;
+pub const SYS_fork: ::c_long = 57;
+pub const SYS_vfork: ::c_long = 58;
+pub const SYS_execve: ::c_long = 59;
+pub const SYS_exit: ::c_long = 60;
+pub const SYS_wait4: ::c_long = 61;
+pub const SYS_kill: ::c_long = 62;
+pub const SYS_uname: ::c_long = 63;
+pub const SYS_semget: ::c_long = 64;
+pub const SYS_semop: ::c_long = 65;
+pub const SYS_semctl: ::c_long = 66;
+pub const SYS_shmdt: ::c_long = 67;
+pub const SYS_msgget: ::c_long = 68;
+pub const SYS_msgsnd: ::c_long = 69;
+pub const SYS_msgrcv: ::c_long = 70;
+pub const SYS_msgctl: ::c_long = 71;
+pub const SYS_fcntl: ::c_long = 72;
+pub const SYS_flock: ::c_long = 73;
+pub const SYS_fsync: ::c_long = 74;
+pub const SYS_fdatasync: ::c_long = 75;
+pub const SYS_truncate: ::c_long = 76;
+pub const SYS_ftruncate: ::c_long = 77;
+pub const SYS_getdents: ::c_long = 78;
+pub const SYS_getcwd: ::c_long = 79;
+pub const SYS_chdir: ::c_long = 80;
+pub const SYS_fchdir: ::c_long = 81;
+pub const SYS_rename: ::c_long = 82;
+pub const SYS_mkdir: ::c_long = 83;
+pub const SYS_rmdir: ::c_long = 84;
+pub const SYS_creat: ::c_long = 85;
+pub const SYS_link: ::c_long = 86;
+pub const SYS_unlink: ::c_long = 87;
+pub const SYS_symlink: ::c_long = 88;
+pub const SYS_readlink: ::c_long = 89;
+pub const SYS_chmod: ::c_long = 90;
+pub const SYS_fchmod: ::c_long = 91;
+pub const SYS_chown: ::c_long = 92;
+pub const SYS_fchown: ::c_long = 93;
+pub const SYS_lchown: ::c_long = 94;
+pub const SYS_umask: ::c_long = 95;
+pub const SYS_gettimeofday: ::c_long = 96;
+pub const SYS_getrlimit: ::c_long = 97;
+pub const SYS_getrusage: ::c_long = 98;
+pub const SYS_sysinfo: ::c_long = 99;
+pub const SYS_times: ::c_long = 100;
+pub const SYS_ptrace: ::c_long = 101;
+pub const SYS_getuid: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_getgid: ::c_long = 104;
+pub const SYS_setuid: ::c_long = 105;
+pub const SYS_setgid: ::c_long = 106;
+pub const SYS_geteuid: ::c_long = 107;
+pub const SYS_getegid: ::c_long = 108;
+pub const SYS_setpgid: ::c_long = 109;
+pub const SYS_getppid: ::c_long = 110;
+pub const SYS_getpgrp: ::c_long = 111;
+pub const SYS_setsid: ::c_long = 112;
+pub const SYS_setreuid: ::c_long = 113;
+pub const SYS_setregid: ::c_long = 114;
+pub const SYS_getgroups: ::c_long = 115;
+pub const SYS_setgroups: ::c_long = 116;
+pub const SYS_setresuid: ::c_long = 117;
+pub const SYS_getresuid: ::c_long = 118;
+pub const SYS_setresgid: ::c_long = 119;
+pub const SYS_getresgid: ::c_long = 120;
+pub const SYS_getpgid: ::c_long = 121;
+pub const SYS_setfsuid: ::c_long = 122;
+pub const SYS_setfsgid: ::c_long = 123;
+pub const SYS_getsid: ::c_long = 124;
+pub const SYS_capget: ::c_long = 125;
+pub const SYS_capset: ::c_long = 126;
+pub const SYS_rt_sigpending: ::c_long = 127;
+pub const SYS_rt_sigtimedwait: ::c_long = 128;
+pub const SYS_rt_sigqueueinfo: ::c_long = 129;
+pub const SYS_rt_sigsuspend: ::c_long = 130;
+pub const SYS_sigaltstack: ::c_long = 131;
+pub const SYS_utime: ::c_long = 132;
+pub const SYS_mknod: ::c_long = 133;
+pub const SYS_uselib: ::c_long = 134;
+pub const SYS_personality: ::c_long = 135;
+pub const SYS_ustat: ::c_long = 136;
+pub const SYS_statfs: ::c_long = 137;
+pub const SYS_fstatfs: ::c_long = 138;
+pub const SYS_sysfs: ::c_long = 139;
+pub const SYS_getpriority: ::c_long = 140;
+pub const SYS_setpriority: ::c_long = 141;
+pub const SYS_sched_setparam: ::c_long = 142;
+pub const SYS_sched_getparam: ::c_long = 143;
+pub const SYS_sched_setscheduler: ::c_long = 144;
+pub const SYS_sched_getscheduler: ::c_long = 145;
+pub const SYS_sched_get_priority_max: ::c_long = 146;
+pub const SYS_sched_get_priority_min: ::c_long = 147;
+pub const SYS_sched_rr_get_interval: ::c_long = 148;
+pub const SYS_mlock: ::c_long = 149;
+pub const SYS_munlock: ::c_long = 150;
+pub const SYS_mlockall: ::c_long = 151;
+pub const SYS_munlockall: ::c_long = 152;
+pub const SYS_vhangup: ::c_long = 153;
+pub const SYS_modify_ldt: ::c_long = 154;
+pub const SYS_pivot_root: ::c_long = 155;
+// FIXME: SYS__sysctl is in the NDK sources but for some reason is
+//        not available in the tests
+// pub const SYS__sysctl: ::c_long = 156;
+pub const SYS_prctl: ::c_long = 157;
+pub const SYS_arch_prctl: ::c_long = 158;
+pub const SYS_adjtimex: ::c_long = 159;
+pub const SYS_setrlimit: ::c_long = 160;
+pub const SYS_chroot: ::c_long = 161;
+pub const SYS_sync: ::c_long = 162;
+pub const SYS_acct: ::c_long = 163;
+pub const SYS_settimeofday: ::c_long = 164;
+pub const SYS_mount: ::c_long = 165;
+pub const SYS_umount2: ::c_long = 166;
+pub const SYS_swapon: ::c_long = 167;
+pub const SYS_swapoff: ::c_long = 168;
+pub const SYS_reboot: ::c_long = 169;
+pub const SYS_sethostname: ::c_long = 170;
+pub const SYS_setdomainname: ::c_long = 171;
+pub const SYS_iopl: ::c_long = 172;
+pub const SYS_ioperm: ::c_long = 173;
+pub const SYS_create_module: ::c_long = 174;
+pub const SYS_init_module: ::c_long = 175;
+pub const SYS_delete_module: ::c_long = 176;
+pub const SYS_get_kernel_syms: ::c_long = 177;
+pub const SYS_query_module: ::c_long = 178;
+pub const SYS_quotactl: ::c_long = 179;
+pub const SYS_nfsservctl: ::c_long = 180;
+pub const SYS_getpmsg: ::c_long = 181;
+pub const SYS_putpmsg: ::c_long = 182;
+pub const SYS_afs_syscall: ::c_long = 183;
+pub const SYS_tuxcall: ::c_long = 184;
+pub const SYS_security: ::c_long = 185;
 pub const SYS_gettid: ::c_long = 186;
+pub const SYS_readahead: ::c_long = 187;
+pub const SYS_setxattr: ::c_long = 188;
+pub const SYS_lsetxattr: ::c_long = 189;
+pub const SYS_fsetxattr: ::c_long = 190;
+pub const SYS_getxattr: ::c_long = 191;
+pub const SYS_lgetxattr: ::c_long = 192;
+pub const SYS_fgetxattr: ::c_long = 193;
+pub const SYS_listxattr: ::c_long = 194;
+pub const SYS_llistxattr: ::c_long = 195;
+pub const SYS_flistxattr: ::c_long = 196;
+pub const SYS_removexattr: ::c_long = 197;
+pub const SYS_lremovexattr: ::c_long = 198;
+pub const SYS_fremovexattr: ::c_long = 199;
+pub const SYS_tkill: ::c_long = 200;
+pub const SYS_time: ::c_long = 201;
+pub const SYS_futex: ::c_long = 202;
+pub const SYS_sched_setaffinity: ::c_long = 203;
+pub const SYS_sched_getaffinity: ::c_long = 204;
+pub const SYS_set_thread_area: ::c_long = 205;
+pub const SYS_io_setup: ::c_long = 206;
+pub const SYS_io_destroy: ::c_long = 207;
+pub const SYS_io_getevents: ::c_long = 208;
+pub const SYS_io_submit: ::c_long = 209;
+pub const SYS_io_cancel: ::c_long = 210;
+pub const SYS_get_thread_area: ::c_long = 211;
+pub const SYS_lookup_dcookie: ::c_long = 212;
+pub const SYS_epoll_create: ::c_long = 213;
+pub const SYS_epoll_ctl_old: ::c_long = 214;
+pub const SYS_epoll_wait_old: ::c_long = 215;
+pub const SYS_remap_file_pages: ::c_long = 216;
+pub const SYS_getdents64: ::c_long = 217;
+pub const SYS_set_tid_address: ::c_long = 218;
+pub const SYS_restart_syscall: ::c_long = 219;
+pub const SYS_semtimedop: ::c_long = 220;
+pub const SYS_fadvise64: ::c_long = 221;
+pub const SYS_timer_create: ::c_long = 222;
+pub const SYS_timer_settime: ::c_long = 223;
+pub const SYS_timer_gettime: ::c_long = 224;
+pub const SYS_timer_getoverrun: ::c_long = 225;
+pub const SYS_timer_delete: ::c_long = 226;
+pub const SYS_clock_settime: ::c_long = 227;
+pub const SYS_clock_gettime: ::c_long = 228;
+pub const SYS_clock_getres: ::c_long = 229;
+pub const SYS_clock_nanosleep: ::c_long = 230;
+pub const SYS_exit_group: ::c_long = 231;
+pub const SYS_epoll_wait: ::c_long = 232;
+pub const SYS_epoll_ctl: ::c_long = 233;
+pub const SYS_tgkill: ::c_long = 234;
+pub const SYS_utimes: ::c_long = 235;
+pub const SYS_vserver: ::c_long = 236;
+pub const SYS_mbind: ::c_long = 237;
+pub const SYS_set_mempolicy: ::c_long = 238;
+pub const SYS_get_mempolicy: ::c_long = 239;
+pub const SYS_mq_open: ::c_long = 240;
+pub const SYS_mq_unlink: ::c_long = 241;
+pub const SYS_mq_timedsend: ::c_long = 242;
+pub const SYS_mq_timedreceive: ::c_long = 243;
+pub const SYS_mq_notify: ::c_long = 244;
+pub const SYS_mq_getsetattr: ::c_long = 245;
+pub const SYS_kexec_load: ::c_long = 246;
+pub const SYS_waitid: ::c_long = 247;
+pub const SYS_add_key: ::c_long = 248;
+pub const SYS_request_key: ::c_long = 249;
+pub const SYS_keyctl: ::c_long = 250;
+pub const SYS_ioprio_set: ::c_long = 251;
+pub const SYS_ioprio_get: ::c_long = 252;
+pub const SYS_inotify_init: ::c_long = 253;
+pub const SYS_inotify_add_watch: ::c_long = 254;
+pub const SYS_inotify_rm_watch: ::c_long = 255;
+pub const SYS_migrate_pages: ::c_long = 256;
+pub const SYS_openat: ::c_long = 257;
+pub const SYS_mkdirat: ::c_long = 258;
+pub const SYS_mknodat: ::c_long = 259;
+pub const SYS_fchownat: ::c_long = 260;
+pub const SYS_futimesat: ::c_long = 261;
+pub const SYS_newfstatat: ::c_long = 262;
+pub const SYS_unlinkat: ::c_long = 263;
+pub const SYS_renameat: ::c_long = 264;
+pub const SYS_linkat: ::c_long = 265;
+pub const SYS_symlinkat: ::c_long = 266;
+pub const SYS_readlinkat: ::c_long = 267;
+pub const SYS_fchmodat: ::c_long = 268;
+pub const SYS_faccessat: ::c_long = 269;
+pub const SYS_pselect6: ::c_long = 270;
+pub const SYS_ppoll: ::c_long = 271;
+pub const SYS_unshare: ::c_long = 272;
+pub const SYS_set_robust_list: ::c_long = 273;
+pub const SYS_get_robust_list: ::c_long = 274;
+pub const SYS_splice: ::c_long = 275;
+pub const SYS_tee: ::c_long = 276;
+pub const SYS_sync_file_range: ::c_long = 277;
+pub const SYS_vmsplice: ::c_long = 278;
+pub const SYS_move_pages: ::c_long = 279;
+pub const SYS_utimensat: ::c_long = 280;
+pub const SYS_epoll_pwait: ::c_long = 281;
+pub const SYS_signalfd: ::c_long = 282;
+pub const SYS_timerfd_create: ::c_long = 283;
+pub const SYS_eventfd: ::c_long = 284;
+pub const SYS_fallocate: ::c_long = 285;
+pub const SYS_timerfd_settime: ::c_long = 286;
+pub const SYS_timerfd_gettime: ::c_long = 287;
+pub const SYS_accept4: ::c_long = 288;
+pub const SYS_signalfd4: ::c_long = 289;
+pub const SYS_eventfd2: ::c_long = 290;
+pub const SYS_epoll_create1: ::c_long = 291;
+pub const SYS_dup3: ::c_long = 292;
+pub const SYS_pipe2: ::c_long = 293;
+pub const SYS_inotify_init1: ::c_long = 294;
+pub const SYS_preadv: ::c_long = 295;
+pub const SYS_pwritev: ::c_long = 296;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 297;
+pub const SYS_perf_event_open: ::c_long = 298;
+pub const SYS_recvmmsg: ::c_long = 299;
+pub const SYS_fanotify_init: ::c_long = 300;
+pub const SYS_fanotify_mark: ::c_long = 301;
+pub const SYS_prlimit64: ::c_long = 302;
+pub const SYS_name_to_handle_at: ::c_long = 303;
+pub const SYS_open_by_handle_at: ::c_long = 304;
+pub const SYS_clock_adjtime: ::c_long = 305;
+pub const SYS_syncfs: ::c_long = 306;
+pub const SYS_sendmmsg: ::c_long = 307;
+pub const SYS_setns: ::c_long = 308;
+pub const SYS_getcpu: ::c_long = 309;
+pub const SYS_process_vm_readv: ::c_long = 310;
+pub const SYS_process_vm_writev: ::c_long = 311;
+pub const SYS_kcmp: ::c_long = 312;
+pub const SYS_finit_module: ::c_long = 313;
+pub const SYS_sched_setattr: ::c_long = 314;
+pub const SYS_sched_getattr: ::c_long = 315;
+pub const SYS_renameat2: ::c_long = 316;
+pub const SYS_seccomp: ::c_long = 317;
+pub const SYS_getrandom: ::c_long = 318;
+pub const SYS_memfd_create: ::c_long = 319;
+pub const SYS_kexec_file_load: ::c_long = 320;
+pub const SYS_bpf: ::c_long = 321;
+pub const SYS_execveat: ::c_long = 322;
+pub const SYS_userfaultfd: ::c_long = 323;
+pub const SYS_membarrier: ::c_long = 324;
+pub const SYS_mlock2: ::c_long = 325;
+pub const SYS_copy_file_range: ::c_long = 326;
+pub const SYS_preadv2: ::c_long = 327;
+pub const SYS_pwritev2: ::c_long = 328;
+pub const SYS_pkey_mprotect: ::c_long = 329;
+pub const SYS_pkey_alloc: ::c_long = 330;
+pub const SYS_pkey_free: ::c_long = 331;
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const R15: ::c_int = 0;
+pub const R14: ::c_int = 1;
+pub const R13: ::c_int = 2;
+pub const R12: ::c_int = 3;
+pub const RBP: ::c_int = 4;
+pub const RBX: ::c_int = 5;
+pub const R11: ::c_int = 6;
+pub const R10: ::c_int = 7;
+pub const R9: ::c_int = 8;
+pub const R8: ::c_int = 9;
+pub const RAX: ::c_int = 10;
+pub const RCX: ::c_int = 11;
+pub const RDX: ::c_int = 12;
+pub const RSI: ::c_int = 13;
+pub const RDI: ::c_int = 14;
+pub const ORIG_RAX: ::c_int = 15;
+pub const RIP: ::c_int = 16;
+pub const CS: ::c_int = 17;
+pub const EFLAGS: ::c_int = 18;
+pub const RSP: ::c_int = 19;
+pub const SS: ::c_int = 20;
+pub const FS_BASE: ::c_int = 21;
+pub const GS_BASE: ::c_int = 22;
+pub const DS: ::c_int = 23;
+pub const ES: ::c_int = 24;
+pub const FS: ::c_int = 25;
+pub const GS: ::c_int = 26;
--- a/third_party/rust/libc/src/unix/notbsd/android/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/android/mod.rs
@@ -1,31 +1,33 @@
 //! Android-specific definitions for linux-like values
 
-use dox::mem;
+use dox::{mem, Option};
 
 pub type clock_t = ::c_long;
 pub type time_t = ::c_long;
 pub type suseconds_t = ::c_long;
 pub type off_t = ::c_long;
 pub type blkcnt_t = ::c_ulong;
 pub type blksize_t = ::c_ulong;
 pub type nlink_t = u32;
 pub type useconds_t = u32;
 pub type pthread_t = ::c_long;
 pub type pthread_mutexattr_t = ::c_long;
+pub type pthread_rwlockattr_t = ::c_long;
 pub type pthread_condattr_t = ::c_long;
 pub type fsfilcnt_t = ::c_ulong;
 pub type fsblkcnt_t = ::c_ulong;
 pub type nfds_t = ::c_uint;
 pub type rlim_t = ::c_ulong;
 pub type dev_t = ::c_ulong;
 pub type ino_t = ::c_ulong;
 pub type __CPU_BITTYPE = ::c_ulong;
 pub type idtype_t = ::c_int;
+pub type loff_t = ::c_longlong;
 
 s! {
     pub struct dirent {
         pub d_ino: u64,
         pub d_off: i64,
         pub d_reclen: ::c_ushort,
         pub d_type: ::c_uchar,
         pub d_name: [::c_char; 256],
@@ -140,21 +142,43 @@ s! {
         pub f_ffree: ::fsfilcnt_t,
         pub f_favail: ::fsfilcnt_t,
         pub f_fsid: ::c_ulong,
         pub f_flag: ::c_ulong,
         pub f_namemax: ::c_ulong,
         #[cfg(target_pointer_width = "64")]
         __f_reserved: [u32; 6],
     }
+
+    pub struct signalfd_siginfo {
+        pub ssi_signo: ::uint32_t,
+        pub ssi_errno: ::int32_t,
+        pub ssi_code: ::int32_t,
+        pub ssi_pid: ::uint32_t,
+        pub ssi_uid: ::uint32_t,
+        pub ssi_fd: ::int32_t,
+        pub ssi_tid: ::uint32_t,
+        pub ssi_band: ::uint32_t,
+        pub ssi_overrun: ::uint32_t,
+        pub ssi_trapno: ::uint32_t,
+        pub ssi_status: ::int32_t,
+        pub ssi_int: ::int32_t,
+        pub ssi_ptr: ::c_ulonglong,
+        pub ssi_utime: ::c_ulonglong,
+        pub ssi_stime: ::c_ulonglong,
+        pub ssi_addr: ::c_ulonglong,
+        pub ssi_addr_lsb: ::uint16_t,
+        _pad: [::uint8_t; 46],
+    }
 }
 
 pub const O_TRUNC: ::c_int = 512;
-
 pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_PATH: ::c_int = 0o10000000;
+pub const O_NOATIME: ::c_int = 0o1000000;
 
 pub const EBFONT: ::c_int = 59;
 pub const ENOSTR: ::c_int = 60;
 pub const ENODATA: ::c_int = 61;
 pub const ETIME: ::c_int = 62;
 pub const ENOSR: ::c_int = 63;
 pub const ENONET: ::c_int = 64;
 pub const ENOPKG: ::c_int = 65;
@@ -168,16 +192,18 @@ pub const EDOTDOT: ::c_int = 73;
 
 pub const SA_NODEFER: ::c_int = 0x40000000;
 pub const SA_RESETHAND: ::c_int = 0x80000000;
 pub const SA_RESTART: ::c_int = 0x10000000;
 pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
 
 pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
 pub const EPOLLONESHOT: ::c_int = 0x40000000;
+pub const EPOLLRDHUP: ::c_int = 0x00002000;
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
 
 pub const EFD_CLOEXEC: ::c_int = 0x80000;
 
 pub const USER_PROCESS: ::c_short = 7;
 
 pub const BUFSIZ: ::c_uint = 1024;
 pub const FILENAME_MAX: ::c_uint = 1024;
 pub const FOPEN_MAX: ::c_uint = 20;
@@ -186,34 +212,45 @@ pub const POSIX_FADV_NOREUSE: ::c_int = 
 pub const L_tmpnam: ::c_uint = 1024;
 pub const TMP_MAX: ::c_uint = 308915776;
 pub const _PC_LINK_MAX: ::c_int = 1;
 pub const _PC_MAX_CANON: ::c_int = 2;
 pub const _PC_MAX_INPUT: ::c_int = 3;
 pub const _PC_NAME_MAX: ::c_int = 4;
 pub const _PC_PATH_MAX: ::c_int = 5;
 pub const _PC_PIPE_BUF: ::c_int = 6;
+pub const _PC_2_SYMLINKS: ::c_int = 7;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 8;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 9;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 10;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 11;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 12;
+pub const _PC_SYMLINK_MAX: ::c_int = 13;
 pub const _PC_CHOWN_RESTRICTED: ::c_int = 14;
 pub const _PC_NO_TRUNC: ::c_int = 15;
 pub const _PC_VDISABLE: ::c_int = 16;
+pub const _PC_ASYNC_IO: ::c_int = 17;
+pub const _PC_PRIO_IO: ::c_int = 18;
+pub const _PC_SYNC_IO: ::c_int = 19;
 
 pub const FIONBIO: ::c_int = 0x5421;
 
 pub const _SC_ARG_MAX: ::c_int = 0;
 pub const _SC_BC_BASE_MAX: ::c_int = 1;
 pub const _SC_BC_DIM_MAX: ::c_int = 2;
 pub const _SC_BC_SCALE_MAX: ::c_int = 3;
 pub const _SC_BC_STRING_MAX: ::c_int = 4;
 pub const _SC_CHILD_MAX: ::c_int = 5;
 pub const _SC_CLK_TCK: ::c_int = 6;
 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7;
 pub const _SC_EXPR_NEST_MAX: ::c_int = 8;
 pub const _SC_LINE_MAX: ::c_int = 9;
 pub const _SC_NGROUPS_MAX: ::c_int = 10;
 pub const _SC_OPEN_MAX: ::c_int = 11;
+pub const _SC_PASS_MAX: ::c_int = 12;
 pub const _SC_2_C_BIND: ::c_int = 13;
 pub const _SC_2_C_DEV: ::c_int = 14;
 pub const _SC_2_C_VERSION: ::c_int = 15;
 pub const _SC_2_CHAR_TERM: ::c_int = 16;
 pub const _SC_2_FORT_DEV: ::c_int = 17;
 pub const _SC_2_FORT_RUN: ::c_int = 18;
 pub const _SC_2_LOCALEDEF: ::c_int = 19;
 pub const _SC_2_SW_DEV: ::c_int = 20;
@@ -233,33 +270,65 @@ pub const _SC_XOPEN_XCU_VERSION: ::c_int
 pub const _SC_XOPEN_REALTIME: ::c_int = 34;
 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35;
 pub const _SC_XOPEN_LEGACY: ::c_int = 36;
 pub const _SC_ATEXIT_MAX: ::c_int = 37;
 pub const _SC_IOV_MAX: ::c_int = 38;
 pub const _SC_PAGESIZE: ::c_int = 39;
 pub const _SC_PAGE_SIZE: ::c_int = 40;
 pub const _SC_XOPEN_UNIX: ::c_int = 41;
+pub const _SC_XBS5_ILP32_OFF32: ::c_int = 42;
+pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 43;
+pub const _SC_XBS5_LP64_OFF64: ::c_int = 44;
+pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 45;
+pub const _SC_AIO_LISTIO_MAX: ::c_int = 46;
+pub const _SC_AIO_MAX: ::c_int = 47;
+pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 48;
+pub const _SC_DELAYTIMER_MAX: ::c_int = 49;
+pub const _SC_MQ_OPEN_MAX: ::c_int = 50;
 pub const _SC_MQ_PRIO_MAX: ::c_int = 51;
+pub const _SC_RTSIG_MAX: ::c_int = 52;
+pub const _SC_SEM_NSEMS_MAX: ::c_int = 53;
+pub const _SC_SEM_VALUE_MAX: ::c_int = 54;
+pub const _SC_SIGQUEUE_MAX: ::c_int = 55;
+pub const _SC_TIMER_MAX: ::c_int = 56;
+pub const _SC_ASYNCHRONOUS_IO: ::c_int = 57;
+pub const _SC_FSYNC: ::c_int = 58;
+pub const _SC_MAPPED_FILES: ::c_int = 59;
+pub const _SC_MEMLOCK: ::c_int = 60;
+pub const _SC_MEMLOCK_RANGE: ::c_int = 61;
+pub const _SC_MEMORY_PROTECTION: ::c_int = 62;
+pub const _SC_MESSAGE_PASSING: ::c_int = 63;
+pub const _SC_PRIORITIZED_IO: ::c_int = 64;
+pub const _SC_PRIORITY_SCHEDULING: ::c_int = 65;
+pub const _SC_REALTIME_SIGNALS: ::c_int = 66;
+pub const _SC_SEMAPHORES: ::c_int = 67;
+pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 68;
+pub const _SC_SYNCHRONIZED_IO: ::c_int = 69;
+pub const _SC_TIMERS: ::c_int = 70;
 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71;
 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72;
 pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74;
 pub const _SC_THREAD_KEYS_MAX: ::c_int = 75;
 pub const _SC_THREAD_STACK_MIN: ::c_int = 76;
 pub const _SC_THREAD_THREADS_MAX: ::c_int = 77;
 pub const _SC_TTY_NAME_MAX: ::c_int = 78;
 pub const _SC_THREADS: ::c_int = 79;
 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80;
 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81;
 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82;
 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83;
 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84;
 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 96;
 pub const _SC_NPROCESSORS_ONLN: ::c_int = 97;
+pub const _SC_PHYS_PAGES: ::c_int = 98;
+pub const _SC_AVPHYS_PAGES: ::c_int = 99;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 100;
 
 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
 
 pub const FIOCLEX: ::c_int = 0x5451;
 
@@ -413,70 +482,85 @@ pub const EKEYREJECTED: ::c_int = 129;
 pub const EOWNERDEAD: ::c_int = 130;
 pub const ENOTRECOVERABLE: ::c_int = 131;
 
 pub const SOCK_STREAM: ::c_int = 1;
 pub const SOCK_DGRAM: ::c_int = 2;
 pub const SOCK_SEQPACKET: ::c_int = 5;
 
 pub const SOL_SOCKET: ::c_int = 1;
-pub const SOL_UDP: ::c_int = 17;
 pub const SOL_SCTP: ::c_int = 132;
 pub const SOL_IPX: ::c_int = 256;
 pub const SOL_AX25: ::c_int = 257;
 pub const SOL_ATALK: ::c_int = 258;
 pub const SOL_NETROM: ::c_int = 259;
 pub const SOL_ROSE: ::c_int = 260;
 
 #[doc(hidden)]
-pub const AF_MAX: ::c_int = 39;
+pub const AF_MAX: ::c_int = 43;
 #[doc(hidden)]
 pub const PF_MAX: ::c_int = AF_MAX;
 
 pub const SO_REUSEADDR: ::c_int = 2;
 pub const SO_TYPE: ::c_int = 3;
 pub const SO_ERROR: ::c_int = 4;
 pub const SO_DONTROUTE: ::c_int = 5;
 pub const SO_BROADCAST: ::c_int = 6;
 pub const SO_SNDBUF: ::c_int = 7;
 pub const SO_RCVBUF: ::c_int = 8;
 pub const SO_KEEPALIVE: ::c_int = 9;
 pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_PRIORITY: ::c_int = 12;
 pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
 pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_PASSCRED: ::c_int = 16;
+pub const SO_PEERCRED: ::c_int = 17;
 pub const SO_RCVLOWAT: ::c_int = 18;
 pub const SO_SNDLOWAT: ::c_int = 19;
 pub const SO_RCVTIMEO: ::c_int = 20;
 pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
 pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const SO_SNDBUFFORCE: ::c_int = 32;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_PROTOCOL: ::c_int = 38;
+pub const SO_DOMAIN: ::c_int = 39;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
 
 pub const O_ACCMODE: ::c_int = 3;
 pub const O_APPEND: ::c_int = 1024;
 pub const O_CREAT: ::c_int = 64;
 pub const O_EXCL: ::c_int = 128;
 pub const O_NOCTTY: ::c_int = 256;
 pub const O_NONBLOCK: ::c_int = 2048;
 pub const O_SYNC: ::c_int = 0x101000;
 pub const O_ASYNC: ::c_int = 0x2000;
 pub const O_NDELAY: ::c_int = 0x800;
+pub const O_DSYNC: ::c_int = 4096;
 
 pub const NI_MAXHOST: ::size_t = 1025;
 
 pub const NCCS: usize = 19;
 pub const TCSBRKP: ::c_int = 0x5425;
 pub const TCSANOW: ::c_int = 0;
 pub const TCSADRAIN: ::c_int = 0x1;
 pub const TCSAFLUSH: ::c_int = 0x2;
 pub const VEOF: usize = 4;
 pub const VEOL: usize = 11;
 pub const VEOL2: usize = 16;
 pub const VMIN: usize = 6;
 pub const IEXTEN: ::tcflag_t = 0x00008000;
 pub const TOSTOP: ::tcflag_t = 0x00000100;
 pub const FLUSHO: ::tcflag_t = 0x00001000;
+pub const EXTPROC: ::tcflag_t = 0o200000;
 
 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
 pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
 pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
 pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
 pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
 pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
 pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
@@ -495,18 +579,16 @@ pub const NFS_SUPER_MAGIC: ::c_long = 0x
 pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
 pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
 pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
 pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
 pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
 pub const TMPFS_MAGIC: ::c_long = 0x01021994;
 pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
 
-pub const MADV_HUGEPAGE: ::c_int = 14;
-pub const MADV_NOHUGEPAGE: ::c_int = 15;
 pub const MAP_HUGETLB: ::c_int = 0x040000;
 
 pub const PTRACE_TRACEME: ::c_int = 0;
 pub const PTRACE_PEEKTEXT: ::c_int = 1;
 pub const PTRACE_PEEKDATA: ::c_int = 2;
 pub const PTRACE_PEEKUSER: ::c_int = 3;
 pub const PTRACE_POKETEXT: ::c_int = 4;
 pub const PTRACE_POKEDATA: ::c_int = 5;
@@ -579,18 +661,16 @@ pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_
 pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
 pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
 pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
 pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
 
 pub const MCL_CURRENT: ::c_int = 0x0001;
 pub const MCL_FUTURE: ::c_int = 0x0002;
 
-pub const SIGSTKSZ: ::size_t = 8192;
-pub const MINSIGSTKSZ: ::size_t = 2048;
 pub const CBAUD: ::tcflag_t = 0o0010017;
 pub const TAB1: ::c_int = 0x00000800;
 pub const TAB2: ::c_int = 0x00001000;
 pub const TAB3: ::c_int = 0x00001800;
 pub const CR1: ::c_int  = 0x00000200;
 pub const CR2: ::c_int  = 0x00000400;
 pub const CR3: ::c_int  = 0x00000600;
 pub const FF1: ::c_int  = 0x00008000;
@@ -621,16 +701,25 @@ pub const ECHOE: ::tcflag_t = 0x00000010
 pub const ECHOK: ::tcflag_t = 0x00000020;
 pub const ECHONL: ::tcflag_t = 0x00000040;
 pub const ECHOPRT: ::tcflag_t = 0x00000400;
 pub const ECHOCTL: ::tcflag_t = 0x00000200;
 pub const ISIG: ::tcflag_t = 0x00000001;
 pub const ICANON: ::tcflag_t = 0x00000002;
 pub const PENDIN: ::tcflag_t = 0x00004000;
 pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
@@ -719,16 +808,44 @@ pub const NETLINK_RX_RING: ::c_int = 6;
 pub const NETLINK_TX_RING: ::c_int = 7;
 
 pub const NLA_F_NESTED: ::c_int = 1 << 15;
 pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14;
 pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER);
 
 pub const SIGEV_THREAD_ID: ::c_int = 4;
 
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const SFD_CLOEXEC: ::c_int = O_CLOEXEC;
+pub const SFD_NONBLOCK: ::c_int = O_NONBLOCK;
+
+pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
+
+pub const SO_ORIGINAL_DST: ::c_int = 80;
+pub const IUTF8: ::tcflag_t = 0x00004000;
+pub const CMSPAR: ::tcflag_t = 0o10000000000;
+pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
+
 f! {
     pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
         for slot in cpuset.__bits.iter_mut() {
             *slot = 0;
         }
     }
 
     pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
@@ -798,16 +915,173 @@ extern {
     pub fn sched_getcpu() -> ::c_int;
 
     pub fn utmpname(name: *const ::c_char) -> ::c_int;
     pub fn setutent();
     pub fn getutent() -> *mut utmp;
 
     pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
                            len: ::off_t) -> ::c_int;
+    pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int)
+                    -> ::c_int;
+    pub fn syscall(num: ::c_long, ...) -> ::c_long;
+    pub fn sched_getaffinity(pid: ::pid_t,
+                             cpusetsize: ::size_t,
+                             cpuset: *mut cpu_set_t) -> ::c_int;
+    pub fn sched_setaffinity(pid: ::pid_t,
+                             cpusetsize: ::size_t,
+                             cpuset: *const cpu_set_t) -> ::c_int;
+    pub fn epoll_create(size: ::c_int) -> ::c_int;
+    pub fn epoll_create1(flags: ::c_int) -> ::c_int;
+    pub fn epoll_wait(epfd: ::c_int,
+                      events: *mut ::epoll_event,
+                      maxevents: ::c_int,
+                      timeout: ::c_int) -> ::c_int;
+    pub fn epoll_ctl(epfd: ::c_int,
+                     op: ::c_int,
+                     fd: ::c_int,
+                     event: *mut ::epoll_event) -> ::c_int;
+    pub fn pthread_getschedparam(native: ::pthread_t,
+                                 policy: *mut ::c_int,
+                                 param: *mut ::sched_param) -> ::c_int;
+    pub fn unshare(flags: ::c_int) -> ::c_int;
+    pub fn umount(target: *const ::c_char) -> ::c_int;
+    pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
+    pub fn tee(fd_in: ::c_int,
+               fd_out: ::c_int,
+               len: ::size_t,
+               flags: ::c_uint) -> ::ssize_t;
+    pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+    pub fn splice(fd_in: ::c_int,
+                  off_in: *mut ::loff_t,
+                  fd_out: ::c_int,
+                  off_out: *mut ::loff_t,
+                  len: ::size_t,
+                  flags: ::c_uint) -> ::ssize_t;
+    pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
+    pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn sem_timedwait(sem: *mut sem_t,
+                         abstime: *const ::timespec) -> ::c_int;
+    pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
+    pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
+    pub fn swapoff(puath: *const ::c_char) -> ::c_int;
+    pub fn vmsplice(fd: ::c_int,
+                    iov: *const ::iovec,
+                    nr_segs: ::size_t,
+                    flags: ::c_uint) -> ::ssize_t;
+    pub fn mount(src: *const ::c_char,
+                 target: *const ::c_char,
+                 fstype: *const ::c_char,
+                 flags: ::c_ulong,
+                 data: *const ::c_void) -> ::c_int;
+    pub fn personality(persona: ::c_ulong) -> ::c_int;
+    pub fn prctl(option: ::c_int, ...) -> ::c_int;
+    pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
+    pub fn ppoll(fds: *mut ::pollfd,
+                 nfds: nfds_t,
+                 timeout: *const ::timespec,
+                 sigmask: *const sigset_t) -> ::c_int;
+    pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+                                   abstime: *const ::timespec) -> ::c_int;
+    pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
+                 child_stack: *mut ::c_void,
+                 flags: ::c_int,
+                 arg: *mut ::c_void, ...) -> ::c_int;
+    pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
+    pub fn clock_nanosleep(clk_id: ::clockid_t,
+                           flags: ::c_int,
+                           rqtp: *const ::timespec,
+                           rmtp:  *mut ::timespec) -> ::c_int;
+    pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
+                                     guardsize: *mut ::size_t) -> ::c_int;
+    pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+    pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
+    pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
+                                       pshared: *mut ::c_int) -> ::c_int;
+    pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int;
+    pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
+    pub fn pthread_setschedparam(native: ::pthread_t,
+                                 policy: ::c_int,
+                                 param: *const ::sched_param) -> ::c_int;
+    pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int;
+    pub fn sched_setscheduler(pid: ::pid_t,
+                              policy: ::c_int,
+                              param: *const ::sched_param) -> ::c_int;
+    pub fn sendfile(out_fd: ::c_int,
+                    in_fd: ::c_int,
+                    offset: *mut off_t,
+                    count: ::size_t) -> ::ssize_t;
+    pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+    pub fn getgrgid_r(uid: ::uid_t,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "sigaltstack$UNIX2003")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+    pub fn sigaltstack(ss: *const stack_t,
+                       oss: *mut stack_t) -> ::c_int;
+    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+    pub fn getdtablesize() -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+    pub fn getgrnam_r(name: *const ::c_char,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "pthread_sigmask$UNIX2003")]
+    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+                           oldset: *mut sigset_t) -> ::c_int;
+    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+    pub fn getpwnam_r(name: *const ::c_char,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+    pub fn getpwuid_r(uid: ::uid_t,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+               link_name = "sigwait$UNIX2003")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+    pub fn sigwait(set: *const sigset_t,
+                   sig: *mut ::c_int) -> ::c_int;
+    pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+                          parent: Option<unsafe extern fn()>,
+                          child: Option<unsafe extern fn()>) -> ::c_int;
+    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+    pub fn getgrouplist(user: *const ::c_char,
+                        group: ::gid_t,
+                        groups: *mut ::gid_t,
+                        ngroups: *mut ::c_int) -> ::c_int;
+    pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
+                                        pshared: *mut ::c_int) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "popen$UNIX2003")]
+    pub fn popen(command: *const c_char,
+                 mode: *const c_char) -> *mut ::FILE;
+    pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
+                     mode: ::c_int, flags: ::c_int) -> ::c_int;
+    pub fn pthread_create(native: *mut ::pthread_t,
+                          attr: *const ::pthread_attr_t,
+                          f: extern fn(*mut ::c_void) -> *mut ::c_void,
+                          value: *mut ::c_void) -> ::c_int;
 }
 
 cfg_if! {
     if #[cfg(target_pointer_width = "32")] {
         mod b32;
         pub use self::b32::*;
     } else if #[cfg(target_pointer_width = "64")] {
         mod b64;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/src/unix/notbsd/emscripten.rs
@@ -0,0 +1,1667 @@
+use dox::{mem, Option};
+
+pub type c_char = i8;
+pub type wchar_t = i32;
+pub type useconds_t = u32;
+pub type dev_t = u32;
+pub type socklen_t = u32;
+pub type pthread_t = c_ulong;
+pub type mode_t = u32;
+pub type ino64_t = u32;
+pub type off64_t = i32;
+pub type blkcnt64_t = i32;
+pub type rlim64_t = u64;
+pub type shmatt_t = ::c_ulong;
+pub type mqd_t = ::c_int;
+pub type msgqnum_t = ::c_ulong;
+pub type msglen_t = ::c_ulong;
+pub type nfds_t = ::c_ulong;
+pub type nl_item = ::c_int;
+pub type idtype_t = ::c_uint;
+pub type loff_t = i32;
+
+pub type clock_t = c_long;
+pub type time_t = c_long;
+pub type suseconds_t = c_long;
+pub type ino_t = u32;
+pub type off_t = i32;
+pub type blkcnt_t = i32;
+
+pub type blksize_t = c_long;
+pub type fsblkcnt_t = u32;
+pub type fsfilcnt_t = u32;
+pub type rlim_t = ::c_ulonglong;
+pub type c_long = i32;
+pub type c_ulong = u32;
+pub type nlink_t = u32;
+
+pub enum fpos64_t {} // TODO: fill this out with a struct
+
+s! {
+    pub struct dirent {
+        pub d_ino: ::ino_t,
+        pub d_off: ::off_t,
+        pub d_reclen: ::c_ushort,
+        pub d_type: ::c_uchar,
+        pub d_name: [::c_char; 256],
+    }
+
+    pub struct dirent64 {
+        pub d_ino: ::ino64_t,
+        pub d_off: ::off64_t,
+        pub d_reclen: ::c_ushort,
+        pub d_type: ::c_uchar,
+        pub d_name: [::c_char; 256],
+    }
+
+    pub struct rlimit64 {
+        pub rlim_cur: rlim64_t,
+        pub rlim_max: rlim64_t,
+    }
+
+    pub struct glob_t {
+        pub gl_pathc: ::size_t,
+        pub gl_pathv: *mut *mut c_char,
+        pub gl_offs: ::size_t,
+        pub gl_flags: ::c_int,
+
+        __unused1: *mut ::c_void,
+        __unused2: *mut ::c_void,
+        __unused3: *mut ::c_void,
+        __unused4: *mut ::c_void,
+        __unused5: *mut ::c_void,
+    }
+
+    pub struct ifaddrs {
+        pub ifa_next: *mut ifaddrs,
+        pub ifa_name: *mut c_char,
+        pub ifa_flags: ::c_uint,
+        pub ifa_addr: *mut ::sockaddr,
+        pub ifa_netmask: *mut ::sockaddr,
+        pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
+        pub ifa_data: *mut ::c_void
+    }
+
+    pub struct pthread_mutex_t {
+        __align: [::c_long; 0],
+        size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
+    }
+
+    pub struct pthread_rwlock_t {
+        __align: [::c_long; 0],
+        size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
+    }
+
+    pub struct pthread_mutexattr_t {
+        __align: [::c_int; 0],
+        size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
+    }
+
+    pub struct pthread_rwlockattr_t {
+        __align: [::c_int; 0],
+        size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
+    }
+
+    pub struct pthread_cond_t {
+        __align: [*const ::c_void; 0],
+        size: [u8; __SIZEOF_PTHREAD_COND_T],
+    }
+
+    pub struct pthread_condattr_t {
+        __align: [::c_int; 0],
+        size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
+    }
+
+    pub struct passwd {
+        pub pw_name: *mut ::c_char,
+        pub pw_passwd: *mut ::c_char,
+        pub pw_uid: ::uid_t,
+        pub pw_gid: ::gid_t,
+        pub pw_gecos: *mut ::c_char,
+        pub pw_dir: *mut ::c_char,
+        pub pw_shell: *mut ::c_char,
+    }
+
+    pub struct spwd {
+        pub sp_namp: *mut ::c_char,
+        pub sp_pwdp: *mut ::c_char,
+        pub sp_lstchg: ::c_long,
+        pub sp_min: ::c_long,
+        pub sp_max: ::c_long,
+        pub sp_warn: ::c_long,
+        pub sp_inact: ::c_long,
+        pub sp_expire: ::c_long,
+        pub sp_flag: ::c_ulong,
+    }
+
+    pub struct statvfs {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_files: ::fsfilcnt_t,
+        pub f_ffree: ::fsfilcnt_t,
+        pub f_favail: ::fsfilcnt_t,
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
+    pub struct dqblk {
+        pub dqb_bhardlimit: ::uint64_t,
+        pub dqb_bsoftlimit: ::uint64_t,
+        pub dqb_curspace: ::uint64_t,
+        pub dqb_ihardlimit: ::uint64_t,
+        pub dqb_isoftlimit: ::uint64_t,
+        pub dqb_curinodes: ::uint64_t,
+        pub dqb_btime: ::uint64_t,
+        pub dqb_itime: ::uint64_t,
+        pub dqb_valid: ::uint32_t,
+    }
+
+    pub struct signalfd_siginfo {
+        pub ssi_signo: ::uint32_t,
+        pub ssi_errno: ::int32_t,
+        pub ssi_code: ::int32_t,
+        pub ssi_pid: ::uint32_t,
+        pub ssi_uid: ::uint32_t,
+        pub ssi_fd: ::int32_t,
+        pub ssi_tid: ::uint32_t,
+        pub ssi_band: ::uint32_t,
+        pub ssi_overrun: ::uint32_t,
+        pub ssi_trapno: ::uint32_t,
+        pub ssi_status: ::int32_t,
+        pub ssi_int: ::int32_t,
+        pub ssi_ptr: ::uint64_t,
+        pub ssi_utime: ::uint64_t,
+        pub ssi_stime: ::uint64_t,
+        pub ssi_addr: ::uint64_t,
+        _pad: [::uint8_t; 48],
+    }
+
+    pub struct fsid_t {
+        __val: [::c_int; 2],
+    }
+
+    pub struct mq_attr {
+        pub mq_flags: ::c_long,
+        pub mq_maxmsg: ::c_long,
+        pub mq_msgsize: ::c_long,
+        pub mq_curmsgs: ::c_long,
+        pad: [::c_long; 4]
+    }
+
+    pub struct cpu_set_t {
+        bits: [u32; 32],
+    }
+
+    pub struct if_nameindex {
+        pub if_index: ::c_uint,
+        pub if_name: *mut ::c_char,
+    }
+
+    // System V IPC
+    pub struct msginfo {
+        pub msgpool: ::c_int,
+        pub msgmap: ::c_int,
+        pub msgmax: ::c_int,
+        pub msgmnb: ::c_int,
+        pub msgmni: ::c_int,
+        pub msgssz: ::c_int,
+        pub msgtql: ::c_int,
+        pub msgseg: ::c_ushort,
+    }
+
+    pub struct mmsghdr {
+        pub msg_hdr: ::msghdr,
+        pub msg_len: ::c_uint,
+    }
+
+    pub struct sembuf {
+        pub sem_num: ::c_ushort,
+        pub sem_op: ::c_short,
+        pub sem_flg: ::c_short,
+    }
+
+    pub struct aiocb {
+        pub aio_fildes: ::c_int,
+        pub aio_lio_opcode: ::c_int,
+        pub aio_reqprio: ::c_int,
+        pub aio_buf: *mut ::c_void,
+        pub aio_nbytes: ::size_t,
+        pub aio_sigevent: ::sigevent,
+        __td: *mut ::c_void,
+        __lock: [::c_int; 2],
+        __err: ::c_int,
+        __ret: ::ssize_t,
+        pub aio_offset: off_t,
+        __next: *mut ::c_void,
+        __prev: *mut ::c_void,
+        __dummy4: [::c_char; 24],
+    }
+
+    pub struct sigaction {
+        pub sa_sigaction: ::sighandler_t,
+        pub sa_mask: ::sigset_t,
+        pub sa_flags: ::c_int,
+        pub sa_restorer: ::dox::Option<extern fn()>,
+    }
+
+    pub struct ipc_perm {
+        pub __ipc_perm_key: ::key_t,
+        pub uid: ::uid_t,
+        pub gid: ::gid_t,
+        pub cuid: ::uid_t,
+        pub cgid: ::gid_t,
+        pub mode: ::mode_t,
+        pub __seq: ::c_int,
+        __unused1: ::c_long,
+        __unused2: ::c_long
+    }
+
+    pub struct termios {
+        pub c_iflag: ::tcflag_t,
+        pub c_oflag: ::tcflag_t,
+        pub c_cflag: ::tcflag_t,
+        pub c_lflag: ::tcflag_t,
+        pub c_line: ::cc_t,
+        pub c_cc: [::cc_t; ::NCCS],
+        pub __c_ispeed: ::speed_t,
+        pub __c_ospeed: ::speed_t,
+    }
+
+    pub struct flock {
+        pub l_type: ::c_short,
+        pub l_whence: ::c_short,
+        pub l_start: ::off_t,
+        pub l_len: ::off_t,
+        pub l_pid: ::pid_t,
+    }
+
+    pub struct sysinfo {
+        pub uptime: ::c_ulong,
+        pub loads: [::c_ulong; 3],
+        pub totalram: ::c_ulong,
+        pub freeram: ::c_ulong,
+        pub sharedram: ::c_ulong,
+        pub bufferram: ::c_ulong,
+        pub totalswap: ::c_ulong,
+        pub freeswap: ::c_ulong,
+        pub procs: ::c_ushort,
+        pub pad: ::c_ushort,
+        pub totalhigh: ::c_ulong,
+        pub freehigh: ::c_ulong,
+        pub mem_unit: ::c_uint,
+        pub __reserved: [::c_char; 256],
+    }
+
+    pub struct pthread_attr_t {
+        __size: [u32; 11]
+    }
+
+    pub struct sigset_t {
+        __val: [::c_ulong; 32],
+    }
+
+    pub struct msghdr {
+        pub msg_name: *mut ::c_void,
+        pub msg_namelen: ::socklen_t,
+        pub msg_iov: *mut ::iovec,
+        pub msg_iovlen: ::c_int,
+        pub msg_control: *mut ::c_void,
+        pub msg_controllen: ::socklen_t,
+        pub msg_flags: ::c_int,
+    }
+
+    pub struct cmsghdr {
+        pub cmsg_len: ::socklen_t,
+        pub cmsg_level: ::c_int,
+        pub cmsg_type: ::c_int,
+    }
+
+    pub struct sem_t {
+        __val: [::c_int; 4],
+    }
+    pub struct stat {
+        pub st_dev: ::dev_t,
+        __st_dev_padding: ::c_int,
+        __st_ino_truncated: ::c_long,
+        pub st_mode: ::mode_t,
+        pub st_nlink: ::nlink_t,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
+        pub st_rdev: ::dev_t,
+        __st_rdev_padding: ::c_int,
+        pub st_size: ::off_t,
+        pub st_blksize: ::blksize_t,
+        pub st_blocks: ::blkcnt_t,
+        pub st_atime: ::time_t,
+        pub st_atime_nsec: ::c_long,
+        pub st_mtime: ::time_t,
+        pub st_mtime_nsec: ::c_long,
+        pub st_ctime: ::time_t,
+        pub st_ctime_nsec: ::c_long,
+        pub st_ino: ::ino_t,
+    }
+
+    pub struct stat64 {
+        pub st_dev: ::dev_t,
+        __st_dev_padding: ::c_int,
+        __st_ino_truncated: ::c_long,
+        pub st_mode: ::mode_t,
+        pub st_nlink: ::nlink_t,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
+        pub st_rdev: ::dev_t,
+        __st_rdev_padding: ::c_int,
+        pub st_size: ::off_t,
+        pub st_blksize: ::blksize_t,
+        pub st_blocks: ::blkcnt_t,
+        pub st_atime: ::time_t,
+        pub st_atime_nsec: ::c_long,
+        pub st_mtime: ::time_t,
+        pub st_mtime_nsec: ::c_long,
+        pub st_ctime: ::time_t,
+        pub st_ctime_nsec: ::c_long,
+        pub st_ino: ::ino_t,
+    }
+
+    pub struct stack_t {
+        pub ss_sp: *mut ::c_void,
+        pub ss_flags: ::c_int,
+        pub ss_size: ::size_t
+    }
+
+    pub struct shmid_ds {
+        pub shm_perm: ::ipc_perm,
+        pub shm_segsz: ::size_t,
+        pub shm_atime: ::time_t,
+        __unused1: ::c_int,
+        pub shm_dtime: ::time_t,
+        __unused2: ::c_int,
+        pub shm_ctime: ::time_t,
+        __unused3: ::c_int,
+        pub shm_cpid: ::pid_t,
+        pub shm_lpid: ::pid_t,
+        pub shm_nattch: ::c_ulong,
+        __pad1: ::c_ulong,
+        __pad2: ::c_ulong,
+    }
+
+    pub struct msqid_ds {
+        pub msg_perm: ::ipc_perm,
+        pub msg_stime: ::time_t,
+        __unused1: ::c_int,
+        pub msg_rtime: ::time_t,
+        __unused2: ::c_int,
+        pub msg_ctime: ::time_t,
+        __unused3: ::c_int,
+        __msg_cbytes: ::c_ulong,
+        pub msg_qnum: ::msgqnum_t,
+        pub msg_qbytes: ::msglen_t,
+        pub msg_lspid: ::pid_t,
+        pub msg_lrpid: ::pid_t,
+        __pad1: ::c_ulong,
+        __pad2: ::c_ulong,
+    }
+
+    pub struct statfs {
+        pub f_type: ::c_ulong,
+        pub f_bsize: ::c_ulong,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_files: ::fsfilcnt_t,
+        pub f_ffree: ::fsfilcnt_t,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_flags: ::c_ulong,
+        pub f_spare: [::c_ulong; 4],
+    }
+
+    pub struct siginfo_t {
+        pub si_signo: ::c_int,
+        pub si_errno: ::c_int,
+        pub si_code: ::c_int,
+        pub _pad: [::c_int; 29],
+        _align: [usize; 0],
+    }
+
+    pub struct statfs64 {
+        pub f_type: ::c_ulong,
+        pub f_bsize: ::c_ulong,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_files: ::fsfilcnt_t,
+        pub f_ffree: ::fsfilcnt_t,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_flags: ::c_ulong,
+        pub f_spare: [::c_ulong; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u32,
+        pub f_bfree: u32,
+        pub f_bavail: u32,
+        pub f_files: u32,
+        pub f_ffree: u32,
+        pub f_favail: u32,
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+}
+
+pub const ABDAY_1: ::nl_item = 0x20000;
+pub const ABDAY_2: ::nl_item = 0x20001;
+pub const ABDAY_3: ::nl_item = 0x20002;
+pub const ABDAY_4: ::nl_item = 0x20003;
+pub const ABDAY_5: ::nl_item = 0x20004;
+pub const ABDAY_6: ::nl_item = 0x20005;
+pub const ABDAY_7: ::nl_item = 0x20006;
+
+pub const DAY_1: ::nl_item = 0x20007;
+pub const DAY_2: ::nl_item = 0x20008;
+pub const DAY_3: ::nl_item = 0x20009;
+pub const DAY_4: ::nl_item = 0x2000A;
+pub const DAY_5: ::nl_item = 0x2000B;
+pub const DAY_6: ::nl_item = 0x2000C;
+pub const DAY_7: ::nl_item = 0x2000D;
+
+pub const ABMON_1: ::nl_item = 0x2000E;
+pub const ABMON_2: ::nl_item = 0x2000F;
+pub const ABMON_3: ::nl_item = 0x20010;
+pub const ABMON_4: ::nl_item = 0x20011;
+pub const ABMON_5: ::nl_item = 0x20012;
+pub const ABMON_6: ::nl_item = 0x20013;
+pub const ABMON_7: ::nl_item = 0x20014;
+pub const ABMON_8: ::nl_item = 0x20015;
+pub const ABMON_9: ::nl_item = 0x20016;
+pub const ABMON_10: ::nl_item = 0x20017;
+pub const ABMON_11: ::nl_item = 0x20018;
+pub const ABMON_12: ::nl_item = 0x20019;
+
+pub const MON_1: ::nl_item = 0x2001A;
+pub const MON_2: ::nl_item = 0x2001B;
+pub const MON_3: ::nl_item = 0x2001C;
+pub const MON_4: ::nl_item = 0x2001D;
+pub const MON_5: ::nl_item = 0x2001E;
+pub const MON_6: ::nl_item = 0x2001F;
+pub const MON_7: ::nl_item = 0x20020;
+pub const MON_8: ::nl_item = 0x20021;
+pub const MON_9: ::nl_item = 0x20022;
+pub const MON_10: ::nl_item = 0x20023;
+pub const MON_11: ::nl_item = 0x20024;
+pub const MON_12: ::nl_item = 0x20025;
+
+pub const AM_STR: ::nl_item = 0x20026;
+pub const PM_STR: ::nl_item = 0x20027;
+
+pub const D_T_FMT: ::nl_item = 0x20028;
+pub const D_FMT: ::nl_item = 0x20029;
+pub const T_FMT: ::nl_item = 0x2002A;
+pub const T_FMT_AMPM: ::nl_item = 0x2002B;
+
+pub const ERA: ::nl_item = 0x2002C;
+pub const ERA_D_FMT: ::nl_item = 0x2002E;
+pub const ALT_DIGITS: ::nl_item = 0x2002F;
+pub const ERA_D_T_FMT: ::nl_item = 0x20030;
+pub const ERA_T_FMT: ::nl_item = 0x20031;
+
+pub const CODESET: ::nl_item = 14;
+
+pub const CRNCYSTR: ::nl_item = 0x4000F;
+
+pub const RUSAGE_THREAD: ::c_int = 1;
+pub const RUSAGE_CHILDREN: ::c_int = -1;
+
+pub const RADIXCHAR: ::nl_item = 0x10000;
+pub const THOUSEP: ::nl_item = 0x10001;
+
+pub const YESEXPR: ::nl_item = 0x50000;
+pub const NOEXPR: ::nl_item = 0x50001;
+pub const YESSTR: ::nl_item = 0x50002;
+pub const NOSTR: ::nl_item = 0x50003;
+
+pub const FILENAME_MAX: ::c_uint = 4096;
+pub const L_tmpnam: ::c_uint = 20;
+pub const _PC_LINK_MAX: ::c_int = 0;
+pub const _PC_MAX_CANON: ::c_int = 1;
+pub const _PC_MAX_INPUT: ::c_int = 2;
+pub const _PC_NAME_MAX: ::c_int = 3;
+pub const _PC_PATH_MAX: ::c_int = 4;
+pub const _PC_PIPE_BUF: ::c_int = 5;
+pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
+pub const _PC_NO_TRUNC: ::c_int = 7;
+pub const _PC_VDISABLE: ::c_int = 8;
+pub const _PC_SYNC_IO: ::c_int = 9;
+pub const _PC_ASYNC_IO: ::c_int = 10;
+pub const _PC_PRIO_IO: ::c_int = 11;
+pub const _PC_SOCK_MAXBUF: ::c_int = 12;
+pub const _PC_FILESIZEBITS: ::c_int = 13;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18;
+pub const _PC_SYMLINK_MAX: ::c_int = 19;
+pub const _PC_2_SYMLINKS: ::c_int = 20;
+
+pub const _SC_ARG_MAX: ::c_int = 0;
+pub const _SC_CHILD_MAX: ::c_int = 1;
+pub const _SC_CLK_TCK: ::c_int = 2;
+pub const _SC_NGROUPS_MAX: ::c_int = 3;
+pub const _SC_OPEN_MAX: ::c_int = 4;
+pub const _SC_STREAM_MAX: ::c_int = 5;
+pub const _SC_TZNAME_MAX: ::c_int = 6;
+pub const _SC_JOB_CONTROL: ::c_int = 7;
+pub const _SC_SAVED_IDS: ::c_int = 8;
+pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
+pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
+pub const _SC_TIMERS: ::c_int = 11;
+pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
+pub const _SC_PRIORITIZED_IO: ::c_int = 13;
+pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
+pub const _SC_FSYNC: ::c_int = 15;
+pub const _SC_MAPPED_FILES: ::c_int = 16;
+pub const _SC_MEMLOCK: ::c_int = 17;
+pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
+pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
+pub const _SC_MESSAGE_PASSING: ::c_int = 20;
+pub const _SC_SEMAPHORES: ::c_int = 21;
+pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
+pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
+pub const _SC_AIO_MAX: ::c_int = 24;
+pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
+pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
+pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
+pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
+pub const _SC_VERSION: ::c_int = 29;
+pub const _SC_PAGESIZE: ::c_int = 30;
+pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
+pub const _SC_RTSIG_MAX: ::c_int = 31;
+pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
+pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
+pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
+pub const _SC_TIMER_MAX: ::c_int = 35;
+pub const _SC_BC_BASE_MAX: ::c_int = 36;
+pub const _SC_BC_DIM_MAX: ::c_int = 37;
+pub const _SC_BC_SCALE_MAX: ::c_int = 38;
+pub const _SC_BC_STRING_MAX: ::c_int = 39;
+pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
+pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
+pub const _SC_LINE_MAX: ::c_int = 43;
+pub const _SC_RE_DUP_MAX: ::c_int = 44;
+pub const _SC_2_VERSION: ::c_int = 46;
+pub const _SC_2_C_BIND: ::c_int = 47;
+pub const _SC_2_C_DEV: ::c_int = 48;
+pub const _SC_2_FORT_DEV: ::c_int = 49;
+pub const _SC_2_FORT_RUN: ::c_int = 50;
+pub const _SC_2_SW_DEV: ::c_int = 51;
+pub const _SC_2_LOCALEDEF: ::c_int = 52;
+pub const _SC_UIO_MAXIOV: ::c_int = 60;
+pub const _SC_IOV_MAX: ::c_int = 60;
+pub const _SC_THREADS: ::c_int = 67;
+pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
+pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
+pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
+pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
+pub const _SC_TTY_NAME_MAX: ::c_int = 72;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
+pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
+pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
+pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
+pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
+pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
+pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
+pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
+pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 83;
+pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
+pub const _SC_PHYS_PAGES: ::c_int = 85;
+pub const _SC_AVPHYS_PAGES: ::c_int = 86;
+pub const _SC_ATEXIT_MAX: ::c_int = 87;
+pub const _SC_PASS_MAX: ::c_int = 88;
+pub const _SC_XOPEN_VERSION: ::c_int = 89;
+pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
+pub const _SC_XOPEN_UNIX: ::c_int = 91;
+pub const _SC_XOPEN_CRYPT: ::c_int = 92;
+pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
+pub const _SC_XOPEN_SHM: ::c_int = 94;
+pub const _SC_2_CHAR_TERM: ::c_int = 95;
+pub const _SC_2_UPE: ::c_int = 97;
+pub const _SC_XOPEN_XPG2: ::c_int = 98;
+pub const _SC_XOPEN_XPG3: ::c_int = 99;
+pub const _SC_XOPEN_XPG4: ::c_int = 100;
+pub const _SC_NZERO: ::c_int = 109;
+pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
+pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
+pub const _SC_XBS5_LP64_OFF64: ::c_int = 127;
+pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
+pub const _SC_XOPEN_LEGACY: ::c_int = 129;
+pub const _SC_XOPEN_REALTIME: ::c_int = 130;
+pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
+pub const _SC_ADVISORY_INFO: ::c_int = 132;
+pub const _SC_BARRIERS: ::c_int = 133;
+pub const _SC_CLOCK_SELECTION: ::c_int = 137;
+pub const _SC_CPUTIME: ::c_int = 138;
+pub const _SC_THREAD_CPUTIME: ::c_int = 139;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 149;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 153;
+pub const _SC_SPIN_LOCKS: ::c_int = 154;
+pub const _SC_REGEXP: ::c_int = 155;
+pub const _SC_SHELL: ::c_int = 157;
+pub const _SC_SPAWN: ::c_int = 159;
+pub const _SC_SPORADIC_SERVER: ::c_int = 160;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161;
+pub const _SC_TIMEOUTS: ::c_int = 164;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
+pub const _SC_2_PBS: ::c_int = 168;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169;
+pub const _SC_2_PBS_LOCATE: ::c_int = 170;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 171;
+pub const _SC_2_PBS_TRACK: ::c_int = 172;
+pub const _SC_SYMLOOP_MAX: ::c_int = 173;
+pub const _SC_STREAMS: ::c_int = 174;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 176;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177;
+pub const _SC_V6_LP64_OFF64: ::c_int = 178;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179;
+pub const _SC_HOST_NAME_MAX: ::c_int = 180;
+pub const _SC_TRACE: ::c_int = 181;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182;
+pub const _SC_TRACE_INHERIT: ::c_int = 183;
+pub const _SC_TRACE_LOG: ::c_int = 184;
+pub const _SC_IPV6: ::c_int = 235;
+pub const _SC_RAW_SOCKETS: ::c_int = 236;
+pub const _SC_V7_ILP32_OFF32: ::c_int = 237;
+pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238;
+pub const _SC_V7_LP64_OFF64: ::c_int = 239;
+pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240;
+pub const _SC_SS_REPL_MAX: ::c_int = 241;
+pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242;
+pub const _SC_TRACE_NAME_MAX: ::c_int = 243;
+pub const _SC_TRACE_SYS_MAX: ::c_int = 244;
+pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245;
+pub const _SC_XOPEN_STREAMS: ::c_int = 246;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
+
+pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
+pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
+
+pub const GLOB_ERR: ::c_int = 1 << 0;
+pub const GLOB_MARK: ::c_int = 1 << 1;
+pub const GLOB_NOSORT: ::c_int = 1 << 2;
+pub const GLOB_DOOFFS: ::c_int = 1 << 3;
+pub const GLOB_NOCHECK: ::c_int = 1 << 4;
+pub const GLOB_APPEND: ::c_int = 1 << 5;
+pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
+
+pub const GLOB_NOSPACE: ::c_int = 1;
+pub const GLOB_ABORTED: ::c_int = 2;
+pub const GLOB_NOMATCH: ::c_int = 3;
+
+pub const POSIX_MADV_NORMAL: ::c_int = 0;
+pub const POSIX_MADV_RANDOM: ::c_int = 1;
+pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
+pub const POSIX_MADV_WILLNEED: ::c_int = 3;
+
+pub const S_IEXEC: mode_t = 64;
+pub const S_IWRITE: mode_t = 128;
+pub const S_IREAD: mode_t = 256;
+
+pub const F_LOCK: ::c_int = 1;
+pub const F_TEST: ::c_int = 3;
+pub const F_TLOCK: ::c_int = 2;
+pub const F_ULOCK: ::c_int = 0;
+
+pub const ST_RDONLY: ::c_ulong = 1;
+pub const ST_NOSUID: ::c_ulong = 2;
+pub const ST_NODEV: ::c_ulong = 4;
+pub const ST_NOEXEC: ::c_ulong = 8;
+pub const ST_SYNCHRONOUS: ::c_ulong = 16;
+pub const ST_MANDLOCK: ::c_ulong = 64;
+pub const ST_WRITE: ::c_ulong = 128;
+pub const ST_APPEND: ::c_ulong = 256;
+pub const ST_IMMUTABLE: ::c_ulong = 512;
+pub const ST_NOATIME: ::c_ulong = 1024;
+pub const ST_NODIRATIME: ::c_ulong = 2048;
+
+pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
+pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
+pub const RTLD_NODELETE: ::c_int = 0x1000;
+pub const RTLD_NOW: ::c_int = 0x2;
+
+pub const TCP_MD5SIG: ::c_int = 14;
+
+pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+    __align: [],
+    size: [0; __SIZEOF_PTHREAD_MUTEX_T],
+};
+pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+    __align: [],
+    size: [0; __SIZEOF_PTHREAD_COND_T],
+};
+pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+    __align: [],
+    size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
+};
+pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
+pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
+pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
+pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
+pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
+
+pub const SCHED_OTHER: ::c_int = 0;
+pub const SCHED_FIFO: ::c_int = 1;
+pub const SCHED_RR: ::c_int = 2;
+pub const SCHED_BATCH: ::c_int = 3;
+pub const SCHED_IDLE: ::c_int = 5;
+
+pub const AF_IB: ::c_int = 27;
+pub const AF_MPLS: ::c_int = 28;
+pub const AF_NFC: ::c_int = 39;
+pub const AF_VSOCK: ::c_int = 40;
+#[doc(hidden)]
+pub const AF_MAX: ::c_int = 42;
+pub const PF_IB: ::c_int = AF_IB;
+pub const PF_MPLS: ::c_int = AF_MPLS;
+pub const PF_NFC: ::c_int = AF_NFC;
+pub const PF_VSOCK: ::c_int = AF_VSOCK;
+#[doc(hidden)]
+pub const PF_MAX: ::c_int = AF_MAX;
+
+// System V IPC
+pub const IPC_PRIVATE: ::key_t = 0;
+
+pub const IPC_CREAT: ::c_int = 0o1000;
+pub const IPC_EXCL: ::c_int = 0o2000;
+pub const IPC_NOWAIT: ::c_int = 0o4000;
+
+pub const IPC_RMID: ::c_int = 0;
+pub const IPC_SET: ::c_int = 1;
+pub const IPC_STAT: ::c_int = 2;
+pub const IPC_INFO: ::c_int = 3;
+pub const MSG_STAT: ::c_int = 11;
+pub const MSG_INFO: ::c_int = 12;
+
+pub const MSG_NOERROR: ::c_int = 0o10000;
+pub const MSG_EXCEPT: ::c_int = 0o20000;
+pub const MSG_COPY: ::c_int = 0o40000;
+
+pub const SHM_R: ::c_int = 0o400;
+pub const SHM_W: ::c_int = 0o200;
+
+pub const SHM_RDONLY: ::c_int = 0o10000;
+pub const SHM_RND: ::c_int = 0o20000;
+pub const SHM_REMAP: ::c_int = 0o40000;
+pub const SHM_EXEC: ::c_int = 0o100000;
+
+pub const SHM_LOCK: ::c_int = 11;
+pub const SHM_UNLOCK: ::c_int = 12;
+
+pub const SHM_HUGETLB: ::c_int = 0o4000;
+pub const SHM_NORESERVE: ::c_int = 0o10000;
+
+pub const EPOLLRDHUP: ::c_int = 0x2000;
+pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
+pub const EPOLLONESHOT: ::c_int = 0x40000000;
+
+pub const QFMT_VFS_OLD: ::c_int = 1;
+pub const QFMT_VFS_V0: ::c_int = 2;
+
+pub const EFD_SEMAPHORE: ::c_int = 0x1;
+
+pub const LOG_NFACILITIES: ::c_int = 24;
+
+pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
+
+pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
+pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
+pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
+pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
+pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
+pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
+pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
+
+pub const AI_PASSIVE: ::c_int = 0x0001;
+pub const AI_CANONNAME: ::c_int = 0x0002;
+pub const AI_NUMERICHOST: ::c_int = 0x0004;
+pub const AI_V4MAPPED: ::c_int = 0x0008;
+pub const AI_ALL: ::c_int = 0x0010;
+pub const AI_ADDRCONFIG: ::c_int = 0x0020;
+
+pub const AI_NUMERICSERV: ::c_int = 0x0400;
+
+pub const EAI_BADFLAGS: ::c_int = -1;
+pub const EAI_NONAME: ::c_int = -2;
+pub const EAI_AGAIN: ::c_int = -3;
+pub const EAI_FAIL: ::c_int = -4;
+pub const EAI_FAMILY: ::c_int = -6;
+pub const EAI_SOCKTYPE: ::c_int = -7;
+pub const EAI_SERVICE: ::c_int = -8;
+pub const EAI_MEMORY: ::c_int = -10;
+pub const EAI_OVERFLOW: ::c_int = -12;
+
+pub const NI_NUMERICHOST: ::c_int = 1;
+pub const NI_NUMERICSERV: ::c_int = 2;
+pub const NI_NOFQDN: ::c_int = 4;
+pub const NI_NAMEREQD: ::c_int = 8;
+pub const NI_DGRAM: ::c_int = 16;
+
+pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
+pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
+pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
+
+pub const EAI_SYSTEM: ::c_int = -11;
+
+pub const AIO_CANCELED: ::c_int = 0;
+pub const AIO_NOTCANCELED: ::c_int = 1;
+pub const AIO_ALLDONE: ::c_int = 2;
+pub const LIO_READ: ::c_int = 0;
+pub const LIO_WRITE: ::c_int = 1;
+pub const LIO_NOP: ::c_int = 2;
+pub const LIO_WAIT: ::c_int = 0;
+pub const LIO_NOWAIT: ::c_int = 1;
+
+pub const MREMAP_MAYMOVE: ::c_int = 1;
+pub const MREMAP_FIXED: ::c_int = 2;
+
+pub const PR_SET_PDEATHSIG: ::c_int = 1;
+pub const PR_GET_PDEATHSIG: ::c_int = 2;
+
+pub const PR_GET_DUMPABLE: ::c_int = 3;
+pub const PR_SET_DUMPABLE: ::c_int = 4;
+
+pub const PR_GET_UNALIGN: ::c_int = 5;
+pub const PR_SET_UNALIGN: ::c_int = 6;
+pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
+pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
+
+pub const PR_GET_KEEPCAPS: ::c_int = 7;
+pub const PR_SET_KEEPCAPS: ::c_int = 8;
+
+pub const PR_GET_FPEMU: ::c_int = 9;
+pub const PR_SET_FPEMU: ::c_int = 10;
+pub const PR_FPEMU_NOPRINT: ::c_int = 1;
+pub const PR_FPEMU_SIGFPE: ::c_int = 2;
+
+pub const PR_GET_FPEXC: ::c_int = 11;
+pub const PR_SET_FPEXC: ::c_int = 12;
+pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
+pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
+pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
+pub const PR_FP_EXC_UND: ::c_int = 0x040000;
+pub const PR_FP_EXC_RES: ::c_int = 0x080000;
+pub const PR_FP_EXC_INV: ::c_int = 0x100000;
+pub const PR_FP_EXC_DISABLED: ::c_int = 0;
+pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
+pub const PR_FP_EXC_ASYNC: ::c_int = 2;
+pub const PR_FP_EXC_PRECISE: ::c_int = 3;
+
+pub const PR_GET_TIMING: ::c_int = 13;
+pub const PR_SET_TIMING: ::c_int = 14;
+pub const PR_TIMING_STATISTICAL: ::c_int = 0;
+pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
+
+pub const PR_SET_NAME: ::c_int = 15;
+pub const PR_GET_NAME: ::c_int = 16;
+
+pub const PR_GET_ENDIAN: ::c_int = 19;
+pub const PR_SET_ENDIAN: ::c_int = 20;
+pub const PR_ENDIAN_BIG: ::c_int = 0;
+pub const PR_ENDIAN_LITTLE: ::c_int = 1;
+pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
+
+pub const PR_GET_SECCOMP: ::c_int = 21;
+pub const PR_SET_SECCOMP: ::c_int = 22;
+
+pub const PR_CAPBSET_READ: ::c_int = 23;
+pub const PR_CAPBSET_DROP: ::c_int = 24;
+
+pub const PR_GET_TSC: ::c_int = 25;
+pub const PR_SET_TSC: ::c_int = 26;
+pub const PR_TSC_ENABLE: ::c_int = 1;
+pub const PR_TSC_SIGSEGV: ::c_int = 2;
+
+pub const PR_GET_SECUREBITS: ::c_int = 27;
+pub const PR_SET_SECUREBITS: ::c_int = 28;
+
+pub const PR_SET_TIMERSLACK: ::c_int = 29;
+pub const PR_GET_TIMERSLACK: ::c_int = 30;
+
+pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
+pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
+
+pub const PR_MCE_KILL: ::c_int = 33;
+pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
+pub const PR_MCE_KILL_SET: ::c_int = 1;
+
+pub const PR_MCE_KILL_LATE: ::c_int = 0;
+pub const PR_MCE_KILL_EARLY: ::c_int = 1;
+pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
+
+pub const PR_MCE_KILL_GET: ::c_int = 34;
+
+pub const PR_SET_MM: ::c_int = 35;
+pub const PR_SET_MM_START_CODE: ::c_int = 1;
+pub const PR_SET_MM_END_CODE: ::c_int = 2;
+pub const PR_SET_MM_START_DATA: ::c_int = 3;
+pub const PR_SET_MM_END_DATA: ::c_int = 4;
+pub const PR_SET_MM_START_STACK: ::c_int = 5;
+pub const PR_SET_MM_START_BRK: ::c_int = 6;
+pub const PR_SET_MM_BRK: ::c_int = 7;
+pub const PR_SET_MM_ARG_START: ::c_int = 8;
+pub const PR_SET_MM_ARG_END: ::c_int = 9;
+pub const PR_SET_MM_ENV_START: ::c_int = 10;
+pub const PR_SET_MM_ENV_END: ::c_int = 11;
+pub const PR_SET_MM_AUXV: ::c_int = 12;
+pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
+pub const PR_SET_MM_MAP: ::c_int = 14;
+pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
+
+pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
+
+pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
+pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
+
+pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
+pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
+
+pub const PR_GET_TID_ADDRESS: ::c_int = 40;
+
+pub const PR_SET_THP_DISABLE: ::c_int = 41;
+pub const PR_GET_THP_DISABLE: ::c_int = 42;
+
+pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43;
+pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44;
+
+pub const PR_SET_FP_MODE: ::c_int = 45;
+pub const PR_GET_FP_MODE: ::c_int = 46;
+pub const PR_FP_MODE_FR: ::c_int = 1 << 0;
+pub const PR_FP_MODE_FRE: ::c_int = 1 << 1;
+
+pub const PR_CAP_AMBIENT: ::c_int = 47;
+pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1;
+pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
+pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
+pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
+
+pub const ITIMER_REAL: ::c_int = 0;
+pub const ITIMER_VIRTUAL: ::c_int = 1;
+pub const ITIMER_PROF: ::c_int = 2;
+
+pub const XATTR_CREATE: ::c_int = 0x1;
+pub const XATTR_REPLACE: ::c_int = 0x2;
+
+pub const _POSIX_VDISABLE: ::cc_t = 0;
+
+pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
+pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
+pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08;
+pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
+pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
+pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
+
+// On Linux, libc doesn't define this constant, libattr does instead.
+// We still define it for Linux as it's defined by libc on other platforms,
+// and it's mentioned in the man pages for getxattr and setxattr.
+pub const SFD_CLOEXEC: ::c_int = 0x080000;
+
+pub const NCCS: usize = 32;
+
+pub const O_TRUNC: ::c_int = 512;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_CLOEXEC: ::c_int = 0x80000;
+
+pub const EBFONT: ::c_int = 59;
+pub const ENOSTR: ::c_int = 60;
+pub const ENODATA: ::c_int = 61;
+pub const ETIME: ::c_int = 62;
+pub const ENOSR: ::c_int = 63;
+pub const ENONET: ::c_int = 64;
+pub const ENOPKG: ::c_int = 65;
+pub const EREMOTE: ::c_int = 66;
+pub const ENOLINK: ::c_int = 67;
+pub const EADV: ::c_int = 68;
+pub const ESRMNT: ::c_int = 69;
+pub const ECOMM: ::c_int = 70;
+pub const EPROTO: ::c_int = 71;
+pub const EDOTDOT: ::c_int = 73;
+
+pub const SA_NODEFER: ::c_int = 0x40000000;
+pub const SA_RESETHAND: ::c_int = 0x80000000;
+pub const SA_RESTART: ::c_int = 0x10000000;
+pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
+
+pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
+
+pub const EFD_CLOEXEC: ::c_int = 0x80000;
+
+pub const BUFSIZ: ::c_uint = 1024;
+pub const TMP_MAX: ::c_uint = 10000;
+pub const FOPEN_MAX: ::c_uint = 1000;
+pub const O_PATH: ::c_int = 0o10000000;
+pub const O_EXEC: ::c_int = 0o10000000;
+pub const O_SEARCH: ::c_int = 0o10000000;
+pub const O_ACCMODE: ::c_int = 0o10000003;
+pub const O_NDELAY: ::c_int = O_NONBLOCK;
+pub const NI_MAXHOST: ::socklen_t = 255;
+pub const PTHREAD_STACK_MIN: ::size_t = 2048;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
+
+pub const POSIX_MADV_DONTNEED: ::c_int = 0;
+
+pub const RLIM_INFINITY: ::rlim_t = !0;
+pub const RLIMIT_RTTIME: ::c_int = 15;
+pub const RLIMIT_NLIMITS: ::c_int = 16;
+
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
+
+pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
+pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
+pub const TCP_THIN_DUPACK: ::c_int = 17;
+pub const TCP_USER_TIMEOUT: ::c_int = 18;
+pub const TCP_REPAIR: ::c_int = 19;
+pub const TCP_REPAIR_QUEUE: ::c_int = 20;
+pub const TCP_QUEUE_SEQ: ::c_int = 21;
+pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
+pub const TCP_FASTOPEN: ::c_int = 23;
+pub const TCP_TIMESTAMP: ::c_int = 24;
+
+pub const SIGUNUSED: ::c_int = ::SIGSYS;
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+
+pub const CPU_SETSIZE: ::c_int = 128;
+
+pub const QFMT_VFS_V1: ::c_int = 4;
+
+pub const PTRACE_TRACEME: ::c_int = 0;
+pub const PTRACE_PEEKTEXT: ::c_int = 1;
+pub const PTRACE_PEEKDATA: ::c_int = 2;
+pub const PTRACE_PEEKUSER: ::c_int = 3;
+pub const PTRACE_POKETEXT: ::c_int = 4;
+pub const PTRACE_POKEDATA: ::c_int = 5;
+pub const PTRACE_POKEUSER: ::c_int = 6;
+pub const PTRACE_CONT: ::c_int = 7;
+pub const PTRACE_KILL: ::c_int = 8;
+pub const PTRACE_SINGLESTEP: ::c_int = 9;
+pub const PTRACE_ATTACH: ::c_int = 16;
+pub const PTRACE_DETACH: ::c_int = 17;
+pub const PTRACE_SYSCALL: ::c_int = 24;
+pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
+pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
+pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
+pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
+pub const PTRACE_GETREGSET: ::c_int = 0x4204;
+pub const PTRACE_SETREGSET: ::c_int = 0x4205;
+pub const PTRACE_SEIZE: ::c_int = 0x4206;
+pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
+pub const PTRACE_LISTEN: ::c_int = 0x4208;
+pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
+
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
+
+pub const PTRACE_GETFPREGS: ::c_uint = 14;
+pub const PTRACE_SETFPREGS: ::c_uint = 15;
+pub const PTRACE_GETFPXREGS: ::c_uint = 18;
+pub const PTRACE_SETFPXREGS: ::c_uint = 19;
+pub const PTRACE_GETREGS: ::c_uint = 12;
+pub const PTRACE_SETREGS: ::c_uint = 13;
+
+pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
+
+pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
+
+pub const TCSANOW: ::c_int = 0;
+pub const TCSADRAIN: ::c_int = 1;
+pub const TCSAFLUSH: ::c_int = 2;
+
+pub const TIOCINQ: ::c_int = ::FIONREAD;
+
+pub const RTLD_GLOBAL: ::c_int = 0x100;
+pub const RTLD_NOLOAD: ::c_int = 0x4;
+
+// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
+// kernel 3.10).  See also notbsd/mod.rs
+pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+pub const CLOCK_TAI: ::clockid_t = 11;
+
+pub const MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+pub const CBAUD: ::tcflag_t = 0o0010017;
+pub const TAB1: ::c_int = 0x00000800;
+pub const TAB2: ::c_int = 0x00001000;
+pub const TAB3: ::c_int = 0x00001800;
+pub const CR1: ::c_int  = 0x00000200;
+pub const CR2: ::c_int  = 0x00000400;
+pub const CR3: ::c_int  = 0x00000600;
+pub const FF1: ::c_int  = 0x00008000;
+pub const BS1: ::c_int  = 0x00002000;
+pub const VT1: ::c_int  = 0x00004000;
+pub const VWERASE: usize = 14;
+pub const VREPRINT: usize = 12;
+pub const VSUSP: usize = 10;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VDISCARD: usize = 13;
+pub const VTIME: usize = 5;
+pub const IXON: ::tcflag_t = 0x00000400;
+pub const IXOFF: ::tcflag_t = 0x00001000;
+pub const ONLCR: ::tcflag_t = 0x4;
+pub const CSIZE: ::tcflag_t = 0x00000030;
+pub const CS6: ::tcflag_t = 0x00000010;
+pub const CS7: ::tcflag_t = 0x00000020;
+pub const CS8: ::tcflag_t = 0x00000030;
+pub const CSTOPB: ::tcflag_t = 0x00000040;
+pub const CREAD: ::tcflag_t = 0x00000080;
+pub const PARENB: ::tcflag_t = 0x00000100;
+pub const PARODD: ::tcflag_t = 0x00000200;
+pub const HUPCL: ::tcflag_t = 0x00000400;
+pub const CLOCAL: ::tcflag_t = 0x00000800;
+pub const ECHOKE: ::tcflag_t = 0x00000800;
+pub const ECHOE: ::tcflag_t = 0x00000010;
+pub const ECHOK: ::tcflag_t = 0x00000020;
+pub const ECHONL: ::tcflag_t = 0x00000040;
+pub const ECHOPRT: ::tcflag_t = 0x00000400;
+pub const ECHOCTL: ::tcflag_t = 0x00000200;
+pub const ISIG: ::tcflag_t = 0x00000001;
+pub const ICANON: ::tcflag_t = 0x00000002;
+pub const PENDIN: ::tcflag_t = 0x00004000;
+pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
+
+pub const B0: ::speed_t = 0o000000;
+pub const B50: ::speed_t = 0o000001;
+pub const B75: ::speed_t = 0o000002;
+pub const B110: ::speed_t = 0o000003;
+pub const B134: ::speed_t = 0o000004;
+pub const B150: ::speed_t = 0o000005;
+pub const B200: ::speed_t = 0o000006;
+pub const B300: ::speed_t = 0o000007;
+pub const B600: ::speed_t = 0o000010;
+pub const B1200: ::speed_t = 0o000011;
+pub const B1800: ::speed_t = 0o000012;
+pub const B2400: ::speed_t = 0o000013;
+pub const B4800: ::speed_t = 0o000014;
+pub const B9600: ::speed_t = 0o000015;
+pub const B19200: ::speed_t = 0o000016;
+pub const B38400: ::speed_t = 0o000017;
+pub const B57600: ::speed_t = 0o010001;
+pub const B115200: ::speed_t = 0o010002;
+pub const B230400: ::speed_t = 0o010003;
+pub const B460800: ::speed_t = 0o010004;
+pub const B500000: ::speed_t = 0o010005;
+pub const B576000: ::speed_t = 0o010006;
+pub const B921600: ::speed_t = 0o010007;
+pub const B1000000: ::speed_t = 0o010010;
+pub const B1152000: ::speed_t = 0o010011;
+pub const B1500000: ::speed_t = 0o010012;
+pub const B2000000: ::speed_t = 0o010013;
+pub const B2500000: ::speed_t = 0o010014;
+pub const B3000000: ::speed_t = 0o010015;
+pub const B3500000: ::speed_t = 0o010016;
+pub const B4000000: ::speed_t = 0o010017;
+
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
+
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28;
+
+pub const O_DIRECT: ::c_int = 0x4000;
+pub const O_DIRECTORY: ::c_int = 0x10000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_ASYNC: ::c_int = 0x2000;
+
+pub const FIOCLEX: ::c_int = 0x5451;
+pub const FIONBIO: ::c_int = 0x5421;
+
+pub const RLIMIT_RSS: ::c_int = 5;
+pub const RLIMIT_NOFILE: ::c_int = 7;
+pub const RLIMIT_AS: ::c_int = 9;
+pub const RLIMIT_NPROC: ::c_int = 6;
+pub const RLIMIT_MEMLOCK: ::c_int = 8;
+
+pub const O_APPEND: ::c_int = 1024;
+pub const O_CREAT: ::c_int = 64;
+pub const O_EXCL: ::c_int = 128;
+pub const O_NOCTTY: ::c_int = 256;
+pub const O_NONBLOCK: ::c_int = 2048;
+pub const O_SYNC: ::c_int = 1052672;
+pub const O_RSYNC: ::c_int = 1052672;
+pub const O_DSYNC: ::c_int = 4096;
+
+pub const SOCK_NONBLOCK: ::c_int = 2048;
+
+pub const MAP_ANON: ::c_int = 0x0020;
+pub const MAP_GROWSDOWN: ::c_int = 0x0100;
+pub const MAP_DENYWRITE: ::c_int = 0x0800;
+pub const MAP_EXECUTABLE: ::c_int = 0x01000;
+pub const MAP_LOCKED: ::c_int = 0x02000;
+pub const MAP_NORESERVE: ::c_int = 0x04000;
+pub const MAP_POPULATE: ::c_int = 0x08000;
+pub const MAP_NONBLOCK: ::c_int = 0x010000;
+pub const MAP_STACK: ::c_int = 0x020000;
+
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+pub const SOCK_SEQPACKET: ::c_int = 5;
+
+pub const SOL_SOCKET: ::c_int = 1;
+
+pub const EDEADLK: ::c_int = 35;
+pub const ENAMETOOLONG: ::c_int = 36;
+pub const ENOLCK: ::c_int = 37;
+pub const ENOSYS: ::c_int = 38;
+pub const ENOTEMPTY: ::c_int = 39;
+pub const ELOOP: ::c_int = 40;
+pub const ENOMSG: ::c_int = 42;
+pub const EIDRM: ::c_int = 43;
+pub const ECHRNG: ::c_int = 44;
+pub const EL2NSYNC: ::c_int = 45;
+pub const EL3HLT: ::c_int = 46;
+pub const EL3RST: ::c_int = 47;
+pub const ELNRNG: ::c_int = 48;
+pub const EUNATCH: ::c_int = 49;
+pub const ENOCSI: ::c_int = 50;
+pub const EL2HLT: ::c_int = 51;
+pub const EBADE: ::c_int = 52;
+pub const EBADR: ::c_int = 53;
+pub const EXFULL: ::c_int = 54;
+pub const ENOANO: ::c_int = 55;
+pub const EBADRQC: ::c_int = 56;
+pub const EBADSLT: ::c_int = 57;
+pub const EDEADLOCK: ::c_int = EDEADLK;
+pub const EMULTIHOP: ::c_int = 72;
+pub const EBADMSG: ::c_int = 74;
+pub const EOVERFLOW: ::c_int = 75;
+pub const ENOTUNIQ: ::c_int = 76;
+pub const EBADFD: ::c_int = 77;
+pub const EREMCHG: ::c_int = 78;
+pub const ELIBACC: ::c_int = 79;
+pub const ELIBBAD: ::c_int = 80;
+pub const ELIBSCN: ::c_int = 81;
+pub const ELIBMAX: ::c_int = 82;
+pub const ELIBEXEC: ::c_int = 83;
+pub const EILSEQ: ::c_int = 84;
+pub const ERESTART: ::c_int = 85;
+pub const ESTRPIPE: ::c_int = 86;
+pub const EUSERS: ::c_int = 87;
+pub const ENOTSOCK: ::c_int = 88;
+pub const EDESTADDRREQ: ::c_int = 89;
+pub const EMSGSIZE: ::c_int = 90;
+pub const EPROTOTYPE: ::c_int = 91;
+pub const ENOPROTOOPT: ::c_int = 92;
+pub const EPROTONOSUPPORT: ::c_int = 93;
+pub const ESOCKTNOSUPPORT: ::c_int = 94;
+pub const EOPNOTSUPP: ::c_int = 95;
+pub const ENOTSUP: ::c_int = EOPNOTSUPP;
+pub const EPFNOSUPPORT: ::c_int = 96;
+pub const EAFNOSUPPORT: ::c_int = 97;
+pub const EADDRINUSE: ::c_int = 98;
+pub const EADDRNOTAVAIL: ::c_int = 99;
+pub const ENETDOWN: ::c_int = 100;
+pub const ENETUNREACH: ::c_int = 101;
+pub const ENETRESET: ::c_int = 102;
+pub const ECONNABORTED: ::c_int = 103;
+pub const ECONNRESET: ::c_int = 104;
+pub const ENOBUFS: ::c_int = 105;
+pub const EISCONN: ::c_int = 106;
+pub const ENOTCONN: ::c_int = 107;
+pub const ESHUTDOWN: ::c_int = 108;
+pub const ETOOMANYREFS: ::c_int = 109;
+pub const ETIMEDOUT: ::c_int = 110;
+pub const ECONNREFUSED: ::c_int = 111;
+pub const EHOSTDOWN: ::c_int = 112;
+pub const EHOSTUNREACH: ::c_int = 113;
+pub const EALREADY: ::c_int = 114;
+pub const EINPROGRESS: ::c_int = 115;
+pub const ESTALE: ::c_int = 116;
+pub const EUCLEAN: ::c_int = 117;
+pub const ENOTNAM: ::c_int = 118;
+pub const ENAVAIL: ::c_int = 119;
+pub const EISNAM: ::c_int = 120;
+pub const EREMOTEIO: ::c_int = 121;
+pub const EDQUOT: ::c_int = 122;
+pub const ENOMEDIUM: ::c_int = 123;
+pub const EMEDIUMTYPE: ::c_int = 124;
+pub const ECANCELED: ::c_int = 125;
+pub const ENOKEY: ::c_int = 126;
+pub const EKEYEXPIRED: ::c_int = 127;
+pub const EKEYREVOKED: ::c_int = 128;
+pub const EKEYREJECTED: ::c_int = 129;
+pub const EOWNERDEAD: ::c_int = 130;
+pub const ENOTRECOVERABLE: ::c_int = 131;
+pub const ERFKILL: ::c_int = 132;
+pub const EHWPOISON: ::c_int = 133;
+
+pub const SO_REUSEADDR: ::c_int = 2;
+pub const SO_TYPE: ::c_int = 3;
+pub const SO_ERROR: ::c_int = 4;
+pub const SO_DONTROUTE: ::c_int = 5;
+pub const SO_BROADCAST: ::c_int = 6;
+pub const SO_SNDBUF: ::c_int = 7;
+pub const SO_RCVBUF: ::c_int = 8;
+pub const SO_KEEPALIVE: ::c_int = 9;
+pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_LINGER: ::c_int = 13;
+pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_RCVLOWAT: ::c_int = 18;
+pub const SO_SNDLOWAT: ::c_int = 19;
+pub const SO_RCVTIMEO: ::c_int = 20;
+pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_ACCEPTCONN: ::c_int = 30;
+
+pub const SA_ONSTACK: ::c_int = 0x08000000;
+pub const SA_SIGINFO: ::c_int = 0x00000004;
+pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
+
+pub const SIGCHLD: ::c_int = 17;
+pub const SIGBUS: ::c_int = 7;
+pub const SIGTTIN: ::c_int = 21;
+pub const SIGTTOU: ::c_int = 22;
+pub const SIGXCPU: ::c_int = 24;
+pub const SIGXFSZ: ::c_int = 25;
+pub const SIGVTALRM: ::c_int = 26;
+pub const SIGPROF: ::c_int = 27;
+pub const SIGWINCH: ::c_int = 28;
+pub const SIGUSR1: ::c_int = 10;
+pub const SIGUSR2: ::c_int = 12;
+pub const SIGCONT: ::c_int = 18;
+pub const SIGSTOP: ::c_int = 19;
+pub const SIGTSTP: ::c_int = 20;
+pub const SIGURG: ::c_int = 23;
+pub const SIGIO: ::c_int = 29;
+pub const SIGSYS: ::c_int = 31;
+pub const SIGSTKFLT: ::c_int = 16;
+pub const SIGPOLL: ::c_int = 29;
+pub const SIGPWR: ::c_int = 30;
+pub const SIG_SETMASK: ::c_int = 2;
+pub const SIG_BLOCK: ::c_int = 0x000000;
+pub const SIG_UNBLOCK: ::c_int = 0x01;
+
+pub const EXTPROC: ::tcflag_t = 0x00010000;
+
+pub const MAP_HUGETLB: ::c_int = 0x040000;
+
+pub const F_GETLK: ::c_int = 12;
+pub const F_GETOWN: ::c_int = 9;
+pub const F_SETLK: ::c_int = 13;
+pub const F_SETLKW: ::c_int = 14;
+pub const F_SETOWN: ::c_int = 8;
+
+pub const VEOF: usize = 4;
+pub const VEOL: usize = 11;
+pub const VEOL2: usize = 16;
+pub const VMIN: usize = 6;
+pub const IEXTEN: ::tcflag_t = 0x00008000;
+pub const TOSTOP: ::tcflag_t = 0x00000100;
+pub const FLUSHO: ::tcflag_t = 0x00001000;
+
+pub const TCGETS: ::c_int = 0x5401;
+pub const TCSETS: ::c_int = 0x5402;
+pub const TCSETSW: ::c_int = 0x5403;
+pub const TCSETSF: ::c_int = 0x5404;
+pub const TCGETA: ::c_int = 0x5405;
+pub const TCSETA: ::c_int = 0x5406;
+pub const TCSETAW: ::c_int = 0x5407;
+pub const TCSETAF: ::c_int = 0x5408;
+pub const TCSBRK: ::c_int = 0x5409;
+pub const TCXONC: ::c_int = 0x540A;
+pub const TCFLSH: ::c_int = 0x540B;
+pub const TIOCGSOFTCAR: ::c_int = 0x5419;
+pub const TIOCSSOFTCAR: ::c_int = 0x541A;
+pub const TIOCLINUX: ::c_int = 0x541C;
+pub const TIOCGSERIAL: ::c_int = 0x541E;
+pub const TIOCEXCL: ::c_int = 0x540C;
+pub const TIOCNXCL: ::c_int = 0x540D;
+pub const TIOCSCTTY: ::c_int = 0x540E;
+pub const TIOCGPGRP: ::c_int = 0x540F;
+pub const TIOCSPGRP: ::c_int = 0x5410;
+pub const TIOCOUTQ: ::c_int = 0x5411;
+pub const TIOCSTI: ::c_int = 0x5412;
+pub const TIOCGWINSZ: ::c_int = 0x5413;
+pub const TIOCSWINSZ: ::c_int = 0x5414;
+pub const TIOCMGET: ::c_int = 0x5415;
+pub const TIOCMBIS: ::c_int = 0x5416;
+pub const TIOCMBIC: ::c_int = 0x5417;
+pub const TIOCMSET: ::c_int = 0x5418;
+pub const FIONREAD: ::c_int = 0x541B;
+pub const TIOCCONS: ::c_int = 0x541D;
+
+pub const SYS_gettid: ::c_long = 224; // Valid for arm (32-bit) and x86 (32-bit)
+
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+pub const O_TMPFILE: ::c_int = 0x400000;
+
+f! {
+    pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
+        for slot in cpuset.bits.iter_mut() {
+            *slot = 0;
+        }
+    }
+
+    pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
+        let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
+        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+        cpuset.bits[idx] |= 1 << offset;
+        ()
+    }
+
+    pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
+        let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
+        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+        cpuset.bits[idx] &= !(1 << offset);
+        ()
+    }
+
+    pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
+        let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]);
+        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+        0 != (cpuset.bits[idx] & (1 << offset))
+    }
+
+    pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
+        set1.bits == set2.bits
+    }
+
+    pub fn major(dev: ::dev_t) -> ::c_uint {
+        // see
+        // https://github.com/kripken/emscripten/blob/
+        // master/system/include/libc/sys/sysmacros.h
+        let mut major = 0;
+        major |= (dev & 0x00000fff) >> 8;
+        major |= (dev & 0xfffff000) >> 31 >> 1;
+        major as ::c_uint
+    }
+
+    pub fn minor(dev: ::dev_t) -> ::c_uint {
+        // see
+        // https://github.com/kripken/emscripten/blob/
+        // master/system/include/libc/sys/sysmacros.h
+        let mut minor = 0;
+        minor |= (dev & 0x000000ff) >> 0;
+        minor |= (dev & 0xffffff00) >> 12;
+        minor as ::c_uint
+    }
+
+    pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
+        let major = major as ::dev_t;
+        let minor = minor as ::dev_t;
+        let mut dev = 0;
+        dev |= (major & 0x00000fff) << 8;
+        dev |= (major & 0xfffff000) << 31 << 1;
+        dev |= (minor & 0x000000ff) << 0;
+        dev |= (minor & 0xffffff00) << 12;
+        dev
+    }
+}
+
+extern {
+    pub fn setpwent();
+    pub fn endpwent();
+    pub fn getpwent() -> *mut passwd;
+
+    pub fn shm_open(name: *const c_char, oflag: ::c_int,
+                    mode: mode_t) -> ::c_int;
+
+    pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
+                    -> ::c_int;
+    pub fn __errno_location() -> *mut ::c_int;
+
+    pub fn fopen64(filename: *const c_char,
+                   mode: *const c_char) -> *mut ::FILE;
+    pub fn freopen64(filename: *const c_char, mode: *const c_char,
+                     file: *mut ::FILE) -> *mut ::FILE;
+    pub fn tmpfile64() -> *mut ::FILE;
+    pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
+    pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
+    pub fn fseeko64(stream: *mut ::FILE,
+                    offset: ::off64_t,
+                    whence: ::c_int) -> ::c_int;
+    pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
+    pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
+                           len: ::off_t) -> ::c_int;
+    pub fn pwritev(fd: ::c_int,
+                   iov: *const ::iovec,
+                   iovcnt: ::c_int,
+                   offset: ::off_t) -> ::ssize_t;
+    pub fn preadv(fd: ::c_int,
+                  iov: *const ::iovec,
+                  iovcnt: ::c_int,
+                  offset: ::off_t) -> ::ssize_t;
+    pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
+    pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
+    pub fn mkostemps(template: *mut ::c_char,
+                     suffixlen: ::c_int,
+                     flags: ::c_int) -> ::c_int;
+    pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+    pub fn getnameinfo(sa: *const ::sockaddr,
+                       salen: ::socklen_t,
+                       host: *mut ::c_char,
+                       hostlen: ::socklen_t,
+                       serv: *mut ::c_char,
+                       sevlen: ::socklen_t,
+                       flags: ::c_int) -> ::c_int;
+    pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
+
+    // Not available now on Android
+    pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
+                    mode: ::mode_t) -> ::c_int;
+    pub fn if_nameindex() -> *mut if_nameindex;
+    pub fn if_freenameindex(ptr: *mut if_nameindex);
+    pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
+    pub fn freeifaddrs(ifa: *mut ::ifaddrs);
+
+    pub fn mremap(addr: *mut ::c_void,
+                  len: ::size_t,
+                  new_len: ::size_t,
+                  flags: ::c_int,
+                  ...) -> *mut ::c_void;
+
+    pub fn glob(pattern: *const c_char,
+                flags: ::c_int,
+                errfunc: Option<extern fn(epath: *const c_char,
+                                          errno: ::c_int) -> ::c_int>,
+                pglob: *mut ::glob_t) -> ::c_int;
+    pub fn globfree(pglob: *mut ::glob_t);
+
+    pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
+                         -> ::c_int;
+
+    pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
+
+    pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
+
+    pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
+    pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
+                  -> ::c_int;
+
+    pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
+
+    pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
+                    flags: ::c_int, addr: *mut ::sockaddr,
+                    addrlen: *mut ::socklen_t) -> ::ssize_t;
+    pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
+    pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
+
+    pub fn bind(socket: ::c_int, address: *const ::sockaddr,
+                address_len: ::socklen_t) -> ::c_int;
+
+    pub fn writev(fd: ::c_int,
+                  iov: *const ::iovec,
+                  iovcnt: ::c_int) -> ::ssize_t;
+    pub fn readv(fd: ::c_int,
+                 iov: *const ::iovec,
+                 iovcnt: ::c_int) -> ::ssize_t;
+
+    pub fn sendmsg(fd: ::c_int,
+                   msg: *const ::msghdr,
+                   flags: ::c_int) -> ::ssize_t;
+    pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
+                   -> ::ssize_t;
+    pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
+    pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+    pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
+                    flags: ::c_int) -> ::c_int;
+    pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
+                    flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
+    pub fn sync();
+    pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
+    pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
+    pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
+    pub fn pthread_create(native: *mut ::pthread_t,
+                          attr: *const ::pthread_attr_t,
+                          f: extern fn(*mut ::c_void) -> *mut ::c_void,
+                          value: *mut ::c_void) -> ::c_int;
+}
--- a/third_party/rust/libc/src/unix/notbsd/linux/mips/mips32.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/mips/mips32.rs
@@ -5,16 +5,17 @@ pub type clock_t = i32;
 pub type time_t = i32;
 pub type suseconds_t = i32;
 pub type wchar_t = i32;
 pub type off_t = i32;
 pub type ino_t = u32;
 pub type blkcnt_t = i32;
 pub type blksize_t = i32;
 pub type nlink_t = u32;
+pub type __u64 = ::c_ulonglong;
 
 s! {
     pub struct aiocb {
         pub aio_fildes: ::c_int,
         pub aio_lio_opcode: ::c_int,
         pub aio_reqprio: ::c_int,
         pub aio_buf: *mut ::c_void,
         pub aio_nbytes: ::size_t,
@@ -70,16 +71,50 @@ s! {
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         pub st_blksize: ::blksize_t,
         st_pad3: ::c_long,
         pub st_blocks: ::blkcnt64_t,
         st_pad5: [::c_long; 14],
     }
 
+    pub struct statfs64 {
+        pub f_type: ::c_long,
+        pub f_bsize: ::c_long,
+        pub f_frsize: ::c_long,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_bavail: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_long,
+        pub f_flags: ::c_long,
+        pub f_spare: [::c_long; 5],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        #[cfg(target_endian = "little")]
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        #[cfg(target_endian = "big")]
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct pthread_attr_t {
         __size: [u32; 9]
     }
 
     pub struct sigaction {
         pub sa_flags: ::c_int,
         pub sa_sigaction: ::sighandler_t,
         pub sa_mask: sigset_t,
@@ -223,12 +258,19 @@ s! {
         pub _f: [::c_char; 8],
     }
 }
 
 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+
+pub const O_LARGEFILE: ::c_int = 0x2000;
 
 pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
 
-pub const SYS_gettid: ::c_long = 4222;   // Valid for O32
+// Valid for O32
+pub const SYS_pivot_root: ::c_long = 4216;
+pub const SYS_gettid: ::c_long = 4222;
+pub const SYS_perf_event_open: ::c_long = 4333;
+pub const SYS_memfd_create: ::c_long = 4354;
--- a/third_party/rust/libc/src/unix/notbsd/linux/mips/mips64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/mips/mips64.rs
@@ -5,16 +5,17 @@ pub type c_long = i64;
 pub type c_ulong = u64;
 pub type ino_t = u64;
 pub type nlink_t = u64;
 pub type off_t = i64;
 pub type suseconds_t = i64;
 pub type time_t = i64;
 pub type wchar_t = i32;
 pub type clock_t = i64;
+pub type __u64 = ::c_ulong;
 
 s! {
     pub struct aiocb {
         pub aio_fildes: ::c_int,
         pub aio_lio_opcode: ::c_int,
         pub aio_reqprio: ::c_int,
         pub aio_buf: *mut ::c_void,
         pub aio_nbytes: ::size_t,
@@ -70,16 +71,46 @@ s! {
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         pub st_blksize: ::blksize_t,
         st_pad3: ::c_long,
         pub st_blocks: ::blkcnt64_t,
         st_pad5: [::c_long; 7],
     }
 
+    pub struct statfs64 {
+        pub f_type: ::c_long,
+        pub f_bsize: ::c_long,
+        pub f_frsize: ::c_long,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_bavail: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_long,
+        pub f_flags: ::c_long,
+        pub f_spare: [::c_long; 5],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct pthread_attr_t {
         __size: [::c_ulong; 7]
     }
 
     pub struct sigaction {
         pub sa_flags: ::c_int,
         pub sa_sigaction: ::sighandler_t,
         pub sa_mask: sigset_t,
@@ -209,12 +240,18 @@ s! {
         pub _f: [::c_char; 0],
     }
 }
 
 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+
+pub const O_LARGEFILE: ::c_int = 0;
 
 pub const RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff;
 
-pub const SYS_gettid: ::c_long = 5178;   // Valid for n64
+// Valid for n64
+pub const SYS_pivot_root: ::c_long = 5151;
+pub const SYS_gettid: ::c_long = 5178;
+pub const SYS_memfd_create: ::c_long = 5314;
--- a/third_party/rust/libc/src/unix/notbsd/linux/mips/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/mips/mod.rs
@@ -22,25 +22,25 @@ s! {
         #[cfg(target_pointer_width = "32")]
         __size: [::c_char; 16],
         #[cfg(target_pointer_width = "64")]
         __size: [::c_char; 32],
         __align: [::c_long; 0],
     }
 }
 
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
 pub const SFD_CLOEXEC: ::c_int = 0x080000;
 
 pub const NCCS: usize = 32;
 
 pub const O_TRUNC: ::c_int = 512;
 
+pub const O_NOATIME: ::c_int = 0o1000000;
 pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_PATH: ::c_int = 0o10000000;
 
 pub const EBFONT: ::c_int = 59;
 pub const ENOSTR: ::c_int = 60;
 pub const ENODATA: ::c_int = 61;
 pub const ETIME: ::c_int = 62;
 pub const ENOSR: ::c_int = 63;
 pub const ENONET: ::c_int = 64;
 pub const ENOPKG: ::c_int = 65;
@@ -62,17 +62,91 @@ pub const EPOLL_CLOEXEC: ::c_int = 0x800
 pub const EFD_CLOEXEC: ::c_int = 0x80000;
 
 pub const BUFSIZ: ::c_uint = 8192;
 pub const TMP_MAX: ::c_uint = 238328;
 pub const FOPEN_MAX: ::c_uint = 16;
 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
+pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
+pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
+pub const _SC_PII: ::c_int = 53;
+pub const _SC_PII_XTI: ::c_int = 54;
+pub const _SC_PII_SOCKET: ::c_int = 55;
+pub const _SC_PII_INTERNET: ::c_int = 56;
+pub const _SC_PII_OSI: ::c_int = 57;
+pub const _SC_POLL: ::c_int = 58;
+pub const _SC_SELECT: ::c_int = 59;
+pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
+pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
+pub const _SC_PII_OSI_COTS: ::c_int = 63;
+pub const _SC_PII_OSI_CLTS: ::c_int = 64;
+pub const _SC_PII_OSI_M: ::c_int = 65;
+pub const _SC_T_IOV_MAX: ::c_int = 66;
 pub const _SC_2_C_VERSION: ::c_int = 96;
+pub const _SC_CHAR_BIT: ::c_int = 101;
+pub const _SC_CHAR_MAX: ::c_int = 102;
+pub const _SC_CHAR_MIN: ::c_int = 103;
+pub const _SC_INT_MAX: ::c_int = 104;
+pub const _SC_INT_MIN: ::c_int = 105;
+pub const _SC_LONG_BIT: ::c_int = 106;
+pub const _SC_WORD_BIT: ::c_int = 107;
+pub const _SC_MB_LEN_MAX: ::c_int = 108;
+pub const _SC_SSIZE_MAX: ::c_int = 110;
+pub const _SC_SCHAR_MAX: ::c_int = 111;
+pub const _SC_SCHAR_MIN: ::c_int = 112;
+pub const _SC_SHRT_MAX: ::c_int = 113;
+pub const _SC_SHRT_MIN: ::c_int = 114;
+pub const _SC_UCHAR_MAX: ::c_int = 115;
+pub const _SC_UINT_MAX: ::c_int = 116;
+pub const _SC_ULONG_MAX: ::c_int = 117;
+pub const _SC_USHRT_MAX: ::c_int = 118;
+pub const _SC_NL_ARGMAX: ::c_int = 119;
+pub const _SC_NL_LANGMAX: ::c_int = 120;
+pub const _SC_NL_MSGMAX: ::c_int = 121;
+pub const _SC_NL_NMAX: ::c_int = 122;
+pub const _SC_NL_SETMAX: ::c_int = 123;
+pub const _SC_NL_TEXTMAX: ::c_int = 124;
+pub const _SC_BASE: ::c_int = 134;
+pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
+pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
+pub const _SC_DEVICE_IO: ::c_int = 140;
+pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
+pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
+pub const _SC_FD_MGMT: ::c_int = 143;
+pub const _SC_FIFO: ::c_int = 144;
+pub const _SC_PIPE: ::c_int = 145;
+pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
+pub const _SC_FILE_LOCKING: ::c_int = 147;
+pub const _SC_FILE_SYSTEM: ::c_int = 148;
+pub const _SC_MULTI_PROCESS: ::c_int = 150;
+pub const _SC_SINGLE_PROCESS: ::c_int = 151;
+pub const _SC_NETWORKING: ::c_int = 152;
+pub const _SC_REGEX_VERSION: ::c_int = 156;
+pub const _SC_SIGNALS: ::c_int = 158;
+pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
+pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
+pub const _SC_USER_GROUPS: ::c_int = 166;
+pub const _SC_USER_GROUPS_R: ::c_int = 167;
+pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
+pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
+pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
+pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
+pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
+pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
+pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
+pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
+pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
+pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
+pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
+pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
+pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
+pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
+pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
 pub const O_ACCMODE: ::c_int = 3;
 pub const O_DIRECT: ::c_int = 0x8000;
 pub const O_DIRECTORY: ::c_int = 0x10000;
 pub const O_NOFOLLOW: ::c_int = 0x20000;
 pub const ST_RELATIME: ::c_ulong = 4096;
 pub const NI_MAXHOST: ::socklen_t = 1025;
 
 pub const RLIMIT_NOFILE: ::c_int = 5;
@@ -251,17 +325,16 @@ pub const SO_SECURITY_AUTHENTICATION: ::
 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
 pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
 pub const SO_BINDTODEVICE: ::c_int = 25;
 pub const SO_ATTACH_FILTER: ::c_int = 26;
 pub const SO_DETACH_FILTER: ::c_int = 27;
 pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
 pub const SO_PEERNAME: ::c_int = 28;
 pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
 pub const SO_PEERSEC: ::c_int = 30;
 pub const SO_SNDBUFFORCE: ::c_int = 31;
 pub const SO_RCVBUFFORCE: ::c_int = 33;
 pub const SO_PASSSEC: ::c_int = 34;
 pub const SO_TIMESTAMPNS: ::c_int = 35;
 pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
 pub const SO_MARK: ::c_int = 36;
 pub const SO_TIMESTAMPING: ::c_int = 37;
@@ -305,19 +378,17 @@ pub const SIGURG: ::c_int = 21;
 pub const SIGIO: ::c_int = 22;
 pub const SIGSYS: ::c_int = 12;
 pub const SIGPOLL: ::c_int = 22;
 pub const SIGPWR: ::c_int = 19;
 pub const SIG_SETMASK: ::c_int = 3;
 pub const SIG_BLOCK: ::c_int = 0x1;
 pub const SIG_UNBLOCK: ::c_int = 0x2;
 
-pub const POLLRDNORM: ::c_short = 0x040;
 pub const POLLWRNORM: ::c_short = 0x004;
-pub const POLLRDBAND: ::c_short = 0x080;
 pub const POLLWRBAND: ::c_short = 0x100;
 
 pub const PTHREAD_STACK_MIN: ::size_t = 131072;
 
 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
 pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
 pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
 pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
@@ -485,16 +556,27 @@ pub const ECHOE: ::tcflag_t = 0x00000010
 pub const ECHOK: ::tcflag_t = 0x00000020;
 pub const ECHONL: ::tcflag_t = 0x00000040;
 pub const ECHOPRT: ::tcflag_t = 0x00000400;
 pub const ECHOCTL: ::tcflag_t = 0x00000200;
 pub const ISIG: ::tcflag_t = 0x00000001;
 pub const ICANON: ::tcflag_t = 0x00000002;
 pub const PENDIN: ::tcflag_t = 0x00004000;
 pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
@@ -520,16 +602,32 @@ pub const B1000000: ::speed_t = 0o010010
 pub const B1152000: ::speed_t = 0o010011;
 pub const B1500000: ::speed_t = 0o010012;
 pub const B2000000: ::speed_t = 0o010013;
 pub const B2500000: ::speed_t = 0o010014;
 pub const B3000000: ::speed_t = 0o010015;
 pub const B3500000: ::speed_t = 0o010016;
 pub const B4000000: ::speed_t = 0o010017;
 
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x010;
+pub const TIOCM_SR: ::c_int = 0x020;
+pub const TIOCM_CTS: ::c_int = 0x040;
+pub const TIOCM_CAR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RNG: ::c_int = 0x200;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+pub const TIOCM_DSR: ::c_int = 0x400;
+
+pub const EHWPOISON: ::c_int = 168;
+pub const SIGEV_THREAD_ID: ::c_int = 4;
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
+
 #[link(name = "util")]
 extern {
     pub fn sysctl(name: *mut ::c_int,
                   namelen: ::c_int,
                   oldp: *mut ::c_void,
                   oldlenp: *mut ::size_t,
                   newp: *mut ::c_void,
                   newlen: ::size_t)
--- a/third_party/rust/libc/src/unix/notbsd/linux/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/mod.rs
@@ -13,16 +13,23 @@ pub type blkcnt64_t = i64;
 pub type rlim64_t = u64;
 pub type shmatt_t = ::c_ulong;
 pub type mqd_t = ::c_int;
 pub type msgqnum_t = ::c_ulong;
 pub type msglen_t = ::c_ulong;
 pub type nfds_t = ::c_ulong;
 pub type nl_item = ::c_int;
 pub type idtype_t = ::c_uint;
+pub type loff_t = ::c_longlong;
+
+pub type __u8 = ::c_uchar;
+pub type __u16 = ::c_ushort;
+pub type __s16 = ::c_short;
+pub type __u32 = ::c_uint;
+pub type __s32 = ::c_int;
 
 pub enum fpos64_t {} // TODO: fill this out with a struct
 
 s! {
     pub struct dirent {
         pub d_ino: ::ino_t,
         pub d_off: ::off_t,
         pub d_reclen: ::c_ushort,
@@ -93,16 +100,24 @@ s! {
         __align: [::c_int; 0],
         #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
                       target_arch = "mips64", target_arch = "s390x",
                       target_arch = "sparc64")))]
         __align: [::c_long; 0],
         size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
     }
 
+    pub struct pthread_rwlockattr_t {
+        #[cfg(any(target_env = "musl"))]
+        __align: [::c_int; 0],
+        #[cfg(not(any(target_env = "musl")))]
+        __align: [::c_long; 0],
+        size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
+    }
+
     pub struct pthread_cond_t {
         #[cfg(any(target_env = "musl"))]
         __align: [*const ::c_void; 0],
         #[cfg(not(any(target_env = "musl")))]
         __align: [::c_longlong; 0],
         size: [u8; __SIZEOF_PTHREAD_COND_T],
     }
 
@@ -226,16 +241,123 @@ s! {
         pub msg_len: ::c_uint,
     }
 
     pub struct sembuf {
         pub sem_num: ::c_ushort,
         pub sem_op: ::c_short,
         pub sem_flg: ::c_short,
     }
+
+    pub struct input_event {
+        pub time: ::timeval,
+        pub type_: ::__u16,
+        pub code: ::__u16,
+        pub value: ::__s32,
+    }
+
+    pub struct input_id {
+        pub bustype: ::__u16,
+        pub vendor: ::__u16,
+        pub product: ::__u16,
+        pub version: ::__u16,
+    }
+
+    pub struct input_absinfo {
+        pub value: ::__s32,
+        pub minimum: ::__s32,
+        pub maximum: ::__s32,
+        pub fuzz: ::__s32,
+        pub flat: ::__s32,
+        pub resolution: ::__s32,
+    }
+
+    pub struct input_keymap_entry {
+        pub flags: ::__u8,
+        pub len: ::__u8,
+        pub index: ::__u16,
+        pub keycode: ::__u32,
+        pub scancode: [::__u8; 32],
+    }
+
+    pub struct input_mask {
+        pub type_: ::__u32,
+        pub codes_size: ::__u32,
+        pub codes_ptr: ::__u64,
+    }
+
+    pub struct ff_replay {
+        pub length: ::__u16,
+        pub delay: ::__u16,
+    }
+
+    pub struct ff_trigger {
+        pub button: ::__u16,
+        pub interval: ::__u16,
+    }
+
+    pub struct ff_envelope {
+        pub attack_length: ::__u16,
+        pub attack_level: ::__u16,
+        pub fade_length: ::__u16,
+        pub fade_level: ::__u16,
+    }
+
+    pub struct ff_constant_effect {
+        pub level: ::__s16,
+        pub envelope: ff_envelope,
+    }
+
+    pub struct ff_ramp_effect {
+        pub start_level: ::__s16,
+        pub end_level: ::__s16,
+        pub envelope: ff_envelope,
+    }
+
+    pub struct ff_condition_effect {
+        pub right_saturation: ::__u16,
+        pub left_saturation: ::__u16,
+
+        pub right_coeff: ::__s16,
+        pub left_coeff: ::__s16,
+
+        pub deadband: ::__u16,
+        pub center: ::__s16,
+    }
+
+    pub struct ff_periodic_effect {
+        pub waveform: ::__u16,
+        pub period: ::__u16,
+        pub magnitude: ::__s16,
+        pub offset: ::__s16,
+        pub phase: ::__u16,
+
+        pub envelope: ff_envelope,
+
+        pub custom_len: ::__u32,
+        pub custom_data: *mut ::__s16,
+    }
+
+    pub struct ff_rumble_effect {
+        pub strong_magnitude: ::__u16,
+        pub weak_magnitude: ::__u16,
+    }
+
+    pub struct ff_effect {
+        pub type_: ::__u16,
+        pub id: ::__s16,
+        pub direction: ::__u16,
+        pub trigger: ff_trigger,
+        pub replay: ff_replay,
+        // FIXME this is actually a union
+        #[cfg(target_pointer_width = "64")]
+        pub u: [u64; 4],
+        #[cfg(target_pointer_width = "32")]
+        pub u: [u32; 7],
+    }
 }
 
 pub const ABDAY_1: ::nl_item = 0x20000;
 pub const ABDAY_2: ::nl_item = 0x20001;
 pub const ABDAY_3: ::nl_item = 0x20002;
 pub const ABDAY_4: ::nl_item = 0x20003;
 pub const ABDAY_5: ::nl_item = 0x20004;
 pub const ABDAY_6: ::nl_item = 0x20005;
@@ -310,16 +432,28 @@ pub const _PC_LINK_MAX: ::c_int = 0;
 pub const _PC_MAX_CANON: ::c_int = 1;
 pub const _PC_MAX_INPUT: ::c_int = 2;
 pub const _PC_NAME_MAX: ::c_int = 3;
 pub const _PC_PATH_MAX: ::c_int = 4;
 pub const _PC_PIPE_BUF: ::c_int = 5;
 pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
 pub const _PC_NO_TRUNC: ::c_int = 7;
 pub const _PC_VDISABLE: ::c_int = 8;
+pub const _PC_SYNC_IO: ::c_int = 9;
+pub const _PC_ASYNC_IO: ::c_int = 10;
+pub const _PC_PRIO_IO: ::c_int = 11;
+pub const _PC_SOCK_MAXBUF: ::c_int = 12;
+pub const _PC_FILESIZEBITS: ::c_int = 13;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18;
+pub const _PC_SYMLINK_MAX: ::c_int = 19;
+pub const _PC_2_SYMLINKS: ::c_int = 20;
 
 pub const _SC_ARG_MAX: ::c_int = 0;
 pub const _SC_CHILD_MAX: ::c_int = 1;
 pub const _SC_CLK_TCK: ::c_int = 2;
 pub const _SC_NGROUPS_MAX: ::c_int = 3;
 pub const _SC_OPEN_MAX: ::c_int = 4;
 pub const _SC_STREAM_MAX: ::c_int = 5;
 pub const _SC_TZNAME_MAX: ::c_int = 6;
@@ -363,50 +497,105 @@ pub const _SC_LINE_MAX: ::c_int = 43;
 pub const _SC_RE_DUP_MAX: ::c_int = 44;
 pub const _SC_2_VERSION: ::c_int = 46;
 pub const _SC_2_C_BIND: ::c_int = 47;
 pub const _SC_2_C_DEV: ::c_int = 48;
 pub const _SC_2_FORT_DEV: ::c_int = 49;
 pub const _SC_2_FORT_RUN: ::c_int = 50;
 pub const _SC_2_SW_DEV: ::c_int = 51;
 pub const _SC_2_LOCALEDEF: ::c_int = 52;
+pub const _SC_UIO_MAXIOV: ::c_int = 60;
 pub const _SC_IOV_MAX: ::c_int = 60;
 pub const _SC_THREADS: ::c_int = 67;
 pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
 pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
 pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
 pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
 pub const _SC_TTY_NAME_MAX: ::c_int = 72;
 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
 pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
 pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
 pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
 pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
 pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
 pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
 pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
 pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82;
 pub const _SC_NPROCESSORS_CONF: ::c_int = 83;
 pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
+pub const _SC_PHYS_PAGES: ::c_int = 85;
+pub const _SC_AVPHYS_PAGES: ::c_int = 86;
 pub const _SC_ATEXIT_MAX: ::c_int = 87;
+pub const _SC_PASS_MAX: ::c_int = 88;
 pub const _SC_XOPEN_VERSION: ::c_int = 89;
 pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
 pub const _SC_XOPEN_UNIX: ::c_int = 91;
 pub const _SC_XOPEN_CRYPT: ::c_int = 92;
 pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
 pub const _SC_XOPEN_SHM: ::c_int = 94;
 pub const _SC_2_CHAR_TERM: ::c_int = 95;
 pub const _SC_2_UPE: ::c_int = 97;
+pub const _SC_XOPEN_XPG2: ::c_int = 98;
+pub const _SC_XOPEN_XPG3: ::c_int = 99;
+pub const _SC_XOPEN_XPG4: ::c_int = 100;
+pub const _SC_NZERO: ::c_int = 109;
 pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
 pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
+pub const _SC_XBS5_LP64_OFF64: ::c_int = 127;
 pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
 pub const _SC_XOPEN_LEGACY: ::c_int = 129;
 pub const _SC_XOPEN_REALTIME: ::c_int = 130;
 pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
+pub const _SC_ADVISORY_INFO: ::c_int = 132;
+pub const _SC_BARRIERS: ::c_int = 133;
+pub const _SC_CLOCK_SELECTION: ::c_int = 137;
+pub const _SC_CPUTIME: ::c_int = 138;
+pub const _SC_THREAD_CPUTIME: ::c_int = 139;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 149;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 153;
+pub const _SC_SPIN_LOCKS: ::c_int = 154;
+pub const _SC_REGEXP: ::c_int = 155;
+pub const _SC_SHELL: ::c_int = 157;
+pub const _SC_SPAWN: ::c_int = 159;
+pub const _SC_SPORADIC_SERVER: ::c_int = 160;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161;
+pub const _SC_TIMEOUTS: ::c_int = 164;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
+pub const _SC_2_PBS: ::c_int = 168;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169;
+pub const _SC_2_PBS_LOCATE: ::c_int = 170;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 171;
+pub const _SC_2_PBS_TRACK: ::c_int = 172;
+pub const _SC_SYMLOOP_MAX: ::c_int = 173;
+pub const _SC_STREAMS: ::c_int = 174;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 176;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177;
+pub const _SC_V6_LP64_OFF64: ::c_int = 178;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179;
 pub const _SC_HOST_NAME_MAX: ::c_int = 180;
+pub const _SC_TRACE: ::c_int = 181;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182;
+pub const _SC_TRACE_INHERIT: ::c_int = 183;
+pub const _SC_TRACE_LOG: ::c_int = 184;
+pub const _SC_IPV6: ::c_int = 235;
+pub const _SC_RAW_SOCKETS: ::c_int = 236;
+pub const _SC_V7_ILP32_OFF32: ::c_int = 237;
+pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238;
+pub const _SC_V7_LP64_OFF64: ::c_int = 239;
+pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240;
+pub const _SC_SS_REPL_MAX: ::c_int = 241;
+pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242;
+pub const _SC_TRACE_NAME_MAX: ::c_int = 243;
+pub const _SC_TRACE_SYS_MAX: ::c_int = 244;
+pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245;
+pub const _SC_XOPEN_STREAMS: ::c_int = 246;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
 
 pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
 pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
 
 pub const GLOB_ERR: ::c_int = 1 << 0;
 pub const GLOB_MARK: ::c_int = 1 << 1;
 pub const GLOB_NOSORT: ::c_int = 1 << 2;
 pub const GLOB_DOOFFS: ::c_int = 1 << 3;
@@ -462,16 +651,18 @@ pub const PTHREAD_COND_INITIALIZER: pthr
 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
     __align: [],
     size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
 };
 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
 pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
 
 pub const SCHED_OTHER: ::c_int = 0;
 pub const SCHED_FIFO: ::c_int = 1;
 pub const SCHED_RR: ::c_int = 2;
 pub const SCHED_BATCH: ::c_int = 3;
 pub const SCHED_IDLE: ::c_int = 5;
 
@@ -706,21 +897,35 @@ pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_
 
 pub const ITIMER_REAL: ::c_int = 0;
 pub const ITIMER_VIRTUAL: ::c_int = 1;
 pub const ITIMER_PROF: ::c_int = 2;
 
 pub const XATTR_CREATE: ::c_int = 0x1;
 pub const XATTR_REPLACE: ::c_int = 0x2;
 
+pub const _POSIX_VDISABLE: ::cc_t = 0;
+
+pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
+pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
+pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08;
+pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
+pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
+pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
+
 // On Linux, libc doesn't define this constant, libattr does instead.
 // We still define it for Linux as it's defined by libc on other platforms,
 // and it's mentioned in the man pages for getxattr and setxattr.
 pub const ENOATTR: ::c_int = ::ENODATA;
 
+pub const SO_ORIGINAL_DST: ::c_int = 80;
+pub const IUTF8: ::tcflag_t = 0x00004000;
+pub const CMSPAR: ::tcflag_t = 0o10000000000;
+pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
+
 f! {
     pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
         for slot in cpuset.bits.iter_mut() {
             *slot = 0;
         }
     }
 
     pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
@@ -783,16 +988,17 @@ extern {
                        timeout: *const ::timespec) -> ::c_int;
     pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
     pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
                       nitems: ::c_int, sevp: *mut ::sigevent) -> ::c_int;
 
     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
 
     pub fn setpwent();
+    pub fn endpwent();
     pub fn getpwent() -> *mut passwd;
     pub fn setspent();
     pub fn endspent();
     pub fn getspent() -> *mut spwd;
     pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
 
     pub fn shm_open(name: *const c_char, oflag: ::c_int,
                     mode: mode_t) -> ::c_int;
@@ -895,35 +1101,25 @@ extern {
                       newattr: *const ::mq_attr,
                       oldattr: *mut ::mq_attr) -> ::c_int;
     pub fn epoll_pwait(epfd: ::c_int,
                        events: *mut ::epoll_event,
                        maxevents: ::c_int,
                        timeout: ::c_int,
                        sigmask: *const ::sigset_t) -> ::c_int;
     pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
-    pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
     pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
     pub fn mkostemps(template: *mut ::c_char,
                      suffixlen: ::c_int,
                      flags: ::c_int) -> ::c_int;
     pub fn sigtimedwait(set: *const sigset_t,
                         info: *mut siginfo_t,
                         timeout: *const ::timespec) -> ::c_int;
     pub fn sigwaitinfo(set: *const sigset_t,
                        info: *mut siginfo_t) -> ::c_int;
-    pub fn openpty(amaster: *mut ::c_int,
-                   aslave: *mut ::c_int,
-                   name: *mut ::c_char,
-                   termp: *const termios,
-                   winp: *const ::winsize) -> ::c_int;
-    pub fn forkpty(amaster: *mut ::c_int,
-                   name: *mut ::c_char,
-                   termp: *const termios,
-                   winp: *const ::winsize) -> ::pid_t;
     pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
     pub fn getnameinfo(sa: *const ::sockaddr,
                        salen: ::socklen_t,
                        host: *mut ::c_char,
                        hostlen: ::socklen_t,
                        serv: *mut ::c_char,
                        sevlen: ::socklen_t,
                        flags: ::c_int) -> ::c_int;
@@ -946,18 +1142,16 @@ extern {
                              local_iov: *const ::iovec,
                              liovcnt: ::c_ulong,
                              remote_iov: *const ::iovec,
                              riovcnt: ::c_ulong,
                              flags: ::c_ulong) -> isize;
     pub fn reboot(how_to: ::c_int) -> ::c_int;
     pub fn setfsgid(gid: ::gid_t) -> ::c_int;
     pub fn setfsuid(uid: ::uid_t) -> ::c_int;
-    pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
-    pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
 
     // Not available now on Android
     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
                     mode: ::mode_t) -> ::c_int;
     pub fn if_nameindex() -> *mut if_nameindex;
     pub fn if_freenameindex(ptr: *mut if_nameindex);
     pub fn sync_file_range(fd: ::c_int, offset: ::off64_t,
                            nbytes: ::off64_t, flags: ::c_uint) -> ::c_int;
@@ -1010,30 +1204,180 @@ extern {
     pub fn sendmsg(fd: ::c_int,
                    msg: *const ::msghdr,
                    flags: ::c_int) -> ::ssize_t;
     pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
                    -> ::ssize_t;
     pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
     pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
     pub fn vhangup() -> ::c_int;
-}
-
-extern {
     pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
                     flags: ::c_int) -> ::c_int;
     pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
                     flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
     pub fn sync();
+    pub fn syscall(num: ::c_long, ...) -> ::c_long;
+    pub fn sched_getaffinity(pid: ::pid_t,
+                             cpusetsize: ::size_t,
+                             cpuset: *mut cpu_set_t) -> ::c_int;
+    pub fn sched_setaffinity(pid: ::pid_t,
+                             cpusetsize: ::size_t,
+                             cpuset: *const cpu_set_t) -> ::c_int;
+    pub fn epoll_create(size: ::c_int) -> ::c_int;
+    pub fn epoll_create1(flags: ::c_int) -> ::c_int;
+    pub fn epoll_wait(epfd: ::c_int,
+                      events: *mut ::epoll_event,
+                      maxevents: ::c_int,
+                      timeout: ::c_int) -> ::c_int;
+    pub fn epoll_ctl(epfd: ::c_int,
+                     op: ::c_int,
+                     fd: ::c_int,
+                     event: *mut ::epoll_event) -> ::c_int;
+    pub fn pthread_getschedparam(native: ::pthread_t,
+                                 policy: *mut ::c_int,
+                                 param: *mut ::sched_param) -> ::c_int;
+    pub fn unshare(flags: ::c_int) -> ::c_int;
+    pub fn umount(target: *const ::c_char) -> ::c_int;
+    pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
+    pub fn tee(fd_in: ::c_int,
+               fd_out: ::c_int,
+               len: ::size_t,
+               flags: ::c_uint) -> ::ssize_t;
+    pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+    pub fn splice(fd_in: ::c_int,
+                  off_in: *mut ::loff_t,
+                  fd_out: ::c_int,
+                  off_out: *mut ::loff_t,
+                  len: ::size_t,
+                  flags: ::c_uint) -> ::ssize_t;
+    pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
+    pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn sem_timedwait(sem: *mut sem_t,
+                         abstime: *const ::timespec) -> ::c_int;
+    pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
+    pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
+    pub fn swapoff(puath: *const ::c_char) -> ::c_int;
+    pub fn vmsplice(fd: ::c_int,
+                    iov: *const ::iovec,
+                    nr_segs: ::size_t,
+                    flags: ::c_uint) -> ::ssize_t;
+    pub fn mount(src: *const ::c_char,
+                 target: *const ::c_char,
+                 fstype: *const ::c_char,
+                 flags: ::c_ulong,
+                 data: *const ::c_void) -> ::c_int;
+    pub fn personality(persona: ::c_ulong) -> ::c_int;
+    pub fn prctl(option: ::c_int, ...) -> ::c_int;
+    pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
+    pub fn ppoll(fds: *mut ::pollfd,
+                 nfds: nfds_t,
+                 timeout: *const ::timespec,
+                 sigmask: *const sigset_t) -> ::c_int;
+    pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+                                   abstime: *const ::timespec) -> ::c_int;
+    pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
+                 child_stack: *mut ::c_void,
+                 flags: ::c_int,
+                 arg: *mut ::c_void, ...) -> ::c_int;
+    pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
+    pub fn clock_nanosleep(clk_id: ::clockid_t,
+                           flags: ::c_int,
+                           rqtp: *const ::timespec,
+                           rmtp:  *mut ::timespec) -> ::c_int;
+    pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
+                                     guardsize: *mut ::size_t) -> ::c_int;
+    pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+    pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
+    pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
+                                       pshared: *mut ::c_int) -> ::c_int;
+    pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int;
+    pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
+    pub fn pthread_setschedparam(native: ::pthread_t,
+                                 policy: ::c_int,
+                                 param: *const ::sched_param) -> ::c_int;
+    pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int;
+    pub fn sched_setscheduler(pid: ::pid_t,
+                              policy: ::c_int,
+                              param: *const ::sched_param) -> ::c_int;
+    pub fn sendfile(out_fd: ::c_int,
+                    in_fd: ::c_int,
+                    offset: *mut off_t,
+                    count: ::size_t) -> ::ssize_t;
+    pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+    pub fn getgrgid_r(uid: ::uid_t,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "sigaltstack$UNIX2003")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+    pub fn sigaltstack(ss: *const stack_t,
+                       oss: *mut stack_t) -> ::c_int;
+    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+    pub fn getdtablesize() -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+    pub fn getgrnam_r(name: *const ::c_char,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "pthread_sigmask$UNIX2003")]
+    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+                           oldset: *mut sigset_t) -> ::c_int;
+    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+    pub fn getpwnam_r(name: *const ::c_char,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+    pub fn getpwuid_r(uid: ::uid_t,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+               link_name = "sigwait$UNIX2003")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+    pub fn sigwait(set: *const sigset_t,
+                   sig: *mut ::c_int) -> ::c_int;
+    pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+                          parent: Option<unsafe extern fn()>,
+                          child: Option<unsafe extern fn()>) -> ::c_int;
+    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+    pub fn getgrouplist(user: *const ::c_char,
+                        group: ::gid_t,
+                        groups: *mut ::gid_t,
+                        ngroups: *mut ::c_int) -> ::c_int;
+    pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
+                                        pshared: *mut ::c_int) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "popen$UNIX2003")]
+    pub fn popen(command: *const c_char,
+                 mode: *const c_char) -> *mut ::FILE;
+    pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
+                     mode: ::c_int, flags: ::c_int) -> ::c_int;
+    pub fn pthread_create(native: *mut ::pthread_t,
+                          attr: *const ::pthread_attr_t,
+                          f: extern fn(*mut ::c_void) -> *mut ::c_void,
+                          value: *mut ::c_void) -> ::c_int;
 }
 
 cfg_if! {
-    if #[cfg(any(target_env = "musl",
-                 target_os = "fuchsia",
-                 target_os = "emscripten"))] {
+    if #[cfg(any(target_env = "musl", target_os = "fuchsia"))] {
         mod musl;
         pub use self::musl::*;
     } else if #[cfg(any(target_arch = "mips",
                         target_arch = "mips64"))] {
         mod mips;
         pub use self::mips::*;
     } else if #[cfg(any(target_arch = "s390x"))] {
         mod s390x;
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/b32/arm.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/b32/arm.rs
@@ -102,22 +102,54 @@ s! {
 
     pub struct siginfo_t {
         pub si_signo: ::c_int,
         pub si_errno: ::c_int,
         pub si_code: ::c_int,
         pub _pad: [::c_int; 29],
         _align: [usize; 0],
     }
+
+    pub struct statfs64 {
+        pub f_type: ::c_ulong,
+        pub f_bsize: ::c_ulong,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_files: ::fsfilcnt_t,
+        pub f_ffree: ::fsfilcnt_t,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_flags: ::c_ulong,
+        pub f_spare: [::c_ulong; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
 }
 
 pub const O_DIRECT: ::c_int = 0x4000;
 pub const O_DIRECTORY: ::c_int = 0x10000;
 pub const O_NOFOLLOW: ::c_int = 0x20000;
 pub const O_ASYNC: ::c_int = 0x2000;
+pub const O_LARGEFILE: ::c_int = 0o400000;
 
 pub const FIOCLEX: ::c_int = 0x5451;
 pub const FIONBIO: ::c_int = 0x5421;
 
 pub const RLIMIT_RSS: ::c_int = 5;
 pub const RLIMIT_NOFILE: ::c_int = 7;
 pub const RLIMIT_AS: ::c_int = 9;
 pub const RLIMIT_NPROC: ::c_int = 6;
@@ -334,13 +366,27 @@ pub const TIOCGWINSZ: ::c_int = 0x5413;
 pub const TIOCSWINSZ: ::c_int = 0x5414;
 pub const TIOCMGET: ::c_int = 0x5415;
 pub const TIOCMBIS: ::c_int = 0x5416;
 pub const TIOCMBIC: ::c_int = 0x5417;
 pub const TIOCMSET: ::c_int = 0x5418;
 pub const FIONREAD: ::c_int = 0x541B;
 pub const TIOCCONS: ::c_int = 0x541D;
 
+pub const SYS_pivot_root: ::c_long = 218;
 pub const SYS_gettid: ::c_long = 224;
 pub const SYS_perf_event_open: ::c_long = 364;
+pub const SYS_memfd_create: ::c_long = 385;
 
 pub const POLLWRNORM: ::c_short = 0x100;
 pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/b32/mips.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/b32/mips.rs
@@ -110,22 +110,57 @@ s! {
 
     pub struct siginfo_t {
         pub si_signo: ::c_int,
         pub si_code: ::c_int,
         pub si_errno: ::c_int,
         pub _pad: [::c_int; 29],
         _align: [usize; 0],
     }
+
+    pub struct statfs64 {
+        pub f_type: ::c_ulong,
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_files: ::fsfilcnt_t,
+        pub f_ffree: ::fsfilcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_ulong,
+        pub f_flags: ::c_ulong,
+        pub f_spare: [::c_ulong; 5],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        #[cfg(target_endian = "little")]
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        #[cfg(target_endian = "big")]
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
 }
 
 pub const O_DIRECT: ::c_int = 0o100000;
 pub const O_DIRECTORY: ::c_int = 0o200000;
 pub const O_NOFOLLOW: ::c_int = 0o400000;
 pub const O_ASYNC: ::c_int = 0o10000;
+pub const O_LARGEFILE: ::c_int = 0x2000;
 
 pub const FIOCLEX: ::c_int = 0x6601;
 pub const FIONBIO: ::c_int = 0x667E;
 
 pub const RLIMIT_RSS: ::c_int = 7;
 pub const RLIMIT_NOFILE: ::c_int = 5;
 pub const RLIMIT_AS: ::c_int = 6;
 pub const RLIMIT_NPROC: ::c_int = 8;
@@ -342,13 +377,28 @@ pub const TIOCGWINSZ: ::c_int = 0x400874
 pub const TIOCSWINSZ: ::c_int = 0x80087467;
 pub const TIOCMGET: ::c_int = 0x741D;
 pub const TIOCMBIS: ::c_int = 0x741B;
 pub const TIOCMBIC: ::c_int = 0x741C;
 pub const TIOCMSET: ::c_int = 0x741A;
 pub const FIONREAD: ::c_int = 0x467F;
 pub const TIOCCONS: ::c_int = 0x80047478;
 
-pub const SYS_gettid: ::c_long = 4222;   // Valid for O32
-pub const SYS_perf_event_open: ::c_long = 4333;  // Valid for O32
+// Valid for O32
+pub const SYS_pivot_root: ::c_long = 4216;
+pub const SYS_gettid: ::c_long = 4222;
+pub const SYS_perf_event_open: ::c_long = 4333;
+pub const SYS_memfd_create: ::c_long = 4354;
 
 pub const POLLWRNORM: ::c_short = 0x4;
 pub const POLLWRBAND: ::c_short = 0x100;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x010;
+pub const TIOCM_SR: ::c_int = 0x020;
+pub const TIOCM_CTS: ::c_int = 0x040;
+pub const TIOCM_CAR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RNG: ::c_int = 0x200;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+pub const TIOCM_DSR: ::c_int = 0x400;
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/b32/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/b32/mod.rs
@@ -1,11 +1,12 @@
 pub type c_long = i32;
 pub type c_ulong = u32;
 pub type nlink_t = u32;
+pub type __u64 = ::c_ulonglong;
 
 s! {
     pub struct pthread_attr_t {
         __size: [u32; 9]
     }
 
     pub struct sigset_t {
         __val: [::c_ulong; 32],
@@ -40,17 +41,12 @@ cfg_if! {
         mod x86;
         pub use self::x86::*;
     } else if #[cfg(any(target_arch = "mips"))] {
         mod mips;
         pub use self::mips::*;
     } else if #[cfg(any(target_arch = "arm"))] {
         mod arm;
         pub use self::arm::*;
-    } else if #[cfg(any(target_arch = "asmjs", target_arch = "wasm32"))] {
-        // For the time being asmjs and wasm32 are the same, and both
-        // backed by identical emscripten runtimes
-        mod asmjs;
-        pub use self::asmjs::*;
     } else {
         // Unknown target_arch
     }
 }
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/b32/x86.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/b32/x86.rs
@@ -115,22 +115,54 @@ s! {
 
     pub struct siginfo_t {
         pub si_signo: ::c_int,
         pub si_errno: ::c_int,
         pub si_code: ::c_int,
         pub _pad: [::c_int; 29],
         _align: [usize; 0],
     }
+
+    pub struct statfs64 {
+        pub f_type: ::c_ulong,
+        pub f_bsize: ::c_ulong,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_files: ::fsfilcnt_t,
+        pub f_ffree: ::fsfilcnt_t,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_flags: ::c_ulong,
+        pub f_spare: [::c_ulong; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
 }
 
 pub const O_DIRECT: ::c_int = 0x4000;
 pub const O_DIRECTORY: ::c_int = 0x10000;
 pub const O_NOFOLLOW: ::c_int = 0x20000;
 pub const O_ASYNC: ::c_int = 0x2000;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
 
 pub const FIOCLEX: ::c_int = 0x5451;
 pub const FIONBIO: ::c_int = 0x5421;
 
 pub const RLIMIT_RSS: ::c_int = 5;
 pub const RLIMIT_NOFILE: ::c_int = 7;
 pub const RLIMIT_AS: ::c_int = 9;
 pub const RLIMIT_NPROC: ::c_int = 6;
@@ -348,13 +380,421 @@ pub const TIOCGWINSZ: ::c_int = 0x5413;
 pub const TIOCSWINSZ: ::c_int = 0x5414;
 pub const TIOCMGET: ::c_int = 0x5415;
 pub const TIOCMBIS: ::c_int = 0x5416;
 pub const TIOCMBIC: ::c_int = 0x5417;
 pub const TIOCMSET: ::c_int = 0x5418;
 pub const FIONREAD: ::c_int = 0x541B;
 pub const TIOCCONS: ::c_int = 0x541D;
 
-pub const SYS_gettid: ::c_long = 224;
-pub const SYS_perf_event_open: ::c_long = 336;
-
 pub const POLLWRNORM: ::c_short = 0x100;
 pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
+// Syscall table
+pub const SYS_restart_syscall: ::c_long = 0;
+pub const SYS_exit: ::c_long = 1;
+pub const SYS_fork: ::c_long = 2;
+pub const SYS_read: ::c_long = 3;
+pub const SYS_write: ::c_long = 4;
+pub const SYS_open: ::c_long = 5;
+pub const SYS_close: ::c_long = 6;
+pub const SYS_waitpid: ::c_long = 7;
+pub const SYS_creat: ::c_long = 8;
+pub const SYS_link: ::c_long = 9;
+pub const SYS_unlink: ::c_long = 10;
+pub const SYS_execve: ::c_long = 11;
+pub const SYS_chdir: ::c_long = 12;
+pub const SYS_time: ::c_long = 13;
+pub const SYS_mknod: ::c_long = 14;
+pub const SYS_chmod: ::c_long = 15;
+pub const SYS_lchown: ::c_long = 16;
+pub const SYS_break: ::c_long = 17;
+pub const SYS_oldstat: ::c_long = 18;
+pub const SYS_lseek: ::c_long = 19;
+pub const SYS_getpid: ::c_long = 20;
+pub const SYS_mount: ::c_long = 21;
+pub const SYS_umount: ::c_long = 22;
+pub const SYS_setuid: ::c_long = 23;
+pub const SYS_getuid: ::c_long = 24;
+pub const SYS_stime: ::c_long = 25;
+pub const SYS_ptrace: ::c_long = 26;
+pub const SYS_alarm: ::c_long = 27;
+pub const SYS_oldfstat: ::c_long = 28;
+pub const SYS_pause: ::c_long = 29;
+pub const SYS_utime: ::c_long = 30;
+pub const SYS_stty: ::c_long = 31;
+pub const SYS_gtty: ::c_long = 32;
+pub const SYS_access: ::c_long = 33;
+pub const SYS_nice: ::c_long = 34;
+pub const SYS_ftime: ::c_long = 35;
+pub const SYS_sync: ::c_long = 36;
+pub const SYS_kill: ::c_long = 37;
+pub const SYS_rename: ::c_long = 38;
+pub const SYS_mkdir: ::c_long = 39;
+pub const SYS_rmdir: ::c_long = 40;
+pub const SYS_dup: ::c_long = 41;
+pub const SYS_pipe: ::c_long = 42;
+pub const SYS_times: ::c_long = 43;
+pub const SYS_prof: ::c_long = 44;
+pub const SYS_brk: ::c_long = 45;
+pub const SYS_setgid: ::c_long = 46;
+pub const SYS_getgid: ::c_long = 47;
+pub const SYS_signal: ::c_long = 48;
+pub const SYS_geteuid: ::c_long = 49;
+pub const SYS_getegid: ::c_long = 50;
+pub const SYS_acct: ::c_long = 51;
+pub const SYS_umount2: ::c_long = 52;
+pub const SYS_lock: ::c_long = 53;
+pub const SYS_ioctl: ::c_long = 54;
+pub const SYS_fcntl: ::c_long = 55;
+pub const SYS_mpx: ::c_long = 56;
+pub const SYS_setpgid: ::c_long = 57;
+pub const SYS_ulimit: ::c_long = 58;
+pub const SYS_oldolduname: ::c_long = 59;
+pub const SYS_umask: ::c_long = 60;
+pub const SYS_chroot: ::c_long = 61;
+pub const SYS_ustat: ::c_long = 62;
+pub const SYS_dup2: ::c_long = 63;
+pub const SYS_getppid: ::c_long = 64;
+pub const SYS_getpgrp: ::c_long = 65;
+pub const SYS_setsid: ::c_long = 66;
+pub const SYS_sigaction: ::c_long = 67;
+pub const SYS_sgetmask: ::c_long = 68;
+pub const SYS_ssetmask: ::c_long = 69;
+pub const SYS_setreuid: ::c_long = 70;
+pub const SYS_setregid: ::c_long = 71;
+pub const SYS_sigsuspend: ::c_long = 72;
+pub const SYS_sigpending: ::c_long = 73;
+pub const SYS_sethostname: ::c_long = 74;
+pub const SYS_setrlimit: ::c_long = 75;
+pub const SYS_getrlimit: ::c_long = 76;
+pub const SYS_getrusage: ::c_long = 77;
+pub const SYS_gettimeofday: ::c_long = 78;
+pub const SYS_settimeofday: ::c_long = 79;
+pub const SYS_getgroups: ::c_long = 80;
+pub const SYS_setgroups: ::c_long = 81;
+pub const SYS_select: ::c_long = 82;
+pub const SYS_symlink: ::c_long = 83;
+pub const SYS_oldlstat: ::c_long = 84;
+pub const SYS_readlink: ::c_long = 85;
+pub const SYS_uselib: ::c_long = 86;
+pub const SYS_swapon: ::c_long = 87;
+pub const SYS_reboot: ::c_long = 88;
+pub const SYS_readdir: ::c_long = 89;
+pub const SYS_mmap: ::c_long = 90;
+pub const SYS_munmap: ::c_long = 91;
+pub const SYS_truncate: ::c_long = 92;
+pub const SYS_ftruncate: ::c_long = 93;
+pub const SYS_fchmod: ::c_long = 94;
+pub const SYS_fchown: ::c_long = 95;
+pub const SYS_getpriority: ::c_long = 96;
+pub const SYS_setpriority: ::c_long = 97;
+pub const SYS_profil: ::c_long = 98;
+pub const SYS_statfs: ::c_long = 99;
+pub const SYS_fstatfs: ::c_long = 100;
+pub const SYS_ioperm: ::c_long = 101;
+pub const SYS_socketcall: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_setitimer: ::c_long = 104;
+pub const SYS_getitimer: ::c_long = 105;
+pub const SYS_stat: ::c_long = 106;
+pub const SYS_lstat: ::c_long = 107;
+pub const SYS_fstat: ::c_long = 108;
+pub const SYS_olduname: ::c_long = 109;
+pub const SYS_iopl: ::c_long = 110;
+pub const SYS_vhangup: ::c_long = 111;
+pub const SYS_idle: ::c_long = 112;
+pub const SYS_vm86old: ::c_long = 113;
+pub const SYS_wait4: ::c_long = 114;
+pub const SYS_swapoff: ::c_long = 115;
+pub const SYS_sysinfo: ::c_long = 116;
+pub const SYS_ipc: ::c_long = 117;
+pub const SYS_fsync: ::c_long = 118;
+pub const SYS_sigreturn: ::c_long = 119;
+pub const SYS_clone: ::c_long = 120;
+pub const SYS_setdomainname: ::c_long = 121;
+pub const SYS_uname: ::c_long = 122;
+pub const SYS_modify_ldt: ::c_long = 123;
+pub const SYS_adjtimex: ::c_long = 124;
+pub const SYS_mprotect: ::c_long = 125;
+pub const SYS_sigprocmask: ::c_long = 126;
+pub const SYS_create_module: ::c_long = 127;
+pub const SYS_init_module: ::c_long = 128;
+pub const SYS_delete_module: ::c_long = 129;
+pub const SYS_get_kernel_syms: ::c_long = 130;
+pub const SYS_quotactl: ::c_long = 131;
+pub const SYS_getpgid: ::c_long = 132;
+pub const SYS_fchdir: ::c_long = 133;
+pub const SYS_bdflush: ::c_long = 134;
+pub const SYS_sysfs: ::c_long = 135;
+pub const SYS_personality: ::c_long = 136;
+pub const SYS_afs_syscall: ::c_long = 137;
+pub const SYS_setfsuid: ::c_long = 138;
+pub const SYS_setfsgid: ::c_long = 139;
+pub const SYS__llseek: ::c_long = 140;
+pub const SYS_getdents: ::c_long = 141;
+pub const SYS__newselect: ::c_long = 142;
+pub const SYS_flock: ::c_long = 143;
+pub const SYS_msync: ::c_long = 144;
+pub const SYS_readv: ::c_long = 145;
+pub const SYS_writev: ::c_long = 146;
+pub const SYS_getsid: ::c_long = 147;
+pub const SYS_fdatasync: ::c_long = 148;
+pub const SYS__sysctl: ::c_long = 149;
+pub const SYS_mlock: ::c_long = 150;
+pub const SYS_munlock: ::c_long = 151;
+pub const SYS_mlockall: ::c_long = 152;
+pub const SYS_munlockall: ::c_long = 153;
+pub const SYS_sched_setparam: ::c_long = 154;
+pub const SYS_sched_getparam: ::c_long = 155;
+pub const SYS_sched_setscheduler: ::c_long = 156;
+pub const SYS_sched_getscheduler: ::c_long = 157;
+pub const SYS_sched_yield: ::c_long = 158;
+pub const SYS_sched_get_priority_max: ::c_long = 159;
+pub const SYS_sched_get_priority_min: ::c_long = 160;
+pub const SYS_sched_rr_get_interval: ::c_long = 161;
+pub const SYS_nanosleep: ::c_long = 162;
+pub const SYS_mremap: ::c_long = 163;
+pub const SYS_setresuid: ::c_long = 164;
+pub const SYS_getresuid: ::c_long = 165;
+pub const SYS_vm86: ::c_long = 166;
+pub const SYS_query_module: ::c_long = 167;
+pub const SYS_poll: ::c_long = 168;
+pub const SYS_nfsservctl: ::c_long = 169;
+pub const SYS_setresgid: ::c_long = 170;
+pub const SYS_getresgid: ::c_long = 171;
+pub const SYS_prctl: ::c_long = 172;
+pub const SYS_rt_sigreturn: ::c_long = 173;
+pub const SYS_rt_sigaction: ::c_long = 174;
+pub const SYS_rt_sigprocmask: ::c_long = 175;
+pub const SYS_rt_sigpending: ::c_long = 176;
+pub const SYS_rt_sigtimedwait: ::c_long = 177;
+pub const SYS_rt_sigqueueinfo: ::c_long = 178;
+pub const SYS_rt_sigsuspend: ::c_long = 179;
+pub const SYS_pread64: ::c_long = 180;
+pub const SYS_pwrite64: ::c_long = 181;
+pub const SYS_chown: ::c_long = 182;
+pub const SYS_getcwd: ::c_long = 183;
+pub const SYS_capget: ::c_long = 184;
+pub const SYS_capset: ::c_long = 185;
+pub const SYS_sigaltstack: ::c_long = 186;
+pub const SYS_sendfile: ::c_long = 187;
+pub const SYS_getpmsg: ::c_long = 188;
+pub const SYS_putpmsg: ::c_long = 189;
+pub const SYS_vfork: ::c_long = 190;
+pub const SYS_ugetrlimit: ::c_long = 191;
+pub const SYS_mmap2: ::c_long = 192;
+pub const SYS_truncate64: ::c_long = 193;
+pub const SYS_ftruncate64: ::c_long = 194;
+pub const SYS_stat64: ::c_long = 195;
+pub const SYS_lstat64: ::c_long = 196;
+pub const SYS_fstat64: ::c_long = 197;
+pub const SYS_lchown32: ::c_long = 198;
+pub const SYS_getuid32: ::c_long = 199;
+pub const SYS_getgid32: ::c_long = 200;
+pub const SYS_geteuid32: ::c_long = 201;
+pub const SYS_getegid32: ::c_long = 202;
+pub const SYS_setreuid32: ::c_long = 203;
+pub const SYS_setregid32: ::c_long = 204;
+pub const SYS_getgroups32: ::c_long = 205;
+pub const SYS_setgroups32: ::c_long = 206;
+pub const SYS_fchown32: ::c_long = 207;
+pub const SYS_setresuid32: ::c_long = 208;
+pub const SYS_getresuid32: ::c_long = 209;
+pub const SYS_setresgid32: ::c_long = 210;
+pub const SYS_getresgid32: ::c_long = 211;
+pub const SYS_chown32: ::c_long = 212;
+pub const SYS_setuid32: ::c_long = 213;
+pub const SYS_setgid32: ::c_long = 214;
+pub const SYS_setfsuid32: ::c_long = 215;
+pub const SYS_setfsgid32: ::c_long = 216;
+pub const SYS_pivot_root: ::c_long = 217;
+pub const SYS_mincore: ::c_long = 218;
+pub const SYS_madvise: ::c_long = 219;
+pub const SYS_getdents64: ::c_long = 220;
+pub const SYS_fcntl64: ::c_long = 221;
+pub const SYS_gettid: ::c_long = 224;
+pub const SYS_readahead: ::c_long = 225;
+pub const SYS_setxattr: ::c_long = 226;
+pub const SYS_lsetxattr: ::c_long = 227;
+pub const SYS_fsetxattr: ::c_long = 228;
+pub const SYS_getxattr: ::c_long = 229;
+pub const SYS_lgetxattr: ::c_long = 230;
+pub const SYS_fgetxattr: ::c_long = 231;
+pub const SYS_listxattr: ::c_long = 232;
+pub const SYS_llistxattr: ::c_long = 233;
+pub const SYS_flistxattr: ::c_long = 234;
+pub const SYS_removexattr: ::c_long = 235;
+pub const SYS_lremovexattr: ::c_long = 236;
+pub const SYS_fremovexattr: ::c_long = 237;
+pub const SYS_tkill: ::c_long = 238;
+pub const SYS_sendfile64: ::c_long = 239;
+pub const SYS_futex: ::c_long = 240;
+pub const SYS_sched_setaffinity: ::c_long = 241;
+pub const SYS_sched_getaffinity: ::c_long = 242;
+pub const SYS_set_thread_area: ::c_long = 243;
+pub const SYS_get_thread_area: ::c_long = 244;
+pub const SYS_io_setup: ::c_long = 245;
+pub const SYS_io_destroy: ::c_long = 246;
+pub const SYS_io_getevents: ::c_long = 247;
+pub const SYS_io_submit: ::c_long = 248;
+pub const SYS_io_cancel: ::c_long = 249;
+pub const SYS_fadvise64: ::c_long = 250;
+pub const SYS_exit_group: ::c_long = 252;
+pub const SYS_lookup_dcookie: ::c_long = 253;
+pub const SYS_epoll_create: ::c_long = 254;
+pub const SYS_epoll_ctl: ::c_long = 255;
+pub const SYS_epoll_wait: ::c_long = 256;
+pub const SYS_remap_file_pages: ::c_long = 257;
+pub const SYS_set_tid_address: ::c_long = 258;
+pub const SYS_timer_create: ::c_long = 259;
+pub const SYS_timer_settime: ::c_long = 260;
+pub const SYS_timer_gettime: ::c_long = 261;
+pub const SYS_timer_getoverrun: ::c_long = 262;
+pub const SYS_timer_delete: ::c_long = 263;
+pub const SYS_clock_settime: ::c_long = 264;
+pub const SYS_clock_gettime: ::c_long = 265;
+pub const SYS_clock_getres: ::c_long = 266;
+pub const SYS_clock_nanosleep: ::c_long = 267;
+pub const SYS_statfs64: ::c_long = 268;
+pub const SYS_fstatfs64: ::c_long = 269;
+pub const SYS_tgkill: ::c_long = 270;
+pub const SYS_utimes: ::c_long = 271;
+pub const SYS_fadvise64_64: ::c_long = 272;
+pub const SYS_vserver: ::c_long = 273;
+pub const SYS_mbind: ::c_long = 274;
+pub const SYS_get_mempolicy: ::c_long = 275;
+pub const SYS_set_mempolicy: ::c_long = 276;
+pub const SYS_mq_open: ::c_long = 277;
+pub const SYS_mq_unlink: ::c_long = 278;
+pub const SYS_mq_timedsend: ::c_long = 279;
+pub const SYS_mq_timedreceive: ::c_long = 280;
+pub const SYS_mq_notify: ::c_long = 281;
+pub const SYS_mq_getsetattr: ::c_long = 282;
+pub const SYS_kexec_load: ::c_long = 283;
+pub const SYS_waitid: ::c_long = 284;
+pub const SYS_add_key: ::c_long = 286;
+pub const SYS_request_key: ::c_long = 287;
+pub const SYS_keyctl: ::c_long = 288;
+pub const SYS_ioprio_set: ::c_long = 289;
+pub const SYS_ioprio_get: ::c_long = 290;
+pub const SYS_inotify_init: ::c_long = 291;
+pub const SYS_inotify_add_watch: ::c_long = 292;
+pub const SYS_inotify_rm_watch: ::c_long = 293;
+pub const SYS_migrate_pages: ::c_long = 294;
+pub const SYS_openat: ::c_long = 295;
+pub const SYS_mkdirat: ::c_long = 296;
+pub const SYS_mknodat: ::c_long = 297;
+pub const SYS_fchownat: ::c_long = 298;
+pub const SYS_futimesat: ::c_long = 299;
+pub const SYS_fstatat64: ::c_long = 300;
+pub const SYS_unlinkat: ::c_long = 301;
+pub const SYS_renameat: ::c_long = 302;
+pub const SYS_linkat: ::c_long = 303;
+pub const SYS_symlinkat: ::c_long = 304;
+pub const SYS_readlinkat: ::c_long = 305;
+pub const SYS_fchmodat: ::c_long = 306;
+pub const SYS_faccessat: ::c_long = 307;
+pub const SYS_pselect6: ::c_long = 308;
+pub const SYS_ppoll: ::c_long = 309;
+pub const SYS_unshare: ::c_long = 310;
+pub const SYS_set_robust_list: ::c_long = 311;
+pub const SYS_get_robust_list: ::c_long = 312;
+pub const SYS_splice: ::c_long = 313;
+pub const SYS_sync_file_range: ::c_long = 314;
+pub const SYS_tee: ::c_long = 315;
+pub const SYS_vmsplice: ::c_long = 316;
+pub const SYS_move_pages: ::c_long = 317;
+pub const SYS_getcpu: ::c_long = 318;
+pub const SYS_epoll_pwait: ::c_long = 319;
+pub const SYS_utimensat: ::c_long = 320;
+pub const SYS_signalfd: ::c_long = 321;
+pub const SYS_timerfd_create: ::c_long = 322;
+pub const SYS_eventfd: ::c_long = 323;
+pub const SYS_fallocate: ::c_long = 324;
+pub const SYS_timerfd_settime: ::c_long = 325;
+pub const SYS_timerfd_gettime: ::c_long = 326;
+pub const SYS_signalfd4: ::c_long = 327;
+pub const SYS_eventfd2: ::c_long = 328;
+pub const SYS_epoll_create1: ::c_long = 329;
+pub const SYS_dup3: ::c_long = 330;
+pub const SYS_pipe2: ::c_long = 331;
+pub const SYS_inotify_init1: ::c_long = 332;
+pub const SYS_preadv: ::c_long = 333;
+pub const SYS_pwritev: ::c_long = 334;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 335;
+pub const SYS_perf_event_open: ::c_long = 336;
+pub const SYS_recvmmsg: ::c_long = 337;
+pub const SYS_fanotify_init: ::c_long = 338;
+pub const SYS_fanotify_mark: ::c_long = 339;
+pub const SYS_prlimit64: ::c_long = 340;
+pub const SYS_name_to_handle_at: ::c_long = 341;
+pub const SYS_open_by_handle_at: ::c_long = 342;
+pub const SYS_clock_adjtime: ::c_long = 343;
+pub const SYS_syncfs: ::c_long = 344;
+pub const SYS_sendmmsg: ::c_long = 345;
+pub const SYS_setns: ::c_long = 346;
+pub const SYS_process_vm_readv: ::c_long = 347;
+pub const SYS_process_vm_writev: ::c_long = 348;
+pub const SYS_kcmp: ::c_long = 349;
+pub const SYS_finit_module: ::c_long = 350;
+pub const SYS_sched_setattr: ::c_long = 351;
+pub const SYS_sched_getattr: ::c_long = 352;
+pub const SYS_renameat2: ::c_long = 353;
+pub const SYS_seccomp: ::c_long = 354;
+pub const SYS_getrandom: ::c_long = 355;
+pub const SYS_memfd_create: ::c_long = 356;
+pub const SYS_bpf: ::c_long = 357;
+pub const SYS_execveat: ::c_long = 358;
+pub const SYS_socket: ::c_long = 359;
+pub const SYS_socketpair: ::c_long = 360;
+pub const SYS_bind: ::c_long = 361;
+pub const SYS_connect: ::c_long = 362;
+pub const SYS_listen: ::c_long = 363;
+pub const SYS_accept4: ::c_long = 364;
+pub const SYS_getsockopt: ::c_long = 365;
+pub const SYS_setsockopt: ::c_long = 366;
+pub const SYS_getsockname: ::c_long = 367;
+pub const SYS_getpeername: ::c_long = 368;
+pub const SYS_sendto: ::c_long = 369;
+pub const SYS_sendmsg: ::c_long = 370;
+pub const SYS_recvfrom: ::c_long = 371;
+pub const SYS_recvmsg: ::c_long = 372;
+pub const SYS_shutdown: ::c_long = 373;
+pub const SYS_userfaultfd: ::c_long = 374;
+pub const SYS_membarrier: ::c_long = 375;
+pub const SYS_mlock2: ::c_long = 376;
+pub const SYS_copy_file_range: ::c_long = 377;
+pub const SYS_preadv2: ::c_long = 378;
+pub const SYS_pwritev2: ::c_long = 379;
+// FIXME syscalls 380-382 have been added in musl 1.16
+// See discussion https://github.com/rust-lang/libc/pull/699
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const EBX: ::c_int = 0;
+pub const ECX: ::c_int = 1;
+pub const EDX: ::c_int = 2;
+pub const ESI: ::c_int = 3;
+pub const EDI: ::c_int = 4;
+pub const EBP: ::c_int = 5;
+pub const EAX: ::c_int = 6;
+pub const DS: ::c_int = 7;
+pub const ES: ::c_int = 8;
+pub const FS: ::c_int = 9;
+pub const GS: ::c_int = 10;
+pub const ORIG_EAX: ::c_int = 11;
+pub const EIP: ::c_int = 12;
+pub const CS: ::c_int = 13;
+pub const EFL: ::c_int = 14;
+pub const UESP: ::c_int = 15;
+pub const SS: ::c_int = 16;
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs
@@ -1,3 +1,7 @@
 pub type c_char = u8;
+pub type __u64 = ::c_ulonglong;
 
+pub const SYS_pivot_root: ::c_long = 41;
+pub const SYS_gettid: ::c_long = 178;
 pub const SYS_perf_event_open: ::c_long = 241;
+pub const SYS_memfd_create: ::c_long = 279;
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/b64/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/b64/mod.rs
@@ -41,16 +41,46 @@ s! {
         pub st_atime_nsec: ::c_long,
         pub st_mtime: ::time_t,
         pub st_mtime_nsec: ::c_long,
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         __reserved: [::c_long; 3],
     }
 
+    pub struct statfs64 {
+        pub f_type: ::c_ulong,
+        pub f_bsize: ::c_ulong,
+        pub f_blocks: ::fsblkcnt_t,
+        pub f_bfree: ::fsblkcnt_t,
+        pub f_bavail: ::fsblkcnt_t,
+        pub f_files: ::fsfilcnt_t,
+        pub f_ffree: ::fsfilcnt_t,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_flags: ::c_ulong,
+        pub f_spare: [::c_ulong; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct stack_t {
         pub ss_sp: *mut ::c_void,
         pub ss_flags: ::c_int,
         pub ss_size: ::size_t
     }
 
     pub struct pthread_attr_t {
         __size: [u64; 7]
@@ -136,16 +166,17 @@ s! {
 
 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
 
 pub const O_DIRECT: ::c_int = 0x4000;
 pub const O_DIRECTORY: ::c_int = 0x10000;
 pub const O_NOFOLLOW: ::c_int = 0x20000;
 pub const O_ASYNC: ::c_int = 0x2000;
+pub const O_LARGEFILE: ::c_int = 0;
 
 pub const FIOCLEX: ::c_int = 0x5451;
 pub const FIONBIO: ::c_int = 0x5421;
 
 pub const RLIMIT_RSS: ::c_int = 5;
 pub const RLIMIT_NOFILE: ::c_int = 7;
 pub const RLIMIT_AS: ::c_int = 9;
 pub const RLIMIT_NPROC: ::c_int = 6;
@@ -366,16 +397,28 @@ pub const TIOCMBIS: ::c_int = 0x5416;
 pub const TIOCMBIC: ::c_int = 0x5417;
 pub const TIOCMSET: ::c_int = 0x5418;
 pub const FIONREAD: ::c_int = 0x541B;
 pub const TIOCCONS: ::c_int = 0x541D;
 
 pub const POLLWRNORM: ::c_short = 0x100;
 pub const POLLWRBAND: ::c_short = 0x200;
 
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
 cfg_if! {
     if #[cfg(target_arch = "aarch64")] {
         mod aarch64;
         pub use self::aarch64::*;
     } else if #[cfg(any(target_arch = "powerpc64"))] {
         mod powerpc64;
         pub use self::powerpc64::*;
     } else if #[cfg(any(target_arch = "x86_64"))] {
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs
@@ -1,3 +1,7 @@
 pub type c_char = u8;
+pub type __u64 = ::c_ulong;
 
+pub const SYS_pivot_root: ::c_long = 203;
+pub const SYS_gettid: ::c_long = 207;
 pub const SYS_perf_event_open: ::c_long = 319;
+pub const SYS_memfd_create: ::c_long = 360;
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs
@@ -1,20 +1,380 @@
 pub type c_char = i8;
+pub type __u64 = ::c_ulonglong;
 
 s! {
     pub struct mcontext_t {
         __private: [u64; 32],
     }
 
     pub struct ucontext_t {
         pub uc_flags: ::c_ulong,
         pub uc_link: *mut ucontext_t,
         pub uc_stack: ::stack_t,
         pub uc_mcontext: mcontext_t,
         pub uc_sigmask: ::sigset_t,
         __private: [u8; 512],
     }
 }
 
-pub const SYS_gettid: ::c_long = 186;
+// Syscall table
 
+pub const SYS_read: ::c_long = 0;
+pub const SYS_write: ::c_long = 1;
+pub const SYS_open: ::c_long = 2;
+pub const SYS_close: ::c_long = 3;
+pub const SYS_stat: ::c_long = 4;
+pub const SYS_fstat: ::c_long = 5;
+pub const SYS_lstat: ::c_long = 6;
+pub const SYS_poll: ::c_long = 7;
+pub const SYS_lseek: ::c_long = 8;
+pub const SYS_mmap: ::c_long = 9;
+pub const SYS_mprotect: ::c_long = 10;
+pub const SYS_munmap: ::c_long = 11;
+pub const SYS_brk: ::c_long = 12;
+pub const SYS_rt_sigaction: ::c_long = 13;
+pub const SYS_rt_sigprocmask: ::c_long = 14;
+pub const SYS_rt_sigreturn: ::c_long = 15;
+pub const SYS_ioctl: ::c_long = 16;
+pub const SYS_pread64: ::c_long = 17;
+pub const SYS_pwrite64: ::c_long = 18;
+pub const SYS_readv: ::c_long = 19;
+pub const SYS_writev: ::c_long = 20;
+pub const SYS_access: ::c_long = 21;
+pub const SYS_pipe: ::c_long = 22;
+pub const SYS_select: ::c_long = 23;
+pub const SYS_sched_yield: ::c_long = 24;
+pub const SYS_mremap: ::c_long = 25;
+pub const SYS_msync: ::c_long = 26;
+pub const SYS_mincore: ::c_long = 27;
+pub const SYS_madvise: ::c_long = 28;
+pub const SYS_shmget: ::c_long = 29;
+pub const SYS_shmat: ::c_long = 30;
+pub const SYS_shmctl: ::c_long = 31;
+pub const SYS_dup: ::c_long = 32;
+pub const SYS_dup2: ::c_long = 33;
+pub const SYS_pause: ::c_long = 34;
+pub const SYS_nanosleep: ::c_long = 35;
+pub const SYS_getitimer: ::c_long = 36;
+pub const SYS_alarm: ::c_long = 37;
+pub const SYS_setitimer: ::c_long = 38;
+pub const SYS_getpid: ::c_long = 39;
+pub const SYS_sendfile: ::c_long = 40;
+pub const SYS_socket: ::c_long = 41;
+pub const SYS_connect: ::c_long = 42;
+pub const SYS_accept: ::c_long = 43;
+pub const SYS_sendto: ::c_long = 44;
+pub const SYS_recvfrom: ::c_long = 45;
+pub const SYS_sendmsg: ::c_long = 46;
+pub const SYS_recvmsg: ::c_long = 47;
+pub const SYS_shutdown: ::c_long = 48;
+pub const SYS_bind: ::c_long = 49;
+pub const SYS_listen: ::c_long = 50;
+pub const SYS_getsockname: ::c_long = 51;
+pub const SYS_getpeername: ::c_long = 52;
+pub const SYS_socketpair: ::c_long = 53;
+pub const SYS_setsockopt: ::c_long = 54;
+pub const SYS_getsockopt: ::c_long = 55;
+pub const SYS_clone: ::c_long = 56;
+pub const SYS_fork: ::c_long = 57;
+pub const SYS_vfork: ::c_long = 58;
+pub const SYS_execve: ::c_long = 59;
+pub const SYS_exit: ::c_long = 60;
+pub const SYS_wait4: ::c_long = 61;
+pub const SYS_kill: ::c_long = 62;
+pub const SYS_uname: ::c_long = 63;
+pub const SYS_semget: ::c_long = 64;
+pub const SYS_semop: ::c_long = 65;
+pub const SYS_semctl: ::c_long = 66;
+pub const SYS_shmdt: ::c_long = 67;
+pub const SYS_msgget: ::c_long = 68;
+pub const SYS_msgsnd: ::c_long = 69;
+pub const SYS_msgrcv: ::c_long = 70;
+pub const SYS_msgctl: ::c_long = 71;
+pub const SYS_fcntl: ::c_long = 72;
+pub const SYS_flock: ::c_long = 73;
+pub const SYS_fsync: ::c_long = 74;
+pub const SYS_fdatasync: ::c_long = 75;
+pub const SYS_truncate: ::c_long = 76;
+pub const SYS_ftruncate: ::c_long = 77;
+pub const SYS_getdents: ::c_long = 78;
+pub const SYS_getcwd: ::c_long = 79;
+pub const SYS_chdir: ::c_long = 80;
+pub const SYS_fchdir: ::c_long = 81;
+pub const SYS_rename: ::c_long = 82;
+pub const SYS_mkdir: ::c_long = 83;
+pub const SYS_rmdir: ::c_long = 84;
+pub const SYS_creat: ::c_long = 85;
+pub const SYS_link: ::c_long = 86;
+pub const SYS_unlink: ::c_long = 87;
+pub const SYS_symlink: ::c_long = 88;
+pub const SYS_readlink: ::c_long = 89;
+pub const SYS_chmod: ::c_long = 90;
+pub const SYS_fchmod: ::c_long = 91;
+pub const SYS_chown: ::c_long = 92;
+pub const SYS_fchown: ::c_long = 93;
+pub const SYS_lchown: ::c_long = 94;
+pub const SYS_umask: ::c_long = 95;
+pub const SYS_gettimeofday: ::c_long = 96;
+pub const SYS_getrlimit: ::c_long = 97;
+pub const SYS_getrusage: ::c_long = 98;
+pub const SYS_sysinfo: ::c_long = 99;
+pub const SYS_times: ::c_long = 100;
+pub const SYS_ptrace: ::c_long = 101;
+pub const SYS_getuid: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_getgid: ::c_long = 104;
+pub const SYS_setuid: ::c_long = 105;
+pub const SYS_setgid: ::c_long = 106;
+pub const SYS_geteuid: ::c_long = 107;
+pub const SYS_getegid: ::c_long = 108;
+pub const SYS_setpgid: ::c_long = 109;
+pub const SYS_getppid: ::c_long = 110;
+pub const SYS_getpgrp: ::c_long = 111;
+pub const SYS_setsid: ::c_long = 112;
+pub const SYS_setreuid: ::c_long = 113;
+pub const SYS_setregid: ::c_long = 114;
+pub const SYS_getgroups: ::c_long = 115;
+pub const SYS_setgroups: ::c_long = 116;
+pub const SYS_setresuid: ::c_long = 117;
+pub const SYS_getresuid: ::c_long = 118;
+pub const SYS_setresgid: ::c_long = 119;
+pub const SYS_getresgid: ::c_long = 120;
+pub const SYS_getpgid: ::c_long = 121;
+pub const SYS_setfsuid: ::c_long = 122;
+pub const SYS_setfsgid: ::c_long = 123;
+pub const SYS_getsid: ::c_long = 124;
+pub const SYS_capget: ::c_long = 125;
+pub const SYS_capset: ::c_long = 126;
+pub const SYS_rt_sigpending: ::c_long = 127;
+pub const SYS_rt_sigtimedwait: ::c_long = 128;
+pub const SYS_rt_sigqueueinfo: ::c_long = 129;
+pub const SYS_rt_sigsuspend: ::c_long = 130;
+pub const SYS_sigaltstack: ::c_long = 131;
+pub const SYS_utime: ::c_long = 132;
+pub const SYS_mknod: ::c_long = 133;
+pub const SYS_uselib: ::c_long = 134;
+pub const SYS_personality: ::c_long = 135;
+pub const SYS_ustat: ::c_long = 136;
+pub const SYS_statfs: ::c_long = 137;
+pub const SYS_fstatfs: ::c_long = 138;
+pub const SYS_sysfs: ::c_long = 139;
+pub const SYS_getpriority: ::c_long = 140;
+pub const SYS_setpriority: ::c_long = 141;
+pub const SYS_sched_setparam: ::c_long = 142;
+pub const SYS_sched_getparam: ::c_long = 143;
+pub const SYS_sched_setscheduler: ::c_long = 144;
+pub const SYS_sched_getscheduler: ::c_long = 145;
+pub const SYS_sched_get_priority_max: ::c_long = 146;
+pub const SYS_sched_get_priority_min: ::c_long = 147;
+pub const SYS_sched_rr_get_interval: ::c_long = 148;
+pub const SYS_mlock: ::c_long = 149;
+pub const SYS_munlock: ::c_long = 150;
+pub const SYS_mlockall: ::c_long = 151;
+pub const SYS_munlockall: ::c_long = 152;
+pub const SYS_vhangup: ::c_long = 153;
+pub const SYS_modify_ldt: ::c_long = 154;
+pub const SYS_pivot_root: ::c_long = 155;
+pub const SYS__sysctl: ::c_long = 156;
+pub const SYS_prctl: ::c_long = 157;
+pub const SYS_arch_prctl: ::c_long = 158;
+pub const SYS_adjtimex: ::c_long = 159;
+pub const SYS_setrlimit: ::c_long = 160;
+pub const SYS_chroot: ::c_long = 161;
+pub const SYS_sync: ::c_long = 162;
+pub const SYS_acct: ::c_long = 163;
+pub const SYS_settimeofday: ::c_long = 164;
+pub const SYS_mount: ::c_long = 165;
+pub const SYS_umount2: ::c_long = 166;
+pub const SYS_swapon: ::c_long = 167;
+pub const SYS_swapoff: ::c_long = 168;
+pub const SYS_reboot: ::c_long = 169;
+pub const SYS_sethostname: ::c_long = 170;
+pub const SYS_setdomainname: ::c_long = 171;
+pub const SYS_iopl: ::c_long = 172;
+pub const SYS_ioperm: ::c_long = 173;
+pub const SYS_create_module: ::c_long = 174;
+pub const SYS_init_module: ::c_long = 175;
+pub const SYS_delete_module: ::c_long = 176;
+pub const SYS_get_kernel_syms: ::c_long = 177;
+pub const SYS_query_module: ::c_long = 178;
+pub const SYS_quotactl: ::c_long = 179;
+pub const SYS_nfsservctl: ::c_long = 180;
+pub const SYS_getpmsg: ::c_long = 181;
+pub const SYS_putpmsg: ::c_long = 182;
+pub const SYS_afs_syscall: ::c_long = 183;
+pub const SYS_tuxcall: ::c_long = 184;
+pub const SYS_security: ::c_long = 185;
+pub const SYS_gettid: ::c_long = 186;
+pub const SYS_readahead: ::c_long = 187;
+pub const SYS_setxattr: ::c_long = 188;
+pub const SYS_lsetxattr: ::c_long = 189;
+pub const SYS_fsetxattr: ::c_long = 190;
+pub const SYS_getxattr: ::c_long = 191;
+pub const SYS_lgetxattr: ::c_long = 192;
+pub const SYS_fgetxattr: ::c_long = 193;
+pub const SYS_listxattr: ::c_long = 194;
+pub const SYS_llistxattr: ::c_long = 195;
+pub const SYS_flistxattr: ::c_long = 196;
+pub const SYS_removexattr: ::c_long = 197;
+pub const SYS_lremovexattr: ::c_long = 198;
+pub const SYS_fremovexattr: ::c_long = 199;
+pub const SYS_tkill: ::c_long = 200;
+pub const SYS_time: ::c_long = 201;
+pub const SYS_futex: ::c_long = 202;
+pub const SYS_sched_setaffinity: ::c_long = 203;
+pub const SYS_sched_getaffinity: ::c_long = 204;
+pub const SYS_set_thread_area: ::c_long = 205;
+pub const SYS_io_setup: ::c_long = 206;
+pub const SYS_io_destroy: ::c_long = 207;
+pub const SYS_io_getevents: ::c_long = 208;
+pub const SYS_io_submit: ::c_long = 209;
+pub const SYS_io_cancel: ::c_long = 210;
+pub const SYS_get_thread_area: ::c_long = 211;
+pub const SYS_lookup_dcookie: ::c_long = 212;
+pub const SYS_epoll_create: ::c_long = 213;
+pub const SYS_epoll_ctl_old: ::c_long = 214;
+pub const SYS_epoll_wait_old: ::c_long = 215;
+pub const SYS_remap_file_pages: ::c_long = 216;
+pub const SYS_getdents64: ::c_long = 217;
+pub const SYS_set_tid_address: ::c_long = 218;
+pub const SYS_restart_syscall: ::c_long = 219;
+pub const SYS_semtimedop: ::c_long = 220;
+pub const SYS_fadvise64: ::c_long = 221;
+pub const SYS_timer_create: ::c_long = 222;
+pub const SYS_timer_settime: ::c_long = 223;
+pub const SYS_timer_gettime: ::c_long = 224;
+pub const SYS_timer_getoverrun: ::c_long = 225;
+pub const SYS_timer_delete: ::c_long = 226;
+pub const SYS_clock_settime: ::c_long = 227;
+pub const SYS_clock_gettime: ::c_long = 228;
+pub const SYS_clock_getres: ::c_long = 229;
+pub const SYS_clock_nanosleep: ::c_long = 230;
+pub const SYS_exit_group: ::c_long = 231;
+pub const SYS_epoll_wait: ::c_long = 232;
+pub const SYS_epoll_ctl: ::c_long = 233;
+pub const SYS_tgkill: ::c_long = 234;
+pub const SYS_utimes: ::c_long = 235;
+pub const SYS_vserver: ::c_long = 236;
+pub const SYS_mbind: ::c_long = 237;
+pub const SYS_set_mempolicy: ::c_long = 238;
+pub const SYS_get_mempolicy: ::c_long = 239;
+pub const SYS_mq_open: ::c_long = 240;
+pub const SYS_mq_unlink: ::c_long = 241;
+pub const SYS_mq_timedsend: ::c_long = 242;
+pub const SYS_mq_timedreceive: ::c_long = 243;
+pub const SYS_mq_notify: ::c_long = 244;
+pub const SYS_mq_getsetattr: ::c_long = 245;
+pub const SYS_kexec_load: ::c_long = 246;
+pub const SYS_waitid: ::c_long = 247;
+pub const SYS_add_key: ::c_long = 248;
+pub const SYS_request_key: ::c_long = 249;
+pub const SYS_keyctl: ::c_long = 250;
+pub const SYS_ioprio_set: ::c_long = 251;
+pub const SYS_ioprio_get: ::c_long = 252;
+pub const SYS_inotify_init: ::c_long = 253;
+pub const SYS_inotify_add_watch: ::c_long = 254;
+pub const SYS_inotify_rm_watch: ::c_long = 255;
+pub const SYS_migrate_pages: ::c_long = 256;
+pub const SYS_openat: ::c_long = 257;
+pub const SYS_mkdirat: ::c_long = 258;
+pub const SYS_mknodat: ::c_long = 259;
+pub const SYS_fchownat: ::c_long = 260;
+pub const SYS_futimesat: ::c_long = 261;
+pub const SYS_newfstatat: ::c_long = 262;
+pub const SYS_unlinkat: ::c_long = 263;
+pub const SYS_renameat: ::c_long = 264;
+pub const SYS_linkat: ::c_long = 265;
+pub const SYS_symlinkat: ::c_long = 266;
+pub const SYS_readlinkat: ::c_long = 267;
+pub const SYS_fchmodat: ::c_long = 268;
+pub const SYS_faccessat: ::c_long = 269;
+pub const SYS_pselect6: ::c_long = 270;
+pub const SYS_ppoll: ::c_long = 271;
+pub const SYS_unshare: ::c_long = 272;
+pub const SYS_set_robust_list: ::c_long = 273;
+pub const SYS_get_robust_list: ::c_long = 274;
+pub const SYS_splice: ::c_long = 275;
+pub const SYS_tee: ::c_long = 276;
+pub const SYS_sync_file_range: ::c_long = 277;
+pub const SYS_vmsplice: ::c_long = 278;
+pub const SYS_move_pages: ::c_long = 279;
+pub const SYS_utimensat: ::c_long = 280;
+pub const SYS_epoll_pwait: ::c_long = 281;
+pub const SYS_signalfd: ::c_long = 282;
+pub const SYS_timerfd_create: ::c_long = 283;
+pub const SYS_eventfd: ::c_long = 284;
+pub const SYS_fallocate: ::c_long = 285;
+pub const SYS_timerfd_settime: ::c_long = 286;
+pub const SYS_timerfd_gettime: ::c_long = 287;
+pub const SYS_accept4: ::c_long = 288;
+pub const SYS_signalfd4: ::c_long = 289;
+pub const SYS_eventfd2: ::c_long = 290;
+pub const SYS_epoll_create1: ::c_long = 291;
+pub const SYS_dup3: ::c_long = 292;
+pub const SYS_pipe2: ::c_long = 293;
+pub const SYS_inotify_init1: ::c_long = 294;
+pub const SYS_preadv: ::c_long = 295;
+pub const SYS_pwritev: ::c_long = 296;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 297;
 pub const SYS_perf_event_open: ::c_long = 298;
+pub const SYS_recvmmsg: ::c_long = 299;
+pub const SYS_fanotify_init: ::c_long = 300;
+pub const SYS_fanotify_mark: ::c_long = 301;
+pub const SYS_prlimit64: ::c_long = 302;
+pub const SYS_name_to_handle_at: ::c_long = 303;
+pub const SYS_open_by_handle_at: ::c_long = 304;
+pub const SYS_clock_adjtime: ::c_long = 305;
+pub const SYS_syncfs: ::c_long = 306;
+pub const SYS_sendmmsg: ::c_long = 307;
+pub const SYS_setns: ::c_long = 308;
+pub const SYS_getcpu: ::c_long = 309;
+pub const SYS_process_vm_readv: ::c_long = 310;
+pub const SYS_process_vm_writev: ::c_long = 311;
+pub const SYS_kcmp: ::c_long = 312;
+pub const SYS_finit_module: ::c_long = 313;
+pub const SYS_sched_setattr: ::c_long = 314;
+pub const SYS_sched_getattr: ::c_long = 315;
+pub const SYS_renameat2: ::c_long = 316;
+pub const SYS_seccomp: ::c_long = 317;
+pub const SYS_getrandom: ::c_long = 318;
+pub const SYS_memfd_create: ::c_long = 319;
+pub const SYS_kexec_file_load: ::c_long = 320;
+pub const SYS_bpf: ::c_long = 321;
+pub const SYS_execveat: ::c_long = 322;
+pub const SYS_userfaultfd: ::c_long = 323;
+pub const SYS_membarrier: ::c_long = 324;
+pub const SYS_mlock2: ::c_long = 325;
+pub const SYS_copy_file_range: ::c_long = 326;
+pub const SYS_preadv2: ::c_long = 327;
+pub const SYS_pwritev2: ::c_long = 328;
+// FIXME syscalls 329-331 have been added in musl 1.16
+// See discussion https://github.com/rust-lang/libc/pull/699
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const R15: ::c_int = 0;
+pub const R14: ::c_int = 1;
+pub const R13: ::c_int = 2;
+pub const R12: ::c_int = 3;
+pub const RBP: ::c_int = 4;
+pub const RBX: ::c_int = 5;
+pub const R11: ::c_int = 6;
+pub const R10: ::c_int = 7;
+pub const R9: ::c_int = 8;
+pub const R8: ::c_int = 9;
+pub const RAX: ::c_int = 10;
+pub const RCX: ::c_int = 11;
+pub const RDX: ::c_int = 12;
+pub const RSI: ::c_int = 13;
+pub const RDI: ::c_int = 14;
+pub const ORIG_RAX: ::c_int = 15;
+pub const RIP: ::c_int = 16;
+pub const CS: ::c_int = 17;
+pub const EFLAGS: ::c_int = 18;
+pub const RSP: ::c_int = 19;
+pub const SS: ::c_int = 20;
+pub const FS_BASE: ::c_int = 21;
+pub const GS_BASE: ::c_int = 22;
+pub const DS: ::c_int = 23;
+pub const ES: ::c_int = 24;
+pub const FS: ::c_int = 25;
+pub const GS: ::c_int = 26;
--- a/third_party/rust/libc/src/unix/notbsd/linux/musl/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/musl/mod.rs
@@ -82,24 +82,22 @@ s! {
         pub pad: ::c_ushort,
         pub totalhigh: ::c_ulong,
         pub freehigh: ::c_ulong,
         pub mem_unit: ::c_uint,
         pub __reserved: [::c_char; 256],
     }
 }
 
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
 pub const SFD_CLOEXEC: ::c_int = 0x080000;
 
 pub const NCCS: usize = 32;
 
 pub const O_TRUNC: ::c_int = 512;
-
+pub const O_NOATIME: ::c_int = 0o1000000;
 pub const O_CLOEXEC: ::c_int = 0x80000;
 
 pub const EBFONT: ::c_int = 59;
 pub const ENOSTR: ::c_int = 60;
 pub const ENODATA: ::c_int = 61;
 pub const ETIME: ::c_int = 62;
 pub const ENOSR: ::c_int = 63;
 pub const ENONET: ::c_int = 64;
@@ -150,78 +148,56 @@ pub const TCP_REPAIR: ::c_int = 19;
 pub const TCP_REPAIR_QUEUE: ::c_int = 20;
 pub const TCP_QUEUE_SEQ: ::c_int = 21;
 pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
 pub const TCP_FASTOPEN: ::c_int = 23;
 pub const TCP_TIMESTAMP: ::c_int = 24;
 
 pub const SIGUNUSED: ::c_int = ::SIGSYS;
 
-pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
-pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
-
 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
 
 pub const CPU_SETSIZE: ::c_int = 128;
 
 pub const QFMT_VFS_V1: ::c_int = 4;
 
 pub const PTRACE_TRACEME: ::c_int = 0;
 pub const PTRACE_PEEKTEXT: ::c_int = 1;
 pub const PTRACE_PEEKDATA: ::c_int = 2;
 pub const PTRACE_PEEKUSER: ::c_int = 3;
 pub const PTRACE_POKETEXT: ::c_int = 4;
 pub const PTRACE_POKEDATA: ::c_int = 5;
 pub const PTRACE_POKEUSER: ::c_int = 6;
 pub const PTRACE_CONT: ::c_int = 7;
 pub const PTRACE_KILL: ::c_int = 8;
 pub const PTRACE_SINGLESTEP: ::c_int = 9;
+pub const PTRACE_GETREGS: ::c_int = 12;
+pub const PTRACE_SETREGS: ::c_int = 13;
+pub const PTRACE_GETFPREGS: ::c_int = 14;
+pub const PTRACE_SETFPREGS: ::c_int = 15;
 pub const PTRACE_ATTACH: ::c_int = 16;
 pub const PTRACE_DETACH: ::c_int = 17;
+pub const PTRACE_GETFPXREGS: ::c_int = 18;
+pub const PTRACE_SETFPXREGS: ::c_int = 19;
 pub const PTRACE_SYSCALL: ::c_int = 24;
 pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
 pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
 pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
 pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
 pub const PTRACE_GETREGSET: ::c_int = 0x4204;
 pub const PTRACE_SETREGSET: ::c_int = 0x4205;
 pub const PTRACE_SEIZE: ::c_int = 0x4206;
 pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
 pub const PTRACE_LISTEN: ::c_int = 0x4208;
 pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
 
-pub const PTRACE_O_EXITKILL: ::c_int = 1048576;
-pub const PTRACE_O_TRACECLONE: ::c_int = 8;
-pub const PTRACE_O_TRACEEXEC: ::c_int = 16;
-pub const PTRACE_O_TRACEEXIT: ::c_int = 64;
-pub const PTRACE_O_TRACEFORK: ::c_int = 2;
-pub const PTRACE_O_TRACESYSGOOD: ::c_int = 1;
-pub const PTRACE_O_TRACEVFORK: ::c_int = 4;
-pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 32;
-pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 2097152;
-
-pub const MADV_DODUMP: ::c_int = 17;
-pub const MADV_DONTDUMP: ::c_int = 16;
-
 pub const EPOLLWAKEUP: ::c_int = 0x20000000;
 
-pub const POLLRDNORM: ::c_short = 0x040;
-pub const POLLRDBAND: ::c_short = 0x080;
-
-pub const MADV_HUGEPAGE: ::c_int = 14;
-pub const MADV_NOHUGEPAGE: ::c_int = 15;
-
-pub const PTRACE_GETFPREGS: ::c_uint = 14;
-pub const PTRACE_SETFPREGS: ::c_uint = 15;
-pub const PTRACE_GETFPXREGS: ::c_uint = 18;
-pub const PTRACE_SETFPXREGS: ::c_uint = 19;
-pub const PTRACE_GETREGS: ::c_uint = 12;
-pub const PTRACE_SETREGS: ::c_uint = 13;
-
 pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
 
 pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
 
 pub const TCSANOW: ::c_int = 0;
 pub const TCSADRAIN: ::c_int = 1;
 pub const TCSAFLUSH: ::c_int = 2;
 
@@ -275,16 +251,27 @@ pub const ECHOE: ::tcflag_t = 0x00000010
 pub const ECHOK: ::tcflag_t = 0x00000020;
 pub const ECHONL: ::tcflag_t = 0x00000040;
 pub const ECHOPRT: ::tcflag_t = 0x00000400;
 pub const ECHOCTL: ::tcflag_t = 0x00000200;
 pub const ISIG: ::tcflag_t = 0x00000001;
 pub const ICANON: ::tcflag_t = 0x00000002;
 pub const PENDIN: ::tcflag_t = 0x00004000;
 pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
@@ -310,28 +297,33 @@ pub const B1000000: ::speed_t = 0o010010
 pub const B1152000: ::speed_t = 0o010011;
 pub const B1500000: ::speed_t = 0o010012;
 pub const B2000000: ::speed_t = 0o010013;
 pub const B2500000: ::speed_t = 0o010014;
 pub const B3000000: ::speed_t = 0o010015;
 pub const B3500000: ::speed_t = 0o010016;
 pub const B4000000: ::speed_t = 0o010017;
 
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
+
 extern {
     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
     pub fn ptrace(request: ::c_int, ...) -> ::c_long;
     pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
     pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
 }
 
 cfg_if! {
     if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] {
         mod b64;
         pub use self::b64::*;
     } else if #[cfg(any(target_arch = "x86",
                         target_arch = "mips",
-                        target_arch = "arm",
-                        target_arch = "asmjs",
-                        target_arch = "wasm32"))] {
+                        target_arch = "arm"))] {
         mod b32;
         pub use self::b32::*;
     } else { }
 }
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b32/arm.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b32/arm.rs
@@ -33,16 +33,47 @@ s! {
         pub st_atime_nsec: ::c_long,
         pub st_mtime: ::time_t,
         pub st_mtime_nsec: ::c_long,
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         pub st_ino: ::ino64_t,
     }
 
+    pub struct statfs64 {
+        pub f_type: ::__fsword_t,
+        pub f_bsize: ::__fsword_t,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::__fsword_t,
+        pub f_frsize: ::__fsword_t,
+        pub f_flags: ::__fsword_t,
+        pub f_spare: [::__fsword_t; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct shmid_ds {
         pub shm_perm: ::ipc_perm,
         pub shm_segsz: ::size_t,
         pub shm_atime: ::time_t,
         __unused1: ::c_ulong,
         pub shm_dtime: ::time_t,
         __unused2: ::c_ulong,
         pub shm_ctime: ::time_t,
@@ -70,33 +101,39 @@ s! {
         __glibc_reserved4: ::c_ulong,
         __glibc_reserved5: ::c_ulong,
     }
 }
 
 pub const O_DIRECT: ::c_int = 0x10000;
 pub const O_DIRECTORY: ::c_int = 0x4000;
 pub const O_NOFOLLOW: ::c_int = 0x8000;
+pub const O_LARGEFILE: ::c_int = 0o400000;
 
 pub const MAP_LOCKED: ::c_int = 0x02000;
 pub const MAP_NORESERVE: ::c_int = 0x04000;
 
 pub const EDEADLOCK: ::c_int = 35;
 
+pub const SO_PASSCRED: ::c_int = 16;
 pub const SO_PEERCRED: ::c_int = 17;
 pub const SO_RCVLOWAT: ::c_int = 18;
 pub const SO_SNDLOWAT: ::c_int = 19;
 pub const SO_RCVTIMEO: ::c_int = 20;
 pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_SNDBUFFORCE: ::c_int = 32;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
 
 pub const FIOCLEX: ::c_ulong = 0x5451;
 pub const FIONBIO: ::c_ulong = 0x5421;
 
+pub const SYS_pivot_root: ::c_long = 218;
 pub const SYS_gettid: ::c_long = 224;
 pub const SYS_perf_event_open: ::c_long = 364;
+pub const SYS_memfd_create: ::c_long = 385;
 
 pub const PTRACE_GETFPXREGS: ::c_uint = 18;
 pub const PTRACE_SETFPXREGS: ::c_uint = 19;
 
 pub const MCL_CURRENT: ::c_int = 0x0001;
 pub const MCL_FUTURE: ::c_int = 0x0002;
 
 pub const SIGSTKSZ: ::size_t = 8192;
@@ -136,16 +173,27 @@ pub const ECHOE: ::tcflag_t = 0x00000010
 pub const ECHOK: ::tcflag_t = 0x00000020;
 pub const ECHONL: ::tcflag_t = 0x00000040;
 pub const ECHOPRT: ::tcflag_t = 0x00000400;
 pub const ECHOCTL: ::tcflag_t = 0x00000200;
 pub const ISIG: ::tcflag_t = 0x00000001;
 pub const ICANON: ::tcflag_t = 0x00000002;
 pub const PENDIN: ::tcflag_t = 0x00004000;
 pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b32/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b32/mod.rs
@@ -7,16 +7,17 @@ pub type time_t = i32;
 pub type suseconds_t = i32;
 pub type ino_t = u32;
 pub type off_t = i32;
 pub type blkcnt_t = i32;
 pub type __fsword_t = i32;
 
 pub type blksize_t = i32;
 pub type nlink_t = u32;
+pub type __u64 = ::c_ulonglong;
 
 s! {
     pub struct stat {
         pub st_dev: ::dev_t,
         __pad1: ::c_short,
         pub st_ino: ::ino_t,
         pub st_mode: ::mode_t,
         pub st_nlink: ::nlink_t,
@@ -73,16 +74,18 @@ pub const O_APPEND: ::c_int = 1024;
 pub const O_CREAT: ::c_int = 64;
 pub const O_EXCL: ::c_int = 128;
 pub const O_NOCTTY: ::c_int = 256;
 pub const O_NONBLOCK: ::c_int = 2048;
 pub const O_SYNC: ::c_int = 1052672;
 pub const O_RSYNC: ::c_int = 1052672;
 pub const O_DSYNC: ::c_int = 4096;
 pub const O_FSYNC: ::c_int = 0x101000;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_PATH: ::c_int = 0o10000000;
 
 pub const MAP_GROWSDOWN: ::c_int = 0x0100;
 
 pub const EDEADLK: ::c_int = 35;
 pub const ENAMETOOLONG: ::c_int = 36;
 pub const ENOLCK: ::c_int = 37;
 pub const ENOSYS: ::c_int = 38;
 pub const ENOTEMPTY: ::c_int = 39;
@@ -166,19 +169,29 @@ pub const SO_REUSEADDR: ::c_int = 2;
 pub const SO_TYPE: ::c_int = 3;
 pub const SO_ERROR: ::c_int = 4;
 pub const SO_DONTROUTE: ::c_int = 5;
 pub const SO_BROADCAST: ::c_int = 6;
 pub const SO_SNDBUF: ::c_int = 7;
 pub const SO_RCVBUF: ::c_int = 8;
 pub const SO_KEEPALIVE: ::c_int = 9;
 pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_PRIORITY: ::c_int = 12;
 pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
 pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
 pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_PROTOCOL: ::c_int = 38;
+pub const SO_DOMAIN: ::c_int = 39;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
 
 pub const SA_ONSTACK: ::c_int = 0x08000000;
 pub const SA_SIGINFO: ::c_int = 0x00000004;
 pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
 
 pub const SIGCHLD: ::c_int = 17;
 pub const SIGBUS: ::c_int = 7;
 pub const SIGUSR1: ::c_int = 10;
@@ -219,17 +232,16 @@ pub const TIOCEXCL: ::c_ulong = 0x540C;
 pub const TIOCNXCL: ::c_ulong = 0x540D;
 pub const TIOCSCTTY: ::c_ulong = 0x540E;
 pub const TIOCSTI: ::c_ulong = 0x5412;
 pub const TIOCMGET: ::c_ulong = 0x5415;
 pub const TIOCMBIS: ::c_ulong = 0x5416;
 pub const TIOCMBIC: ::c_ulong = 0x5417;
 pub const TIOCMSET: ::c_ulong = 0x5418;
 pub const TIOCCONS: ::c_ulong = 0x541D;
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
 
 pub const SFD_CLOEXEC: ::c_int = 0x080000;
 
 pub const NCCS: usize = 32;
 
 pub const O_TRUNC: ::c_int = 512;
 
 pub const O_CLOEXEC: ::c_int = 0x80000;
@@ -257,16 +269,17 @@ pub const SA_NOCLDSTOP: ::c_int = 0x0000
 pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
 
 pub const EFD_CLOEXEC: ::c_int = 0x80000;
 
 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
 
 pub const PTRACE_GETFPREGS: ::c_uint = 14;
 pub const PTRACE_SETFPREGS: ::c_uint = 15;
 pub const PTRACE_GETREGS: ::c_uint = 12;
 pub const PTRACE_SETREGS: ::c_uint = 13;
 
 cfg_if! {
     if #[cfg(target_arch = "x86")] {
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b32/powerpc.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b32/powerpc.rs
@@ -32,16 +32,47 @@ s! {
         pub st_mtime: ::time_t,
         pub st_mtime_nsec: ::c_long,
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         __glibc_reserved4: ::c_ulong,
         __glibc_reserved5: ::c_ulong,
     }
 
+    pub struct statfs64 {
+        pub f_type: ::__fsword_t,
+        pub f_bsize: ::__fsword_t,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::__fsword_t,
+        pub f_frsize: ::__fsword_t,
+        pub f_flags: ::__fsword_t,
+        pub f_spare: [::__fsword_t; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct shmid_ds {
         pub shm_perm: ::ipc_perm,
         __glibc_reserved1: ::c_uint,
         pub shm_atime: ::time_t,
         __glibc_reserved2: ::c_uint,
         pub shm_dtime: ::time_t,
         __glibc_reserved3: ::c_uint,
         pub shm_ctime: ::time_t,
@@ -70,39 +101,40 @@ s! {
         __glibc_reserved4: ::c_ulong,
         __glibc_reserved5: ::c_ulong,
     }
 }
 
 pub const O_DIRECT: ::c_int = 0x20000;
 pub const O_DIRECTORY: ::c_int = 0x4000;
 pub const O_NOFOLLOW: ::c_int = 0x8000;
+pub const O_LARGEFILE: ::c_int = 0o200000;
 
 pub const MAP_LOCKED: ::c_int = 0x00080;
 pub const MAP_NORESERVE: ::c_int = 0x00040;
 
 pub const EDEADLOCK: ::c_int = 58;
 
 pub const SO_SNDBUFFORCE: ::c_int = 32;
 pub const SO_RCVBUFFORCE: ::c_int = 33;
 pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
 pub const SO_RCVLOWAT: ::c_int = 16;
 pub const SO_SNDLOWAT: ::c_int = 17;
 pub const SO_RCVTIMEO: ::c_int = 18;
 pub const SO_SNDTIMEO: ::c_int = 19;
 pub const SO_PASSCRED: ::c_int = 20;
 pub const SO_PEERCRED: ::c_int = 21;
 
 pub const FIOCLEX: ::c_ulong = 0x20006601;
 pub const FIONBIO: ::c_ulong = 0x8004667e;
 
+pub const SYS_pivot_root: ::c_long = 203;
 pub const SYS_gettid: ::c_long = 207;
 pub const SYS_perf_event_open: ::c_long = 319;
+pub const SYS_memfd_create: ::c_long = 360;
 
 pub const MCL_CURRENT: ::c_int = 0x2000;
 pub const MCL_FUTURE: ::c_int = 0x4000;
 
 pub const SIGSTKSZ: ::size_t = 0x4000;
 pub const MINSIGSTKSZ: ::size_t = 4096;
 pub const CBAUD: ::tcflag_t = 0xff;
 pub const TAB1: ::c_int = 0x400;
@@ -139,16 +171,25 @@ pub const ECHOE: ::tcflag_t = 0x2;
 pub const ECHOK: ::tcflag_t = 0x4;
 pub const ECHONL: ::tcflag_t = 0x10;
 pub const ECHOPRT: ::tcflag_t = 0x20;
 pub const ECHOCTL: ::tcflag_t = 0x40;
 pub const ISIG: ::tcflag_t = 0x80;
 pub const ICANON: ::tcflag_t = 0x100;
 pub const PENDIN: ::tcflag_t = 0x20000000;
 pub const NOFLSH: ::tcflag_t = 0x80000000;
+pub const VSWTC: usize = 9;
+pub const OLCUC:  ::tcflag_t = 0o000004;
+pub const NLDLY:  ::tcflag_t = 0o001400;
+pub const CRDLY:  ::tcflag_t = 0o030000;
+pub const TABDLY: ::tcflag_t = 0o006000;
+pub const BSDLY:  ::tcflag_t = 0o100000;
+pub const FFDLY:  ::tcflag_t = 0o040000;
+pub const VTDLY:  ::tcflag_t = 0o200000;
+pub const XTABS:  ::tcflag_t = 0o006000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b32/x86.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b32/x86.rs
@@ -132,16 +132,47 @@ s! {
         pub st_atime_nsec: ::c_long,
         pub st_mtime: ::time_t,
         pub st_mtime_nsec: ::c_long,
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         pub st_ino: ::ino64_t,
     }
 
+    pub struct statfs64 {
+        pub f_type: ::__fsword_t,
+        pub f_bsize: ::__fsword_t,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::__fsword_t,
+        pub f_frsize: ::__fsword_t,
+        pub f_flags: ::__fsword_t,
+        pub f_spare: [::__fsword_t; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        __f_unused: ::c_int,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct shmid_ds {
         pub shm_perm: ::ipc_perm,
         pub shm_segsz: ::size_t,
         pub shm_atime: ::time_t,
         __unused1: ::c_ulong,
         pub shm_dtime: ::time_t,
         __unused2: ::c_ulong,
         pub shm_ctime: ::time_t,
@@ -169,41 +200,37 @@ s! {
         __glibc_reserved4: ::c_ulong,
         __glibc_reserved5: ::c_ulong,
     }
 }
 
 pub const O_DIRECT: ::c_int = 0x4000;
 pub const O_DIRECTORY: ::c_int = 0x10000;
 pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
 
 pub const MAP_LOCKED: ::c_int = 0x02000;
 pub const MAP_NORESERVE: ::c_int = 0x04000;
 pub const MAP_32BIT: ::c_int = 0x0040;
 
 pub const EDEADLOCK: ::c_int = 35;
 
 pub const SO_SNDBUFFORCE: ::c_int = 32;
 pub const SO_RCVBUFFORCE: ::c_int = 33;
 pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
 pub const SO_PASSCRED: ::c_int = 16;
 pub const SO_PEERCRED: ::c_int = 17;
 pub const SO_RCVLOWAT: ::c_int = 18;
 pub const SO_SNDLOWAT: ::c_int = 19;
 pub const SO_RCVTIMEO: ::c_int = 20;
 pub const SO_SNDTIMEO: ::c_int = 21;
 
 pub const FIOCLEX: ::c_ulong = 0x5451;
 pub const FIONBIO: ::c_ulong = 0x5421;
 
-pub const SYS_gettid: ::c_long = 224;
-pub const SYS_perf_event_open: ::c_long = 336;
-
 pub const PTRACE_GETFPXREGS: ::c_uint = 18;
 pub const PTRACE_SETFPXREGS: ::c_uint = 19;
 
 pub const MCL_CURRENT: ::c_int = 0x0001;
 pub const MCL_FUTURE: ::c_int = 0x0002;
 
 pub const SIGSTKSZ: ::size_t = 8192;
 pub const MINSIGSTKSZ: ::size_t = 2048;
@@ -242,16 +269,27 @@ pub const ECHOE: ::tcflag_t = 0x00000010
 pub const ECHOK: ::tcflag_t = 0x00000020;
 pub const ECHONL: ::tcflag_t = 0x00000040;
 pub const ECHOPRT: ::tcflag_t = 0x00000400;
 pub const ECHOCTL: ::tcflag_t = 0x00000200;
 pub const ISIG: ::tcflag_t = 0x00000001;
 pub const ICANON: ::tcflag_t = 0x00000002;
 pub const PENDIN: ::tcflag_t = 0x00004000;
 pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
@@ -303,16 +341,416 @@ pub const TCFLSH: ::c_ulong = 0x540B;
 pub const TIOCINQ: ::c_ulong = 0x541B;
 pub const TIOCGPGRP: ::c_ulong = 0x540F;
 pub const TIOCSPGRP: ::c_ulong = 0x5410;
 pub const TIOCOUTQ: ::c_ulong = 0x5411;
 pub const TIOCGWINSZ: ::c_ulong = 0x5413;
 pub const TIOCSWINSZ: ::c_ulong = 0x5414;
 pub const FIONREAD: ::c_ulong = 0x541B;
 
+// Syscall table
+pub const SYS_restart_syscall: ::c_long = 0;
+pub const SYS_exit: ::c_long = 1;
+pub const SYS_fork: ::c_long = 2;
+pub const SYS_read: ::c_long = 3;
+pub const SYS_write: ::c_long = 4;
+pub const SYS_open: ::c_long = 5;
+pub const SYS_close: ::c_long = 6;
+pub const SYS_waitpid: ::c_long = 7;
+pub const SYS_creat: ::c_long = 8;
+pub const SYS_link: ::c_long = 9;
+pub const SYS_unlink: ::c_long = 10;
+pub const SYS_execve: ::c_long = 11;
+pub const SYS_chdir: ::c_long = 12;
+pub const SYS_time: ::c_long = 13;
+pub const SYS_mknod: ::c_long = 14;
+pub const SYS_chmod: ::c_long = 15;
+pub const SYS_lchown: ::c_long = 16;
+pub const SYS_break: ::c_long = 17;
+pub const SYS_oldstat: ::c_long = 18;
+pub const SYS_lseek: ::c_long = 19;
+pub const SYS_getpid: ::c_long = 20;
+pub const SYS_mount: ::c_long = 21;
+pub const SYS_umount: ::c_long = 22;
+pub const SYS_setuid: ::c_long = 23;
+pub const SYS_getuid: ::c_long = 24;
+pub const SYS_stime: ::c_long = 25;
+pub const SYS_ptrace: ::c_long = 26;
+pub const SYS_alarm: ::c_long = 27;
+pub const SYS_oldfstat: ::c_long = 28;
+pub const SYS_pause: ::c_long = 29;
+pub const SYS_utime: ::c_long = 30;
+pub const SYS_stty: ::c_long = 31;
+pub const SYS_gtty: ::c_long = 32;
+pub const SYS_access: ::c_long = 33;
+pub const SYS_nice: ::c_long = 34;
+pub const SYS_ftime: ::c_long = 35;
+pub const SYS_sync: ::c_long = 36;
+pub const SYS_kill: ::c_long = 37;
+pub const SYS_rename: ::c_long = 38;
+pub const SYS_mkdir: ::c_long = 39;
+pub const SYS_rmdir: ::c_long = 40;
+pub const SYS_dup: ::c_long = 41;
+pub const SYS_pipe: ::c_long = 42;
+pub const SYS_times: ::c_long = 43;
+pub const SYS_prof: ::c_long = 44;
+pub const SYS_brk: ::c_long = 45;
+pub const SYS_setgid: ::c_long = 46;
+pub const SYS_getgid: ::c_long = 47;
+pub const SYS_signal: ::c_long = 48;
+pub const SYS_geteuid: ::c_long = 49;
+pub const SYS_getegid: ::c_long = 50;
+pub const SYS_acct: ::c_long = 51;
+pub const SYS_umount2: ::c_long = 52;
+pub const SYS_lock: ::c_long = 53;
+pub const SYS_ioctl: ::c_long = 54;
+pub const SYS_fcntl: ::c_long = 55;
+pub const SYS_mpx: ::c_long = 56;
+pub const SYS_setpgid: ::c_long = 57;
+pub const SYS_ulimit: ::c_long = 58;
+pub const SYS_oldolduname: ::c_long = 59;
+pub const SYS_umask: ::c_long = 60;
+pub const SYS_chroot: ::c_long = 61;
+pub const SYS_ustat: ::c_long = 62;
+pub const SYS_dup2: ::c_long = 63;
+pub const SYS_getppid: ::c_long = 64;
+pub const SYS_getpgrp: ::c_long = 65;
+pub const SYS_setsid: ::c_long = 66;
+pub const SYS_sigaction: ::c_long = 67;
+pub const SYS_sgetmask: ::c_long = 68;
+pub const SYS_ssetmask: ::c_long = 69;
+pub const SYS_setreuid: ::c_long = 70;
+pub const SYS_setregid: ::c_long = 71;
+pub const SYS_sigsuspend: ::c_long = 72;
+pub const SYS_sigpending: ::c_long = 73;
+pub const SYS_sethostname: ::c_long = 74;
+pub const SYS_setrlimit: ::c_long = 75;
+pub const SYS_getrlimit: ::c_long = 76;
+pub const SYS_getrusage: ::c_long = 77;
+pub const SYS_gettimeofday: ::c_long = 78;
+pub const SYS_settimeofday: ::c_long = 79;
+pub const SYS_getgroups: ::c_long = 80;
+pub const SYS_setgroups: ::c_long = 81;
+pub const SYS_select: ::c_long = 82;
+pub const SYS_symlink: ::c_long = 83;
+pub const SYS_oldlstat: ::c_long = 84;
+pub const SYS_readlink: ::c_long = 85;
+pub const SYS_uselib: ::c_long = 86;
+pub const SYS_swapon: ::c_long = 87;
+pub const SYS_reboot: ::c_long = 88;
+pub const SYS_readdir: ::c_long = 89;
+pub const SYS_mmap: ::c_long = 90;
+pub const SYS_munmap: ::c_long = 91;
+pub const SYS_truncate: ::c_long = 92;
+pub const SYS_ftruncate: ::c_long = 93;
+pub const SYS_fchmod: ::c_long = 94;
+pub const SYS_fchown: ::c_long = 95;
+pub const SYS_getpriority: ::c_long = 96;
+pub const SYS_setpriority: ::c_long = 97;
+pub const SYS_profil: ::c_long = 98;
+pub const SYS_statfs: ::c_long = 99;
+pub const SYS_fstatfs: ::c_long = 100;
+pub const SYS_ioperm: ::c_long = 101;
+pub const SYS_socketcall: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_setitimer: ::c_long = 104;
+pub const SYS_getitimer: ::c_long = 105;
+pub const SYS_stat: ::c_long = 106;
+pub const SYS_lstat: ::c_long = 107;
+pub const SYS_fstat: ::c_long = 108;
+pub const SYS_olduname: ::c_long = 109;
+pub const SYS_iopl: ::c_long = 110;
+pub const SYS_vhangup: ::c_long = 111;
+pub const SYS_idle: ::c_long = 112;
+pub const SYS_vm86old: ::c_long = 113;
+pub const SYS_wait4: ::c_long = 114;
+pub const SYS_swapoff: ::c_long = 115;
+pub const SYS_sysinfo: ::c_long = 116;
+pub const SYS_ipc: ::c_long = 117;
+pub const SYS_fsync: ::c_long = 118;
+pub const SYS_sigreturn: ::c_long = 119;
+pub const SYS_clone: ::c_long = 120;
+pub const SYS_setdomainname: ::c_long = 121;
+pub const SYS_uname: ::c_long = 122;
+pub const SYS_modify_ldt: ::c_long = 123;
+pub const SYS_adjtimex: ::c_long = 124;
+pub const SYS_mprotect: ::c_long = 125;
+pub const SYS_sigprocmask: ::c_long = 126;
+pub const SYS_create_module: ::c_long = 127;
+pub const SYS_init_module: ::c_long = 128;
+pub const SYS_delete_module: ::c_long = 129;
+pub const SYS_get_kernel_syms: ::c_long = 130;
+pub const SYS_quotactl: ::c_long = 131;
+pub const SYS_getpgid: ::c_long = 132;
+pub const SYS_fchdir: ::c_long = 133;
+pub const SYS_bdflush: ::c_long = 134;
+pub const SYS_sysfs: ::c_long = 135;
+pub const SYS_personality: ::c_long = 136;
+pub const SYS_afs_syscall: ::c_long = 137;
+pub const SYS_setfsuid: ::c_long = 138;
+pub const SYS_setfsgid: ::c_long = 139;
+pub const SYS__llseek: ::c_long = 140;
+pub const SYS_getdents: ::c_long = 141;
+pub const SYS__newselect: ::c_long = 142;
+pub const SYS_flock: ::c_long = 143;
+pub const SYS_msync: ::c_long = 144;
+pub const SYS_readv: ::c_long = 145;
+pub const SYS_writev: ::c_long = 146;
+pub const SYS_getsid: ::c_long = 147;
+pub const SYS_fdatasync: ::c_long = 148;
+pub const SYS__sysctl: ::c_long = 149;
+pub const SYS_mlock: ::c_long = 150;
+pub const SYS_munlock: ::c_long = 151;
+pub const SYS_mlockall: ::c_long = 152;
+pub const SYS_munlockall: ::c_long = 153;
+pub const SYS_sched_setparam: ::c_long = 154;
+pub const SYS_sched_getparam: ::c_long = 155;
+pub const SYS_sched_setscheduler: ::c_long = 156;
+pub const SYS_sched_getscheduler: ::c_long = 157;
+pub const SYS_sched_yield: ::c_long = 158;
+pub const SYS_sched_get_priority_max: ::c_long = 159;
+pub const SYS_sched_get_priority_min: ::c_long = 160;
+pub const SYS_sched_rr_get_interval: ::c_long = 161;
+pub const SYS_nanosleep: ::c_long = 162;
+pub const SYS_mremap: ::c_long = 163;
+pub const SYS_setresuid: ::c_long = 164;
+pub const SYS_getresuid: ::c_long = 165;
+pub const SYS_vm86: ::c_long = 166;
+pub const SYS_query_module: ::c_long = 167;
+pub const SYS_poll: ::c_long = 168;
+pub const SYS_nfsservctl: ::c_long = 169;
+pub const SYS_setresgid: ::c_long = 170;
+pub const SYS_getresgid: ::c_long = 171;
+pub const SYS_prctl: ::c_long = 172;
+pub const SYS_rt_sigreturn: ::c_long = 173;
+pub const SYS_rt_sigaction: ::c_long = 174;
+pub const SYS_rt_sigprocmask: ::c_long = 175;
+pub const SYS_rt_sigpending: ::c_long = 176;
+pub const SYS_rt_sigtimedwait: ::c_long = 177;
+pub const SYS_rt_sigqueueinfo: ::c_long = 178;
+pub const SYS_rt_sigsuspend: ::c_long = 179;
+pub const SYS_pread64: ::c_long = 180;
+pub const SYS_pwrite64: ::c_long = 181;
+pub const SYS_chown: ::c_long = 182;
+pub const SYS_getcwd: ::c_long = 183;
+pub const SYS_capget: ::c_long = 184;
+pub const SYS_capset: ::c_long = 185;
+pub const SYS_sigaltstack: ::c_long = 186;
+pub const SYS_sendfile: ::c_long = 187;
+pub const SYS_getpmsg: ::c_long = 188;
+pub const SYS_putpmsg: ::c_long = 189;
+pub const SYS_vfork: ::c_long = 190;
+pub const SYS_ugetrlimit: ::c_long = 191;
+pub const SYS_mmap2: ::c_long = 192;
+pub const SYS_truncate64: ::c_long = 193;
+pub const SYS_ftruncate64: ::c_long = 194;
+pub const SYS_stat64: ::c_long = 195;
+pub const SYS_lstat64: ::c_long = 196;
+pub const SYS_fstat64: ::c_long = 197;
+pub const SYS_lchown32: ::c_long = 198;
+pub const SYS_getuid32: ::c_long = 199;
+pub const SYS_getgid32: ::c_long = 200;
+pub const SYS_geteuid32: ::c_long = 201;
+pub const SYS_getegid32: ::c_long = 202;
+pub const SYS_setreuid32: ::c_long = 203;
+pub const SYS_setregid32: ::c_long = 204;
+pub const SYS_getgroups32: ::c_long = 205;
+pub const SYS_setgroups32: ::c_long = 206;
+pub const SYS_fchown32: ::c_long = 207;
+pub const SYS_setresuid32: ::c_long = 208;
+pub const SYS_getresuid32: ::c_long = 209;
+pub const SYS_setresgid32: ::c_long = 210;
+pub const SYS_getresgid32: ::c_long = 211;
+pub const SYS_chown32: ::c_long = 212;
+pub const SYS_setuid32: ::c_long = 213;
+pub const SYS_setgid32: ::c_long = 214;
+pub const SYS_setfsuid32: ::c_long = 215;
+pub const SYS_setfsgid32: ::c_long = 216;
+pub const SYS_pivot_root: ::c_long = 217;
+pub const SYS_mincore: ::c_long = 218;
+pub const SYS_madvise: ::c_long = 219;
+pub const SYS_getdents64: ::c_long = 220;
+pub const SYS_fcntl64: ::c_long = 221;
+pub const SYS_gettid: ::c_long = 224;
+pub const SYS_readahead: ::c_long = 225;
+pub const SYS_setxattr: ::c_long = 226;
+pub const SYS_lsetxattr: ::c_long = 227;
+pub const SYS_fsetxattr: ::c_long = 228;
+pub const SYS_getxattr: ::c_long = 229;
+pub const SYS_lgetxattr: ::c_long = 230;
+pub const SYS_fgetxattr: ::c_long = 231;
+pub const SYS_listxattr: ::c_long = 232;
+pub const SYS_llistxattr: ::c_long = 233;
+pub const SYS_flistxattr: ::c_long = 234;
+pub const SYS_removexattr: ::c_long = 235;
+pub const SYS_lremovexattr: ::c_long = 236;
+pub const SYS_fremovexattr: ::c_long = 237;
+pub const SYS_tkill: ::c_long = 238;
+pub const SYS_sendfile64: ::c_long = 239;
+pub const SYS_futex: ::c_long = 240;
+pub const SYS_sched_setaffinity: ::c_long = 241;
+pub const SYS_sched_getaffinity: ::c_long = 242;
+pub const SYS_set_thread_area: ::c_long = 243;
+pub const SYS_get_thread_area: ::c_long = 244;
+pub const SYS_io_setup: ::c_long = 245;
+pub const SYS_io_destroy: ::c_long = 246;
+pub const SYS_io_getevents: ::c_long = 247;
+pub const SYS_io_submit: ::c_long = 248;
+pub const SYS_io_cancel: ::c_long = 249;
+pub const SYS_fadvise64: ::c_long = 250;
+pub const SYS_exit_group: ::c_long = 252;
+pub const SYS_lookup_dcookie: ::c_long = 253;
+pub const SYS_epoll_create: ::c_long = 254;
+pub const SYS_epoll_ctl: ::c_long = 255;
+pub const SYS_epoll_wait: ::c_long = 256;
+pub const SYS_remap_file_pages: ::c_long = 257;
+pub const SYS_set_tid_address: ::c_long = 258;
+pub const SYS_timer_create: ::c_long = 259;
+pub const SYS_timer_settime: ::c_long = 260;
+pub const SYS_timer_gettime: ::c_long = 261;
+pub const SYS_timer_getoverrun: ::c_long = 262;
+pub const SYS_timer_delete: ::c_long = 263;
+pub const SYS_clock_settime: ::c_long = 264;
+pub const SYS_clock_gettime: ::c_long = 265;
+pub const SYS_clock_getres: ::c_long = 266;
+pub const SYS_clock_nanosleep: ::c_long = 267;
+pub const SYS_statfs64: ::c_long = 268;
+pub const SYS_fstatfs64: ::c_long = 269;
+pub const SYS_tgkill: ::c_long = 270;
+pub const SYS_utimes: ::c_long = 271;
+pub const SYS_fadvise64_64: ::c_long = 272;
+pub const SYS_vserver: ::c_long = 273;
+pub const SYS_mbind: ::c_long = 274;
+pub const SYS_get_mempolicy: ::c_long = 275;
+pub const SYS_set_mempolicy: ::c_long = 276;
+pub const SYS_mq_open: ::c_long = 277;
+pub const SYS_mq_unlink: ::c_long = 278;
+pub const SYS_mq_timedsend: ::c_long = 279;
+pub const SYS_mq_timedreceive: ::c_long = 280;
+pub const SYS_mq_notify: ::c_long = 281;
+pub const SYS_mq_getsetattr: ::c_long = 282;
+pub const SYS_kexec_load: ::c_long = 283;
+pub const SYS_waitid: ::c_long = 284;
+pub const SYS_add_key: ::c_long = 286;
+pub const SYS_request_key: ::c_long = 287;
+pub const SYS_keyctl: ::c_long = 288;
+pub const SYS_ioprio_set: ::c_long = 289;
+pub const SYS_ioprio_get: ::c_long = 290;
+pub const SYS_inotify_init: ::c_long = 291;
+pub const SYS_inotify_add_watch: ::c_long = 292;
+pub const SYS_inotify_rm_watch: ::c_long = 293;
+pub const SYS_migrate_pages: ::c_long = 294;
+pub const SYS_openat: ::c_long = 295;
+pub const SYS_mkdirat: ::c_long = 296;
+pub const SYS_mknodat: ::c_long = 297;
+pub const SYS_fchownat: ::c_long = 298;
+pub const SYS_futimesat: ::c_long = 299;
+pub const SYS_fstatat64: ::c_long = 300;
+pub const SYS_unlinkat: ::c_long = 301;
+pub const SYS_renameat: ::c_long = 302;
+pub const SYS_linkat: ::c_long = 303;
+pub const SYS_symlinkat: ::c_long = 304;
+pub const SYS_readlinkat: ::c_long = 305;
+pub const SYS_fchmodat: ::c_long = 306;
+pub const SYS_faccessat: ::c_long = 307;
+pub const SYS_pselect6: ::c_long = 308;
+pub const SYS_ppoll: ::c_long = 309;
+pub const SYS_unshare: ::c_long = 310;
+pub const SYS_set_robust_list: ::c_long = 311;
+pub const SYS_get_robust_list: ::c_long = 312;
+pub const SYS_splice: ::c_long = 313;
+pub const SYS_sync_file_range: ::c_long = 314;
+pub const SYS_tee: ::c_long = 315;
+pub const SYS_vmsplice: ::c_long = 316;
+pub const SYS_move_pages: ::c_long = 317;
+pub const SYS_getcpu: ::c_long = 318;
+pub const SYS_epoll_pwait: ::c_long = 319;
+pub const SYS_utimensat: ::c_long = 320;
+pub const SYS_signalfd: ::c_long = 321;
+pub const SYS_timerfd_create: ::c_long = 322;
+pub const SYS_eventfd: ::c_long = 323;
+pub const SYS_fallocate: ::c_long = 324;
+pub const SYS_timerfd_settime: ::c_long = 325;
+pub const SYS_timerfd_gettime: ::c_long = 326;
+pub const SYS_signalfd4: ::c_long = 327;
+pub const SYS_eventfd2: ::c_long = 328;
+pub const SYS_epoll_create1: ::c_long = 329;
+pub const SYS_dup3: ::c_long = 330;
+pub const SYS_pipe2: ::c_long = 331;
+pub const SYS_inotify_init1: ::c_long = 332;
+pub const SYS_preadv: ::c_long = 333;
+pub const SYS_pwritev: ::c_long = 334;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 335;
+pub const SYS_perf_event_open: ::c_long = 336;
+pub const SYS_recvmmsg: ::c_long = 337;
+pub const SYS_fanotify_init: ::c_long = 338;
+pub const SYS_fanotify_mark: ::c_long = 339;
+pub const SYS_prlimit64: ::c_long = 340;
+pub const SYS_name_to_handle_at: ::c_long = 341;
+pub const SYS_open_by_handle_at: ::c_long = 342;
+pub const SYS_clock_adjtime: ::c_long = 343;
+pub const SYS_syncfs: ::c_long = 344;
+pub const SYS_sendmmsg: ::c_long = 345;
+pub const SYS_setns: ::c_long = 346;
+pub const SYS_process_vm_readv: ::c_long = 347;
+pub const SYS_process_vm_writev: ::c_long = 348;
+pub const SYS_kcmp: ::c_long = 349;
+pub const SYS_finit_module: ::c_long = 350;
+pub const SYS_sched_setattr: ::c_long = 351;
+pub const SYS_sched_getattr: ::c_long = 352;
+pub const SYS_renameat2: ::c_long = 353;
+pub const SYS_seccomp: ::c_long = 354;
+pub const SYS_getrandom: ::c_long = 355;
+pub const SYS_memfd_create: ::c_long = 356;
+pub const SYS_bpf: ::c_long = 357;
+pub const SYS_execveat: ::c_long = 358;
+pub const SYS_socket: ::c_long = 359;
+pub const SYS_socketpair: ::c_long = 360;
+pub const SYS_bind: ::c_long = 361;
+pub const SYS_connect: ::c_long = 362;
+pub const SYS_listen: ::c_long = 363;
+pub const SYS_accept4: ::c_long = 364;
+pub const SYS_getsockopt: ::c_long = 365;
+pub const SYS_setsockopt: ::c_long = 366;
+pub const SYS_getsockname: ::c_long = 367;
+pub const SYS_getpeername: ::c_long = 368;
+pub const SYS_sendto: ::c_long = 369;
+pub const SYS_sendmsg: ::c_long = 370;
+pub const SYS_recvfrom: ::c_long = 371;
+pub const SYS_recvmsg: ::c_long = 372;
+pub const SYS_shutdown: ::c_long = 373;
+pub const SYS_userfaultfd: ::c_long = 374;
+pub const SYS_membarrier: ::c_long = 375;
+pub const SYS_mlock2: ::c_long = 376;
+pub const SYS_copy_file_range: ::c_long = 377;
+pub const SYS_preadv2: ::c_long = 378;
+pub const SYS_pwritev2: ::c_long = 379;
+pub const SYS_pkey_mprotect: ::c_long = 380;
+pub const SYS_pkey_alloc: ::c_long = 381;
+pub const SYS_pkey_free: ::c_long = 382;
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const EBX: ::c_int = 0;
+pub const ECX: ::c_int = 1;
+pub const EDX: ::c_int = 2;
+pub const ESI: ::c_int = 3;
+pub const EDI: ::c_int = 4;
+pub const EBP: ::c_int = 5;
+pub const EAX: ::c_int = 6;
+pub const DS: ::c_int = 7;
+pub const ES: ::c_int = 8;
+pub const FS: ::c_int = 9;
+pub const GS: ::c_int = 10;
+pub const ORIG_EAX: ::c_int = 11;
+pub const EIP: ::c_int = 12;
+pub const CS: ::c_int = 13;
+pub const EFL: ::c_int = 14;
+pub const UESP: ::c_int = 15;
+pub const SS: ::c_int = 16;
+
 extern {
     pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
     pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
     pub fn makecontext(ucp: *mut ucontext_t,
                        func:  extern fn (),
                        argc: ::c_int, ...);
     pub fn swapcontext(uocp: *mut ucontext_t,
                        ucp: *const ucontext_t) -> ::c_int;
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b64/aarch64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b64/aarch64.rs
@@ -1,15 +1,16 @@
 //! AArch64-specific definitions for 64-bit linux-like values
 
 pub type c_char = u8;
 pub type wchar_t = u32;
 pub type nlink_t = u32;
 pub type blksize_t = i32;
 pub type suseconds_t = i64;
+pub type __u64 = ::c_ulonglong;
 
 s! {
     pub struct stat {
         pub st_dev: ::dev_t,
         pub st_ino: ::ino_t,
         pub st_mode: ::mode_t,
         pub st_nlink: ::nlink_t,
         pub st_uid: ::uid_t,
@@ -46,16 +47,46 @@ s! {
         pub st_atime_nsec: ::c_long,
         pub st_mtime: ::time_t,
         pub st_mtime_nsec: ::c_long,
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         __unused: [::c_int; 2],
     }
 
+    pub struct statfs64 {
+        pub f_type: ::__fsword_t,
+        pub f_bsize: ::__fsword_t,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::__fsword_t,
+        pub f_frsize: ::__fsword_t,
+        pub f_flags: ::__fsword_t,
+        pub f_spare: [::__fsword_t; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct pthread_attr_t {
         __size: [u64; 8]
     }
 
     pub struct ipc_perm {
         pub __key: ::key_t,
         pub uid: ::uid_t,
         pub gid: ::gid_t,
@@ -92,16 +123,18 @@ pub const O_APPEND: ::c_int = 1024;
 pub const O_CREAT: ::c_int = 64;
 pub const O_EXCL: ::c_int = 128;
 pub const O_NOCTTY: ::c_int = 256;
 pub const O_NONBLOCK: ::c_int = 2048;
 pub const O_SYNC: ::c_int = 1052672;
 pub const O_RSYNC: ::c_int = 1052672;
 pub const O_DSYNC: ::c_int = 4096;
 pub const O_FSYNC: ::c_int = 0x101000;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_PATH: ::c_int = 0o10000000;
 
 pub const MAP_GROWSDOWN: ::c_int = 0x0100;
 
 pub const EDEADLK: ::c_int = 35;
 pub const ENAMETOOLONG: ::c_int = 36;
 pub const ENOLCK: ::c_int = 37;
 pub const ENOSYS: ::c_int = 38;
 pub const ENOTEMPTY: ::c_int = 39;
@@ -207,17 +240,16 @@ pub const SO_SECURITY_AUTHENTICATION: ::
 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
 pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
 pub const SO_BINDTODEVICE: ::c_int = 25;
 pub const SO_ATTACH_FILTER: ::c_int = 26;
 pub const SO_DETACH_FILTER: ::c_int = 27;
 pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
 pub const SO_PEERNAME: ::c_int = 28;
 pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
 pub const SO_ACCEPTCONN: ::c_int = 30;
 pub const SO_PEERSEC: ::c_int = 31;
 pub const SO_PASSSEC: ::c_int = 34;
 pub const SO_TIMESTAMPNS: ::c_int = 35;
 pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
 pub const SO_MARK: ::c_int = 36;
 pub const SO_TIMESTAMPING: ::c_int = 37;
 pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
@@ -282,18 +314,16 @@ pub const TIOCNXCL: ::c_ulong = 0x540D;
 pub const TIOCSCTTY: ::c_ulong = 0x540E;
 pub const TIOCSTI: ::c_ulong = 0x5412;
 pub const TIOCMGET: ::c_ulong = 0x5415;
 pub const TIOCMBIS: ::c_ulong = 0x5416;
 pub const TIOCMBIC: ::c_ulong = 0x5417;
 pub const TIOCMSET: ::c_ulong = 0x5418;
 pub const TIOCCONS: ::c_ulong = 0x541D;
 
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
 pub const SFD_CLOEXEC: ::c_int = 0x080000;
 
 pub const NCCS: usize = 32;
 
 pub const O_TRUNC: ::c_int = 512;
 
 pub const O_CLOEXEC: ::c_int = 0x80000;
 
@@ -332,18 +362,20 @@ pub const O_NOFOLLOW: ::c_int = 0x8000;
 pub const MAP_LOCKED: ::c_int = 0x02000;
 pub const MAP_NORESERVE: ::c_int = 0x04000;
 
 pub const EDEADLOCK: ::c_int = 35;
 
 pub const FIOCLEX: ::c_ulong = 0x5451;
 pub const FIONBIO: ::c_ulong = 0x5421;
 
+pub const SYS_pivot_root: ::c_long = 41;
 pub const SYS_gettid: ::c_long = 178;
 pub const SYS_perf_event_open: ::c_long = 241;
+pub const SYS_memfd_create: ::c_long = 279;
 
 pub const MCL_CURRENT: ::c_int = 0x0001;
 pub const MCL_FUTURE: ::c_int = 0x0002;
 
 pub const SIGSTKSZ: ::size_t = 16384;
 pub const MINSIGSTKSZ: ::size_t = 5120;
 pub const CBAUD: ::tcflag_t = 0o0010017;
 pub const TAB1: ::c_int = 0x00000800;
@@ -380,16 +412,27 @@ pub const ECHOE: ::tcflag_t = 0x00000010
 pub const ECHOK: ::tcflag_t = 0x00000020;
 pub const ECHONL: ::tcflag_t = 0x00000040;
 pub const ECHOPRT: ::tcflag_t = 0x00000400;
 pub const ECHOCTL: ::tcflag_t = 0x00000200;
 pub const ISIG: ::tcflag_t = 0x00000001;
 pub const ICANON: ::tcflag_t = 0x00000002;
 pub const PENDIN: ::tcflag_t = 0x00004000;
 pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b64/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b64/mod.rs
@@ -42,16 +42,19 @@ s! {
         pub msg_lspid: ::pid_t,
         pub msg_lrpid: ::pid_t,
         __glibc_reserved4: ::c_ulong,
         __glibc_reserved5: ::c_ulong,
     }
 }
 
 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+
+pub const O_LARGEFILE: ::c_int = 0;
 
 cfg_if! {
     if #[cfg(target_arch = "aarch64")] {
         mod aarch64;
         pub use self::aarch64::*;
     } else if #[cfg(any(target_arch = "powerpc64"))] {
         mod powerpc64;
         pub use self::powerpc64::*;
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs
@@ -1,15 +1,16 @@
 //! PowerPC64-specific definitions for 64-bit linux-like values
 
 pub type c_char = u8;
 pub type wchar_t = i32;
 pub type nlink_t = u64;
 pub type blksize_t = i64;
 pub type suseconds_t = i64;
+pub type __u64 = ::c_ulong;
 
 s! {
     pub struct stat {
         pub st_dev: ::dev_t,
         pub st_ino: ::ino_t,
         pub st_nlink: ::nlink_t,
         pub st_mode: ::mode_t,
         pub st_uid: ::uid_t,
@@ -44,16 +45,46 @@ s! {
         pub st_atime_nsec: ::c_long,
         pub st_mtime: ::time_t,
         pub st_mtime_nsec: ::c_long,
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         __reserved: [::c_long; 3],
     }
 
+    pub struct statfs64 {
+        pub f_type: ::__fsword_t,
+        pub f_bsize: ::__fsword_t,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::__fsword_t,
+        pub f_frsize: ::__fsword_t,
+        pub f_flags: ::__fsword_t,
+        pub f_spare: [::__fsword_t; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct pthread_attr_t {
         __size: [u64; 7]
     }
 
     pub struct ipc_perm {
         pub __key: ::key_t,
         pub uid: ::uid_t,
         pub gid: ::gid_t,
@@ -90,16 +121,18 @@ pub const O_APPEND: ::c_int = 1024;
 pub const O_CREAT: ::c_int = 64;
 pub const O_EXCL: ::c_int = 128;
 pub const O_NOCTTY: ::c_int = 256;
 pub const O_NONBLOCK: ::c_int = 2048;
 pub const O_SYNC: ::c_int = 1052672;
 pub const O_RSYNC: ::c_int = 1052672;
 pub const O_DSYNC: ::c_int = 4096;
 pub const O_FSYNC: ::c_int = 0x101000;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_PATH: ::c_int = 0o10000000;
 
 pub const MAP_GROWSDOWN: ::c_int = 0x0100;
 
 pub const EDEADLK: ::c_int = 35;
 pub const ENAMETOOLONG: ::c_int = 36;
 pub const ENOLCK: ::c_int = 37;
 pub const ENOSYS: ::c_int = 38;
 pub const ENOTEMPTY: ::c_int = 39;
@@ -205,17 +238,16 @@ pub const SO_SECURITY_AUTHENTICATION: ::
 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
 pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
 pub const SO_BINDTODEVICE: ::c_int = 25;
 pub const SO_ATTACH_FILTER: ::c_int = 26;
 pub const SO_DETACH_FILTER: ::c_int = 27;
 pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
 pub const SO_PEERNAME: ::c_int = 28;
 pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
 pub const SO_ACCEPTCONN: ::c_int = 30;
 pub const SO_PEERSEC: ::c_int = 31;
 pub const SO_PASSSEC: ::c_int = 34;
 pub const SO_TIMESTAMPNS: ::c_int = 35;
 pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
 pub const SO_MARK: ::c_int = 36;
 pub const SO_TIMESTAMPING: ::c_int = 37;
 pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
@@ -280,18 +312,16 @@ pub const TIOCNXCL: ::c_ulong = 0x540D;
 pub const TIOCSCTTY: ::c_ulong = 0x540E;
 pub const TIOCSTI: ::c_ulong = 0x5412;
 pub const TIOCMGET: ::c_ulong = 0x5415;
 pub const TIOCMBIS: ::c_ulong = 0x5416;
 pub const TIOCMBIC: ::c_ulong = 0x5417;
 pub const TIOCMSET: ::c_ulong = 0x5418;
 pub const TIOCCONS: ::c_ulong = 0x541D;
 
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
 pub const SFD_CLOEXEC: ::c_int = 0x080000;
 
 pub const NCCS: usize = 32;
 
 pub const O_TRUNC: ::c_int = 512;
 
 pub const O_CLOEXEC: ::c_int = 0x80000;
 
@@ -330,18 +360,20 @@ pub const O_DIRECT: ::c_int = 0x20000;
 pub const MAP_LOCKED: ::c_int = 0x00080;
 pub const MAP_NORESERVE: ::c_int = 0x00040;
 
 pub const EDEADLOCK: ::c_int = 58;
 
 pub const FIOCLEX: ::c_ulong = 0x20006601;
 pub const FIONBIO: ::c_ulong = 0x8004667e;
 
+pub const SYS_pivot_root: ::c_long = 203;
 pub const SYS_gettid: ::c_long = 207;
 pub const SYS_perf_event_open: ::c_long = 319;
+pub const SYS_memfd_create: ::c_long = 360;
 
 pub const MCL_CURRENT: ::c_int = 0x2000;
 pub const MCL_FUTURE: ::c_int = 0x4000;
 
 pub const SIGSTKSZ: ::size_t = 0x4000;
 pub const MINSIGSTKSZ: ::size_t = 4096;
 pub const CBAUD: ::tcflag_t = 0xff;
 pub const TAB1: ::c_int = 0x400;
@@ -378,16 +410,25 @@ pub const ECHOE: ::tcflag_t = 0x2;
 pub const ECHOK: ::tcflag_t = 0x4;
 pub const ECHONL: ::tcflag_t = 0x10;
 pub const ECHOPRT: ::tcflag_t = 0x20;
 pub const ECHOCTL: ::tcflag_t = 0x40;
 pub const ISIG: ::tcflag_t = 0x80;
 pub const ICANON: ::tcflag_t = 0x100;
 pub const PENDIN: ::tcflag_t = 0x20000000;
 pub const NOFLSH: ::tcflag_t = 0x80000000;
+pub const VSWTC: usize = 9;
+pub const OLCUC:  ::tcflag_t = 0o000004;
+pub const NLDLY:  ::tcflag_t = 0o001400;
+pub const CRDLY:  ::tcflag_t = 0o030000;
+pub const TABDLY: ::tcflag_t = 0o006000;
+pub const BSDLY:  ::tcflag_t = 0o100000;
+pub const FFDLY:  ::tcflag_t = 0o040000;
+pub const VTDLY:  ::tcflag_t = 0o200000;
+pub const XTABS:  ::tcflag_t = 0o006000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b64/sparc64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b64/sparc64.rs
@@ -1,15 +1,16 @@
 //! SPARC64-specific definitions for 64-bit linux-like values
 
 pub type c_char = i8;
 pub type wchar_t = i32;
 pub type nlink_t = u32;
 pub type blksize_t = i64;
 pub type suseconds_t = i32;
+pub type __u64 = ::c_ulonglong;
 
 s! {
     pub struct stat {
         pub st_dev: ::dev_t,
         __pad0: u64,
         pub st_ino: ::ino_t,
         pub st_mode: ::mode_t,
         pub st_nlink: ::nlink_t,
@@ -92,16 +93,18 @@ pub const O_APPEND: ::c_int = 0x8;
 pub const O_CREAT: ::c_int = 0x200;
 pub const O_EXCL: ::c_int = 0x800;
 pub const O_NOCTTY: ::c_int = 0x8000;
 pub const O_NONBLOCK: ::c_int = 0x4000;
 pub const O_SYNC: ::c_int = 0x802000;
 pub const O_RSYNC: ::c_int = 0x802000;
 pub const O_DSYNC: ::c_int = 0x2000;
 pub const O_FSYNC: ::c_int = 0x802000;
+pub const O_NOATIME: ::c_int = 0x200000;
+pub const O_PATH: ::c_int = 0x1000000;
 
 pub const MAP_GROWSDOWN: ::c_int = 0x0200;
 
 pub const EDEADLK: ::c_int = 78;
 pub const ENAMETOOLONG: ::c_int = 63;
 pub const ENOLCK: ::c_int = 79;
 pub const ENOSYS: ::c_int = 90;
 pub const ENOTEMPTY: ::c_int = 66;
@@ -177,22 +180,29 @@ pub const EKEYREJECTED: ::c_int = 131;
 pub const EOWNERDEAD: ::c_int = 132;
 pub const ENOTRECOVERABLE: ::c_int = 133;
 pub const EHWPOISON: ::c_int = 135;
 pub const ERFKILL: ::c_int = 134;
 
 pub const SOL_SOCKET: ::c_int = 0xffff;
 
 pub const SO_REUSEADDR: ::c_int = 4;
+pub const SO_BINDTODEVICE: ::c_int = 0x000d;
+pub const SO_TIMESTAMP: ::c_int = 0x001d;
+pub const SO_MARK: ::c_int = 0x0022;
+pub const SO_RXQ_OVFL: ::c_int = 0x0024;
+pub const SO_PEEK_OFF: ::c_int = 0x0026;
+pub const SO_BUSY_POLL: ::c_int = 0x0030;
 pub const SO_TYPE: ::c_int = 0x1008;
 pub const SO_ERROR: ::c_int = 0x1007;
 pub const SO_DONTROUTE: ::c_int = 16;
 pub const SO_BROADCAST: ::c_int = 32;
 pub const SO_SNDBUF: ::c_int = 0x1001;
 pub const SO_RCVBUF: ::c_int = 0x1002;
+pub const SO_DOMAIN: ::c_int = 0x1029;
 pub const SO_KEEPALIVE: ::c_int = 8;
 pub const SO_OOBINLINE: ::c_int = 0x100;
 pub const SO_LINGER: ::c_int = 128;
 pub const SO_REUSEPORT: ::c_int = 0x200;
 pub const SO_ACCEPTCONN: ::c_int = 0x8000;
 
 pub const SA_ONSTACK: ::c_int = 1;
 pub const SA_SIGINFO: ::c_int = 0x200;
@@ -337,16 +347,27 @@ pub const ECHOE: ::tcflag_t = 0x10;
 pub const ECHOK: ::tcflag_t = 0x20;
 pub const ECHONL: ::tcflag_t = 0x40;
 pub const ECHOPRT: ::tcflag_t = 0x400;
 pub const ECHOCTL: ::tcflag_t = 0x200;
 pub const ISIG: ::tcflag_t = 0x1;
 pub const ICANON: ::tcflag_t = 0x2;
 pub const PENDIN: ::tcflag_t = 0x4000;
 pub const NOFLSH: ::tcflag_t = 0x80;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0x00001000;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
 
 pub const VEOL: usize = 5;
 pub const VEOL2: usize = 6;
 pub const VMIN: usize = 4;
 pub const IEXTEN: ::tcflag_t = 0x8000;
 pub const TOSTOP: ::tcflag_t = 0x100;
 pub const FLUSHO: ::tcflag_t = 0x2000;
 pub const EXTPROC: ::tcflag_t = 0x10000;
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/b64/x86_64.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/b64/x86_64.rs
@@ -1,16 +1,17 @@
 //! x86_64-specific definitions for 64-bit linux-like values
 
 pub type c_char = i8;
 pub type wchar_t = i32;
 pub type nlink_t = u64;
 pub type blksize_t = i64;
 pub type greg_t = i64;
 pub type suseconds_t = i64;
+pub type __u64 = ::c_ulonglong;
 
 s! {
     pub struct stat {
         pub st_dev: ::dev_t,
         pub st_ino: ::ino_t,
         pub st_nlink: ::nlink_t,
         pub st_mode: ::mode_t,
         pub st_uid: ::uid_t,
@@ -45,16 +46,46 @@ s! {
         pub st_atime_nsec: ::c_long,
         pub st_mtime: ::time_t,
         pub st_mtime_nsec: ::c_long,
         pub st_ctime: ::time_t,
         pub st_ctime_nsec: ::c_long,
         __reserved: [::c_long; 3],
     }
 
+    pub struct statfs64 {
+        pub f_type: ::__fsword_t,
+        pub f_bsize: ::__fsword_t,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::__fsword_t,
+        pub f_frsize: ::__fsword_t,
+        pub f_flags: ::__fsword_t,
+        pub f_spare: [::__fsword_t; 4],
+    }
+
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+
     pub struct pthread_attr_t {
         __size: [u64; 7]
     }
 
     pub struct _libc_fpxreg {
         pub significand: [u16; 4],
         pub exponent: u16,
         __private: [u16; 3],
@@ -193,16 +224,18 @@ pub const O_APPEND: ::c_int = 1024;
 pub const O_CREAT: ::c_int = 64;
 pub const O_EXCL: ::c_int = 128;
 pub const O_NOCTTY: ::c_int = 256;
 pub const O_NONBLOCK: ::c_int = 2048;
 pub const O_SYNC: ::c_int = 1052672;
 pub const O_RSYNC: ::c_int = 1052672;
 pub const O_DSYNC: ::c_int = 4096;
 pub const O_FSYNC: ::c_int = 0x101000;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_PATH: ::c_int = 0o10000000;
 
 pub const MAP_GROWSDOWN: ::c_int = 0x0100;
 
 pub const EDEADLK: ::c_int = 35;
 pub const ENAMETOOLONG: ::c_int = 36;
 pub const ENOLCK: ::c_int = 37;
 pub const ENOSYS: ::c_int = 38;
 pub const ENOTEMPTY: ::c_int = 39;
@@ -308,17 +341,16 @@ pub const SO_SECURITY_AUTHENTICATION: ::
 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
 pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
 pub const SO_BINDTODEVICE: ::c_int = 25;
 pub const SO_ATTACH_FILTER: ::c_int = 26;
 pub const SO_DETACH_FILTER: ::c_int = 27;
 pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
 pub const SO_PEERNAME: ::c_int = 28;
 pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
 pub const SO_ACCEPTCONN: ::c_int = 30;
 pub const SO_PEERSEC: ::c_int = 31;
 pub const SO_PASSSEC: ::c_int = 34;
 pub const SO_TIMESTAMPNS: ::c_int = 35;
 pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
 pub const SO_MARK: ::c_int = 36;
 pub const SO_TIMESTAMPING: ::c_int = 37;
 pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
@@ -383,18 +415,16 @@ pub const TIOCNXCL: ::c_ulong = 0x540D;
 pub const TIOCSCTTY: ::c_ulong = 0x540E;
 pub const TIOCSTI: ::c_ulong = 0x5412;
 pub const TIOCMGET: ::c_ulong = 0x5415;
 pub const TIOCMBIS: ::c_ulong = 0x5416;
 pub const TIOCMBIC: ::c_ulong = 0x5417;
 pub const TIOCMSET: ::c_ulong = 0x5418;
 pub const TIOCCONS: ::c_ulong = 0x541D;
 
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
 pub const SFD_CLOEXEC: ::c_int = 0x080000;
 
 pub const NCCS: usize = 32;
 
 pub const O_TRUNC: ::c_int = 512;
 
 pub const O_CLOEXEC: ::c_int = 0x80000;
 
@@ -440,31 +470,18 @@ pub const FIOCLEX: ::c_ulong = 0x5451;
 pub const FIONBIO: ::c_ulong = 0x5421;
 
 pub const PTRACE_GETFPREGS: ::c_uint = 14;
 pub const PTRACE_SETFPREGS: ::c_uint = 15;
 pub const PTRACE_GETFPXREGS: ::c_uint = 18;
 pub const PTRACE_SETFPXREGS: ::c_uint = 19;
 pub const PTRACE_GETREGS: ::c_uint = 12;
 pub const PTRACE_SETREGS: ::c_uint = 13;
-pub const PTRACE_O_EXITKILL: ::c_uint = 1048576;
-pub const PTRACE_O_TRACECLONE: ::c_uint = 8;
-pub const PTRACE_O_TRACEEXEC: ::c_uint = 16;
-pub const PTRACE_O_TRACEEXIT: ::c_uint = 64;
-pub const PTRACE_O_TRACEFORK: ::c_uint = 2;
-pub const PTRACE_O_TRACESYSGOOD: ::c_uint = 1;
-pub const PTRACE_O_TRACEVFORK: ::c_uint = 4;
-pub const PTRACE_O_TRACEVFORKDONE: ::c_uint = 32;
-pub const PTRACE_O_TRACESECCOMP: ::c_uint = 128;
-pub const PTRACE_O_SUSPEND_SECCOMP: ::c_uint = 2097152;
 pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1;
 
-pub const SYS_gettid: ::c_long = 186;
-pub const SYS_perf_event_open: ::c_long = 298;
-
 pub const MCL_CURRENT: ::c_int = 0x0001;
 pub const MCL_FUTURE: ::c_int = 0x0002;
 
 pub const SIGSTKSZ: ::size_t = 8192;
 pub const MINSIGSTKSZ: ::size_t = 2048;
 pub const CBAUD: ::tcflag_t = 0o0010017;
 pub const TAB1: ::c_int = 0x00000800;
 pub const TAB2: ::c_int = 0x00001000;
@@ -500,16 +517,27 @@ pub const ECHOE: ::tcflag_t = 0x00000010
 pub const ECHOK: ::tcflag_t = 0x00000020;
 pub const ECHONL: ::tcflag_t = 0x00000040;
 pub const ECHOPRT: ::tcflag_t = 0x00000400;
 pub const ECHOCTL: ::tcflag_t = 0x00000200;
 pub const ISIG: ::tcflag_t = 0x00000001;
 pub const ICANON: ::tcflag_t = 0x00000002;
 pub const PENDIN: ::tcflag_t = 0x00004000;
 pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC:  ::tcflag_t = 0o000002;
+pub const NLDLY:  ::tcflag_t = 0o000400;
+pub const CRDLY:  ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const XTABS:  ::tcflag_t = 0o014000;
 
 pub const B0: ::speed_t = 0o000000;
 pub const B50: ::speed_t = 0o000001;
 pub const B75: ::speed_t = 0o000002;
 pub const B110: ::speed_t = 0o000003;
 pub const B134: ::speed_t = 0o000004;
 pub const B150: ::speed_t = 0o000005;
 pub const B200: ::speed_t = 0o000006;
@@ -561,16 +589,380 @@ pub const TCFLSH: ::c_ulong = 0x540B;
 pub const TIOCINQ: ::c_ulong = 0x541B;
 pub const TIOCGPGRP: ::c_ulong = 0x540F;
 pub const TIOCSPGRP: ::c_ulong = 0x5410;
 pub const TIOCOUTQ: ::c_ulong = 0x5411;
 pub const TIOCGWINSZ: ::c_ulong = 0x5413;
 pub const TIOCSWINSZ: ::c_ulong = 0x5414;
 pub const FIONREAD: ::c_ulong = 0x541B;
 
+// Syscall table
+
+pub const SYS_read: ::c_long = 0;
+pub const SYS_write: ::c_long = 1;
+pub const SYS_open: ::c_long = 2;
+pub const SYS_close: ::c_long = 3;
+pub const SYS_stat: ::c_long = 4;
+pub const SYS_fstat: ::c_long = 5;
+pub const SYS_lstat: ::c_long = 6;
+pub const SYS_poll: ::c_long = 7;
+pub const SYS_lseek: ::c_long = 8;
+pub const SYS_mmap: ::c_long = 9;
+pub const SYS_mprotect: ::c_long = 10;
+pub const SYS_munmap: ::c_long = 11;
+pub const SYS_brk: ::c_long = 12;
+pub const SYS_rt_sigaction: ::c_long = 13;
+pub const SYS_rt_sigprocmask: ::c_long = 14;
+pub const SYS_rt_sigreturn: ::c_long = 15;
+pub const SYS_ioctl: ::c_long = 16;
+pub const SYS_pread64: ::c_long = 17;
+pub const SYS_pwrite64: ::c_long = 18;
+pub const SYS_readv: ::c_long = 19;
+pub const SYS_writev: ::c_long = 20;
+pub const SYS_access: ::c_long = 21;
+pub const SYS_pipe: ::c_long = 22;
+pub const SYS_select: ::c_long = 23;
+pub const SYS_sched_yield: ::c_long = 24;
+pub const SYS_mremap: ::c_long = 25;
+pub const SYS_msync: ::c_long = 26;
+pub const SYS_mincore: ::c_long = 27;
+pub const SYS_madvise: ::c_long = 28;
+pub const SYS_shmget: ::c_long = 29;
+pub const SYS_shmat: ::c_long = 30;
+pub const SYS_shmctl: ::c_long = 31;
+pub const SYS_dup: ::c_long = 32;
+pub const SYS_dup2: ::c_long = 33;
+pub const SYS_pause: ::c_long = 34;
+pub const SYS_nanosleep: ::c_long = 35;
+pub const SYS_getitimer: ::c_long = 36;
+pub const SYS_alarm: ::c_long = 37;
+pub const SYS_setitimer: ::c_long = 38;
+pub const SYS_getpid: ::c_long = 39;
+pub const SYS_sendfile: ::c_long = 40;
+pub const SYS_socket: ::c_long = 41;
+pub const SYS_connect: ::c_long = 42;
+pub const SYS_accept: ::c_long = 43;
+pub const SYS_sendto: ::c_long = 44;
+pub const SYS_recvfrom: ::c_long = 45;
+pub const SYS_sendmsg: ::c_long = 46;
+pub const SYS_recvmsg: ::c_long = 47;
+pub const SYS_shutdown: ::c_long = 48;
+pub const SYS_bind: ::c_long = 49;
+pub const SYS_listen: ::c_long = 50;
+pub const SYS_getsockname: ::c_long = 51;
+pub const SYS_getpeername: ::c_long = 52;
+pub const SYS_socketpair: ::c_long = 53;
+pub const SYS_setsockopt: ::c_long = 54;
+pub const SYS_getsockopt: ::c_long = 55;
+pub const SYS_clone: ::c_long = 56;
+pub const SYS_fork: ::c_long = 57;
+pub const SYS_vfork: ::c_long = 58;
+pub const SYS_execve: ::c_long = 59;
+pub const SYS_exit: ::c_long = 60;
+pub const SYS_wait4: ::c_long = 61;
+pub const SYS_kill: ::c_long = 62;
+pub const SYS_uname: ::c_long = 63;
+pub const SYS_semget: ::c_long = 64;
+pub const SYS_semop: ::c_long = 65;
+pub const SYS_semctl: ::c_long = 66;
+pub const SYS_shmdt: ::c_long = 67;
+pub const SYS_msgget: ::c_long = 68;
+pub const SYS_msgsnd: ::c_long = 69;
+pub const SYS_msgrcv: ::c_long = 70;
+pub const SYS_msgctl: ::c_long = 71;
+pub const SYS_fcntl: ::c_long = 72;
+pub const SYS_flock: ::c_long = 73;
+pub const SYS_fsync: ::c_long = 74;
+pub const SYS_fdatasync: ::c_long = 75;
+pub const SYS_truncate: ::c_long = 76;
+pub const SYS_ftruncate: ::c_long = 77;
+pub const SYS_getdents: ::c_long = 78;
+pub const SYS_getcwd: ::c_long = 79;
+pub const SYS_chdir: ::c_long = 80;
+pub const SYS_fchdir: ::c_long = 81;
+pub const SYS_rename: ::c_long = 82;
+pub const SYS_mkdir: ::c_long = 83;
+pub const SYS_rmdir: ::c_long = 84;
+pub const SYS_creat: ::c_long = 85;
+pub const SYS_link: ::c_long = 86;
+pub const SYS_unlink: ::c_long = 87;
+pub const SYS_symlink: ::c_long = 88;
+pub const SYS_readlink: ::c_long = 89;
+pub const SYS_chmod: ::c_long = 90;
+pub const SYS_fchmod: ::c_long = 91;
+pub const SYS_chown: ::c_long = 92;
+pub const SYS_fchown: ::c_long = 93;
+pub const SYS_lchown: ::c_long = 94;
+pub const SYS_umask: ::c_long = 95;
+pub const SYS_gettimeofday: ::c_long = 96;
+pub const SYS_getrlimit: ::c_long = 97;
+pub const SYS_getrusage: ::c_long = 98;
+pub const SYS_sysinfo: ::c_long = 99;
+pub const SYS_times: ::c_long = 100;
+pub const SYS_ptrace: ::c_long = 101;
+pub const SYS_getuid: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_getgid: ::c_long = 104;
+pub const SYS_setuid: ::c_long = 105;
+pub const SYS_setgid: ::c_long = 106;
+pub const SYS_geteuid: ::c_long = 107;
+pub const SYS_getegid: ::c_long = 108;
+pub const SYS_setpgid: ::c_long = 109;
+pub const SYS_getppid: ::c_long = 110;
+pub const SYS_getpgrp: ::c_long = 111;
+pub const SYS_setsid: ::c_long = 112;
+pub const SYS_setreuid: ::c_long = 113;
+pub const SYS_setregid: ::c_long = 114;
+pub const SYS_getgroups: ::c_long = 115;
+pub const SYS_setgroups: ::c_long = 116;
+pub const SYS_setresuid: ::c_long = 117;
+pub const SYS_getresuid: ::c_long = 118;
+pub const SYS_setresgid: ::c_long = 119;
+pub const SYS_getresgid: ::c_long = 120;
+pub const SYS_getpgid: ::c_long = 121;
+pub const SYS_setfsuid: ::c_long = 122;
+pub const SYS_setfsgid: ::c_long = 123;
+pub const SYS_getsid: ::c_long = 124;
+pub const SYS_capget: ::c_long = 125;
+pub const SYS_capset: ::c_long = 126;
+pub const SYS_rt_sigpending: ::c_long = 127;
+pub const SYS_rt_sigtimedwait: ::c_long = 128;
+pub const SYS_rt_sigqueueinfo: ::c_long = 129;
+pub const SYS_rt_sigsuspend: ::c_long = 130;
+pub const SYS_sigaltstack: ::c_long = 131;
+pub const SYS_utime: ::c_long = 132;
+pub const SYS_mknod: ::c_long = 133;
+pub const SYS_uselib: ::c_long = 134;
+pub const SYS_personality: ::c_long = 135;
+pub const SYS_ustat: ::c_long = 136;
+pub const SYS_statfs: ::c_long = 137;
+pub const SYS_fstatfs: ::c_long = 138;
+pub const SYS_sysfs: ::c_long = 139;
+pub const SYS_getpriority: ::c_long = 140;
+pub const SYS_setpriority: ::c_long = 141;
+pub const SYS_sched_setparam: ::c_long = 142;
+pub const SYS_sched_getparam: ::c_long = 143;
+pub const SYS_sched_setscheduler: ::c_long = 144;
+pub const SYS_sched_getscheduler: ::c_long = 145;
+pub const SYS_sched_get_priority_max: ::c_long = 146;
+pub const SYS_sched_get_priority_min: ::c_long = 147;
+pub const SYS_sched_rr_get_interval: ::c_long = 148;
+pub const SYS_mlock: ::c_long = 149;
+pub const SYS_munlock: ::c_long = 150;
+pub const SYS_mlockall: ::c_long = 151;
+pub const SYS_munlockall: ::c_long = 152;
+pub const SYS_vhangup: ::c_long = 153;
+pub const SYS_modify_ldt: ::c_long = 154;
+pub const SYS_pivot_root: ::c_long = 155;
+pub const SYS__sysctl: ::c_long = 156;
+pub const SYS_prctl: ::c_long = 157;
+pub const SYS_arch_prctl: ::c_long = 158;
+pub const SYS_adjtimex: ::c_long = 159;
+pub const SYS_setrlimit: ::c_long = 160;
+pub const SYS_chroot: ::c_long = 161;
+pub const SYS_sync: ::c_long = 162;
+pub const SYS_acct: ::c_long = 163;
+pub const SYS_settimeofday: ::c_long = 164;
+pub const SYS_mount: ::c_long = 165;
+pub const SYS_umount2: ::c_long = 166;
+pub const SYS_swapon: ::c_long = 167;
+pub const SYS_swapoff: ::c_long = 168;
+pub const SYS_reboot: ::c_long = 169;
+pub const SYS_sethostname: ::c_long = 170;
+pub const SYS_setdomainname: ::c_long = 171;
+pub const SYS_iopl: ::c_long = 172;
+pub const SYS_ioperm: ::c_long = 173;
+pub const SYS_create_module: ::c_long = 174;
+pub const SYS_init_module: ::c_long = 175;
+pub const SYS_delete_module: ::c_long = 176;
+pub const SYS_get_kernel_syms: ::c_long = 177;
+pub const SYS_query_module: ::c_long = 178;
+pub const SYS_quotactl: ::c_long = 179;
+pub const SYS_nfsservctl: ::c_long = 180;
+pub const SYS_getpmsg: ::c_long = 181;
+pub const SYS_putpmsg: ::c_long = 182;
+pub const SYS_afs_syscall: ::c_long = 183;
+pub const SYS_tuxcall: ::c_long = 184;
+pub const SYS_security: ::c_long = 185;
+pub const SYS_gettid: ::c_long = 186;
+pub const SYS_readahead: ::c_long = 187;
+pub const SYS_setxattr: ::c_long = 188;
+pub const SYS_lsetxattr: ::c_long = 189;
+pub const SYS_fsetxattr: ::c_long = 190;
+pub const SYS_getxattr: ::c_long = 191;
+pub const SYS_lgetxattr: ::c_long = 192;
+pub const SYS_fgetxattr: ::c_long = 193;
+pub const SYS_listxattr: ::c_long = 194;
+pub const SYS_llistxattr: ::c_long = 195;
+pub const SYS_flistxattr: ::c_long = 196;
+pub const SYS_removexattr: ::c_long = 197;
+pub const SYS_lremovexattr: ::c_long = 198;
+pub const SYS_fremovexattr: ::c_long = 199;
+pub const SYS_tkill: ::c_long = 200;
+pub const SYS_time: ::c_long = 201;
+pub const SYS_futex: ::c_long = 202;
+pub const SYS_sched_setaffinity: ::c_long = 203;
+pub const SYS_sched_getaffinity: ::c_long = 204;
+pub const SYS_set_thread_area: ::c_long = 205;
+pub const SYS_io_setup: ::c_long = 206;
+pub const SYS_io_destroy: ::c_long = 207;
+pub const SYS_io_getevents: ::c_long = 208;
+pub const SYS_io_submit: ::c_long = 209;
+pub const SYS_io_cancel: ::c_long = 210;
+pub const SYS_get_thread_area: ::c_long = 211;
+pub const SYS_lookup_dcookie: ::c_long = 212;
+pub const SYS_epoll_create: ::c_long = 213;
+pub const SYS_epoll_ctl_old: ::c_long = 214;
+pub const SYS_epoll_wait_old: ::c_long = 215;
+pub const SYS_remap_file_pages: ::c_long = 216;
+pub const SYS_getdents64: ::c_long = 217;
+pub const SYS_set_tid_address: ::c_long = 218;
+pub const SYS_restart_syscall: ::c_long = 219;
+pub const SYS_semtimedop: ::c_long = 220;
+pub const SYS_fadvise64: ::c_long = 221;
+pub const SYS_timer_create: ::c_long = 222;
+pub const SYS_timer_settime: ::c_long = 223;
+pub const SYS_timer_gettime: ::c_long = 224;
+pub const SYS_timer_getoverrun: ::c_long = 225;
+pub const SYS_timer_delete: ::c_long = 226;
+pub const SYS_clock_settime: ::c_long = 227;
+pub const SYS_clock_gettime: ::c_long = 228;
+pub const SYS_clock_getres: ::c_long = 229;
+pub const SYS_clock_nanosleep: ::c_long = 230;
+pub const SYS_exit_group: ::c_long = 231;
+pub const SYS_epoll_wait: ::c_long = 232;
+pub const SYS_epoll_ctl: ::c_long = 233;
+pub const SYS_tgkill: ::c_long = 234;
+pub const SYS_utimes: ::c_long = 235;
+pub const SYS_vserver: ::c_long = 236;
+pub const SYS_mbind: ::c_long = 237;
+pub const SYS_set_mempolicy: ::c_long = 238;
+pub const SYS_get_mempolicy: ::c_long = 239;
+pub const SYS_mq_open: ::c_long = 240;
+pub const SYS_mq_unlink: ::c_long = 241;
+pub const SYS_mq_timedsend: ::c_long = 242;
+pub const SYS_mq_timedreceive: ::c_long = 243;
+pub const SYS_mq_notify: ::c_long = 244;
+pub const SYS_mq_getsetattr: ::c_long = 245;
+pub const SYS_kexec_load: ::c_long = 246;
+pub const SYS_waitid: ::c_long = 247;
+pub const SYS_add_key: ::c_long = 248;
+pub const SYS_request_key: ::c_long = 249;
+pub const SYS_keyctl: ::c_long = 250;
+pub const SYS_ioprio_set: ::c_long = 251;
+pub const SYS_ioprio_get: ::c_long = 252;
+pub const SYS_inotify_init: ::c_long = 253;
+pub const SYS_inotify_add_watch: ::c_long = 254;
+pub const SYS_inotify_rm_watch: ::c_long = 255;
+pub const SYS_migrate_pages: ::c_long = 256;
+pub const SYS_openat: ::c_long = 257;
+pub const SYS_mkdirat: ::c_long = 258;
+pub const SYS_mknodat: ::c_long = 259;
+pub const SYS_fchownat: ::c_long = 260;
+pub const SYS_futimesat: ::c_long = 261;
+pub const SYS_newfstatat: ::c_long = 262;
+pub const SYS_unlinkat: ::c_long = 263;
+pub const SYS_renameat: ::c_long = 264;
+pub const SYS_linkat: ::c_long = 265;
+pub const SYS_symlinkat: ::c_long = 266;
+pub const SYS_readlinkat: ::c_long = 267;
+pub const SYS_fchmodat: ::c_long = 268;
+pub const SYS_faccessat: ::c_long = 269;
+pub const SYS_pselect6: ::c_long = 270;
+pub const SYS_ppoll: ::c_long = 271;
+pub const SYS_unshare: ::c_long = 272;
+pub const SYS_set_robust_list: ::c_long = 273;
+pub const SYS_get_robust_list: ::c_long = 274;
+pub const SYS_splice: ::c_long = 275;
+pub const SYS_tee: ::c_long = 276;
+pub const SYS_sync_file_range: ::c_long = 277;
+pub const SYS_vmsplice: ::c_long = 278;
+pub const SYS_move_pages: ::c_long = 279;
+pub const SYS_utimensat: ::c_long = 280;
+pub const SYS_epoll_pwait: ::c_long = 281;
+pub const SYS_signalfd: ::c_long = 282;
+pub const SYS_timerfd_create: ::c_long = 283;
+pub const SYS_eventfd: ::c_long = 284;
+pub const SYS_fallocate: ::c_long = 285;
+pub const SYS_timerfd_settime: ::c_long = 286;
+pub const SYS_timerfd_gettime: ::c_long = 287;
+pub const SYS_accept4: ::c_long = 288;
+pub const SYS_signalfd4: ::c_long = 289;
+pub const SYS_eventfd2: ::c_long = 290;
+pub const SYS_epoll_create1: ::c_long = 291;
+pub const SYS_dup3: ::c_long = 292;
+pub const SYS_pipe2: ::c_long = 293;
+pub const SYS_inotify_init1: ::c_long = 294;
+pub const SYS_preadv: ::c_long = 295;
+pub const SYS_pwritev: ::c_long = 296;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 297;
+pub const SYS_perf_event_open: ::c_long = 298;
+pub const SYS_recvmmsg: ::c_long = 299;
+pub const SYS_fanotify_init: ::c_long = 300;
+pub const SYS_fanotify_mark: ::c_long = 301;
+pub const SYS_prlimit64: ::c_long = 302;
+pub const SYS_name_to_handle_at: ::c_long = 303;
+pub const SYS_open_by_handle_at: ::c_long = 304;
+pub const SYS_clock_adjtime: ::c_long = 305;
+pub const SYS_syncfs: ::c_long = 306;
+pub const SYS_sendmmsg: ::c_long = 307;
+pub const SYS_setns: ::c_long = 308;
+pub const SYS_getcpu: ::c_long = 309;
+pub const SYS_process_vm_readv: ::c_long = 310;
+pub const SYS_process_vm_writev: ::c_long = 311;
+pub const SYS_kcmp: ::c_long = 312;
+pub const SYS_finit_module: ::c_long = 313;
+pub const SYS_sched_setattr: ::c_long = 314;
+pub const SYS_sched_getattr: ::c_long = 315;
+pub const SYS_renameat2: ::c_long = 316;
+pub const SYS_seccomp: ::c_long = 317;
+pub const SYS_getrandom: ::c_long = 318;
+pub const SYS_memfd_create: ::c_long = 319;
+pub const SYS_kexec_file_load: ::c_long = 320;
+pub const SYS_bpf: ::c_long = 321;
+pub const SYS_execveat: ::c_long = 322;
+pub const SYS_userfaultfd: ::c_long = 323;
+pub const SYS_membarrier: ::c_long = 324;
+pub const SYS_mlock2: ::c_long = 325;
+pub const SYS_copy_file_range: ::c_long = 326;
+pub const SYS_preadv2: ::c_long = 327;
+pub const SYS_pwritev2: ::c_long = 328;
+pub const SYS_pkey_mprotect: ::c_long = 329;
+pub const SYS_pkey_alloc: ::c_long = 330;
+pub const SYS_pkey_free: ::c_long = 331;
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const R15: ::c_int = 0;
+pub const R14: ::c_int = 1;
+pub const R13: ::c_int = 2;
+pub const R12: ::c_int = 3;
+pub const RBP: ::c_int = 4;
+pub const RBX: ::c_int = 5;
+pub const R11: ::c_int = 6;
+pub const R10: ::c_int = 7;
+pub const R9: ::c_int = 8;
+pub const R8: ::c_int = 9;
+pub const RAX: ::c_int = 10;
+pub const RCX: ::c_int = 11;
+pub const RDX: ::c_int = 12;
+pub const RSI: ::c_int = 13;
+pub const RDI: ::c_int = 14;
+pub const ORIG_RAX: ::c_int = 15;
+pub const RIP: ::c_int = 16;
+pub const CS: ::c_int = 17;
+pub const EFLAGS: ::c_int = 18;
+pub const RSP: ::c_int = 19;
+pub const SS: ::c_int = 20;
+pub const FS_BASE: ::c_int = 21;
+pub const GS_BASE: ::c_int = 22;
+pub const DS: ::c_int = 23;
+pub const ES: ::c_int = 24;
+pub const FS: ::c_int = 25;
+pub const GS: ::c_int = 26;
+
 extern {
     pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
     pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
     pub fn makecontext(ucp: *mut ucontext_t,
                        func:  extern fn (),
                        argc: ::c_int, ...);
     pub fn swapcontext(uocp: *mut ucontext_t,
                        ucp: *const ucontext_t) -> ::c_int;
--- a/third_party/rust/libc/src/unix/notbsd/linux/other/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/other/mod.rs
@@ -264,29 +264,97 @@ pub const SIGTTOU: ::c_int = 22;
 pub const SIGXCPU: ::c_int = 24;
 pub const SIGXFSZ: ::c_int = 25;
 pub const SIGVTALRM: ::c_int = 26;
 pub const SIGPROF: ::c_int = 27;
 pub const SIGWINCH: ::c_int = 28;
 
 pub const SIGEV_THREAD_ID: ::c_int = 4;
 
-pub const POLLRDNORM: ::c_short = 0x040;
-pub const POLLRDBAND: ::c_short = 0x080;
-
-pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
-pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
-
 pub const BUFSIZ: ::c_uint = 8192;
 pub const TMP_MAX: ::c_uint = 238328;
 pub const FOPEN_MAX: ::c_uint = 16;
 pub const POSIX_FADV_DONTNEED: ::c_int = 4;
 pub const POSIX_FADV_NOREUSE: ::c_int = 5;
 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
+pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
+pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
+pub const _SC_PII: ::c_int = 53;
+pub const _SC_PII_XTI: ::c_int = 54;
+pub const _SC_PII_SOCKET: ::c_int = 55;
+pub const _SC_PII_INTERNET: ::c_int = 56;
+pub const _SC_PII_OSI: ::c_int = 57;
+pub const _SC_POLL: ::c_int = 58;
+pub const _SC_SELECT: ::c_int = 59;
+pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
+pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
+pub const _SC_PII_OSI_COTS: ::c_int = 63;
+pub const _SC_PII_OSI_CLTS: ::c_int = 64;
+pub const _SC_PII_OSI_M: ::c_int = 65;
+pub const _SC_T_IOV_MAX: ::c_int = 66;
 pub const _SC_2_C_VERSION: ::c_int = 96;
+pub const _SC_CHAR_BIT: ::c_int = 101;
+pub const _SC_CHAR_MAX: ::c_int = 102;
+pub const _SC_CHAR_MIN: ::c_int = 103;
+pub const _SC_INT_MAX: ::c_int = 104;
+pub const _SC_INT_MIN: ::c_int = 105;
+pub const _SC_LONG_BIT: ::c_int = 106;
+pub const _SC_WORD_BIT: ::c_int = 107;
+pub const _SC_MB_LEN_MAX: ::c_int = 108;
+pub const _SC_SSIZE_MAX: ::c_int = 110;
+pub const _SC_SCHAR_MAX: ::c_int = 111;
+pub const _SC_SCHAR_MIN: ::c_int = 112;
+pub const _SC_SHRT_MAX: ::c_int = 113;
+pub const _SC_SHRT_MIN: ::c_int = 114;
+pub const _SC_UCHAR_MAX: ::c_int = 115;
+pub const _SC_UINT_MAX: ::c_int = 116;
+pub const _SC_ULONG_MAX: ::c_int = 117;
+pub const _SC_USHRT_MAX: ::c_int = 118;
+pub const _SC_NL_ARGMAX: ::c_int = 119;
+pub const _SC_NL_LANGMAX: ::c_int = 120;
+pub const _SC_NL_MSGMAX: ::c_int = 121;
+pub const _SC_NL_NMAX: ::c_int = 122;
+pub const _SC_NL_SETMAX: ::c_int = 123;
+pub const _SC_NL_TEXTMAX: ::c_int = 124;
+pub const _SC_BASE: ::c_int = 134;
+pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
+pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
+pub const _SC_DEVICE_IO: ::c_int = 140;
+pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
+pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
+pub const _SC_FD_MGMT: ::c_int = 143;
+pub const _SC_FIFO: ::c_int = 144;
+pub const _SC_PIPE: ::c_int = 145;
+pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
+pub const _SC_FILE_LOCKING: ::c_int = 147;
+pub const _SC_FILE_SYSTEM: ::c_int = 148;
+pub const _SC_MULTI_PROCESS: ::c_int = 150;
+pub const _SC_SINGLE_PROCESS: ::c_int = 151;
+pub const _SC_NETWORKING: ::c_int = 152;
+pub const _SC_REGEX_VERSION: ::c_int = 156;
+pub const _SC_SIGNALS: ::c_int = 158;
+pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
+pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
+pub const _SC_USER_GROUPS: ::c_int = 166;
+pub const _SC_USER_GROUPS_R: ::c_int = 167;
+pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
+pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
+pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
+pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
+pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
+pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
+pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
+pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
+pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
+pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
+pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
+pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
+pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
+pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
+pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
 pub const O_ACCMODE: ::c_int = 3;
 pub const ST_RELATIME: ::c_ulong = 4096;
 pub const NI_MAXHOST: ::socklen_t = 1025;
 
 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
 pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
 pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
 pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
@@ -337,23 +405,18 @@ pub const PTRACE_GETSIGINFO: ::c_uint = 
 pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
 pub const PTRACE_GETREGSET: ::c_uint = 0x4204;
 pub const PTRACE_SETREGSET: ::c_uint = 0x4205;
 pub const PTRACE_SEIZE: ::c_uint = 0x4206;
 pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
 pub const PTRACE_LISTEN: ::c_uint = 0x4208;
 pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
 
-pub const MADV_DODUMP: ::c_int = 17;
-pub const MADV_DONTDUMP: ::c_int = 16;
-
 pub const EPOLLWAKEUP: ::c_int = 0x20000000;
 
-pub const MADV_HUGEPAGE: ::c_int = 14;
-pub const MADV_NOHUGEPAGE: ::c_int = 15;
 pub const MAP_HUGETLB: ::c_int = 0x040000;
 
 pub const SEEK_DATA: ::c_int = 3;
 pub const SEEK_HOLE: ::c_int = 4;
 
 pub const TCSANOW: ::c_int = 0;
 pub const TCSADRAIN: ::c_int = 1;
 pub const TCSAFLUSH: ::c_int = 2;
@@ -438,16 +501,28 @@ pub const NETLINK_TX_RING: ::c_int = 7;
 pub const NETLINK_LISTEN_ALL_NSID: ::c_int = 8;
 pub const NETLINK_LIST_MEMBERSHIPS: ::c_int = 9;
 pub const NETLINK_CAP_ACK: ::c_int = 10;
 
 pub const NLA_F_NESTED: ::c_int = 1 << 15;
 pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14;
 pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER);
 
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
 cfg_if! {
     if #[cfg(any(target_arch = "arm", target_arch = "x86",
                  target_arch = "x86_64"))] {
         pub const PTHREAD_STACK_MIN: ::size_t = 16384;
     } else if #[cfg(target_arch = "sparc64")] {
         pub const PTHREAD_STACK_MIN: ::size_t = 0x6000;
     } else {
         pub const PTHREAD_STACK_MIN: ::size_t = 131072;
@@ -495,16 +570,20 @@ extern {
     pub fn setpriority(which: ::__priority_which_t, who: ::id_t,
                                        prio: ::c_int) -> ::c_int;
     pub fn pthread_getaffinity_np(thread: ::pthread_t,
                                   cpusetsize: ::size_t,
                                   cpuset: *mut ::cpu_set_t) -> ::c_int;
     pub fn pthread_setaffinity_np(thread: ::pthread_t,
                                   cpusetsize: ::size_t,
                                   cpuset: *const ::cpu_set_t) -> ::c_int;
+    pub fn pthread_rwlockattr_getkind_np(attr: *const ::pthread_rwlockattr_t,
+                                         val: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_setkind_np(attr: *mut ::pthread_rwlockattr_t,
+                                         val: ::c_int) -> ::c_int;
     pub fn sched_getcpu() -> ::c_int;
 }
 
 cfg_if! {
     if #[cfg(any(target_arch = "x86",
                  target_arch = "arm",
                  target_arch = "powerpc"))] {
         mod b32;
--- a/third_party/rust/libc/src/unix/notbsd/linux/s390x.rs
+++ b/third_party/rust/libc/src/unix/notbsd/linux/s390x.rs
@@ -11,16 +11,17 @@ pub type off_t = i64;
 pub type rlim_t = u64;
 pub type suseconds_t = i64;
 pub type time_t = i64;
 pub type wchar_t = i32;
 pub type greg_t = u64;
 pub type clock_t = i64;
 pub type __fsword_t = ::c_long;
 pub type __priority_which_t = ::c_uint;
+pub type __u64 = u64;
 
 s! {
     pub struct aiocb {
         pub aio_fildes: ::c_int,
         pub aio_lio_opcode: ::c_int,
         pub aio_reqprio: ::c_int,
         pub aio_buf: *mut ::c_void,
         pub aio_nbytes: ::size_t,
@@ -266,27 +267,57 @@ s! {
         __msg_cbytes: ::c_ulong,
         pub msg_qnum: ::msgqnum_t,
         pub msg_qbytes: ::msglen_t,
         pub msg_lspid: ::pid_t,
         pub msg_lrpid: ::pid_t,
         __glibc_reserved4: ::c_ulong,
         __glibc_reserved5: ::c_ulong,
     }
-}
+
+    pub struct statfs64 {
+        pub f_type: ::c_uint,
+        pub f_bsize: ::c_uint,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_fsid: ::fsid_t,
+        pub f_namelen: ::c_uint,
+        pub f_frsize: ::c_uint,
+        pub f_flags: ::c_uint,
+        pub f_spare: [::c_uint; 4],
+    }
 
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
+    pub struct statvfs64 {
+        pub f_bsize: ::c_ulong,
+        pub f_frsize: ::c_ulong,
+        pub f_blocks: u64,
+        pub f_bfree: u64,
+        pub f_bavail: u64,
+        pub f_files: u64,
+        pub f_ffree: u64,
+        pub f_favail: u64,
+        pub f_fsid: ::c_ulong,
+        pub f_flag: ::c_ulong,
+        pub f_namemax: ::c_ulong,
+        __f_spare: [::c_int; 6],
+    }
+}
 
 pub const SFD_CLOEXEC: ::c_int = 0x080000;
 
 pub const NCCS: usize = 32;
 
 pub const O_TRUNC: ::c_int = 512;
-
+pub const O_LARGEFILE: ::c_int = 0o0100000;
+pub const O_NOATIME: ::c_int = 0o1000000;
 pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_PATH: ::c_int = 0o10000000;
 
 pub const EBFONT: ::c_int = 59;
 pub const ENOSTR: ::c_int = 60;
 pub const ENODATA: ::c_int = 61;
 pub const ETIME: ::c_int = 62;
 pub const ENOSR: ::c_int = 63;
 pub const ENONET: ::c_int = 64;
 pub const ENOPKG: ::c_int = 65;
@@ -309,16 +340,17 @@ pub const EFD_CLOEXEC: ::c_int = 0x80000
 
 pub const POSIX_FADV_DONTNEED: ::c_int = 6;
 pub const POSIX_FADV_NOREUSE: ::c_int = 7;
 
 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
 
 pub const EADDRINUSE: ::c_int = 98;
 pub const EADDRNOTAVAIL: ::c_int = 99;
 pub const ECONNABORTED: ::c_int = 103;
 pub const ECONNREFUSED: ::c_int = 111;
 pub const ECONNRESET: ::c_int = 104;
 pub const EDEADLK: ::c_int = 35;
 pub const ENOSYS: ::c_int = 38;
@@ -344,16 +376,24 @@ pub const SIG_SETMASK: ::c_int = 2;
 pub const SOCK_DGRAM: ::c_int = 2;
 pub const SOCK_STREAM: ::c_int = 1;
 pub const SOL_SOCKET: ::c_int = 1;
 pub const SO_BROADCAST: ::c_int = 6;
 pub const SO_ERROR: ::c_int = 4;
 pub const SO_RCVTIMEO: ::c_int = 20;
 pub const SO_REUSEADDR: ::c_int = 2;
 pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_PROTOCOL: ::c_int = 38;
+pub const SO_DOMAIN: ::c_int = 39;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
 
 pub const RLIMIT_RSS: ::c_int = 5;
 pub const RLIMIT_NOFILE: ::c_int = 7;
 pub const RLIMIT_AS: ::c_int = 9;
 pub const RLIMIT_NPROC: ::c_int = 6;
 pub const RLIMIT_MEMLOCK: ::c_int = 8;
 pub const RLIMIT_RTTIME: ::c_int = 15;
 pub const RLIMIT_NLIMITS: ::c_int = 16;
@@ -484,22 +524,27 @@ pub const ERFKILL: ::c_int = 132;
 pub const SOCK_SEQPACKET: ::c_int = 5;
 
 pub const SO_TYPE: ::c_int = 3;
 pub const SO_DONTROUTE: ::c_int = 5;
 pub const SO_SNDBUF: ::c_int = 7;
 pub const SO_RCVBUF: ::c_int = 8;
 pub const SO_KEEPALIVE: ::c_int = 9;
 pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_PRIORITY: ::c_int = 12;
 pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
 pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_PASSCRED: ::c_int = 16;
 pub const SO_PEERCRED: ::c_int = 17;
 pub const SO_RCVLOWAT: ::c_int = 18;
 pub const SO_SNDLOWAT: ::c_int = 19;
 pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const SO_SNDBUFFORCE: ::c_int = 32;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
 
 pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
 pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
 pub const TCP_THIN_DUPACK: ::c_int = 17;
 pub const TCP_USER_TIMEOUT: ::c_int = 18;
 pub const TCP_REPAIR: ::c_int = 19;
 pub const TCP_REPAIR_QUEUE: ::c_int = 20;
 pub const TCP_QUEUE_SEQ: ::c_int = 21;
@@ -525,24 +570,95 @@ pub const SIGXFSZ: ::c_int = 25;
 pub const SIGVTALRM: ::c_int = 26;
 pub const SIGPROF: ::c_int = 27;
 pub const SIGWINCH: ::c_int = 28;
 pub const SIGPOLL: ::c_int = 29;
 pub const SIGPWR: ::c_int = 30;
 pub const SIG_BLOCK: ::c_int = 0x000000;
 pub const SIG_UNBLOCK: ::c_int = 0x01;
 
-pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
-pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
-
 pub const BUFSIZ: ::c_uint = 8192;
 pub const TMP_MAX: ::c_uint = 238328;
 pub const FOPEN_MAX: ::c_uint = 16;
 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
+pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
+pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
+pub const _SC_PII: ::c_int = 53;
+pub const _SC_PII_XTI: ::c_int = 54;
+pub const _SC_PII_SOCKET: ::c_int = 55;
+pub const _SC_PII_INTERNET: ::c_int = 56;
+pub const _SC_PII_OSI: ::c_int = 57;
+pub const _SC_POLL: ::c_int = 58;
+pub const _SC_SELECT: ::c_int = 59;
+pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
+pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
+pub const _SC_PII_OSI_COTS: ::c_int = 63;
+pub const _SC_PII_OSI_CLTS: ::c_int = 64;
+pub const _SC_PII_OSI_M: ::c_int = 65;
+pub const _SC_T_IOV_MAX: ::c_int = 66;
 pub const _SC_2_C_VERSION: ::c_int = 96;
+pub const _SC_CHAR_BIT: ::c_int = 101;
+pub const _SC_CHAR_MAX: ::c_int = 102;
+pub const _SC_CHAR_MIN: ::c_int = 103;
+pub const _SC_INT_MAX: ::c_int = 104;
+pub const _SC_INT_MIN: ::c_int = 105;
+pub const _SC_LONG_BIT: ::c_int = 106;
+pub const _SC_WORD_BIT: ::c_int = 107;
+pub const _SC_MB_LEN_MAX: ::c_int = 108;
+pub const _SC_SSIZE_MAX: ::c_int = 110;
+pub const _SC_SCHAR_MAX: ::c_int = 111;
+pub const _SC_SCHAR_MIN: ::c_int = 112;
+pub const _SC_SHRT_MAX: ::c_int = 113;
+pub const _SC_SHRT_MIN: ::c_int = 114;
+pub const _SC_UCHAR_MAX: ::c_int = 115;
+pub const _SC_UINT_MAX: ::c_int = 116;
+pub const _SC_ULONG_MAX: ::c_int = 117;
+pub const _SC_USHRT_MAX: ::c_int = 118;
+pub const _SC_NL_ARGMAX: ::c_int = 119;
+pub const _SC_NL_LANGMAX: ::c_int = 120;
+pub const _SC_NL_MSGMAX: ::c_int = 121;
+pub const _SC_NL_NMAX: ::c_int = 122;
+pub const _SC_NL_SETMAX: ::c_int = 123;
+pub const _SC_NL_TEXTMAX: ::c_int = 124;
+pub const _SC_BASE: ::c_int = 134;
+pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
+pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
+pub const _SC_DEVICE_IO: ::c_int = 140;
+pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
+pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
+pub const _SC_FD_MGMT: ::c_int = 143;
+pub const _SC_FIFO: ::c_int = 144;
+pub const _SC_PIPE: ::c_int = 145;
+pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
+pub const _SC_FILE_LOCKING: ::c_int = 147;
+pub const _SC_FILE_SYSTEM: ::c_int = 148;
+pub const _SC_MULTI_PROCESS: ::c_int = 150;
+pub const _SC_SINGLE_PROCESS: ::c_int = 151;
+pub const _SC_NETWORKING: ::c_int = 152;
+pub const _SC_REGEX_VERSION: ::c_int = 156;
+pub const _SC_SIGNALS: ::c_int = 158;
+pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
+pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
+pub const _SC_USER_GROUPS: ::c_int = 166;
+pub const _SC_USER_GROUPS_R: ::c_int = 167;
+pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
+pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
+pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
+pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
+pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
+pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
+pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
+pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
+pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
+pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
+pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
+pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
+pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
+pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
+pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
 pub const O_ASYNC: ::c_int = 0x2000;
 pub const O_NDELAY: ::c_int = 0x800;
 pub const ST_RELATIME: ::c_ulong = 4096;
 pub const NI_MAXHOST: ::socklen_t = 1025;
 
 pub const ADFS_SUPER_MAGIC: ::c_int = 0x0000adf5;
 pub const AFFS_SUPER_MAGIC: ::c_int = 0x0000adff;
 pub const CODA_SUPER_MAGIC: ::c_int = 0x73757245;
@@ -607,23 +723,18 @@ pub const PTRACE_GETSIGINFO: ::c_uint = 
 pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
 pub const PTRACE_GETREGSET: ::c_uint = 0x4204;
 pub const PTRACE_SETREGSET: ::c_uint = 0x4205;
 pub const PTRACE_SEIZE: ::c_uint = 0x4206;
 pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
 pub const PTRACE_LISTEN: ::c_uint = 0x4208;
 pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
 
-pub const MADV_DODUMP: ::c_int = 17;
-pub const MADV_DONTDUMP: ::c_int = 16;
-
 pub const EPOLLWAKEUP: ::c_int = 0x20000000;
 
-pub const MADV_HUGEPAGE: ::c_int = 14;
-pub const MADV_NOHUGEPAGE: ::c_int = 15;
 pub const MAP_HUGETLB: ::c_int = 0x040000;
 
 pub const EFD_NONBLOCK: ::c_int = 0x800;
 
 pub const F_GETLK: ::c_int = 5;
 pub const F_GETOWN: ::c_int = 9;
 pub const F_SETOWN: ::c_int = 8;
 pub const F_SETLK: ::c_int = 6;
@@ -684,18 +795,126 @@ pub const LINUX_REBOOT_CMD_RESTART: ::c_
 pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
 pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
 pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
 pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
 pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
 pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
 pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
 
+pub const SYS_pivot_root: ::c_long = 217;
 pub const SYS_gettid: ::c_long = 236;
 pub const SYS_perf_event_open: ::c_long = 331;
+pub const SYS_memfd_create: ::c_long = 350;
+
+pub const VTIME: usize = 5;
+pub const VSWTC: usize = 7;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VSUSP: usize = 10;
+pub const VREPRINT: usize = 12;
+pub const VDISCARD: usize = 13;
+pub const VWERASE: usize = 14;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const ONLCR: ::tcflag_t = 0o000004;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const CR1: ::tcflag_t  = 0x00000200;
+pub const CR2: ::tcflag_t  = 0x00000400;
+pub const CR3: ::tcflag_t  = 0x00000600;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const TAB1: ::tcflag_t = 0x00000800;
+pub const TAB2: ::tcflag_t = 0x00001000;
+pub const TAB3: ::tcflag_t = 0x00001800;
+pub const BSDLY:  ::tcflag_t = 0o020000;
+pub const BS1: ::tcflag_t  = 0x00002000;
+pub const FFDLY:  ::tcflag_t = 0o100000;
+pub const FF1: ::tcflag_t  = 0x00008000;
+pub const VTDLY:  ::tcflag_t = 0o040000;
+pub const VT1: ::tcflag_t  = 0x00004000;
+pub const XTABS:  ::tcflag_t = 0o014000;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
+pub const SIGEV_THREAD_ID: ::c_int = 4;
+
+pub const CBAUD: ::speed_t = 0o010017;
+pub const B0: ::speed_t = 0o000000;
+pub const B50: ::speed_t = 0o000001;
+pub const B75: ::speed_t = 0o000002;
+pub const B110: ::speed_t = 0o000003;
+pub const B134: ::speed_t = 0o000004;
+pub const B150: ::speed_t = 0o000005;
+pub const B200: ::speed_t = 0o000006;
+pub const B300: ::speed_t = 0o000007;
+pub const B600: ::speed_t = 0o000010;
+pub const B1200: ::speed_t = 0o000011;
+pub const B1800: ::speed_t = 0o000012;
+pub const B2400: ::speed_t = 0o000013;
+pub const B4800: ::speed_t = 0o000014;
+pub const B9600: ::speed_t = 0o000015;
+pub const B19200: ::speed_t = 0o000016;
+pub const B38400: ::speed_t = 0o000017;
+pub const EXTA: ::speed_t = B19200;
+pub const EXTB: ::speed_t = B38400;
+pub const CSIZE: ::tcflag_t = 0o000060;
+pub const CS6: ::tcflag_t = 0o000020;
+pub const CS7: ::tcflag_t = 0o000040;
+pub const CS8: ::tcflag_t = 0o000060;
+pub const CSTOPB: ::tcflag_t = 0o000100;
+pub const CREAD: ::tcflag_t = 0o000200;
+pub const PARENB: ::tcflag_t = 0o000400;
+pub const PARODD: ::tcflag_t = 0o001000;
+pub const HUPCL: ::tcflag_t = 0o002000;
+pub const CLOCAL: ::tcflag_t = 0o004000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const B57600: ::speed_t = 0o010001;
+pub const B115200: ::speed_t = 0o010002;
+pub const B230400: ::speed_t = 0o010003;
+pub const B460800: ::speed_t = 0o010004;
+pub const B500000: ::speed_t = 0o010005;
+pub const B576000: ::speed_t = 0o010006;
+pub const B921600: ::speed_t = 0o010007;
+pub const B1000000: ::speed_t = 0o010010;
+pub const B1152000: ::speed_t = 0o010011;
+pub const B1500000: ::speed_t = 0o010012;
+pub const B2000000: ::speed_t = 0o010013;
+pub const B2500000: ::speed_t = 0o010014;
+pub const B3000000: ::speed_t = 0o010015;
+pub const B3500000: ::speed_t = 0o010016;
+pub const B4000000: ::speed_t = 0o010017;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+
+pub const ISIG: ::tcflag_t = 0o000001;
+pub const ICANON: ::tcflag_t = 0o000002;
+pub const XCASE: ::tcflag_t = 0o000004;
+pub const ECHOE: ::tcflag_t = 0o000020;
+pub const ECHOK: ::tcflag_t = 0o000040;
+pub const ECHONL: ::tcflag_t = 0o000100;
+pub const NOFLSH: ::tcflag_t = 0o000200;
+pub const ECHOCTL: ::tcflag_t = 0o001000;
+pub const ECHOPRT: ::tcflag_t = 0o002000;
+pub const ECHOKE: ::tcflag_t = 0o004000;
+pub const PENDIN: ::tcflag_t = 0o040000;
+
+pub const POLLWRNORM: ::c_short = 0x004;
+pub const POLLWRBAND: ::c_short = 0x100;
+
+pub const IXON: ::tcflag_t = 0o002000;
+pub const IXOFF: ::tcflag_t = 0o010000;
 
 #[link(name = "util")]
 extern {
     pub fn sysctl(name: *mut ::c_int,
                   namelen: ::c_int,
                   oldp: *mut ::c_void,
                   oldlenp: *mut ::size_t,
                   newp: *mut ::c_void,
--- a/third_party/rust/libc/src/unix/notbsd/mod.rs
+++ b/third_party/rust/libc/src/unix/notbsd/mod.rs
@@ -1,15 +1,14 @@
 use dox::mem;
 
 pub type sa_family_t = u16;
 pub type pthread_key_t = ::c_uint;
 pub type speed_t = ::c_uint;
 pub type tcflag_t = ::c_uint;
-pub type loff_t = ::c_longlong;
 pub type clockid_t = ::c_int;
 pub type key_t = ::c_int;
 pub type id_t = ::c_uint;
 
 pub enum timezone {}
 
 s! {
     pub struct sockaddr {
@@ -98,23 +97,23 @@ s! {
         pub tm_yday: ::c_int,
         pub tm_isdst: ::c_int,
         pub tm_gmtoff: ::c_long,
         pub tm_zone: *const ::c_char,
     }
 
     pub struct sched_param {
         pub sched_priority: ::c_int,
-        #[cfg(any(target_env = "musl"))]
+        #[cfg(any(target_env = "musl", target_os = "emscripten"))]
         pub sched_ss_low_priority: ::c_int,
-        #[cfg(any(target_env = "musl"))]
+        #[cfg(any(target_env = "musl", target_os = "emscripten"))]
         pub sched_ss_repl_period: ::timespec,
-        #[cfg(any(target_env = "musl"))]
+        #[cfg(any(target_env = "musl", target_os = "emscripten"))]
         pub sched_ss_init_budget: ::timespec,
-        #[cfg(any(target_env = "musl"))]
+        #[cfg(any(target_env = "musl", target_os = "emscripten"))]
         pub sched_ss_max_repl: ::c_int,
     }
 
     pub struct Dl_info {
         pub dli_fname: *const ::c_char,
         pub dli_fbase: *mut ::c_void,
         pub dli_sname: *const ::c_char,
         pub dli_saddr: *mut ::c_void,
@@ -207,41 +206,49 @@ pub const F_GETFD: ::c_int = 1;
 pub const F_SETFD: ::c_int = 2;
 pub const F_GETFL: ::c_int = 3;
 pub const F_SETFL: ::c_int = 4;
 
 // Linux-specific fcntls
 pub const F_SETLEASE: ::c_int = 1024;
 pub const F_GETLEASE: ::c_int = 1025;
 pub const F_NOTIFY: ::c_int = 1026;
+pub const F_CANCELLK: ::c_int = 1029;
 pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
 pub const F_SETPIPE_SZ: ::c_int = 1031;
 pub const F_GETPIPE_SZ: ::c_int = 1032;
+pub const F_ADD_SEALS: ::c_int = 1033;
+pub const F_GET_SEALS: ::c_int = 1034;
+
+pub const F_SEAL_SEAL: ::c_int = 0x0001;
+pub const F_SEAL_SHRINK: ::c_int = 0x0002;
+pub const F_SEAL_GROW: ::c_int = 0x0004;
+pub const F_SEAL_WRITE: ::c_int = 0x0008;
 
 // TODO(#235): Include file sealing fcntls once we have a way to verify them.
 
 pub const SIGTRAP: ::c_int = 5;
 
 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
 
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 1;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
-pub const CLOCK_MONOTONIC_RAW: clockid_t = 4;
-pub const CLOCK_REALTIME_COARSE: clockid_t = 5;
-pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
-pub const CLOCK_BOOTTIME: clockid_t = 7;
-pub const CLOCK_REALTIME_ALARM: clockid_t = 8;
-pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 1;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
+pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4;
+pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5;
+pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6;
+pub const CLOCK_BOOTTIME: ::clockid_t = 7;
+pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8;
+pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9;
 // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
 // 2014.) See also musl/mod.rs
-// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
-// pub const CLOCK_TAI: clockid_t = 11;
+// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+// pub const CLOCK_TAI: ::clockid_t = 11;
 pub const TIMER_ABSTIME: ::c_int = 1;
 
 pub const RLIMIT_CPU: ::c_int = 0;
 pub const RLIMIT_FSIZE: ::c_int = 1;
 pub const RLIMIT_DATA: ::c_int = 2;
 pub const RLIMIT_STACK: ::c_int = 3;
 pub const RLIMIT_CORE: ::c_int = 4;
 pub const RLIMIT_LOCKS: ::c_int = 10;
@@ -250,17 +257,16 @@ pub const RLIMIT_MSGQUEUE: ::c_int = 12;
 pub const RLIMIT_NICE: ::c_int = 13;
 pub const RLIMIT_RTPRIO: ::c_int = 14;
 
 pub const RUSAGE_SELF: ::c_int = 0;
 
 pub const O_RDONLY: ::c_int = 0;
 pub const O_WRONLY: ::c_int = 1;
 pub const O_RDWR: ::c_int = 2;
-pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
 
 pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
 
 pub const S_IFIFO: ::mode_t = 4096;
 pub const S_IFCHR: ::mode_t = 8192;
 pub const S_IFBLK: ::mode_t = 24576;
 pub const S_IFDIR: ::mode_t = 16384;
 pub const S_IFREG: ::mode_t = 32768;
@@ -406,22 +412,28 @@ pub const PROT_GROWSUP: ::c_int = 0x2000
 
 pub const MAP_TYPE: ::c_int = 0x000f;
 
 pub const MADV_NORMAL: ::c_int = 0;
 pub const MADV_RANDOM: ::c_int = 1;
 pub const MADV_SEQUENTIAL: ::c_int = 2;
 pub const MADV_WILLNEED: ::c_int = 3;
 pub const MADV_DONTNEED: ::c_int = 4;
+pub const MADV_FREE: ::c_int = 8;
 pub const MADV_REMOVE: ::c_int = 9;
 pub const MADV_DONTFORK: ::c_int = 10;
 pub const MADV_DOFORK: ::c_int = 11;
 pub const MADV_MERGEABLE: ::c_int = 12;
 pub const MADV_UNMERGEABLE: ::c_int = 13;
+pub const MADV_HUGEPAGE: ::c_int = 14;
+pub const MADV_NOHUGEPAGE: ::c_int = 15;
+pub const MADV_DONTDUMP: ::c_int = 16;
+pub const MADV_DODUMP: ::c_int = 17;
 pub const MADV_HWPOISON: ::c_int = 100;
+pub const MADV_SOFT_OFFLINE: ::c_int = 101;
 
 pub const IFF_UP: ::c_int = 0x1;
 pub const IFF_BROADCAST: ::c_int = 0x2;
 pub const IFF_DEBUG: ::c_int = 0x4;
 pub const IFF_LOOPBACK: ::c_int = 0x8;
 pub const IFF_POINTOPOINT: ::c_int = 0x10;
 pub const IFF_NOTRAILERS: ::c_int = 0x20;
 pub const IFF_RUNNING: ::c_int = 0x40;
@@ -432,16 +444,17 @@ pub const IFF_MASTER: ::c_int = 0x400;
 pub const IFF_SLAVE: ::c_int = 0x800;
 pub const IFF_MULTICAST: ::c_int = 0x1000;
 pub const IFF_PORTSEL: ::c_int = 0x2000;
 pub const IFF_AUTOMEDIA: ::c_int = 0x4000;
 pub const IFF_DYNAMIC: ::c_int = 0x8000;
 
 pub const SOL_IP: ::c_int = 0;
 pub const SOL_TCP: ::c_int = 6;
+pub const SOL_UDP: ::c_int = 17;
 pub const SOL_IPV6: ::c_int = 41;
 pub const SOL_ICMPV6: ::c_int = 58;
 pub const SOL_RAW: ::c_int = 255;
 pub const SOL_DECNET: ::c_int = 261;
 pub const SOL_X25: ::c_int = 262;
 pub const SOL_PACKET: ::c_int = 263;
 pub const SOL_ATM: ::c_int = 264;
 pub const SOL_AAL: ::c_int = 265;
@@ -548,22 +561,21 @@ pub const MSG_CONFIRM: ::c_int = 0x800;
 pub const MSG_RST: ::c_int = 0x1000;
 pub const MSG_ERRQUEUE: ::c_int = 0x2000;
 pub const MSG_NOSIGNAL: ::c_int = 0x4000;
 pub const MSG_MORE: ::c_int = 0x8000;
 pub const MSG_WAITFORONE: ::c_int = 0x10000;
 pub const MSG_FASTOPEN: ::c_int = 0x20000000;
 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
 
+pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
+
 pub const SOCK_RAW: ::c_int = 3;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
+pub const SOCK_RDM: ::c_int = 4;
+pub const IP_MULTICAST_IF: ::c_int = 32;
 pub const IP_MULTICAST_TTL: ::c_int = 33;
 pub const IP_MULTICAST_LOOP: ::c_int = 34;
 pub const IP_TTL: ::c_int = 2;
 pub const IP_HDRINCL: ::c_int = 3;
 pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
 pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
 pub const IP_TRANSPARENT: ::c_int = 19;
 pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
@@ -670,21 +682,25 @@ pub const IGNPAR: ::tcflag_t = 0x0000000
 pub const PARMRK: ::tcflag_t = 0x00000008;
 pub const INPCK: ::tcflag_t = 0x00000010;
 pub const ISTRIP: ::tcflag_t = 0x00000020;
 pub const INLCR: ::tcflag_t = 0x00000040;
 pub const IGNCR: ::tcflag_t = 0x00000080;
 pub const ICRNL: ::tcflag_t = 0x00000100;
 pub const IXANY: ::tcflag_t = 0x00000800;
 pub const IMAXBEL: ::tcflag_t = 0x00002000;
-pub const IUTF8: ::tcflag_t = 0x00004000;
 pub const OPOST: ::tcflag_t = 0x1;
 pub const CS5: ::tcflag_t = 0x00000000;
 pub const CRTSCTS: ::tcflag_t = 0x80000000;
 pub const ECHO: ::tcflag_t = 0x00000008;
+pub const OCRNL:  ::tcflag_t = 0o000010;
+pub const ONOCR:  ::tcflag_t = 0o000020;
+pub const ONLRET: ::tcflag_t = 0o000040;
+pub const OFILL:  ::tcflag_t = 0o000100;
+pub const OFDEL:  ::tcflag_t = 0o000200;
 
 pub const CLONE_VM: ::c_int = 0x100;
 pub const CLONE_FS: ::c_int = 0x200;
 pub const CLONE_FILES: ::c_int = 0x400;
 pub const CLONE_SIGHAND: ::c_int = 0x800;
 pub const CLONE_PTRACE: ::c_int = 0x2000;
 pub const CLONE_VFORK: ::c_int = 0x4000;
 pub const CLONE_PARENT: ::c_int = 0x8000;
@@ -698,24 +714,49 @@ pub const CLONE_DETACHED: ::c_int = 0x40
 pub const CLONE_UNTRACED: ::c_int = 0x800000;
 pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
 pub const CLONE_NEWUTS: ::c_int = 0x04000000;
 pub const CLONE_NEWIPC: ::c_int = 0x08000000;
 pub const CLONE_NEWUSER: ::c_int = 0x10000000;
 pub const CLONE_NEWPID: ::c_int = 0x20000000;
 pub const CLONE_NEWNET: ::c_int = 0x40000000;
 pub const CLONE_IO: ::c_int = 0x80000000;
+pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
 
 pub const WNOHANG: ::c_int = 0x00000001;
 pub const WUNTRACED: ::c_int = 0x00000002;
 pub const WSTOPPED: ::c_int = WUNTRACED;
 pub const WEXITED: ::c_int = 0x00000004;
 pub const WCONTINUED: ::c_int = 0x00000008;
 pub const WNOWAIT: ::c_int = 0x01000000;
 
+// Options set using PTRACE_SETOPTIONS.
+pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
+pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002;
+pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004;
+pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008;
+pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010;
+pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020;
+pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040;
+pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080;
+pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
+pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
+pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
+
+// Wait extended result codes for the above trace options.
+pub const PTRACE_EVENT_FORK: ::c_int = 1;
+pub const PTRACE_EVENT_VFORK: ::c_int = 2;
+pub const PTRACE_EVENT_CLONE: ::c_int = 3;
+pub const PTRACE_EVENT_EXEC: ::c_int = 4;
+pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5;
+pub const PTRACE_EVENT_EXIT: ::c_int = 6;
+pub const PTRACE_EVENT_SECCOMP: ::c_int = 7;
+// PTRACE_EVENT_STOP was added to glibc in 2.26
+// pub const PTRACE_EVENT_STOP: ::c_int = 128;
+
 pub const __WNOTHREAD: ::c_int = 0x20000000;
 pub const __WALL: ::c_int = 0x40000000;
 pub const __WCLONE: ::c_int = 0x80000000;
 
 pub const SPLICE_F_MOVE: ::c_uint = 0x01;
 pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
 pub const SPLICE_F_MORE: ::c_uint = 0x04;
 pub const SPLICE_F_GIFT: ::c_uint = 0x08;
@@ -749,16 +790,19 @@ pub const SIGEV_THREAD: ::c_int = 2;
 
 pub const P_ALL: idtype_t = 0;
 pub const P_PID: idtype_t = 1;
 pub const P_PGID: idtype_t = 2;
 
 pub const UTIME_OMIT: c_long = 1073741822;
 pub const UTIME_NOW: c_long = 1073741823;
 
+pub const POLLRDNORM: ::c_short = 0x040;
+pub const POLLRDBAND: ::c_short = 0x080;
+
 f! {
     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
         let fd = fd as usize;
         let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
         (*set).fds_bits[fd / size] &= !(1 << (fd % size));
         return
     }
 
@@ -810,106 +854,42 @@ f! {
     }
 
     pub fn WCOREDUMP(status: ::c_int) -> bool {
         (status & 0x80) != 0
     }
 }
 
 extern {
-    pub fn getpwnam_r(name: *const ::c_char,
-                      pwd: *mut passwd,
-                      buf: *mut ::c_char,
-                      buflen: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
-    pub fn getpwuid_r(uid: ::uid_t,
-                      pwd: *mut passwd,
-                      buf: *mut ::c_char,
-                      buflen: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
     pub fn fdatasync(fd: ::c_int) -> ::c_int;
     pub fn mincore(addr: *mut ::c_void, len: ::size_t,
                    vec: *mut ::c_uchar) -> ::c_int;
-    pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_nanosleep(clk_id: clockid_t,
-                           flags: ::c_int,
-                           rqtp: *const ::timespec,
-                           rmtp:  *mut ::timespec) -> ::c_int;
-    pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+    pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
-    pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
 
-    pub fn prctl(option: ::c_int, ...) -> ::c_int;
     pub fn pthread_getattr_np(native: ::pthread_t,
                               attr: *mut ::pthread_attr_t) -> ::c_int;
-    pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
-                                     guardsize: *mut ::size_t) -> ::c_int;
     pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
                                  stackaddr: *mut *mut ::c_void,
                                  stacksize: *mut ::size_t) -> ::c_int;
     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
     pub fn setgroups(ngroups: ::size_t,
                      ptr: *const ::gid_t) -> ::c_int;
-    pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
-    pub fn sched_setscheduler(pid: ::pid_t,
-                              policy: ::c_int,
-                              param: *const sched_param) -> ::c_int;
-    pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
-    pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
-    pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
-    pub fn sched_setparam(pid: ::pid_t, param: *const sched_param) -> ::c_int;
-    pub fn sched_getparam(pid: ::pid_t, param: *mut sched_param) -> ::c_int;
-    pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn epoll_create(size: ::c_int) -> ::c_int;
-    pub fn epoll_create1(flags: ::c_int) -> ::c_int;
-    pub fn epoll_ctl(epfd: ::c_int,
-                     op: ::c_int,
-                     fd: ::c_int,
-                     event: *mut epoll_event) -> ::c_int;
-    pub fn epoll_wait(epfd: ::c_int,
-                      events: *mut epoll_event,
-                      maxevents: ::c_int,
-                      timeout: ::c_int) -> ::c_int;
     pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
-    pub fn mount(src: *const ::c_char,
-                 target: *const ::c_char,
-                 fstype: *const ::c_char,
-                 flags: ::c_ulong,
-                 data: *const ::c_void) -> ::c_int;
-    pub fn umount(target: *const ::c_char) -> ::c_int;
-    pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
-    pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
-                 child_stack: *mut ::c_void,
-                 flags: ::c_int,
-                 arg: *mut ::c_void, ...) -> ::c_int;
     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
+    pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int;
     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
+    pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int;
+    pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int;
+    pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int;
     pub fn memrchr(cx: *const ::c_void,
                    c: ::c_int,
                    n: ::size_t) -> *mut ::c_void;
-    pub fn syscall(num: ::c_long, ...) -> ::c_long;
-    pub fn sendfile(out_fd: ::c_int,
-                    in_fd: ::c_int,
-                    offset: *mut off_t,
-                    count: ::size_t) -> ::ssize_t;
-    pub fn splice(fd_in: ::c_int,
-                  off_in: *mut ::loff_t,
-                  fd_out: ::c_int,
-                  off_out: *mut ::loff_t,
-                  len: ::size_t,
-                  flags: ::c_uint) -> ::ssize_t;
-    pub fn tee(fd_in: ::c_int,
-               fd_out: ::c_int,
-               len: ::size_t,
-               flags: ::c_uint) -> ::ssize_t;
-    pub fn vmsplice(fd: ::c_int,
-                    iov: *const ::iovec,
-                    nr_segs: ::size_t,
-                    flags: ::c_uint) -> ::ssize_t;
 
     pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
                          advise: ::c_int) -> ::c_int;
     pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
     pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
                      times: *const ::timespec, flag: ::c_int) -> ::c_int;
     pub fn duplocale(base: ::locale_t) -> ::locale_t;
     pub fn freelocale(loc: ::locale_t);
@@ -939,88 +919,78 @@ extern {
     pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
                     offset: off64_t) -> ::ssize_t;
     pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
     pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
                        result: *mut *mut ::dirent64) -> ::c_int;
     pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
     pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
     pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
-    pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
-    pub fn sysinfo (info: *mut ::sysinfo) -> ::c_int;
 
     pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
 
     pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
                    mode: ::mode_t, dev: dev_t) -> ::c_int;
-    pub fn ppoll(fds: *mut ::pollfd,
-                 nfds: nfds_t,
-                 timeout: *const ::timespec,
-                 sigmask: *const sigset_t) -> ::c_int;
     pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
                                      clock_id: *mut clockid_t) -> ::c_int;
     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
-                                     clock_id: clockid_t) -> ::c_int;
+                                     clock_id: ::clockid_t) -> ::c_int;
     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
                                        pshared: ::c_int) -> ::c_int;
-    pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
-                                       pshared: *mut ::c_int) -> ::c_int;
-    pub fn pthread_getschedparam(native: ::pthread_t,
-                                 policy: *mut ::c_int,
-                                 param: *mut ::sched_param) -> ::c_int;
-    pub fn pthread_setschedparam(native: ::pthread_t,
-                                 policy: ::c_int,
-                                 param: *const ::sched_param) -> ::c_int;
-    pub fn sched_getaffinity(pid: ::pid_t,
-                             cpusetsize: ::size_t,
-                             cpuset: *mut cpu_set_t) -> ::c_int;
-    pub fn sched_setaffinity(pid: ::pid_t,
-                             cpusetsize: ::size_t,
-                             cpuset: *const cpu_set_t) -> ::c_int;
-    pub fn unshare(flags: ::c_int) -> ::c_int;
-    pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
-    pub fn sem_timedwait(sem: *mut sem_t,
-                         abstime: *const ::timespec) -> ::c_int;
     pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
                    flg: ::c_int) -> ::c_int;
-    pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
-                                   abstime: *const ::timespec) -> ::c_int;
     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
                                         pshared: ::c_int) -> ::c_int;
-    pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
-                                        pshared: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+                                         val: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+                                         val: ::c_int) -> ::c_int;
     pub fn ptsname_r(fd: ::c_int,
                      buf: *mut ::c_char,
                      buflen: ::size_t) -> ::c_int;
     pub fn clearenv() -> ::c_int;
     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
                   options: ::c_int) -> ::c_int;
-    pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
     pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int;
     pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int;
     pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t,
                      suid: *mut ::uid_t) -> ::c_int;
     pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t,
                      sgid: *mut ::gid_t) -> ::c_int;
-    pub fn personality(persona: ::c_ulong) -> ::c_int;
-    pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int;
-    pub fn swapoff(puath: *const ::c_char) -> ::c_int;
     pub fn acct(filename: *const ::c_char) -> ::c_int;
     pub fn brk(addr: *mut ::c_void) -> ::c_int;
     pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
     pub fn vfork() -> ::pid_t;
+    pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
+    pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
     pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int,
                  rusage: *mut ::rusage) -> ::pid_t;
+    pub fn openpty(amaster: *mut ::c_int,
+                aslave: *mut ::c_int,
+                name: *mut ::c_char,
+                termp: *const termios,
+                winp: *const ::winsize) -> ::c_int;
+    pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
+                   envp: *const *const ::c_char) -> ::c_int;
+    pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+                   envp: *const *const ::c_char)
+                   -> ::c_int;
 }
 
 cfg_if! {
-    if #[cfg(any(target_os = "linux",
-                 target_os = "emscripten",
-                 target_os = "fuchsia"))] {
+    if #[cfg(target_os = "emscripten")] {
+        mod emscripten;
+        pub use self::emscripten::*;
+    } else if #[cfg(any(target_os = "linux", target_os = "fuchsia"))] {
         mod linux;
         pub use self::linux::*;
     } else if #[cfg(target_os = "android")] {
         mod android;
         pub use self::android::*;
     } else {
         // Unknown target_os
     }
 }
+    // pub fn forkpty(amaster: *mut ::c_int,
+    //             name: *mut ::c_char,
+    //             termp: *const termios,
+    //             winp: *const ::winsize) -> ::pid_t;
+    // pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
--- a/third_party/rust/libc/src/unix/solaris/mod.rs
+++ b/third_party/rust/libc/src/unix/solaris/mod.rs
@@ -164,16 +164,20 @@ s! {
         __pthread_rwlock_readers: i32,
         __pthread_rwlock_type: u16,
         __pthread_rwlock_magic: u16,
         __pthread_rwlock_mutex: ::pthread_mutex_t,
         __pthread_rwlock_readercv: ::pthread_cond_t,
         __pthread_rwlock_writercv: ::pthread_cond_t
     }
 
+    pub struct pthread_rwlockattr_t {
+        __pthread_rwlockattrp: *mut ::c_void,
+    }
+
     pub struct dirent {
         pub d_ino: ::ino_t,
         pub d_off: ::off_t,
         pub d_reclen: u16,
         pub d_name: [::c_char; 1]
     }
 
     pub struct glob_t {
@@ -199,16 +203,18 @@ s! {
         __ss_pad2: [u8; 240],
     }
 
     pub struct addrinfo {
         pub ai_flags: ::c_int,
         pub ai_family: ::c_int,
         pub ai_socktype: ::c_int,
         pub ai_protocol: ::c_int,
+        #[cfg(target_arch = "sparc64")]
+        __sparcv9_pad: ::c_int,
         pub ai_addrlen: ::socklen_t,
         pub ai_canonname: *mut ::c_char,
         pub ai_addr: *mut ::sockaddr,
         pub ai_next: *mut addrinfo,
     }
 
     pub struct sigset_t {
         bits: [u32; 4],
@@ -761,65 +767,36 @@ pub const GLOB_ABORTED : ::c_int = -1;
 pub const GLOB_NOMATCH : ::c_int = -3;
 
 pub const POSIX_MADV_NORMAL: ::c_int = 0;
 pub const POSIX_MADV_RANDOM: ::c_int = 1;
 pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
 pub const POSIX_MADV_WILLNEED: ::c_int = 3;
 pub const POSIX_MADV_DONTNEED: ::c_int = 4;
 
-pub const _SC_IOV_MAX: ::c_int = 77;
-pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 569;
-pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 570;
-pub const _SC_LOGIN_NAME_MAX: ::c_int = 571;
-pub const _SC_MQ_PRIO_MAX: ::c_int = 30;
-pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 577;
-pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 578;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 568;
-pub const _SC_THREAD_KEYS_MAX: ::c_int = 572;
-pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 580;
-pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 581;
-pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 579;
-pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 582;
-pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 583;
-pub const _SC_THREAD_STACK_MIN: ::c_int = 573;
-pub const _SC_THREAD_THREADS_MAX: ::c_int = 574;
-pub const _SC_THREADS: ::c_int = 576;
-pub const _SC_TTY_NAME_MAX: ::c_int = 575;
-pub const _SC_ATEXIT_MAX: ::c_int = 76;
-pub const _SC_XOPEN_CRYPT: ::c_int = 62;
-pub const _SC_XOPEN_ENH_I18N: ::c_int = 63;
-pub const _SC_XOPEN_LEGACY: ::c_int = 717;
-pub const _SC_XOPEN_REALTIME: ::c_int = 718;
-pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 719;
-pub const _SC_XOPEN_SHM: ::c_int = 64;
-pub const _SC_XOPEN_UNIX: ::c_int = 78;
-pub const _SC_XOPEN_VERSION: ::c_int = 12;
-pub const _SC_XOPEN_XCU_VERSION: ::c_int = 67;
-
 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
 pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x40;
 pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
-pub const PTHREAD_PROCESS_PRIVATE: u16 = 0;
+pub const PTHREAD_PROCESS_PRIVATE: ::c_ushort = 0;
 pub const PTHREAD_STACK_MIN: ::size_t = 4096;
 
 pub const SIGSTKSZ: ::size_t = 8192;
 
 // https://illumos.org/man/3c/clock_gettime
 // https://github.com/illumos/illumos-gate/
 //   blob/HEAD/usr/src/lib/libc/amd64/sys/__clock_gettime.s
 // clock_gettime(3c) doesn't seem to accept anything other than CLOCK_REALTIME
 // or __CLOCK_REALTIME0
 //
 // https://github.com/illumos/illumos-gate/
 //   blob/HEAD/usr/src/uts/common/sys/time_impl.h
 // Confusing! CLOCK_HIGHRES==CLOCK_MONOTONIC==4
 // __CLOCK_REALTIME0==0 is an obsoleted version of CLOCK_REALTIME==3
-pub const CLOCK_REALTIME: clockid_t = 3;
-pub const CLOCK_MONOTONIC: clockid_t = 4;
+pub const CLOCK_REALTIME: ::clockid_t = 3;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
 pub const TIMER_RELTIME: ::c_int = 0;
 pub const TIMER_ABSTIME: ::c_int = 1;
 
 pub const RLIMIT_CPU: ::c_int = 0;
 pub const RLIMIT_FSIZE: ::c_int = 1;
 pub const RLIMIT_DATA: ::c_int = 2;
 pub const RLIMIT_STACK: ::c_int = 3;
 pub const RLIMIT_CORE: ::c_int = 4;
@@ -843,21 +820,16 @@ pub const MADV_FREE: ::c_int = 5;
 pub const AF_INET: ::c_int = 2;
 pub const AF_INET6: ::c_int = 26;
 pub const AF_UNIX: ::c_int = 1;
 pub const SOCK_DGRAM: ::c_int = 1;
 pub const SOCK_STREAM: ::c_int = 2;
 pub const SOCK_RAW: ::c_int = 4;
 pub const SOCK_RDM: ::c_int = 5;
 pub const SOCK_SEQPACKET: ::c_int = 6;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
 pub const IP_MULTICAST_TTL: ::c_int = 17;
 pub const IP_MULTICAST_LOOP: ::c_int = 18;
 pub const IP_TTL: ::c_int = 4;
 pub const IP_HDRINCL: ::c_int = 2;
 pub const IP_ADD_MEMBERSHIP: ::c_int = 19;
 pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
 pub const IPV6_JOIN_GROUP: ::c_int = 9;
 pub const IPV6_LEAVE_GROUP: ::c_int = 10;
@@ -900,70 +872,197 @@ pub const F_RDLCK: ::c_short = 1;
 pub const F_WRLCK: ::c_short = 2;
 pub const F_UNLCK: ::c_short = 3;
 
 pub const O_SYNC: ::c_int = 16;
 pub const O_NONBLOCK: ::c_int = 128;
 
 pub const IPPROTO_RAW: ::c_int = 255;
 
+pub const _PC_LINK_MAX: ::c_int = 1;
+pub const _PC_MAX_CANON: ::c_int = 2;
+pub const _PC_MAX_INPUT: ::c_int = 3;
+pub const _PC_NAME_MAX: ::c_int = 4;
+pub const _PC_PATH_MAX: ::c_int = 5;
+pub const _PC_PIPE_BUF: ::c_int = 6;
+pub const _PC_NO_TRUNC: ::c_int = 7;
+pub const _PC_VDISABLE: ::c_int = 8;
+pub const _PC_CHOWN_RESTRICTED: ::c_int = 9;
+pub const _PC_ASYNC_IO: ::c_int = 10;
+pub const _PC_PRIO_IO: ::c_int = 11;
+pub const _PC_SYNC_IO: ::c_int = 12;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 13;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_SYMLINK_MAX: ::c_int = 18;
+pub const _PC_2_SYMLINKS: ::c_int = 19;
+pub const _PC_ACL_ENABLED: ::c_int = 20;
+pub const _PC_MIN_HOLE_SIZE: ::c_int = 21;
+pub const _PC_CASE_BEHAVIOR: ::c_int = 22;
+pub const _PC_SATTR_ENABLED: ::c_int = 23;
+pub const _PC_SATTR_EXISTS: ::c_int = 24;
+pub const _PC_ACCESS_FILTERING: ::c_int = 25;
+pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 26;
+pub const _PC_FILESIZEBITS: ::c_int = 67;
+pub const _PC_XATTR_ENABLED: ::c_int = 100;
+pub const _PC_LAST: ::c_int = 101;
+pub const _PC_XATTR_EXISTS: ::c_int = 101;
+
 pub const _SC_ARG_MAX: ::c_int = 1;
 pub const _SC_CHILD_MAX: ::c_int = 2;
 pub const _SC_CLK_TCK: ::c_int = 3;
 pub const _SC_NGROUPS_MAX: ::c_int = 4;
 pub const _SC_OPEN_MAX: ::c_int = 5;
 pub const _SC_JOB_CONTROL: ::c_int = 6;
 pub const _SC_SAVED_IDS: ::c_int = 7;
 pub const _SC_VERSION: ::c_int = 8;
+pub const _SC_PASS_MAX: ::c_int = 9;
+pub const _SC_LOGNAME_MAX: ::c_int = 10;
 pub const _SC_PAGESIZE: ::c_int = 11;
 pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
+pub const _SC_XOPEN_VERSION: ::c_int = 12;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 14;
 pub const _SC_NPROCESSORS_ONLN: ::c_int = 15;
 pub const _SC_STREAM_MAX: ::c_int = 16;
 pub const _SC_TZNAME_MAX: ::c_int = 17;
 pub const _SC_AIO_LISTIO_MAX: ::c_int = 18;
 pub const _SC_AIO_MAX: ::c_int = 19;
+pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 20;
+pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21;
+pub const _SC_DELAYTIMER_MAX: ::c_int = 22;
+pub const _SC_FSYNC: ::c_int = 23;
+pub const _SC_MAPPED_FILES: ::c_int = 24;
+pub const _SC_MEMLOCK: ::c_int = 25;
+pub const _SC_MEMLOCK_RANGE: ::c_int = 26;
+pub const _SC_MEMORY_PROTECTION: ::c_int = 27;
+pub const _SC_MESSAGE_PASSING: ::c_int = 28;
+pub const _SC_MQ_OPEN_MAX: ::c_int = 29;
+pub const _SC_MQ_PRIO_MAX: ::c_int = 30;
+pub const _SC_PRIORITIZED_IO: ::c_int = 31;
+pub const _SC_PRIORITY_SCHEDULING: ::c_int = 32;
+pub const _SC_REALTIME_SIGNALS: ::c_int = 33;
+pub const _SC_RTSIG_MAX: ::c_int = 34;
+pub const _SC_SEMAPHORES: ::c_int = 35;
+pub const _SC_SEM_NSEMS_MAX: ::c_int = 36;
+pub const _SC_SEM_VALUE_MAX: ::c_int = 37;
+pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 38;
+pub const _SC_SIGQUEUE_MAX: ::c_int = 39;
+pub const _SC_SIGRT_MIN: ::c_int = 40;
+pub const _SC_SIGRT_MAX: ::c_int = 41;
+pub const _SC_SYNCHRONIZED_IO: ::c_int = 42;
+pub const _SC_TIMERS: ::c_int = 43;
+pub const _SC_TIMER_MAX: ::c_int = 44;
+pub const _SC_2_C_BIND: ::c_int = 45;
+pub const _SC_2_C_DEV: ::c_int = 46;
+pub const _SC_2_C_VERSION: ::c_int = 47;
+pub const _SC_2_FORT_DEV: ::c_int = 48;
+pub const _SC_2_FORT_RUN: ::c_int = 49;
+pub const _SC_2_LOCALEDEF: ::c_int = 50;
+pub const _SC_2_SW_DEV: ::c_int = 51;
+pub const _SC_2_UPE: ::c_int = 52;
+pub const _SC_2_VERSION: ::c_int = 53;
 pub const _SC_BC_BASE_MAX: ::c_int = 54;
 pub const _SC_BC_DIM_MAX: ::c_int = 55;
 pub const _SC_BC_SCALE_MAX: ::c_int = 56;
 pub const _SC_BC_STRING_MAX: ::c_int = 57;
 pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 58;
 pub const _SC_EXPR_NEST_MAX: ::c_int = 59;
 pub const _SC_LINE_MAX: ::c_int = 60;
 pub const _SC_RE_DUP_MAX: ::c_int = 61;
-pub const _SC_2_VERSION: ::c_int = 53;
-pub const _SC_2_C_BIND: ::c_int = 45;
-pub const _SC_2_C_DEV: ::c_int = 46;
+pub const _SC_XOPEN_CRYPT: ::c_int = 62;
+pub const _SC_XOPEN_ENH_I18N: ::c_int = 63;
+pub const _SC_XOPEN_SHM: ::c_int = 64;
 pub const _SC_2_CHAR_TERM: ::c_int = 66;
-pub const _SC_2_FORT_DEV: ::c_int = 48;
-pub const _SC_2_FORT_RUN: ::c_int = 49;
-pub const _SC_2_LOCALEDEF: ::c_int = 50;
-pub const _SC_2_SW_DEV: ::c_int = 51;
-pub const _SC_2_UPE: ::c_int = 52;
-pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21;
-pub const _SC_MAPPED_FILES: ::c_int = 24;
-pub const _SC_MEMLOCK: ::c_int = 25;
-pub const _SC_MEMLOCK_RANGE: ::c_int = 26;
-pub const _SC_MEMORY_PROTECTION: ::c_int = 27;
-pub const _SC_MESSAGE_PASSING: ::c_int = 28;
-pub const _SC_PRIORITIZED_IO: ::c_int = 31;
-pub const _SC_PRIORITY_SCHEDULING: ::c_int = 32;
-pub const _SC_REALTIME_SIGNALS: ::c_int = 33;
-pub const _SC_SEMAPHORES: ::c_int = 35;
-pub const _SC_FSYNC: ::c_int = 23;
-pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 38;
-pub const _SC_SYNCHRONIZED_IO: ::c_int = 42;
-pub const _SC_TIMERS: ::c_int = 43;
-pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 20;
-pub const _SC_DELAYTIMER_MAX: ::c_int = 22;
-pub const _SC_MQ_OPEN_MAX: ::c_int = 29;
-pub const _SC_RTSIG_MAX: ::c_int = 34;
-pub const _SC_SEM_NSEMS_MAX: ::c_int = 36;
-pub const _SC_SEM_VALUE_MAX: ::c_int = 37;
-pub const _SC_SIGQUEUE_MAX: ::c_int = 39;
-pub const _SC_TIMER_MAX: ::c_int = 44;
+pub const _SC_XOPEN_XCU_VERSION: ::c_int = 67;
+pub const _SC_ATEXIT_MAX: ::c_int = 76;
+pub const _SC_IOV_MAX: ::c_int = 77;
+pub const _SC_XOPEN_UNIX: ::c_int = 78;
+pub const _SC_T_IOV_MAX: ::c_int = 79;
+pub const _SC_PHYS_PAGES: ::c_int = 500;
+pub const _SC_AVPHYS_PAGES: ::c_int = 501;
+pub const _SC_COHER_BLKSZ: ::c_int = 503;
+pub const _SC_SPLIT_CACHE: ::c_int = 504;
+pub const _SC_ICACHE_SZ: ::c_int = 505;
+pub const _SC_DCACHE_SZ: ::c_int = 506;
+pub const _SC_ICACHE_LINESZ: ::c_int = 507;
+pub const _SC_DCACHE_LINESZ: ::c_int = 508;
+pub const _SC_ICACHE_BLKSZ: ::c_int = 509;
+pub const _SC_DCACHE_BLKSZ: ::c_int = 510;
+pub const _SC_DCACHE_TBLKSZ: ::c_int = 511;
+pub const _SC_ICACHE_ASSOC: ::c_int = 512;
+pub const _SC_DCACHE_ASSOC: ::c_int = 513;
+pub const _SC_MAXPID: ::c_int = 514;
+pub const _SC_STACK_PROT: ::c_int = 515;
+pub const _SC_NPROCESSORS_MAX: ::c_int = 516;
+pub const _SC_CPUID_MAX: ::c_int = 517;
+pub const _SC_EPHID_MAX: ::c_int = 518;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 568;
+pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 569;
+pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 570;
+pub const _SC_LOGIN_NAME_MAX: ::c_int = 571;
+pub const _SC_THREAD_KEYS_MAX: ::c_int = 572;
+pub const _SC_THREAD_STACK_MIN: ::c_int = 573;
+pub const _SC_THREAD_THREADS_MAX: ::c_int = 574;
+pub const _SC_TTY_NAME_MAX: ::c_int = 575;
+pub const _SC_THREADS: ::c_int = 576;
+pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 577;
+pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 578;
+pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 579;
+pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 580;
+pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 581;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 582;
+pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 583;
+pub const _SC_XOPEN_LEGACY: ::c_int = 717;
+pub const _SC_XOPEN_REALTIME: ::c_int = 718;
+pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 719;
+pub const _SC_XBS5_ILP32_OFF32: ::c_int = 720;
+pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 721;
+pub const _SC_XBS5_LP64_OFF64: ::c_int = 722;
+pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 723;
+pub const _SC_2_PBS: ::c_int = 724;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 725;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 726;
+pub const _SC_2_PBS_LOCATE: ::c_int = 728;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 729;
+pub const _SC_2_PBS_TRACK: ::c_int = 730;
+pub const _SC_ADVISORY_INFO: ::c_int = 731;
+pub const _SC_BARRIERS: ::c_int = 732;
+pub const _SC_CLOCK_SELECTION: ::c_int = 733;
+pub const _SC_CPUTIME: ::c_int = 734;
+pub const _SC_HOST_NAME_MAX: ::c_int = 735;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 736;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 737;
+pub const _SC_REGEXP: ::c_int = 738;
+pub const _SC_SHELL: ::c_int = 739;
+pub const _SC_SPAWN: ::c_int = 740;
+pub const _SC_SPIN_LOCKS: ::c_int = 741;
+pub const _SC_SPORADIC_SERVER: ::c_int = 742;
+pub const _SC_SS_REPL_MAX: ::c_int = 743;
+pub const _SC_SYMLOOP_MAX: ::c_int = 744;
+pub const _SC_THREAD_CPUTIME: ::c_int = 745;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 746;
+pub const _SC_TIMEOUTS: ::c_int = 747;
+pub const _SC_TRACE: ::c_int = 748;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 749;
+pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 750;
+pub const _SC_TRACE_INHERIT: ::c_int = 751;
+pub const _SC_TRACE_LOG: ::c_int = 752;
+pub const _SC_TRACE_NAME_MAX: ::c_int = 753;
+pub const _SC_TRACE_SYS_MAX: ::c_int = 754;
+pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 755;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 756;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 757;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 758;
+pub const _SC_V6_LP64_OFF64: ::c_int = 759;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 760;
+pub const _SC_XOPEN_STREAMS: ::c_int = 761;
+pub const _SC_IPV6: ::c_int = 762;
+pub const _SC_RAW_SOCKETS: ::c_int = 763;
 
 pub const _MUTEX_MAGIC: u16 = 0x4d58; // MX
 pub const _COND_MAGIC: u16 = 0x4356;  // CV
 pub const _RWL_MAGIC: u16 = 0x5257;   // RW
 
 pub const NCCS: usize = 19;
 
 pub const LOG_CRON: ::c_int = 15 << 3;
@@ -1069,44 +1168,32 @@ extern {
     pub fn stack_getbounds(sp: *mut ::stack_t) -> ::c_int;
     pub fn mincore(addr: *const ::c_void, len: ::size_t,
                    vec: *mut c_char) -> ::c_int;
     pub fn setgroups(ngroups: ::c_int,
                      ptr: *const ::gid_t) -> ::c_int;
     pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int;
     pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
                     -> ::c_int;
-    pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_nanosleep(clk_id: clockid_t,
+    pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_nanosleep(clk_id: ::clockid_t,
                            flags: ::c_int,
                            rqtp: *const ::timespec,
                            rmtp:  *mut ::timespec) -> ::c_int;
-    pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+    pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
     pub fn getnameinfo(sa: *const ::sockaddr,
                        salen: ::socklen_t,
                        host: *mut ::c_char,
                        hostlen: ::socklen_t,
                        serv: *mut ::c_char,
                        sevlen: ::socklen_t,
                        flags: ::c_int) -> ::c_int;
-    #[link_name = "__posix_getpwnam_r"]
-    pub fn getpwnam_r(name: *const ::c_char,
-                      pwd: *mut passwd,
-                      buf: *mut ::c_char,
-                      buflen: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
-
-    #[link_name = "__posix_getpwuid_r"]
-    pub fn getpwuid_r(uid: ::uid_t,
-                      pwd: *mut passwd,
-                      buf: *mut ::c_char,
-                      buflen: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
     pub fn setpwent();
+    pub fn endpwent();
     pub fn getpwent() -> *mut passwd;
     pub fn fdatasync(fd: ::c_int) -> ::c_int;
     pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
     pub fn duplocale(base: ::locale_t) -> ::locale_t;
     pub fn freelocale(loc: ::locale_t);
     pub fn newlocale(mask: ::c_int,
                      locale: *const ::c_char,
                      base: ::locale_t) -> ::locale_t;
@@ -1124,17 +1211,17 @@ extern {
     pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
                     mode: ::mode_t) -> ::c_int;
     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
     pub fn if_nameindex() -> *mut if_nameindex;
     pub fn if_freenameindex(ptr: *mut if_nameindex);
     pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
                                      clock_id: *mut clockid_t) -> ::c_int;
     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
-                                     clock_id: clockid_t) -> ::c_int;
+                                     clock_id: ::clockid_t) -> ::c_int;
     pub fn sem_timedwait(sem: *mut sem_t,
                          abstime: *const ::timespec) -> ::c_int;
     pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
                                    abstime: *const ::timespec) -> ::c_int;
     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
                   options: ::c_int) -> ::c_int;
 
     pub fn glob(pattern: *const ::c_char,
@@ -1186,9 +1273,67 @@ extern {
                           events: ::c_int, user: ::uintptr_t) -> ::c_int;
     pub fn port_dissociate(port: ::c_int, source: ::c_int, object: ::uintptr_t)
                            -> ::c_int;
     pub fn port_get(port: ::c_int, pe: *mut port_event,
                     timeout: *const ::timespec) -> ::c_int;
     pub fn port_getn(port: ::c_int, pe_list: *mut port_event, max: ::c_uint,
                      nget: *mut ::c_uint, timeout: *const ::timespec)
                      -> ::c_int;
+    pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+                   envp: *const *const ::c_char)
+                   -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+    pub fn getgrgid_r(uid: ::uid_t,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "sigaltstack$UNIX2003")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+    pub fn sigaltstack(ss: *const stack_t,
+                       oss: *mut stack_t) -> ::c_int;
+    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+    pub fn getdtablesize() -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+    pub fn getgrnam_r(name: *const ::c_char,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "pthread_sigmask$UNIX2003")]
+    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+                           oldset: *mut sigset_t) -> ::c_int;
+    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+    pub fn getpwnam_r(name: *const ::c_char,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+    pub fn getpwuid_r(uid: ::uid_t,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+               link_name = "sigwait$UNIX2003")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+    pub fn sigwait(set: *const sigset_t,
+                   sig: *mut ::c_int) -> ::c_int;
+    pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+                          parent: Option<unsafe extern fn()>,
+                          child: Option<unsafe extern fn()>) -> ::c_int;
+    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "popen$UNIX2003")]
+    pub fn popen(command: *const c_char,
+                 mode: *const c_char) -> *mut ::FILE;
 }
--- a/third_party/rust/libc/src/unix/uclibc/mod.rs
+++ b/third_party/rust/libc/src/unix/uclibc/mod.rs
@@ -252,16 +252,21 @@ s! {
         __align: [::c_int; 0],
         #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
                       target_arch = "mips64", target_arch = "s390x",
                       target_arch = "sparc64")))]
         __align: [::c_long; 0],
         size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
     }
 
+    pub struct pthread_rwlockattr_t {
+        __lockkind: ::c_int,
+        __pshared: ::c_int,
+    }
+
     pub struct pthread_cond_t {
         __align: [::c_longlong; 0],
         size: [u8; __SIZEOF_PTHREAD_COND_T],
     }
 
     pub struct pthread_condattr_t {
         __align: [::c_int; 0],
         size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
@@ -413,24 +418,24 @@ pub const F_DUPFD_CLOEXEC: ::c_int = 103
 
 // TODO(#235): Include file sealing fcntls once we have a way to verify them.
 
 pub const SIGTRAP: ::c_int = 5;
 
 pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
 pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
 
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 1;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 1;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
 // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
 // 2014.) See also musl/mod.rs
-// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
-// pub const CLOCK_TAI: clockid_t = 11;
+// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+// pub const CLOCK_TAI: ::clockid_t = 11;
 pub const TIMER_ABSTIME: ::c_int = 1;
 
 pub const RLIMIT_CPU: ::c_int = 0;
 pub const RLIMIT_FSIZE: ::c_int = 1;
 pub const RLIMIT_DATA: ::c_int = 2;
 pub const RLIMIT_STACK: ::c_int = 3;
 pub const RLIMIT_CORE: ::c_int = 4;
 pub const RLIMIT_LOCKS: ::c_int = 10;
@@ -715,28 +720,26 @@ pub const MSG_CONFIRM: ::c_int = 0x800;
 pub const MSG_RST: ::c_int = 0x1000;
 pub const MSG_ERRQUEUE: ::c_int = 0x2000;
 pub const MSG_NOSIGNAL: ::c_int = 0x4000;
 pub const MSG_MORE: ::c_int = 0x8000;
 pub const MSG_WAITFORONE: ::c_int = 0x10000;
 pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
 
 pub const SOCK_RAW: ::c_int = 3;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
 pub const IP_MULTICAST_TTL: ::c_int = 33;
 pub const IP_MULTICAST_LOOP: ::c_int = 34;
 pub const IP_TTL: ::c_int = 2;
 pub const IP_HDRINCL: ::c_int = 3;
 pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
 pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
 
+pub const IPV6_JOIN_GROUP: ::c_int = 20;
+pub const IPV6_LEAVE_GROUP: ::c_int = 21;
+
 pub const TCP_NODELAY: ::c_int = 1;
 pub const TCP_MAXSEG: ::c_int = 2;
 pub const TCP_CORK: ::c_int = 3;
 pub const TCP_KEEPIDLE: ::c_int = 4;
 pub const TCP_KEEPINTVL: ::c_int = 5;
 pub const TCP_KEEPCNT: ::c_int = 6;
 pub const TCP_SYNCNT: ::c_int = 7;
 pub const TCP_LINGER2: ::c_int = 8;
@@ -1414,62 +1417,52 @@ f! {
     }
 
     pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
         set1.bits == set2.bits
     }
 }
 
 extern {
-    pub fn getpwnam_r(name: *const ::c_char,
-                      pwd: *mut passwd,
-                      buf: *mut ::c_char,
-                      buflen: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
-    pub fn getpwuid_r(uid: ::uid_t,
-                      pwd: *mut passwd,
-                      buf: *mut ::c_char,
-                      buflen: ::size_t,
-                      result: *mut *mut passwd) -> ::c_int;
     pub fn fdatasync(fd: ::c_int) -> ::c_int;
     pub fn mincore(addr: *mut ::c_void, len: ::size_t,
                    vec: *mut ::c_uchar) -> ::c_int;
-    pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
-    pub fn clock_nanosleep(clk_id: clockid_t,
+    pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+    pub fn clock_nanosleep(clk_id: ::clockid_t,
                            flags: ::c_int,
                            rqtp: *const ::timespec,
                            rmtp:  *mut ::timespec) -> ::c_int;
-    pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+    pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
     pub fn prctl(option: ::c_int, ...) -> ::c_int;
     pub fn pthread_getattr_np(native: ::pthread_t,
                               attr: *mut ::pthread_attr_t) -> ::c_int;
     pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
                                      guardsize: *mut ::size_t) -> ::c_int;
     pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
                                  stackaddr: *mut *mut ::c_void,
                                  stacksize: *mut ::size_t) -> ::c_int;
     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
     pub fn setgroups(ngroups: ::size_t,
                      ptr: *const ::gid_t) -> ::c_int;
     pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
     pub fn sched_setscheduler(pid: ::pid_t,
                               policy: ::c_int,
-                              param: *const sched_param) -> ::c_int;
+                              param: *const ::sched_param) -> ::c_int;
     pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
     pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
     pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
     pub fn epoll_create(size: ::c_int) -> ::c_int;
     pub fn epoll_create1(flags: ::c_int) -> ::c_int;
     pub fn epoll_ctl(epfd: ::c_int,
                      op: ::c_int,
                      fd: ::c_int,
-                     event: *mut epoll_event) -> ::c_int;
+                     event: *mut ::epoll_event) -> ::c_int;
     pub fn epoll_wait(epfd: ::c_int,
-                      events: *mut epoll_event,
+                      events: *mut ::epoll_event,
                       maxevents: ::c_int,
                       timeout: ::c_int) -> ::c_int;
     pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
     pub fn mount(src: *const ::c_char,
                  target: *const ::c_char,
                  fstype: *const ::c_char,
                  flags: ::c_ulong,
                  data: *const ::c_void) -> ::c_int;
@@ -1550,17 +1543,17 @@ extern {
                    mode: ::mode_t, dev: dev_t) -> ::c_int;
     pub fn ppoll(fds: *mut ::pollfd,
                  nfds: nfds_t,
                  timeout: *const ::timespec,
                  sigmask: *const sigset_t) -> ::c_int;
     pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
                                      clock_id: *mut clockid_t) -> ::c_int;
     pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
-                                     clock_id: clockid_t) -> ::c_int;
+                                     clock_id: ::clockid_t) -> ::c_int;
     pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
                                        pshared: ::c_int) -> ::c_int;
     pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
                                        pshared: *mut ::c_int) -> ::c_int;
     pub fn sched_getaffinity(pid: ::pid_t,
                              cpusetsize: ::size_t,
                              cpuset: *mut cpu_set_t) -> ::c_int;
     pub fn sched_setaffinity(pid: ::pid_t,
@@ -1572,26 +1565,35 @@ extern {
     pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
                    flg: ::c_int) -> ::c_int;
     pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
                                    abstime: *const ::timespec) -> ::c_int;
     pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
                                         pshared: ::c_int) -> ::c_int;
     pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
                                         pshared: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_getkind_np(attr: *const pthread_rwlockattr_t,
+                                         val: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_setkind_np(attr: *mut pthread_rwlockattr_t,
+                                         val: ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+                                         val: *mut ::c_int) -> ::c_int;
+    pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+                                         val: ::c_int) -> ::c_int;
     pub fn ptsname_r(fd: ::c_int,
                      buf: *mut ::c_char,
                      buflen: ::size_t) -> ::c_int;
     pub fn clearenv() -> ::c_int;
     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
                   options: ::c_int) -> ::c_int;
 
     pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
 
     pub fn setpwent();
+    pub fn endpwent();
     pub fn getpwent() -> *mut passwd;
     pub fn setspent();
     pub fn endspent();
     pub fn getspent() -> *mut spwd;
     pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
 
     pub fn shm_open(name: *const c_char, oflag: ::c_int,
                     mode: mode_t) -> ::c_int;
@@ -1748,22 +1750,76 @@ extern {
                  iov: *const ::iovec,
                  iovcnt: ::c_int) -> ::ssize_t;
 
     pub fn sendmsg(fd: ::c_int,
                    msg: *const ::msghdr,
                    flags: ::c_int) -> ::ssize_t;
     pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
                    -> ::ssize_t;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+    pub fn getgrgid_r(uid: ::uid_t,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "sigaltstack$UNIX2003")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+    pub fn sigaltstack(ss: *const stack_t,
+                       oss: *mut stack_t) -> ::c_int;
+    pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+    pub fn getdtablesize() -> ::c_int;
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+    pub fn getgrnam_r(name: *const ::c_char,
+                      grp: *mut ::group,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut ::group) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "pthread_sigmask$UNIX2003")]
+    pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+                           oldset: *mut sigset_t) -> ::c_int;
+    pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+    pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+    pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+    pub fn getpwnam_r(name: *const ::c_char,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+    pub fn getpwuid_r(uid: ::uid_t,
+                      pwd: *mut passwd,
+                      buf: *mut ::c_char,
+                      buflen: ::size_t,
+                      result: *mut *mut passwd) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+               link_name = "sigwait$UNIX2003")]
+    #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+    pub fn sigwait(set: *const sigset_t,
+                   sig: *mut ::c_int) -> ::c_int;
+    pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+                          parent: Option<unsafe extern fn()>,
+                          child: Option<unsafe extern fn()>) -> ::c_int;
+    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "popen$UNIX2003")]
+    pub fn popen(command: *const c_char,
+                 mode: *const c_char) -> *mut ::FILE;
 }
 
 cfg_if! {
     if #[cfg(target_arch = "mips")] {
         mod mips;
         pub use self::mips::*;
     } else if #[cfg(target_arch = "x86_64")] {
         mod x86_64;
         pub use self::x86_64::*;
     } else {
         pub use unsupported_target;
     }
 }
-
new file mode 100644
--- /dev/null
+++ b/third_party/rust/libc/src/unix/uclibc/x86_64/l4re.rs
@@ -0,0 +1,46 @@
+/// L4Re specifics
+/// This module contains definitions required by various L4Re libc backends.
+/// Some of them are formally not part of the libc, but are a dependency of the
+/// libc and hence we should provide them here.
+
+pub type l4_umword_t = ::c_ulong; // Unsigned machine word.
+
+s! {
+    /// CPU sets.
+    pub struct l4_sched_cpu_set_t {
+        // from the L4Re docs
+        /// Combination of granularity and offset.
+        ///
+        /// The granularity defines how many CPUs each bit in map describes.
+        /// The offset is the numer of the first CPU described by the first
+        /// bit in the bitmap.
+        /// offset must be a multiple of 2^graularity.
+        ///
+        /// | MSB              |                 LSB |
+        /// | ---------------- | ------------------- |
+        /// | 8bit granularity | 24bit offset ..     |
+        gran_offset: l4_umword_t ,
+        /// Bitmap of CPUs.
+        map: l4_umword_t ,
+    }
+}
+
+#[cfg(target_os = "l4re")]
+pub struct pthread_attr_t {
+    pub __detachstate: ::c_int,
+    pub __schedpolicy: ::c_int,
+    pub __schedparam: super::__sched_param,
+    pub __inheritsched: ::c_int,
+    pub __scope: ::c_int,
+    pub __guardsize: ::size_t,
+    pub __stackaddr_set: ::c_int,
+    pub __stackaddr: *mut ::c_void, // better don't use it
+    pub __stacksize: ::size_t,
+    // L4Re specifics
+    pub affinity: l4_sched_cpu_set_t,
+    pub create_flags: ::c_uint,
+}
+
+// L4Re requires a min stack size of 64k; that isn't defined in uClibc, but
+// somewhere in the core libraries. uClibc wants 16k, but that's not enough.
+pub const PTHREAD_STACK_MIN: usize = 65536;
--- a/third_party/rust/libc/src/unix/uclibc/x86_64/mod.rs
+++ b/third_party/rust/libc/src/unix/uclibc/x86_64/mod.rs
@@ -1,136 +1,173 @@
-//! Definitions for l4re-uclibc on 64bit systems
-
+//! Definitions for uclibc on 64bit systems
+//!
 pub type blkcnt_t = i64;
 pub type blksize_t = i64;
+pub type clock_t = i64;
 pub type c_char = u8;
 pub type c_long = i64;
 pub type c_ulong = u64;
 pub type fsblkcnt_t = ::c_ulong;
 pub type fsfilcnt_t = ::c_ulong;
 pub type fsword_t = ::c_long;
 pub type ino_t = ::c_ulong;
 pub type nlink_t = ::c_uint;
 pub type off_t = ::c_long;
 pub type rlim_t = c_ulong;
 pub type rlim64_t = u64;
+// [uClibc docs] Note stat64 has the same shape as stat for x86-64.
+pub type stat64 = stat;
 pub type suseconds_t = ::c_long;
 pub type time_t = ::c_int;
 pub type wchar_t = ::c_int;
 
-// ToDo, used?
-//pub type d_ino = ::c_ulong;
 pub type nfds_t = ::c_ulong;
 
 s! {
-    // ------------------------------------------------------------
-    // networking
-    pub struct in_addr {
-        pub s_addr: in_addr_t,
+    pub struct dirent {
+        pub d_ino: ::ino64_t,
+        pub d_off: ::off64_t,
+        pub d_reclen: u16,
+        pub d_type: u8,
+        pub d_name: [::c_char; 256],
+    }
+
+    pub struct dirent64 {
+        pub d_ino: ::ino64_t,
+        pub d_off: ::off64_t,
+        pub d_reclen: u16,
+        pub d_type: u8,
+        pub d_name: [::c_char; 256],
+    }
+
+    pub struct ipc_perm {
+        pub __key: ::key_t,
+        pub uid: ::uid_t,
+        pub gid: ::gid_t,
+        pub cuid: ::uid_t,
+        pub cgid: ::gid_t,
+        pub mode: ::c_ushort, // read / write
+        __pad1: ::c_ushort,
+        pub __seq: ::c_ushort,
+        __pad2: ::c_ushort,
+        __unused1: ::c_ulong,
+        __unused2: ::c_ulong
     }
 
-    pub struct in6_addr {
-        pub s6_addr: [u8; 16],
-        __align: [u32; 0],
+    #[cfg(not(target_os = "l4re"))]
+    pub struct pthread_attr_t {
+        __detachstate: ::c_int,
+        __schedpolicy: ::c_int,
+        __schedparam: __sched_param,
+        __inheritsched: ::c_int,
+        __scope: ::c_int,
+        __guardsize: ::size_t,
+        __stackaddr_set: ::c_int,
+        __stackaddr: *mut ::c_void, // better don't use it
+        __stacksize: ::size_t,
+    }
+
+    pub struct __sched_param {
+        __sched_priority: ::c_int,
+    }
+
+    pub struct siginfo_t {
+        si_signo: ::c_int, // signal number
+        si_errno: ::c_int, // if not zero: error value of signal, see errno.h
+        si_code: ::c_int,  // signal code
+        pub _pad: [::c_int; 28], // unported union
+        _align: [usize; 0],
+    }
+
+    pub struct shmid_ds {
+        pub shm_perm: ::ipc_perm,
+        pub shm_segsz: ::size_t, // segment size in bytes
+        pub shm_atime: ::time_t, // time of last shmat()
+        pub shm_dtime: ::time_t,
+        pub shm_ctime: ::time_t,
+        pub shm_cpid: ::pid_t,
+        pub shm_lpid: ::pid_t,
+        pub shm_nattch: ::shmatt_t,
+        __unused1: ::c_ulong,
+        __unused2: ::c_ulong
+    }
+
+    pub struct msqid_ds {
+        pub msg_perm: ::ipc_perm,
+        pub msg_stime: ::time_t,
+        pub msg_rtime: ::time_t,
+        pub msg_ctime: ::time_t,
+        __msg_cbytes: ::c_ulong,
+        pub msg_qnum: ::msgqnum_t,
+        pub msg_qbytes: ::msglen_t,
+        pub msg_lspid: ::pid_t,
+        pub msg_lrpid: ::pid_t,
+        __ignored1: ::c_ulong,
+        __ignored2: ::c_ulong,
     }
 
     pub struct sockaddr {
-        pub sa_family: sa_family_t,
+        pub sa_family: ::sa_family_t,
         pub sa_data: [::c_char; 14],
     }
 
     pub struct sockaddr_in {
-        pub sin_family: sa_family_t,
+        pub sin_family: ::sa_family_t,
         pub sin_port: ::in_port_t,
         pub sin_addr: ::in_addr,
         pub sin_zero: [u8; 8],
     }
 
     pub struct sockaddr_in6 {
-        pub sin6_family: sa_family_t,
-        pub sin6_port: in_port_t,
+        pub sin6_family: ::sa_family_t,
+        pub sin6_port: ::in_port_t,
         pub sin6_flowinfo: u32,
         pub sin6_addr: ::in6_addr,
         pub sin6_scope_id: u32,
     }
 
     // ------------------------------------------------------------
     // definitions below are *unverified* and might **break** the software
-    pub struct stat { // ToDo
+//    pub struct in_addr {
+//        pub s_addr: in_addr_t,
+//    }
+//
+//    pub struct in6_addr {
+//        pub s6_addr: [u8; 16],
+//        __align: [u32; 0],
+//    }
+
+    pub struct stat {
         pub st_dev: ::c_ulong,
-        st_pad1: [::c_long; 2],
         pub st_ino: ::ino_t,
+        // According to uclibc/libc/sysdeps/linux/x86_64/bits/stat.h, order of
+        // nlink and mode are swapped on 64 bit systems.
+        pub st_nlink: ::nlink_t,
         pub st_mode: ::mode_t,
-        pub st_nlink: ::nlink_t,
         pub st_uid: ::uid_t,
         pub st_gid: ::gid_t,
-        pub st_rdev: u64,
-        pub st_pad2: [u64; 1],
-        pub st_size: off_t,
-        st_pad3: ::c_long,
+        pub st_rdev: ::c_ulong, // dev_t
+        pub st_size: off_t, // file size
+        pub st_blksize: ::blksize_t,
+        pub st_blocks: ::blkcnt_t,
         pub st_atime: ::time_t,
-        pub st_atime_nsec: ::c_long,
+        pub st_atime_nsec: ::c_ulong,
         pub st_mtime: ::time_t,
-        pub st_mtime_nsec: ::c_long,
+        pub st_mtime_nsec: ::c_ulong,
         pub st_ctime: ::time_t,
-        pub st_ctime_nsec: ::c_long,
-        pub st_blksize: ::blksize_t,
-        st_pad4: ::c_long,
-        pub st_blocks: ::blkcnt_t,
-        st_pad5: [::c_long; 7],
+        pub st_ctime_nsec: ::c_ulong,
+        st_pad4: [::c_long; 3]
     }
 
-    pub struct statvfs { // ToDo: broken
-        pub f_bsize: ::c_ulong,
-        pub f_frsize: ::c_ulong,
-        pub f_blocks: ::fsblkcnt_t,
-        pub f_bfree: ::fsblkcnt_t,
-        pub f_bavail: ::fsblkcnt_t,
-        pub f_files: ::fsfilcnt_t,
-        pub f_ffree: ::fsfilcnt_t,
-        pub f_favail: ::fsfilcnt_t,
-        #[cfg(target_endian = "little")]
-        pub f_fsid: ::c_ulong,
-        #[cfg(target_pointer_width = "32")]
-        __f_unused: ::c_int,
-        #[cfg(target_endian = "big")]
-        pub f_fsid: ::c_ulong,
-        pub f_flag: ::c_ulong,
-        pub f_namemax: ::c_ulong,
-        __f_spare: [::c_int; 6],
-    }
-
-    pub struct dirent { // Todo
-        pub d_ino: ino_64_t,
-        pub d_off: off64_t,
-        d_reclen: u16,
-        pub d_type: u8,
-        pub d_name: [i8; 256],
-    }
-
-    pub struct dirent64 { //
-        pub d_ino: ino64_t,
-        pub d_off: off64_t,
-        pub d_reclen: u16,
-        pub d_type: u8,
-        pub d_name: [i8; 256],
-    }
-
-    pub struct pthread_attr_t { // ToDo
-        __size: [u64; 7]
-    }
-
-    pub struct sigaction { // TODO!!
-        pub sa_sigaction: ::sighandler_t,
+    pub struct sigaction {
+        pub sa_handler: ::sighandler_t,
+        pub sa_flags: ::c_ulong,
+        pub sa_restorer: *mut ::c_void,
         pub sa_mask: ::sigset_t,
-        #[cfg(target_arch = "sparc64")]
-        __reserved0: ::c_int,
-        pub sa_flags: ::c_int,
-        _restorer: *mut ::c_void,
     }
 
     pub struct stack_t { // ToDo
         pub ss_sp: *mut ::c_void,
         pub ss_flags: ::c_int,
         pub ss_size: ::size_t
     }
 
@@ -245,68 +282,68 @@ s! {
         pub gl_flags: ::c_int,
         __unused1: *mut ::c_void,
         __unused2: *mut ::c_void,
         __unused3: *mut ::c_void,
         __unused4: *mut ::c_void,
         __unused5: *mut ::c_void,
     }
 
-    pub struct stat64 { // ToDo
-        pub st_dev: ::dev_t,
-        pub st_ino: ::ino64_t,
-        pub st_nlink: ::nlink_t,
-        pub st_mode: ::mode_t,
-        pub st_uid: ::uid_t,
-        pub st_gid: ::gid_t,
-        __pad0: ::c_int,
-        pub st_rdev: ::dev_t,
-        pub st_size: ::off_t,
-        pub st_blksize: ::blksize_t,
-        pub st_blocks: ::blkcnt64_t,
-        pub st_atime: ::time_t,
-        pub st_atime_nsec: ::c_long,
-        pub st_mtime: ::time_t,
-        pub st_mtime_nsec: ::c_long,
-        pub st_ctime: ::time_t,
-        pub st_ctime_nsec: ::c_long,
-        __reserved: [::c_long; 3],
-    }
-
     pub struct rlimit64 { // ToDo
         pub rlim_cur: rlim64_t,
         pub rlim_max: rlim64_t,
     }
 
     pub struct cpu_set_t { // ToDo
         #[cfg(target_pointer_width = "32")]
         bits: [u32; 32],
         #[cfg(target_pointer_width = "64")]
         bits: [u64; 16],
     }
 
-    pub struct timespec { // ToDo
-        tv_sec: time_t, // seconds
-        tv_nsec: ::c_ulong, // nanoseconds
-    }
-
     pub struct fsid_t { // ToDo
         __val: [::c_int; 2],
     }
 }
 
 // constants
+pub const EADDRINUSE: ::c_int = 98; // Address already in use
+pub const EADDRNOTAVAIL: ::c_int = 99; // Cannot assign requested address
+pub const ECONNABORTED: ::c_int = 103; // Software caused connection abort
+pub const ECONNREFUSED: ::c_int = 111; // Connection refused
+pub const ECONNRESET: ::c_int = 104; // Connection reset by peer
+pub const EDEADLK: ::c_int = 35; // Resource deadlock would occur
+pub const ENOSYS: ::c_int = 38; // Function not implemented
+pub const ENOTCONN: ::c_int = 107; // Transport endpoint is not connected
+pub const ETIMEDOUT: ::c_int = 110; // connection timed out
+pub const O_APPEND: ::c_int = 02000;
+pub const O_ACCMODE: ::c_int = 0003;
 pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_CREAT: ::c_int = 0100;
 pub const O_DIRECTORY: ::c_int = 0200000;
+pub const O_EXCL: ::c_int = 0200;
+pub const O_NONBLOCK: ::c_int = 04000;
+pub const O_TRUNC: ::c_int = 01000;
 pub const NCCS: usize = 32;
+pub const SIG_SETMASK: ::c_int = 2; // Set the set of blocked signals
+pub const PTHREAD_STACK_MIN: usize = 16384;
 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
 pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
 pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
 pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
 pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
+pub const RLIM_INFINITY: u64 = 0xffffffffffffffff;
 pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
 
 extern {
     pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
 }
+
+cfg_if! {
+    if #[cfg(target_os = "l4re")] {
+        mod l4re;
+        pub use self::l4re::*;
+    } else { }
+}
+
--- a/third_party/rust/libc/src/windows.rs
+++ b/third_party/rust/libc/src/windows.rs
@@ -38,16 +38,28 @@ s! {
     }
 
     // note that this is called utimbuf64 in Windows
     pub struct utimbuf {
         pub actime: time64_t,
         pub modtime: time64_t,
     }
 
+    pub struct tm {
+        tm_sec: ::c_int,
+        tm_min: ::c_int,
+        tm_hour: ::c_int,
+        tm_mday: ::c_int,
+        tm_mon: ::c_int,
+        tm_year: ::c_int,
+        tm_wday: ::c_int,
+        tm_yday: ::c_int,
+        tm_isdst: ::c_int,
+    }
+
     pub struct timeval {
         pub tv_sec: c_long,
         pub tv_usec: c_long,
     }
 
     pub struct timespec {
         pub tv_sec: time_t,
         pub tv_nsec: c_long,
copy from third_party/rust/matches/.cargo-checksum.json
copy to third_party/rust/matches-0.1.4/.cargo-checksum.json
copy from third_party/rust/matches/Cargo.toml
copy to third_party/rust/matches-0.1.4/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/matches-0.1.4/LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) 2014-2016 Simon Sapin
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
copy from third_party/rust/matches/lib.rs
copy to third_party/rust/matches-0.1.4/lib.rs
--- a/third_party/rust/matches/.cargo-checksum.json
+++ b/third_party/rust/matches/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"8bbbe858562332a57f5f5551b427e79874ae3c3df52766df61860871288e827a","LICENSE":"d7b49708075b5f43f8e108464f1970c8c66fa8b6afce4f9c944da3af77cc1460","lib.rs":"d927e99fc4fd88b0e30b44580384b411e63bc504e9953ac7cc85029437372266"},"package":"efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"}
\ No newline at end of file
+{"files":{"Cargo.toml":"99f3240f188218fe7890b29ee50df780298ea63ecd5861b88cd68844a3f4b8c9","LICENSE":"d7b49708075b5f43f8e108464f1970c8c66fa8b6afce4f9c944da3af77cc1460","lib.rs":"e5af1e84cfb67b1466d75c586efe31cae68b1ddf6015df2589ce18c23bd09bdc"},"package":"100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"}
\ No newline at end of file
--- a/third_party/rust/matches/Cargo.toml
+++ b/third_party/rust/matches/Cargo.toml
@@ -1,12 +1,12 @@
 [package]
 name = "matches"
-version = "0.1.4"
+version = "0.1.6"
 authors = ["Simon Sapin <simon.sapin@exyr.org>"]
 license = "MIT"
 repository = "https://github.com/SimonSapin/rust-std-candidates"
 description = "A macro to evaluate, as a boolean, whether an expression matches a pattern."
+documentation = "https://docs.rs/matches/"
 
 [lib]
 name = "matches"
 path = "lib.rs"
-doctest = false
--- a/third_party/rust/matches/lib.rs
+++ b/third_party/rust/matches/lib.rs
@@ -1,38 +1,106 @@
+/// Check if an expression matches a refutable pattern.
+///
+/// Syntax: `matches!(` *expression* `,` *pattern* `)`
+///
+/// Return a boolean, true if the expression matches the pattern, false otherwise.
+///
+/// # Examples
+///
+/// ```
+/// #[macro_use]
+/// extern crate matches;
+///
+/// pub enum Foo<T> {
+///     A,
+///     B(T),
+/// }
+///
+/// impl<T> Foo<T> {
+///     pub fn is_a(&self) -> bool {
+///         matches!(*self, Foo::A)
+///     }
+///
+///     pub fn is_b(&self) -> bool {
+///         matches!(*self, Foo::B(_))
+///     }
+/// }
+///
+/// # fn main() { }
+/// ```
 #[macro_export]
 macro_rules! matches {
     ($expression:expr, $($pattern:tt)+) => {
         _matches_tt_as_expr_hack! {
             match $expression {
                 $($pattern)+ => true,
                 _ => false
             }
         }
     }
 }
 
 /// Work around "error: unexpected token: `an interpolated tt`", whatever that means.
+#[doc(hidden)]
 #[macro_export]
 macro_rules! _matches_tt_as_expr_hack {
     ($value:expr) => ($value)
 }
 
+/// Assert that an expression matches a refutable pattern.
+///
+/// Syntax: `assert_matches!(` *expression* `,` *pattern* `)`
+///
+/// Panic with a message that shows the expression if it does not match the
+/// pattern.
+///
+/// # Examples
+///
+/// ```
+/// #[macro_use]
+/// extern crate matches;
+///
+/// fn main() {
+///     let data = [1, 2, 3];
+///     assert_matches!(data.get(1), Some(_));
+/// }
+/// ```
 #[macro_export]
 macro_rules! assert_matches {
     ($expression:expr, $($pattern:tt)+) => {
         _matches_tt_as_expr_hack! {
             match $expression {
                 $($pattern)+ => (),
                 ref e => panic!("assertion failed: `{:?}` does not match `{}`", e, stringify!($($pattern)+)),
             }
         }
     }
 }
 
+/// Assert that an expression matches a refutable pattern using debug assertions.
+///
+/// Syntax: `debug_assert_matches!(` *expression* `,` *pattern* `)`
+///
+/// If debug assertions are enabled, panic with a message that shows the
+/// expression if it does not match the pattern.
+///
+/// When debug assertions are not enabled, this macro does nothing.
+///
+/// # Examples
+///
+/// ```
+/// #[macro_use]
+/// extern crate matches;
+///
+/// fn main() {
+///     let data = [1, 2, 3];
+///     debug_assert_matches!(data.get(1), Some(_));
+/// }
+/// ```
 #[macro_export]
 macro_rules! debug_assert_matches {
     ($($arg:tt)*) => (if cfg!(debug_assertions) { assert_matches!($($arg)*); })
 }
 
 #[test]
 fn matches_works() {
     let foo = Some("-12");
copy from third_party/rust/mime/.cargo-checksum.json
copy to third_party/rust/mime-0.2.4/.cargo-checksum.json
new file mode 100644
--- /dev/null
+++ b/third_party/rust/mime-0.2.4/.travis.yml
@@ -0,0 +1,3 @@
+language: rust
+rust: beta
+
copy from third_party/rust/mime/Cargo.toml
copy to third_party/rust/mime-0.2.4/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/mime-0.2.4/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2014 Sean McArthur
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
new file mode 100644
--- /dev/null
+++ b/third_party/rust/mime-0.2.4/README.md
@@ -0,0 +1,11 @@
+# mime.rs
+
+[![Build Status](https://travis-ci.org/hyperium/mime.rs.svg?branch=master)](https://travis-ci.org/hyperium/mime.rs)
+
+Support MIME (Media Types) as strong types in Rust.
+
+[Documentation](http://hyperium.github.io/mime.rs)
+
+## License
+
+[MIT](./LICENSE)
copy from third_party/rust/mime/src/lib.rs
copy to third_party/rust/mime-0.2.4/src/lib.rs
--- a/third_party/rust/mime/.cargo-checksum.json
+++ b/third_party/rust/mime/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"713aa1cac091a99e295194ca0dfd6d74028edbb02a0f5f627f3d3dfdf6437ee0","Cargo.toml":"cf9de6a21aa19f3f8c5e074625629f93f3f38cff8d57598e4287a554f10b1549","LICENSE":"df9cfd06d8a44d9a671eadd39ffd97f166481da015a30f45dfd27886209c5922","README.md":"706ee5777dbfea1255359f2dd3f905f7bb89282a528c9c14e38751e5e874fd5e","src/lib.rs":"9635770a9af281e355a538a5f629b9b338b9350c71cc2ec5f7c101794a3289f7"},"package":"9d69889cdc6336ed56b174514ce876c4c3dc564cc23dd872e7bca589bb2a36c8"}
\ No newline at end of file
+{"files":{".travis.yml":"713aa1cac091a99e295194ca0dfd6d74028edbb02a0f5f627f3d3dfdf6437ee0","Cargo.toml":"c2757b0a3b45e977f1f872603ad3cee9a029ffb9a37af5eb639a7c16c96fa3d9","LICENSE":"df9cfd06d8a44d9a671eadd39ffd97f166481da015a30f45dfd27886209c5922","README.md":"706ee5777dbfea1255359f2dd3f905f7bb89282a528c9c14e38751e5e874fd5e","src/lib.rs":"0f534df49767cdf07ee2f59db9b8aeb8ca9f552531504eef0b1bbe55f6fbd7f7"},"package":"ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"}
\ No newline at end of file
--- a/third_party/rust/mime/Cargo.toml
+++ b/third_party/rust/mime/Cargo.toml
@@ -1,25 +1,37 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
-
 name = "mime"
-version = "0.2.4"
+version = "0.2.6"
 authors = ["Sean McArthur <sean.monstar@gmail.com>"]
-license = "MIT"
 description = "Strongly Typed Mimes"
 documentation = "http://hyperium.github.io/mime.rs"
+keywords = ["mime", "media-extensions", "media-types"]
+license = "MIT"
 repository = "https://github.com/hyperium/mime.rs"
-keywords = ["mime", "media-extensions", "media-types"]
-
-[dependencies]
-log = "0.3"
-serde = { version = ">=0.7, <0.9", optional = true }
-
-[dev-dependencies]
-serde_json = ">=0.7, <0.9"
-
 [dependencies.heapsize]
 version = ">=0.2.0, <0.4"
 optional = true
 
+[dependencies.log]
+version = "0.3"
+
+[dependencies.serde]
+version = ">=0.7, <0.9"
+optional = true
+[dev-dependencies.serde_json]
+version = ">=0.7, <0.9"
+
 [features]
 heap_size = ["heapsize"]
 nightly = []
--- a/third_party/rust/mime/src/lib.rs
+++ b/third_party/rust/mime/src/lib.rs
@@ -36,24 +36,16 @@ extern crate serde_json;
 #[cfg(feature = "heapsize")]
 extern crate heapsize;
 
 use std::ascii::AsciiExt;
 use std::fmt;
 use std::iter::Enumerate;
 use std::str::{FromStr, Chars};
 
-macro_rules! inspect(
-    ($s:expr, $t:expr) => ({
-        let t = $t;
-        trace!("inspect {}: {:?}", $s, t);
-        t
-    })
-);
-
 /// Mime, or Media Type. Encapsulates common registers types.
 ///
 /// Consider that a traditional mime type contains a "top level type",
 /// a "sub level type", and 0-N "parameters". And they're all strings.
 /// Strings everywhere. Strings mean typos. Rust has type safety. We should
 /// use types!
 ///
 /// So, Mime bundles together this data into types so the compiler can catch
@@ -79,16 +71,17 @@ impl<T: AsRef<[Param]> + heapsize::HeapS
     fn heap_size_of_children(&self) -> usize {
         self.0.heap_size_of_children() +
         self.1.heap_size_of_children() +
         self.2.heap_size_of_children()
     }
 }
 
 impl<LHS: AsRef<[Param]>, RHS: AsRef<[Param]>> PartialEq<Mime<RHS>> for Mime<LHS> {
+    #[inline]
     fn eq(&self, other: &Mime<RHS>) -> bool {
         self.0 == other.0 && self.1 == other.1 && self.2.as_ref() == other.2.as_ref()
     }
 }
 
 /// Easily create a Mime without having to import so many enums.
 ///
 /// # Example
@@ -153,21 +146,22 @@ macro_rules! enoom {
         impl ::std::ops::Deref for $en {
             type Target = str;
             fn deref(&self) -> &str {
                 self.as_str()
             }
         }
 
         impl PartialEq for $en {
+            #[inline]
             fn eq(&self, other: &$en) -> bool {
                 match (self, other) {
                     $( (&$en::$ty, &$en::$ty) => true ),*,
                     (&$en::$ext(ref a), &$en::$ext(ref b)) => a == b,
-                    _ => self.as_str() == other.as_str()
+                    (_, _) => self.as_str() == other.as_str(),
                 }
             }
         }
 
         impl PartialEq<String> for $en {
             fn eq(&self, other: &String) -> bool {
                 self.as_str() == other
             }
@@ -213,17 +207,17 @@ macro_rules! enoom {
             }
         }
 
         impl FromStr for $en {
             type Err = ();
             fn from_str(s: &str) -> Result<$en, ()> {
                 Ok(match s {
                     $(_s if _s == $text => $en::$ty),*,
-                    s => $en::$ext(inspect!(stringify!($ext), s).to_string())
+                    s => $en::$ext(s.to_string())
                 })
             }
         }
 
         #[cfg(feature = "heapsize")]
         impl heapsize::HeapSizeOf for $en {
             fn heap_size_of_children(&self) -> usize {
                 match *self {
@@ -297,16 +291,45 @@ enoom! {
     Utf8, "utf-8";
 }
 
 pub type Param = (Attr, Value);
 
 impl<T: AsRef<[Param]>> fmt::Display for Mime<T> {
     #[inline]
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        // It's much faster to write a single string, as opposed to push
+        // several parts through f.write_str(). So, check for the most common
+        // mime types, and fast track them.
+        if let TopLevel::Text = self.0 {
+            if let SubLevel::Plain = self.1 {
+                let attrs = self.2.as_ref();
+                if attrs.len() == 0 {
+                    return f.write_str("text/plain");
+                } else if &[(Attr::Charset, Value::Utf8)] == attrs {
+                    return f.write_str("text/plain; charset=utf-8");
+                }
+            }
+        } else if let TopLevel::Application = self.0 {
+            if let SubLevel::Json = self.1 {
+                let attrs = self.2.as_ref();
+                if attrs.len() == 0 {
+                    return f.write_str("application/json");
+                }
+            }
+        } else if let TopLevel::Star = self.0 {
+            if let SubLevel::Star = self.1 {
+                let attrs = self.2.as_ref();
+                if attrs.len() == 0 {
+                    return f.write_str("*/*");
+                }
+            }
+        }
+
+        // slower general purpose fmt
         try!(fmt::Display::fmt(&self.0, f));
         try!(f.write_str("/"));
         try!(fmt::Display::fmt(&self.1, f));
         for param in self.2.as_ref() {
             try!(f.write_str("; "));
             try!(fmt::Display::fmt(&param.0, f));
             try!(f.write_str("="));
             try!(fmt::Display::fmt(&param.1, f));
@@ -331,17 +354,17 @@ impl FromStr for Mime {
         let ascii = raw.to_ascii_lowercase(); // lifetimes :(
         let len = ascii.len();
         let mut iter = ascii.chars().enumerate();
         let mut params = vec![];
         // toplevel
         let mut start;
         let top;
         loop {
-            match inspect!("top iter", iter.next()) {
+            match iter.next() {
                 Some((0, c)) if is_restricted_name_first_char(c) => (),
                 Some((i, c)) if i > 0 && is_restricted_name_char(c) => (),
                 Some((i, '/')) if i > 0 => match FromStr::from_str(&ascii[..i]) {
                     Ok(t) => {
                         top = t;
                         start = i + 1;
                         break;
                     }
@@ -351,17 +374,17 @@ impl FromStr for Mime {
             };
 
         }
 
         // sublevel
         let sub;
         let mut sub_star = false;
         loop {
-            match inspect!("sub iter", iter.next()) {
+            match iter.next() {
                 Some((i, '*')) if i == start => {
                     sub_star = true;
                 },
                 Some((i, c)) if i == start && is_restricted_name_first_char(c) => (),
                 Some((i, c)) if !sub_star && i > start && is_restricted_name_char(c) => (),
                 Some((i, ';')) if i > start => match FromStr::from_str(&ascii[start..i]) {
                     Ok(s) => {
                         sub = s;
@@ -376,17 +399,17 @@ impl FromStr for Mime {
                 },
                 _ => return Err(())
             };
         }
 
         // params
         debug!("starting params, len={}", len);
         loop {
-            match inspect!("param", param_from_str(raw, &ascii, &mut iter, start)) {
+            match param_from_str(raw, &ascii, &mut iter, start) {
                 Some((p, end)) => {
                     params.push(p);
                     start = end;
                     if start >= len {
                         break;
                     }
                 }
                 None => break
@@ -419,23 +442,23 @@ impl serde::de::Deserialize for Mime {
         Ok(mime)
     }
 }
 
 fn param_from_str(raw: &str, ascii: &str, iter: &mut Enumerate<Chars>, mut start: usize) -> Option<(Param, usize)> {
     let attr;
     debug!("param_from_str, start={}", start);
     loop {
-        match inspect!("attr iter", iter.next()) {
+        match iter.next() {
             Some((i, ' ')) if i == start => start = i + 1,
             Some((i, c)) if i == start && is_restricted_name_first_char(c) => (),
             Some((i, c)) if i > start && is_restricted_name_char(c) => (),
             Some((i, '=')) if i > start => match FromStr::from_str(&ascii[start..i]) {
                 Ok(a) => {
-                    attr = inspect!("attr", a);
+                    attr = a;
                     start = i + 1;
                     break;
                 },
                 Err(_) => return None
             },
             _ => return None
         }
     }
@@ -443,17 +466,17 @@ fn param_from_str(raw: &str, ascii: &str
     let value;
     // values must be restrict-name-char or "anything goes"
     let mut is_quoted = false;
 
     {
         let substr = |a,b| { if attr==Attr::Charset { &ascii[a..b] } else { &raw[a..b] } };
         let endstr = |a| { if attr==Attr::Charset { &ascii[a..] } else { &raw[a..] } };
         loop {
-            match inspect!("value iter", iter.next()) {
+            match iter.next() {
                 Some((i, '"')) if i == start => {
                     debug!("quoted");
                     is_quoted = true;
                     start = i + 1;
                 },
                 Some((i, c)) if i == start && is_restricted_name_first_char(c) => (),
                 Some((i, '"')) if i > start && is_quoted => match FromStr::from_str(substr(start,i)) {
                     Ok(v) => {
@@ -607,17 +630,17 @@ mod tests {
         let deserialized: Mime = serde_json::from_str(&serialized).unwrap();
         assert_eq!(mime, deserialized);
     }
 
     #[cfg(feature = "nightly")]
     #[bench]
     fn bench_fmt(b: &mut Bencher) {
         use std::fmt::Write;
-        let mime = mime!(Text/Plain; Charset=Utf8, ("foo")=("bar"));
+        let mime = mime!(Text/Plain; Charset=Utf8);
         b.bytes = mime.to_string().as_bytes().len() as u64;
         let mut s = String::with_capacity(64);
         b.iter(|| {
             let _ = write!(s, "{}", mime);
             ::test::black_box(&s);
             unsafe { s.as_mut_vec().set_len(0); }
         })
     }
new file mode 100644
--- /dev/null
+++ b/third_party/rust/num_cpus-1.6.0/.appveyor.yml
@@ -0,0 +1,16 @@
+environment:
+  matrix:
+  - TARGET: x86_64-pc-windows-msvc
+  - TARGET: i686-pc-windows-msvc
+  - TARGET: x86_64-pc-windows-gnu
+  - TARGET: i686-pc-windows-gnu
+install:
+  - curl -sSf -o rustup-init.exe https://win.rustup.rs/
+  - rustup-init.exe -y --default-host %TARGET%
+  - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
+  - rustc -vV
+  - cargo -vV
+build: false
+test_script:
+  - cargo build --verbose
+  - cargo test --verbose
copy from third_party/rust/num_cpus/.cargo-checksum.json
copy to third_party/rust/num_cpus-1.6.0/.cargo-checksum.json
new file mode 100644
--- /dev/null
+++ b/third_party/rust/num_cpus-1.6.0/.travis.yml
@@ -0,0 +1,20 @@
+language: rust
+rust:
+  - stable
+  - beta
+  - nightly
+
+sudo: false
+
+cache:
+  apt: true
+  directories:
+    - target/debug/deps
+    - target/debug/build
+
+script:
+  - cargo build --verbose
+  - cargo test --verbose
+
+notifications:
+  email: false
copy from third_party/rust/num_cpus/Cargo.toml
copy to third_party/rust/num_cpus-1.6.0/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/num_cpus-1.6.0/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/num_cpus-1.6.0/LICENSE-MIT
@@ -0,0 +1,20 @@
+Copyright (c) 2015
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
new file mode 100644
--- /dev/null
+++ b/third_party/rust/num_cpus-1.6.0/README.md
@@ -0,0 +1,42 @@
+# num_cpus
+
+[![crates.io](http://meritbadge.herokuapp.com/num_cpus)](https://crates.io/crates/num_cpus)
+[![Travis CI Status](https://travis-ci.org/seanmonstar/num_cpus.svg?branch=master)](https://travis-ci.org/seanmonstar/num_cpus)
+[![AppVeyor status](https://ci.appveyor.com/api/projects/status/qn8t6grhko5jwno6?svg=true)](https://ci.appveyor.com/project/seanmonstar/num-cpus)
+
+[Documentation](https://docs.rs/num_cpus)
+
+Count the number of CPUs on the current machine.
+
+## Usage
+
+Add to Cargo.toml:
+
+```toml
+[dependencies]
+num_cpus = "1.0"
+```
+
+In your `main.rs` or `lib.rs`:
+
+```rust
+extern crate num_cpus;
+
+// elsewhere
+let num = num_cpus::get();
+```
+
+## License
+
+Licensed under either of
+
+ * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
+additional terms or conditions.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/num_cpus-1.6.0/src/lib.rs
@@ -0,0 +1,316 @@
+//! # num_cpus
+//!
+//! A crate with utilities to determine the number of CPUs available on the
+//! current system.
+//!
+//! ## Example
+//!
+//! ```
+//! let cpus = num_cpus::get();
+//! ```
+#![cfg_attr(test, deny(warnings))]
+#![deny(missing_docs)]
+#![allow(non_snake_case)]
+
+#[cfg(not(windows))]
+extern crate libc;
+
+/// Returns the number of available CPUs of the current system.
+///
+/// # Note
+///
+/// This will check sched affinity on Linux.
+#[inline]
+pub fn get() -> usize {
+    get_num_cpus()
+}
+
+/// Returns the number of physical cores of the current system.
+///
+/// If not possible on the particular architecture, returns same as `get()`
+/// which is the logical CPUs.
+#[inline]
+pub fn get_physical() -> usize {
+    get_num_physical_cpus()
+}
+
+
+#[cfg(not(any(target_os = "linux", target_os = "windows")))]
+#[inline]
+fn get_num_physical_cpus() -> usize {
+    // Not implemented, fallback
+    get_num_cpus()
+}
+
+#[cfg(target_os = "windows")]
+fn get_num_physical_cpus() -> usize {
+    match get_num_physical_cpus_windows() {
+        Some(num) => num,
+        None => get_num_cpus()
+    }
+}
+
+#[cfg(target_os = "windows")]
+fn get_num_physical_cpus_windows() -> Option<usize> {
+    // Inspired by https://msdn.microsoft.com/en-us/library/ms683194
+
+    use std::ptr;
+    use std::mem;
+
+    #[allow(non_upper_case_globals)]
+    const RelationProcessorCore: u32 = 0;
+
+    #[repr(C)]
+    #[allow(non_camel_case_types)]
+    struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION {
+        mask: usize,
+        relationship: u32,
+        _unused: [u64; 2]
+    }
+
+    extern "system" {
+        fn GetLogicalProcessorInformation(
+            info: *mut SYSTEM_LOGICAL_PROCESSOR_INFORMATION,
+            length: &mut u32
+        ) -> u32;
+    }
+
+    // First we need to determine how much space to reserve.
+
+    // The required size of the buffer, in bytes.
+    let mut needed_size = 0;
+
+    unsafe {
+        GetLogicalProcessorInformation(ptr::null_mut(), &mut needed_size);
+    }
+
+    let struct_size = mem::size_of::<SYSTEM_LOGICAL_PROCESSOR_INFORMATION>() as u32;
+
+    // Could be 0, or some other bogus size.
+    if needed_size == 0 || needed_size < struct_size || needed_size % struct_size != 0 {
+        return None;
+    }
+
+    let count = needed_size / struct_size;
+
+    // Allocate some memory where we will store the processor info.
+    let mut buf = Vec::with_capacity(count as usize);
+
+    let result;
+
+    unsafe {
+        result = GetLogicalProcessorInformation(buf.as_mut_ptr(), &mut needed_size);
+    }
+
+    // Failed for any reason.
+    if result == 0 {
+        return None;
+    }
+
+    let count = needed_size / struct_size;
+
+    unsafe {
+        buf.set_len(count as usize);
+    }
+
+    let phys_proc_count = buf.iter()
+        // Only interested in processor packages (physical processors.)
+        .filter(|proc_info| proc_info.relationship == RelationProcessorCore)
+        .count();
+
+    if phys_proc_count == 0 {
+        None
+    } else {
+        Some(phys_proc_count)
+    }
+}
+
+#[cfg(target_os = "linux")]
+fn get_num_physical_cpus() -> usize {
+    use std::io::BufReader;
+    use std::io::BufRead;
+    use std::fs::File;
+    use std::collections::HashSet;
+
+    let file = match File::open("/proc/cpuinfo") {
+        Ok(val) => val,
+        Err(_) => {return get_num_cpus()},
+    };
+    let reader = BufReader::new(file);
+    let mut set = HashSet::new();
+    let mut coreid: u32 = 0;
+    let mut physid: u32 = 0;
+    let mut chgcount = 0;
+    for line in reader.lines().filter_map(|result| result.ok()) {
+        let parts: Vec<&str> = line.split(':').map(|s| s.trim()).collect();
+        if parts.len() != 2 {
+            continue
+        }
+        if parts[0] == "core id" || parts[0] == "physical id" {
+            let value = match parts[1].trim().parse() {
+              Ok(val) => val,
+              Err(_) => break,
+            };
+            match parts[0] {
+                "core id"     => coreid = value,
+                "physical id" => physid = value,
+                _ => {},
+            }
+            chgcount += 1;
+        }
+        if chgcount == 2 {
+            set.insert((physid, coreid));
+            chgcount = 0;
+        }
+    }
+    let count = set.len();
+    if count == 0 { get_num_cpus() } else { count }
+}
+
+#[cfg(windows)]
+fn get_num_cpus() -> usize {
+    #[repr(C)]
+    struct SYSTEM_INFO {
+        wProcessorArchitecture: u16,
+        wReserved: u16,
+        dwPageSize: u32,
+        lpMinimumApplicationAddress: *mut u8,
+        lpMaximumApplicationAddress: *mut u8,
+        dwActiveProcessorMask: *mut u8,
+        dwNumberOfProcessors: u32,
+        dwProcessorType: u32,
+        dwAllocationGranularity: u32,
+        wProcessorLevel: u16,
+        wProcessorRevision: u16,
+    }
+
+    extern "system" {
+        fn GetSystemInfo(lpSystemInfo: *mut SYSTEM_INFO);
+    }
+
+    unsafe {
+        let mut sysinfo: SYSTEM_INFO = std::mem::uninitialized();
+        GetSystemInfo(&mut sysinfo);
+        sysinfo.dwNumberOfProcessors as usize
+    }
+}
+
+#[cfg(any(target_os = "freebsd",
+          target_os = "dragonfly",
+          target_os = "bitrig",
+          target_os = "netbsd"))]
+fn get_num_cpus() -> usize {
+    let mut cpus: libc::c_uint = 0;
+    let mut cpus_size = std::mem::size_of_val(&cpus);
+
+    unsafe {
+        cpus = libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as libc::c_uint;
+    }
+    if cpus < 1 {
+        let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0];
+        unsafe {
+            libc::sysctl(mib.as_mut_ptr(),
+                         2,
+                         &mut cpus as *mut _ as *mut _,
+                         &mut cpus_size as *mut _ as *mut _,
+                         0 as *mut _,
+                         0);
+        }
+        if cpus < 1 {
+            cpus = 1;
+        }
+    }
+    cpus as usize
+}
+
+#[cfg(target_os = "openbsd")]
+fn get_num_cpus() -> usize {
+    let mut cpus: libc::c_uint = 0;
+    let mut cpus_size = std::mem::size_of_val(&cpus);
+    let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0];
+
+    unsafe {
+        libc::sysctl(mib.as_mut_ptr(),
+                     2,
+                     &mut cpus as *mut _ as *mut _,
+                     &mut cpus_size as *mut _ as *mut _,
+                     0 as *mut _,
+                     0);
+    }
+    if cpus < 1 {
+        cpus = 1;
+    }
+    cpus as usize
+}
+
+#[cfg(target_os = "linux")]
+fn get_num_cpus() -> usize {
+    let mut set:  libc::cpu_set_t = unsafe { std::mem::zeroed() };
+    if unsafe { libc::sched_getaffinity(0, std::mem::size_of::<libc::cpu_set_t>(), &mut set) } == 0 {
+        let mut count: u32 = 0;
+        for i in 0..libc::CPU_SETSIZE as usize {
+            if unsafe { libc::CPU_ISSET(i, &set) } {
+                count += 1
+            }
+        }
+        count as usize
+    } else {
+        let cpus = unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) };
+        if cpus < 1 {
+            1
+        } else {
+            cpus as usize
+        }
+    }
+}
+
+#[cfg(any(
+    target_os = "nacl",
+    target_os = "macos",
+    target_os = "ios",
+    target_os = "android",
+    target_os = "solaris",
+    target_os = "fuchsia")
+)]
+fn get_num_cpus() -> usize {
+    let cpus = unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) };
+    if cpus < 1 {
+        1
+    } else {
+        cpus as usize
+    }
+}
+
+#[cfg(any(target_os = "emscripten", target_os = "redox", target_os = "haiku"))]
+fn get_num_cpus() -> usize {
+    1
+}
+
+#[cfg(test)]
+mod tests {
+    fn env_var(name: &'static str) -> Option<usize> {
+        ::std::env::var(name).ok().map(|val| val.parse().unwrap())
+    }
+
+    #[test]
+    fn test_get() {
+        let num = super::get();
+        if let Some(n) = env_var("NUM_CPUS_TEST_GET") {
+            assert_eq!(num, n);
+        } else {
+            assert!(num > 0);
+            assert!(num < 236_451);
+        }
+    }
+
+    #[test]
+    fn test_get_physical() {
+        let num = super::get_physical();
+        if let Some(n) = env_var("NUM_CPUS_TEST_GET_PHYSICAL") {
+            assert_eq!(num, n);
+        } else {
+            assert!(num > 0);
+            assert!(num < 236_451);
+        }
+    }
+}
--- a/third_party/rust/num_cpus/.cargo-checksum.json
+++ b/third_party/rust/num_cpus/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".appveyor.yml":"2f3f82a91e82a6c0b601048a5c9cd9b39fa78dfb7172ecfe7ff3d4d010af66d8",".travis.yml":"979eec484d5ceb95a6553860cafa053694613fbafda322e6d159cfab261d99a0","Cargo.toml":"06c4215944a3f040dd2d10a724c5926f30b186cb6835fba7b6dab6930c456d78","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0593d22d122d4bfec6407115e3907546312976f75473417aaa4c57ecd2095ae6","README.md":"4d586d8185ea43e6472db25ad748da265024869eabdcd62805c2bf3de06c4eb4","src/lib.rs":"295224974716d3ac2cd3d9f65764bae2ec92d94c01f939f62cf3b00974bb3e63"},"package":"83df569ffd47dbf87f36bead512632f89e90882b8e7a14286d0471daf6b72de9"}
\ No newline at end of file
+{"files":{".appveyor.yml":"2f3f82a91e82a6c0b601048a5c9cd9b39fa78dfb7172ecfe7ff3d4d010af66d8",".travis.yml":"979eec484d5ceb95a6553860cafa053694613fbafda322e6d159cfab261d99a0","Cargo.toml":"64af5f893e89e09be28f21857fb4238ddc63cf12f012a6f59c1a404db3f96284","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0593d22d122d4bfec6407115e3907546312976f75473417aaa4c57ecd2095ae6","README.md":"4d586d8185ea43e6472db25ad748da265024869eabdcd62805c2bf3de06c4eb4","src/lib.rs":"295224974716d3ac2cd3d9f65764bae2ec92d94c01f939f62cf3b00974bb3e63"},"package":"aec53c34f2d0247c5ca5d32cca1478762f301740468ee9ee6dcb7a0dd7a0c584"}
\ No newline at end of file
--- a/third_party/rust/num_cpus/Cargo.toml
+++ b/third_party/rust/num_cpus/Cargo.toml
@@ -7,17 +7,17 @@
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
 name = "num_cpus"
-version = "1.6.0"
+version = "1.6.2"
 authors = ["Sean McArthur <sean.monstar@gmail.com>"]
 description = "Get the number of CPUs on a machine."
 documentation = "https://docs.rs/num_cpus"
 keywords = ["cpu", "cpus", "cores"]
 categories = ["hardware-support"]
 license = "MIT/Apache-2.0"
 repository = "https://github.com/seanmonstar/num_cpus"
 [dependencies.libc]
copy from third_party/rust/redox_syscall/.cargo-checksum.json
copy to third_party/rust/redox_syscall-0.1.16/.cargo-checksum.json
copy from third_party/rust/redox_syscall/Cargo.toml
copy to third_party/rust/redox_syscall-0.1.16/Cargo.toml
copy from third_party/rust/redox_syscall/src/arch/arm.rs
copy to third_party/rust/redox_syscall-0.1.16/src/arch/arm.rs
copy from third_party/rust/redox_syscall/src/arch/x86.rs
copy to third_party/rust/redox_syscall-0.1.16/src/arch/x86.rs
copy from third_party/rust/redox_syscall/src/arch/x86_64.rs
copy to third_party/rust/redox_syscall-0.1.16/src/arch/x86_64.rs
copy from third_party/rust/redox_syscall/src/call.rs
copy to third_party/rust/redox_syscall-0.1.16/src/call.rs
copy from third_party/rust/redox_syscall/src/data.rs
copy to third_party/rust/redox_syscall-0.1.16/src/data.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall-0.1.16/src/error.rs
@@ -0,0 +1,315 @@
+use core::{fmt, result};
+
+#[derive(Eq, PartialEq)]
+pub struct Error {
+    pub errno: i32,
+}
+
+pub type Result<T> = result::Result<T, Error>;
+
+impl Error {
+    pub fn new(errno: i32) -> Error {
+        Error { errno: errno }
+    }
+
+    pub fn mux(result: Result<usize>) -> usize {
+        match result {
+            Ok(value) => value,
+            Err(error) => -error.errno as usize,
+        }
+    }
+
+    pub fn demux(value: usize) -> Result<usize> {
+        let errno = -(value as i32);
+        if errno >= 1 && errno < STR_ERROR.len() as i32 {
+            Err(Error::new(errno))
+        } else {
+            Ok(value)
+        }
+    }
+
+    pub fn text(&self) -> &str {
+        if let Some(description) = STR_ERROR.get(self.errno as usize) {
+            description
+        } else {
+            "Unknown Error"
+        }
+    }
+}
+
+impl fmt::Debug for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
+        f.write_str(self.text())
+    }
+}
+
+impl fmt::Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
+        f.write_str(self.text())
+    }
+}
+
+pub const EPERM: i32 = 1;  /* Operation not permitted */
+pub const ENOENT: i32 = 2;  /* No such file or directory */
+pub const ESRCH: i32 = 3;  /* No such process */
+pub const EINTR: i32 = 4;  /* Interrupted system call */
+pub const EIO: i32 = 5;  /* I/O error */
+pub const ENXIO: i32 = 6;  /* No such device or address */
+pub const E2BIG: i32 = 7;  /* Argument list too long */
+pub const ENOEXEC: i32 = 8;  /* Exec format error */
+pub const EBADF: i32 = 9;  /* Bad file number */
+pub const ECHILD: i32 = 10;  /* No child processes */
+pub const EAGAIN: i32 = 11;  /* Try again */
+pub const ENOMEM: i32 = 12;  /* Out of memory */
+pub const EACCES: i32 = 13;  /* Permission denied */
+pub const EFAULT: i32 = 14;  /* Bad address */
+pub const ENOTBLK: i32 = 15;  /* Block device required */
+pub const EBUSY: i32 = 16;  /* Device or resource busy */
+pub const EEXIST: i32 = 17;  /* File exists */
+pub const EXDEV: i32 = 18;  /* Cross-device link */
+pub const ENODEV: i32 = 19;  /* No such device */
+pub const ENOTDIR: i32 = 20;  /* Not a directory */
+pub const EISDIR: i32 = 21;  /* Is a directory */
+pub const EINVAL: i32 = 22;  /* Invalid argument */
+pub const ENFILE: i32 = 23;  /* File table overflow */
+pub const EMFILE: i32 = 24;  /* Too many open files */
+pub const ENOTTY: i32 = 25;  /* Not a typewriter */
+pub const ETXTBSY: i32 = 26;  /* Text file busy */
+pub const EFBIG: i32 = 27;  /* File too large */
+pub const ENOSPC: i32 = 28;  /* No space left on device */
+pub const ESPIPE: i32 = 29;  /* Illegal seek */
+pub const EROFS: i32 = 30;  /* Read-only file system */
+pub const EMLINK: i32 = 31;  /* Too many links */
+pub const EPIPE: i32 = 32;  /* Broken pipe */
+pub const EDOM: i32 = 33;  /* Math argument out of domain of func */
+pub const ERANGE: i32 = 34;  /* Math result not representable */
+pub const EDEADLK: i32 = 35;  /* Resource deadlock would occur */
+pub const ENAMETOOLONG: i32 = 36;  /* File name too long */
+pub const ENOLCK: i32 = 37;  /* No record locks available */
+pub const ENOSYS: i32 = 38;  /* Function not implemented */
+pub const ENOTEMPTY: i32 = 39;  /* Directory not empty */
+pub const ELOOP: i32 = 40;  /* Too many symbolic links encountered */
+pub const EWOULDBLOCK: i32 = 41;  /* Operation would block */
+pub const ENOMSG: i32 = 42;  /* No message of desired type */
+pub const EIDRM: i32 = 43;  /* Identifier removed */
+pub const ECHRNG: i32 = 44;  /* Channel number out of range */
+pub const EL2NSYNC: i32 = 45;  /* Level 2 not synchronized */
+pub const EL3HLT: i32 = 46;  /* Level 3 halted */
+pub const EL3RST: i32 = 47;  /* Level 3 reset */
+pub const ELNRNG: i32 = 48;  /* Link number out of range */
+pub const EUNATCH: i32 = 49;  /* Protocol driver not attached */
+pub const ENOCSI: i32 = 50;  /* No CSI structure available */
+pub const EL2HLT: i32 = 51;  /* Level 2 halted */
+pub const EBADE: i32 = 52;  /* Invalid exchange */
+pub const EBADR: i32 = 53;  /* Invalid request descriptor */
+pub const EXFULL: i32 = 54;  /* Exchange full */
+pub const ENOANO: i32 = 55;  /* No anode */
+pub const EBADRQC: i32 = 56;  /* Invalid request code */
+pub const EBADSLT: i32 = 57;  /* Invalid slot */
+pub const EDEADLOCK: i32 = 58; /* Resource deadlock would occur */
+pub const EBFONT: i32 = 59;  /* Bad font file format */
+pub const ENOSTR: i32 = 60;  /* Device not a stream */
+pub const ENODATA: i32 = 61;  /* No data available */
+pub const ETIME: i32 = 62;  /* Timer expired */
+pub const ENOSR: i32 = 63;  /* Out of streams resources */
+pub const ENONET: i32 = 64;  /* Machine is not on the network */
+pub const ENOPKG: i32 = 65;  /* Package not installed */
+pub const EREMOTE: i32 = 66;  /* Object is remote */
+pub const ENOLINK: i32 = 67;  /* Link has been severed */
+pub const EADV: i32 = 68;  /* Advertise error */
+pub const ESRMNT: i32 = 69;  /* Srmount error */
+pub const ECOMM: i32 = 70;  /* Communication error on send */
+pub const EPROTO: i32 = 71;  /* Protocol error */
+pub const EMULTIHOP: i32 = 72;  /* Multihop attempted */
+pub const EDOTDOT: i32 = 73;  /* RFS specific error */
+pub const EBADMSG: i32 = 74;  /* Not a data message */
+pub const EOVERFLOW: i32 = 75;  /* Value too large for defined data type */
+pub const ENOTUNIQ: i32 = 76;  /* Name not unique on network */
+pub const EBADFD: i32 = 77;  /* File descriptor in bad state */
+pub const EREMCHG: i32 = 78;  /* Remote address changed */
+pub const ELIBACC: i32 = 79;  /* Can not access a needed shared library */
+pub const ELIBBAD: i32 = 80;  /* Accessing a corrupted shared library */
+pub const ELIBSCN: i32 = 81;  /* .lib section in a.out corrupted */
+pub const ELIBMAX: i32 = 82;  /* Attempting to link in too many shared libraries */
+pub const ELIBEXEC: i32 = 83;  /* Cannot exec a shared library directly */
+pub const EILSEQ: i32 = 84;  /* Illegal byte sequence */
+pub const ERESTART: i32 = 85;  /* Interrupted system call should be restarted */
+pub const ESTRPIPE: i32 = 86;  /* Streams pipe error */
+pub const EUSERS: i32 = 87;  /* Too many users */
+pub const ENOTSOCK: i32 = 88;  /* Socket operation on non-socket */
+pub const EDESTADDRREQ: i32 = 89;  /* Destination address required */
+pub const EMSGSIZE: i32 = 90;  /* Message too long */
+pub const EPROTOTYPE: i32 = 91;  /* Protocol wrong type for socket */
+pub const ENOPROTOOPT: i32 = 92;  /* Protocol not available */
+pub const EPROTONOSUPPORT: i32 = 93;  /* Protocol not supported */
+pub const ESOCKTNOSUPPORT: i32 = 94;  /* Socket type not supported */
+pub const EOPNOTSUPP: i32 = 95;  /* Operation not supported on transport endpoint */
+pub const EPFNOSUPPORT: i32 = 96;  /* Protocol family not supported */
+pub const EAFNOSUPPORT: i32 = 97;  /* Address family not supported by protocol */
+pub const EADDRINUSE: i32 = 98;  /* Address already in use */
+pub const EADDRNOTAVAIL: i32 = 99;  /* Cannot assign requested address */
+pub const ENETDOWN: i32 = 100; /* Network is down */
+pub const ENETUNREACH: i32 = 101; /* Network is unreachable */
+pub const ENETRESET: i32 = 102; /* Network dropped connection because of reset */
+pub const ECONNABORTED: i32 = 103; /* Software caused connection abort */
+pub const ECONNRESET: i32 = 104; /* Connection reset by peer */
+pub const ENOBUFS: i32 = 105; /* No buffer space available */
+pub const EISCONN: i32 = 106; /* Transport endpoint is already connected */
+pub const ENOTCONN: i32 = 107; /* Transport endpoint is not connected */
+pub const ESHUTDOWN: i32 = 108; /* Cannot send after transport endpoint shutdown */
+pub const ETOOMANYREFS: i32 = 109; /* Too many references: cannot splice */
+pub const ETIMEDOUT: i32 = 110; /* Connection timed out */
+pub const ECONNREFUSED: i32 = 111; /* Connection refused */
+pub const EHOSTDOWN: i32 = 112; /* Host is down */
+pub const EHOSTUNREACH: i32 = 113; /* No route to host */
+pub const EALREADY: i32 = 114; /* Operation already in progress */
+pub const EINPROGRESS: i32 = 115; /* Operation now in progress */
+pub const ESTALE: i32 = 116; /* Stale NFS file handle */
+pub const EUCLEAN: i32 = 117; /* Structure needs cleaning */
+pub const ENOTNAM: i32 = 118; /* Not a XENIX named type file */
+pub const ENAVAIL: i32 = 119; /* No XENIX semaphores available */
+pub const EISNAM: i32 = 120; /* Is a named type file */
+pub const EREMOTEIO: i32 = 121; /* Remote I/O error */
+pub const EDQUOT: i32 = 122; /* Quota exceeded */
+pub const ENOMEDIUM: i32 = 123; /* No medium found */
+pub const EMEDIUMTYPE: i32 = 124; /* Wrong medium type */
+pub const ECANCELED: i32 = 125; /* Operation Canceled */
+pub const ENOKEY: i32 = 126; /* Required key not available */
+pub const EKEYEXPIRED: i32 = 127; /* Key has expired */
+pub const EKEYREVOKED: i32 = 128; /* Key has been revoked */
+pub const EKEYREJECTED: i32 = 129; /* Key was rejected by service */
+pub const EOWNERDEAD: i32 = 130; /* Owner died */
+pub const ENOTRECOVERABLE: i32 = 131; /* State not recoverable */
+
+pub static STR_ERROR: [&'static str; 132] = ["Success",
+                                             "Operation not permitted",
+                                             "No such file or directory",
+                                             "No such process",
+                                             "Interrupted system call",
+                                             "I/O error",
+                                             "No such device or address",
+                                             "Argument list too long",
+                                             "Exec format error",
+                                             "Bad file number",
+                                             "No child processes",
+                                             "Try again",
+                                             "Out of memory",
+                                             "Permission denied",
+                                             "Bad address",
+                                             "Block device required",
+                                             "Device or resource busy",
+                                             "File exists",
+                                             "Cross-device link",
+                                             "No such device",
+                                             "Not a directory",
+                                             "Is a directory",
+                                             "Invalid argument",
+                                             "File table overflow",
+                                             "Too many open files",
+                                             "Not a typewriter",
+                                             "Text file busy",
+                                             "File too large",
+                                             "No space left on device",
+                                             "Illegal seek",
+                                             "Read-only file system",
+                                             "Too many links",
+                                             "Broken pipe",
+                                             "Math argument out of domain of func",
+                                             "Math result not representable",
+                                             "Resource deadlock would occur",
+                                             "File name too long",
+                                             "No record locks available",
+                                             "Function not implemented",
+                                             "Directory not empty",
+                                             "Too many symbolic links encountered",
+                                             "Operation would block",
+                                             "No message of desired type",
+                                             "Identifier removed",
+                                             "Channel number out of range",
+                                             "Level 2 not synchronized",
+                                             "Level 3 halted",
+                                             "Level 3 reset",
+                                             "Link number out of range",
+                                             "Protocol driver not attached",
+                                             "No CSI structure available",
+                                             "Level 2 halted",
+                                             "Invalid exchange",
+                                             "Invalid request descriptor",
+                                             "Exchange full",
+                                             "No anode",
+                                             "Invalid request code",
+                                             "Invalid slot",
+                                             "Resource deadlock would occur",
+                                             "Bad font file format",
+                                             "Device not a stream",
+                                             "No data available",
+                                             "Timer expired",
+                                             "Out of streams resources",
+                                             "Machine is not on the network",
+                                             "Package not installed",
+                                             "Object is remote",
+                                             "Link has been severed",
+                                             "Advertise error",
+                                             "Srmount error",
+                                             "Communication error on send",
+                                             "Protocol error",
+                                             "Multihop attempted",
+                                             "RFS specific error",
+                                             "Not a data message",
+                                             "Value too large for defined data type",
+                                             "Name not unique on network",
+                                             "File descriptor in bad state",
+                                             "Remote address changed",
+                                             "Can not access a needed shared library",
+                                             "Accessing a corrupted shared library",
+                                             ".lib section in a.out corrupted",
+                                             "Attempting to link in too many shared libraries",
+                                             "Cannot exec a shared library directly",
+                                             "Illegal byte sequence",
+                                             "Interrupted system call should be restarted",
+                                             "Streams pipe error",
+                                             "Too many users",
+                                             "Socket operation on non-socket",
+                                             "Destination address required",
+                                             "Message too long",
+                                             "Protocol wrong type for socket",
+                                             "Protocol not available",
+                                             "Protocol not supported",
+                                             "Socket type not supported",
+                                             "Operation not supported on transport endpoint",
+                                             "Protocol family not supported",
+                                             "Address family not supported by protocol",
+                                             "Address already in use",
+                                             "Cannot assign requested address",
+                                             "Network is down",
+                                             "Network is unreachable",
+                                             "Network dropped connection because of reset",
+                                             "Software caused connection abort",
+                                             "Connection reset by peer",
+                                             "No buffer space available",
+                                             "Transport endpoint is already connected",
+                                             "Transport endpoint is not connected",
+                                             "Cannot send after transport endpoint shutdown",
+                                             "Too many references: cannot splice",
+                                             "Connection timed out",
+                                             "Connection refused",
+                                             "Host is down",
+                                             "No route to host",
+                                             "Operation already in progress",
+                                             "Operation now in progress",
+                                             "Stale NFS file handle",
+                                             "Structure needs cleaning",
+                                             "Not a XENIX named type file",
+                                             "No XENIX semaphores available",
+                                             "Is a named type file",
+                                             "Remote I/O error",
+                                             "Quota exceeded",
+                                             "No medium found",
+                                             "Wrong medium type",
+                                             "Operation Canceled",
+                                             "Required key not available",
+                                             "Key has expired",
+                                             "Key has been revoked",
+                                             "Key was rejected by service",
+                                             "Owner died",
+                                             "State not recoverable"];
copy from third_party/rust/redox_syscall/src/flag.rs
copy to third_party/rust/redox_syscall-0.1.16/src/flag.rs
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall-0.1.16/src/io/dma.rs
@@ -0,0 +1,76 @@
+use core::{mem, ptr};
+use core::ops::{Deref, DerefMut};
+
+use Result;
+
+struct PhysBox {
+    address: usize,
+    size: usize
+}
+
+impl PhysBox {
+    fn new(size: usize) -> Result<PhysBox> {
+        let address = unsafe { ::physalloc(size)? };
+        Ok(PhysBox {
+            address: address,
+            size: size
+        })
+    }
+}
+
+impl Drop for PhysBox {
+    fn drop(&mut self) {
+        let _ = unsafe { ::physfree(self.address, self.size) };
+    }
+}
+
+pub struct Dma<T> {
+    phys: PhysBox,
+    virt: *mut T
+}
+
+impl<T> Dma<T> {
+    pub fn new(value: T) -> Result<Dma<T>> {
+        let phys = PhysBox::new(mem::size_of::<T>())?;
+        let virt = unsafe { ::physmap(phys.address, phys.size, ::MAP_WRITE)? } as *mut T;
+        unsafe { ptr::write(virt, value); }
+        Ok(Dma {
+            phys: phys,
+            virt: virt
+        })
+    }
+
+    pub fn zeroed() -> Result<Dma<T>> {
+        let phys = PhysBox::new(mem::size_of::<T>())?;
+        let virt = unsafe { ::physmap(phys.address, phys.size, ::MAP_WRITE)? } as *mut T;
+        unsafe { ptr::write_bytes(virt as *mut u8, 0, phys.size); }
+        Ok(Dma {
+            phys: phys,
+            virt: virt
+        })
+    }
+
+    pub fn physical(&self) -> usize {
+        self.phys.address
+    }
+}
+
+impl<T> Deref for Dma<T> {
+    type Target = T;
+    fn deref(&self) -> &T {
+        unsafe { &*self.virt }
+    }
+}
+
+impl<T> DerefMut for Dma<T> {
+    fn deref_mut(&mut self) -> &mut T {
+        unsafe { &mut *self.virt }
+    }
+}
+
+impl<T> Drop for Dma<T> {
+    fn drop(&mut self) {
+        unsafe { drop(ptr::read(self.virt)); }
+        let _ = unsafe { ::physunmap(self.virt as usize) };
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall-0.1.16/src/io/io.rs
@@ -0,0 +1,67 @@
+use core::cmp::PartialEq;
+use core::ops::{BitAnd, BitOr, Not};
+
+pub trait Io {
+    type Value: Copy + PartialEq + BitAnd<Output = Self::Value> + BitOr<Output = Self::Value> + Not<Output = Self::Value>;
+
+    fn read(&self) -> Self::Value;
+    fn write(&mut self, value: Self::Value);
+
+    #[inline(always)]
+    fn readf(&self, flags: Self::Value) -> bool  {
+        (self.read() & flags) as Self::Value == flags
+    }
+
+    #[inline(always)]
+    fn writef(&mut self, flags: Self::Value, value: bool) {
+        let tmp: Self::Value = match value {
+            true => self.read() | flags,
+            false => self.read() & !flags,
+        };
+        self.write(tmp);
+    }
+}
+
+pub struct ReadOnly<I: Io> {
+    inner: I
+}
+
+impl<I: Io> ReadOnly<I> {
+    pub const fn new(inner: I) -> ReadOnly<I> {
+        ReadOnly {
+            inner: inner
+        }
+    }
+
+    #[inline(always)]
+    pub fn read(&self) -> I::Value {
+        self.inner.read()
+    }
+
+    #[inline(always)]
+    pub fn readf(&self, flags: I::Value) -> bool {
+        self.inner.readf(flags)
+    }
+}
+
+pub struct WriteOnly<I: Io> {
+    inner: I
+}
+
+impl<I: Io> WriteOnly<I> {
+    pub const fn new(inner: I) -> WriteOnly<I> {
+        WriteOnly {
+            inner: inner
+        }
+    }
+
+    #[inline(always)]
+    pub fn write(&mut self, value: I::Value) {
+        self.inner.write(value)
+    }
+
+    #[inline(always)]
+    pub fn writef(&mut self, flags: I::Value, value: bool) {
+        self.inner.writef(flags, value)
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall-0.1.16/src/io/mmio.rs
@@ -0,0 +1,31 @@
+use core::intrinsics::{volatile_load, volatile_store};
+use core::mem::uninitialized;
+use core::ops::{BitAnd, BitOr, Not};
+
+use super::io::Io;
+
+#[repr(packed)]
+pub struct Mmio<T> {
+    value: T,
+}
+
+impl<T> Mmio<T> {
+    /// Create a new Mmio without initializing
+    pub fn new() -> Self {
+        Mmio {
+            value: unsafe { uninitialized() }
+        }
+    }
+}
+
+impl<T> Io for Mmio<T> where T: Copy + PartialEq + BitAnd<Output = T> + BitOr<Output = T> + Not<Output = T> {
+    type Value = T;
+
+    fn read(&self) -> T {
+        unsafe { volatile_load(&self.value) }
+    }
+
+    fn write(&mut self, value: T) {
+        unsafe { volatile_store(&mut self.value, value) };
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall-0.1.16/src/io/mod.rs
@@ -0,0 +1,11 @@
+//! I/O functions
+
+pub use self::dma::*;
+pub use self::io::*;
+pub use self::mmio::*;
+pub use self::pio::*;
+
+mod dma;
+mod io;
+mod mmio;
+mod pio;
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall-0.1.16/src/io/pio.rs
@@ -0,0 +1,89 @@
+use core::marker::PhantomData;
+
+use super::io::Io;
+
+/// Generic PIO
+#[derive(Copy, Clone)]
+pub struct Pio<T> {
+    port: u16,
+    value: PhantomData<T>,
+}
+
+impl<T> Pio<T> {
+    /// Create a PIO from a given port
+    pub const fn new(port: u16) -> Self {
+        Pio::<T> {
+            port: port,
+            value: PhantomData,
+        }
+    }
+}
+
+/// Read/Write for byte PIO
+impl Io for Pio<u8> {
+    type Value = u8;
+
+    /// Read
+    #[inline(always)]
+    fn read(&self) -> u8 {
+        let value: u8;
+        unsafe {
+            asm!("in $0, $1" : "={al}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
+        }
+        value
+    }
+
+    /// Write
+    #[inline(always)]
+    fn write(&mut self, value: u8) {
+        unsafe {
+            asm!("out $1, $0" : : "{al}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
+        }
+    }
+}
+
+/// Read/Write for word PIO
+impl Io for Pio<u16> {
+    type Value = u16;
+
+    /// Read
+    #[inline(always)]
+    fn read(&self) -> u16 {
+        let value: u16;
+        unsafe {
+            asm!("in $0, $1" : "={ax}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
+        }
+        value
+    }
+
+    /// Write
+    #[inline(always)]
+    fn write(&mut self, value: u16) {
+        unsafe {
+            asm!("out $1, $0" : : "{ax}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
+        }
+    }
+}
+
+/// Read/Write for doubleword PIO
+impl Io for Pio<u32> {
+    type Value = u32;
+
+    /// Read
+    #[inline(always)]
+    fn read(&self) -> u32 {
+        let value: u32;
+        unsafe {
+            asm!("in $0, $1" : "={eax}"(value) : "{dx}"(self.port) : "memory" : "intel", "volatile");
+        }
+        value
+    }
+
+    /// Write
+    #[inline(always)]
+    fn write(&mut self, value: u32) {
+        unsafe {
+            asm!("out $1, $0" : : "{eax}"(value), "{dx}"(self.port) : "memory" : "intel", "volatile");
+        }
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall-0.1.16/src/lib.rs
@@ -0,0 +1,47 @@
+#![deny(warnings)]
+#![feature(asm)]
+#![feature(const_fn)]
+#![feature(core_intrinsics)]
+#![no_std]
+
+pub use self::arch::*;
+pub use self::call::*;
+pub use self::data::*;
+pub use self::error::*;
+pub use self::flag::*;
+pub use self::io::*;
+pub use self::number::*;
+pub use self::scheme::*;
+
+#[cfg(target_arch = "arm")]
+#[path="arch/arm.rs"]
+mod arch;
+
+#[cfg(target_arch = "x86")]
+#[path="arch/x86.rs"]
+mod arch;
+
+#[cfg(target_arch = "x86_64")]
+#[path="arch/x86_64.rs"]
+mod arch;
+
+/// Function definitions
+pub mod call;
+
+/// Complex structures that are used for some system calls
+pub mod data;
+
+/// All errors that can be generated by a system call
+pub mod error;
+
+/// Flags used as an argument to many system calls
+pub mod flag;
+
+/// Functions for low level hardware control
+pub mod io;
+
+/// Call numbers used by each system call
+pub mod number;
+
+/// A trait useful for scheme handlers
+pub mod scheme;
copy from third_party/rust/redox_syscall/src/number.rs
copy to third_party/rust/redox_syscall-0.1.16/src/number.rs
copy from third_party/rust/redox_syscall/src/scheme.rs
copy to third_party/rust/redox_syscall-0.1.16/src/scheme.rs
--- a/third_party/rust/redox_syscall/.cargo-checksum.json
+++ b/third_party/rust/redox_syscall/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{"Cargo.toml":"e1423d4f80dd1b358812a9993312cf6338df844c2b15e423ab779bf914cead14","src/arch/arm.rs":"0cd845b3790f7358b5290b58163ae2663b46b7ecf64eb8c6b0a29b33da6f143c","src/arch/x86.rs":"3fc9757cbb775bd08da9999ab39d95b62b3cb509e0ab309dd26c11c3fbdbc778","src/arch/x86_64.rs":"37bc2c6e74c009ff5f2896b249fac7ddf9f5e30e223a5122a28a93cef5ba33b1","src/call.rs":"7913da5b7d8b11e290d863d6cbca17be20c98bef420ddb964519a9c9cfeff366","src/data.rs":"c3406d581387828b6fb246bea2b57582cef890cedeb2c0e632e472cd3776d884","src/error.rs":"b23c12db8cafb64f3b909a95bdd47cf03f62f6fa1201b40892febf46ec56bcb4","src/flag.rs":"400c91c57b1ab1afd6ab06c0582b1b0817590688900882de31fc3a4aab27da49","src/io/dma.rs":"4ab65016b3bc9121f0844dc4b8de77608eba327c0e0d930900254242b2c204b0","src/io/io.rs":"1bcb36d1867e9bab6a8186cd6928efe70ae2655e9f9d0dd3def20bc0fb6a82f6","src/io/mmio.rs":"bd475c815d483cc2b187348c32e10f94df0ca756ee8d14260b6ca3c660b2a73a","src/io/mod.rs":"4df12af3e82e6b5fe22112c9f51552112ee4811b7d1131d2a43d608d8d1cac09","src/io/pio.rs":"219fcd317d6c490a14794ec4db9de3e305c722dda720043c67076bda60632bb8","src/lib.rs":"988fb0b0bd3b396345f11ef46617072aeaf9307d3fa05a4d2a2ee9d590598bba","src/number.rs":"9043372ef517ecbbca776536efa3d7a822ba6f49d29c20d4c3648f0e3c85fe35","src/scheme.rs":"3281173d9a5d7d420f5dbdaed7562ba5adc1ce5753843a3bf3eecf4060eb09c2"},"package":"8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753"}
\ No newline at end of file
+{"files":{"Cargo.toml":"c725f317bb27871da237c88ca08a137e2dbe1f2864d48ffd9fe65e545cd9207a","LICENSE":"efcfee7981ff72431fffb06925cad00a23dce079ed4354f61030ad5abdb78829","README.md":"f2aabeb00e422ebe0f5ccdde1449fca7e8da5e563fb84024db83742ca12633fc","src/arch/arm.rs":"44ed9097879fce0ebe85d29e25ba378fb3ee7fcd649b569207495ed601c42a1c","src/arch/x86.rs":"e72a7f653c25b1ea5595af7ce991fe0e5c96547e127fc67e4967d60abbe1d3bd","src/arch/x86_64.rs":"499a0c997756c1cac5f4b4b98cff474a4e759695d3664712bd1a92d5d4a4a5f1","src/call.rs":"9b8517947298b82f0ccde0e97288856fee20d484470996d4bd19b725ecb7892b","src/data.rs":"8602d05b437216e6774658902f2d5fb030edc7510754ce7277fd299ab53a6b8b","src/error.rs":"b23c12db8cafb64f3b909a95bdd47cf03f62f6fa1201b40892febf46ec56bcb4","src/flag.rs":"4e10f5aeeba8406d50155332d59f7933c933dd7a03cc0a8316237e389c30e278","src/io/dma.rs":"4ab65016b3bc9121f0844dc4b8de77608eba327c0e0d930900254242b2c204b0","src/io/io.rs":"1bcb36d1867e9bab6a8186cd6928efe70ae2655e9f9d0dd3def20bc0fb6a82f6","src/io/mmio.rs":"bd475c815d483cc2b187348c32e10f94df0ca756ee8d14260b6ca3c660b2a73a","src/io/mod.rs":"4df12af3e82e6b5fe22112c9f51552112ee4811b7d1131d2a43d608d8d1cac09","src/io/pio.rs":"219fcd317d6c490a14794ec4db9de3e305c722dda720043c67076bda60632bb8","src/lib.rs":"988fb0b0bd3b396345f11ef46617072aeaf9307d3fa05a4d2a2ee9d590598bba","src/number.rs":"f9779b8abf0473ffbc81614746eb6ef5648129984a69eb43e4890a5b4c0aaedf","src/scheme.rs":"fe4cfac446eb1951795f588648afa0f6014566a7e2aa423f5f6f1dad45fe8583"},"package":"8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509"}
\ No newline at end of file
--- a/third_party/rust/redox_syscall/Cargo.toml
+++ b/third_party/rust/redox_syscall/Cargo.toml
@@ -1,9 +1,23 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "redox_syscall"
-version = "0.1.16"
+version = "0.1.31"
+authors = ["Jeremy Soller <jackpot51@gmail.com>"]
 description = "A Rust library to access raw Redox system calls"
+documentation = "https://docs.rs/redox_syscall"
 license = "MIT"
-authors = ["Jeremy Soller <jackpot51@gmail.com>"]
+repository = "https://github.com/redox-os/syscall"
 
 [lib]
 name = "syscall"
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2017 Redox OS Developers
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/redox_syscall/README.md
@@ -0,0 +1,7 @@
+[Redox OS][1]'s syscall API
+
+[Documentation][2]
+
+[1]: https://github.com/redox-os/redox
+[2]: https://docs.rs/redox_syscall
+
--- a/third_party/rust/redox_syscall/src/arch/arm.rs
+++ b/third_party/rust/redox_syscall/src/arch/arm.rs
@@ -1,9 +1,9 @@
-use error::{Error, Result};
+use super::error::{Error, Result};
 
 pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
     asm!("swi $$0"
         : "={r0}"(a)
         : "{r7}"(a)
         : "memory"
         : "volatile");
 
@@ -56,17 +56,18 @@ pub unsafe fn syscall4(mut a: usize, b: 
         : "={r0}"(a)
         : "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d), "{r3}"(e)
         : "memory"
         : "volatile");
 
     Error::demux(a)
 }
 
-pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result<usize> {
+pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
+                       -> Result<usize> {
     asm!("swi $$0"
         : "={r0}"(a)
         : "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d), "{r3}"(e), "{r4}"(f)
         : "memory"
         : "volatile");
 
     Error::demux(a)
 }
--- a/third_party/rust/redox_syscall/src/arch/x86.rs
+++ b/third_party/rust/redox_syscall/src/arch/x86.rs
@@ -1,9 +1,9 @@
-use error::{Error, Result};
+use super::error::{Error, Result};
 
 pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
     asm!("int 0x80"
         : "={eax}"(a)
         : "{eax}"(a)
         : "memory"
         : "intel", "volatile");
 
@@ -56,17 +56,18 @@ pub unsafe fn syscall4(mut a: usize, b: 
         : "={eax}"(a)
         : "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d), "{esi}"(e)
         : "memory"
         : "intel", "volatile");
 
     Error::demux(a)
 }
 
-pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result<usize> {
+pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
+                       -> Result<usize> {
     asm!("int 0x80"
         : "={eax}"(a)
         : "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d), "{esi}"(e), "{edi}"(f)
         : "memory"
         : "intel", "volatile");
 
     Error::demux(a)
 }
--- a/third_party/rust/redox_syscall/src/arch/x86_64.rs
+++ b/third_party/rust/redox_syscall/src/arch/x86_64.rs
@@ -1,9 +1,9 @@
-use error::{Error, Result};
+use super::error::{Error, Result};
 
 pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
     asm!("int 0x80"
         : "={rax}"(a)
         : "{rax}"(a)
         : "memory"
         : "intel", "volatile");
 
@@ -20,17 +20,18 @@ pub unsafe fn syscall1(mut a: usize, b: 
     Error::demux(a)
 }
 
 // Clobbers all registers - special for clone
 pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
     asm!("int 0x80"
         : "={rax}"(a)
         : "{rax}"(a), "{rbx}"(b)
-        : "memory", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
+        : "memory", "rbx", "rcx", "rdx", "rsi", "rdi", "r8",
+          "r9", "r10", "r11", "r12", "r13", "r14", "r15"
         : "intel", "volatile");
 
     Error::demux(a)
 }
 
 pub unsafe fn syscall2(mut a: usize, b: usize, c: usize) -> Result<usize> {
     asm!("int 0x80"
         : "={rax}"(a)
@@ -56,17 +57,18 @@ pub unsafe fn syscall4(mut a: usize, b: 
         : "={rax}"(a)
         : "{rax}"(a), "{rbx}"(b), "{rcx}"(c), "{rdx}"(d), "{rsi}"(e)
         : "memory"
         : "intel", "volatile");
 
     Error::demux(a)
 }
 
-pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result<usize> {
+pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
+                       -> Result<usize> {
     asm!("int 0x80"
         : "={rax}"(a)
         : "{rax}"(a), "{rbx}"(b), "{rcx}"(c), "{rdx}"(d), "{rsi}"(e), "{rdi}"(f)
         : "memory"
         : "intel", "volatile");
 
     Error::demux(a)
 }
--- a/third_party/rust/redox_syscall/src/call.rs
+++ b/third_party/rust/redox_syscall/src/call.rs
@@ -1,14 +1,20 @@
 use super::arch::*;
-use super::data::{Stat, StatVfs, TimeSpec};
+use super::data::{SigAction, Stat, StatVfs, TimeSpec};
 use super::error::Result;
 use super::number::*;
 
-use core::mem;
+use core::{mem, ptr};
+
+// Signal restorer
+extern "C" fn restorer() -> ! {
+    sigreturn().unwrap();
+    unreachable!();
+}
 
 /// Set the end of the process's heap
 ///
 /// When `addr` is `0`, this function will return the current break.
 ///
 /// When `addr` is nonzero, this function will attempt to set the end of the process's
 /// heap to `addr` and return the new program break. The new program break should be
 /// checked by the allocator, it may not be exactly `addr`, as it may be aligned to a page
@@ -25,25 +31,25 @@ pub unsafe fn brk(addr: usize) -> Result
 /// either a relative, scheme relative, or absolute path.
 ///
 /// On success, `Ok(0)` will be returned. On error, one of the following errors will be returned.
 ///
 /// # Errors
 ///
 /// * `EACCES` - permission is denied for one of the components of `path`, or `path`
 /// * `EFAULT` - `path` does not point to the process's addressible memory
-/// * `EIO` - an I/O error occured
+/// * `EIO` - an I/O error occurred
 /// * `ENOENT` - `path` does not exit
 /// * `ENOTDIR` - `path` is not a directory
-pub fn chdir(path: &str) -> Result<usize> {
-    unsafe { syscall2(SYS_CHDIR, path.as_ptr() as usize, path.len()) }
+pub fn chdir<T: AsRef<[u8]>>(path: T) -> Result<usize> {
+    unsafe { syscall2(SYS_CHDIR, path.as_ref().as_ptr() as usize, path.as_ref().len()) }
 }
 
-pub fn chmod(path: &str, mode: usize) -> Result<usize> {
-    unsafe { syscall3(SYS_CHMOD, path.as_ptr() as usize, path.len(), mode) }
+pub fn chmod<T: AsRef<[u8]>>(path: T, mode: usize) -> Result<usize> {
+    unsafe { syscall3(SYS_CHMOD, path.as_ref().as_ptr() as usize, path.as_ref().len(), mode) }
 }
 
 /// Produce a fork of the current process, or a new process thread
 pub unsafe fn clone(flags: usize) -> Result<usize> {
     syscall1_clobber(SYS_CLONE, flags)
 }
 
 /// Close a file
@@ -62,18 +68,19 @@ pub fn dup(fd: usize, buf: &[u8]) -> Res
 }
 
 /// Copy and transform a file descriptor
 pub fn dup2(fd: usize, newfd: usize, buf: &[u8]) -> Result<usize> {
     unsafe { syscall4(SYS_DUP2, fd, newfd, buf.as_ptr() as usize, buf.len()) }
 }
 
 /// Replace the current process with a new executable
-pub fn execve(path: &str, args: &[[usize; 2]]) -> Result<usize> {
-    unsafe { syscall4(SYS_EXECVE, path.as_ptr() as usize, path.len(), args.as_ptr() as usize, args.len()) }
+pub fn execve<T: AsRef<[u8]>>(path: T, args: &[[usize; 2]]) -> Result<usize> {
+    unsafe { syscall4(SYS_EXECVE, path.as_ref().as_ptr() as usize,
+                      path.as_ref().len(), args.as_ptr() as usize, args.len()) }
 }
 
 /// Exit the current process
 pub fn exit(status: usize) -> Result<usize> {
     unsafe { syscall1(SYS_EXIT, status) }
 }
 
 /// Register a file for event-based I/O
@@ -116,18 +123,24 @@ pub fn fsync(fd: usize) -> Result<usize>
     unsafe { syscall1(SYS_FSYNC, fd) }
 }
 
 /// Truncate or extend a file to a specified length
 pub fn ftruncate(fd: usize, len: usize) -> Result<usize> {
     unsafe { syscall2(SYS_FTRUNCATE, fd, len) }
 }
 
-/// Fast userspace mutex - TODO: Document
-pub unsafe fn futex(addr: *mut i32, op: usize, val: i32, val2: usize, addr2: *mut i32) -> Result<usize> {
+// Change modify and/or access times
+pub fn futimens(fd: usize, times: &[TimeSpec]) -> Result<usize> {
+    unsafe { syscall3(SYS_FUTIMENS, fd, times.as_ptr() as usize, times.len() * mem::size_of::<TimeSpec>()) }
+}
+
+/// Fast userspace mutex
+pub unsafe fn futex(addr: *mut i32, op: usize, val: i32, val2: usize, addr2: *mut i32)
+                    -> Result<usize> {
     syscall5(SYS_FUTEX, addr as usize, op, (val as isize) as usize, val2, addr2 as usize)
 }
 
 /// Get the current working directory
 pub fn getcwd(buf: &mut [u8]) -> Result<usize> {
     unsafe { syscall2(SYS_GETCWD, buf.as_mut_ptr() as usize, buf.len()) }
 }
 
@@ -156,16 +169,26 @@ pub fn getns() -> Result<usize> {
     unsafe { syscall0(SYS_GETNS) }
 }
 
 /// Get the current process ID
 pub fn getpid() -> Result<usize> {
     unsafe { syscall0(SYS_GETPID) }
 }
 
+/// Get the process group ID
+pub fn getpgid(pid: usize) -> Result<usize> {
+    unsafe { syscall1(SYS_GETPGID, pid) }
+}
+
+/// Get the parent process ID
+pub fn getppid() -> Result<usize> {
+    unsafe { syscall0(SYS_GETPPID) }
+}
+
 /// Get the current user ID
 pub fn getuid() -> Result<usize> {
     unsafe { syscall0(SYS_GETUID) }
 }
 
 /// Set the I/O privilege level
 pub unsafe fn iopl(level: usize) -> Result<usize> {
     syscall1(SYS_IOPL, level)
@@ -188,22 +211,23 @@ pub fn lseek(fd: usize, offset: isize, w
 
 /// Make a new scheme namespace
 pub fn mkns(schemes: &[[usize; 2]]) -> Result<usize> {
     unsafe { syscall2(SYS_MKNS, schemes.as_ptr() as usize, schemes.len()) }
 }
 
 /// Sleep for the time specified in `req`
 pub fn nanosleep(req: &TimeSpec, rem: &mut TimeSpec) -> Result<usize> {
-    unsafe { syscall2(SYS_NANOSLEEP, req as *const TimeSpec as usize, rem as *mut TimeSpec as usize) }
+    unsafe { syscall2(SYS_NANOSLEEP, req as *const TimeSpec as usize,
+                                     rem as *mut TimeSpec as usize) }
 }
 
 /// Open a file
-pub fn open(path: &str, flags: usize) -> Result<usize> {
-    unsafe { syscall3(SYS_OPEN, path.as_ptr() as usize, path.len(), flags) }
+pub fn open<T: AsRef<[u8]>>(path: T, flags: usize) -> Result<usize> {
+    unsafe { syscall3(SYS_OPEN, path.as_ref().as_ptr() as usize, path.as_ref().len(), flags) }
 }
 
 /// Allocate pages, linearly in physical memory
 pub unsafe fn physalloc(size: usize) -> Result<usize> {
     syscall1(SYS_PHYSALLOC, size)
 }
 
 /// Free physically allocated pages
@@ -227,18 +251,23 @@ pub fn pipe2(fds: &mut [usize; 2], flags
 }
 
 /// Read from a file descriptor into a buffer
 pub fn read(fd: usize, buf: &mut [u8]) -> Result<usize> {
     unsafe { syscall3(SYS_READ, fd, buf.as_mut_ptr() as usize, buf.len()) }
 }
 
 /// Remove a directory
-pub fn rmdir(path: &str) -> Result<usize> {
-    unsafe { syscall2(SYS_RMDIR, path.as_ptr() as usize, path.len()) }
+pub fn rmdir<T: AsRef<[u8]>>(path: T) -> Result<usize> {
+    unsafe { syscall2(SYS_RMDIR, path.as_ref().as_ptr() as usize, path.as_ref().len()) }
+}
+
+/// Set the process group ID
+pub fn setpgid(pid: usize, pgid: usize) -> Result<usize> {
+    unsafe { syscall2(SYS_SETPGID, pid, pgid) }
 }
 
 /// Set the current process group IDs
 pub fn setregid(rgid: usize, egid: usize) -> Result<usize> {
     unsafe { syscall2(SYS_SETREGID, rgid, egid) }
 }
 
 /// Make a new scheme namespace
@@ -246,19 +275,32 @@ pub fn setrens(rns: usize, ens: usize) -
     unsafe { syscall2(SYS_SETRENS, rns, ens) }
 }
 
 /// Set the current process user IDs
 pub fn setreuid(ruid: usize, euid: usize) -> Result<usize> {
     unsafe { syscall2(SYS_SETREUID, ruid, euid) }
 }
 
+/// Set up a signal handler
+pub fn sigaction(sig: usize, act: Option<&SigAction>, oldact: Option<&mut SigAction>) -> Result<usize> {
+    unsafe { syscall4(SYS_SIGACTION, sig,
+                      act.map(|x| x as *const _).unwrap_or_else(ptr::null) as usize,
+                      oldact.map(|x| x as *mut _).unwrap_or_else(ptr::null_mut) as usize,
+                      restorer as usize) }
+}
+
+// Return from signal handler
+pub fn sigreturn() -> Result<usize> {
+    unsafe { syscall0(SYS_SIGRETURN) }
+}
+
 /// Remove a file
-pub fn unlink(path: &str) -> Result<usize> {
-    unsafe { syscall2(SYS_UNLINK, path.as_ptr() as usize, path.len()) }
+pub fn unlink<T: AsRef<[u8]>>(path: T) -> Result<usize> {
+    unsafe { syscall2(SYS_UNLINK, path.as_ref().as_ptr() as usize, path.as_ref().len()) }
 }
 
 /// Convert a virtual address to a physical one
 pub unsafe fn virttophys(virtual_address: usize) -> Result<usize> {
     syscall1(SYS_VIRTTOPHYS, virtual_address)
 }
 
 /// Check if a child process has exited or received a signal
@@ -272,17 +314,17 @@ pub fn waitpid(pid: usize, status: &mut 
 /// either an `Err`, explained below, or `Ok(count)` where `count` is the number of bytes which
 /// were written.
 ///
 /// # Errors
 ///
 /// * `EAGAIN` - the file descriptor was opened with `O_NONBLOCK` and writing would block
 /// * `EBADF` - the file descriptor is not valid or is not open for writing
 /// * `EFAULT` - `buf` does not point to the process's addressible memory
-/// * `EIO` - an I/O error occured
+/// * `EIO` - an I/O error occurred
 /// * `ENOSPC` - the device containing the file descriptor has no room for data
 /// * `EPIPE` - the file descriptor refers to a pipe or socket whose reading end is closed
 pub fn write(fd: usize, buf: &[u8]) -> Result<usize> {
     unsafe { syscall3(SYS_WRITE, fd, buf.as_ptr() as usize, buf.len()) }
 }
 
 /// Yield the process's time slice to the kernel
 ///
--- a/third_party/rust/redox_syscall/src/data.rs
+++ b/third_party/rust/redox_syscall/src/data.rs
@@ -21,17 +21,17 @@ impl DerefMut for Event {
     fn deref_mut(&mut self) -> &mut [u8] {
         unsafe {
             slice::from_raw_parts_mut(self as *mut Event as *mut u8, mem::size_of::<Event>()) as &mut [u8]
         }
     }
 }
 
 #[derive(Copy, Clone, Debug, Default)]
-#[repr(packed)]
+#[repr(C)]
 pub struct Packet {
     pub id: u64,
     pub pid: usize,
     pub uid: u32,
     pub gid: u32,
     pub a: usize,
     pub b: usize,
     pub c: usize,
@@ -50,18 +50,36 @@ impl Deref for Packet {
 impl DerefMut for Packet {
     fn deref_mut(&mut self) -> &mut [u8] {
         unsafe {
             slice::from_raw_parts_mut(self as *mut Packet as *mut u8, mem::size_of::<Packet>()) as &mut [u8]
         }
     }
 }
 
+#[derive(Copy, Clone, Debug)]
+#[repr(C)]
+pub struct SigAction {
+    pub sa_handler: extern "C" fn(usize),
+    pub sa_mask: [u64; 2],
+    pub sa_flags: usize,
+}
+
+impl Default for SigAction {
+    fn default() -> Self {
+        Self {
+            sa_handler: unsafe { mem::transmute(0usize) },
+            sa_mask: [0; 2],
+            sa_flags: 0,
+        }
+    }
+}
+
 #[derive(Copy, Clone, Debug, Default)]
-#[repr(packed)]
+#[repr(C)]
 pub struct Stat {
     pub st_dev: u64,
     pub st_ino: u64,
     pub st_mode: u16,
     pub st_nlink: u32,
     pub st_uid: u32,
     pub st_gid: u32,
     pub st_size: u64,
@@ -74,58 +92,61 @@ pub struct Stat {
     pub st_ctime: u64,
     pub st_ctime_nsec: u32,
 }
 
 impl Deref for Stat {
     type Target = [u8];
     fn deref(&self) -> &[u8] {
         unsafe {
-            slice::from_raw_parts(self as *const Stat as *const u8, mem::size_of::<Stat>()) as &[u8]
+            slice::from_raw_parts(self as *const Stat as *const u8,
+                                  mem::size_of::<Stat>()) as &[u8]
         }
     }
 }
 
 impl DerefMut for Stat {
     fn deref_mut(&mut self) -> &mut [u8] {
         unsafe {
-            slice::from_raw_parts_mut(self as *mut Stat as *mut u8, mem::size_of::<Stat>()) as &mut [u8]
+            slice::from_raw_parts_mut(self as *mut Stat as *mut u8,
+                                      mem::size_of::<Stat>()) as &mut [u8]
         }
     }
 }
 
 #[derive(Copy, Clone, Debug, Default)]
-#[repr(packed)]
+#[repr(C)]
 pub struct StatVfs {
     pub f_bsize: u32,
     pub f_blocks: u64,
     pub f_bfree: u64,
     pub f_bavail: u64,
-    //TODO: More fields https://linux.die.net/man/2/statvfs
 }
 
 impl Deref for StatVfs {
     type Target = [u8];
     fn deref(&self) -> &[u8] {
         unsafe {
-            slice::from_raw_parts(self as *const StatVfs as *const u8, mem::size_of::<StatVfs>()) as &[u8]
+            slice::from_raw_parts(self as *const StatVfs as *const u8,
+                                  mem::size_of::<StatVfs>()) as &[u8]
         }
     }
 }
 
 impl DerefMut for StatVfs {
     fn deref_mut(&mut self) -> &mut [u8] {
         unsafe {
-            slice::from_raw_parts_mut(self as *mut StatVfs as *mut u8, mem::size_of::<StatVfs>()) as &mut [u8]
+            slice::from_raw_parts_mut(self as *mut StatVfs as *mut u8,
+                                      mem::size_of::<StatVfs>()) as &mut [u8]
         }
     }
 }
 
 #[derive(Copy, Clone, Debug, Default)]
-#[repr(packed)]
+#[repr(C)]
 pub struct TimeSpec {
     pub tv_sec: i64,
     pub tv_nsec: i32,
 }
 
 impl Deref for TimeSpec {
     type Target = [u8];
     fn deref(&self) -> &[u8] {
--- a/third_party/rust/redox_syscall/src/flag.rs
+++ b/third_party/rust/redox_syscall/src/flag.rs
@@ -1,33 +1,41 @@
 pub const CLONE_VM: usize = 0x100;
 pub const CLONE_FS: usize = 0x200;
 pub const CLONE_FILES: usize = 0x400;
+pub const CLONE_SIGHAND: usize = 0x800;
 pub const CLONE_VFORK: usize = 0x4000;
+pub const CLONE_THREAD: usize = 0x10000;
 
 pub const CLOCK_REALTIME: usize = 1;
 pub const CLOCK_MONOTONIC: usize = 4;
 
 pub const EVENT_NONE: usize = 0;
 pub const EVENT_READ: usize = 1;
 pub const EVENT_WRITE: usize = 2;
 
-pub const F_GETFL: usize = 1;
-pub const F_SETFL: usize = 2;
+pub const F_DUPFD: usize = 0;
+pub const F_GETFD: usize = 1;
+pub const F_SETFD: usize = 2;
+pub const F_GETFL: usize = 3;
+pub const F_SETFL: usize = 4;
 
 pub const FUTEX_WAIT: usize = 0;
 pub const FUTEX_WAKE: usize = 1;
 pub const FUTEX_REQUEUE: usize = 2;
 
 pub const MAP_WRITE: usize = 1;
 pub const MAP_WRITE_COMBINE: usize = 2;
 
 pub const MODE_TYPE: u16 = 0xF000;
 pub const MODE_DIR: u16 = 0x4000;
 pub const MODE_FILE: u16 = 0x8000;
+pub const MODE_SYMLINK: u16 = 0xA000;
+pub const MODE_FIFO: u16 = 0x1000;
+pub const MODE_CHR: u16 = 0x2000;
 
 pub const MODE_PERM: u16 = 0x0FFF;
 pub const MODE_SETUID: u16 = 0o4000;
 pub const MODE_SETGID: u16 = 0o2000;
 
 pub const O_RDONLY: usize =     0x0001_0000;
 pub const O_WRONLY: usize =     0x0002_0000;
 pub const O_RDWR: usize =       0x0003_0000;
@@ -38,16 +46,18 @@ pub const O_EXLOCK: usize =     0x0020_0
 pub const O_ASYNC: usize =      0x0040_0000;
 pub const O_FSYNC: usize =      0x0080_0000;
 pub const O_CLOEXEC: usize =    0x0100_0000;
 pub const O_CREAT: usize =      0x0200_0000;
 pub const O_TRUNC: usize =      0x0400_0000;
 pub const O_EXCL: usize =       0x0800_0000;
 pub const O_DIRECTORY: usize =  0x1000_0000;
 pub const O_STAT: usize =       0x2000_0000;
+pub const O_SYMLINK: usize =    0x4000_0000;
+pub const O_NOFOLLOW: usize =   0x8000_0000;
 pub const O_ACCMODE: usize =    O_RDONLY | O_WRONLY | O_RDWR;
 
 pub const SEEK_SET: usize = 0;
 pub const SEEK_CUR: usize = 1;
 pub const SEEK_END: usize = 2;
 
 pub const SIGHUP: usize =   1;
 pub const SIGINT: usize =   2;
@@ -76,9 +86,21 @@ pub const SIGXCPU: usize =  24;
 pub const SIGXFSZ: usize =  25;
 pub const SIGVTALRM: usize= 26;
 pub const SIGPROF: usize =  27;
 pub const SIGWINCH: usize = 28;
 pub const SIGIO: usize =    29;
 pub const SIGPWR: usize =   30;
 pub const SIGSYS: usize =   31;
 
+pub const SIG_DFL: usize = 0;
+pub const SIG_IGN: usize = 1;
+
+pub const SA_NOCLDSTOP: usize = 0x00000001;
+pub const SA_NOCLDWAIT: usize = 0x00000002;
+pub const SA_SIGINFO: usize =   0x00000004;
+pub const SA_RESTORER: usize =  0x04000000;
+pub const SA_ONSTACK: usize =   0x08000000;
+pub const SA_RESTART: usize =   0x10000000;
+pub const SA_NODEFER: usize =   0x40000000;
+pub const SA_RESETHAND: usize = 0x80000000;
+
 pub const WNOHANG: usize = 1;
--- a/third_party/rust/redox_syscall/src/number.rs
+++ b/third_party/rust/redox_syscall/src/number.rs
@@ -13,52 +13,58 @@ pub const SYS_RET_FILE: usize = 0x0010_0
 pub const SYS_LINK: usize =     SYS_CLASS_PATH | SYS_ARG_PATH | 9;
 pub const SYS_OPEN: usize =     SYS_CLASS_PATH | SYS_RET_FILE | 5;
 pub const SYS_CHMOD: usize =    SYS_CLASS_PATH | 15;
 pub const SYS_RMDIR: usize =    SYS_CLASS_PATH | 84;
 pub const SYS_UNLINK: usize =   SYS_CLASS_PATH | 10;
 
 pub const SYS_CLOSE: usize =    SYS_CLASS_FILE | 6;
 pub const SYS_DUP: usize =      SYS_CLASS_FILE | SYS_RET_FILE | 41;
-pub const SYS_DUP2: usize =      SYS_CLASS_FILE | SYS_RET_FILE | 63;
+pub const SYS_DUP2: usize =     SYS_CLASS_FILE | SYS_RET_FILE | 63;
 pub const SYS_READ: usize =     SYS_CLASS_FILE | SYS_ARG_MSLICE | 3;
 pub const SYS_WRITE: usize =    SYS_CLASS_FILE | SYS_ARG_SLICE | 4;
 pub const SYS_LSEEK: usize =    SYS_CLASS_FILE | 19;
 pub const SYS_FCNTL: usize =    SYS_CLASS_FILE | 55;
 pub const SYS_FEVENT: usize =   SYS_CLASS_FILE | 927;
 pub const SYS_FMAP: usize =     SYS_CLASS_FILE | 90;
 pub const SYS_FUNMAP: usize =   SYS_CLASS_FILE | 91;
 pub const SYS_FPATH: usize =    SYS_CLASS_FILE | SYS_ARG_MSLICE | 928;
 pub const SYS_FSTAT: usize =    SYS_CLASS_FILE | SYS_ARG_MSLICE | 28;
 pub const SYS_FSTATVFS: usize = SYS_CLASS_FILE | SYS_ARG_MSLICE | 100;
 pub const SYS_FSYNC: usize =    SYS_CLASS_FILE | 118;
 pub const SYS_FTRUNCATE: usize =SYS_CLASS_FILE | 93;
+pub const SYS_FUTIMENS: usize = SYS_CLASS_FILE | SYS_ARG_SLICE | 320;
 
 pub const SYS_BRK: usize =      45;
 pub const SYS_CHDIR: usize =    12;
 pub const SYS_CLOCK_GETTIME: usize = 265;
 pub const SYS_CLONE: usize =    120;
 pub const SYS_EXECVE: usize =   11;
 pub const SYS_EXIT: usize =     1;
 pub const SYS_FUTEX: usize =    240;
 pub const SYS_GETCWD: usize =   183;
 pub const SYS_GETEGID: usize =  202;
 pub const SYS_GETENS: usize =   951;
 pub const SYS_GETEUID: usize =  201;
 pub const SYS_GETGID: usize =   200;
 pub const SYS_GETNS: usize =    950;
 pub const SYS_GETPID: usize =   20;
+pub const SYS_GETPGID: usize =  132;
+pub const SYS_GETPPID: usize =  64;
 pub const SYS_GETUID: usize =   199;
 pub const SYS_IOPL: usize =     110;
 pub const SYS_KILL: usize =     37;
 pub const SYS_MKNS: usize =     984;
 pub const SYS_NANOSLEEP: usize =162;
 pub const SYS_PHYSALLOC: usize =945;
 pub const SYS_PHYSFREE: usize = 946;
 pub const SYS_PHYSMAP: usize =  947;
 pub const SYS_PHYSUNMAP: usize =948;
 pub const SYS_VIRTTOPHYS: usize=949;
 pub const SYS_PIPE2: usize =    331;
+pub const SYS_SETPGID: usize =  57;
 pub const SYS_SETREGID: usize = 204;
 pub const SYS_SETRENS: usize =  952;
 pub const SYS_SETREUID: usize = 203;
+pub const SYS_SIGACTION: usize =67;
+pub const SYS_SIGRETURN: usize =119;
 pub const SYS_WAITPID: usize =  7;
 pub const SYS_YIELD: usize =    158;
--- a/third_party/rust/redox_syscall/src/scheme.rs
+++ b/third_party/rust/redox_syscall/src/scheme.rs
@@ -13,22 +13,34 @@ pub trait Scheme {
             SYS_DUP => self.dup(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }),
             SYS_READ => self.read(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }),
             SYS_WRITE => self.write(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }),
             SYS_LSEEK => self.seek(packet.b, packet.c, packet.d),
             SYS_FCNTL => self.fcntl(packet.b, packet.c, packet.d),
             SYS_FEVENT => self.fevent(packet.b, packet.c),
             SYS_FMAP => self.fmap(packet.b, packet.c, packet.d),
             SYS_FPATH => self.fpath(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }),
-            SYS_FSTAT => if packet.d >= mem::size_of::<Stat>() { self.fstat(packet.b, unsafe { &mut *(packet.c as *mut Stat) }) } else { Err(Error::new(EFAULT)) },
-            SYS_FSTATVFS => if packet.d >= mem::size_of::<StatVfs>() { self.fstatvfs(packet.b, unsafe { &mut *(packet.c as *mut StatVfs) }) } else { Err(Error::new(EFAULT)) },
+            SYS_FSTAT => if packet.d >= mem::size_of::<Stat>() {
+                self.fstat(packet.b, unsafe { &mut *(packet.c as *mut Stat) })
+            } else {
+                Err(Error::new(EFAULT))
+            },
+            SYS_FSTATVFS => if packet.d >= mem::size_of::<StatVfs>() {
+                self.fstatvfs(packet.b, unsafe { &mut *(packet.c as *mut StatVfs) })
+            } else {
+                Err(Error::new(EFAULT))
+            },
             SYS_FSYNC => self.fsync(packet.b),
             SYS_FTRUNCATE => self.ftruncate(packet.b, packet.c),
+            SYS_FUTIMENS => if packet.d >= mem::size_of::<TimeSpec>() {
+                self.futimens(packet.b, unsafe { slice::from_raw_parts(packet.c as *const TimeSpec, packet.d / mem::size_of::<TimeSpec>()) })
+            } else {
+                Err(Error::new(EFAULT))
+            },
             SYS_CLOSE => self.close(packet.b),
-
             _ => Err(Error::new(ENOSYS))
         });
     }
 
     /* Scheme operations */
 
     #[allow(unused_variables)]
     fn open(&self, path: &[u8], flags: usize, uid: u32, gid: u32) -> Result<usize> {
@@ -107,16 +119,21 @@ pub trait Scheme {
     }
 
     #[allow(unused_variables)]
     fn ftruncate(&self, id: usize, len: usize) -> Result<usize> {
         Err(Error::new(EBADF))
     }
 
     #[allow(unused_variables)]
+    fn futimens(&self, id: usize, times: &[TimeSpec]) -> Result<usize> {
+        Err(Error::new(EBADF))
+    }
+
+    #[allow(unused_variables)]
     fn close(&self, id: usize) -> Result<usize> {
         Err(Error::new(EBADF))
     }
 }
 
 pub trait SchemeMut {
     fn handle(&mut self, packet: &mut Packet) {
         packet.a = Error::mux(match packet.a {
@@ -128,34 +145,46 @@ pub trait SchemeMut {
             SYS_DUP => self.dup(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }),
             SYS_READ => self.read(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }),
             SYS_WRITE => self.write(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }),
             SYS_LSEEK => self.seek(packet.b, packet.c, packet.d),
             SYS_FCNTL => self.fcntl(packet.b, packet.c, packet.d),
             SYS_FEVENT => self.fevent(packet.b, packet.c),
             SYS_FMAP => self.fmap(packet.b, packet.c, packet.d),
             SYS_FPATH => self.fpath(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }),
-            SYS_FSTAT => if packet.d >= mem::size_of::<Stat>() { self.fstat(packet.b, unsafe { &mut *(packet.c as *mut Stat) }) } else { Err(Error::new(EFAULT)) },
-            SYS_FSTATVFS => if packet.d >= mem::size_of::<StatVfs>() { self.fstatvfs(packet.b, unsafe { &mut *(packet.c as *mut StatVfs) }) } else { Err(Error::new(EFAULT)) },
+            SYS_FSTAT => if packet.d >= mem::size_of::<Stat>() {
+                self.fstat(packet.b, unsafe { &mut *(packet.c as *mut Stat) })
+            } else {
+                Err(Error::new(EFAULT))
+            },
+            SYS_FSTATVFS => if packet.d >= mem::size_of::<StatVfs>() {
+                self.fstatvfs(packet.b, unsafe { &mut *(packet.c as *mut StatVfs) })
+            } else {
+                Err(Error::new(EFAULT))
+            },
             SYS_FSYNC => self.fsync(packet.b),
             SYS_FTRUNCATE => self.ftruncate(packet.b, packet.c),
+            SYS_FUTIMENS => if packet.d >= mem::size_of::<TimeSpec>() {
+                self.futimens(packet.b, unsafe { slice::from_raw_parts(packet.c as *const TimeSpec, packet.d / mem::size_of::<TimeSpec>()) })
+            } else {
+                Err(Error::new(EFAULT))
+            },
             SYS_CLOSE => self.close(packet.b),
-
             _ => Err(Error::new(ENOSYS))
         });
     }
 
     /* Scheme operations */
     #[allow(unused_variables)]
     fn open(&mut self, path: &[u8], flags: usize, uid: u32, gid: u32) -> Result<usize> {
         Err(Error::new(ENOENT))
     }
 
     #[allow(unused_variables)]
-    fn chmod(&self, path: &[u8], mode: u16, uid: u32, gid: u32) -> Result<usize> {
+    fn chmod(&mut self, path: &[u8], mode: u16, uid: u32, gid: u32) -> Result<usize> {
         Err(Error::new(ENOENT))
     }
 
     #[allow(unused_variables)]
     fn rmdir(&mut self, path: &[u8], uid: u32, gid: u32) -> Result<usize> {
         Err(Error::new(ENOENT))
     }
 
@@ -221,12 +250,17 @@ pub trait SchemeMut {
     }
 
     #[allow(unused_variables)]
     fn ftruncate(&mut self, id: usize, len: usize) -> Result<usize> {
         Err(Error::new(EBADF))
     }
 
     #[allow(unused_variables)]
+    fn futimens(&mut self, id: usize, times: &[TimeSpec]) -> Result<usize> {
+        Err(Error::new(EBADF))
+    }
+
+    #[allow(unused_variables)]
     fn close(&mut self, id: usize) -> Result<usize> {
         Err(Error::new(EBADF))
     }
 }
copy from third_party/rust/rustc-demangle/.cargo-checksum.json
copy to third_party/rust/rustc-demangle-0.1.4/.cargo-checksum.json
new file mode 100644
--- /dev/null
+++ b/third_party/rust/rustc-demangle-0.1.4/.travis.yml
@@ -0,0 +1,20 @@
+language: rust
+rust:
+  - stable
+  - beta
+  - nightly
+sudo: false
+before_script:
+  - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
+script:
+  - cargo build
+  - cargo test
+  - cargo doc
+after_success:
+  - travis-cargo --only nightly doc-upload
+notifications:
+  email:
+    on_success: never
+env:
+  global:
+    secure: "VWE8DaftZLOj34USRPiq2jyFV1xWrPJP0lgMVWPGF52soyWV6L5FyMlbk00GvKH8y5h0urtuVFmInsLKz1E96eTLbD7Efa2snjSlOWMsTaWy3yq0NNuPraMWiXUkjDBxW3DTV47HN9thYA7TbrM35A0XGr7fXKl4CPT/UKEo2nNZPb2Y2XYaD6RID1sXMOvemOERGu7Lnq8dQ/PdGWWkpTV4FVsmq2wTyyZnzsEFsK0r/wqEPPHSl8r3NH6Rid9kCMw3h1d9s1eYSqzP09/fYfjy+X/6iGV9dL5WUQFL7xG7WjfZZG/e87lAxbXx+jXTlncdvXjm4BmIOYHeEMK9N5D3qE5C1gIIU+tk6ZuVKBLWMQJnAIDJKCsVdUhAXtWqbFK4djvNJUml1rIOF/CVUeynBVtacJ8nlxyh61XvDHbZGSBFBR2odEkhUaLzw/t/zqOIYd0u+mjtM4pX1nZ+ZFIMqVFsNTfVWWMDLyRVBNiAoHCdn/ug+mJJaYE3mZ2q1wPPqJVFffyaZVyg97zFO0y9v5ASHjb/7nYlIPoDGDPDUuoscuw5IYf+6CoCi7EgGqg5v7X1BsBXSYK+XfzOvrAqP31ixNGyVJEcBjAaJXwopx6KVIqWe71eHJDX68VeI0ncfCPDDQIReKA7MBhq5PzRDzr4iRHZAhNyuKgo+Fo="
copy from third_party/rust/rustc-demangle/Cargo.toml
copy to third_party/rust/rustc-demangle-0.1.4/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/rustc-demangle-0.1.4/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/rustc-demangle-0.1.4/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 Alex Crichton
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/rustc-demangle-0.1.4/README.md
@@ -0,0 +1,15 @@
+# rustc-demangle
+
+Symbol demangling for Rust
+
+[![Build Status](https://travis-ci.org/alexcrichton/rustc-demangle.svg?branch=master)](https://travis-ci.org/alexcrichton/rustc-demangle)
+
+[Documentation](http://alexcrichton.com/rustc-demangle)
+
+# License
+
+`rustc-demangle` is primarily distributed under the terms of both the MIT license and
+the Apache License (Version 2.0), with portions covered by various BSD-like
+licenses.
+
+See LICENSE-APACHE, and LICENSE-MIT for details.
copy from third_party/rust/rustc-demangle/src/lib.rs
copy to third_party/rust/rustc-demangle-0.1.4/src/lib.rs
--- a/third_party/rust/rustc-demangle/.cargo-checksum.json
+++ b/third_party/rust/rustc-demangle/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"ff608da9edb53d86860db37ca32b87abb9423785544d763b0776eb654e1896c0","Cargo.toml":"f36d04ef66479455b1adb0a96e7c7ee16282f526dfa241ee878c9f810a11e93f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"2ab3793abfd94209549d28f157f223ff43a7f3bfeefe90cf5572ed49c69c52fd","src/lib.rs":"60a242b81e0bbe06dfeec2640a31d5d71458a35c187b5b3c3ee30fc9a2d0ddd5"},"package":"3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95"}
\ No newline at end of file
+{"files":{".travis.yml":"ff608da9edb53d86860db37ca32b87abb9423785544d763b0776eb654e1896c0","Cargo.toml":"43337f9d8ac2872814a164f83868594c40893b6e41097297d9dcdfc32ea64ca6","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"2ab3793abfd94209549d28f157f223ff43a7f3bfeefe90cf5572ed49c69c52fd","src/lib.rs":"cd17aa17e13e3f4d21d1be2a7ca020ae2138570c0e24570eda647199a228495e"},"package":"aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e"}
\ No newline at end of file
--- a/third_party/rust/rustc-demangle/Cargo.toml
+++ b/third_party/rust/rustc-demangle/Cargo.toml
@@ -1,12 +1,22 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "rustc-demangle"
-version = "0.1.4"
+version = "0.1.5"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
-license = "MIT/Apache-2.0"
-readme = "README.md"
-repository = "https://github.com/alexcrichton/rustc-demangle"
+description = "Rust compiler symbol demangling.\n"
 homepage = "https://github.com/alexcrichton/rustc-demangle"
 documentation = "http://alexcrichton.com/rustc-demangle"
-description = """
-Rust compiler symbol demangling.
-"""
+readme = "README.md"
+license = "MIT/Apache-2.0"
+repository = "https://github.com/alexcrichton/rustc-demangle"
--- a/third_party/rust/rustc-demangle/src/lib.rs
+++ b/third_party/rust/rustc-demangle/src/lib.rs
@@ -87,16 +87,19 @@ pub fn demangle(s: &str) -> Demangle {
     let mut valid = true;
     let mut inner = s;
     if s.len() > 4 && s.starts_with("_ZN") && s.ends_with('E') {
         inner = &s[3..s.len() - 1];
     } else if s.len() > 3 && s.starts_with("ZN") && s.ends_with('E') {
         // On Windows, dbghelp strips leading underscores, so we accept "ZN...E"
         // form too.
         inner = &s[2..s.len() - 1];
+    } else if s.len() > 5 && s.starts_with("__ZN") && s.ends_with('E') {
+        // On OSX, symbols are prefixed with an extra _
+        inner = &s[4..s.len() - 1];
     } else {
         valid = false;
     }
 
     let mut elements = 0;
     if valid {
         let mut chars = inner.chars();
         while valid {
@@ -298,16 +301,24 @@ mod tests {
     }
 
     #[test]
     fn demangle_many_dollars() {
         t!("_ZN13test$u20$test4foobE", "test test::foob");
         t!("_ZN12test$BP$test4foobE", "test*test::foob");
     }
 
+
+    #[test]
+    fn demangle_osx() {
+        t!("__ZN5alloc9allocator6Layout9for_value17h02a996811f781011E", "alloc::allocator::Layout::for_value::h02a996811f781011");
+        t!("__ZN38_$LT$core..option..Option$LT$T$GT$$GT$6unwrap18_MSG_FILE_LINE_COL17haf7cb8d5824ee659E", "<core::option::Option<T>>::unwrap::_MSG_FILE_LINE_COL::haf7cb8d5824ee659");
+        t!("__ZN4core5slice89_$LT$impl$u20$core..iter..traits..IntoIterator$u20$for$u20$$RF$$u27$a$u20$$u5b$T$u5d$$GT$9into_iter17h450e234d27262170E", "core::slice::<impl core::iter::traits::IntoIterator for &'a [T]>::into_iter::h450e234d27262170");
+    }
+
     #[test]
     fn demangle_windows() {
         t!("ZN4testE", "test");
         t!("ZN13test$u20$test4foobE", "test test::foob");
         t!("ZN12test$RF$test4foobE", "test&test::foob");
     }
 
     #[test]
new file mode 100644
--- /dev/null
+++ b/third_party/rust/safemem/.cargo-checksum.json
@@ -0,0 +1,1 @@
+{"files":{".idea/runConfigurations/cargo_check.xml":"e4387dbed627bf7ba488115245b1fdfc546d118a7378a97ab3abb1343002170e","Cargo.toml":"94aae7f1f5f45951bc2143279ac3c61259cbd047b1ac9fc6cb820f26d0b6b392","LICENSE-APACHE":"7cfd738c53d61c79f07e348f622bf7707c9084237054d37fbe07788a75f5881c","LICENSE-MIT":"64e1c5f067ee2d8c0ee8abd751e57275d4e97e4f7c05699bc23f5005a9c53043","README.md":"2bb7c7b12f6d223514fdf7e346c9bd9950347a6a7e271dfc8eec06c6fe10ab3e","src/lib.rs":"da812d1fa45ff718510e8f32d5012efca83b0880f9ccf1ff1147dc318e3e434f"},"package":"e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/third_party/rust/safemem/.idea/runConfigurations/cargo_check.xml
@@ -0,0 +1,12 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="cargo check" type="CargoCommandRunConfiguration" factoryName="Cargo Command" show_console_on_std_err="false" show_console_on_std_out="false">
+    <option name="additionalArguments" value="" />
+    <option name="command" value="check" />
+    <option name="environmentVariables">
+      <map />
+    </option>
+    <option name="printBacktrace" value="false" />
+    <module name="safemem" />
+    <method />
+  </configuration>
+</component>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/third_party/rust/safemem/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "safemem"
+version = "0.2.0"
+authors = ["Austin Bonander <austin.bonander@gmail.com>"]
+
+description = "Safe wrappers for memory-accessing functions, like `std::ptr::copy()`."
+repository = "https://github.com/abonander/safemem"
+keywords = ["memset", "memmove", "copy"]
+license = "MIT OR Apache-2.0"
+
+documentation = "https://docs.rs/safemem"
+
+[dependencies]
copy from third_party/rust/httparse/LICENSE-APACHE
copy to third_party/rust/safemem/LICENSE-APACHE
new file mode 100644
--- /dev/null
+++ b/third_party/rust/safemem/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2016 The `multipart` Crate Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/safemem/README.md
@@ -0,0 +1,18 @@
+# safemem
+Safe wrappers for `memmove`, `memset`, etc. in Rust
+
+License
+-------
+
+Licensed under either of
+
+ * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
+additional terms or conditions.
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/third_party/rust/safemem/src/lib.rs
@@ -0,0 +1,109 @@
+//! Safe wrappers for memory-accessing functions like `std::ptr::copy()`.
+use std::ptr;
+
+macro_rules! idx_check (
+    ($slice:expr, $idx:expr) => {
+        assert!($idx < $slice.len(),
+            concat!("`", stringify!($idx), "` ({}) out of bounds. Length: {}"),
+            $idx, $slice.len());
+    }
+);
+
+macro_rules! len_check (
+    ($slice:expr, $start:ident, $len:ident) => {
+        assert!(
+            $start.checked_add($len)
+                .expect(concat!("Overflow evaluating ", stringify!($start + $len)))
+                <= $slice.len(),
+            "Length {} starting at {} is out of bounds (slice len {}).", $len, $start, $slice.len()
+        )
+    }
+);
+
+/// Copy `len` elements from `src_idx` to `dest_idx`. Ranges may overlap.
+///
+/// Safe wrapper for `memmove()`/`std::ptr::copy()`.
+///
+/// ###Panics
+/// * If either `src_idx` or `dest_idx` are out of bounds, or if either of these plus `len` is out of
+/// bounds.
+/// * If `src_idx + len` or `dest_idx + len` overflows.
+pub fn copy_over<T: Copy>(slice: &mut [T], src_idx: usize, dest_idx: usize, len: usize) {
+    if slice.len() == 0 { return; }
+
+    idx_check!(slice, src_idx);
+    idx_check!(slice, dest_idx);
+    len_check!(slice, src_idx, len);
+    len_check!(slice, dest_idx, len);
+
+    let src_ptr: *const T = &slice[src_idx];
+    let dest_ptr: *mut T = &mut slice[dest_idx];
+
+    unsafe {
+        ptr::copy(src_ptr, dest_ptr, len);
+    }
+}
+
+/// Safe wrapper for `std::ptr::write_bytes()`/`memset()`.
+pub fn write_bytes(slice: &mut [u8], byte: u8) {
+    unsafe {
+        ptr::write_bytes(slice.as_mut_ptr(), byte, slice.len());
+    }
+}
+
+/// Prepend `elems` to `vec`, resizing if necessary.
+///
+/// ###Panics
+/// If `vec.len() + elems.len()` overflows.
+pub fn prepend<T: Copy>(elems: &[T], vec: &mut Vec<T>) {
+    // Our overflow check occurs here, no need to do it ourselves.
+    vec.reserve(elems.len());
+
+    let old_len = vec.len();
+    let new_len = old_len + elems.len();
+
+    unsafe {
+        vec.set_len(new_len);
+    }
+
+    // Move the old elements down to the end.
+    if old_len > 0 {
+        copy_over(vec, 0, elems.len(), old_len);
+    }
+
+    vec[..elems.len()].copy_from_slice(elems);
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    #[should_panic]
+    fn bounds_check() {
+        let mut arr = [0i32, 1, 2, 3, 4, 5];
+
+        copy_over(&mut arr, 2, 1, 7);
+    }
+
+    #[test]
+    fn copy_empty() {
+        let mut arr: [i32; 0] = [];
+
+        copy_over(&mut arr, 0, 0, 0);
+    }
+
+    #[test]
+    fn prepend_empty() {
+        let mut vec: Vec<i32> = vec![];
+        prepend(&[1, 2, 3], &mut vec);
+    }
+
+    #[test]
+    fn prepend_i32() {
+        let mut vec = vec![3, 4, 5];
+        prepend(&[1, 2], &mut vec);
+        assert_eq!(vec, &[1, 2, 3, 4, 5]);
+    }
+}
+
copy from third_party/rust/thread_local/.cargo-checksum.json
copy to third_party/rust/thread_local-0.3.3/.cargo-checksum.json
copy from third_party/rust/thread_local/.travis.yml
copy to third_party/rust/thread_local-0.3.3/.travis.yml
copy from third_party/rust/thread_local/Cargo.toml
copy to third_party/rust/thread_local-0.3.3/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/thread_local-0.3.3/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/thread_local-0.3.3/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2016 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/thread_local-0.3.3/README.md
@@ -0,0 +1,41 @@
+thread_local
+============
+
+[![Build Status](https://travis-ci.org/Amanieu/thread_local-rs.svg?branch=master)](https://travis-ci.org/Amanieu/thread_local-rs) [![Crates.io](https://img.shields.io/crates/v/thread_local.svg)](https://crates.io/crates/thread_local)
+
+This library provides the `ThreadLocal` and `CachedThreadLocal` types which
+allow a separate copy of an object to be used for each thread. This allows for
+per-object thread-local storage, unlike the standard library's `thread_local!`
+macro which only allows static thread-local storage.
+
+[Documentation](https://amanieu.github.io/thread_local-rs/thread_local/index.html)
+
+## Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+thread_local = "0.3"
+```
+
+and this to your crate root:
+
+```rust
+extern crate thread_local;
+```
+
+## License
+
+Licensed under either of
+
+ * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
+additional terms or conditions.
copy from third_party/rust/thread_local/src/lib.rs
copy to third_party/rust/thread_local-0.3.3/src/lib.rs
--- a/third_party/rust/thread_local/.cargo-checksum.json
+++ b/third_party/rust/thread_local/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"474743a2a8c8c7bbcc86ed6a4b68165405635651493757d97c06e965c608ee74","Cargo.toml":"0ec34b07cd55626697c62496ab1f826c9b7928697cf3362e7f5a7bcf9e080fda","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"00a29378d5aeb66b7a48b77bee0d463c8b408b8a9cb0abb7674edb10d142aca0","src/lib.rs":"f5d04966ff4da2a79fe4f484687f4b845df5a2fe2b94151d4cad3f595ef6fce2"},"package":"c85048c6260d17cf486ceae3282d9fb6b90be220bf5b28c400f5485ffc29f0c7"}
\ No newline at end of file
+{"files":{".travis.yml":"c01fcdfc31a1092bfdbdd22a0d88773bdc280550b806ab2ebe23ac4b32d4a5c2","Cargo.toml":"cc42ea81b9749fdd354f433e91f845f656841e904b986ad08c30bf419a26c6d7","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"00a29378d5aeb66b7a48b77bee0d463c8b408b8a9cb0abb7674edb10d142aca0","benches/thread_local.rs":"cc8bde81ed6206525feff209598caf1e01e89a83bf21d8b7ccc0dadc8b89d815","src/lib.rs":"e5902751bf1768fb756b88146da66a128920d3f1b166b797fd0a5e1528f2e687","src/thread_id.rs":"0962c130061939557aa272115e4420fbbc63b6bd306783a456a8ffcbf304a447"},"package":"1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"}
\ No newline at end of file
--- a/third_party/rust/thread_local/.travis.yml
+++ b/third_party/rust/thread_local/.travis.yml
@@ -10,16 +10,17 @@ rust:
 before_script:
 - |
   pip install 'travis-cargo<0.2' --user &&
   export PATH=$HOME/.local/bin:$PATH
 
 script:
 - travis-cargo build
 - travis-cargo test
+- travis-cargo bench
 - travis-cargo doc -- --no-deps
 
 after_success:
 - travis-cargo --only nightly doc-upload
 
 env:
   global:
   - TRAVIS_CARGO_NIGHTLY_FEATURE=""
--- a/third_party/rust/thread_local/Cargo.toml
+++ b/third_party/rust/thread_local/Cargo.toml
@@ -1,16 +1,27 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "thread_local"
-version = "0.3.3"
+version = "0.3.4"
 authors = ["Amanieu d'Antras <amanieu@gmail.com>"]
 description = "Per-object thread-local storage"
 documentation = "https://amanieu.github.io/thread_local-rs/thread_local/index.html"
-license = "Apache-2.0/MIT"
-repository = "https://github.com/Amanieu/thread_local-rs"
 readme = "README.md"
 keywords = ["thread_local", "concurrent", "thread"]
+license = "Apache-2.0/MIT"
+repository = "https://github.com/Amanieu/thread_local-rs"
+[dependencies.unreachable]
+version = "1.0"
 
-[dependencies]
-unreachable = "0.1"
-
-[target.'cfg(not(target_os = "emscripten"))'.dependencies]
-thread-id = "3.0"
+[dependencies.lazy_static]
+version = "0.2"
new file mode 100644
--- /dev/null
+++ b/third_party/rust/thread_local/benches/thread_local.rs
@@ -0,0 +1,18 @@
+#![feature(test)]
+
+extern crate thread_local;
+extern crate test;
+
+use thread_local::{ThreadLocal, CachedThreadLocal};
+
+#[bench]
+fn thread_local(b: &mut test::Bencher) {
+    let local = ThreadLocal::new();
+    b.iter(|| { let _: &i32 = local.get_or(|| Box::new(0)); });
+}
+
+#[bench]
+fn cached_thread_local(b: &mut test::Bencher) {
+    let local = CachedThreadLocal::new();
+    b.iter(|| { let _: &i32 = local.get_or(|| Box::new(0)); });
+}
--- a/third_party/rust/thread_local/src/lib.rs
+++ b/third_party/rust/thread_local/src/lib.rs
@@ -1,9 +1,9 @@
-// Copyright 2016 Amanieu d'Antras
+// Copyright 2017 Amanieu d'Antras
 //
 // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
 // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
 // http://opensource.org/licenses/MIT>, at your option. This file may not be
 // copied, modified, or distributed except according to those terms.
 
 //! Per-object thread-local storage
 //!
@@ -65,19 +65,21 @@
 //! // sum of all thread-local counter values.
 //! let tls = Arc::try_unwrap(tls).unwrap();
 //! let total = tls.into_iter().fold(0, |x, y| x + y.get());
 //! assert_eq!(total, 5);
 //! ```
 
 #![warn(missing_docs)]
 
-#[cfg(not(target_os = "emscripten"))]
-extern crate thread_id;
 extern crate unreachable;
+#[macro_use]
+extern crate lazy_static;
+
+mod thread_id;
 
 use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
 use std::sync::Mutex;
 use std::marker::PhantomData;
 use std::cell::UnsafeCell;
 use std::fmt;
 use std::iter::Chain;
 use std::option::IntoIter as OptionIter;
@@ -142,31 +144,16 @@ impl<T: ?Sized + Send> Clone for TableEn
     fn clone(&self) -> TableEntry<T> {
         TableEntry {
             owner: AtomicUsize::new(0),
             data: UnsafeCell::new(None),
         }
     }
 }
 
-// Helper function to get a thread id
-#[cfg(not(target_os = "emscripten"))]
-fn get_thread_id() -> usize {
-    thread_id::get()
-}
-#[cfg(target_os = "emscripten")]
-fn get_thread_id() -> usize {
-    // pthread_self returns 0 on enscripten, but we use that as a
-    // reserved value to indicate an empty slot. We instead fall
-    // back to using the address of a thread-local variable, which
-    // is slightly slower but guaranteed to produce a non-zero value.
-    thread_local!(static KEY: u8 = unsafe { std::mem::uninitialized() });
-    KEY.with(|x| x as *const _ as usize)
-}
-
 // Hash function for the thread id
 #[cfg(target_pointer_width = "32")]
 #[inline]
 fn hash(id: usize, bits: usize) -> usize {
     id.wrapping_mul(0x9E3779B9) >> (32 - bits)
 }
 #[cfg(target_pointer_width = "64")]
 #[inline]
@@ -190,35 +177,40 @@ impl<T: ?Sized + Send> ThreadLocal<T> {
             table: AtomicPtr::new(Box::into_raw(Box::new(table))),
             lock: Mutex::new(0),
             marker: PhantomData,
         }
     }
 
     /// Returns the element for the current thread, if it exists.
     pub fn get(&self) -> Option<&T> {
-        let id = get_thread_id();
+        let id = thread_id::get();
         self.get_fast(id)
     }
 
     /// Returns the element for the current thread, or creates it if it doesn't
     /// exist.
     pub fn get_or<F>(&self, create: F) -> &T
-        where F: FnOnce() -> Box<T>
+    where
+        F: FnOnce() -> Box<T>,
     {
-        unsafe { self.get_or_try(|| Ok::<Box<T>, ()>(create())).unchecked_unwrap_ok() }
+        unsafe {
+            self.get_or_try(|| Ok::<Box<T>, ()>(create()))
+                .unchecked_unwrap_ok()
+        }
     }
 
     /// Returns the element for the current thread, or creates it if it doesn't
     /// exist. If `create` fails, that error is returned and no element is
     /// added.
     pub fn get_or_try<F, E>(&self, create: F) -> Result<&T, E>
-        where F: FnOnce() -> Result<Box<T>, E>
+    where
+        F: FnOnce() -> Result<Box<T>, E>,
     {
-        let id = get_thread_id();
+        let id = thread_id::get();
         match self.get_fast(id) {
             Some(x) => Ok(x),
             None => Ok(self.insert(id, try!(create()), true)),
         }
     }
 
     // Simple hash table lookup function
     fn lookup(id: usize, table: &Table<T>) -> Option<&UnsafeCell<Option<Box<T>>>> {
@@ -418,17 +410,19 @@ pub struct IterMut<'a, T: ?Sized + Send 
     raw: RawIter<T>,
     marker: PhantomData<&'a mut ThreadLocal<T>>,
 }
 
 impl<'a, T: ?Sized + Send + 'a> Iterator for IterMut<'a, T> {
     type Item = &'a mut Box<T>;
 
     fn next(&mut self) -> Option<&'a mut Box<T>> {
-        self.raw.next().map(|x| unsafe { (*x).as_mut().unchecked_unwrap() })
+        self.raw.next().map(|x| unsafe {
+            (*x).as_mut().unchecked_unwrap()
+        })
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
         (self.raw.remaining, Some(self.raw.remaining))
     }
 }
 
 impl<'a, T: ?Sized + Send + 'a> ExactSizeIterator for IterMut<'a, T> {}
@@ -438,17 +432,19 @@ pub struct IntoIter<T: ?Sized + Send> {
     raw: RawIter<T>,
     _thread_local: ThreadLocal<T>,
 }
 
 impl<T: ?Sized + Send> Iterator for IntoIter<T> {
     type Item = Box<T>;
 
     fn next(&mut self) -> Option<Box<T>> {
-        self.raw.next().map(|x| unsafe { (*x).take().unchecked_unwrap() })
+        self.raw.next().map(
+            |x| unsafe { (*x).take().unchecked_unwrap() },
+        )
     }
 
     fn size_hint(&self) -> (usize, Option<usize>) {
         (self.raw.remaining, Some(self.raw.remaining))
     }
 }
 
 impl<T: ?Sized + Send> ExactSizeIterator for IntoIter<T> {}
@@ -480,54 +476,60 @@ impl<T: ?Sized + Send> CachedThreadLocal
             owner: AtomicUsize::new(0),
             local: UnsafeCell::new(None),
             global: ThreadLocal::new(),
         }
     }
 
     /// Returns the element for the current thread, if it exists.
     pub fn get(&self) -> Option<&T> {
-        let id = get_thread_id();
+        let id = thread_id::get();
         let owner = self.owner.load(Ordering::Relaxed);
         if owner == id {
             return unsafe { Some((*self.local.get()).as_ref().unchecked_unwrap()) };
         }
         if owner == 0 {
             return None;
         }
         self.global.get_fast(id)
     }
 
     /// Returns the element for the current thread, or creates it if it doesn't
     /// exist.
     #[inline(always)]
     pub fn get_or<F>(&self, create: F) -> &T
-        where F: FnOnce() -> Box<T>
+    where
+        F: FnOnce() -> Box<T>,
     {
-        unsafe { self.get_or_try(|| Ok::<Box<T>, ()>(create())).unchecked_unwrap_ok() }
+        unsafe {
+            self.get_or_try(|| Ok::<Box<T>, ()>(create()))
+                .unchecked_unwrap_ok()
+        }
     }
 
     /// Returns the element for the current thread, or creates it if it doesn't
     /// exist. If `create` fails, that error is returned and no element is
     /// added.
     pub fn get_or_try<F, E>(&self, create: F) -> Result<&T, E>
-        where F: FnOnce() -> Result<Box<T>, E>
+    where
+        F: FnOnce() -> Result<Box<T>, E>,
     {
-        let id = get_thread_id();
+        let id = thread_id::get();
         let owner = self.owner.load(Ordering::Relaxed);
         if owner == id {
             return Ok(unsafe { (*self.local.get()).as_ref().unchecked_unwrap() });
         }
         self.get_or_try_slow(id, owner, create)
     }
 
     #[cold]
     #[inline(never)]
     fn get_or_try_slow<F, E>(&self, id: usize, owner: usize, create: F) -> Result<&T, E>
-        where F: FnOnce() -> Result<Box<T>, E>
+    where
+        F: FnOnce() -> Result<Box<T>, E>,
     {
         if owner == 0 && self.owner.compare_and_swap(0, id, Ordering::Relaxed) == 0 {
             unsafe {
                 (*self.local.get()) = Some(try!(create()));
                 return Ok((*self.local.get()).as_ref().unchecked_unwrap());
             }
         }
         match self.global.get_fast(id) {
@@ -537,17 +539,22 @@ impl<T: ?Sized + Send> CachedThreadLocal
     }
 
     /// Returns a mutable iterator over the local values of all threads.
     ///
     /// Since this call borrows the `ThreadLocal` mutably, this operation can
     /// be done safely---the mutable borrow statically guarantees no other
     /// threads are currently accessing their associated values.
     pub fn iter_mut(&mut self) -> CachedIterMut<T> {
-        unsafe { (*self.local.get()).as_mut().into_iter().chain(self.global.iter_mut()) }
+        unsafe {
+            (*self.local.get()).as_mut().into_iter().chain(
+                self.global
+                    .iter_mut(),
+            )
+        }
     }
 
     /// Removes all thread-specific values from the `ThreadLocal`, effectively
     /// reseting it to its original state.
     ///
     /// Since this call borrows the `ThreadLocal` mutably, this operation can
     /// be done safely---the mutable borrow statically guarantees no other
     /// threads are currently accessing their associated values.
@@ -556,17 +563,22 @@ impl<T: ?Sized + Send> CachedThreadLocal
     }
 }
 
 impl<T: ?Sized + Send> IntoIterator for CachedThreadLocal<T> {
     type Item = Box<T>;
     type IntoIter = CachedIntoIter<T>;
 
     fn into_iter(self) -> CachedIntoIter<T> {
-        unsafe { (*self.local.get()).take().into_iter().chain(self.global.into_iter()) }
+        unsafe {
+            (*self.local.get()).take().into_iter().chain(
+                self.global
+                    .into_iter(),
+            )
+        }
     }
 }
 
 impl<'a, T: ?Sized + Send + 'a> IntoIterator for &'a mut CachedThreadLocal<T> {
     type Item = &'a mut Box<T>;
     type IntoIter = CachedIterMut<'a, T>;
 
     fn into_iter(self) -> CachedIterMut<'a, T> {
@@ -650,21 +662,20 @@ mod tests {
         let tls = Arc::new(ThreadLocal::new());
         assert_eq!(None, tls.get());
         assert_eq!(0, *tls.get_or(|| create()));
         assert_eq!(Some(&0), tls.get());
 
         let tls2 = tls.clone();
         let create2 = create.clone();
         thread::spawn(move || {
-                assert_eq!(None, tls2.get());
-                assert_eq!(1, *tls2.get_or(|| create2()));
-                assert_eq!(Some(&1), tls2.get());
-            })
-            .join()
+            assert_eq!(None, tls2.get());
+            assert_eq!(1, *tls2.get_or(|| create2()));
+            assert_eq!(Some(&1), tls2.get());
+        }).join()
             .unwrap();
 
         assert_eq!(Some(&0), tls.get());
         assert_eq!(0, *tls.get_or(|| create()));
     }
 
     #[test]
     fn different_thread_cached() {
@@ -672,43 +683,39 @@ mod tests {
         let tls = Arc::new(CachedThreadLocal::new());
         assert_eq!(None, tls.get());
         assert_eq!(0, *tls.get_or(|| create()));
         assert_eq!(Some(&0), tls.get());
 
         let tls2 = tls.clone();
         let create2 = create.clone();
         thread::spawn(move || {
-                assert_eq!(None, tls2.get());
-                assert_eq!(1, *tls2.get_or(|| create2()));
-                assert_eq!(Some(&1), tls2.get());
-            })
-            .join()
+            assert_eq!(None, tls2.get());
+            assert_eq!(1, *tls2.get_or(|| create2()));
+            assert_eq!(Some(&1), tls2.get());
+        }).join()
             .unwrap();
 
         assert_eq!(Some(&0), tls.get());
         assert_eq!(0, *tls.get_or(|| create()));
     }
 
     #[test]
     fn iter() {
         let tls = Arc::new(ThreadLocal::new());
         tls.get_or(|| Box::new(1));
 
         let tls2 = tls.clone();
         thread::spawn(move || {
-                tls2.get_or(|| Box::new(2));
-                let tls3 = tls2.clone();
-                thread::spawn(move || {
-                        tls3.get_or(|| Box::new(3));
-                    })
-                    .join()
-                    .unwrap();
-            })
-            .join()
+            tls2.get_or(|| Box::new(2));
+            let tls3 = tls2.clone();
+            thread::spawn(move || { tls3.get_or(|| Box::new(3)); })
+                .join()
+                .unwrap();
+        }).join()
             .unwrap();
 
         let mut tls = Arc::try_unwrap(tls).unwrap();
         let mut v = tls.iter_mut().map(|x| **x).collect::<Vec<i32>>();
         v.sort();
         assert_eq!(vec![1, 2, 3], v);
         let mut v = tls.into_iter().map(|x| *x).collect::<Vec<i32>>();
         v.sort();
@@ -717,25 +724,22 @@ mod tests {
 
     #[test]
     fn iter_cached() {
         let tls = Arc::new(CachedThreadLocal::new());
         tls.get_or(|| Box::new(1));
 
         let tls2 = tls.clone();
         thread::spawn(move || {
-                tls2.get_or(|| Box::new(2));
-                let tls3 = tls2.clone();
-                thread::spawn(move || {
-                        tls3.get_or(|| Box::new(3));
-                    })
-                    .join()
-                    .unwrap();
-            })
-            .join()
+            tls2.get_or(|| Box::new(2));
+            let tls3 = tls2.clone();
+            thread::spawn(move || { tls3.get_or(|| Box::new(3)); })
+                .join()
+                .unwrap();
+        }).join()
             .unwrap();
 
         let mut tls = Arc::try_unwrap(tls).unwrap();
         let mut v = tls.iter_mut().map(|x| **x).collect::<Vec<i32>>();
         v.sort();
         assert_eq!(vec![1, 2, 3], v);
         let mut v = tls.into_iter().map(|x| *x).collect::<Vec<i32>>();
         v.sort();
new file mode 100644
--- /dev/null
+++ b/third_party/rust/thread_local/src/thread_id.rs
@@ -0,0 +1,61 @@
+// Copyright 2017 Amanieu d'Antras
+//
+// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+// http://opensource.org/licenses/MIT>, at your option. This file may not be
+// copied, modified, or distributed except according to those terms.
+
+use std::collections::BinaryHeap;
+use std::sync::Mutex;
+use std::usize;
+
+// Thread ID manager which allocates thread IDs. It attempts to aggressively
+// reuse thread IDs where possible to avoid cases where a ThreadLocal grows
+// indefinitely when it is used by many short-lived threads.
+struct ThreadIdManager {
+    limit: usize,
+    free_list: BinaryHeap<usize>,
+}
+impl ThreadIdManager {
+    fn new() -> ThreadIdManager {
+        ThreadIdManager {
+            limit: usize::MAX,
+            free_list: BinaryHeap::new(),
+        }
+    }
+    fn alloc(&mut self) -> usize {
+        if let Some(id) = self.free_list.pop() {
+            id
+        } else {
+            let id = self.limit;
+            self.limit = self.limit.checked_sub(1).expect("Ran out of thread IDs");
+            id
+        }
+    }
+    fn free(&mut self, id: usize) {
+        self.free_list.push(id);
+    }
+}
+lazy_static! {
+    static ref THREAD_ID_MANAGER: Mutex<ThreadIdManager> = Mutex::new(ThreadIdManager::new());
+}
+
+// Non-zero integer which is unique to the current thread while it is running.
+// A thread ID may be reused after a thread exits.
+struct ThreadId(usize);
+impl ThreadId {
+    fn new() -> ThreadId {
+        ThreadId(THREAD_ID_MANAGER.lock().unwrap().alloc())
+    }
+}
+impl Drop for ThreadId {
+    fn drop(&mut self) {
+        THREAD_ID_MANAGER.lock().unwrap().free(self.0);
+    }
+}
+thread_local!(static THREAD_ID: ThreadId = ThreadId::new());
+
+/// Returns a non-zero ID for the current thread
+pub fn get() -> usize {
+    THREAD_ID.with(|x| x.0)
+}
copy from third_party/rust/time/.cargo-checksum.json
copy to third_party/rust/time-0.1.36/.cargo-checksum.json
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/.travis.yml
@@ -0,0 +1,27 @@
+language: rust
+rust:
+  - stable
+  - beta
+  - nightly
+sudo: false
+before_script:
+  - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
+script:
+  - cargo build --verbose
+  - cargo test --verbose
+  - cargo test --verbose --features rustc-serialize
+  - cargo doc --no-deps
+after_success:
+  - travis-cargo --only nightly doc-upload
+env:
+  global:
+    secure: "NlXnNaUBf2MgV2gPJyIQU+JM814e29itvvb8o5BvN4YB60rseu16yLbzKpO4FzuOFBc/Uc+1veDcKyzZYsdV6FIwQk4jfdUkNZ3i56InVCzXcaaHCe78cpg/IxK+/48fGy/EIJkWYdtQsoVCGunaf5NdF360Lzb6G/B1vheC34E="
+
+
+
+notifications:
+  email:
+    on_success: never
+os:
+  - linux
+  - osx
copy from third_party/rust/time/Cargo.toml
copy to third_party/rust/time-0.1.36/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/README.md
@@ -0,0 +1,30 @@
+time
+====
+
+Utilities for working with time-related functions in Rust
+
+[![Build Status](https://travis-ci.org/rust-lang-deprecated/time.svg?branch=master)](https://travis-ci.org/rust-lang-deprecated/time)
+[![Build status](https://ci.appveyor.com/api/projects/status/55m7rbaj9a5v3ad7?svg=true)](https://ci.appveyor.com/project/alexcrichton/time)
+
+[Documentation](https://doc.rust-lang.org/time)
+
+## Notes
+
+This library is no longer actively maintained, but bugfixes will be added ([details](https://github.com/rust-lang-deprecated/time/issues/136)).
+
+In case you're looking for something a little fresher and more actively maintained have a look at the [`chrono`](https://github.com/lifthrasiir/rust-chrono) crate.
+
+## Usage
+
+Put this in your `Cargo.toml`:
+
+```toml
+[dependencies]
+time = "0.1"
+```
+
+And this in your crate root:
+
+```rust
+extern crate time;
+```
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/appveyor.yml
@@ -0,0 +1,17 @@
+environment:
+  matrix:
+  - TARGET: x86_64-pc-windows-msvc
+  - TARGET: i686-pc-windows-msvc
+  - TARGET: i686-pc-windows-gnu
+install:
+  - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe"
+  - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
+  - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
+  - SET PATH=%PATH%;C:\MinGW\bin
+  - rustc -V
+  - cargo -V
+
+build: false
+
+test_script:
+  - cargo test --verbose
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/benches/precise_time_ns.rs
@@ -0,0 +1,11 @@
+#![feature(test)]
+
+extern crate test;
+extern crate time;
+
+use test::Bencher;
+
+#[bench]
+fn bench_precise_time_ns(b: &mut Bencher) {
+    b.iter(|| time::precise_time_ns())
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/src/display.rs
@@ -0,0 +1,260 @@
+use std::fmt::{self, Write};
+
+use super::{TmFmt, Tm, Fmt};
+
+impl<'a> fmt::Display for TmFmt<'a> {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+        match self.format {
+            Fmt::Str(ref s) => {
+                let mut chars = s.chars();
+                while let Some(ch) = chars.next() {
+                    if ch == '%' {
+                        // we've already validated that % always precedes
+                        // another char
+                        try!(parse_type(fmt, chars.next().unwrap(), self.tm));
+                    } else {
+                        try!(fmt.write_char(ch));
+                    }
+                }
+
+                Ok(())
+            }
+            Fmt::Ctime => self.tm.to_local().asctime().fmt(fmt),
+            Fmt::Rfc3339 => {
+                if self.tm.tm_utcoff == 0 {
+                    TmFmt {
+                        tm: self.tm,
+                        format: Fmt::Str("%Y-%m-%dT%H:%M:%SZ"),
+                    }.fmt(fmt)
+                } else {
+                    let s = TmFmt {
+                        tm: self.tm,
+                        format: Fmt::Str("%Y-%m-%dT%H:%M:%S"),
+                    };
+                    let sign = if self.tm.tm_utcoff > 0 { '+' } else { '-' };
+                    let mut m = abs(self.tm.tm_utcoff) / 60;
+                    let h = m / 60;
+                    m -= h * 60;
+                    write!(fmt, "{}{}{:02}:{:02}", s, sign, h, m)
+                }
+            }
+        }
+    }
+}
+
+fn is_leap_year(year: i32) -> bool {
+    (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))
+}
+
+fn days_in_year(year: i32) -> i32 {
+    if is_leap_year(year) { 366 }
+    else                  { 365 }
+}
+
+fn iso_week_days(yday: i32, wday: i32) -> i32 {
+    /* The number of days from the first day of the first ISO week of this
+    * year to the year day YDAY with week day WDAY.
+    * ISO weeks start on Monday. The first ISO week has the year's first
+    * Thursday.
+    * YDAY may be as small as yday_minimum.
+    */
+    let iso_week_start_wday: i32 = 1;                     /* Monday */
+    let iso_week1_wday: i32 = 4;                          /* Thursday */
+    let yday_minimum: i32 = 366;
+    /* Add enough to the first operand of % to make it nonnegative. */
+    let big_enough_multiple_of_7: i32 = (yday_minimum / 7 + 2) * 7;
+
+    yday - (yday - wday + iso_week1_wday + big_enough_multiple_of_7) % 7
+        + iso_week1_wday - iso_week_start_wday
+}
+
+fn iso_week(fmt: &mut fmt::Formatter, ch:char, tm: &Tm) -> fmt::Result {
+    let mut year = tm.tm_year + 1900;
+    let mut days = iso_week_days(tm.tm_yday, tm.tm_wday);
+
+    if days < 0 {
+        /* This ISO week belongs to the previous year. */
+        year -= 1;
+        days = iso_week_days(tm.tm_yday + (days_in_year(year)), tm.tm_wday);
+    } else {
+        let d = iso_week_days(tm.tm_yday - (days_in_year(year)),
+                              tm.tm_wday);
+        if 0 <= d {
+            /* This ISO week belongs to the next year. */
+            year += 1;
+            days = d;
+        }
+    }
+
+    match ch {
+        'G' => write!(fmt, "{}", year),
+        'g' => write!(fmt, "{:02}", (year % 100 + 100) % 100),
+        'V' => write!(fmt, "{:02}", days / 7 + 1),
+        _ => Ok(())
+    }
+}
+
+fn parse_type(fmt: &mut fmt::Formatter, ch: char, tm: &Tm) -> fmt::Result {
+    match ch {
+        'A' => fmt.write_str(match tm.tm_wday {
+            0 => "Sunday",
+            1 => "Monday",
+            2 => "Tuesday",
+            3 => "Wednesday",
+            4 => "Thursday",
+            5 => "Friday",
+            6 => "Saturday",
+            _ => unreachable!(),
+        }),
+        'a' => fmt.write_str(match tm.tm_wday {
+            0 => "Sun",
+            1 => "Mon",
+            2 => "Tue",
+            3 => "Wed",
+            4 => "Thu",
+            5 => "Fri",
+            6 => "Sat",
+            _ => unreachable!(),
+        }),
+        'B' => fmt.write_str(match tm.tm_mon {
+            0 => "January",
+            1 => "February",
+            2 => "March",
+            3 => "April",
+            4 => "May",
+            5 => "June",
+            6 => "July",
+            7 => "August",
+            8 => "September",
+            9 => "October",
+            10 => "November",
+            11 => "December",
+            _ => unreachable!(),
+        }),
+        'b' | 'h' => fmt.write_str(match tm.tm_mon {
+            0 => "Jan",
+            1 => "Feb",
+            2 => "Mar",
+            3 => "Apr",
+            4 => "May",
+            5 => "Jun",
+            6 => "Jul",
+            7 => "Aug",
+            8 => "Sep",
+            9 => "Oct",
+            10 => "Nov",
+            11 => "Dec",
+            _  => unreachable!(),
+        }),
+        'C' => write!(fmt, "{:02}", (tm.tm_year + 1900) / 100),
+        'c' => {
+            try!(parse_type(fmt, 'a', tm));
+            try!(fmt.write_str(" "));
+            try!(parse_type(fmt, 'b', tm));
+            try!(fmt.write_str(" "));
+            try!(parse_type(fmt, 'e', tm));
+            try!(fmt.write_str(" "));
+            try!(parse_type(fmt, 'T', tm));
+            try!(fmt.write_str(" "));
+            parse_type(fmt, 'Y', tm)
+        }
+        'D' | 'x' => {
+            try!(parse_type(fmt, 'm', tm));
+            try!(fmt.write_str("/"));
+            try!(parse_type(fmt, 'd', tm));
+            try!(fmt.write_str("/"));
+            parse_type(fmt, 'y', tm)
+        }
+        'd' => write!(fmt, "{:02}", tm.tm_mday),
+        'e' => write!(fmt, "{:2}", tm.tm_mday),
+        'f' => write!(fmt, "{:09}", tm.tm_nsec),
+        'F' => {
+            try!(parse_type(fmt, 'Y', tm));
+            try!(fmt.write_str("-"));
+            try!(parse_type(fmt, 'm', tm));
+            try!(fmt.write_str("-"));
+            parse_type(fmt, 'd', tm)
+        }
+        'G' => iso_week(fmt, 'G', tm),
+        'g' => iso_week(fmt, 'g', tm),
+        'H' => write!(fmt, "{:02}", tm.tm_hour),
+        'I' => {
+            let mut h = tm.tm_hour;
+            if h == 0 { h = 12 }
+            if h > 12 { h -= 12 }
+            write!(fmt, "{:02}", h)
+        }
+        'j' => write!(fmt, "{:03}", tm.tm_yday + 1),
+        'k' => write!(fmt, "{:2}", tm.tm_hour),
+        'l' => {
+            let mut h = tm.tm_hour;
+            if h == 0 { h = 12 }
+            if h > 12 { h -= 12 }
+            write!(fmt, "{:2}", h)
+        }
+        'M' => write!(fmt, "{:02}", tm.tm_min),
+        'm' => write!(fmt, "{:02}", tm.tm_mon + 1),
+        'n' => fmt.write_str("\n"),
+        'P' => fmt.write_str(if tm.tm_hour < 12 { "am" } else { "pm" }),
+        'p' => fmt.write_str(if (tm.tm_hour) < 12 { "AM" } else { "PM" }),
+        'R' => {
+            try!(parse_type(fmt, 'H', tm));
+            try!(fmt.write_str(":"));
+            parse_type(fmt, 'M', tm)
+        }
+        'r' => {
+            try!(parse_type(fmt, 'I', tm));
+            try!(fmt.write_str(":"));
+            try!(parse_type(fmt, 'M', tm));
+            try!(fmt.write_str(":"));
+            try!(parse_type(fmt, 'S', tm));
+            try!(fmt.write_str(" "));
+            parse_type(fmt, 'p', tm)
+        }
+        'S' => write!(fmt, "{:02}", tm.tm_sec),
+        's' => write!(fmt, "{}", tm.to_timespec().sec),
+        'T' | 'X' => {
+            try!(parse_type(fmt, 'H', tm));
+            try!(fmt.write_str(":"));
+            try!(parse_type(fmt, 'M', tm));
+            try!(fmt.write_str(":"));
+            parse_type(fmt, 'S', tm)
+        }
+        't' => fmt.write_str("\t"),
+        'U' => write!(fmt, "{:02}", (tm.tm_yday - tm.tm_wday + 7) / 7),
+        'u' => {
+            let i = tm.tm_wday;
+            write!(fmt, "{}", (if i == 0 { 7 } else { i }))
+        }
+        'V' => iso_week(fmt, 'V', tm),
+        'v' => {
+            try!(parse_type(fmt, 'e', tm));
+            try!(fmt.write_str("-"));
+            try!(parse_type(fmt, 'b', tm));
+            try!(fmt.write_str("-"));
+            parse_type(fmt, 'Y', tm)
+        }
+        'W' => {
+            write!(fmt, "{:02}", (tm.tm_yday - (tm.tm_wday - 1 + 7) % 7 + 7) / 7)
+        }
+        'w' => write!(fmt, "{}", tm.tm_wday),
+        'Y' => write!(fmt, "{}", tm.tm_year + 1900),
+        'y' => write!(fmt, "{:02}", (tm.tm_year + 1900) % 100),
+        // FIXME (#2350): support locale
+        'Z' => fmt.write_str(if tm.tm_utcoff == 0 { "UTC"} else { "" }),
+        'z' => {
+            let sign = if tm.tm_utcoff > 0 { '+' } else { '-' };
+            let mut m = abs(tm.tm_utcoff) / 60;
+            let h = m / 60;
+            m -= h * 60;
+            write!(fmt, "{}{:02}{:02}", sign, h, m)
+        }
+        '+' => write!(fmt, "{}", tm.rfc3339()),
+        '%' => fmt.write_str("%"),
+        _   => unreachable!(),
+    }
+}
+
+fn abs(i: i32) -> i32 {
+    if i < 0 {-i} else {i}
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/src/duration.rs
@@ -0,0 +1,648 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Temporal quantification
+
+use std::{fmt, i64};
+use std::error::Error;
+use std::ops::{Add, Sub, Mul, Div, Neg, FnOnce};
+use std::time::Duration as StdDuration;
+
+/// The number of nanoseconds in a microsecond.
+const NANOS_PER_MICRO: i32 = 1000;
+/// The number of nanoseconds in a millisecond.
+const NANOS_PER_MILLI: i32 = 1000_000;
+/// The number of nanoseconds in seconds.
+const NANOS_PER_SEC: i32 = 1_000_000_000;
+/// The number of microseconds per second.
+const MICROS_PER_SEC: i64 = 1000_000;
+/// The number of milliseconds per second.
+const MILLIS_PER_SEC: i64 = 1000;
+/// The number of seconds in a minute.
+const SECS_PER_MINUTE: i64 = 60;
+/// The number of seconds in an hour.
+const SECS_PER_HOUR: i64 = 3600;
+/// The number of (non-leap) seconds in days.
+const SECS_PER_DAY: i64 = 86400;
+/// The number of (non-leap) seconds in a week.
+const SECS_PER_WEEK: i64 = 604800;
+
+macro_rules! try_opt {
+    ($e:expr) => (match $e { Some(v) => v, None => return None })
+}
+
+
+/// ISO 8601 time duration with nanosecond precision.
+/// This also allows for the negative duration; see individual methods for details.
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
+pub struct Duration {
+    secs: i64,
+    nanos: i32, // Always 0 <= nanos < NANOS_PER_SEC
+}
+
+/// The minimum possible `Duration`: `i64::MIN` milliseconds.
+pub const MIN: Duration = Duration {
+    secs: i64::MIN / MILLIS_PER_SEC - 1,
+    nanos: NANOS_PER_SEC + (i64::MIN % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI
+};
+
+/// The maximum possible `Duration`: `i64::MAX` milliseconds.
+pub const MAX: Duration = Duration {
+    secs: i64::MAX / MILLIS_PER_SEC,
+    nanos: (i64::MAX % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI
+};
+
+impl Duration {
+    /// Makes a new `Duration` with given number of weeks.
+    /// Equivalent to `Duration::seconds(weeks * 7 * 24 * 60 * 60)` with overflow checks.
+    /// Panics when the duration is out of bounds.
+    #[inline]
+    pub fn weeks(weeks: i64) -> Duration {
+        let secs = weeks.checked_mul(SECS_PER_WEEK).expect("Duration::weeks out of bounds");
+        Duration::seconds(secs)
+    }
+
+    /// Makes a new `Duration` with given number of days.
+    /// Equivalent to `Duration::seconds(days * 24 * 60 * 60)` with overflow checks.
+    /// Panics when the duration is out of bounds.
+    #[inline]
+    pub fn days(days: i64) -> Duration {
+        let secs = days.checked_mul(SECS_PER_DAY).expect("Duration::days out of bounds");
+        Duration::seconds(secs)
+    }
+
+    /// Makes a new `Duration` with given number of hours.
+    /// Equivalent to `Duration::seconds(hours * 60 * 60)` with overflow checks.
+    /// Panics when the duration is out of bounds.
+    #[inline]
+    pub fn hours(hours: i64) -> Duration {
+        let secs = hours.checked_mul(SECS_PER_HOUR).expect("Duration::hours ouf of bounds");
+        Duration::seconds(secs)
+    }
+
+    /// Makes a new `Duration` with given number of minutes.
+    /// Equivalent to `Duration::seconds(minutes * 60)` with overflow checks.
+    /// Panics when the duration is out of bounds.
+    #[inline]
+    pub fn minutes(minutes: i64) -> Duration {
+        let secs = minutes.checked_mul(SECS_PER_MINUTE).expect("Duration::minutes out of bounds");
+        Duration::seconds(secs)
+    }
+
+    /// Makes a new `Duration` with given number of seconds.
+    /// Panics when the duration is more than `i64::MAX` milliseconds
+    /// or less than `i64::MIN` milliseconds.
+    #[inline]
+    pub fn seconds(seconds: i64) -> Duration {
+        let d = Duration { secs: seconds, nanos: 0 };
+        if d < MIN || d > MAX {
+            panic!("Duration::seconds out of bounds");
+        }
+        d
+    }
+
+    /// Makes a new `Duration` with given number of milliseconds.
+    #[inline]
+    pub fn milliseconds(milliseconds: i64) -> Duration {
+        let (secs, millis) = div_mod_floor_64(milliseconds, MILLIS_PER_SEC);
+        let nanos = millis as i32 * NANOS_PER_MILLI;
+        Duration { secs: secs, nanos: nanos }
+    }
+
+    /// Makes a new `Duration` with given number of microseconds.
+    #[inline]
+    pub fn microseconds(microseconds: i64) -> Duration {
+        let (secs, micros) = div_mod_floor_64(microseconds, MICROS_PER_SEC);
+        let nanos = micros as i32 * NANOS_PER_MICRO;
+        Duration { secs: secs, nanos: nanos }
+    }
+
+    /// Makes a new `Duration` with given number of nanoseconds.
+    #[inline]
+    pub fn nanoseconds(nanos: i64) -> Duration {
+        let (secs, nanos) = div_mod_floor_64(nanos, NANOS_PER_SEC as i64);
+        Duration { secs: secs, nanos: nanos as i32 }
+    }
+
+    /// Runs a closure, returning the duration of time it took to run the
+    /// closure.
+    pub fn span<F>(f: F) -> Duration where F: FnOnce() {
+        let before = super::precise_time_ns();
+        f();
+        Duration::nanoseconds((super::precise_time_ns() - before) as i64)
+    }
+
+    /// Returns the total number of whole weeks in the duration.
+    #[inline]
+    pub fn num_weeks(&self) -> i64 {
+        self.num_days() / 7
+    }
+
+    /// Returns the total number of whole days in the duration.
+    pub fn num_days(&self) -> i64 {
+        self.num_seconds() / SECS_PER_DAY
+    }
+
+    /// Returns the total number of whole hours in the duration.
+    #[inline]
+    pub fn num_hours(&self) -> i64 {
+        self.num_seconds() / SECS_PER_HOUR
+    }
+
+    /// Returns the total number of whole minutes in the duration.
+    #[inline]
+    pub fn num_minutes(&self) -> i64 {
+        self.num_seconds() / SECS_PER_MINUTE
+    }
+
+    /// Returns the total number of whole seconds in the duration.
+    pub fn num_seconds(&self) -> i64 {
+        // If secs is negative, nanos should be subtracted from the duration.
+        if self.secs < 0 && self.nanos > 0 {
+            self.secs + 1
+        } else {
+            self.secs
+        }
+    }
+
+    /// Returns the number of nanoseconds such that
+    /// `nanos_mod_sec() + num_seconds() * NANOS_PER_SEC` is the total number of
+    /// nanoseconds in the duration.
+    fn nanos_mod_sec(&self) -> i32 {
+        if self.secs < 0 && self.nanos > 0 {
+            self.nanos - NANOS_PER_SEC
+        } else {
+            self.nanos
+        }
+    }
+
+    /// Returns the total number of whole milliseconds in the duration,
+    pub fn num_milliseconds(&self) -> i64 {
+        // A proper Duration will not overflow, because MIN and MAX are defined
+        // such that the range is exactly i64 milliseconds.
+        let secs_part = self.num_seconds() * MILLIS_PER_SEC;
+        let nanos_part = self.nanos_mod_sec() / NANOS_PER_MILLI;
+        secs_part + nanos_part as i64
+    }
+
+    /// Returns the total number of whole microseconds in the duration,
+    /// or `None` on overflow (exceeding 2^63 microseconds in either direction).
+    pub fn num_microseconds(&self) -> Option<i64> {
+        let secs_part = try_opt!(self.num_seconds().checked_mul(MICROS_PER_SEC));
+        let nanos_part = self.nanos_mod_sec() / NANOS_PER_MICRO;
+        secs_part.checked_add(nanos_part as i64)
+    }
+
+    /// Returns the total number of whole nanoseconds in the duration,
+    /// or `None` on overflow (exceeding 2^63 nanoseconds in either direction).
+    pub fn num_nanoseconds(&self) -> Option<i64> {
+        let secs_part = try_opt!(self.num_seconds().checked_mul(NANOS_PER_SEC as i64));
+        let nanos_part = self.nanos_mod_sec();
+        secs_part.checked_add(nanos_part as i64)
+    }
+
+    /// Add two durations, returning `None` if overflow occurred.
+    pub fn checked_add(&self, rhs: &Duration) -> Option<Duration> {
+        let mut secs = try_opt!(self.secs.checked_add(rhs.secs));
+        let mut nanos = self.nanos + rhs.nanos;
+        if nanos >= NANOS_PER_SEC {
+            nanos -= NANOS_PER_SEC;
+            secs = try_opt!(secs.checked_add(1));
+        }
+        let d = Duration { secs: secs, nanos: nanos };
+        // Even if d is within the bounds of i64 seconds,
+        // it might still overflow i64 milliseconds.
+        if d < MIN || d > MAX { None } else { Some(d) }
+    }
+
+    /// Subtract two durations, returning `None` if overflow occurred.
+    pub fn checked_sub(&self, rhs: &Duration) -> Option<Duration> {
+        let mut secs = try_opt!(self.secs.checked_sub(rhs.secs));
+        let mut nanos = self.nanos - rhs.nanos;
+        if nanos < 0 {
+            nanos += NANOS_PER_SEC;
+            secs = try_opt!(secs.checked_sub(1));
+        }
+        let d = Duration { secs: secs, nanos: nanos };
+        // Even if d is within the bounds of i64 seconds,
+        // it might still overflow i64 milliseconds.
+        if d < MIN || d > MAX { None } else { Some(d) }
+    }
+
+    /// The minimum possible `Duration`: `i64::MIN` milliseconds.
+    #[inline]
+    pub fn min_value() -> Duration { MIN }
+
+    /// The maximum possible `Duration`: `i64::MAX` milliseconds.
+    #[inline]
+    pub fn max_value() -> Duration { MAX }
+
+    /// A duration where the stored seconds and nanoseconds are equal to zero.
+    #[inline]
+    pub fn zero() -> Duration {
+        Duration { secs: 0, nanos: 0 }
+    }
+
+    /// Returns `true` if the duration equals `Duration::zero()`.
+    #[inline]
+    pub fn is_zero(&self) -> bool {
+        self.secs == 0 && self.nanos == 0
+    }
+
+    /// Creates a `time::Duration` object from `std::time::Duration`
+    ///
+    /// This function errors when original duration is larger than the maximum
+    /// value supported for this type.
+    pub fn from_std(duration: StdDuration) -> Result<Duration, OutOfRangeError> {
+        // We need to check secs as u64 before coercing to i64
+        if duration.as_secs() > MAX.secs as u64 {
+            return Err(OutOfRangeError(()));
+        }
+        let d = Duration {
+            secs: duration.as_secs() as i64,
+            nanos: duration.subsec_nanos() as i32,
+        };
+        if d > MAX {
+            return Err(OutOfRangeError(()));
+        }
+        Ok(d)
+    }
+
+    /// Creates a `std::time::Duration` object from `time::Duration`
+    ///
+    /// This function errors when duration is less than zero. As standard
+    /// library implementation is limited to non-negative values.
+    pub fn to_std(&self) -> Result<StdDuration, OutOfRangeError> {
+        if self.secs < 0 {
+            return Err(OutOfRangeError(()));
+        }
+        Ok(StdDuration::new(self.secs as u64, self.nanos as u32))
+    }
+}
+
+impl Neg for Duration {
+    type Output = Duration;
+
+    #[inline]
+    fn neg(self) -> Duration {
+        if self.nanos == 0 {
+            Duration { secs: -self.secs, nanos: 0 }
+        } else {
+            Duration { secs: -self.secs - 1, nanos: NANOS_PER_SEC - self.nanos }
+        }
+    }
+}
+
+impl Add for Duration {
+    type Output = Duration;
+
+    fn add(self, rhs: Duration) -> Duration {
+        let mut secs = self.secs + rhs.secs;
+        let mut nanos = self.nanos + rhs.nanos;
+        if nanos >= NANOS_PER_SEC {
+            nanos -= NANOS_PER_SEC;
+            secs += 1;
+        }
+        Duration { secs: secs, nanos: nanos }
+    }
+}
+
+impl Sub for Duration {
+    type Output = Duration;
+
+    fn sub(self, rhs: Duration) -> Duration {
+        let mut secs = self.secs - rhs.secs;
+        let mut nanos = self.nanos - rhs.nanos;
+        if nanos < 0 {
+            nanos += NANOS_PER_SEC;
+            secs -= 1;
+        }
+        Duration { secs: secs, nanos: nanos }
+    }
+}
+
+impl Mul<i32> for Duration {
+    type Output = Duration;
+
+    fn mul(self, rhs: i32) -> Duration {
+        // Multiply nanoseconds as i64, because it cannot overflow that way.
+        let total_nanos = self.nanos as i64 * rhs as i64;
+        let (extra_secs, nanos) = div_mod_floor_64(total_nanos, NANOS_PER_SEC as i64);
+        let secs = self.secs * rhs as i64 + extra_secs;
+        Duration { secs: secs, nanos: nanos as i32 }
+    }
+}
+
+impl Div<i32> for Duration {
+    type Output = Duration;
+
+    fn div(self, rhs: i32) -> Duration {
+        let mut secs = self.secs / rhs as i64;
+        let carry = self.secs - secs * rhs as i64;
+        let extra_nanos = carry * NANOS_PER_SEC as i64 / rhs as i64;
+        let mut nanos = self.nanos / rhs + extra_nanos as i32;
+        if nanos >= NANOS_PER_SEC {
+            nanos -= NANOS_PER_SEC;
+            secs += 1;
+        }
+        if nanos < 0 {
+            nanos += NANOS_PER_SEC;
+            secs -= 1;
+        }
+        Duration { secs: secs, nanos: nanos }
+    }
+}
+
+impl fmt::Display for Duration {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        // technically speaking, negative duration is not valid ISO 8601,
+        // but we need to print it anyway.
+        let (abs, sign) = if self.secs < 0 { (-*self, "-") } else { (*self, "") };
+
+        let days = abs.secs / SECS_PER_DAY;
+        let secs = abs.secs - days * SECS_PER_DAY;
+        let hasdate = days != 0;
+        let hastime = (secs != 0 || abs.nanos != 0) || !hasdate;
+
+        try!(write!(f, "{}P", sign));
+
+        if hasdate {
+            try!(write!(f, "{}D", days));
+        }
+        if hastime {
+            if abs.nanos == 0 {
+                try!(write!(f, "T{}S", secs));
+            } else if abs.nanos % NANOS_PER_MILLI == 0 {
+                try!(write!(f, "T{}.{:03}S", secs, abs.nanos / NANOS_PER_MILLI));
+            } else if abs.nanos % NANOS_PER_MICRO == 0 {
+                try!(write!(f, "T{}.{:06}S", secs, abs.nanos / NANOS_PER_MICRO));
+            } else {
+                try!(write!(f, "T{}.{:09}S", secs, abs.nanos));
+            }
+        }
+        Ok(())
+    }
+}
+
+/// Represents error when converting `Duration` to/from a standard library
+/// implementation
+///
+/// The `std::time::Duration` supports a range from zero to `u64::MAX`
+/// *seconds*, while this module supports signed range of up to
+/// `i64::MAX` of *milliseconds*.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub struct OutOfRangeError(());
+
+impl fmt::Display for OutOfRangeError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{}", self.description())
+    }
+}
+
+impl Error for OutOfRangeError {
+    fn description(&self) -> &str {
+        "Source duration value is out of range for the target type"
+    }
+}
+
+// Copied from libnum
+#[inline]
+fn div_mod_floor_64(this: i64, other: i64) -> (i64, i64) {
+    (div_floor_64(this, other), mod_floor_64(this, other))
+}
+
+#[inline]
+fn div_floor_64(this: i64, other: i64) -> i64 {
+    match div_rem_64(this, other) {
+        (d, r) if (r > 0 && other < 0)
+               || (r < 0 && other > 0) => d - 1,
+        (d, _)                         => d,
+    }
+}
+
+#[inline]
+fn mod_floor_64(this: i64, other: i64) -> i64 {
+    match this % other {
+        r if (r > 0 && other < 0)
+          || (r < 0 && other > 0) => r + other,
+        r                         => r,
+    }
+}
+
+#[inline]
+fn div_rem_64(this: i64, other: i64) -> (i64, i64) {
+    (this / other, this % other)
+}
+
+#[cfg(test)]
+mod tests {
+    use super::{Duration, MIN, MAX, OutOfRangeError};
+    use std::{i32, i64};
+    use std::time::Duration as StdDuration;
+
+    #[test]
+    fn test_duration() {
+        assert!(Duration::seconds(1) != Duration::zero());
+        assert_eq!(Duration::seconds(1) + Duration::seconds(2), Duration::seconds(3));
+        assert_eq!(Duration::seconds(86399) + Duration::seconds(4),
+                   Duration::days(1) + Duration::seconds(3));
+        assert_eq!(Duration::days(10) - Duration::seconds(1000), Duration::seconds(863000));
+        assert_eq!(Duration::days(10) - Duration::seconds(1000000), Duration::seconds(-136000));
+        assert_eq!(Duration::days(2) + Duration::seconds(86399) +
+                   Duration::nanoseconds(1234567890),
+                   Duration::days(3) + Duration::nanoseconds(234567890));
+        assert_eq!(-Duration::days(3), Duration::days(-3));
+        assert_eq!(-(Duration::days(3) + Duration::seconds(70)),
+                   Duration::days(-4) + Duration::seconds(86400-70));
+    }
+
+    #[test]
+    fn test_duration_num_days() {
+        assert_eq!(Duration::zero().num_days(), 0);
+        assert_eq!(Duration::days(1).num_days(), 1);
+        assert_eq!(Duration::days(-1).num_days(), -1);
+        assert_eq!(Duration::seconds(86399).num_days(), 0);
+        assert_eq!(Duration::seconds(86401).num_days(), 1);
+        assert_eq!(Duration::seconds(-86399).num_days(), 0);
+        assert_eq!(Duration::seconds(-86401).num_days(), -1);
+        assert_eq!(Duration::days(i32::MAX as i64).num_days(), i32::MAX as i64);
+        assert_eq!(Duration::days(i32::MIN as i64).num_days(), i32::MIN as i64);
+    }
+
+    #[test]
+    fn test_duration_num_seconds() {
+        assert_eq!(Duration::zero().num_seconds(), 0);
+        assert_eq!(Duration::seconds(1).num_seconds(), 1);
+        assert_eq!(Duration::seconds(-1).num_seconds(), -1);
+        assert_eq!(Duration::milliseconds(999).num_seconds(), 0);
+        assert_eq!(Duration::milliseconds(1001).num_seconds(), 1);
+        assert_eq!(Duration::milliseconds(-999).num_seconds(), 0);
+        assert_eq!(Duration::milliseconds(-1001).num_seconds(), -1);
+    }
+
+    #[test]
+    fn test_duration_num_milliseconds() {
+        assert_eq!(Duration::zero().num_milliseconds(), 0);
+        assert_eq!(Duration::milliseconds(1).num_milliseconds(), 1);
+        assert_eq!(Duration::milliseconds(-1).num_milliseconds(), -1);
+        assert_eq!(Duration::microseconds(999).num_milliseconds(), 0);
+        assert_eq!(Duration::microseconds(1001).num_milliseconds(), 1);
+        assert_eq!(Duration::microseconds(-999).num_milliseconds(), 0);
+        assert_eq!(Duration::microseconds(-1001).num_milliseconds(), -1);
+        assert_eq!(Duration::milliseconds(i64::MAX).num_milliseconds(), i64::MAX);
+        assert_eq!(Duration::milliseconds(i64::MIN).num_milliseconds(), i64::MIN);
+        assert_eq!(MAX.num_milliseconds(), i64::MAX);
+        assert_eq!(MIN.num_milliseconds(), i64::MIN);
+    }
+
+    #[test]
+    fn test_duration_num_microseconds() {
+        assert_eq!(Duration::zero().num_microseconds(), Some(0));
+        assert_eq!(Duration::microseconds(1).num_microseconds(), Some(1));
+        assert_eq!(Duration::microseconds(-1).num_microseconds(), Some(-1));
+        assert_eq!(Duration::nanoseconds(999).num_microseconds(), Some(0));
+        assert_eq!(Duration::nanoseconds(1001).num_microseconds(), Some(1));
+        assert_eq!(Duration::nanoseconds(-999).num_microseconds(), Some(0));
+        assert_eq!(Duration::nanoseconds(-1001).num_microseconds(), Some(-1));
+        assert_eq!(Duration::microseconds(i64::MAX).num_microseconds(), Some(i64::MAX));
+        assert_eq!(Duration::microseconds(i64::MIN).num_microseconds(), Some(i64::MIN));
+        assert_eq!(MAX.num_microseconds(), None);
+        assert_eq!(MIN.num_microseconds(), None);
+
+        // overflow checks
+        const MICROS_PER_DAY: i64 = 86400_000_000;
+        assert_eq!(Duration::days(i64::MAX / MICROS_PER_DAY).num_microseconds(),
+                   Some(i64::MAX / MICROS_PER_DAY * MICROS_PER_DAY));
+        assert_eq!(Duration::days(i64::MIN / MICROS_PER_DAY).num_microseconds(),
+                   Some(i64::MIN / MICROS_PER_DAY * MICROS_PER_DAY));
+        assert_eq!(Duration::days(i64::MAX / MICROS_PER_DAY + 1).num_microseconds(), None);
+        assert_eq!(Duration::days(i64::MIN / MICROS_PER_DAY - 1).num_microseconds(), None);
+    }
+
+    #[test]
+    fn test_duration_num_nanoseconds() {
+        assert_eq!(Duration::zero().num_nanoseconds(), Some(0));
+        assert_eq!(Duration::nanoseconds(1).num_nanoseconds(), Some(1));
+        assert_eq!(Duration::nanoseconds(-1).num_nanoseconds(), Some(-1));
+        assert_eq!(Duration::nanoseconds(i64::MAX).num_nanoseconds(), Some(i64::MAX));
+        assert_eq!(Duration::nanoseconds(i64::MIN).num_nanoseconds(), Some(i64::MIN));
+        assert_eq!(MAX.num_nanoseconds(), None);
+        assert_eq!(MIN.num_nanoseconds(), None);
+
+        // overflow checks
+        const NANOS_PER_DAY: i64 = 86400_000_000_000;
+        assert_eq!(Duration::days(i64::MAX / NANOS_PER_DAY).num_nanoseconds(),
+                   Some(i64::MAX / NANOS_PER_DAY * NANOS_PER_DAY));
+        assert_eq!(Duration::days(i64::MIN / NANOS_PER_DAY).num_nanoseconds(),
+                   Some(i64::MIN / NANOS_PER_DAY * NANOS_PER_DAY));
+        assert_eq!(Duration::days(i64::MAX / NANOS_PER_DAY + 1).num_nanoseconds(), None);
+        assert_eq!(Duration::days(i64::MIN / NANOS_PER_DAY - 1).num_nanoseconds(), None);
+    }
+
+    #[test]
+    fn test_duration_checked_ops() {
+        assert_eq!(Duration::milliseconds(i64::MAX - 1).checked_add(&Duration::microseconds(999)),
+                   Some(Duration::milliseconds(i64::MAX - 2) + Duration::microseconds(1999)));
+        assert!(Duration::milliseconds(i64::MAX).checked_add(&Duration::microseconds(1000))
+                                                .is_none());
+
+        assert_eq!(Duration::milliseconds(i64::MIN).checked_sub(&Duration::milliseconds(0)),
+                   Some(Duration::milliseconds(i64::MIN)));
+        assert!(Duration::milliseconds(i64::MIN).checked_sub(&Duration::milliseconds(1))
+                                                .is_none());
+    }
+
+    #[test]
+    fn test_duration_mul() {
+        assert_eq!(Duration::zero() * i32::MAX, Duration::zero());
+        assert_eq!(Duration::zero() * i32::MIN, Duration::zero());
+        assert_eq!(Duration::nanoseconds(1) * 0, Duration::zero());
+        assert_eq!(Duration::nanoseconds(1) * 1, Duration::nanoseconds(1));
+        assert_eq!(Duration::nanoseconds(1) * 1_000_000_000, Duration::seconds(1));
+        assert_eq!(Duration::nanoseconds(1) * -1_000_000_000, -Duration::seconds(1));
+        assert_eq!(-Duration::nanoseconds(1) * 1_000_000_000, -Duration::seconds(1));
+        assert_eq!(Duration::nanoseconds(30) * 333_333_333,
+                   Duration::seconds(10) - Duration::nanoseconds(10));
+        assert_eq!((Duration::nanoseconds(1) + Duration::seconds(1) + Duration::days(1)) * 3,
+                   Duration::nanoseconds(3) + Duration::seconds(3) + Duration::days(3));
+        assert_eq!(Duration::milliseconds(1500) * -2, Duration::seconds(-3));
+        assert_eq!(Duration::milliseconds(-1500) * 2, Duration::seconds(-3));
+    }
+
+    #[test]
+    fn test_duration_div() {
+        assert_eq!(Duration::zero() / i32::MAX, Duration::zero());
+        assert_eq!(Duration::zero() / i32::MIN, Duration::zero());
+        assert_eq!(Duration::nanoseconds(123_456_789) / 1, Duration::nanoseconds(123_456_789));
+        assert_eq!(Duration::nanoseconds(123_456_789) / -1, -Duration::nanoseconds(123_456_789));
+        assert_eq!(-Duration::nanoseconds(123_456_789) / -1, Duration::nanoseconds(123_456_789));
+        assert_eq!(-Duration::nanoseconds(123_456_789) / 1, -Duration::nanoseconds(123_456_789));
+        assert_eq!(Duration::seconds(1) / 3, Duration::nanoseconds(333_333_333));
+        assert_eq!(Duration::seconds(4) / 3, Duration::nanoseconds(1_333_333_333));
+        assert_eq!(Duration::seconds(-1) / 2, Duration::milliseconds(-500));
+        assert_eq!(Duration::seconds(1) / -2, Duration::milliseconds(-500));
+        assert_eq!(Duration::seconds(-1) / -2, Duration::milliseconds(500));
+        assert_eq!(Duration::seconds(-4) / 3, Duration::nanoseconds(-1_333_333_333));
+        assert_eq!(Duration::seconds(-4) / -3, Duration::nanoseconds(1_333_333_333));
+    }
+
+    #[test]
+    fn test_duration_fmt() {
+        assert_eq!(Duration::zero().to_string(), "PT0S");
+        assert_eq!(Duration::days(42).to_string(), "P42D");
+        assert_eq!(Duration::days(-42).to_string(), "-P42D");
+        assert_eq!(Duration::seconds(42).to_string(), "PT42S");
+        assert_eq!(Duration::milliseconds(42).to_string(), "PT0.042S");
+        assert_eq!(Duration::microseconds(42).to_string(), "PT0.000042S");
+        assert_eq!(Duration::nanoseconds(42).to_string(), "PT0.000000042S");
+        assert_eq!((Duration::days(7) + Duration::milliseconds(6543)).to_string(),
+                   "P7DT6.543S");
+        assert_eq!(Duration::seconds(-86401).to_string(), "-P1DT1S");
+        assert_eq!(Duration::nanoseconds(-1).to_string(), "-PT0.000000001S");
+
+        // the format specifier should have no effect on `Duration`
+        assert_eq!(format!("{:30}", Duration::days(1) + Duration::milliseconds(2345)),
+                   "P1DT2.345S");
+    }
+
+    #[test]
+    fn test_to_std() {
+        assert_eq!(Duration::seconds(1).to_std(), Ok(StdDuration::new(1, 0)));
+        assert_eq!(Duration::seconds(86401).to_std(), Ok(StdDuration::new(86401, 0)));
+        assert_eq!(Duration::milliseconds(123).to_std(), Ok(StdDuration::new(0, 123000000)));
+        assert_eq!(Duration::milliseconds(123765).to_std(), Ok(StdDuration::new(123, 765000000)));
+        assert_eq!(Duration::nanoseconds(777).to_std(), Ok(StdDuration::new(0, 777)));
+        assert_eq!(MAX.to_std(), Ok(StdDuration::new(9223372036854775, 807000000)));
+        assert_eq!(Duration::seconds(-1).to_std(),
+                   Err(OutOfRangeError(())));
+        assert_eq!(Duration::milliseconds(-1).to_std(),
+                   Err(OutOfRangeError(())));
+    }
+
+    #[test]
+    fn test_from_std() {
+        assert_eq!(Ok(Duration::seconds(1)),
+                   Duration::from_std(StdDuration::new(1, 0)));
+        assert_eq!(Ok(Duration::seconds(86401)),
+                   Duration::from_std(StdDuration::new(86401, 0)));
+        assert_eq!(Ok(Duration::milliseconds(123)),
+                   Duration::from_std(StdDuration::new(0, 123000000)));
+        assert_eq!(Ok(Duration::milliseconds(123765)),
+                   Duration::from_std(StdDuration::new(123, 765000000)));
+        assert_eq!(Ok(Duration::nanoseconds(777)),
+                   Duration::from_std(StdDuration::new(0, 777)));
+        assert_eq!(Ok(MAX),
+                   Duration::from_std(StdDuration::new(9223372036854775, 807000000)));
+        assert_eq!(Duration::from_std(StdDuration::new(9223372036854776, 0)),
+                   Err(OutOfRangeError(())));
+        assert_eq!(Duration::from_std(StdDuration::new(9223372036854775, 807000001)),
+                   Err(OutOfRangeError(())));
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/src/lib.rs
@@ -0,0 +1,1277 @@
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Simple time handling.
+//!
+//! # Usage
+//!
+//! This crate is [on crates.io](https://crates.io/crates/time) and can be
+//! used by adding `time` to the dependencies in your project's `Cargo.toml`.
+//!
+//! ```toml
+//! [dependencies]
+//! time = "0.1"
+//! ```
+//!
+//! And this in your crate root:
+//!
+//! ```rust
+//! extern crate time;
+//! ```
+//!
+//! This crate uses the same syntax for format strings as the [strftime()]
+//! (http://man7.org/linux/man-pages/man3/strftime.3.html) function from the C
+//! standard library.
+
+#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
+       html_favicon_url = "https://www.rust-lang.org/favicon.ico",
+       html_root_url = "https://doc.rust-lang.org/time/")]
+#![allow(trivial_numeric_casts)]
+#![cfg_attr(test, deny(warnings))]
+
+#[cfg(target_os = "redox")] extern crate syscall;
+#[cfg(unix)] extern crate libc;
+#[cfg(windows)] extern crate kernel32;
+#[cfg(windows)] extern crate winapi;
+#[cfg(feature = "rustc-serialize")] extern crate rustc_serialize;
+
+#[cfg(test)] #[macro_use] extern crate log;
+#[cfg(all(windows, test))] extern crate advapi32;
+
+use std::cmp::Ordering;
+use std::error::Error;
+use std::fmt;
+use std::ops::{Add, Sub};
+
+pub use duration::{Duration, OutOfRangeError};
+
+use self::ParseError::{InvalidDay, InvalidDayOfMonth, InvalidDayOfWeek,
+                       InvalidDayOfYear, InvalidFormatSpecifier, InvalidHour,
+                       InvalidMinute, InvalidMonth, InvalidSecond, InvalidTime,
+                       InvalidYear, InvalidZoneOffset, InvalidSecondsSinceEpoch,
+                       MissingFormatConverter, UnexpectedCharacter};
+
+pub use parse::strptime;
+
+mod display;
+mod duration;
+mod parse;
+mod sys;
+
+static NSEC_PER_SEC: i32 = 1_000_000_000;
+
+/// A record specifying a time value in seconds and nanoseconds, where
+/// nanoseconds represent the offset from the given second.
+///
+/// For example a timespec of 1.2 seconds after the beginning of the epoch would
+/// be represented as {sec: 1, nsec: 200000000}.
+#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
+#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
+pub struct Timespec { pub sec: i64, pub nsec: i32 }
+/*
+ * Timespec assumes that pre-epoch Timespecs have negative sec and positive
+ * nsec fields. Darwin's and Linux's struct timespec functions handle pre-
+ * epoch timestamps using a "two steps back, one step forward" representation,
+ * though the man pages do not actually document this. For example, the time
+ * -1.2 seconds before the epoch is represented by `Timespec { sec: -2_i64,
+ * nsec: 800_000_000 }`.
+ */
+impl Timespec {
+    pub fn new(sec: i64, nsec: i32) -> Timespec {
+        assert!(nsec >= 0 && nsec < NSEC_PER_SEC);
+        Timespec { sec: sec, nsec: nsec }
+    }
+}
+
+impl Add<Duration> for Timespec {
+    type Output = Timespec;
+
+    fn add(self, other: Duration) -> Timespec {
+        let d_sec = other.num_seconds();
+        // It is safe to unwrap the nanoseconds, because there cannot be
+        // more than one second left, which fits in i64 and in i32.
+        let d_nsec = (other - Duration::seconds(d_sec))
+                     .num_nanoseconds().unwrap() as i32;
+        let mut sec = self.sec + d_sec;
+        let mut nsec = self.nsec + d_nsec;
+        if nsec >= NSEC_PER_SEC {
+            nsec -= NSEC_PER_SEC;
+            sec += 1;
+        } else if nsec < 0 {
+            nsec += NSEC_PER_SEC;
+            sec -= 1;
+        }
+        Timespec::new(sec, nsec)
+    }
+}
+
+impl Sub<Duration> for Timespec {
+    type Output = Timespec;
+
+    fn sub(self, other: Duration) -> Timespec {
+        let d_sec = other.num_seconds();
+        // It is safe to unwrap the nanoseconds, because there cannot be
+        // more than one second left, which fits in i64 and in i32.
+        let d_nsec = (other - Duration::seconds(d_sec))
+                     .num_nanoseconds().unwrap() as i32;
+        let mut sec = self.sec - d_sec;
+        let mut nsec = self.nsec - d_nsec;
+        if nsec >= NSEC_PER_SEC {
+            nsec -= NSEC_PER_SEC;
+            sec += 1;
+        } else if nsec < 0 {
+            nsec += NSEC_PER_SEC;
+            sec -= 1;
+        }
+        Timespec::new(sec, nsec)
+    }
+}
+
+impl Sub<Timespec> for Timespec {
+    type Output = Duration;
+
+    fn sub(self, other: Timespec) -> Duration {
+        let sec = self.sec - other.sec;
+        let nsec = self.nsec - other.nsec;
+        Duration::seconds(sec) + Duration::nanoseconds(nsec as i64)
+    }
+}
+
+/**
+ * Returns the current time as a `timespec` containing the seconds and
+ * nanoseconds since 1970-01-01T00:00:00Z.
+ */
+pub fn get_time() -> Timespec {
+    let (sec, nsec) = sys::get_time();
+    Timespec::new(sec, nsec)
+}
+
+
+/**
+ * Returns the current value of a high-resolution performance counter
+ * in nanoseconds since an unspecified epoch.
+ */
+pub fn precise_time_ns() -> u64 {
+    sys::get_precise_ns()
+}
+
+
+/**
+ * Returns the current value of a high-resolution performance counter
+ * in seconds since an unspecified epoch.
+ */
+pub fn precise_time_s() -> f64 {
+    return (precise_time_ns() as f64) / 1000000000.;
+}
+
+/// An opaque structure representing a moment in time.
+///
+/// The only operation that can be performed on a `PreciseTime` is the
+/// calculation of the `Duration` of time that lies between them.
+///
+/// # Examples
+///
+/// Repeatedly call a function for 1 second:
+///
+/// ```rust
+/// use time::{Duration, PreciseTime};
+/// # fn do_some_work() {}
+///
+/// let start = PreciseTime::now();
+///
+/// while start.to(PreciseTime::now()) < Duration::seconds(1) {
+///     do_some_work();
+/// }
+/// ```
+#[derive(Copy, Clone)]
+pub struct PreciseTime(u64);
+
+impl PreciseTime {
+    /// Returns a `PreciseTime` representing the current moment in time.
+    pub fn now() -> PreciseTime {
+        PreciseTime(precise_time_ns())
+    }
+
+    /// Returns a `Duration` representing the span of time from the value of
+    /// `self` to the value of `later`.
+    ///
+    /// # Notes
+    ///
+    /// If `later` represents a time before `self`, the result of this method
+    /// is unspecified.
+    ///
+    /// If `later` represents a time more than 293 years after `self`, the
+    /// result of this method is unspecified.
+    #[inline]
+    pub fn to(&self, later: PreciseTime) -> Duration {
+        // NB: even if later is less than self due to overflow, this will work
+        // since the subtraction will underflow properly as well.
+        //
+        // We could deal with the overflow when casting to an i64, but all that
+        // gets us is the ability to handle intervals of up to 584 years, which
+        // seems not very useful :)
+        Duration::nanoseconds((later.0 - self.0) as i64)
+    }
+}
+
+/// A structure representing a moment in time.
+///
+/// `SteadyTime`s are generated by a "steady" clock, that is, a clock which
+/// never experiences discontinuous jumps and for which time always flows at
+/// the same rate.
+///
+/// # Examples
+///
+/// Repeatedly call a function for 1 second:
+///
+/// ```rust
+/// # use time::{Duration, SteadyTime};
+/// # fn do_some_work() {}
+/// let start = SteadyTime::now();
+///
+/// while SteadyTime::now() - start < Duration::seconds(1) {
+///     do_some_work();
+/// }
+/// ```
+#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug)]
+pub struct SteadyTime(sys::SteadyTime);
+
+impl SteadyTime {
+    /// Returns a `SteadyTime` representing the current moment in time.
+    pub fn now() -> SteadyTime {
+        SteadyTime(sys::SteadyTime::now())
+    }
+}
+
+impl fmt::Display for SteadyTime {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+        // TODO: needs a display customization
+        fmt::Debug::fmt(self, fmt)
+    }
+}
+
+impl Sub for SteadyTime {
+    type Output = Duration;
+
+    fn sub(self, other: SteadyTime) -> Duration {
+        self.0 - other.0
+    }
+}
+
+impl Sub<Duration> for SteadyTime {
+    type Output = SteadyTime;
+
+    fn sub(self, other: Duration) -> SteadyTime {
+        SteadyTime(self.0 - other)
+    }
+}
+
+impl Add<Duration> for SteadyTime {
+    type Output = SteadyTime;
+
+    fn add(self, other: Duration) -> SteadyTime {
+        SteadyTime(self.0 + other)
+    }
+}
+
+#[cfg(not(windows))]
+pub fn tzset() {
+    extern { fn tzset(); }
+    unsafe { tzset() }
+}
+
+
+#[cfg(windows)]
+pub fn tzset() {}
+
+/// Holds a calendar date and time broken down into its components (year, month,
+/// day, and so on), also called a broken-down time value.
+// FIXME: use c_int instead of i32?
+#[repr(C)]
+#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
+#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
+pub struct Tm {
+    /// Seconds after the minute - [0, 60]
+    pub tm_sec: i32,
+
+    /// Minutes after the hour - [0, 59]
+    pub tm_min: i32,
+
+    /// Hours after midnight - [0, 23]
+    pub tm_hour: i32,
+
+    /// Day of the month - [1, 31]
+    pub tm_mday: i32,
+
+    /// Months since January - [0, 11]
+    pub tm_mon: i32,
+
+    /// Years since 1900
+    pub tm_year: i32,
+
+    /// Days since Sunday - [0, 6]. 0 = Sunday, 1 = Monday, ..., 6 = Saturday.
+    pub tm_wday: i32,
+
+    /// Days since January 1 - [0, 365]
+    pub tm_yday: i32,
+
+    /// Daylight Saving Time flag.
+    ///
+    /// This value is positive if Daylight Saving Time is in effect, zero if
+    /// Daylight Saving Time is not in effect, and negative if this information
+    /// is not available.
+    pub tm_isdst: i32,
+
+    /// Identifies the time zone that was used to compute this broken-down time
+    /// value, including any adjustment for Daylight Saving Time. This is the
+    /// number of seconds east of UTC. For example, for U.S. Pacific Daylight
+    /// Time, the value is -7*60*60 = -25200.
+    pub tm_utcoff: i32,
+
+    /// Nanoseconds after the second - [0, 10<sup>9</sup> - 1]
+    pub tm_nsec: i32,
+}
+
+impl Add<Duration> for Tm {
+    type Output = Tm;
+
+    /// The resulting Tm is in UTC.
+    // FIXME:  The resulting Tm should have the same timezone as `self`;
+    // however, we need a function such as `at_tm(clock: Timespec, offset: i32)`
+    // for this.
+    fn add(self, other: Duration) -> Tm {
+        at_utc(self.to_timespec() + other)
+    }
+}
+
+impl Sub<Duration> for Tm {
+    type Output = Tm;
+
+    /// The resulting Tm is in UTC.
+    // FIXME:  The resulting Tm should have the same timezone as `self`;
+    // however, we need a function such as `at_tm(clock: Timespec, offset: i32)`
+    // for this.
+    fn sub(self, other: Duration) -> Tm {
+        at_utc(self.to_timespec() - other)
+    }
+}
+
+impl Sub<Tm> for Tm {
+    type Output = Duration;
+
+    fn sub(self, other: Tm) -> Duration {
+        self.to_timespec() - other.to_timespec()
+    }
+}
+
+impl PartialOrd for Tm {
+    fn partial_cmp(&self, other: &Tm) -> Option<Ordering> {
+        self.to_timespec().partial_cmp(&other.to_timespec())
+    }
+}
+
+impl Ord for Tm {
+    fn cmp(&self, other: &Tm) -> Ordering {
+        self.to_timespec().cmp(&other.to_timespec())
+    }
+}
+
+pub fn empty_tm() -> Tm {
+    Tm {
+        tm_sec: 0,
+        tm_min: 0,
+        tm_hour: 0,
+        tm_mday: 0,
+        tm_mon: 0,
+        tm_year: 0,
+        tm_wday: 0,
+        tm_yday: 0,
+        tm_isdst: 0,
+        tm_utcoff: 0,
+        tm_nsec: 0,
+    }
+}
+
+/// Returns the specified time in UTC
+pub fn at_utc(clock: Timespec) -> Tm {
+    let Timespec { sec, nsec } = clock;
+    let mut tm = empty_tm();
+    sys::time_to_utc_tm(sec, &mut tm);
+    tm.tm_nsec = nsec;
+    tm
+}
+
+/// Returns the current time in UTC
+pub fn now_utc() -> Tm {
+    at_utc(get_time())
+}
+
+/// Returns the specified time in the local timezone
+pub fn at(clock: Timespec) -> Tm {
+    let Timespec { sec, nsec } = clock;
+    let mut tm = empty_tm();
+    sys::time_to_local_tm(sec, &mut tm);
+    tm.tm_nsec = nsec;
+    tm
+}
+
+/// Returns the current time in the local timezone
+pub fn now() -> Tm {
+    at(get_time())
+}
+
+impl Tm {
+    /// Convert time to the seconds from January 1, 1970
+    pub fn to_timespec(&self) -> Timespec {
+        let sec = match self.tm_utcoff {
+            0 => sys::utc_tm_to_time(self),
+            _ => sys::local_tm_to_time(self)
+        };
+
+        Timespec::new(sec, self.tm_nsec)
+    }
+
+    /// Convert time to the local timezone
+    pub fn to_local(&self) -> Tm {
+        at(self.to_timespec())
+    }
+
+    /// Convert time to the UTC
+    pub fn to_utc(&self) -> Tm {
+        match self.tm_utcoff {
+            0 => *self,
+            _ => at_utc(self.to_timespec())
+        }
+    }
+
+    /**
+     * Returns a TmFmt that outputs according to the `asctime` format in ISO
+     * C, in the local timezone.
+     *
+     * Example: "Thu Jan  1 00:00:00 1970"
+     */
+    pub fn ctime(&self) -> TmFmt {
+        TmFmt {
+            tm: self,
+            format: Fmt::Ctime,
+        }
+    }
+
+    /**
+     * Returns a TmFmt that outputs according to the `asctime` format in ISO
+     * C.
+     *
+     * Example: "Thu Jan  1 00:00:00 1970"
+     */
+    pub fn asctime(&self) -> TmFmt {
+        TmFmt {
+            tm: self,
+            format: Fmt::Str("%c"),
+        }
+    }
+
+    /// Formats the time according to the format string.
+    pub fn strftime<'a>(&'a self, format: &'a str) -> Result<TmFmt<'a>, ParseError> {
+        validate_format(TmFmt {
+            tm: self,
+            format: Fmt::Str(format),
+        })
+    }
+
+    /**
+     * Returns a TmFmt that outputs according to RFC 822.
+     *
+     * local: "Thu, 22 Mar 2012 07:53:18 PST"
+     * utc:   "Thu, 22 Mar 2012 14:53:18 GMT"
+     */
+    pub fn rfc822(&self) -> TmFmt {
+        let fmt = if self.tm_utcoff == 0 {
+            "%a, %d %b %Y %T GMT"
+        } else {
+            "%a, %d %b %Y %T %Z"
+        };
+        TmFmt {
+            tm: self,
+            format: Fmt::Str(fmt),
+        }
+    }
+
+    /**
+     * Returns a TmFmt that outputs according to RFC 822 with Zulu time.
+     *
+     * local: "Thu, 22 Mar 2012 07:53:18 -0700"
+     * utc:   "Thu, 22 Mar 2012 14:53:18 -0000"
+     */
+    pub fn rfc822z(&self) -> TmFmt {
+        TmFmt {
+            tm: self,
+            format: Fmt::Str("%a, %d %b %Y %T %z"),
+        }
+    }
+
+    /**
+     * Returns a TmFmt that outputs according to RFC 3339. RFC 3339 is
+     * compatible with ISO 8601.
+     *
+     * local: "2012-02-22T07:53:18-07:00"
+     * utc:   "2012-02-22T14:53:18Z"
+     */
+    pub fn rfc3339<'a>(&'a self) -> TmFmt {
+        TmFmt {
+            tm: self,
+            format: Fmt::Rfc3339,
+        }
+    }
+}
+
+#[derive(Copy, PartialEq, Debug, Clone)]
+pub enum ParseError {
+    InvalidSecond,
+    InvalidMinute,
+    InvalidHour,
+    InvalidDay,
+    InvalidMonth,
+    InvalidYear,
+    InvalidDayOfWeek,
+    InvalidDayOfMonth,
+    InvalidDayOfYear,
+    InvalidZoneOffset,
+    InvalidTime,
+    InvalidSecondsSinceEpoch,
+    MissingFormatConverter,
+    InvalidFormatSpecifier(char),
+    UnexpectedCharacter(char, char),
+}
+
+impl fmt::Display for ParseError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            InvalidFormatSpecifier(ch) => {
+                write!(f, "{}: %{}", self.description(), ch)
+            }
+            UnexpectedCharacter(a, b) => {
+                write!(f, "expected: `{}`, found: `{}`", a, b)
+            }
+            _ => write!(f, "{}", self.description())
+        }
+    }
+}
+
+impl Error for ParseError {
+    fn description(&self) -> &str {
+        match *self {
+            InvalidSecond => "Invalid second.",
+            InvalidMinute => "Invalid minute.",
+            InvalidHour => "Invalid hour.",
+            InvalidDay => "Invalid day.",
+            InvalidMonth => "Invalid month.",
+            InvalidYear => "Invalid year.",
+            InvalidDayOfWeek => "Invalid day of the week.",
+            InvalidDayOfMonth => "Invalid day of the month.",
+            InvalidDayOfYear => "Invalid day of the year.",
+            InvalidZoneOffset => "Invalid zone offset.",
+            InvalidTime => "Invalid time.",
+            InvalidSecondsSinceEpoch => "Invalid seconds since epoch.",
+            MissingFormatConverter => "missing format converter after `%`",
+            InvalidFormatSpecifier(..) => "invalid format specifier",
+            UnexpectedCharacter(..) => "Unexpected character.",
+        }
+    }
+}
+
+/// A wrapper around a `Tm` and format string that implements Display.
+#[derive(Debug)]
+pub struct TmFmt<'a> {
+    tm: &'a Tm,
+    format: Fmt<'a>
+}
+
+#[derive(Debug)]
+enum Fmt<'a> {
+    Str(&'a str),
+    Rfc3339,
+    Ctime,
+}
+
+fn validate_format<'a>(fmt: TmFmt<'a>) -> Result<TmFmt<'a>, ParseError> {
+
+    match (fmt.tm.tm_wday, fmt.tm.tm_mon) {
+        (0...6, 0...11) => (),
+        (_wday, 0...11) => return Err(InvalidDayOfWeek),
+        (0...6, _mon) => return Err(InvalidMonth),
+        _ => return Err(InvalidDay)
+    }
+    match fmt.format {
+        Fmt::Str(ref s) => {
+            let mut chars = s.chars();
+            loop {
+                match chars.next() {
+                    Some('%') => {
+                        match chars.next() {
+                            Some('A') | Some('a') | Some('B') | Some('b') |
+                            Some('C') | Some('c') | Some('D') | Some('d') |
+                            Some('e') | Some('F') | Some('f') | Some('G') |
+                            Some('g') | Some('H') | Some('h') | Some('I') |
+                            Some('j') | Some('k') | Some('l') | Some('M') |
+                            Some('m') | Some('n') | Some('P') | Some('p') |
+                            Some('R') | Some('r') | Some('S') | Some('s') |
+                            Some('T') | Some('t') | Some('U') | Some('u') |
+                            Some('V') | Some('v') | Some('W') | Some('w') |
+                            Some('X') | Some('x') | Some('Y') | Some('y') |
+                            Some('Z') | Some('z') | Some('+') | Some('%') => (),
+
+                            Some(c) => return Err(InvalidFormatSpecifier(c)),
+                            None => return Err(MissingFormatConverter),
+                        }
+                    },
+                    None => break,
+                    _ => ()
+                }
+            }
+        },
+        _ => ()
+    }
+    Ok(fmt)
+}
+
+/// Formats the time according to the format string.
+pub fn strftime(format: &str, tm: &Tm) -> Result<String, ParseError> {
+    tm.strftime(format).map(|fmt| fmt.to_string())
+}
+
+#[cfg(test)]
+mod tests {
+    use super::{Timespec, get_time, precise_time_ns, precise_time_s,
+                at_utc, at, strptime, PreciseTime, SteadyTime, ParseError, Duration};
+    use super::ParseError::{InvalidTime, InvalidYear, MissingFormatConverter,
+                            InvalidFormatSpecifier};
+
+    use std::sync::{Once, ONCE_INIT, Mutex, MutexGuard, LockResult};
+    use std::mem;
+
+    struct TzReset {
+        _tzreset: ::sys::TzReset,
+        _lock: LockResult<MutexGuard<'static, ()>>,
+    }
+
+    fn set_time_zone_la_or_london(london: bool) -> TzReset {
+        // Lock manages current timezone because some tests require LA some
+        // London
+        static mut LOCK: *mut Mutex<()> = 0 as *mut _;
+        static INIT: Once = ONCE_INIT;
+
+        unsafe {
+            INIT.call_once(|| {
+                LOCK = mem::transmute(Box::new(Mutex::new(())));
+            });
+
+            let timezone_lock = (*LOCK).lock();
+            let reset_func = if london {
+                ::sys::set_london_with_dst_time_zone()
+            } else {
+                ::sys::set_los_angeles_time_zone()
+            };
+            TzReset {
+                _lock: timezone_lock,
+                _tzreset: reset_func,
+            }
+        }
+    }
+
+    fn set_time_zone() -> TzReset {
+        set_time_zone_la_or_london(false)
+    }
+
+    fn set_time_zone_london_dst() -> TzReset {
+        set_time_zone_la_or_london(true)
+    }
+
+    #[test]
+    fn test_get_time() {
+        static SOME_RECENT_DATE: i64 = 1325376000i64; // 2012-01-01T00:00:00Z
+        static SOME_FUTURE_DATE: i64 = 1577836800i64; // 2020-01-01T00:00:00Z
+
+        let tv1 = get_time();
+        debug!("tv1={} sec + {} nsec", tv1.sec, tv1.nsec);
+
+        assert!(tv1.sec > SOME_RECENT_DATE);
+        assert!(tv1.nsec < 1000000000i32);
+
+        let tv2 = get_time();
+        debug!("tv2={} sec + {} nsec", tv2.sec, tv2.nsec);
+
+        assert!(tv2.sec >= tv1.sec);
+        assert!(tv2.sec < SOME_FUTURE_DATE);
+        assert!(tv2.nsec < 1000000000i32);
+        if tv2.sec == tv1.sec {
+            assert!(tv2.nsec >= tv1.nsec);
+        }
+    }
+
+    #[test]
+    fn test_precise_time() {
+        let s0 = precise_time_s();
+        debug!("s0={} sec", s0);
+        assert!(s0 > 0.);
+
+        let ns0 = precise_time_ns();
+        let ns1 = precise_time_ns();
+        debug!("ns0={} ns", ns0);
+        debug!("ns1={} ns", ns1);
+        assert!(ns1 >= ns0);
+
+        let ns2 = precise_time_ns();
+        debug!("ns2={} ns", ns2);
+        assert!(ns2 >= ns1);
+    }
+
+    #[test]
+    fn test_precise_time_to() {
+        let t0 = PreciseTime(1000);
+        let t1 = PreciseTime(1023);
+        assert_eq!(Duration::nanoseconds(23), t0.to(t1));
+    }
+
+    #[test]
+    fn test_at_utc() {
+        let _reset = set_time_zone();
+
+        let time = Timespec::new(1234567890, 54321);
+        let utc = at_utc(time);
+
+        assert_eq!(utc.tm_sec, 30);
+        assert_eq!(utc.tm_min, 31);
+        assert_eq!(utc.tm_hour, 23);
+        assert_eq!(utc.tm_mday, 13);
+        assert_eq!(utc.tm_mon, 1);
+        assert_eq!(utc.tm_year, 109);
+        assert_eq!(utc.tm_wday, 5);
+        assert_eq!(utc.tm_yday, 43);
+        assert_eq!(utc.tm_isdst, 0);
+        assert_eq!(utc.tm_utcoff, 0);
+        assert_eq!(utc.tm_nsec, 54321);
+    }
+
+    #[test]
+    fn test_at() {
+        let _reset = set_time_zone();
+
+        let time = Timespec::new(1234567890, 54321);
+        let local = at(time);
+
+        debug!("time_at: {:?}", local);
+
+        assert_eq!(local.tm_sec, 30);
+        assert_eq!(local.tm_min, 31);
+        assert_eq!(local.tm_hour, 15);
+        assert_eq!(local.tm_mday, 13);
+        assert_eq!(local.tm_mon, 1);
+        assert_eq!(local.tm_year, 109);
+        assert_eq!(local.tm_wday, 5);
+        assert_eq!(local.tm_yday, 43);
+        assert_eq!(local.tm_isdst, 0);
+        assert_eq!(local.tm_utcoff, -28800);
+        assert_eq!(local.tm_nsec, 54321);
+    }
+
+    #[test]
+    fn test_to_timespec() {
+        let _reset = set_time_zone();
+
+        let time = Timespec::new(1234567890, 54321);
+        let utc = at_utc(time);
+
+        assert_eq!(utc.to_timespec(), time);
+        assert_eq!(utc.to_local().to_timespec(), time);
+    }
+
+    #[test]
+    fn test_conversions() {
+        let _reset = set_time_zone();
+
+        let time = Timespec::new(1234567890, 54321);
+        let utc = at_utc(time);
+        let local = at(time);
+
+        assert!(local.to_local() == local);
+        assert!(local.to_utc() == utc);
+        assert!(local.to_utc().to_local() == local);
+        assert!(utc.to_utc() == utc);
+        assert!(utc.to_local() == local);
+        assert!(utc.to_local().to_utc() == utc);
+    }
+
+    #[test]
+    fn test_strptime() {
+        let _reset = set_time_zone();
+
+        match strptime("", "") {
+            Ok(ref tm) => {
+                assert!(tm.tm_sec == 0);
+                assert!(tm.tm_min == 0);
+                assert!(tm.tm_hour == 0);
+                assert!(tm.tm_mday == 0);
+                assert!(tm.tm_mon == 0);
+                assert!(tm.tm_year == 0);
+                assert!(tm.tm_wday == 0);
+                assert!(tm.tm_isdst == 0);
+                assert!(tm.tm_utcoff == 0);
+                assert!(tm.tm_nsec == 0);
+            }
+            Err(_) => ()
+        }
+
+        let format = "%a %b %e %T.%f %Y";
+        assert_eq!(strptime("", format), Err(ParseError::InvalidDay));
+        assert_eq!(strptime("Fri Feb 13 15:31:30", format),
+                   Err(InvalidTime));
+
+        match strptime("Fri Feb 13 15:31:30.01234 2009", format) {
+            Err(e) => panic!("{}", e),
+            Ok(ref tm) => {
+                assert_eq!(tm.tm_sec, 30);
+                assert_eq!(tm.tm_min, 31);
+                assert_eq!(tm.tm_hour, 15);
+                assert_eq!(tm.tm_mday, 13);
+                assert_eq!(tm.tm_mon, 1);
+                assert_eq!(tm.tm_year, 109);
+                assert_eq!(tm.tm_wday, 5);
+                assert_eq!(tm.tm_yday, 0);
+                assert_eq!(tm.tm_isdst, 0);
+                assert_eq!(tm.tm_utcoff, 0);
+                assert_eq!(tm.tm_nsec, 12340000);
+            }
+        }
+
+        fn test(s: &str, format: &str) -> bool {
+            match strptime(s, format) {
+              Ok(tm) => {
+                tm.strftime(format).unwrap().to_string() == s.to_string()
+              },
+              Err(e) => panic!("{:?},  s={:?}, format={:?}", e, s, format)
+            }
+        }
+
+        fn test_oneway(s : &str, format : &str) -> bool {
+            match strptime(s, format) {
+              Ok(_) => {
+                // oneway tests are used when reformatting the parsed Tm
+                // back into a string can generate a different string
+                // from the original (i.e. leading zeroes)
+                true
+              },
+              Err(e) => panic!("{:?},  s={:?}, format={:?}", e, s, format)
+            }
+        }
+
+        let days = [
+            "Sunday".to_string(),
+            "Monday".to_string(),
+            "Tuesday".to_string(),
+            "Wednesday".to_string(),
+            "Thursday".to_string(),
+            "Friday".to_string(),
+            "Saturday".to_string()
+        ];
+        for day in days.iter() {
+            assert!(test(&day, "%A"));
+        }
+
+        let days = [
+            "Sun".to_string(),
+            "Mon".to_string(),
+            "Tue".to_string(),
+            "Wed".to_string(),
+            "Thu".to_string(),
+            "Fri".to_string(),
+            "Sat".to_string()
+        ];
+        for day in days.iter() {
+            assert!(test(&day, "%a"));
+        }
+
+        let months = [
+            "January".to_string(),
+            "February".to_string(),
+            "March".to_string(),
+            "April".to_string(),
+            "May".to_string(),
+            "June".to_string(),
+            "July".to_string(),
+            "August".to_string(),
+            "September".to_string(),
+            "October".to_string(),
+            "November".to_string(),
+            "December".to_string()
+        ];
+        for day in months.iter() {
+            assert!(test(&day, "%B"));
+        }
+
+        let months = [
+            "Jan".to_string(),
+            "Feb".to_string(),
+            "Mar".to_string(),
+            "Apr".to_string(),
+            "May".to_string(),
+            "Jun".to_string(),
+            "Jul".to_string(),
+            "Aug".to_string(),
+            "Sep".to_string(),
+            "Oct".to_string(),
+            "Nov".to_string(),
+            "Dec".to_string()
+        ];
+        for day in months.iter() {
+            assert!(test(&day, "%b"));
+        }
+
+        assert!(test("19", "%C"));
+        assert!(test("Fri Feb  3 23:31:30 2009", "%c"));
+        assert!(test("Fri Feb 13 23:31:30 2009", "%c"));
+        assert!(test("02/13/09", "%D"));
+        assert!(test("03", "%d"));
+        assert!(test("13", "%d"));
+        assert!(test(" 3", "%e"));
+        assert!(test("13", "%e"));
+        assert!(test("2009-02-13", "%F"));
+        assert!(test("03", "%H"));
+        assert!(test("13", "%H"));
+        assert!(test("03", "%I")); // FIXME (#2350): flesh out
+        assert!(test("11", "%I")); // FIXME (#2350): flesh out
+        assert!(test("044", "%j"));
+        assert!(test(" 3", "%k"));
+        assert!(test("13", "%k"));
+        assert!(test(" 1", "%l"));
+        assert!(test("11", "%l"));
+        assert!(test("03", "%M"));
+        assert!(test("13", "%M"));
+        assert!(test("\n", "%n"));
+        assert!(test("am", "%P"));
+        assert!(test("pm", "%P"));
+        assert!(test("AM", "%p"));
+        assert!(test("PM", "%p"));
+        assert!(test("23:31", "%R"));
+        assert!(test("11:31:30 AM", "%r"));
+        assert!(test("11:31:30 PM", "%r"));
+        assert!(test("03", "%S"));
+        assert!(test("13", "%S"));
+        assert!(test("15:31:30", "%T"));
+        assert!(test("\t", "%t"));
+        assert!(test("1", "%u"));
+        assert!(test("7", "%u"));
+        assert!(test("13-Feb-2009", "%v"));
+        assert!(test("0", "%w"));
+        assert!(test("6", "%w"));
+        assert!(test("2009", "%Y"));
+        assert!(test("09", "%y"));
+
+        assert!(test_oneway("3",  "%d"));
+        assert!(test_oneway("3",  "%H"));
+        assert!(test_oneway("3",  "%e"));
+        assert!(test_oneway("3",  "%M"));
+        assert!(test_oneway("3",  "%S"));
+
+        assert!(strptime("-0000", "%z").unwrap().tm_utcoff == 0);
+        assert!(strptime("-00:00", "%z").unwrap().tm_utcoff == 0);
+        assert!(strptime("Z", "%z").unwrap().tm_utcoff == 0);
+        assert_eq!(-28800, strptime("-0800", "%z").unwrap().tm_utcoff);
+        assert_eq!(-28800, strptime("-08:00", "%z").unwrap().tm_utcoff);
+        assert_eq!(28800, strptime("+0800", "%z").unwrap().tm_utcoff);
+        assert_eq!(28800, strptime("+08:00", "%z").unwrap().tm_utcoff);
+        assert_eq!(5400, strptime("+0130", "%z").unwrap().tm_utcoff);
+        assert_eq!(5400, strptime("+01:30", "%z").unwrap().tm_utcoff);
+        assert!(test("%", "%%"));
+
+        // Test for #7256
+        assert_eq!(strptime("360", "%Y-%m-%d"), Err(InvalidYear));
+
+        // Test for epoch seconds parsing
+        {
+            assert!(test("1428035610", "%s"));
+            let tm = strptime("1428035610", "%s").unwrap();
+            assert_eq!(tm.tm_utcoff, 0);
+            assert_eq!(tm.tm_isdst, 0);
+            assert_eq!(tm.tm_yday, 92);
+            assert_eq!(tm.tm_wday, 5);
+            assert_eq!(tm.tm_year, 115);
+            assert_eq!(tm.tm_mon, 3);
+            assert_eq!(tm.tm_mday, 3);
+            assert_eq!(tm.tm_hour, 4);
+        }
+    }
+
+    #[test]
+    fn test_asctime() {
+        let _reset = set_time_zone();
+
+        let time = Timespec::new(1234567890, 54321);
+        let utc   = at_utc(time);
+        let local = at(time);
+
+        debug!("test_ctime: {} {}", utc.asctime(), local.asctime());
+
+        assert_eq!(utc.asctime().to_string(), "Fri Feb 13 23:31:30 2009".to_string());
+        assert_eq!(local.asctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string());
+    }
+
+    #[test]
+    fn test_ctime() {
+        let _reset = set_time_zone();
+
+        let time = Timespec::new(1234567890, 54321);
+        let utc   = at_utc(time);
+        let local = at(time);
+
+        debug!("test_ctime: {} {}", utc.ctime(), local.ctime());
+
+        assert_eq!(utc.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string());
+        assert_eq!(local.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string());
+    }
+
+    #[test]
+    fn test_strftime() {
+        let _reset = set_time_zone();
+
+        let time = Timespec::new(1234567890, 54321);
+        let utc = at_utc(time);
+        let local = at(time);
+
+        assert_eq!(local.strftime("").unwrap().to_string(), "".to_string());
+        assert_eq!(local.strftime("%A").unwrap().to_string(), "Friday".to_string());
+        assert_eq!(local.strftime("%a").unwrap().to_string(), "Fri".to_string());
+        assert_eq!(local.strftime("%B").unwrap().to_string(), "February".to_string());
+        assert_eq!(local.strftime("%b").unwrap().to_string(), "Feb".to_string());
+        assert_eq!(local.strftime("%C").unwrap().to_string(), "20".to_string());
+        assert_eq!(local.strftime("%c").unwrap().to_string(),
+                   "Fri Feb 13 15:31:30 2009".to_string());
+        assert_eq!(local.strftime("%D").unwrap().to_string(), "02/13/09".to_string());
+        assert_eq!(local.strftime("%d").unwrap().to_string(), "13".to_string());
+        assert_eq!(local.strftime("%e").unwrap().to_string(), "13".to_string());
+        assert_eq!(local.strftime("%F").unwrap().to_string(), "2009-02-13".to_string());
+        assert_eq!(local.strftime("%f").unwrap().to_string(), "000054321".to_string());
+        assert_eq!(local.strftime("%G").unwrap().to_string(), "2009".to_string());
+        assert_eq!(local.strftime("%g").unwrap().to_string(), "09".to_string());
+        assert_eq!(local.strftime("%H").unwrap().to_string(), "15".to_string());
+        assert_eq!(local.strftime("%h").unwrap().to_string(), "Feb".to_string());
+        assert_eq!(local.strftime("%I").unwrap().to_string(), "03".to_string());
+        assert_eq!(local.strftime("%j").unwrap().to_string(), "044".to_string());
+        assert_eq!(local.strftime("%k").unwrap().to_string(), "15".to_string());
+        assert_eq!(local.strftime("%l").unwrap().to_string(), " 3".to_string());
+        assert_eq!(local.strftime("%M").unwrap().to_string(), "31".to_string());
+        assert_eq!(local.strftime("%m").unwrap().to_string(), "02".to_string());
+        assert_eq!(local.strftime("%n").unwrap().to_string(), "\n".to_string());
+        assert_eq!(local.strftime("%P").unwrap().to_string(), "pm".to_string());
+        assert_eq!(local.strftime("%p").unwrap().to_string(), "PM".to_string());
+        assert_eq!(local.strftime("%R").unwrap().to_string(), "15:31".to_string());
+        assert_eq!(local.strftime("%r").unwrap().to_string(), "03:31:30 PM".to_string());
+        assert_eq!(local.strftime("%S").unwrap().to_string(), "30".to_string());
+        assert_eq!(local.strftime("%s").unwrap().to_string(), "1234567890".to_string());
+        assert_eq!(local.strftime("%T").unwrap().to_string(), "15:31:30".to_string());
+        assert_eq!(local.strftime("%t").unwrap().to_string(), "\t".to_string());
+        assert_eq!(local.strftime("%U").unwrap().to_string(), "06".to_string());
+        assert_eq!(local.strftime("%u").unwrap().to_string(), "5".to_string());
+        assert_eq!(local.strftime("%V").unwrap().to_string(), "07".to_string());
+        assert_eq!(local.strftime("%v").unwrap().to_string(), "13-Feb-2009".to_string());
+        assert_eq!(local.strftime("%W").unwrap().to_string(), "06".to_string());
+        assert_eq!(local.strftime("%w").unwrap().to_string(), "5".to_string());
+        // FIXME (#2350): support locale
+        assert_eq!(local.strftime("%X").unwrap().to_string(), "15:31:30".to_string());
+        // FIXME (#2350): support locale
+        assert_eq!(local.strftime("%x").unwrap().to_string(), "02/13/09".to_string());
+        assert_eq!(local.strftime("%Y").unwrap().to_string(), "2009".to_string());
+        assert_eq!(local.strftime("%y").unwrap().to_string(), "09".to_string());
+        // FIXME (#2350): support locale
+        assert_eq!(local.strftime("%Z").unwrap().to_string(), "".to_string());
+        assert_eq!(local.strftime("%z").unwrap().to_string(), "-0800".to_string());
+        assert_eq!(local.strftime("%+").unwrap().to_string(),
+                   "2009-02-13T15:31:30-08:00".to_string());
+        assert_eq!(local.strftime("%%").unwrap().to_string(), "%".to_string());
+
+         let invalid_specifiers = ["%E", "%J", "%K", "%L", "%N", "%O", "%o", "%Q", "%q"];
+        for &sp in invalid_specifiers.iter() {
+            assert_eq!(local.strftime(sp).unwrap_err(),
+                       InvalidFormatSpecifier(sp[1..].chars().next().unwrap()));
+        }
+        assert_eq!(local.strftime("%").unwrap_err(), MissingFormatConverter);
+        assert_eq!(local.strftime("%A %").unwrap_err(), MissingFormatConverter);
+
+        assert_eq!(local.asctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string());
+        assert_eq!(local.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string());
+        assert_eq!(local.rfc822z().to_string(), "Fri, 13 Feb 2009 15:31:30 -0800".to_string());
+        assert_eq!(local.rfc3339().to_string(), "2009-02-13T15:31:30-08:00".to_string());
+
+        assert_eq!(utc.asctime().to_string(), "Fri Feb 13 23:31:30 2009".to_string());
+        assert_eq!(utc.ctime().to_string(), "Fri Feb 13 15:31:30 2009".to_string());
+        assert_eq!(utc.rfc822().to_string(), "Fri, 13 Feb 2009 23:31:30 GMT".to_string());
+        assert_eq!(utc.rfc822z().to_string(), "Fri, 13 Feb 2009 23:31:30 -0000".to_string());
+        assert_eq!(utc.rfc3339().to_string(), "2009-02-13T23:31:30Z".to_string());
+    }
+
+    #[test]
+    fn test_timespec_eq_ord() {
+        let a = &Timespec::new(-2, 1);
+        let b = &Timespec::new(-1, 2);
+        let c = &Timespec::new(1, 2);
+        let d = &Timespec::new(2, 1);
+        let e = &Timespec::new(2, 1);
+
+        assert!(d.eq(e));
+        assert!(c.ne(e));
+
+        assert!(a.lt(b));
+        assert!(b.lt(c));
+        assert!(c.lt(d));
+
+        assert!(a.le(b));
+        assert!(b.le(c));
+        assert!(c.le(d));
+        assert!(d.le(e));
+        assert!(e.le(d));
+
+        assert!(b.ge(a));
+        assert!(c.ge(b));
+        assert!(d.ge(c));
+        assert!(e.ge(d));
+        assert!(d.ge(e));
+
+        assert!(b.gt(a));
+        assert!(c.gt(b));
+        assert!(d.gt(c));
+    }
+
+    #[test]
+    #[allow(deprecated)]
+    fn test_timespec_hash() {
+        use std::hash::{Hash, Hasher};
+
+        let c = &Timespec::new(3, 2);
+        let d = &Timespec::new(2, 1);
+        let e = &Timespec::new(2, 1);
+
+        let mut hasher = ::std::hash::SipHasher::new();
+
+        let d_hash:u64 = {
+          d.hash(&mut hasher);
+          hasher.finish()
+        };
+
+        hasher = ::std::hash::SipHasher::new();
+
+        let e_hash:u64 = {
+          e.hash(&mut hasher);
+          hasher.finish()
+        };
+
+        hasher = ::std::hash::SipHasher::new();
+
+        let c_hash:u64 = {
+          c.hash(&mut hasher);
+          hasher.finish()
+        };
+
+        assert_eq!(d_hash, e_hash);
+        assert!(c_hash != e_hash);
+    }
+
+    #[test]
+    fn test_timespec_add() {
+        let a = Timespec::new(1, 2);
+        let b = Duration::seconds(2) + Duration::nanoseconds(3);
+        let c = a + b;
+        assert_eq!(c.sec, 3);
+        assert_eq!(c.nsec, 5);
+
+        let p = Timespec::new(1, super::NSEC_PER_SEC - 2);
+        let q = Duration::seconds(2) + Duration::nanoseconds(2);
+        let r = p + q;
+        assert_eq!(r.sec, 4);
+        assert_eq!(r.nsec, 0);
+
+        let u = Timespec::new(1, super::NSEC_PER_SEC - 2);
+        let v = Duration::seconds(2) + Duration::nanoseconds(3);
+        let w = u + v;
+        assert_eq!(w.sec, 4);
+        assert_eq!(w.nsec, 1);
+
+        let k = Timespec::new(1, 0);
+        let l = Duration::nanoseconds(-1);
+        let m = k + l;
+        assert_eq!(m.sec, 0);
+        assert_eq!(m.nsec, 999_999_999);
+    }
+
+    #[test]
+    fn test_timespec_sub() {
+        let a = Timespec::new(2, 3);
+        let b = Timespec::new(1, 2);
+        let c = a - b;
+        assert_eq!(c.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 + 1));
+
+        let p = Timespec::new(2, 0);
+        let q = Timespec::new(1, 2);
+        let r = p - q;
+        assert_eq!(r.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 - 2));
+
+        let u = Timespec::new(1, 2);
+        let v = Timespec::new(2, 3);
+        let w = u - v;
+        assert_eq!(w.num_nanoseconds(), Some(-super::NSEC_PER_SEC as i64 - 1));
+    }
+
+    #[test]
+    fn test_time_sub() {
+        let a = ::now();
+        let b = at(a.to_timespec() + Duration::seconds(5));
+        let c = b - a;
+        assert_eq!(c.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 * 5));
+    }
+
+    #[test]
+    fn test_steadytime_sub() {
+        let a = SteadyTime::now();
+        let b = a + Duration::seconds(1);
+        assert_eq!(b - a, Duration::seconds(1));
+        assert_eq!(a - b, Duration::seconds(-1));
+    }
+
+    #[test]
+    fn test_date_before_1970() {
+        let early = strptime("1901-01-06", "%F").unwrap();
+        let late = strptime("2000-01-01", "%F").unwrap();
+        assert!(early < late);
+    }
+
+    #[test]
+    fn test_dst() {
+        let _reset = set_time_zone_london_dst();
+        let utc_in_feb = strptime("2015-02-01Z", "%F%z").unwrap();
+        let utc_in_jun = strptime("2015-06-01Z", "%F%z").unwrap();
+        let utc_in_nov = strptime("2015-11-01Z", "%F%z").unwrap();
+        let local_in_feb = utc_in_feb.to_local();
+        let local_in_jun = utc_in_jun.to_local();
+        let local_in_nov = utc_in_nov.to_local();
+
+        assert_eq!(local_in_feb.tm_mon, 1);
+        assert_eq!(local_in_feb.tm_hour, 0);
+        assert_eq!(local_in_feb.tm_utcoff, 0);
+        assert_eq!(local_in_feb.tm_isdst, 0);
+
+        assert_eq!(local_in_jun.tm_mon, 5);
+        assert_eq!(local_in_jun.tm_hour, 1);
+        assert_eq!(local_in_jun.tm_utcoff, 3600);
+        assert_eq!(local_in_jun.tm_isdst, 1);
+
+        assert_eq!(local_in_nov.tm_mon, 10);
+        assert_eq!(local_in_nov.tm_hour, 0);
+        assert_eq!(local_in_nov.tm_utcoff, 0);
+        assert_eq!(local_in_nov.tm_isdst, 0)
+    }
+}
new file mode 100644
--- /dev/null
+++ b/third_party/rust/time-0.1.36/src/parse.rs
@@ -0,0 +1,394 @@
+use super::{Timespec, Tm, at_utc, ParseError, NSEC_PER_SEC};
+
+/// Parses the time from the string according to the format string.
+pub fn strptime(mut s: &str, format: &str) -> Result<Tm, ParseError> {
+    let mut tm = Tm {
+        tm_sec: 0,
+        tm_min: 0,
+        tm_hour: 0,
+        tm_mday: 0,
+        tm_mon: 0,
+        tm_year: 0,
+        tm_wday: 0,
+        tm_yday: 0,
+        tm_isdst: 0,
+        tm_utcoff: 0,
+        tm_nsec: 0,
+    };
+    let mut chars = format.chars();
+
+    while let Some(ch) = chars.next() {
+        if ch == '%' {
+            if let Some(ch) = chars.next() {
+                try!(parse_type(&mut s, ch, &mut tm));
+            }
+        } else {
+            try!(parse_char(&mut s, ch));
+        }
+    }
+
+    Ok(tm)
+}
+
+fn parse_type(s: &mut &str, ch: char, tm: &mut Tm) -> Result<(), ParseError> {
+    match ch {
+        'A' => match match_strs(s, &[("Sunday", 0),
+                                     ("Monday", 1),
+                                     ("Tuesday", 2),
+                                     ("Wednesday", 3),
+                                     ("Thursday", 4),
+                                     ("Friday", 5),
+                                     ("Saturday", 6)]) {
+            Some(v) => { tm.tm_wday = v; Ok(()) }
+            None => Err(ParseError::InvalidDay)
+        },
+        'a' => match match_strs(s, &[("Sun", 0),
+                                     ("Mon", 1),
+                                     ("Tue", 2),
+                                     ("Wed", 3),
+                                     ("Thu", 4),
+                                     ("Fri", 5),
+                                     ("Sat", 6)]) {
+            Some(v) => { tm.tm_wday = v; Ok(()) }
+            None => Err(ParseError::InvalidDay)
+        },
+        'B' => match match_strs(s, &[("January", 0),
+                                     ("February", 1),
+                                     ("March", 2),
+                                     ("April", 3),
+                                     ("May", 4),
+                                     ("June", 5),
+                                     ("July", 6),
+                                     ("August", 7),
+                                     ("September", 8),
+                                     ("October", 9),
+                                     ("November", 10),
+                                     ("December", 11)]) {
+            Some(v) => { tm.tm_mon = v; Ok(()) }
+            None => Err(ParseError::InvalidMonth)
+        },
+        'b' | 'h' => match match_strs(s, &[("Jan", 0),
+                                           ("Feb", 1),
+                                           ("Mar", 2),
+                                           ("Apr", 3),
+                                           ("May", 4),
+                                           ("Jun", 5),
+                                           ("Jul", 6),
+                                           ("Aug", 7),
+                                           ("Sep", 8),
+                                           ("Oct", 9),
+                                           ("Nov", 10),
+                                           ("Dec", 11)]) {
+            Some(v) => { tm.tm_mon = v; Ok(()) }
+            None => Err(ParseError::InvalidMonth)
+        },
+        'C' => match match_digits_in_range(s, 1, 2, false, 0, 99) {
+            Some(v) => { tm.tm_year += (v * 100) - 1900; Ok(()) }
+            None => Err(ParseError::InvalidYear)
+        },
+        'c' => {
+            parse_type(s, 'a', tm)
+                .and_then(|()| parse_char(s, ' '))
+                .and_then(|()| parse_type(s, 'b', tm))
+                .and_then(|()| parse_char(s, ' '))
+                .and_then(|()| parse_type(s, 'e', tm))
+                .and_then(|()| parse_char(s, ' '))
+                .and_then(|()| parse_type(s, 'T', tm))
+                .and_then(|()| parse_char(s, ' '))
+                .and_then(|()| parse_type(s, 'Y', tm))
+        }
+        'D' | 'x' => {
+            parse_type(s, 'm', tm)
+                .and_then(|()| parse_char(s, '/'))
+                .and_then(|()| parse_type(s, 'd', tm))
+                .and_then(|()| parse_char(s, '/'))
+                .and_then(|()| parse_type(s, 'y', tm))
+        }
+        'd' => match match_digits_in_range(s, 1, 2, false, 1, 31) {
+            Some(v) => { tm.tm_mday = v; Ok(()) }
+            None => Err(ParseError::InvalidDayOfMonth)
+        },
+        'e' => match match_digits_in_range(s, 1, 2, true, 1, 31) {
+            Some(v) => { tm.tm_mday = v; Ok(()) }
+            None => Err(ParseError::InvalidDayOfMonth)
+        },
+        'f' => {
+            tm.tm_nsec = match_fractional_seconds(s);
+            Ok(())
+        }
+        'F' => {
+            parse_type(s, 'Y', tm)
+                .and_then(|()| parse_char(s, '-'))
+                .and_then(|()| parse_type(s, 'm', tm))
+                .and_then(|()| parse_char(s, '-'))
+                .and_then(|()| parse_type(s, 'd', tm))
+        }
+        'H' => {
+            match match_digits_in_range(s, 1, 2, false, 0, 23) {
+                Some(v) => { tm.tm_hour = v; Ok(()) }
+                None => Err(ParseError::InvalidHour)
+            }
+        }
+        'I' => {
+            match match_digits_in_range(s, 1, 2, false, 1, 12) {
+                Some(v) => { tm.tm_hour = if v == 12 { 0 } else { v }; Ok(()) }
+                None => Err(ParseError::InvalidHour)
+            }
+        }
+        'j' => {
+            match match_digits_in_range(s, 1, 3, false, 1, 366) {
+                Some(v) => { tm.tm_yday = v - 1; Ok(()) }
+                None => Err(ParseError::InvalidDayOfYear)
+            }
+        }
+        'k' => {
+            match match_digits_in_range(s, 1, 2, true, 0, 23) {
+                Some(v) => { tm.tm_hour = v; Ok(()) }
+                None => Err(ParseError::InvalidHour)
+            }
+        }
+        'l' => {
+            match match_digits_in_range(s, 1, 2, true, 1, 12) {
+                Some(v) => { tm.tm_hour = if v == 12 { 0 } else { v }; Ok(()) }
+                None => Err(ParseError::InvalidHour)
+            }
+        }
+        'M' => {
+            match match_digits_in_range(s, 1, 2, false, 0, 59) {
+                Some(v) => { tm.tm_min = v; Ok(()) }
+                None => Err(ParseError::InvalidMinute)
+            }
+        }
+        'm' => {
+            match match_digits_in_range(s, 1, 2, false, 1, 12) {
+                Some(v) => { tm.tm_mon = v - 1; Ok(()) }
+                None => Err(ParseError::InvalidMonth)
+            }
+        }
+        'n' => parse_char(s, '\n'),
+        'P' => match match_strs(s, &[("am", 0), ("pm", 12)]) {
+            Some(v) => { tm.tm_hour += v; Ok(()) }
+            None => Err(ParseError::InvalidHour)
+        },
+        'p' => match match_strs(s, &[("AM", 0), ("PM", 12)]) {
+            Some(v) => { tm.tm_hour += v; Ok(()) }
+            None => Err(ParseError::InvalidHour)
+        },
+        'R' => {
+            parse_type(s, 'H', tm)
+                .and_then(|()| parse_char(s, ':'))
+                .and_then(|()| parse_type(s, 'M', tm))
+        }
+        'r' => {
+            parse_type(s, 'I', tm)
+                .and_then(|()| parse_char(s, ':'))
+                .and_then(|()| parse_type(s, 'M', tm))
+                .and_then(|()| parse_char(s, ':'))
+                .and_then(|()| parse_type(s, 'S', tm))
+                .and_then(|()| parse_char(s, ' '))
+                .and_then(|()| parse_type(s, 'p', tm))
+        }
+        's' => {
+            match match_digits_i64(s, 1, 18, false) {
+                Some(v) => {
+                    *tm = at_utc(Timespec::new(v, 0));
+                    Ok(())
+                },
+                None => Err(ParseError::InvalidSecondsSinceEpoch)
+            }
+        }
+        'S' => {
+            match match_digits_in_range(s, 1, 2, false, 0, 60) {
+                Some(v) => { tm.tm_sec = v; Ok(()) }
+                None => Err(ParseError::InvalidSecond)
+            }
+        }
+        //'s' {}
+        'T' | 'X' => {
+            parse_type(s, 'H', tm)
+                .and_then(|()| parse_char(s, ':'))
+                .and_then(|()| parse_type(s, 'M', tm))
+                .and_then(|()| parse_char(s, ':'))
+                .and_then(|()| parse_type(s, 'S', tm))
+        }
+        't' => parse_char(s, '\t'),
+        'u' => {
+            match match_digits_in_range(s, 1, 1, false, 1, 7) {
+                Some(v) => { tm.tm_wday = if v == 7 { 0 } else { v }; Ok(()) }
+                None => Err(ParseError::InvalidDayOfWeek)
+            }
+        }
+        'v' => {
+            parse_type(s, 'e', tm)
+                .and_then(|()| parse_char(s, '-'))
+                .and_then(|()| parse_type(s, 'b', tm))
+                .and_then(|()| parse_char(s, '-'))
+                .and_then(|()| parse_type(s, 'Y', tm))
+        }
+        //'W' {}
+        'w' => {
+            match match_digits_in_range(s, 1, 1, false, 0, 6) {
+                Some(v) => { tm.tm_wday = v; Ok(()) }
+                None => Err(ParseError::InvalidDayOfWeek)
+            }
+        }
+        'Y' => {
+            match match_digits(s, 4, 4, false) {
+                Some(v) => { tm.tm_year = v - 1900; Ok(()) }
+                None => Err(ParseError::InvalidYear)
+            }
+        }
+        'y' => {
+            match match_digits_in_range(s, 1, 2, false, 0, 99) {
+                Some(v) => { tm.tm_year = v; Ok(()) }
+                None => Err(ParseError::InvalidYear)
+            }
+        }
+        'Z' => {
+            if match_str(s, "UTC") || match_str(s, "GMT") {
+                tm.tm_utcoff = 0;
+                Ok(())
+            } else {
+                // It's odd, but to maintain compatibility with c's
+                // strptime we ignore the timezone.
+                for (i, ch) in s.char_indices() {
+                    if ch == ' ' {
+                        *s = &s[i..];
+                        return Ok(())
+                    }
+                }
+                *s = "";
+                Ok(())
+            }
+        }
+        'z' => {
+            if parse_char(s, 'Z').is_ok() {
+                tm.tm_utcoff = 0;
+                Ok(())
+            } else {
+                let sign = if parse_char(s, '+').is_ok() {1}
+                           else if parse_char(s, '-').is_ok() {-1}
+                           else { return Err(ParseError::InvalidZoneOffset) };
+
+                let hours;
+                let minutes;
+
+                match match_digits(s, 2, 2, false) {
+                    Some(h) => hours = h,
+                    None => return Err(ParseError::InvalidZoneOffset)
+                }
+
+                // consume the colon if its present,
+                // just ignore it otherwise
+                let _ = parse_char(s, ':');
+
+                match match_digits(s, 2, 2, false) {
+                    Some(m) => minutes = m,
+                    None => return Err(ParseError::InvalidZoneOffset)
+                }
+
+                tm.tm_utcoff = sign * (hours * 60 * 60 + minutes * 60);
+                Ok(())
+            }
+        }
+        '%' => parse_char(s, '%'),
+        ch => Err(ParseError::InvalidFormatSpecifier(ch))
+    }
+}
+
+
+fn match_str(s: &mut &str, needle: &str) -> bool {
+    if s.starts_with(needle) {
+        *s = &s[needle.len()..];
+        true
+    } else {
+        false
+    }
+}
+
+fn match_strs(ss: &mut &str, strs: &[(&str, i32)]) -> Option<i32> {
+    for &(needle, value) in strs.iter() {
+        if match_str(ss, needle) {
+            return Some(value)
+        }
+    }
+    None
+}
+
+fn match_digits(ss: &mut &str, min_digits : usize, max_digits: usize, ws: bool) -> Option<i32> {
+    match match_digits_i64(ss, min_digits, max_digits, ws) {
+        Some(v) => Some(v as i32),
+        None => None
+    }
+}
+
+fn match_digits_i64(ss: &mut &str, min_digits : usize, max_digits: usize, ws: bool) -> Option<i64> {
+    let mut value : i64 = 0;
+    let mut n = 0;
+    if ws {
+        let s2 = ss.trim_left_matches(" ");
+        n = ss.len() - s2.len();
+        if n > max_digits { return None }
+    }
+    let chars = ss[n..].char_indices();
+    for (_, ch) in chars.take(max_digits - n) {
+        match ch {
+            '0' ... '9' => value = value * 10 + (ch as i64 - '0' as i64),
+            _ => break,
+        }
+        n += 1;
+    }
+
+    if n >= min_digits && n <= max_digits {
+        *ss = &ss[n..];
+        Some(value)
+    } else {
+        None
+    }
+}
+
+fn match_fractional_seconds(ss: &mut &str) -> i32 {
+    let mut value = 0;
+    let mut multiplier = NSEC_PER_SEC / 10;
+
+    let mut chars = ss.char_indices();
+    let orig = *ss;
+    for (i, ch) in &mut chars {
+        *ss = &orig[i..];
+        match ch {
+            '0' ... '9' => {
+                // This will drop digits after the nanoseconds place
+                let digit = ch as i32 - '0' as i32;
+                value += digit * multiplier;
+                multiplier /= 10;
+            }
+            _ => break
+        }
+    }
+
+    value
+}
+
+fn match_digits_in_range(ss: &mut &str,
+                         min_digits : usize, max_digits : usize,
+                         ws: bool, min: i32, max: i32) -> Option<i32> {
+    let before = *ss;
+    match match_digits(ss, min_digits, max_digits, ws) {
+        Some(val) if val >= min && val <= max => Some(val),
+        _ => { *ss = before; None }
+    }
+}
+
+fn parse_char(s: &mut &str, c: char) -> Result<(), ParseError> {
+    match s.char_indices().next() {
+        Some((i, c2)) => {
+            if c == c2 {
+                *s = &s[i + c2.len_utf8()..];
+                Ok(())
+            } else {
+                Err(ParseError::UnexpectedCharacter(c, c2))
+            }
+        }
+        None => Err(ParseError::InvalidTime),
+    }
+}
copy from third_party/rust/time/src/sys.rs
copy to third_party/rust/time-0.1.36/src/sys.rs
--- a/third_party/rust/time/.cargo-checksum.json
+++ b/third_party/rust/time/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"9555a092ed1f87de52b07a90c614a30c6fa8f307eb4b05229253d06df363ce7a","Cargo.toml":"9369a5798a85c467578e9be04ffdb220d1d7457950373bd3b0662a62ca58520b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"2c17f942c4a797f6f491c6d40570f904f35047531884ded3244438832b3d6f0a","appveyor.yml":"da991211b72fa6f231af7adb84c9fb72f5a9131d1c0a3d47b8ceffe5a82c8542","benches/precise_time_ns.rs":"f331c85489a05ea3bb83df9d57131a6e651ce852ca881417f328c4e8f53503c6","src/display.rs":"b79a81b4f068e44934ad3398ba0259120cc30cf0855ac5108c4569e320fd7f1d","src/duration.rs":"032f2ced8ea4dddaf6ed111f345e99217bad17edb7ed9fc4c511e405c8e02b87","src/lib.rs":"d01631b2340e30673e4c809678a5bdd3f8c18debb25ada21805a990254cb7caf","src/parse.rs":"717ae5735dfdaaba513f2a54a179e73bb2a48f8d4fb8787740d4662d6ff3389c","src/sys.rs":"a6bf379947da5ed16063a9bfcdf877c84e38e006a9cbc45ee0558cba4cf5c295"},"package":"211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade"}
\ No newline at end of file
+{"files":{".travis.yml":"9555a092ed1f87de52b07a90c614a30c6fa8f307eb4b05229253d06df363ce7a","Cargo.toml":"e51328f4f8dd0d9b1f039121c70de3e8bb4cf29975a64036af64c95bfeaa9e72","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"2c17f942c4a797f6f491c6d40570f904f35047531884ded3244438832b3d6f0a","appveyor.yml":"da991211b72fa6f231af7adb84c9fb72f5a9131d1c0a3d47b8ceffe5a82c8542","benches/precise_time_ns.rs":"f331c85489a05ea3bb83df9d57131a6e651ce852ca881417f328c4e8f53503c6","src/display.rs":"b79a81b4f068e44934ad3398ba0259120cc30cf0855ac5108c4569e320fd7f1d","src/duration.rs":"032f2ced8ea4dddaf6ed111f345e99217bad17edb7ed9fc4c511e405c8e02b87","src/lib.rs":"d01631b2340e30673e4c809678a5bdd3f8c18debb25ada21805a990254cb7caf","src/parse.rs":"717ae5735dfdaaba513f2a54a179e73bb2a48f8d4fb8787740d4662d6ff3389c","src/sys.rs":"0ca713b16747d046e4ce117828148bea66f23f4d461ad17045a24c7895d62be7"},"package":"d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520"}
\ No newline at end of file
--- a/third_party/rust/time/Cargo.toml
+++ b/third_party/rust/time/Cargo.toml
@@ -1,12 +1,12 @@
 [package]
 
 name = "time"
-version = "0.1.36"
+version = "0.1.38"
 authors = ["The Rust Project Developers"]
 license = "MIT/Apache-2.0"
 homepage = "https://github.com/rust-lang/time"
 repository = "https://github.com/rust-lang/time"
 documentation = "https://doc.rust-lang.org/time"
 description = """
 Utilities for working with time-related functions in Rust.
 """
@@ -19,9 +19,11 @@ rustc-serialize = { version = "0.3", opt
 redox_syscall = "0.1"
 
 [target.'cfg(windows)'.dependencies]
 winapi = "0.2.0"
 kernel32-sys = "0.2.0"
 
 [dev-dependencies]
 log = "0.3"
+
+[target.'cfg(windows)'.dev-dependencies]
 advapi32-sys = "0.1.2"
--- a/third_party/rust/time/src/sys.rs
+++ b/third_party/rust/time/src/sys.rs
@@ -204,16 +204,22 @@ mod inner {
     use std::io;
     use Tm;
 
     #[cfg(any(target_os = "macos", target_os = "ios"))]
     pub use self::mac::*;
     #[cfg(all(not(target_os = "macos"), not(target_os = "ios")))]
     pub use self::unix::*;
 
+    #[cfg(target_os = "solaris")]
+    extern {
+        static timezone: time_t;
+        static altzone: time_t;
+    }
+
     fn rust_tm_to_tm(rust_tm: &Tm, tm: &mut libc::tm) {
         tm.tm_sec = rust_tm.tm_sec;
         tm.tm_min = rust_tm.tm_min;
         tm.tm_hour = rust_tm.tm_hour;
         tm.tm_mday = rust_tm.tm_mday;
         tm.tm_mon = rust_tm.tm_mon;
         tm.tm_year = rust_tm.tm_year;
         tm.tm_wday = rust_tm.tm_wday;
@@ -272,24 +278,39 @@ mod inner {
 
     pub fn time_to_local_tm(sec: i64, tm: &mut Tm) {
         unsafe {
             let sec = sec as time_t;
             let mut out = mem::zeroed();
             if libc::localtime_r(&sec, &mut out).is_null() {
                 panic!("localtime_r failed: {}", io::Error::last_os_error());
             }
-            tm_to_rust_tm(&out, out.tm_gmtoff as i32, tm);
+            #[cfg(target_os = "solaris")]
+            let gmtoff = {
+                ::tzset();
+                // < 0 means we don't know; assume we're not in DST.
+                if out.tm_isdst == 0 {
+                    // timezone is seconds west of UTC, tm_gmtoff is seconds east
+                    -timezone
+                } else if out.tm_isdst > 0 {
+                    -altzone
+                } else {
+                    -timezone
+                }
+            };
+            #[cfg(not(target_os = "solaris"))]
+            let gmtoff = out.tm_gmtoff;
+            tm_to_rust_tm(&out, gmtoff as i32, tm);
         }
     }
 
     pub fn utc_tm_to_time(rust_tm: &Tm) -> i64 {
-        #[cfg(all(target_os = "android", not(target_arch = "aarch64")))]
+        #[cfg(all(target_os = "android", target_pointer_width = "32"))]
         use libc::timegm64 as timegm;
-        #[cfg(not(all(target_os = "android", not(target_arch = "aarch64"))))]
+        #[cfg(not(all(target_os = "android", target_pointer_width = "32")))]
         use libc::timegm;
 
         let mut tm = unsafe { mem::zeroed() };
         rust_tm_to_tm(rust_tm, &mut tm);
         unsafe { timegm(&mut tm) as i64 }
     }
 
     pub fn local_tm_to_time(rust_tm: &Tm) -> i64 {
copy from third_party/rust/unicase/.cargo-checksum.json
copy to third_party/rust/unicase-1.4.0/.cargo-checksum.json
copy from third_party/rust/unicase/.travis.yml
copy to third_party/rust/unicase-1.4.0/.travis.yml
copy from third_party/rust/unicase/Cargo.toml
copy to third_party/rust/unicase-1.4.0/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicase-1.4.0/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2014-2015 Sean McArthur
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicase-1.4.0/README.md
@@ -0,0 +1,15 @@
+# unicase
+
+[![Build Status](https://travis-ci.org/seanmonstar/unicase.svg?branch=master)](https://travis-ci.org/seanmonstar/unicase)
+
+Compare strings when case is not important.
+
+```rust
+if UniCase(method) == UniCase('GET') {
+    // GET request
+}
+```
+
+## License
+
+[MIT](./LICENSE)
copy from third_party/rust/unicase/build.rs
copy to third_party/rust/unicase-1.4.0/build.rs
copy from third_party/rust/unicase/src/lib.rs
copy to third_party/rust/unicase-1.4.0/src/lib.rs
--- a/third_party/rust/unicase/.cargo-checksum.json
+++ b/third_party/rust/unicase/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"659372b49358cc4b09cde98923122b608b9733a861ae51a7bb27ffe25808fad7","Cargo.toml":"b0a7941038e0cd9aa68c0bffdd2d872e71e1228f0d6fa33e090c09c843ee6a93","LICENSE":"a745ca7ae4a3c089cfbe4b0a6288fa95776244a65be2914b147878146f8c64da","README.md":"4c7e3e81e09029b9c8465241a6b673ba5f723ea279464fd0d44c3544ed0867c5","build.rs":"81a706e8a238587fdea06eb97c3756dd9eda8d92028c4ccd6339ffedbe0b78ff","src/lib.rs":"cca9109bf1124f46e9158e88b426bd74353917685226aeb442013ad30f84ab5d"},"package":"13a5906ca2b98c799f4b1ab4557b76367ebd6ae5ef14930ec841c74aed5f3764"}
\ No newline at end of file
+{"files":{".travis.yml":"2b8c34447a7f2e36ed670780610caaf95d2b6450406762a28e866d10d412b3a2","Cargo.toml":"c9e02b663403a7bbc6a72da2db4dd19fc107f003c70fc908309168cd01205abc","LICENSE":"a745ca7ae4a3c089cfbe4b0a6288fa95776244a65be2914b147878146f8c64da","README.md":"4c7e3e81e09029b9c8465241a6b673ba5f723ea279464fd0d44c3544ed0867c5","build.rs":"2c7412ba90a1181cdfaf5dbbe04076054cc565fd753a2c83e59c2f34208abf6c","src/lib.rs":"fd09b88d0aa3a0e8f51e060267d031678a86cb6496afaa5f33224c3d2e2deaf3"},"package":"7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"}
\ No newline at end of file
--- a/third_party/rust/unicase/.travis.yml
+++ b/third_party/rust/unicase/.travis.yml
@@ -1,16 +1,26 @@
 language: rust
-rust:
-  - stable
-  - beta
-  - nightly
+
+sudo: false
+
 matrix:
-  allow_failures:
-    - rust: nightly
+    fast_finish: true
+    include:
+        - rust: nightly
+          env: FEATURES="--features nightly"
+        - rust: beta
+        - rust: stable
+        - rust: 1.3.0
+
+cache:
+    apt: true
+    directories:
+        - target/debug/deps
+        - target/debug/build
 
 after_success: |
     [ $TRAVIS_BRANCH = master ] &&
     [ $TRAVIS_PULL_REQUEST = false ] &&
     cargo doc &&
     echo '<meta http-equiv=refresh content=0;url=case/index.html>' > target/doc/index.html &&
     sudo pip install ghp-import &&
     ghp-import -n target/doc &&
--- a/third_party/rust/unicase/Cargo.toml
+++ b/third_party/rust/unicase/Cargo.toml
@@ -1,25 +1,33 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
-
 name = "unicase"
-version = "1.4.0"
+version = "1.4.2"
 authors = ["Sean McArthur <sean.monstar@gmail.com>"]
+build = "build.rs"
 description = "A case-insensitive wrapper around strings."
-repository = "https://github.com/seanmonstar/unicase"
+keywords = ["lowercase", "case", "case-insensitive"]
 license = "MIT"
-keywords = ["lowercase", "case", "case-insensitive"]
-
-build = "build.rs"
-
-[build-dependencies]
-rustc_version = "0.1"
-
+repository = "https://github.com/seanmonstar/unicase"
 [dependencies.heapsize]
 version = ">=0.2.0, <0.4"
 optional = true
 
 [dependencies.heapsize_plugin]
 version = "0.1.2"
 optional = true
+[build-dependencies.version_check]
+version = "0.1"
 
 [features]
 heap_size = ["heapsize", "heapsize_plugin"]
--- a/third_party/rust/unicase/build.rs
+++ b/third_party/rust/unicase/build.rs
@@ -1,7 +1,10 @@
-extern crate rustc_version as rustc;
+extern crate version_check as rustc;
 
 fn main() {
-    if rustc::version_matches(">= 1.5") {
-        println!("cargo:rustc-cfg=iter_cmp");
+    if rustc::is_min_version("1.5.0").map(|(is_min, _)| is_min).unwrap_or(true) {
+        println!("cargo:rustc-cfg=__unicase__iter_cmp");
+    }
+    if rustc::is_min_version("1.13.0").map(|(is_min, _)| is_min).unwrap_or(true) {
+        println!("cargo:rustc-cfg=__unicase__default_hasher");
     }
 }
--- a/third_party/rust/unicase/src/lib.rs
+++ b/third_party/rust/unicase/src/lib.rs
@@ -17,17 +17,17 @@
 //!
 //! assert_eq!(a, b);
 //! ```
 
 #[cfg(feature = "heap_size")]
 extern crate heapsize;
 
 use std::ascii::AsciiExt;
-#[cfg(iter_cmp)]
+#[cfg(__unicase__iter_cmp)]
 use std::cmp::Ordering;
 use std::fmt;
 use std::hash::{Hash, Hasher};
 use std::ops::{Deref, DerefMut};
 use std::str::FromStr;
 
 /// Case Insensitive wrapper of strings.
 #[derive(Copy, Clone, Debug)]
@@ -44,24 +44,24 @@ impl<S> Deref for UniCase<S> {
 
 impl<S> DerefMut for UniCase<S> {
     #[inline]
     fn deref_mut<'a>(&'a mut self) -> &'a mut S {
         &mut self.0
     }
 }
 
-#[cfg(iter_cmp)]
+#[cfg(__unicase__iter_cmp)]
 impl<T: AsRef<str>> PartialOrd for UniCase<T> {
     fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
         Some(self.cmp(other))
     }
 }
 
-#[cfg(iter_cmp)]
+#[cfg(__unicase__iter_cmp)]
 impl<T: AsRef<str>> Ord for UniCase<T> {
     fn cmp(&self, other: &Self) -> Ordering {
         let self_chars = self.as_ref().chars().map(|c| c.to_ascii_lowercase());
         let other_chars = other.as_ref().chars().map(|c| c.to_ascii_lowercase());
         self_chars.cmp(other_chars)
     }
 }
 
@@ -133,20 +133,24 @@ from_impl!(&'a String => &'a str; as_ref
 from_impl!(String => String);
 
 into_impl!(&'a str);
 into_impl!(String);
 
 #[cfg(test)]
 mod test {
     use super::UniCase;
-    use std::hash::{Hash, Hasher, SipHasher};
+    use std::hash::{Hash, Hasher};
+    #[cfg(not(__unicase__default_hasher))]
+    use std::hash::SipHasher as DefaultHasher;
+    #[cfg(__unicase__default_hasher)]
+    use std::collections::hash_map::DefaultHasher;
 
     fn hash<T: Hash>(t: &T) -> u64 {
-        let mut s = SipHasher::new();
+        let mut s = DefaultHasher::new();
         t.hash(&mut s);
         s.finish()
     }
 
     #[test]
     fn test_copy_for_refs() {
         fn foo<T>(_: UniCase<T>) {}
 
@@ -167,17 +171,17 @@ mod test {
     #[test]
     fn test_different_string_types() {
         let a = UniCase("foobar");
         let b = "FOOBAR".to_owned();
         assert_eq!(a, b);
         assert_eq!(UniCase(b), a);
     }
 
-    #[cfg(iter_cmp)]
+    #[cfg(__unicase__iter_cmp)]
     #[test]
     fn test_case_cmp() {
         assert!(UniCase("foobar") == UniCase("FOOBAR"));
         assert!(UniCase("a") < UniCase("B"));
 
         assert!(UniCase("A") < UniCase("b"));
         assert!(UniCase("aa") > UniCase("a"));
 
copy from third_party/rust/unicode-bidi/.cargo-checksum.json
copy to third_party/rust/unicode-bidi-0.3.3/.cargo-checksum.json
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-bidi-0.3.3/.rustfmt.toml
@@ -0,0 +1,6 @@
+array_layout = "Block"
+array_width = 80
+fn_args_layout = "Block"
+fn_brace_style = "SameLineWhere"
+fn_call_style = "Block"
+generics_indent = "Block"
copy from third_party/rust/unicode-bidi/.travis.yml
copy to third_party/rust/unicode-bidi-0.3.3/.travis.yml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-bidi-0.3.3/AUTHORS
@@ -0,0 +1,4 @@
+This software was written by the following people:
+
+Matt Brubeck <mbrubeck@limpet.net>
+Behnam Esfahbod <behnam@zwnj.org>
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-bidi-0.3.3/COPYRIGHT
@@ -0,0 +1,8 @@
+This project is copyright 2015, The Servo Project Developers (given in the
+file AUTHORS).
+
+Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+http://opensource.org/licenses/MIT>, at your option. All files in the project
+carrying such notice may not be copied, modified, or distributed except
+according to those terms.
copy from third_party/rust/unicode-bidi/Cargo.toml
copy to third_party/rust/unicode-bidi-0.3.3/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-bidi-0.3.3/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-bidi-0.3.3/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2015 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
copy from third_party/rust/unicode-bidi/README.md
copy to third_party/rust/unicode-bidi-0.3.3/README.md
rename from third_party/rust/unicode-bidi/benches/basic.rs
rename to third_party/rust/unicode-bidi-0.3.3/benches/basic.rs
rename from third_party/rust/unicode-bidi/benches/udhr.rs
rename to third_party/rust/unicode-bidi-0.3.3/benches/udhr.rs
rename from third_party/rust/unicode-bidi/benches/udhr_data/README.md
rename to third_party/rust/unicode-bidi-0.3.3/benches/udhr_data/README.md
copy from third_party/rust/unicode-bidi/src/char_data/mod.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/char_data/mod.rs
copy from third_party/rust/unicode-bidi/src/char_data/tables.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/char_data/tables.rs
copy from third_party/rust/unicode-bidi/src/deprecated.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/deprecated.rs
copy from third_party/rust/unicode-bidi/src/explicit.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/explicit.rs
copy from third_party/rust/unicode-bidi/src/format_chars.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/format_chars.rs
copy from third_party/rust/unicode-bidi/src/implicit.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/implicit.rs
copy from third_party/rust/unicode-bidi/src/level.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/level.rs
copy from third_party/rust/unicode-bidi/src/lib.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/lib.rs
copy from third_party/rust/unicode-bidi/src/prepare.rs
copy to third_party/rust/unicode-bidi-0.3.3/src/prepare.rs
rename from third_party/rust/unicode-bidi/tests/conformance_tests.rs
rename to third_party/rust/unicode-bidi-0.3.3/tests/conformance_tests.rs
rename from third_party/rust/unicode-bidi/tools/generate.py
rename to third_party/rust/unicode-bidi-0.3.3/tools/generate.py
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unicode-bidi/.appveyor.yml
@@ -0,0 +1,19 @@
+install:
+  - ps: Start-FileDownload 'https://static.rust-lang.org/dist/rust-nightly-i686-pc-windows-gnu.exe'
+  - rust-nightly-i686-pc-windows-gnu.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
+  - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
+  - rustc -V
+  - cargo -V
+  - git submodule update --init --recursive
+
+build: false
+
+environment:
+    RUST_BACKTRACE: full
+
+test_script:
+  - cargo build --verbose --all
+  - cargo doc   --verbose --all --no-deps
+
+  - cargo test  --verbose --all
+  - cargo test  --verbose --all --features serde
--- a/third_party/rust/unicode-bidi/.cargo-checksum.json
+++ b/third_party/rust/unicode-bidi/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".rustfmt.toml":"4587a30e695dc4afdd3b5d33370cf712c90a716de06ab0c5a2c023b0f269ab1a",".travis.yml":"e340419604a35e795fc3afdab237eb0ea3a31e71c98fb98fa88626d61b8a50f7","AUTHORS":"1ff3a7c8519b29544bb28ba9b1e7502df0cb764051fb9a1172e60006aa2b8dcc","COPYRIGHT":"edb20b474f6cbd4f4db066b54a9e0f687d0009d309412a63431189b59b8e2a07","Cargo.toml":"dc21922a66df3876268bc4c187aeaf8db875aee8a1869c7f78e2c67b2e572680","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7b63ecd5f1902af1b63729947373683c32745c16a10e8e6292e2e2dcd7e90ae0","README.md":"e764abd9a6abbe9517dd9dedc003dd64594351282437a509fec9362ef136686d","benches/basic.rs":"e1538acb2de8b0c510d663d5ba0b6877f148955774c713a7aa2374b62ceb6e6a","benches/udhr.rs":"7869911021fc0f0a71246d2535183a4610a0b9efd14fc8fc58daf121a02acd21","benches/udhr_data/README.md":"103dd98f2777082f73dd90ce441245370169a6e889b329da81ee4b9c236c0e05","src/char_data/mod.rs":"6fa055d2c81061bcc15854eb91f897998ed9109725827932266a0dc4d4051166","src/char_data/tables.rs":"3742ed00360d3955b10ba690b1446e69ddf04f2cee13e86dd185ba6641bc6198","src/deprecated.rs":"ce1b62ac47d0d7ea547a1e03d17cd86b6b850e4e095642ba2e9c29130f13fa72","src/explicit.rs":"273c56d064891a9b2f1ef61f81845c0467c81db4e3ce756a9f2ac58f7e6e3e14","src/format_chars.rs":"0b60e26adfff7f61abfbaf63bc5e37896f12f9d420a6df630c4f71e0acb4222a","src/implicit.rs":"ab583bd9f0e9ecff8bd5e26253912c1f40598d0212a6bc78664774149c38dccb","src/level.rs":"b8739d4dd84d9270140047972167d9e72db8637c769228eec17d12e07c5ab55f","src/lib.rs":"f264fe18c7ae5d4c4b100f9304be0466a138384cbcc9b08cb7b5185c5aac6bd4","src/prepare.rs":"cacf4ff9f7b0adf700b9f5cd82165c67eec93fd8e4d05cb6c7fe54111d9bbe40","tests/conformance_tests.rs":"777c74cbb3946d5b4495d4f8abe1f8edd0169a38bb724c44eea82eff5ca9581d","tools/generate.py":"12f94bdf2226f306d993fe2a0fa623b8dc9b1db1ac038a17ab44892ccdc8feeb"},"package":"a6a2c4e3710edd365cd7e78383153ed739fa31af19f9172f72d3575060f5a43a"}
\ No newline at end of file
+{"files":{".appveyor.yml":"ab30fe181e4c87679afd5f7f10f6dcf622fd4d5df5a872e5f5d84911348dd60e",".rustfmt.toml":"4587a30e695dc4afdd3b5d33370cf712c90a716de06ab0c5a2c023b0f269ab1a",".travis.yml":"e93173a373b24339c49452f973bc6c086e13bf364d8637599a5f63e4d5b357cd","AUTHORS":"1ff3a7c8519b29544bb28ba9b1e7502df0cb764051fb9a1172e60006aa2b8dcc","COPYRIGHT":"edb20b474f6cbd4f4db066b54a9e0f687d0009d309412a63431189b59b8e2a07","Cargo.toml":"4f2ad9af370a75060a68d930ce56613b7a3dc47a33bd22d0a3e43118f0d62172","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"7b63ecd5f1902af1b63729947373683c32745c16a10e8e6292e2e2dcd7e90ae0","README.md":"bec1ce7b4dd0873f67e5b3f615453557403caaa385d01a53e2de0201e4b19fa2","src/char_data/mod.rs":"400505d0c7f9f201403e828181dde79648f412c0f72aa4ced76c1b91fcdd087c","src/char_data/tables.rs":"a27f625544bc49817b02b78cf55997a73d27dc4d616724aa96f70128b9629b23","src/deprecated.rs":"314c68b009ed66989bd233dc3d07ac0eea1327ec4fe6ee9cb41c26c3dcf05d97","src/explicit.rs":"fdf07374d0a5825bc9d6e616be10b57cc0b159d39590d86409da6df50b6a2ee7","src/format_chars.rs":"678399fec3f4bfaf4093f38cfdb8956288313386dc3511dab9fb58164e8dc01b","src/implicit.rs":"bd324d5f4814610b18851ad2981b8a18b04c3817bb8492b4346e15cb712daf3c","src/level.rs":"d31289f55b65602863c16bce37e370ff6ca8fa8cee344787e06acf215d29a77a","src/lib.rs":"b32ad80998b7cd11bf2edca7a5eca81cc8d4a33656758751ec4958c74649e029","src/prepare.rs":"a9f7db29099fb557dfec56fbb5b24d031a5ee0b9b3fb9a73a3a92e3fe1ebd051"},"package":"49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"}
\ No newline at end of file
--- a/third_party/rust/unicode-bidi/.travis.yml
+++ b/third_party/rust/unicode-bidi/.travis.yml
@@ -1,24 +1,38 @@
+language: rust
 sudo: false
-language: rust
+os: linux
+dist: trusty
 
 rust:
   - nightly
   - beta
   - stable
-  - 1.15.0
+  - 1.17.0
 
 matrix:
   fast_finish: true
+  allow_failures:
+    - rust: nightly
 
 notifications:
   webhooks: http://build.servo.org:54856/travis
+  email:
+    on_success: never
 
-before_script:
-    - pip install git+https://github.com/euclio/travis-cargo@kcov --user && export PATH=$HOME/.local/bin:$PATH
+env:
+  global:
+    - RUST_BACKTRACE=full
 
 script:
   - cargo build --verbose
+  - cargo doc   --verbose --no-deps
+
   - cargo test  --verbose
-  - cargo test  --verbose --features with_serde
-  - cargo doc   --verbose --no-deps
-  - travis-cargo bench
+  - cargo test  --verbose --features 'serde'
+  - cargo test  --verbose --features 'with_serde'
+
+  - test "$TRAVIS_RUST_VERSION" != "nightly" ||
+    cargo bench --verbose --features 'bench_it'
+
+  - test "$TRAVIS_RUST_VERSION" != "nightly" ||
+    cargo run   --verbose --features 'flame_it' --example 'flame_udhr'
--- a/third_party/rust/unicode-bidi/Cargo.toml
+++ b/third_party/rust/unicode-bidi/Cargo.toml
@@ -1,27 +1,49 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
 [package]
 name = "unicode-bidi"
-version = "0.3.3"
+version = "0.3.4"
 authors = ["The Servo Project Developers"]
-license = "MIT / Apache-2.0"
+exclude = ["benches/**", "data/**", "examples/**", "tests/**", "tools/**"]
 description = "Implementation of the Unicode Bidirectional Algorithm"
-repository = "https://github.com/servo/unicode-bidi"
 documentation = "http://doc.servo.org/unicode_bidi/"
 keywords = ["rtl", "unicode", "text", "layout", "bidi"]
-
-exclude = ["*.txt"]
+license = "MIT / Apache-2.0"
+repository = "https://github.com/servo/unicode-bidi"
 
 [lib]
 name = "unicode_bidi"
+[dependencies.flame]
+version = "0.1"
+optional = true
 
-[dependencies]
-matches = "0.1"
-serde = {version = ">=0.8, <2.0", optional = true}
-serde_derive = {version = ">=0.8, <2.0", optional = true}
+[dependencies.flamer]
+version = "0.1"
+optional = true
 
-[dev-dependencies]
-serde_test = ">=0.8, <2.0"
+[dependencies.serde]
+version = ">=0.8, <2.0"
+features = ["derive"]
+optional = true
+
+[dependencies.matches]
+version = "0.1"
+[dev-dependencies.serde_test]
+version = ">=0.8, <2.0"
 
 [features]
+with_serde = ["serde"]
+flame_it = ["flame", "flamer"]
+unstable = []
 default = []
-unstable = []  # Use in benches/
-with_serde = ["serde", "serde_derive"]
+bench_it = []
--- a/third_party/rust/unicode-bidi/README.md
+++ b/third_party/rust/unicode-bidi/README.md
@@ -1,11 +1,12 @@
 # unicode-bidi
 
 This crate implements the [Unicode Bidirectional Algorithm][tr9] for display
 of mixed right-to-left and left-to-right text.  It is written in safe Rust,
 compatible with the current stable release.
 
 [Documentation](http://doc.servo.org/unicode_bidi/)
 
-[![Build Status](https://travis-ci.org/servo/unicode-bidi.svg?branch=master)](https://travis-ci.org/servo/unicode-bidi)
+[![Travis-CI](https://travis-ci.org/servo/unicode-bidi.svg?branch=master)](https://travis-ci.org/servo/unicode-bidi)
+[![AppVeyor](https://img.shields.io/appveyor/ci/servo/unicode-bidi/master.svg)](https://ci.appveyor.com/project/servo/unicode-bidi)
 
 [tr9]: http://www.unicode.org/reports/tr9/
--- a/third_party/rust/unicode-bidi/src/char_data/mod.rs
+++ b/third_party/rust/unicode-bidi/src/char_data/mod.rs
@@ -14,103 +14,123 @@ mod tables;
 pub use self::tables::{BidiClass, UNICODE_VERSION};
 
 use std::cmp::Ordering::{Equal, Less, Greater};
 use std::char;
 
 use self::tables::bidi_class_table;
 use BidiClass::*;
 
-/// Find the BidiClass of a single char.
+/// Find the `BidiClass` of a single char.
 pub fn bidi_class(c: char) -> BidiClass {
     bsearch_range_value_table(c, bidi_class_table)
 }
 
 pub fn is_rtl(bidi_class: BidiClass) -> bool {
     match bidi_class {
         RLE | RLO | RLI => true,
         _ => false,
     }
 }
 
 fn bsearch_range_value_table(c: char, r: &'static [(char, char, BidiClass)]) -> BidiClass {
-    match r.binary_search_by(
-        |&(lo, hi, _)| if lo <= c && c <= hi {
-            Equal
-        } else if hi < c {
-            Less
-        } else {
-            Greater
-        }
-    ) {
+    match r.binary_search_by(|&(lo, hi, _)| if lo <= c && c <= hi {
+        Equal
+    } else if hi < c {
+        Less
+    } else {
+        Greater
+    }) {
         Ok(idx) => {
             let (_, _, cat) = r[idx];
             cat
         }
         // UCD/extracted/DerivedBidiClass.txt: "All code points not explicitly listed
         // for Bidi_Class have the value Left_To_Right (L)."
         Err(_) => L,
     }
 }
 
 #[cfg(test)]
 mod tests {
     use super::*;
 
     #[test]
-    fn test_bidi_class() {
-        for (input, expected) in
-            vec![
-                (0x0000, BN),
-                (0x0040, ON),
-                (0x0041, L),
-                (0x0062, L),
-                (0x007F, BN),
+    fn test_ascii() {
+        assert_eq!(bidi_class('\u{0000}'), BN);
+        assert_eq!(bidi_class('\u{0040}'), ON);
+        assert_eq!(bidi_class('\u{0041}'), L);
+        assert_eq!(bidi_class('\u{0062}'), L);
+        assert_eq!(bidi_class('\u{007F}'), BN);
+    }
+
+    #[test]
+    fn test_bmp() {
+        // Hebrew
+        assert_eq!(bidi_class('\u{0590}'), R);
+        assert_eq!(bidi_class('\u{05D0}'), R);
+        assert_eq!(bidi_class('\u{05D1}'), R);
+        assert_eq!(bidi_class('\u{05FF}'), R);
 
-                // Hebrew
-                (0x0590, R),
-                (0x05D0, R),
-                (0x05D1, R),
-                (0x05FF, R),
+        // Arabic
+        assert_eq!(bidi_class('\u{0600}'), AN);
+        assert_eq!(bidi_class('\u{0627}'), AL);
+        assert_eq!(bidi_class('\u{07BF}'), AL);
 
-                // Arabic
-                (0x0600, AN),
-                (0x0627, AL),
-                (0x07BF, AL),
+        // Default R + Arabic Extras
+        assert_eq!(bidi_class('\u{07C0}'), R);
+        assert_eq!(bidi_class('\u{085F}'), R);
+        assert_eq!(bidi_class('\u{0860}'), AL);
+        assert_eq!(bidi_class('\u{0870}'), R);
+        assert_eq!(bidi_class('\u{089F}'), R);
+        assert_eq!(bidi_class('\u{08A0}'), AL);
+        assert_eq!(bidi_class('\u{089F}'), R);
+        assert_eq!(bidi_class('\u{08FF}'), NSM);
+
+        // Default ET
+        assert_eq!(bidi_class('\u{20A0}'), ET);
+        assert_eq!(bidi_class('\u{20CF}'), ET);
 
-                // Default R + Arabic Extras
-                (0x07C0, R),
-                (0x085F, R),
-                (0x0860, R),
-                (0x089F, R),
-                (0x08A0, AL),
-                (0x089F, R),
-                (0x08FF, NSM),
+        // Arabic Presentation Forms
+        assert_eq!(bidi_class('\u{FB1D}'), R);
+        assert_eq!(bidi_class('\u{FB4F}'), R);
+        assert_eq!(bidi_class('\u{FB50}'), AL);
+        assert_eq!(bidi_class('\u{FDCF}'), AL);
+        assert_eq!(bidi_class('\u{FDF0}'), AL);
+        assert_eq!(bidi_class('\u{FDFF}'), AL);
+        assert_eq!(bidi_class('\u{FE70}'), AL);
+        assert_eq!(bidi_class('\u{FEFE}'), AL);
+        assert_eq!(bidi_class('\u{FEFF}'), BN);
 
-                // Default ET
-                (0x20A0, ET),
-                (0x20CF, ET),
+        // noncharacters
+        assert_eq!(bidi_class('\u{FDD0}'), L);
+        assert_eq!(bidi_class('\u{FDD1}'), L);
+        assert_eq!(bidi_class('\u{FDEE}'), L);
+        assert_eq!(bidi_class('\u{FDEF}'), L);
+        assert_eq!(bidi_class('\u{FFFE}'), L);
+        assert_eq!(bidi_class('\u{FFFF}'), L);
+    }
 
-                // Arabic Presentation Forms
-                (0xFB1D, R),
-                (0xFB4F, R),
-                (0xFB50, AL),
-                (0xFDCF, AL),
-                (0xFDF0, AL),
-                (0xFDFF, AL),
-                (0xFE70, AL),
-                (0xFEFE, AL),
-                (0xFEFF, BN),
+    #[test]
+    fn test_smp() {
+        // Default AL + R
+        assert_eq!(bidi_class('\u{10800}'), R);
+        assert_eq!(bidi_class('\u{10FFF}'), R);
+        assert_eq!(bidi_class('\u{1E800}'), R);
+        assert_eq!(bidi_class('\u{1EDFF}'), R);
+        assert_eq!(bidi_class('\u{1EE00}'), AL);
+        assert_eq!(bidi_class('\u{1EEFF}'), AL);
+        assert_eq!(bidi_class('\u{1EF00}'), R);
+        assert_eq!(bidi_class('\u{1EFFF}'), R);
+    }
 
-                // Default AL + R
-                (0x10800, R),
-                (0x10FFF, R),
-                (0x1E800, R),
-                (0x1EDFF, R),
-                (0x1EE00, AL),
-                (0x1EEFF, AL),
-                (0x1EF00, R),
-                (0x1EFFF, R),
-            ] {
-            assert_eq!(bidi_class(char::from_u32(input).unwrap()), expected);
-        }
+    #[test]
+    fn test_unassigned_planes() {
+        assert_eq!(bidi_class('\u{30000}'), L);
+        assert_eq!(bidi_class('\u{40000}'), L);
+        assert_eq!(bidi_class('\u{50000}'), L);
+        assert_eq!(bidi_class('\u{60000}'), L);
+        assert_eq!(bidi_class('\u{70000}'), L);
+        assert_eq!(bidi_class('\u{80000}'), L);
+        assert_eq!(bidi_class('\u{90000}'), L);
+        assert_eq!(bidi_class('\u{a0000}'), L);
     }
 }
--- a/third_party/rust/unicode-bidi/src/char_data/tables.rs
+++ b/third_party/rust/unicode-bidi/src/char_data/tables.rs
@@ -1,25 +1,25 @@
 // NOTE:
 // The following code was generated by "tools/generate.py". do not edit directly
 
 #![allow(missing_docs, non_upper_case_globals, non_snake_case)]
 #![cfg_attr(rustfmt, rustfmt_skip)]
 
 /// The [Unicode version](http://www.unicode.org/versions/) of data
-pub const UNICODE_VERSION: (u64, u64, u64) = (9, 0, 0);
+pub const UNICODE_VERSION: (u64, u64, u64) = (10, 0, 0);
 
 #[allow(non_camel_case_types)]
 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
 /// Represents values of the Unicode character property
-/// [Bidi_Class](http://www.unicode.org/reports/tr44/#Bidi_Class), also
+/// [`Bidi_Class`](http://www.unicode.org/reports/tr44/#Bidi_Class), also
 /// known as the *bidirectional character type*.
 ///
-/// * http://www.unicode.org/reports/tr9/#Bidirectional_Character_Types
-/// * http://www.unicode.org/reports/tr44/#Bidi_Class_Values
+/// * <http://www.unicode.org/reports/tr9/#Bidirectional_Character_Types>
+/// * <http://www.unicode.org/reports/tr44/#Bidi_Class_Values>
 pub enum BidiClass {
     AL,
     AN,
     B,
     BN,
     CS,
     EN,
     ES,
@@ -79,338 +79,350 @@ pub const bidi_class_table: &'static [(c
     '\u{6e4}', NSM), ('\u{6e5}', '\u{6e6}', AL), ('\u{6e7}', '\u{6e8}', NSM), ('\u{6e9}', '\u{6e9}',
     ON), ('\u{6ea}', '\u{6ed}', NSM), ('\u{6ee}', '\u{6ef}', AL), ('\u{6f0}', '\u{6f9}', EN),
     ('\u{6fa}', '\u{710}', AL), ('\u{711}', '\u{711}', NSM), ('\u{712}', '\u{72f}', AL), ('\u{730}',
     '\u{74a}', NSM), ('\u{74b}', '\u{7a5}', AL), ('\u{7a6}', '\u{7b0}', NSM), ('\u{7b1}', '\u{7bf}',
     AL), ('\u{7c0}', '\u{7ea}', R), ('\u{7eb}', '\u{7f3}', NSM), ('\u{7f4}', '\u{7f5}', R),
     ('\u{7f6}', '\u{7f9}', ON), ('\u{7fa}', '\u{815}', R), ('\u{816}', '\u{819}', NSM), ('\u{81a}',
     '\u{81a}', R), ('\u{81b}', '\u{823}', NSM), ('\u{824}', '\u{824}', R), ('\u{825}', '\u{827}',
     NSM), ('\u{828}', '\u{828}', R), ('\u{829}', '\u{82d}', NSM), ('\u{82e}', '\u{858}', R),
-    ('\u{859}', '\u{85b}', NSM), ('\u{85c}', '\u{89f}', R), ('\u{8a0}', '\u{8d3}', AL), ('\u{8d4}',
-    '\u{8e1}', NSM), ('\u{8e2}', '\u{8e2}', AN), ('\u{8e3}', '\u{902}', NSM), ('\u{903}', '\u{939}',
-    L), ('\u{93a}', '\u{93a}', NSM), ('\u{93b}', '\u{93b}', L), ('\u{93c}', '\u{93c}', NSM),
-    ('\u{93d}', '\u{940}', L), ('\u{941}', '\u{948}', NSM), ('\u{949}', '\u{94c}', L), ('\u{94d}',
-    '\u{94d}', NSM), ('\u{94e}', '\u{950}', L), ('\u{951}', '\u{957}', NSM), ('\u{958}', '\u{961}',
-    L), ('\u{962}', '\u{963}', NSM), ('\u{964}', '\u{980}', L), ('\u{981}', '\u{981}', NSM),
-    ('\u{982}', '\u{983}', L), ('\u{985}', '\u{98c}', L), ('\u{98f}', '\u{990}', L), ('\u{993}',
-    '\u{9a8}', L), ('\u{9aa}', '\u{9b0}', L), ('\u{9b2}', '\u{9b2}', L), ('\u{9b6}', '\u{9b9}', L),
-    ('\u{9bc}', '\u{9bc}', NSM), ('\u{9bd}', '\u{9c0}', L), ('\u{9c1}', '\u{9c4}', NSM), ('\u{9c7}',
-    '\u{9c8}', L), ('\u{9cb}', '\u{9cc}', L), ('\u{9cd}', '\u{9cd}', NSM), ('\u{9ce}', '\u{9ce}',
-    L), ('\u{9d7}', '\u{9d7}', L), ('\u{9dc}', '\u{9dd}', L), ('\u{9df}', '\u{9e1}', L), ('\u{9e2}',
-    '\u{9e3}', NSM), ('\u{9e6}', '\u{9f1}', L), ('\u{9f2}', '\u{9f3}', ET), ('\u{9f4}', '\u{9fa}',
-    L), ('\u{9fb}', '\u{9fb}', ET), ('\u{a01}', '\u{a02}', NSM), ('\u{a03}', '\u{a03}', L),
+    ('\u{859}', '\u{85b}', NSM), ('\u{85c}', '\u{85f}', R), ('\u{860}', '\u{86a}', AL), ('\u{86b}',
+    '\u{89f}', R), ('\u{8a0}', '\u{8d3}', AL), ('\u{8d4}', '\u{8e1}', NSM), ('\u{8e2}', '\u{8e2}',
+    AN), ('\u{8e3}', '\u{902}', NSM), ('\u{903}', '\u{939}', L), ('\u{93a}', '\u{93a}', NSM),
+    ('\u{93b}', '\u{93b}', L), ('\u{93c}', '\u{93c}', NSM), ('\u{93d}', '\u{940}', L), ('\u{941}',
+    '\u{948}', NSM), ('\u{949}', '\u{94c}', L), ('\u{94d}', '\u{94d}', NSM), ('\u{94e}', '\u{950}',
+    L), ('\u{951}', '\u{957}', NSM), ('\u{958}', '\u{961}', L), ('\u{962}', '\u{963}', NSM),
+    ('\u{964}', '\u{980}', L), ('\u{981}', '\u{981}', NSM), ('\u{982}', '\u{983}', L), ('\u{985}',
+    '\u{98c}', L), ('\u{98f}', '\u{990}', L), ('\u{993}', '\u{9a8}', L), ('\u{9aa}', '\u{9b0}', L),
+    ('\u{9b2}', '\u{9b2}', L), ('\u{9b6}', '\u{9b9}', L), ('\u{9bc}', '\u{9bc}', NSM), ('\u{9bd}',
+    '\u{9c0}', L), ('\u{9c1}', '\u{9c4}', NSM), ('\u{9c7}', '\u{9c8}', L), ('\u{9cb}', '\u{9cc}',
+    L), ('\u{9cd}', '\u{9cd}', NSM), ('\u{9ce}', '\u{9ce}', L), ('\u{9d7}', '\u{9d7}', L),
+    ('\u{9dc}', '\u{9dd}', L), ('\u{9df}', '\u{9e1}', L), ('\u{9e2}', '\u{9e3}', NSM), ('\u{9e6}',
+    '\u{9f1}', L), ('\u{9f2}', '\u{9f3}', ET), ('\u{9f4}', '\u{9fa}', L), ('\u{9fb}', '\u{9fb}',
+    ET), ('\u{9fc}', '\u{9fd}', L), ('\u{a01}', '\u{a02}', NSM), ('\u{a03}', '\u{a03}', L),
     ('\u{a05}', '\u{a0a}', L), ('\u{a0f}', '\u{a10}', L), ('\u{a13}', '\u{a28}', L), ('\u{a2a}',
     '\u{a30}', L), ('\u{a32}', '\u{a33}', L), ('\u{a35}', '\u{a36}', L), ('\u{a38}', '\u{a39}', L),
     ('\u{a3c}', '\u{a3c}', NSM), ('\u{a3e}', '\u{a40}', L), ('\u{a41}', '\u{a42}', NSM), ('\u{a47}',
     '\u{a48}', NSM), ('\u{a4b}', '\u{a4d}', NSM), ('\u{a51}', '\u{a51}', NSM), ('\u{a59}',
     '\u{a5c}', L), ('\u{a5e}', '\u{a5e}', L), ('\u{a66}', '\u{a6f}', L), ('\u{a70}', '\u{a71}',
     NSM), ('\u{a72}', '\u{a74}', L), ('\u{a75}', '\u{a75}', NSM), ('\u{a81}', '\u{a82}', NSM),
     ('\u{a83}', '\u{a83}', L), ('\u{a85}', '\u{a8d}', L), ('\u{a8f}', '\u{a91}', L), ('\u{a93}',
     '\u{aa8}', L), ('\u{aaa}', '\u{ab0}', L), ('\u{ab2}', '\u{ab3}', L), ('\u{ab5}', '\u{ab9}', L),
     ('\u{abc}', '\u{abc}', NSM), ('\u{abd}', '\u{ac0}', L), ('\u{ac1}', '\u{ac5}', NSM), ('\u{ac7}',
     '\u{ac8}', NSM), ('\u{ac9}', '\u{ac9}', L), ('\u{acb}', '\u{acc}', L), ('\u{acd}', '\u{acd}',
     NSM), ('\u{ad0}', '\u{ad0}', L), ('\u{ae0}', '\u{ae1}', L), ('\u{ae2}', '\u{ae3}', NSM),
-    ('\u{ae6}', '\u{af0}', L), ('\u{af1}', '\u{af1}', ET), ('\u{af9}', '\u{af9}', L), ('\u{b01}',
-    '\u{b01}', NSM), ('\u{b02}', '\u{b03}', L), ('\u{b05}', '\u{b0c}', L), ('\u{b0f}', '\u{b10}',
-    L), ('\u{b13}', '\u{b28}', L), ('\u{b2a}', '\u{b30}', L), ('\u{b32}', '\u{b33}', L), ('\u{b35}',
-    '\u{b39}', L), ('\u{b3c}', '\u{b3c}', NSM), ('\u{b3d}', '\u{b3e}', L), ('\u{b3f}', '\u{b3f}',
-    NSM), ('\u{b40}', '\u{b40}', L), ('\u{b41}', '\u{b44}', NSM), ('\u{b47}', '\u{b48}', L),
-    ('\u{b4b}', '\u{b4c}', L), ('\u{b4d}', '\u{b4d}', NSM), ('\u{b56}', '\u{b56}', NSM), ('\u{b57}',
-    '\u{b57}', L), ('\u{b5c}', '\u{b5d}', L), ('\u{b5f}', '\u{b61}', L), ('\u{b62}', '\u{b63}',
-    NSM), ('\u{b66}', '\u{b77}', L), ('\u{b82}', '\u{b82}', NSM), ('\u{b83}', '\u{b83}', L),
-    ('\u{b85}', '\u{b8a}', L), ('\u{b8e}', '\u{b90}', L), ('\u{b92}', '\u{b95}', L), ('\u{b99}',
-    '\u{b9a}', L), ('\u{b9c}', '\u{b9c}', L), ('\u{b9e}', '\u{b9f}', L), ('\u{ba3}', '\u{ba4}', L),
-    ('\u{ba8}', '\u{baa}', L), ('\u{bae}', '\u{bb9}', L), ('\u{bbe}', '\u{bbf}', L), ('\u{bc0}',
-    '\u{bc0}', NSM), ('\u{bc1}', '\u{bc2}', L), ('\u{bc6}', '\u{bc8}', L), ('\u{bca}', '\u{bcc}',
-    L), ('\u{bcd}', '\u{bcd}', NSM), ('\u{bd0}', '\u{bd0}', L), ('\u{bd7}', '\u{bd7}', L),
-    ('\u{be6}', '\u{bf2}', L), ('\u{bf3}', '\u{bf8}', ON), ('\u{bf9}', '\u{bf9}', ET), ('\u{bfa}',
-    '\u{bfa}', ON), ('\u{c00}', '\u{c00}', NSM), ('\u{c01}', '\u{c03}', L), ('\u{c05}', '\u{c0c}',
-    L), ('\u{c0e}', '\u{c10}', L), ('\u{c12}', '\u{c28}', L), ('\u{c2a}', '\u{c39}', L), ('\u{c3d}',
-    '\u{c3d}', L), ('\u{c3e}', '\u{c40}', NSM), ('\u{c41}', '\u{c44}', L), ('\u{c46}', '\u{c48}',
-    NSM), ('\u{c4a}', '\u{c4d}', NSM), ('\u{c55}', '\u{c56}', NSM), ('\u{c58}', '\u{c5a}', L),
-    ('\u{c60}', '\u{c61}', L), ('\u{c62}', '\u{c63}', NSM), ('\u{c66}', '\u{c6f}', L), ('\u{c78}',
-    '\u{c7e}', ON), ('\u{c7f}', '\u{c80}', L), ('\u{c81}', '\u{c81}', NSM), ('\u{c82}', '\u{c83}',
-    L), ('\u{c85}', '\u{c8c}', L), ('\u{c8e}', '\u{c90}', L), ('\u{c92}', '\u{ca8}', L), ('\u{caa}',
-    '\u{cb3}', L), ('\u{cb5}', '\u{cb9}', L), ('\u{cbc}', '\u{cbc}', NSM), ('\u{cbd}', '\u{cc4}',
-    L), ('\u{cc6}', '\u{cc8}', L), ('\u{cca}', '\u{ccb}', L), ('\u{ccc}', '\u{ccd}', NSM),
-    ('\u{cd5}', '\u{cd6}', L), ('\u{cde}', '\u{cde}', L), ('\u{ce0}', '\u{ce1}', L), ('\u{ce2}',
-    '\u{ce3}', NSM), ('\u{ce6}', '\u{cef}', L), ('\u{cf1}', '\u{cf2}', L), ('\u{d01}', '\u{d01}',
-    NSM), ('\u{d02}', '\u{d03}', L), ('\u{d05}', '\u{d0c}', L), ('\u{d0e}', '\u{d10}', L),
-    ('\u{d12}', '\u{d3a}', L), ('\u{d3d}', '\u{d40}', L), ('\u{d41}', '\u{d44}', NSM), ('\u{d46}',
-    '\u{d48}', L), ('\u{d4a}', '\u{d4c}', L), ('\u{d4d}', '\u{d4d}', NSM), ('\u{d4e}', '\u{d4f}',
-    L), ('\u{d54}', '\u{d61}', L), ('\u{d62}', '\u{d63}', NSM), ('\u{d66}', '\u{d7f}', L),
-    ('\u{d82}', '\u{d83}', L), ('\u{d85}', '\u{d96}', L), ('\u{d9a}', '\u{db1}', L), ('\u{db3}',
-    '\u{dbb}', L), ('\u{dbd}', '\u{dbd}', L), ('\u{dc0}', '\u{dc6}', L), ('\u{dca}', '\u{dca}',
-    NSM), ('\u{dcf}', '\u{dd1}', L), ('\u{dd2}', '\u{dd4}', NSM), ('\u{dd6}', '\u{dd6}', NSM),
-    ('\u{dd8}', '\u{ddf}', L), ('\u{de6}', '\u{def}', L), ('\u{df2}', '\u{df4}', L), ('\u{e01}',
-    '\u{e30}', L), ('\u{e31}', '\u{e31}', NSM), ('\u{e32}', '\u{e33}', L), ('\u{e34}', '\u{e3a}',
-    NSM), ('\u{e3f}', '\u{e3f}', ET), ('\u{e40}', '\u{e46}', L), ('\u{e47}', '\u{e4e}', NSM),
-    ('\u{e4f}', '\u{e5b}', L), ('\u{e81}', '\u{e82}', L), ('\u{e84}', '\u{e84}', L), ('\u{e87}',
-    '\u{e88}', L), ('\u{e8a}', '\u{e8a}', L), ('\u{e8d}', '\u{e8d}', L), ('\u{e94}', '\u{e97}', L),
-    ('\u{e99}', '\u{e9f}', L), ('\u{ea1}', '\u{ea3}', L), ('\u{ea5}', '\u{ea5}', L), ('\u{ea7}',
-    '\u{ea7}', L), ('\u{eaa}', '\u{eab}', L), ('\u{ead}', '\u{eb0}', L), ('\u{eb1}', '\u{eb1}',
-    NSM), ('\u{eb2}', '\u{eb3}', L), ('\u{eb4}', '\u{eb9}', NSM), ('\u{ebb}', '\u{ebc}', NSM),
-    ('\u{ebd}', '\u{ebd}', L), ('\u{ec0}', '\u{ec4}', L), ('\u{ec6}', '\u{ec6}', L), ('\u{ec8}',
-    '\u{ecd}', NSM), ('\u{ed0}', '\u{ed9}', L), ('\u{edc}', '\u{edf}', L), ('\u{f00}', '\u{f17}',
-    L), ('\u{f18}', '\u{f19}', NSM), ('\u{f1a}', '\u{f34}', L), ('\u{f35}', '\u{f35}', NSM),
-    ('\u{f36}', '\u{f36}', L), ('\u{f37}', '\u{f37}', NSM), ('\u{f38}', '\u{f38}', L), ('\u{f39}',
-    '\u{f39}', NSM), ('\u{f3a}', '\u{f3d}', ON), ('\u{f3e}', '\u{f47}', L), ('\u{f49}', '\u{f6c}',
-    L), ('\u{f71}', '\u{f7e}', NSM), ('\u{f7f}', '\u{f7f}', L), ('\u{f80}', '\u{f84}', NSM),
-    ('\u{f85}', '\u{f85}', L), ('\u{f86}', '\u{f87}', NSM), ('\u{f88}', '\u{f8c}', L), ('\u{f8d}',
-    '\u{f97}', NSM), ('\u{f99}', '\u{fbc}', NSM), ('\u{fbe}', '\u{fc5}', L), ('\u{fc6}', '\u{fc6}',
-    NSM), ('\u{fc7}', '\u{fcc}', L), ('\u{fce}', '\u{fda}', L), ('\u{1000}', '\u{102c}', L),
-    ('\u{102d}', '\u{1030}', NSM), ('\u{1031}', '\u{1031}', L), ('\u{1032}', '\u{1037}', NSM),
-    ('\u{1038}', '\u{1038}', L), ('\u{1039}', '\u{103a}', NSM), ('\u{103b}', '\u{103c}', L),
-    ('\u{103d}', '\u{103e}', NSM), ('\u{103f}', '\u{1057}', L), ('\u{1058}', '\u{1059}', NSM),
-    ('\u{105a}', '\u{105d}', L), ('\u{105e}', '\u{1060}', NSM), ('\u{1061}', '\u{1070}', L),
-    ('\u{1071}', '\u{1074}', NSM), ('\u{1075}', '\u{1081}', L), ('\u{1082}', '\u{1082}', NSM),
-    ('\u{1083}', '\u{1084}', L), ('\u{1085}', '\u{1086}', NSM), ('\u{1087}', '\u{108c}', L),
-    ('\u{108d}', '\u{108d}', NSM), ('\u{108e}', '\u{109c}', L), ('\u{109d}', '\u{109d}', NSM),
-    ('\u{109e}', '\u{10c5}', L), ('\u{10c7}', '\u{10c7}', L), ('\u{10cd}', '\u{10cd}', L),
-    ('\u{10d0}', '\u{1248}', L), ('\u{124a}', '\u{124d}', L), ('\u{1250}', '\u{1256}', L),
-    ('\u{1258}', '\u{1258}', L), ('\u{125a}', '\u{125d}', L), ('\u{1260}', '\u{1288}', L),
-    ('\u{128a}', '\u{128d}', L), ('\u{1290}', '\u{12b0}', L), ('\u{12b2}', '\u{12b5}', L),
-    ('\u{12b8}', '\u{12be}', L), ('\u{12c0}', '\u{12c0}', L), ('\u{12c2}', '\u{12c5}', L),
-    ('\u{12c8}', '\u{12d6}', L), ('\u{12d8}', '\u{1310}', L), ('\u{1312}', '\u{1315}', L),
-    ('\u{1318}', '\u{135a}', L), ('\u{135d}', '\u{135f}', NSM), ('\u{1360}', '\u{137c}', L),
-    ('\u{1380}', '\u{138f}', L), ('\u{1390}', '\u{1399}', ON), ('\u{13a0}', '\u{13f5}', L),
-    ('\u{13f8}', '\u{13fd}', L), ('\u{1400}', '\u{1400}', ON), ('\u{1401}', '\u{167f}', L),
-    ('\u{1680}', '\u{1680}', WS), ('\u{1681}', '\u{169a}', L), ('\u{169b}', '\u{169c}', ON),
-    ('\u{16a0}', '\u{16f8}', L), ('\u{1700}', '\u{170c}', L), ('\u{170e}', '\u{1711}', L),
-    ('\u{1712}', '\u{1714}', NSM), ('\u{1720}', '\u{1731}', L), ('\u{1732}', '\u{1734}', NSM),
-    ('\u{1735}', '\u{1736}', L), ('\u{1740}', '\u{1751}', L), ('\u{1752}', '\u{1753}', NSM),
-    ('\u{1760}', '\u{176c}', L), ('\u{176e}', '\u{1770}', L), ('\u{1772}', '\u{1773}', NSM),
-    ('\u{1780}', '\u{17b3}', L), ('\u{17b4}', '\u{17b5}', NSM), ('\u{17b6}', '\u{17b6}', L),
-    ('\u{17b7}', '\u{17bd}', NSM), ('\u{17be}', '\u{17c5}', L), ('\u{17c6}', '\u{17c6}', NSM),
-    ('\u{17c7}', '\u{17c8}', L), ('\u{17c9}', '\u{17d3}', NSM), ('\u{17d4}', '\u{17da}', L),
-    ('\u{17db}', '\u{17db}', ET), ('\u{17dc}', '\u{17dc}', L), ('\u{17dd}', '\u{17dd}', NSM),
-    ('\u{17e0}', '\u{17e9}', L), ('\u{17f0}', '\u{17f9}', ON), ('\u{1800}', '\u{180a}', ON),
-    ('\u{180b}', '\u{180d}', NSM), ('\u{180e}', '\u{180e}', BN), ('\u{1810}', '\u{1819}', L),
-    ('\u{1820}', '\u{1877}', L), ('\u{1880}', '\u{1884}', L), ('\u{1885}', '\u{1886}', NSM),
-    ('\u{1887}', '\u{18a8}', L), ('\u{18a9}', '\u{18a9}', NSM), ('\u{18aa}', '\u{18aa}', L),
-    ('\u{18b0}', '\u{18f5}', L), ('\u{1900}', '\u{191e}', L), ('\u{1920}', '\u{1922}', NSM),
-    ('\u{1923}', '\u{1926}', L), ('\u{1927}', '\u{1928}', NSM), ('\u{1929}', '\u{192b}', L),
-    ('\u{1930}', '\u{1931}', L), ('\u{1932}', '\u{1932}', NSM), ('\u{1933}', '\u{1938}', L),
-    ('\u{1939}', '\u{193b}', NSM), ('\u{1940}', '\u{1940}', ON), ('\u{1944}', '\u{1945}', ON),
-    ('\u{1946}', '\u{196d}', L), ('\u{1970}', '\u{1974}', L), ('\u{1980}', '\u{19ab}', L),
-    ('\u{19b0}', '\u{19c9}', L), ('\u{19d0}', '\u{19da}', L), ('\u{19de}', '\u{19ff}', ON),
-    ('\u{1a00}', '\u{1a16}', L), ('\u{1a17}', '\u{1a18}', NSM), ('\u{1a19}', '\u{1a1a}', L),
-    ('\u{1a1b}', '\u{1a1b}', NSM), ('\u{1a1e}', '\u{1a55}', L), ('\u{1a56}', '\u{1a56}', NSM),
-    ('\u{1a57}', '\u{1a57}', L), ('\u{1a58}', '\u{1a5e}', NSM), ('\u{1a60}', '\u{1a60}', NSM),
-    ('\u{1a61}', '\u{1a61}', L), ('\u{1a62}', '\u{1a62}', NSM), ('\u{1a63}', '\u{1a64}', L),
-    ('\u{1a65}', '\u{1a6c}', NSM), ('\u{1a6d}', '\u{1a72}', L), ('\u{1a73}', '\u{1a7c}', NSM),
-    ('\u{1a7f}', '\u{1a7f}', NSM), ('\u{1a80}', '\u{1a89}', L), ('\u{1a90}', '\u{1a99}', L),
-    ('\u{1aa0}', '\u{1aad}', L), ('\u{1ab0}', '\u{1abe}', NSM), ('\u{1b00}', '\u{1b03}', NSM),
-    ('\u{1b04}', '\u{1b33}', L), ('\u{1b34}', '\u{1b34}', NSM), ('\u{1b35}', '\u{1b35}', L),
-    ('\u{1b36}', '\u{1b3a}', NSM), ('\u{1b3b}', '\u{1b3b}', L), ('\u{1b3c}', '\u{1b3c}', NSM),
-    ('\u{1b3d}', '\u{1b41}', L), ('\u{1b42}', '\u{1b42}', NSM), ('\u{1b43}', '\u{1b4b}', L),
-    ('\u{1b50}', '\u{1b6a}', L), ('\u{1b6b}', '\u{1b73}', NSM), ('\u{1b74}', '\u{1b7c}', L),
-    ('\u{1b80}', '\u{1b81}', NSM), ('\u{1b82}', '\u{1ba1}', L), ('\u{1ba2}', '\u{1ba5}', NSM),
-    ('\u{1ba6}', '\u{1ba7}', L), ('\u{1ba8}', '\u{1ba9}', NSM), ('\u{1baa}', '\u{1baa}', L),
-    ('\u{1bab}', '\u{1bad}', NSM), ('\u{1bae}', '\u{1be5}', L), ('\u{1be6}', '\u{1be6}', NSM),
-    ('\u{1be7}', '\u{1be7}', L), ('\u{1be8}', '\u{1be9}', NSM), ('\u{1bea}', '\u{1bec}', L),
-    ('\u{1bed}', '\u{1bed}', NSM), ('\u{1bee}', '\u{1bee}', L), ('\u{1bef}', '\u{1bf1}', NSM),
-    ('\u{1bf2}', '\u{1bf3}', L), ('\u{1bfc}', '\u{1c2b}', L), ('\u{1c2c}', '\u{1c33}', NSM),
-    ('\u{1c34}', '\u{1c35}', L), ('\u{1c36}', '\u{1c37}', NSM), ('\u{1c3b}', '\u{1c49}', L),
-    ('\u{1c4d}', '\u{1c88}', L), ('\u{1cc0}', '\u{1cc7}', L), ('\u{1cd0}', '\u{1cd2}', NSM),
-    ('\u{1cd3}', '\u{1cd3}', L), ('\u{1cd4}', '\u{1ce0}', NSM), ('\u{1ce1}', '\u{1ce1}', L),
-    ('\u{1ce2}', '\u{1ce8}', NSM), ('\u{1ce9}', '\u{1cec}', L), ('\u{1ced}', '\u{1ced}', NSM),
-    ('\u{1cee}', '\u{1cf3}', L), ('\u{1cf4}', '\u{1cf4}', NSM), ('\u{1cf5}', '\u{1cf6}', L),
-    ('\u{1cf8}', '\u{1cf9}', NSM), ('\u{1d00}', '\u{1dbf}', L), ('\u{1dc0}', '\u{1df5}', NSM),
-    ('\u{1dfb}', '\u{1dff}', NSM), ('\u{1e00}', '\u{1f15}', L), ('\u{1f18}', '\u{1f1d}', L),
-    ('\u{1f20}', '\u{1f45}', L), ('\u{1f48}', '\u{1f4d}', L), ('\u{1f50}', '\u{1f57}', L),
-    ('\u{1f59}', '\u{1f59}', L), ('\u{1f5b}', '\u{1f5b}', L), ('\u{1f5d}', '\u{1f5d}', L),
-    ('\u{1f5f}', '\u{1f7d}', L), ('\u{1f80}', '\u{1fb4}', L), ('\u{1fb6}', '\u{1fbc}', L),
-    ('\u{1fbd}', '\u{1fbd}', ON), ('\u{1fbe}', '\u{1fbe}', L), ('\u{1fbf}', '\u{1fc1}', ON),
-    ('\u{1fc2}', '\u{1fc4}', L), ('\u{1fc6}', '\u{1fcc}', L), ('\u{1fcd}', '\u{1fcf}', ON),
-    ('\u{1fd0}', '\u{1fd3}', L), ('\u{1fd6}', '\u{1fdb}', L), ('\u{1fdd}', '\u{1fdf}', ON),
-    ('\u{1fe0}', '\u{1fec}', L), ('\u{1fed}', '\u{1fef}', ON), ('\u{1ff2}', '\u{1ff4}', L),
-    ('\u{1ff6}', '\u{1ffc}', L), ('\u{1ffd}', '\u{1ffe}', ON), ('\u{2000}', '\u{200a}', WS),
-    ('\u{200b}', '\u{200d}', BN), ('\u{200e}', '\u{200e}', L), ('\u{200f}', '\u{200f}', R),
-    ('\u{2010}', '\u{2027}', ON), ('\u{2028}', '\u{2028}', WS), ('\u{2029}', '\u{2029}', B),
-    ('\u{202a}', '\u{202a}', LRE), ('\u{202b}', '\u{202b}', RLE), ('\u{202c}', '\u{202c}', PDF),
-    ('\u{202d}', '\u{202d}', LRO), ('\u{202e}', '\u{202e}', RLO), ('\u{202f}', '\u{202f}', CS),
-    ('\u{2030}', '\u{2034}', ET), ('\u{2035}', '\u{2043}', ON), ('\u{2044}', '\u{2044}', CS),
-    ('\u{2045}', '\u{205e}', ON), ('\u{205f}', '\u{205f}', WS), ('\u{2060}', '\u{2064}', BN),
-    ('\u{2066}', '\u{2066}', LRI), ('\u{2067}', '\u{2067}', RLI), ('\u{2068}', '\u{2068}', FSI),
-    ('\u{2069}', '\u{2069}', PDI), ('\u{206a}', '\u{206f}', BN), ('\u{2070}', '\u{2070}', EN),
-    ('\u{2071}', '\u{2071}', L), ('\u{2074}', '\u{2079}', EN), ('\u{207a}', '\u{207b}', ES),
-    ('\u{207c}', '\u{207e}', ON), ('\u{207f}', '\u{207f}', L), ('\u{2080}', '\u{2089}', EN),
-    ('\u{208a}', '\u{208b}', ES), ('\u{208c}', '\u{208e}', ON), ('\u{2090}', '\u{209c}', L),
-    ('\u{20a0}', '\u{20cf}', ET), ('\u{20d0}', '\u{20f0}', NSM), ('\u{2100}', '\u{2101}', ON),
-    ('\u{2102}', '\u{2102}', L), ('\u{2103}', '\u{2106}', ON), ('\u{2107}', '\u{2107}', L),
-    ('\u{2108}', '\u{2109}', ON), ('\u{210a}', '\u{2113}', L), ('\u{2114}', '\u{2114}', ON),
-    ('\u{2115}', '\u{2115}', L), ('\u{2116}', '\u{2118}', ON), ('\u{2119}', '\u{211d}', L),
-    ('\u{211e}', '\u{2123}', ON), ('\u{2124}', '\u{2124}', L), ('\u{2125}', '\u{2125}', ON),
-    ('\u{2126}', '\u{2126}', L), ('\u{2127}', '\u{2127}', ON), ('\u{2128}', '\u{2128}', L),
-    ('\u{2129}', '\u{2129}', ON), ('\u{212a}', '\u{212d}', L), ('\u{212e}', '\u{212e}', ET),
-    ('\u{212f}', '\u{2139}', L), ('\u{213a}', '\u{213b}', ON), ('\u{213c}', '\u{213f}', L),
-    ('\u{2140}', '\u{2144}', ON), ('\u{2145}', '\u{2149}', L), ('\u{214a}', '\u{214d}', ON),
-    ('\u{214e}', '\u{214f}', L), ('\u{2150}', '\u{215f}', ON), ('\u{2160}', '\u{2188}', L),
-    ('\u{2189}', '\u{218b}', ON), ('\u{2190}', '\u{2211}', ON), ('\u{2212}', '\u{2212}', ES),
-    ('\u{2213}', '\u{2213}', ET), ('\u{2214}', '\u{2335}', ON), ('\u{2336}', '\u{237a}', L),
-    ('\u{237b}', '\u{2394}', ON), ('\u{2395}', '\u{2395}', L), ('\u{2396}', '\u{23fe}', ON),
-    ('\u{2400}', '\u{2426}', ON), ('\u{2440}', '\u{244a}', ON), ('\u{2460}', '\u{2487}', ON),
-    ('\u{2488}', '\u{249b}', EN), ('\u{249c}', '\u{24e9}', L), ('\u{24ea}', '\u{26ab}', ON),
-    ('\u{26ac}', '\u{26ac}', L), ('\u{26ad}', '\u{27ff}', ON), ('\u{2800}', '\u{28ff}', L),
-    ('\u{2900}', '\u{2b73}', ON), ('\u{2b76}', '\u{2b95}', ON), ('\u{2b98}', '\u{2bb9}', ON),
-    ('\u{2bbd}', '\u{2bc8}', ON), ('\u{2bca}', '\u{2bd1}', ON), ('\u{2bec}', '\u{2bef}', ON),
-    ('\u{2c00}', '\u{2c2e}', L), ('\u{2c30}', '\u{2c5e}', L), ('\u{2c60}', '\u{2ce4}', L),
-    ('\u{2ce5}', '\u{2cea}', ON), ('\u{2ceb}', '\u{2cee}', L), ('\u{2cef}', '\u{2cf1}', NSM),
-    ('\u{2cf2}', '\u{2cf3}', L), ('\u{2cf9}', '\u{2cff}', ON), ('\u{2d00}', '\u{2d25}', L),
-    ('\u{2d27}', '\u{2d27}', L), ('\u{2d2d}', '\u{2d2d}', L), ('\u{2d30}', '\u{2d67}', L),
-    ('\u{2d6f}', '\u{2d70}', L), ('\u{2d7f}', '\u{2d7f}', NSM), ('\u{2d80}', '\u{2d96}', L),
-    ('\u{2da0}', '\u{2da6}', L), ('\u{2da8}', '\u{2dae}', L), ('\u{2db0}', '\u{2db6}', L),
-    ('\u{2db8}', '\u{2dbe}', L), ('\u{2dc0}', '\u{2dc6}', L), ('\u{2dc8}', '\u{2dce}', L),
-    ('\u{2dd0}', '\u{2dd6}', L), ('\u{2dd8}', '\u{2dde}', L), ('\u{2de0}', '\u{2dff}', NSM),
-    ('\u{2e00}', '\u{2e44}', ON), ('\u{2e80}', '\u{2e99}', ON), ('\u{2e9b}', '\u{2ef3}', ON),
-    ('\u{2f00}', '\u{2fd5}', ON), ('\u{2ff0}', '\u{2ffb}', ON), ('\u{3000}', '\u{3000}', WS),
-    ('\u{3001}', '\u{3004}', ON), ('\u{3005}', '\u{3007}', L), ('\u{3008}', '\u{3020}', ON),
-    ('\u{3021}', '\u{3029}', L), ('\u{302a}', '\u{302d}', NSM), ('\u{302e}', '\u{302f}', L),
-    ('\u{3030}', '\u{3030}', ON), ('\u{3031}', '\u{3035}', L), ('\u{3036}', '\u{3037}', ON),
-    ('\u{3038}', '\u{303c}', L), ('\u{303d}', '\u{303f}', ON), ('\u{3041}', '\u{3096}', L),
-    ('\u{3099}', '\u{309a}', NSM), ('\u{309b}', '\u{309c}', ON), ('\u{309d}', '\u{309f}', L),
-    ('\u{30a0}', '\u{30a0}', ON), ('\u{30a1}', '\u{30fa}', L), ('\u{30fb}', '\u{30fb}', ON),
-    ('\u{30fc}', '\u{30ff}', L), ('\u{3105}', '\u{312d}', L), ('\u{3131}', '\u{318e}', L),
-    ('\u{3190}', '\u{31ba}', L), ('\u{31c0}', '\u{31e3}', ON), ('\u{31f0}', '\u{321c}', L),
-    ('\u{321d}', '\u{321e}', ON), ('\u{3220}', '\u{324f}', L), ('\u{3250}', '\u{325f}', ON),
-    ('\u{3260}', '\u{327b}', L), ('\u{327c}', '\u{327e}', ON), ('\u{327f}', '\u{32b0}', L),
-    ('\u{32b1}', '\u{32bf}', ON), ('\u{32c0}', '\u{32cb}', L), ('\u{32cc}', '\u{32cf}', ON),
-    ('\u{32d0}', '\u{32fe}', L), ('\u{3300}', '\u{3376}', L), ('\u{3377}', '\u{337a}', ON),
-    ('\u{337b}', '\u{33dd}', L), ('\u{33de}', '\u{33df}', ON), ('\u{33e0}', '\u{33fe}', L),
-    ('\u{33ff}', '\u{33ff}', ON), ('\u{3400}', '\u{4db5}', L), ('\u{4dc0}', '\u{4dff}', ON),
-    ('\u{4e00}', '\u{9fd5}', L), ('\u{a000}', '\u{a48c}', L), ('\u{a490}', '\u{a4c6}', ON),
-    ('\u{a4d0}', '\u{a60c}', L), ('\u{a60d}', '\u{a60f}', ON), ('\u{a610}', '\u{a62b}', L),
-    ('\u{a640}', '\u{a66e}', L), ('\u{a66f}', '\u{a672}', NSM), ('\u{a673}', '\u{a673}', ON),
-    ('\u{a674}', '\u{a67d}', NSM), ('\u{a67e}', '\u{a67f}', ON), ('\u{a680}', '\u{a69d}', L),
-    ('\u{a69e}', '\u{a69f}', NSM), ('\u{a6a0}', '\u{a6ef}', L), ('\u{a6f0}', '\u{a6f1}', NSM),
-    ('\u{a6f2}', '\u{a6f7}', L), ('\u{a700}', '\u{a721}', ON), ('\u{a722}', '\u{a787}', L),
-    ('\u{a788}', '\u{a788}', ON), ('\u{a789}', '\u{a7ae}', L), ('\u{a7b0}', '\u{a7b7}', L),
-    ('\u{a7f7}', '\u{a801}', L), ('\u{a802}', '\u{a802}', NSM), ('\u{a803}', '\u{a805}', L),
-    ('\u{a806}', '\u{a806}', NSM), ('\u{a807}', '\u{a80a}', L), ('\u{a80b}', '\u{a80b}', NSM),
-    ('\u{a80c}', '\u{a824}', L), ('\u{a825}', '\u{a826}', NSM), ('\u{a827}', '\u{a827}', L),
-    ('\u{a828}', '\u{a82b}', ON), ('\u{a830}', '\u{a837}', L), ('\u{a838}', '\u{a839}', ET),
-    ('\u{a840}', '\u{a873}', L), ('\u{a874}', '\u{a877}', ON), ('\u{a880}', '\u{a8c3}', L),
-    ('\u{a8c4}', '\u{a8c5}', NSM), ('\u{a8ce}', '\u{a8d9}', L), ('\u{a8e0}', '\u{a8f1}', NSM),
-    ('\u{a8f2}', '\u{a8fd}', L), ('\u{a900}', '\u{a925}', L), ('\u{a926}', '\u{a92d}', NSM),
-    ('\u{a92e}', '\u{a946}', L), ('\u{a947}', '\u{a951}', NSM), ('\u{a952}', '\u{a953}', L),
-    ('\u{a95f}', '\u{a97c}', L), ('\u{a980}', '\u{a982}', NSM), ('\u{a983}', '\u{a9b2}', L),
-    ('\u{a9b3}', '\u{a9b3}', NSM), ('\u{a9b4}', '\u{a9b5}', L), ('\u{a9b6}', '\u{a9b9}', NSM),
-    ('\u{a9ba}', '\u{a9bb}', L), ('\u{a9bc}', '\u{a9bc}', NSM), ('\u{a9bd}', '\u{a9cd}', L),
-    ('\u{a9cf}', '\u{a9d9}', L), ('\u{a9de}', '\u{a9e4}', L), ('\u{a9e5}', '\u{a9e5}', NSM),
-    ('\u{a9e6}', '\u{a9fe}', L), ('\u{aa00}', '\u{aa28}', L), ('\u{aa29}', '\u{aa2e}', NSM),
-    ('\u{aa2f}', '\u{aa30}', L), ('\u{aa31}', '\u{aa32}', NSM), ('\u{aa33}', '\u{aa34}', L),
-    ('\u{aa35}', '\u{aa36}', NSM), ('\u{aa40}', '\u{aa42}', L), ('\u{aa43}', '\u{aa43}', NSM),
-    ('\u{aa44}', '\u{aa4b}', L), ('\u{aa4c}', '\u{aa4c}', NSM), ('\u{aa4d}', '\u{aa4d}', L),
-    ('\u{aa50}', '\u{aa59}', L), ('\u{aa5c}', '\u{aa7b}', L), ('\u{aa7c}', '\u{aa7c}', NSM),
-    ('\u{aa7d}', '\u{aaaf}', L), ('\u{aab0}', '\u{aab0}', NSM), ('\u{aab1}', '\u{aab1}', L),
-    ('\u{aab2}', '\u{aab4}', NSM), ('\u{aab5}', '\u{aab6}', L), ('\u{aab7}', '\u{aab8}', NSM),
-    ('\u{aab9}', '\u{aabd}', L), ('\u{aabe}', '\u{aabf}', NSM), ('\u{aac0}', '\u{aac0}', L),
-    ('\u{aac1}', '\u{aac1}', NSM), ('\u{aac2}', '\u{aac2}', L), ('\u{aadb}', '\u{aaeb}', L),
-    ('\u{aaec}', '\u{aaed}', NSM), ('\u{aaee}', '\u{aaf5}', L), ('\u{aaf6}', '\u{aaf6}', NSM),
-    ('\u{ab01}', '\u{ab06}', L), ('\u{ab09}', '\u{ab0e}', L), ('\u{ab11}', '\u{ab16}', L),
-    ('\u{ab20}', '\u{ab26}', L), ('\u{ab28}', '\u{ab2e}', L), ('\u{ab30}', '\u{ab65}', L),
-    ('\u{ab70}', '\u{abe4}', L), ('\u{abe5}', '\u{abe5}', NSM), ('\u{abe6}', '\u{abe7}', L),
-    ('\u{abe8}', '\u{abe8}', NSM), ('\u{abe9}', '\u{abec}', L), ('\u{abed}', '\u{abed}', NSM),
-    ('\u{abf0}', '\u{abf9}', L), ('\u{ac00}', '\u{d7a3}', L), ('\u{d7b0}', '\u{d7c6}', L),
-    ('\u{d7cb}', '\u{d7fb}', L), ('\u{e000}', '\u{fa6d}', L), ('\u{fa70}', '\u{fad9}', L),
-    ('\u{fb00}', '\u{fb06}', L), ('\u{fb13}', '\u{fb17}', L), ('\u{fb1d}', '\u{fb1d}', R),
-    ('\u{fb1e}', '\u{fb1e}', NSM), ('\u{fb1f}', '\u{fb28}', R), ('\u{fb29}', '\u{fb29}', ES),
-    ('\u{fb2a}', '\u{fb4f}', R), ('\u{fb50}', '\u{fd3d}', AL), ('\u{fd3e}', '\u{fd3f}', ON),
-    ('\u{fd40}', '\u{fdcf}', AL), ('\u{fdf0}', '\u{fdfc}', AL), ('\u{fdfd}', '\u{fdfd}', ON),
-    ('\u{fdfe}', '\u{fdff}', AL), ('\u{fe00}', '\u{fe0f}', NSM), ('\u{fe10}', '\u{fe19}', ON),
-    ('\u{fe20}', '\u{fe2f}', NSM), ('\u{fe30}', '\u{fe4f}', ON), ('\u{fe50}', '\u{fe50}', CS),
-    ('\u{fe51}', '\u{fe51}', ON), ('\u{fe52}', '\u{fe52}', CS), ('\u{fe54}', '\u{fe54}', ON),
-    ('\u{fe55}', '\u{fe55}', CS), ('\u{fe56}', '\u{fe5e}', ON), ('\u{fe5f}', '\u{fe5f}', ET),
-    ('\u{fe60}', '\u{fe61}', ON), ('\u{fe62}', '\u{fe63}', ES), ('\u{fe64}', '\u{fe66}', ON),
-    ('\u{fe68}', '\u{fe68}', ON), ('\u{fe69}', '\u{fe6a}', ET), ('\u{fe6b}', '\u{fe6b}', ON),
-    ('\u{fe70}', '\u{fefe}', AL), ('\u{feff}', '\u{feff}', BN), ('\u{ff01}', '\u{ff02}', ON),
-    ('\u{ff03}', '\u{ff05}', ET), ('\u{ff06}', '\u{ff0a}', ON), ('\u{ff0b}', '\u{ff0b}', ES),
-    ('\u{ff0c}', '\u{ff0c}', CS), ('\u{ff0d}', '\u{ff0d}', ES), ('\u{ff0e}', '\u{ff0f}', CS),
-    ('\u{ff10}', '\u{ff19}', EN), ('\u{ff1a}', '\u{ff1a}', CS), ('\u{ff1b}', '\u{ff20}', ON),
-    ('\u{ff21}', '\u{ff3a}', L), ('\u{ff3b}', '\u{ff40}', ON), ('\u{ff41}', '\u{ff5a}', L),
-    ('\u{ff5b}', '\u{ff65}', ON), ('\u{ff66}', '\u{ffbe}', L), ('\u{ffc2}', '\u{ffc7}', L),
-    ('\u{ffca}', '\u{ffcf}', L), ('\u{ffd2}', '\u{ffd7}', L), ('\u{ffda}', '\u{ffdc}', L),
-    ('\u{ffe0}', '\u{ffe1}', ET), ('\u{ffe2}', '\u{ffe4}', ON), ('\u{ffe5}', '\u{ffe6}', ET),
-    ('\u{ffe8}', '\u{ffee}', ON), ('\u{fff9}', '\u{fffd}', ON), ('\u{10000}', '\u{1000b}', L),
-    ('\u{1000d}', '\u{10026}', L), ('\u{10028}', '\u{1003a}', L), ('\u{1003c}', '\u{1003d}', L),
-    ('\u{1003f}', '\u{1004d}', L), ('\u{10050}', '\u{1005d}', L), ('\u{10080}', '\u{100fa}', L),
-    ('\u{10100}', '\u{10100}', L), ('\u{10101}', '\u{10101}', ON), ('\u{10102}', '\u{10102}', L),
-    ('\u{10107}', '\u{10133}', L), ('\u{10137}', '\u{1013f}', L), ('\u{10140}', '\u{1018c}', ON),
-    ('\u{1018d}', '\u{1018e}', L), ('\u{10190}', '\u{1019b}', ON), ('\u{101a0}', '\u{101a0}', ON),
-    ('\u{101d0}', '\u{101fc}', L), ('\u{101fd}', '\u{101fd}', NSM), ('\u{10280}', '\u{1029c}', L),
-    ('\u{102a0}', '\u{102d0}', L), ('\u{102e0}', '\u{102e0}', NSM), ('\u{102e1}', '\u{102fb}', EN),
-    ('\u{10300}', '\u{10323}', L), ('\u{10330}', '\u{1034a}', L), ('\u{10350}', '\u{10375}', L),
-    ('\u{10376}', '\u{1037a}', NSM), ('\u{10380}', '\u{1039d}', L), ('\u{1039f}', '\u{103c3}', L),
-    ('\u{103c8}', '\u{103d5}', L), ('\u{10400}', '\u{1049d}', L), ('\u{104a0}', '\u{104a9}', L),
-    ('\u{104b0}', '\u{104d3}', L), ('\u{104d8}', '\u{104fb}', L), ('\u{10500}', '\u{10527}', L),
-    ('\u{10530}', '\u{10563}', L), ('\u{1056f}', '\u{1056f}', L), ('\u{10600}', '\u{10736}', L),
-    ('\u{10740}', '\u{10755}', L), ('\u{10760}', '\u{10767}', L), ('\u{10800}', '\u{1091e}', R),
-    ('\u{1091f}', '\u{1091f}', ON), ('\u{10920}', '\u{10a00}', R), ('\u{10a01}', '\u{10a03}', NSM),
-    ('\u{10a04}', '\u{10a04}', R), ('\u{10a05}', '\u{10a06}', NSM), ('\u{10a07}', '\u{10a0b}', R),
-    ('\u{10a0c}', '\u{10a0f}', NSM), ('\u{10a10}', '\u{10a37}', R), ('\u{10a38}', '\u{10a3a}', NSM),
-    ('\u{10a3b}', '\u{10a3e}', R), ('\u{10a3f}', '\u{10a3f}', NSM), ('\u{10a40}', '\u{10ae4}', R),
-    ('\u{10ae5}', '\u{10ae6}', NSM), ('\u{10ae7}', '\u{10b38}', R), ('\u{10b39}', '\u{10b3f}', ON),
-    ('\u{10b40}', '\u{10e5f}', R), ('\u{10e60}', '\u{10e7e}', AN), ('\u{10e7f}', '\u{10fff}', R),
-    ('\u{11000}', '\u{11000}', L), ('\u{11001}', '\u{11001}', NSM), ('\u{11002}', '\u{11037}', L),
-    ('\u{11038}', '\u{11046}', NSM), ('\u{11047}', '\u{1104d}', L), ('\u{11052}', '\u{11065}', ON),
-    ('\u{11066}', '\u{1106f}', L), ('\u{1107f}', '\u{11081}', NSM), ('\u{11082}', '\u{110b2}', L),
-    ('\u{110b3}', '\u{110b6}', NSM), ('\u{110b7}', '\u{110b8}', L), ('\u{110b9}', '\u{110ba}', NSM),
-    ('\u{110bb}', '\u{110c1}', L), ('\u{110d0}', '\u{110e8}', L), ('\u{110f0}', '\u{110f9}', L),
-    ('\u{11100}', '\u{11102}', NSM), ('\u{11103}', '\u{11126}', L), ('\u{11127}', '\u{1112b}', NSM),
-    ('\u{1112c}', '\u{1112c}', L), ('\u{1112d}', '\u{11134}', NSM), ('\u{11136}', '\u{11143}', L),
-    ('\u{11150}', '\u{11172}', L), ('\u{11173}', '\u{11173}', NSM), ('\u{11174}', '\u{11176}', L),
-    ('\u{11180}', '\u{11181}', NSM), ('\u{11182}', '\u{111b5}', L), ('\u{111b6}', '\u{111be}', NSM),
-    ('\u{111bf}', '\u{111c9}', L), ('\u{111ca}', '\u{111cc}', NSM), ('\u{111cd}', '\u{111cd}', L),
-    ('\u{111d0}', '\u{111df}', L), ('\u{111e1}', '\u{111f4}', L), ('\u{11200}', '\u{11211}', L),
-    ('\u{11213}', '\u{1122e}', L), ('\u{1122f}', '\u{11231}', NSM), ('\u{11232}', '\u{11233}', L),
-    ('\u{11234}', '\u{11234}', NSM), ('\u{11235}', '\u{11235}', L), ('\u{11236}', '\u{11237}', NSM),
-    ('\u{11238}', '\u{1123d}', L), ('\u{1123e}', '\u{1123e}', NSM), ('\u{11280}', '\u{11286}', L),
-    ('\u{11288}', '\u{11288}', L), ('\u{1128a}', '\u{1128d}', L), ('\u{1128f}', '\u{1129d}', L),
-    ('\u{1129f}', '\u{112a9}', L), ('\u{112b0}', '\u{112de}', L), ('\u{112df}', '\u{112df}', NSM),
-    ('\u{112e0}', '\u{112e2}', L), ('\u{112e3}', '\u{112ea}', NSM), ('\u{112f0}', '\u{112f9}', L),
-    ('\u{11300}', '\u{11301}', NSM), ('\u{11302}', '\u{11303}', L), ('\u{11305}', '\u{1130c}', L),
-    ('\u{1130f}', '\u{11310}', L), ('\u{11313}', '\u{11328}', L), ('\u{1132a}', '\u{11330}', L),
-    ('\u{11332}', '\u{11333}', L), ('\u{11335}', '\u{11339}', L), ('\u{1133c}', '\u{1133c}', NSM),
-    ('\u{1133d}', '\u{1133f}', L), ('\u{11340}', '\u{11340}', NSM), ('\u{11341}', '\u{11344}', L),
-    ('\u{11347}', '\u{11348}', L), ('\u{1134b}', '\u{1134d}', L), ('\u{11350}', '\u{11350}', L),
-    ('\u{11357}', '\u{11357}', L), ('\u{1135d}', '\u{11363}', L), ('\u{11366}', '\u{1136c}', NSM),
-    ('\u{11370}', '\u{11374}', NSM), ('\u{11400}', '\u{11437}', L), ('\u{11438}', '\u{1143f}', NSM),
-    ('\u{11440}', '\u{11441}', L), ('\u{11442}', '\u{11444}', NSM), ('\u{11445}', '\u{11445}', L),
-    ('\u{11446}', '\u{11446}', NSM), ('\u{11447}', '\u{11459}', L), ('\u{1145b}', '\u{1145b}', L),
-    ('\u{1145d}', '\u{1145d}', L), ('\u{11480}', '\u{114b2}', L), ('\u{114b3}', '\u{114b8}', NSM),
-    ('\u{114b9}', '\u{114b9}', L), ('\u{114ba}', '\u{114ba}', NSM), ('\u{114bb}', '\u{114be}', L),
-    ('\u{114bf}', '\u{114c0}', NSM), ('\u{114c1}', '\u{114c1}', L), ('\u{114c2}', '\u{114c3}', NSM),
-    ('\u{114c4}', '\u{114c7}', L), ('\u{114d0}', '\u{114d9}', L), ('\u{11580}', '\u{115b1}', L),
-    ('\u{115b2}', '\u{115b5}', NSM), ('\u{115b8}', '\u{115bb}', L), ('\u{115bc}', '\u{115bd}', NSM),
-    ('\u{115be}', '\u{115be}', L), ('\u{115bf}', '\u{115c0}', NSM), ('\u{115c1}', '\u{115db}', L),
-    ('\u{115dc}', '\u{115dd}', NSM), ('\u{11600}', '\u{11632}', L), ('\u{11633}', '\u{1163a}', NSM),
-    ('\u{1163b}', '\u{1163c}', L), ('\u{1163d}', '\u{1163d}', NSM), ('\u{1163e}', '\u{1163e}', L),
-    ('\u{1163f}', '\u{11640}', NSM), ('\u{11641}', '\u{11644}', L), ('\u{11650}', '\u{11659}', L),
-    ('\u{11660}', '\u{1166c}', ON), ('\u{11680}', '\u{116aa}', L), ('\u{116ab}', '\u{116ab}', NSM),
-    ('\u{116ac}', '\u{116ac}', L), ('\u{116ad}', '\u{116ad}', NSM), ('\u{116ae}', '\u{116af}', L),
-    ('\u{116b0}', '\u{116b5}', NSM), ('\u{116b6}', '\u{116b6}', L), ('\u{116b7}', '\u{116b7}', NSM),
-    ('\u{116c0}', '\u{116c9}', L), ('\u{11700}', '\u{11719}', L), ('\u{1171d}', '\u{1171f}', NSM),
-    ('\u{11720}', '\u{11721}', L), ('\u{11722}', '\u{11725}', NSM), ('\u{11726}', '\u{11726}', L),
-    ('\u{11727}', '\u{1172b}', NSM), ('\u{11730}', '\u{1173f}', L), ('\u{118a0}', '\u{118f2}', L),
-    ('\u{118ff}', '\u{118ff}', L), ('\u{11ac0}', '\u{11af8}', L), ('\u{11c00}', '\u{11c08}', L),
-    ('\u{11c0a}', '\u{11c2f}', L), ('\u{11c30}', '\u{11c36}', NSM), ('\u{11c38}', '\u{11c3d}', NSM),
-    ('\u{11c3e}', '\u{11c45}', L), ('\u{11c50}', '\u{11c6c}', L), ('\u{11c70}', '\u{11c8f}', L),
-    ('\u{11c92}', '\u{11ca7}', NSM), ('\u{11ca9}', '\u{11ca9}', L), ('\u{11caa}', '\u{11cb0}', NSM),
-    ('\u{11cb1}', '\u{11cb1}', L), ('\u{11cb2}', '\u{11cb3}', NSM), ('\u{11cb4}', '\u{11cb4}', L),
-    ('\u{11cb5}', '\u{11cb6}', NSM), ('\u{12000}', '\u{12399}', L), ('\u{12400}', '\u{1246e}', L),
-    ('\u{12470}', '\u{12474}', L), ('\u{12480}', '\u{12543}', L), ('\u{13000}', '\u{1342e}', L),
-    ('\u{14400}', '\u{14646}', L), ('\u{16800}', '\u{16a38}', L), ('\u{16a40}', '\u{16a5e}', L),
-    ('\u{16a60}', '\u{16a69}', L), ('\u{16a6e}', '\u{16a6f}', L), ('\u{16ad0}', '\u{16aed}', L),
-    ('\u{16af0}', '\u{16af4}', NSM), ('\u{16af5}', '\u{16af5}', L), ('\u{16b00}', '\u{16b2f}', L),
-    ('\u{16b30}', '\u{16b36}', NSM), ('\u{16b37}', '\u{16b45}', L), ('\u{16b50}', '\u{16b59}', L),
-    ('\u{16b5b}', '\u{16b61}', L), ('\u{16b63}', '\u{16b77}', L), ('\u{16b7d}', '\u{16b8f}', L),
-    ('\u{16f00}', '\u{16f44}', L), ('\u{16f50}', '\u{16f7e}', L), ('\u{16f8f}', '\u{16f92}', NSM),
-    ('\u{16f93}', '\u{16f9f}', L), ('\u{16fe0}', '\u{16fe0}', L), ('\u{17000}', '\u{187ec}', L),
-    ('\u{18800}', '\u{18af2}', L), ('\u{1b000}', '\u{1b001}', L), ('\u{1bc00}', '\u{1bc6a}', L),
+    ('\u{ae6}', '\u{af0}', L), ('\u{af1}', '\u{af1}', ET), ('\u{af9}', '\u{af9}', L), ('\u{afa}',
+    '\u{aff}', NSM), ('\u{b01}', '\u{b01}', NSM), ('\u{b02}', '\u{b03}', L), ('\u{b05}', '\u{b0c}',
+    L), ('\u{b0f}', '\u{b10}', L), ('\u{b13}', '\u{b28}', L), ('\u{b2a}', '\u{b30}', L), ('\u{b32}',
+    '\u{b33}', L), ('\u{b35}', '\u{b39}', L), ('\u{b3c}', '\u{b3c}', NSM), ('\u{b3d}', '\u{b3e}',
+    L), ('\u{b3f}', '\u{b3f}', NSM), ('\u{b40}', '\u{b40}', L), ('\u{b41}', '\u{b44}', NSM),
+    ('\u{b47}', '\u{b48}', L), ('\u{b4b}', '\u{b4c}', L), ('\u{b4d}', '\u{b4d}', NSM), ('\u{b56}',
+    '\u{b56}', NSM), ('\u{b57}', '\u{b57}', L), ('\u{b5c}', '\u{b5d}', L), ('\u{b5f}', '\u{b61}',
+    L), ('\u{b62}', '\u{b63}', NSM), ('\u{b66}', '\u{b77}', L), ('\u{b82}', '\u{b82}', NSM),
+    ('\u{b83}', '\u{b83}', L), ('\u{b85}', '\u{b8a}', L), ('\u{b8e}', '\u{b90}', L), ('\u{b92}',
+    '\u{b95}', L), ('\u{b99}', '\u{b9a}', L), ('\u{b9c}', '\u{b9c}', L), ('\u{b9e}', '\u{b9f}', L),
+    ('\u{ba3}', '\u{ba4}', L), ('\u{ba8}', '\u{baa}', L), ('\u{bae}', '\u{bb9}', L), ('\u{bbe}',
+    '\u{bbf}', L), ('\u{bc0}', '\u{bc0}', NSM), ('\u{bc1}', '\u{bc2}', L), ('\u{bc6}', '\u{bc8}',
+    L), ('\u{bca}', '\u{bcc}', L), ('\u{bcd}', '\u{bcd}', NSM), ('\u{bd0}', '\u{bd0}', L),
+    ('\u{bd7}', '\u{bd7}', L), ('\u{be6}', '\u{bf2}', L), ('\u{bf3}', '\u{bf8}', ON), ('\u{bf9}',
+    '\u{bf9}', ET), ('\u{bfa}', '\u{bfa}', ON), ('\u{c00}', '\u{c00}', NSM), ('\u{c01}', '\u{c03}',
+    L), ('\u{c05}', '\u{c0c}', L), ('\u{c0e}', '\u{c10}', L), ('\u{c12}', '\u{c28}', L), ('\u{c2a}',
+    '\u{c39}', L), ('\u{c3d}', '\u{c3d}', L), ('\u{c3e}', '\u{c40}', NSM), ('\u{c41}', '\u{c44}',
+    L), ('\u{c46}', '\u{c48}', NSM), ('\u{c4a}', '\u{c4d}', NSM), ('\u{c55}', '\u{c56}', NSM),
+    ('\u{c58}', '\u{c5a}', L), ('\u{c60}', '\u{c61}', L), ('\u{c62}', '\u{c63}', NSM), ('\u{c66}',
+    '\u{c6f}', L), ('\u{c78}', '\u{c7e}', ON), ('\u{c7f}', '\u{c80}', L), ('\u{c81}', '\u{c81}',
+    NSM), ('\u{c82}', '\u{c83}', L), ('\u{c85}', '\u{c8c}', L), ('\u{c8e}', '\u{c90}', L),
+    ('\u{c92}', '\u{ca8}', L), ('\u{caa}', '\u{cb3}', L), ('\u{cb5}', '\u{cb9}', L), ('\u{cbc}',
+    '\u{cbc}', NSM), ('\u{cbd}', '\u{cc4}', L), ('\u{cc6}', '\u{cc8}', L), ('\u{cca}', '\u{ccb}',
+    L), ('\u{ccc}', '\u{ccd}', NSM), ('\u{cd5}', '\u{cd6}', L), ('\u{cde}', '\u{cde}', L),
+    ('\u{ce0}', '\u{ce1}', L), ('\u{ce2}', '\u{ce3}', NSM), ('\u{ce6}', '\u{cef}', L), ('\u{cf1}',
+    '\u{cf2}', L), ('\u{d00}', '\u{d01}', NSM), ('\u{d02}', '\u{d03}', L), ('\u{d05}', '\u{d0c}',
+    L), ('\u{d0e}', '\u{d10}', L), ('\u{d12}', '\u{d3a}', L), ('\u{d3b}', '\u{d3c}', NSM),
+    ('\u{d3d}', '\u{d40}', L), ('\u{d41}', '\u{d44}', NSM), ('\u{d46}', '\u{d48}', L), ('\u{d4a}',
+    '\u{d4c}', L), ('\u{d4d}', '\u{d4d}', NSM), ('\u{d4e}', '\u{d4f}', L), ('\u{d54}', '\u{d61}',
+    L), ('\u{d62}', '\u{d63}', NSM), ('\u{d66}', '\u{d7f}', L), ('\u{d82}', '\u{d83}', L),
+    ('\u{d85}', '\u{d96}', L), ('\u{d9a}', '\u{db1}', L), ('\u{db3}', '\u{dbb}', L), ('\u{dbd}',
+    '\u{dbd}', L), ('\u{dc0}', '\u{dc6}', L), ('\u{dca}', '\u{dca}', NSM), ('\u{dcf}', '\u{dd1}',
+    L), ('\u{dd2}', '\u{dd4}', NSM), ('\u{dd6}', '\u{dd6}', NSM), ('\u{dd8}', '\u{ddf}', L),
+    ('\u{de6}', '\u{def}', L), ('\u{df2}', '\u{df4}', L), ('\u{e01}', '\u{e30}', L), ('\u{e31}',
+    '\u{e31}', NSM), ('\u{e32}', '\u{e33}', L), ('\u{e34}', '\u{e3a}', NSM), ('\u{e3f}', '\u{e3f}',
+    ET), ('\u{e40}', '\u{e46}', L), ('\u{e47}', '\u{e4e}', NSM), ('\u{e4f}', '\u{e5b}', L),
+    ('\u{e81}', '\u{e82}', L), ('\u{e84}', '\u{e84}', L), ('\u{e87}', '\u{e88}', L), ('\u{e8a}',
+    '\u{e8a}', L), ('\u{e8d}', '\u{e8d}', L), ('\u{e94}', '\u{e97}', L), ('\u{e99}', '\u{e9f}', L),
+    ('\u{ea1}', '\u{ea3}', L), ('\u{ea5}', '\u{ea5}', L), ('\u{ea7}', '\u{ea7}', L), ('\u{eaa}',
+    '\u{eab}', L), ('\u{ead}', '\u{eb0}', L), ('\u{eb1}', '\u{eb1}', NSM), ('\u{eb2}', '\u{eb3}',
+    L), ('\u{eb4}', '\u{eb9}', NSM), ('\u{ebb}', '\u{ebc}', NSM), ('\u{ebd}', '\u{ebd}', L),
+    ('\u{ec0}', '\u{ec4}', L), ('\u{ec6}', '\u{ec6}', L), ('\u{ec8}', '\u{ecd}', NSM), ('\u{ed0}',
+    '\u{ed9}', L), ('\u{edc}', '\u{edf}', L), ('\u{f00}', '\u{f17}', L), ('\u{f18}', '\u{f19}',
+    NSM), ('\u{f1a}', '\u{f34}', L), ('\u{f35}', '\u{f35}', NSM), ('\u{f36}', '\u{f36}', L),
+    ('\u{f37}', '\u{f37}', NSM), ('\u{f38}', '\u{f38}', L), ('\u{f39}', '\u{f39}', NSM), ('\u{f3a}',
+    '\u{f3d}', ON), ('\u{f3e}', '\u{f47}', L), ('\u{f49}', '\u{f6c}', L), ('\u{f71}', '\u{f7e}',
+    NSM), ('\u{f7f}', '\u{f7f}', L), ('\u{f80}', '\u{f84}', NSM), ('\u{f85}', '\u{f85}', L),
+    ('\u{f86}', '\u{f87}', NSM), ('\u{f88}', '\u{f8c}', L), ('\u{f8d}', '\u{f97}', NSM), ('\u{f99}',
+    '\u{fbc}', NSM), ('\u{fbe}', '\u{fc5}', L), ('\u{fc6}', '\u{fc6}', NSM), ('\u{fc7}', '\u{fcc}',
+    L), ('\u{fce}', '\u{fda}', L), ('\u{1000}', '\u{102c}', L), ('\u{102d}', '\u{1030}', NSM),
+    ('\u{1031}', '\u{1031}', L), ('\u{1032}', '\u{1037}', NSM), ('\u{1038}', '\u{1038}', L),
+    ('\u{1039}', '\u{103a}', NSM), ('\u{103b}', '\u{103c}', L), ('\u{103d}', '\u{103e}', NSM),
+    ('\u{103f}', '\u{1057}', L), ('\u{1058}', '\u{1059}', NSM), ('\u{105a}', '\u{105d}', L),
+    ('\u{105e}', '\u{1060}', NSM), ('\u{1061}', '\u{1070}', L), ('\u{1071}', '\u{1074}', NSM),
+    ('\u{1075}', '\u{1081}', L), ('\u{1082}', '\u{1082}', NSM), ('\u{1083}', '\u{1084}', L),
+    ('\u{1085}', '\u{1086}', NSM), ('\u{1087}', '\u{108c}', L), ('\u{108d}', '\u{108d}', NSM),
+    ('\u{108e}', '\u{109c}', L), ('\u{109d}', '\u{109d}', NSM), ('\u{109e}', '\u{10c5}', L),
+    ('\u{10c7}', '\u{10c7}', L), ('\u{10cd}', '\u{10cd}', L), ('\u{10d0}', '\u{1248}', L),
+    ('\u{124a}', '\u{124d}', L), ('\u{1250}', '\u{1256}', L), ('\u{1258}', '\u{1258}', L),
+    ('\u{125a}', '\u{125d}', L), ('\u{1260}', '\u{1288}', L), ('\u{128a}', '\u{128d}', L),
+    ('\u{1290}', '\u{12b0}', L), ('\u{12b2}', '\u{12b5}', L), ('\u{12b8}', '\u{12be}', L),
+    ('\u{12c0}', '\u{12c0}', L), ('\u{12c2}', '\u{12c5}', L), ('\u{12c8}', '\u{12d6}', L),
+    ('\u{12d8}', '\u{1310}', L), ('\u{1312}', '\u{1315}', L), ('\u{1318}', '\u{135a}', L),
+    ('\u{135d}', '\u{135f}', NSM), ('\u{1360}', '\u{137c}', L), ('\u{1380}', '\u{138f}', L),
+    ('\u{1390}', '\u{1399}', ON), ('\u{13a0}', '\u{13f5}', L), ('\u{13f8}', '\u{13fd}', L),
+    ('\u{1400}', '\u{1400}', ON), ('\u{1401}', '\u{167f}', L), ('\u{1680}', '\u{1680}', WS),
+    ('\u{1681}', '\u{169a}', L), ('\u{169b}', '\u{169c}', ON), ('\u{16a0}', '\u{16f8}', L),
+    ('\u{1700}', '\u{170c}', L), ('\u{170e}', '\u{1711}', L), ('\u{1712}', '\u{1714}', NSM),
+    ('\u{1720}', '\u{1731}', L), ('\u{1732}', '\u{1734}', NSM), ('\u{1735}', '\u{1736}', L),
+    ('\u{1740}', '\u{1751}', L), ('\u{1752}', '\u{1753}', NSM), ('\u{1760}', '\u{176c}', L),
+    ('\u{176e}', '\u{1770}', L), ('\u{1772}', '\u{1773}', NSM), ('\u{1780}', '\u{17b3}', L),
+    ('\u{17b4}', '\u{17b5}', NSM), ('\u{17b6}', '\u{17b6}', L), ('\u{17b7}', '\u{17bd}', NSM),
+    ('\u{17be}', '\u{17c5}', L), ('\u{17c6}', '\u{17c6}', NSM), ('\u{17c7}', '\u{17c8}', L),
+    ('\u{17c9}', '\u{17d3}', NSM), ('\u{17d4}', '\u{17da}', L), ('\u{17db}', '\u{17db}', ET),
+    ('\u{17dc}', '\u{17dc}', L), ('\u{17dd}', '\u{17dd}', NSM), ('\u{17e0}', '\u{17e9}', L),
+    ('\u{17f0}', '\u{17f9}', ON), ('\u{1800}', '\u{180a}', ON), ('\u{180b}', '\u{180d}', NSM),
+    ('\u{180e}', '\u{180e}', BN), ('\u{1810}', '\u{1819}', L), ('\u{1820}', '\u{1877}', L),
+    ('\u{1880}', '\u{1884}', L), ('\u{1885}', '\u{1886}', NSM), ('\u{1887}', '\u{18a8}', L),
+    ('\u{18a9}', '\u{18a9}', NSM), ('\u{18aa}', '\u{18aa}', L), ('\u{18b0}', '\u{18f5}', L),
+    ('\u{1900}', '\u{191e}', L), ('\u{1920}', '\u{1922}', NSM), ('\u{1923}', '\u{1926}', L),
+    ('\u{1927}', '\u{1928}', NSM), ('\u{1929}', '\u{192b}', L), ('\u{1930}', '\u{1931}', L),
+    ('\u{1932}', '\u{1932}', NSM), ('\u{1933}', '\u{1938}', L), ('\u{1939}', '\u{193b}', NSM),
+    ('\u{1940}', '\u{1940}', ON), ('\u{1944}', '\u{1945}', ON), ('\u{1946}', '\u{196d}', L),
+    ('\u{1970}', '\u{1974}', L), ('\u{1980}', '\u{19ab}', L), ('\u{19b0}', '\u{19c9}', L),
+    ('\u{19d0}', '\u{19da}', L), ('\u{19de}', '\u{19ff}', ON), ('\u{1a00}', '\u{1a16}', L),
+    ('\u{1a17}', '\u{1a18}', NSM), ('\u{1a19}', '\u{1a1a}', L), ('\u{1a1b}', '\u{1a1b}', NSM),
+    ('\u{1a1e}', '\u{1a55}', L), ('\u{1a56}', '\u{1a56}', NSM), ('\u{1a57}', '\u{1a57}', L),
+    ('\u{1a58}', '\u{1a5e}', NSM), ('\u{1a60}', '\u{1a60}', NSM), ('\u{1a61}', '\u{1a61}', L),
+    ('\u{1a62}', '\u{1a62}', NSM), ('\u{1a63}', '\u{1a64}', L), ('\u{1a65}', '\u{1a6c}', NSM),
+    ('\u{1a6d}', '\u{1a72}', L), ('\u{1a73}', '\u{1a7c}', NSM), ('\u{1a7f}', '\u{1a7f}', NSM),
+    ('\u{1a80}', '\u{1a89}', L), ('\u{1a90}', '\u{1a99}', L), ('\u{1aa0}', '\u{1aad}', L),
+    ('\u{1ab0}', '\u{1abe}', NSM), ('\u{1b00}', '\u{1b03}', NSM), ('\u{1b04}', '\u{1b33}', L),
+    ('\u{1b34}', '\u{1b34}', NSM), ('\u{1b35}', '\u{1b35}', L), ('\u{1b36}', '\u{1b3a}', NSM),
+    ('\u{1b3b}', '\u{1b3b}', L), ('\u{1b3c}', '\u{1b3c}', NSM), ('\u{1b3d}', '\u{1b41}', L),
+    ('\u{1b42}', '\u{1b42}', NSM), ('\u{1b43}', '\u{1b4b}', L), ('\u{1b50}', '\u{1b6a}', L),
+    ('\u{1b6b}', '\u{1b73}', NSM), ('\u{1b74}', '\u{1b7c}', L), ('\u{1b80}', '\u{1b81}', NSM),
+    ('\u{1b82}', '\u{1ba1}', L), ('\u{1ba2}', '\u{1ba5}', NSM), ('\u{1ba6}', '\u{1ba7}', L),
+    ('\u{1ba8}', '\u{1ba9}', NSM), ('\u{1baa}', '\u{1baa}', L), ('\u{1bab}', '\u{1bad}', NSM),
+    ('\u{1bae}', '\u{1be5}', L), ('\u{1be6}', '\u{1be6}', NSM), ('\u{1be7}', '\u{1be7}', L),
+    ('\u{1be8}', '\u{1be9}', NSM), ('\u{1bea}', '\u{1bec}', L), ('\u{1bed}', '\u{1bed}', NSM),
+    ('\u{1bee}', '\u{1bee}', L), ('\u{1bef}', '\u{1bf1}', NSM), ('\u{1bf2}', '\u{1bf3}', L),
+    ('\u{1bfc}', '\u{1c2b}', L), ('\u{1c2c}', '\u{1c33}', NSM), ('\u{1c34}', '\u{1c35}', L),
+    ('\u{1c36}', '\u{1c37}', NSM), ('\u{1c3b}', '\u{1c49}', L), ('\u{1c4d}', '\u{1c88}', L),
+    ('\u{1cc0}', '\u{1cc7}', L), ('\u{1cd0}', '\u{1cd2}', NSM), ('\u{1cd3}', '\u{1cd3}', L),
+    ('\u{1cd4}', '\u{1ce0}', NSM), ('\u{1ce1}', '\u{1ce1}', L), ('\u{1ce2}', '\u{1ce8}', NSM),
+    ('\u{1ce9}', '\u{1cec}', L), ('\u{1ced}', '\u{1ced}', NSM), ('\u{1cee}', '\u{1cf3}', L),
+    ('\u{1cf4}', '\u{1cf4}', NSM), ('\u{1cf5}', '\u{1cf7}', L), ('\u{1cf8}', '\u{1cf9}', NSM),
+    ('\u{1d00}', '\u{1dbf}', L), ('\u{1dc0}', '\u{1df9}', NSM), ('\u{1dfb}', '\u{1dff}', NSM),
+    ('\u{1e00}', '\u{1f15}', L), ('\u{1f18}', '\u{1f1d}', L), ('\u{1f20}', '\u{1f45}', L),
+    ('\u{1f48}', '\u{1f4d}', L), ('\u{1f50}', '\u{1f57}', L), ('\u{1f59}', '\u{1f59}', L),
+    ('\u{1f5b}', '\u{1f5b}', L), ('\u{1f5d}', '\u{1f5d}', L), ('\u{1f5f}', '\u{1f7d}', L),
+    ('\u{1f80}', '\u{1fb4}', L), ('\u{1fb6}', '\u{1fbc}', L), ('\u{1fbd}', '\u{1fbd}', ON),
+    ('\u{1fbe}', '\u{1fbe}', L), ('\u{1fbf}', '\u{1fc1}', ON), ('\u{1fc2}', '\u{1fc4}', L),
+    ('\u{1fc6}', '\u{1fcc}', L), ('\u{1fcd}', '\u{1fcf}', ON), ('\u{1fd0}', '\u{1fd3}', L),
+    ('\u{1fd6}', '\u{1fdb}', L), ('\u{1fdd}', '\u{1fdf}', ON), ('\u{1fe0}', '\u{1fec}', L),
+    ('\u{1fed}', '\u{1fef}', ON), ('\u{1ff2}', '\u{1ff4}', L), ('\u{1ff6}', '\u{1ffc}', L),
+    ('\u{1ffd}', '\u{1ffe}', ON), ('\u{2000}', '\u{200a}', WS), ('\u{200b}', '\u{200d}', BN),
+    ('\u{200e}', '\u{200e}', L), ('\u{200f}', '\u{200f}', R), ('\u{2010}', '\u{2027}', ON),
+    ('\u{2028}', '\u{2028}', WS), ('\u{2029}', '\u{2029}', B), ('\u{202a}', '\u{202a}', LRE),
+    ('\u{202b}', '\u{202b}', RLE), ('\u{202c}', '\u{202c}', PDF), ('\u{202d}', '\u{202d}', LRO),
+    ('\u{202e}', '\u{202e}', RLO), ('\u{202f}', '\u{202f}', CS), ('\u{2030}', '\u{2034}', ET),
+    ('\u{2035}', '\u{2043}', ON), ('\u{2044}', '\u{2044}', CS), ('\u{2045}', '\u{205e}', ON),
+    ('\u{205f}', '\u{205f}', WS), ('\u{2060}', '\u{2064}', BN), ('\u{2066}', '\u{2066}', LRI),
+    ('\u{2067}', '\u{2067}', RLI), ('\u{2068}', '\u{2068}', FSI), ('\u{2069}', '\u{2069}', PDI),
+    ('\u{206a}', '\u{206f}', BN), ('\u{2070}', '\u{2070}', EN), ('\u{2071}', '\u{2071}', L),
+    ('\u{2074}', '\u{2079}', EN), ('\u{207a}', '\u{207b}', ES), ('\u{207c}', '\u{207e}', ON),
+    ('\u{207f}', '\u{207f}', L), ('\u{2080}', '\u{2089}', EN), ('\u{208a}', '\u{208b}', ES),
+    ('\u{208c}', '\u{208e}', ON), ('\u{2090}', '\u{209c}', L), ('\u{20a0}', '\u{20cf}', ET),
+    ('\u{20d0}', '\u{20f0}', NSM), ('\u{2100}', '\u{2101}', ON), ('\u{2102}', '\u{2102}', L),
+    ('\u{2103}', '\u{2106}', ON), ('\u{2107}', '\u{2107}', L), ('\u{2108}', '\u{2109}', ON),
+    ('\u{210a}', '\u{2113}', L), ('\u{2114}', '\u{2114}', ON), ('\u{2115}', '\u{2115}', L),
+    ('\u{2116}', '\u{2118}', ON), ('\u{2119}', '\u{211d}', L), ('\u{211e}', '\u{2123}', ON),
+    ('\u{2124}', '\u{2124}', L), ('\u{2125}', '\u{2125}', ON), ('\u{2126}', '\u{2126}', L),
+    ('\u{2127}', '\u{2127}', ON), ('\u{2128}', '\u{2128}', L), ('\u{2129}', '\u{2129}', ON),
+    ('\u{212a}', '\u{212d}', L), ('\u{212e}', '\u{212e}', ET), ('\u{212f}', '\u{2139}', L),
+    ('\u{213a}', '\u{213b}', ON), ('\u{213c}', '\u{213f}', L), ('\u{2140}', '\u{2144}', ON),
+    ('\u{2145}', '\u{2149}', L), ('\u{214a}', '\u{214d}', ON), ('\u{214e}', '\u{214f}', L),
+    ('\u{2150}', '\u{215f}', ON), ('\u{2160}', '\u{2188}', L), ('\u{2189}', '\u{218b}', ON),
+    ('\u{2190}', '\u{2211}', ON), ('\u{2212}', '\u{2212}', ES), ('\u{2213}', '\u{2213}', ET),
+    ('\u{2214}', '\u{2335}', ON), ('\u{2336}', '\u{237a}', L), ('\u{237b}', '\u{2394}', ON),
+    ('\u{2395}', '\u{2395}', L), ('\u{2396}', '\u{2426}', ON), ('\u{2440}', '\u{244a}', ON),
+    ('\u{2460}', '\u{2487}', ON), ('\u{2488}', '\u{249b}', EN), ('\u{249c}', '\u{24e9}', L),
+    ('\u{24ea}', '\u{26ab}', ON), ('\u{26ac}', '\u{26ac}', L), ('\u{26ad}', '\u{27ff}', ON),
+    ('\u{2800}', '\u{28ff}', L), ('\u{2900}', '\u{2b73}', ON), ('\u{2b76}', '\u{2b95}', ON),
+    ('\u{2b98}', '\u{2bb9}', ON), ('\u{2bbd}', '\u{2bc8}', ON), ('\u{2bca}', '\u{2bd2}', ON),
+    ('\u{2bec}', '\u{2bef}', ON), ('\u{2c00}', '\u{2c2e}', L), ('\u{2c30}', '\u{2c5e}', L),
+    ('\u{2c60}', '\u{2ce4}', L), ('\u{2ce5}', '\u{2cea}', ON), ('\u{2ceb}', '\u{2cee}', L),
+    ('\u{2cef}', '\u{2cf1}', NSM), ('\u{2cf2}', '\u{2cf3}', L), ('\u{2cf9}', '\u{2cff}', ON),
+    ('\u{2d00}', '\u{2d25}', L), ('\u{2d27}', '\u{2d27}', L), ('\u{2d2d}', '\u{2d2d}', L),
+    ('\u{2d30}', '\u{2d67}', L), ('\u{2d6f}', '\u{2d70}', L), ('\u{2d7f}', '\u{2d7f}', NSM),
+    ('\u{2d80}', '\u{2d96}', L), ('\u{2da0}', '\u{2da6}', L), ('\u{2da8}', '\u{2dae}', L),
+    ('\u{2db0}', '\u{2db6}', L), ('\u{2db8}', '\u{2dbe}', L), ('\u{2dc0}', '\u{2dc6}', L),
+    ('\u{2dc8}', '\u{2dce}', L), ('\u{2dd0}', '\u{2dd6}', L), ('\u{2dd8}', '\u{2dde}', L),
+    ('\u{2de0}', '\u{2dff}', NSM), ('\u{2e00}', '\u{2e49}', ON), ('\u{2e80}', '\u{2e99}', ON),
+    ('\u{2e9b}', '\u{2ef3}', ON), ('\u{2f00}', '\u{2fd5}', ON), ('\u{2ff0}', '\u{2ffb}', ON),
+    ('\u{3000}', '\u{3000}', WS), ('\u{3001}', '\u{3004}', ON), ('\u{3005}', '\u{3007}', L),
+    ('\u{3008}', '\u{3020}', ON), ('\u{3021}', '\u{3029}', L), ('\u{302a}', '\u{302d}', NSM),
+    ('\u{302e}', '\u{302f}', L), ('\u{3030}', '\u{3030}', ON), ('\u{3031}', '\u{3035}', L),
+    ('\u{3036}', '\u{3037}', ON), ('\u{3038}', '\u{303c}', L), ('\u{303d}', '\u{303f}', ON),
+    ('\u{3041}', '\u{3096}', L), ('\u{3099}', '\u{309a}', NSM), ('\u{309b}', '\u{309c}', ON),
+    ('\u{309d}', '\u{309f}', L), ('\u{30a0}', '\u{30a0}', ON), ('\u{30a1}', '\u{30fa}', L),
+    ('\u{30fb}', '\u{30fb}', ON), ('\u{30fc}', '\u{30ff}', L), ('\u{3105}', '\u{312e}', L),
+    ('\u{3131}', '\u{318e}', L), ('\u{3190}', '\u{31ba}', L), ('\u{31c0}', '\u{31e3}', ON),
+    ('\u{31f0}', '\u{321c}', L), ('\u{321d}', '\u{321e}', ON), ('\u{3220}', '\u{324f}', L),
+    ('\u{3250}', '\u{325f}', ON), ('\u{3260}', '\u{327b}', L), ('\u{327c}', '\u{327e}', ON),
+    ('\u{327f}', '\u{32b0}', L), ('\u{32b1}', '\u{32bf}', ON), ('\u{32c0}', '\u{32cb}', L),
+    ('\u{32cc}', '\u{32cf}', ON), ('\u{32d0}', '\u{32fe}', L), ('\u{3300}', '\u{3376}', L),
+    ('\u{3377}', '\u{337a}', ON), ('\u{337b}', '\u{33dd}', L), ('\u{33de}', '\u{33df}', ON),
+    ('\u{33e0}', '\u{33fe}', L), ('\u{33ff}', '\u{33ff}', ON), ('\u{3400}', '\u{4db5}', L),
+    ('\u{4dc0}', '\u{4dff}', ON), ('\u{4e00}', '\u{9fea}', L), ('\u{a000}', '\u{a48c}', L),
+    ('\u{a490}', '\u{a4c6}', ON), ('\u{a4d0}', '\u{a60c}', L), ('\u{a60d}', '\u{a60f}', ON),
+    ('\u{a610}', '\u{a62b}', L), ('\u{a640}', '\u{a66e}', L), ('\u{a66f}', '\u{a672}', NSM),
+    ('\u{a673}', '\u{a673}', ON), ('\u{a674}', '\u{a67d}', NSM), ('\u{a67e}', '\u{a67f}', ON),
+    ('\u{a680}', '\u{a69d}', L), ('\u{a69e}', '\u{a69f}', NSM), ('\u{a6a0}', '\u{a6ef}', L),
+    ('\u{a6f0}', '\u{a6f1}', NSM), ('\u{a6f2}', '\u{a6f7}', L), ('\u{a700}', '\u{a721}', ON),
+    ('\u{a722}', '\u{a787}', L), ('\u{a788}', '\u{a788}', ON), ('\u{a789}', '\u{a7ae}', L),
+    ('\u{a7b0}', '\u{a7b7}', L), ('\u{a7f7}', '\u{a801}', L), ('\u{a802}', '\u{a802}', NSM),
+    ('\u{a803}', '\u{a805}', L), ('\u{a806}', '\u{a806}', NSM), ('\u{a807}', '\u{a80a}', L),
+    ('\u{a80b}', '\u{a80b}', NSM), ('\u{a80c}', '\u{a824}', L), ('\u{a825}', '\u{a826}', NSM),
+    ('\u{a827}', '\u{a827}', L), ('\u{a828}', '\u{a82b}', ON), ('\u{a830}', '\u{a837}', L),
+    ('\u{a838}', '\u{a839}', ET), ('\u{a840}', '\u{a873}', L), ('\u{a874}', '\u{a877}', ON),
+    ('\u{a880}', '\u{a8c3}', L), ('\u{a8c4}', '\u{a8c5}', NSM), ('\u{a8ce}', '\u{a8d9}', L),
+    ('\u{a8e0}', '\u{a8f1}', NSM), ('\u{a8f2}', '\u{a8fd}', L), ('\u{a900}', '\u{a925}', L),
+    ('\u{a926}', '\u{a92d}', NSM), ('\u{a92e}', '\u{a946}', L), ('\u{a947}', '\u{a951}', NSM),
+    ('\u{a952}', '\u{a953}', L), ('\u{a95f}', '\u{a97c}', L), ('\u{a980}', '\u{a982}', NSM),
+    ('\u{a983}', '\u{a9b2}', L), ('\u{a9b3}', '\u{a9b3}', NSM), ('\u{a9b4}', '\u{a9b5}', L),
+    ('\u{a9b6}', '\u{a9b9}', NSM), ('\u{a9ba}', '\u{a9bb}', L), ('\u{a9bc}', '\u{a9bc}', NSM),
+    ('\u{a9bd}', '\u{a9cd}', L), ('\u{a9cf}', '\u{a9d9}', L), ('\u{a9de}', '\u{a9e4}', L),
+    ('\u{a9e5}', '\u{a9e5}', NSM), ('\u{a9e6}', '\u{a9fe}', L), ('\u{aa00}', '\u{aa28}', L),
+    ('\u{aa29}', '\u{aa2e}', NSM), ('\u{aa2f}', '\u{aa30}', L), ('\u{aa31}', '\u{aa32}', NSM),
+    ('\u{aa33}', '\u{aa34}', L), ('\u{aa35}', '\u{aa36}', NSM), ('\u{aa40}', '\u{aa42}', L),
+    ('\u{aa43}', '\u{aa43}', NSM), ('\u{aa44}', '\u{aa4b}', L), ('\u{aa4c}', '\u{aa4c}', NSM),
+    ('\u{aa4d}', '\u{aa4d}', L), ('\u{aa50}', '\u{aa59}', L), ('\u{aa5c}', '\u{aa7b}', L),
+    ('\u{aa7c}', '\u{aa7c}', NSM), ('\u{aa7d}', '\u{aaaf}', L), ('\u{aab0}', '\u{aab0}', NSM),
+    ('\u{aab1}', '\u{aab1}', L), ('\u{aab2}', '\u{aab4}', NSM), ('\u{aab5}', '\u{aab6}', L),
+    ('\u{aab7}', '\u{aab8}', NSM), ('\u{aab9}', '\u{aabd}', L), ('\u{aabe}', '\u{aabf}', NSM),
+    ('\u{aac0}', '\u{aac0}', L), ('\u{aac1}', '\u{aac1}', NSM), ('\u{aac2}', '\u{aac2}', L),
+    ('\u{aadb}', '\u{aaeb}', L), ('\u{aaec}', '\u{aaed}', NSM), ('\u{aaee}', '\u{aaf5}', L),
+    ('\u{aaf6}', '\u{aaf6}', NSM), ('\u{ab01}', '\u{ab06}', L), ('\u{ab09}', '\u{ab0e}', L),
+    ('\u{ab11}', '\u{ab16}', L), ('\u{ab20}', '\u{ab26}', L), ('\u{ab28}', '\u{ab2e}', L),
+    ('\u{ab30}', '\u{ab65}', L), ('\u{ab70}', '\u{abe4}', L), ('\u{abe5}', '\u{abe5}', NSM),
+    ('\u{abe6}', '\u{abe7}', L), ('\u{abe8}', '\u{abe8}', NSM), ('\u{abe9}', '\u{abec}', L),
+    ('\u{abed}', '\u{abed}', NSM), ('\u{abf0}', '\u{abf9}', L), ('\u{ac00}', '\u{d7a3}', L),
+    ('\u{d7b0}', '\u{d7c6}', L), ('\u{d7cb}', '\u{d7fb}', L), ('\u{e000}', '\u{fa6d}', L),
+    ('\u{fa70}', '\u{fad9}', L), ('\u{fb00}', '\u{fb06}', L), ('\u{fb13}', '\u{fb17}', L),
+    ('\u{fb1d}', '\u{fb1d}', R), ('\u{fb1e}', '\u{fb1e}', NSM), ('\u{fb1f}', '\u{fb28}', R),
+    ('\u{fb29}', '\u{fb29}', ES), ('\u{fb2a}', '\u{fb4f}', R), ('\u{fb50}', '\u{fd3d}', AL),
+    ('\u{fd3e}', '\u{fd3f}', ON), ('\u{fd40}', '\u{fdcf}', AL), ('\u{fdf0}', '\u{fdfc}', AL),
+    ('\u{fdfd}', '\u{fdfd}', ON), ('\u{fdfe}', '\u{fdff}', AL), ('\u{fe00}', '\u{fe0f}', NSM),
+    ('\u{fe10}', '\u{fe19}', ON), ('\u{fe20}', '\u{fe2f}', NSM), ('\u{fe30}', '\u{fe4f}', ON),
+    ('\u{fe50}', '\u{fe50}', CS), ('\u{fe51}', '\u{fe51}', ON), ('\u{fe52}', '\u{fe52}', CS),
+    ('\u{fe54}', '\u{fe54}', ON), ('\u{fe55}', '\u{fe55}', CS), ('\u{fe56}', '\u{fe5e}', ON),
+    ('\u{fe5f}', '\u{fe5f}', ET), ('\u{fe60}', '\u{fe61}', ON), ('\u{fe62}', '\u{fe63}', ES),
+    ('\u{fe64}', '\u{fe66}', ON), ('\u{fe68}', '\u{fe68}', ON), ('\u{fe69}', '\u{fe6a}', ET),
+    ('\u{fe6b}', '\u{fe6b}', ON), ('\u{fe70}', '\u{fefe}', AL), ('\u{feff}', '\u{feff}', BN),
+    ('\u{ff01}', '\u{ff02}', ON), ('\u{ff03}', '\u{ff05}', ET), ('\u{ff06}', '\u{ff0a}', ON),
+    ('\u{ff0b}', '\u{ff0b}', ES), ('\u{ff0c}', '\u{ff0c}', CS), ('\u{ff0d}', '\u{ff0d}', ES),
+    ('\u{ff0e}', '\u{ff0f}', CS), ('\u{ff10}', '\u{ff19}', EN), ('\u{ff1a}', '\u{ff1a}', CS),
+    ('\u{ff1b}', '\u{ff20}', ON), ('\u{ff21}', '\u{ff3a}', L), ('\u{ff3b}', '\u{ff40}', ON),
+    ('\u{ff41}', '\u{ff5a}', L), ('\u{ff5b}', '\u{ff65}', ON), ('\u{ff66}', '\u{ffbe}', L),
+    ('\u{ffc2}', '\u{ffc7}', L), ('\u{ffca}', '\u{ffcf}', L), ('\u{ffd2}', '\u{ffd7}', L),
+    ('\u{ffda}', '\u{ffdc}', L), ('\u{ffe0}', '\u{ffe1}', ET), ('\u{ffe2}', '\u{ffe4}', ON),
+    ('\u{ffe5}', '\u{ffe6}', ET), ('\u{ffe8}', '\u{ffee}', ON), ('\u{fff9}', '\u{fffd}', ON),
+    ('\u{10000}', '\u{1000b}', L), ('\u{1000d}', '\u{10026}', L), ('\u{10028}', '\u{1003a}', L),
+    ('\u{1003c}', '\u{1003d}', L), ('\u{1003f}', '\u{1004d}', L), ('\u{10050}', '\u{1005d}', L),
+    ('\u{10080}', '\u{100fa}', L), ('\u{10100}', '\u{10100}', L), ('\u{10101}', '\u{10101}', ON),
+    ('\u{10102}', '\u{10102}', L), ('\u{10107}', '\u{10133}', L), ('\u{10137}', '\u{1013f}', L),
+    ('\u{10140}', '\u{1018c}', ON), ('\u{1018d}', '\u{1018e}', L), ('\u{10190}', '\u{1019b}', ON),
+    ('\u{101a0}', '\u{101a0}', ON), ('\u{101d0}', '\u{101fc}', L), ('\u{101fd}', '\u{101fd}', NSM),
+    ('\u{10280}', '\u{1029c}', L), ('\u{102a0}', '\u{102d0}', L), ('\u{102e0}', '\u{102e0}', NSM),
+    ('\u{102e1}', '\u{102fb}', EN), ('\u{10300}', '\u{10323}', L), ('\u{1032d}', '\u{1034a}', L),
+    ('\u{10350}', '\u{10375}', L), ('\u{10376}', '\u{1037a}', NSM), ('\u{10380}', '\u{1039d}', L),
+    ('\u{1039f}', '\u{103c3}', L), ('\u{103c8}', '\u{103d5}', L), ('\u{10400}', '\u{1049d}', L),
+    ('\u{104a0}', '\u{104a9}', L), ('\u{104b0}', '\u{104d3}', L), ('\u{104d8}', '\u{104fb}', L),
+    ('\u{10500}', '\u{10527}', L), ('\u{10530}', '\u{10563}', L), ('\u{1056f}', '\u{1056f}', L),
+    ('\u{10600}', '\u{10736}', L), ('\u{10740}', '\u{10755}', L), ('\u{10760}', '\u{10767}', L),
+    ('\u{10800}', '\u{1091e}', R), ('\u{1091f}', '\u{1091f}', ON), ('\u{10920}', '\u{10a00}', R),
+    ('\u{10a01}', '\u{10a03}', NSM), ('\u{10a04}', '\u{10a04}', R), ('\u{10a05}', '\u{10a06}', NSM),
+    ('\u{10a07}', '\u{10a0b}', R), ('\u{10a0c}', '\u{10a0f}', NSM), ('\u{10a10}', '\u{10a37}', R),
+    ('\u{10a38}', '\u{10a3a}', NSM), ('\u{10a3b}', '\u{10a3e}', R), ('\u{10a3f}', '\u{10a3f}', NSM),
+    ('\u{10a40}', '\u{10ae4}', R), ('\u{10ae5}', '\u{10ae6}', NSM), ('\u{10ae7}', '\u{10b38}', R),
+    ('\u{10b39}', '\u{10b3f}', ON), ('\u{10b40}', '\u{10e5f}', R), ('\u{10e60}', '\u{10e7e}', AN),
+    ('\u{10e7f}', '\u{10fff}', R), ('\u{11000}', '\u{11000}', L), ('\u{11001}', '\u{11001}', NSM),
+    ('\u{11002}', '\u{11037}', L), ('\u{11038}', '\u{11046}', NSM), ('\u{11047}', '\u{1104d}', L),
+    ('\u{11052}', '\u{11065}', ON), ('\u{11066}', '\u{1106f}', L), ('\u{1107f}', '\u{11081}', NSM),
+    ('\u{11082}', '\u{110b2}', L), ('\u{110b3}', '\u{110b6}', NSM), ('\u{110b7}', '\u{110b8}', L),
+    ('\u{110b9}', '\u{110ba}', NSM), ('\u{110bb}', '\u{110c1}', L), ('\u{110d0}', '\u{110e8}', L),
+    ('\u{110f0}', '\u{110f9}', L), ('\u{11100}', '\u{11102}', NSM), ('\u{11103}', '\u{11126}', L),
+    ('\u{11127}', '\u{1112b}', NSM), ('\u{1112c}', '\u{1112c}', L), ('\u{1112d}', '\u{11134}', NSM),
+    ('\u{11136}', '\u{11143}', L), ('\u{11150}', '\u{11172}', L), ('\u{11173}', '\u{11173}', NSM),
+    ('\u{11174}', '\u{11176}', L), ('\u{11180}', '\u{11181}', NSM), ('\u{11182}', '\u{111b5}', L),
+    ('\u{111b6}', '\u{111be}', NSM), ('\u{111bf}', '\u{111c9}', L), ('\u{111ca}', '\u{111cc}', NSM),
+    ('\u{111cd}', '\u{111cd}', L), ('\u{111d0}', '\u{111df}', L), ('\u{111e1}', '\u{111f4}', L),
+    ('\u{11200}', '\u{11211}', L), ('\u{11213}', '\u{1122e}', L), ('\u{1122f}', '\u{11231}', NSM),
+    ('\u{11232}', '\u{11233}', L), ('\u{11234}', '\u{11234}', NSM), ('\u{11235}', '\u{11235}', L),
+    ('\u{11236}', '\u{11237}', NSM), ('\u{11238}', '\u{1123d}', L), ('\u{1123e}', '\u{1123e}', NSM),
+    ('\u{11280}', '\u{11286}', L), ('\u{11288}', '\u{11288}', L), ('\u{1128a}', '\u{1128d}', L),
+    ('\u{1128f}', '\u{1129d}', L), ('\u{1129f}', '\u{112a9}', L), ('\u{112b0}', '\u{112de}', L),
+    ('\u{112df}', '\u{112df}', NSM), ('\u{112e0}', '\u{112e2}', L), ('\u{112e3}', '\u{112ea}', NSM),
+    ('\u{112f0}', '\u{112f9}', L), ('\u{11300}', '\u{11301}', NSM), ('\u{11302}', '\u{11303}', L),
+    ('\u{11305}', '\u{1130c}', L), ('\u{1130f}', '\u{11310}', L), ('\u{11313}', '\u{11328}', L),
+    ('\u{1132a}', '\u{11330}', L), ('\u{11332}', '\u{11333}', L), ('\u{11335}', '\u{11339}', L),
+    ('\u{1133c}', '\u{1133c}', NSM), ('\u{1133d}', '\u{1133f}', L), ('\u{11340}', '\u{11340}', NSM),
+    ('\u{11341}', '\u{11344}', L), ('\u{11347}', '\u{11348}', L), ('\u{1134b}', '\u{1134d}', L),
+    ('\u{11350}', '\u{11350}', L), ('\u{11357}', '\u{11357}', L), ('\u{1135d}', '\u{11363}', L),
+    ('\u{11366}', '\u{1136c}', NSM), ('\u{11370}', '\u{11374}', NSM), ('\u{11400}', '\u{11437}', L),
+    ('\u{11438}', '\u{1143f}', NSM), ('\u{11440}', '\u{11441}', L), ('\u{11442}', '\u{11444}', NSM),
+    ('\u{11445}', '\u{11445}', L), ('\u{11446}', '\u{11446}', NSM), ('\u{11447}', '\u{11459}', L),
+    ('\u{1145b}', '\u{1145b}', L), ('\u{1145d}', '\u{1145d}', L), ('\u{11480}', '\u{114b2}', L),
+    ('\u{114b3}', '\u{114b8}', NSM), ('\u{114b9}', '\u{114b9}', L), ('\u{114ba}', '\u{114ba}', NSM),
+    ('\u{114bb}', '\u{114be}', L), ('\u{114bf}', '\u{114c0}', NSM), ('\u{114c1}', '\u{114c1}', L),
+    ('\u{114c2}', '\u{114c3}', NSM), ('\u{114c4}', '\u{114c7}', L), ('\u{114d0}', '\u{114d9}', L),
+    ('\u{11580}', '\u{115b1}', L), ('\u{115b2}', '\u{115b5}', NSM), ('\u{115b8}', '\u{115bb}', L),
+    ('\u{115bc}', '\u{115bd}', NSM), ('\u{115be}', '\u{115be}', L), ('\u{115bf}', '\u{115c0}', NSM),
+    ('\u{115c1}', '\u{115db}', L), ('\u{115dc}', '\u{115dd}', NSM), ('\u{11600}', '\u{11632}', L),
+    ('\u{11633}', '\u{1163a}', NSM), ('\u{1163b}', '\u{1163c}', L), ('\u{1163d}', '\u{1163d}', NSM),
+    ('\u{1163e}', '\u{1163e}', L), ('\u{1163f}', '\u{11640}', NSM), ('\u{11641}', '\u{11644}', L),
+    ('\u{11650}', '\u{11659}', L), ('\u{11660}', '\u{1166c}', ON), ('\u{11680}', '\u{116aa}', L),
+    ('\u{116ab}', '\u{116ab}', NSM), ('\u{116ac}', '\u{116ac}', L), ('\u{116ad}', '\u{116ad}', NSM),
+    ('\u{116ae}', '\u{116af}', L), ('\u{116b0}', '\u{116b5}', NSM), ('\u{116b6}', '\u{116b6}', L),
+    ('\u{116b7}', '\u{116b7}', NSM), ('\u{116c0}', '\u{116c9}', L), ('\u{11700}', '\u{11719}', L),
+    ('\u{1171d}', '\u{1171f}', NSM), ('\u{11720}', '\u{11721}', L), ('\u{11722}', '\u{11725}', NSM),
+    ('\u{11726}', '\u{11726}', L), ('\u{11727}', '\u{1172b}', NSM), ('\u{11730}', '\u{1173f}', L),
+    ('\u{118a0}', '\u{118f2}', L), ('\u{118ff}', '\u{118ff}', L), ('\u{11a00}', '\u{11a00}', L),
+    ('\u{11a01}', '\u{11a06}', NSM), ('\u{11a07}', '\u{11a08}', L), ('\u{11a09}', '\u{11a0a}', NSM),
+    ('\u{11a0b}', '\u{11a32}', L), ('\u{11a33}', '\u{11a38}', NSM), ('\u{11a39}', '\u{11a3a}', L),
+    ('\u{11a3b}', '\u{11a3e}', NSM), ('\u{11a3f}', '\u{11a46}', L), ('\u{11a47}', '\u{11a47}', NSM),
+    ('\u{11a50}', '\u{11a50}', L), ('\u{11a51}', '\u{11a56}', NSM), ('\u{11a57}', '\u{11a58}', L),
+    ('\u{11a59}', '\u{11a5b}', NSM), ('\u{11a5c}', '\u{11a83}', L), ('\u{11a86}', '\u{11a89}', L),
+    ('\u{11a8a}', '\u{11a96}', NSM), ('\u{11a97}', '\u{11a97}', L), ('\u{11a98}', '\u{11a99}', NSM),
+    ('\u{11a9a}', '\u{11a9c}', L), ('\u{11a9e}', '\u{11aa2}', L), ('\u{11ac0}', '\u{11af8}', L),
+    ('\u{11c00}', '\u{11c08}', L), ('\u{11c0a}', '\u{11c2f}', L), ('\u{11c30}', '\u{11c36}', NSM),
+    ('\u{11c38}', '\u{11c3d}', NSM), ('\u{11c3e}', '\u{11c45}', L), ('\u{11c50}', '\u{11c6c}', L),
+    ('\u{11c70}', '\u{11c8f}', L), ('\u{11c92}', '\u{11ca7}', NSM), ('\u{11ca9}', '\u{11ca9}', L),
+    ('\u{11caa}', '\u{11cb0}', NSM), ('\u{11cb1}', '\u{11cb1}', L), ('\u{11cb2}', '\u{11cb3}', NSM),
+    ('\u{11cb4}', '\u{11cb4}', L), ('\u{11cb5}', '\u{11cb6}', NSM), ('\u{11d00}', '\u{11d06}', L),
+    ('\u{11d08}', '\u{11d09}', L), ('\u{11d0b}', '\u{11d30}', L), ('\u{11d31}', '\u{11d36}', NSM),
+    ('\u{11d3a}', '\u{11d3a}', NSM), ('\u{11d3c}', '\u{11d3d}', NSM), ('\u{11d3f}', '\u{11d45}',
+    NSM), ('\u{11d46}', '\u{11d46}', L), ('\u{11d47}', '\u{11d47}', NSM), ('\u{11d50}', '\u{11d59}',
+    L), ('\u{12000}', '\u{12399}', L), ('\u{12400}', '\u{1246e}', L), ('\u{12470}', '\u{12474}', L),
+    ('\u{12480}', '\u{12543}', L), ('\u{13000}', '\u{1342e}', L), ('\u{14400}', '\u{14646}', L),
+    ('\u{16800}', '\u{16a38}', L), ('\u{16a40}', '\u{16a5e}', L), ('\u{16a60}', '\u{16a69}', L),
+    ('\u{16a6e}', '\u{16a6f}', L), ('\u{16ad0}', '\u{16aed}', L), ('\u{16af0}', '\u{16af4}', NSM),
+    ('\u{16af5}', '\u{16af5}', L), ('\u{16b00}', '\u{16b2f}', L), ('\u{16b30}', '\u{16b36}', NSM),
+    ('\u{16b37}', '\u{16b45}', L), ('\u{16b50}', '\u{16b59}', L), ('\u{16b5b}', '\u{16b61}', L),
+    ('\u{16b63}', '\u{16b77}', L), ('\u{16b7d}', '\u{16b8f}', L), ('\u{16f00}', '\u{16f44}', L),
+    ('\u{16f50}', '\u{16f7e}', L), ('\u{16f8f}', '\u{16f92}', NSM), ('\u{16f93}', '\u{16f9f}', L),
+    ('\u{16fe0}', '\u{16fe1}', L), ('\u{17000}', '\u{187ec}', L), ('\u{18800}', '\u{18af2}', L),
+    ('\u{1b000}', '\u{1b11e}', L), ('\u{1b170}', '\u{1b2fb}', L), ('\u{1bc00}', '\u{1bc6a}', L),
     ('\u{1bc70}', '\u{1bc7c}', L), ('\u{1bc80}', '\u{1bc88}', L), ('\u{1bc90}', '\u{1bc99}', L),
     ('\u{1bc9c}', '\u{1bc9c}', L), ('\u{1bc9d}', '\u{1bc9e}', NSM), ('\u{1bc9f}', '\u{1bc9f}', L),
     ('\u{1bca0}', '\u{1bca3}', BN), ('\u{1d000}', '\u{1d0f5}', L), ('\u{1d100}', '\u{1d126}', L),
     ('\u{1d129}', '\u{1d166}', L), ('\u{1d167}', '\u{1d169}', NSM), ('\u{1d16a}', '\u{1d172}', L),
     ('\u{1d173}', '\u{1d17a}', BN), ('\u{1d17b}', '\u{1d182}', NSM), ('\u{1d183}', '\u{1d184}', L),
     ('\u{1d185}', '\u{1d18b}', NSM), ('\u{1d18c}', '\u{1d1a9}', L), ('\u{1d1aa}', '\u{1d1ad}', NSM),
     ('\u{1d1ae}', '\u{1d1e8}', L), ('\u{1d200}', '\u{1d241}', ON), ('\u{1d242}', '\u{1d244}', NSM),
     ('\u{1d245}', '\u{1d245}', ON), ('\u{1d300}', '\u{1d356}', ON), ('\u{1d360}', '\u{1d371}', L),
@@ -433,20 +445,20 @@ pub const bidi_class_table: &'static [(c
     '\u{1e8cf}', R), ('\u{1e8d0}', '\u{1e8d6}', NSM), ('\u{1e8d7}', '\u{1e943}', R), ('\u{1e944}',
     '\u{1e94a}', NSM), ('\u{1e94b}', '\u{1edff}', R), ('\u{1ee00}', '\u{1eeef}', AL), ('\u{1eef0}',
     '\u{1eef1}', ON), ('\u{1eef2}', '\u{1eeff}', AL), ('\u{1ef00}', '\u{1efff}', R), ('\u{1f000}',
     '\u{1f02b}', ON), ('\u{1f030}', '\u{1f093}', ON), ('\u{1f0a0}', '\u{1f0ae}', ON), ('\u{1f0b1}',
     '\u{1f0bf}', ON), ('\u{1f0c1}', '\u{1f0cf}', ON), ('\u{1f0d1}', '\u{1f0f5}', ON), ('\u{1f100}',
     '\u{1f10a}', EN), ('\u{1f10b}', '\u{1f10c}', ON), ('\u{1f110}', '\u{1f12e}', L), ('\u{1f130}',
     '\u{1f169}', L), ('\u{1f16a}', '\u{1f16b}', ON), ('\u{1f170}', '\u{1f1ac}', L), ('\u{1f1e6}',
     '\u{1f202}', L), ('\u{1f210}', '\u{1f23b}', L), ('\u{1f240}', '\u{1f248}', L), ('\u{1f250}',
-    '\u{1f251}', L), ('\u{1f300}', '\u{1f6d2}', ON), ('\u{1f6e0}', '\u{1f6ec}', ON), ('\u{1f6f0}',
-    '\u{1f6f6}', ON), ('\u{1f700}', '\u{1f773}', ON), ('\u{1f780}', '\u{1f7d4}', ON), ('\u{1f800}',
-    '\u{1f80b}', ON), ('\u{1f810}', '\u{1f847}', ON), ('\u{1f850}', '\u{1f859}', ON), ('\u{1f860}',
-    '\u{1f887}', ON), ('\u{1f890}', '\u{1f8ad}', ON), ('\u{1f910}', '\u{1f91e}', ON), ('\u{1f920}',
-    '\u{1f927}', ON), ('\u{1f930}', '\u{1f930}', ON), ('\u{1f933}', '\u{1f93e}', ON), ('\u{1f940}',
-    '\u{1f94b}', ON), ('\u{1f950}', '\u{1f95e}', ON), ('\u{1f980}', '\u{1f991}', ON), ('\u{1f9c0}',
-    '\u{1f9c0}', ON), ('\u{20000}', '\u{2a6d6}', L), ('\u{2a700}', '\u{2b734}', L), ('\u{2b740}',
-    '\u{2b81d}', L), ('\u{2b820}', '\u{2cea1}', L), ('\u{2f800}', '\u{2fa1d}', L), ('\u{e0001}',
-    '\u{e0001}', BN), ('\u{e0020}', '\u{e007f}', BN), ('\u{e0100}', '\u{e01ef}', NSM), ('\u{f0000}',
-    '\u{ffffd}', L), ('\u{100000}', '\u{10fffd}', L)
+    '\u{1f251}', L), ('\u{1f260}', '\u{1f265}', ON), ('\u{1f300}', '\u{1f6d4}', ON), ('\u{1f6e0}',
+    '\u{1f6ec}', ON), ('\u{1f6f0}', '\u{1f6f8}', ON), ('\u{1f700}', '\u{1f773}', ON), ('\u{1f780}',
+    '\u{1f7d4}', ON), ('\u{1f800}', '\u{1f80b}', ON), ('\u{1f810}', '\u{1f847}', ON), ('\u{1f850}',
+    '\u{1f859}', ON), ('\u{1f860}', '\u{1f887}', ON), ('\u{1f890}', '\u{1f8ad}', ON), ('\u{1f900}',
+    '\u{1f90b}', ON), ('\u{1f910}', '\u{1f93e}', ON), ('\u{1f940}', '\u{1f94c}', ON), ('\u{1f950}',
+    '\u{1f96b}', ON), ('\u{1f980}', '\u{1f997}', ON), ('\u{1f9c0}', '\u{1f9c0}', ON), ('\u{1f9d0}',
+    '\u{1f9e6}', ON), ('\u{20000}', '\u{2a6d6}', L), ('\u{2a700}', '\u{2b734}', L), ('\u{2b740}',
+    '\u{2b81d}', L), ('\u{2b820}', '\u{2cea1}', L), ('\u{2ceb0}', '\u{2ebe0}', L), ('\u{2f800}',
+    '\u{2fa1d}', L), ('\u{e0001}', '\u{e0001}', BN), ('\u{e0020}', '\u{e007f}', BN), ('\u{e0100}',
+    '\u{e01ef}', NSM), ('\u{f0000}', '\u{ffffd}', L), ('\u{100000}', '\u{10fffd}', L)
 ];
 
--- a/third_party/rust/unicode-bidi/src/deprecated.rs
+++ b/third_party/rust/unicode-bidi/src/deprecated.rs
@@ -4,59 +4,61 @@
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 //! This module holds deprecated assets only.
 
+// Doesn't worth updating API here
+#![cfg_attr(feature="cargo-clippy", allow(needless_pass_by_value))]
+
 use super::*;
 
 /// Find the level runs within a line and return them in visual order.
 ///
 /// NOTE: This implementation is incomplete. The algorithm needs information about the text,
-/// including original BidiClass property of each character, to be able to perform correctly.
+/// including original `BidiClass` property of each character, to be able to perform correctly.
 /// Please see [`BidiInfo::visual_runs()`](../struct.BidiInfo.html#method.visual_runs) for the
 /// improved implementation.
 ///
 /// `line` is a range of bytes indices within `levels`.
 ///
-/// http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
-#[deprecated(since="0.3.0", note="please use `BidiInfo::visual_runs()` instead.")]
+/// <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
+#[deprecated(since = "0.3.0", note = "please use `BidiInfo::visual_runs()` instead.")]
 pub fn visual_runs(line: Range<usize>, levels: &[Level]) -> Vec<LevelRun> {
     assert!(line.start <= levels.len());
     assert!(line.end <= levels.len());
 
     let mut runs = Vec::new();
 
     // Find consecutive level runs.
     let mut start = line.start;
-    let mut level = levels[start];
-    let mut min_level = level;
-    let mut max_level = level;
+    let mut run_level = levels[start];
+    let mut min_level = run_level;
+    let mut max_level = run_level;
 
-    for i in (start + 1)..line.end {
-        let new_level = levels[i];
-        if new_level != level {
+    for (i, &new_level) in levels.iter().enumerate().take(line.end).skip(start + 1) {
+        if new_level != run_level {
             // End of the previous run, start of a new one.
             runs.push(start..i);
             start = i;
-            level = new_level;
+            run_level = new_level;
 
-            min_level = min(level, min_level);
-            max_level = max(level, max_level);
+            min_level = min(run_level, min_level);
+            max_level = max(run_level, max_level);
         }
     }
     runs.push(start..line.end);
 
     let run_count = runs.len();
 
     // Re-order the odd runs.
-    // http://www.unicode.org/reports/tr9/#L2
+    // <http://www.unicode.org/reports/tr9/#L2>
 
     // Stop at the lowest *odd* level.
     min_level = min_level.new_lowest_ge_rtl().expect("Level error");
 
     while max_level >= min_level {
         // Look for the start of a sequence of consecutive runs of max_level or higher.
         let mut seq_start = 0;
         while seq_start < run_count {
@@ -74,15 +76,15 @@ pub fn visual_runs(line: Range<usize>, l
                 seq_end += 1;
             }
 
             // Reverse the runs within this sequence.
             runs[seq_start..seq_end].reverse();
 
             seq_start = seq_end;
         }
-        max_level
-            .lower(1)
-            .expect("Lowering embedding level below zero");
+        max_level.lower(1).expect(
+            "Lowering embedding level below zero",
+        );
     }
 
     runs
 }
--- a/third_party/rust/unicode-bidi/src/explicit.rs
+++ b/third_party/rust/unicode-bidi/src/explicit.rs
@@ -4,37 +4,38 @@
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 //! 3.3.2 Explicit Levels and Directions
 //!
-//! http://www.unicode.org/reports/tr9/#Explicit_Levels_and_Directions
+//! <http://www.unicode.org/reports/tr9/#Explicit_Levels_and_Directions>
 
 use super::char_data::{BidiClass, is_rtl};
 use super::level::Level;
 
 use BidiClass::*;
 
 /// Compute explicit embedding levels for one paragraph of text (X1-X8).
 ///
-/// `processing_classes[i]` must contain the BidiClass of the char at byte index `i`,
+/// `processing_classes[i]` must contain the `BidiClass` of the char at byte index `i`,
 /// for each char in `text`.
+#[cfg_attr(feature = "flame_it", flame)]
 pub fn compute(
     text: &str,
     para_level: Level,
     original_classes: &[BidiClass],
     levels: &mut [Level],
     processing_classes: &mut [BidiClass],
 ) {
-    assert!(text.len() == original_classes.len());
+    assert_eq!(text.len(), original_classes.len());
 
-    // http://www.unicode.org/reports/tr9/#X1
+    // <http://www.unicode.org/reports/tr9/#X1>
     let mut stack = DirectionalStatusStack::new();
     stack.push(para_level, OverrideStatus::Neutral);
 
     let mut overflow_isolate_count = 0u32;
     let mut overflow_embedding_count = 0u32;
     let mut valid_isolate_count = 0u32;
 
     for (i, c) in text.char_indices() {
@@ -56,66 +57,68 @@ pub fn compute(
                 }
 
                 let new_level = if is_rtl(original_classes[i]) {
                     last_level.new_explicit_next_rtl()
                 } else {
                     last_level.new_explicit_next_ltr()
                 };
                 if new_level.is_ok() && overflow_isolate_count == 0 &&
-                   overflow_embedding_count == 0 {
+                    overflow_embedding_count == 0
+                {
                     let new_level = new_level.unwrap();
                     stack.push(
-                        new_level, match original_classes[i] {
+                        new_level,
+                        match original_classes[i] {
                             RLO => OverrideStatus::RTL,
                             LRO => OverrideStatus::LTR,
                             RLI | LRI | FSI => OverrideStatus::Isolate,
                             _ => OverrideStatus::Neutral,
-                        }
+                        },
                     );
                     if is_isolate {
                         valid_isolate_count += 1;
                     } else {
                         // The spec doesn't explicitly mention this step, but it is necessary.
                         // See the reference implementations for comparison.
                         levels[i] = new_level;
                     }
                 } else if is_isolate {
                     overflow_isolate_count += 1;
                 } else if overflow_isolate_count == 0 {
                     overflow_embedding_count += 1;
                 }
             }
 
-            // http://www.unicode.org/reports/tr9/#X6a
+            // <http://www.unicode.org/reports/tr9/#X6a>
             PDI => {
                 if overflow_isolate_count > 0 {
                     overflow_isolate_count -= 1;
                 } else if valid_isolate_count > 0 {
                     overflow_embedding_count = 0;
                     loop {
                         // Pop everything up to and including the last Isolate status.
                         match stack.vec.pop() {
+                            None |
                             Some(Status { status: OverrideStatus::Isolate, .. }) => break,
-                            None => break,
                             _ => continue,
                         }
                     }
                     valid_isolate_count -= 1;
                 }
                 let last = stack.last();
                 levels[i] = last.level;
                 match last.status {
                     OverrideStatus::RTL => processing_classes[i] = R,
                     OverrideStatus::LTR => processing_classes[i] = L,
                     _ => {}
                 }
             }
 
-            // http://www.unicode.org/reports/tr9/#X7
+            // <http://www.unicode.org/reports/tr9/#X7>
             PDF => {
                 if overflow_isolate_count > 0 {
                     continue;
                 }
                 if overflow_embedding_count > 0 {
                     overflow_embedding_count -= 1;
                     continue;
                 }
@@ -125,17 +128,17 @@ pub fn compute(
                 // The spec doesn't explicitly mention this step, but it is necessary.
                 // See the reference implementations for comparison.
                 levels[i] = stack.last().level;
             }
 
             // Nothing
             B | BN => {}
 
-            // http://www.unicode.org/reports/tr9/#X6
+            // <http://www.unicode.org/reports/tr9/#X6>
             _ => {
                 let last = stack.last();
                 levels[i] = last.level;
                 match last.status {
                     OverrideStatus::RTL => processing_classes[i] = R,
                     OverrideStatus::LTR => processing_classes[i] = L,
                     _ => {}
                 }
@@ -169,21 +172,15 @@ struct DirectionalStatusStack {
 }
 
 impl DirectionalStatusStack {
     fn new() -> Self {
         DirectionalStatusStack { vec: Vec::with_capacity(Level::max_explicit_depth() as usize + 2) }
     }
 
     fn push(&mut self, level: Level, status: OverrideStatus) {
-        self.vec
-            .push(
-                Status {
-                    level: level,
-                    status: status,
-                }
-            );
+        self.vec.push(Status { level, status });
     }
 
     fn last(&self) -> &Status {
         self.vec.last().unwrap()
     }
 }
--- a/third_party/rust/unicode-bidi/src/format_chars.rs
+++ b/third_party/rust/unicode-bidi/src/format_chars.rs
@@ -1,20 +1,20 @@
-// Copyright 2014 The html5ever Project Developers. See the
+// Copyright 2017 The Servo Project Developers. See the
 // COPYRIGHT file at the top-level directory of this distribution.
 //
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 //! Directional Formatting Characters
 //!
-//! http://www.unicode.org/reports/tr9/#Directional_Formatting_Characters
+//! <http://www.unicode.org/reports/tr9/#Directional_Formatting_Characters>
 
 // == Implicit ==
 /// ARABIC LETTER MARK
 pub const ALM: char = '\u{061C}';
 /// LEFT-TO-RIGHT MARK
 pub const LRM: char = '\u{200E}';
 /// RIGHT-TO-LEFT MARK
 pub const RLM: char = '\u{200F}';
--- a/third_party/rust/unicode-bidi/src/implicit.rs
+++ b/third_party/rust/unicode-bidi/src/implicit.rs
@@ -14,17 +14,18 @@ use std::cmp::max;
 use super::char_data::BidiClass;
 use super::prepare::{IsolatingRunSequence, LevelRun, not_removed_by_x9, removed_by_x9};
 use super::level::Level;
 
 use BidiClass::*;
 
 /// 3.3.4 Resolving Weak Types
 ///
-/// http://www.unicode.org/reports/tr9/#Resolving_Weak_Types
+/// <http://www.unicode.org/reports/tr9/#Resolving_Weak_Types>
+#[cfg_attr(feature = "flame_it", flame)]
 pub fn resolve_weak(sequence: &IsolatingRunSequence, processing_classes: &mut [BidiClass]) {
     // FIXME (#8): This function applies steps W1-W6 in a single pass.  This can produce
     // incorrect results in cases where a "later" rule changes the value of `prev_class` seen
     // by an "earlier" rule.  We should either split this into separate passes, or preserve
     // extra state so each rule can see the correct previous class.
 
     // FIXME: Also, this could be the cause of increased failure for using longer-UTF-8 chars in
     // conformance tests, like BidiTest:69635 (AL ET EN)
@@ -32,25 +33,23 @@ pub fn resolve_weak(sequence: &Isolating
     let mut prev_class = sequence.sos;
     let mut last_strong_is_al = false;
     let mut et_run_indices = Vec::new(); // for W5
 
     // Like sequence.runs.iter().flat_map(Clone::clone), but make indices itself clonable.
     fn id(x: LevelRun) -> LevelRun {
         x
     }
-    let mut indices = sequence
-        .runs
-        .iter()
-        .cloned()
-        .flat_map(id as fn(LevelRun) -> LevelRun);
+    let mut indices = sequence.runs.iter().cloned().flat_map(
+        id as fn(LevelRun) -> LevelRun,
+    );
 
     while let Some(i) = indices.next() {
         match processing_classes[i] {
-            // http://www.unicode.org/reports/tr9/#W1
+            // <http://www.unicode.org/reports/tr9/#W1>
             NSM => {
                 processing_classes[i] = match prev_class {
                     RLI | LRI | FSI | PDI => ON,
                     _ => prev_class,
                 };
             }
             EN => {
                 if last_strong_is_al {
@@ -59,34 +58,33 @@ pub fn resolve_weak(sequence: &Isolating
                 } else {
                     // W5. If a run of ETs is adjacent to an EN, change the ETs to EN.
                     for j in &et_run_indices {
                         processing_classes[*j] = EN;
                     }
                     et_run_indices.clear();
                 }
             }
-            // http://www.unicode.org/reports/tr9/#W3
+            // <http://www.unicode.org/reports/tr9/#W3>
             AL => processing_classes[i] = R,
 
-            // http://www.unicode.org/reports/tr9/#W4
+            // <http://www.unicode.org/reports/tr9/#W4>
             ES | CS => {
                 let next_class = indices
                     .clone()
                     .map(|j| processing_classes[j])
-                    .filter(not_removed_by_x9)
-                    .next()
+                    .find(not_removed_by_x9)
                     .unwrap_or(sequence.eos);
                 processing_classes[i] = match (prev_class, processing_classes[i], next_class) {
                     (EN, ES, EN) | (EN, CS, EN) => EN,
                     (AN, CS, AN) => AN,
                     (_, _, _) => ON,
                 }
             }
-            // http://www.unicode.org/reports/tr9/#W5
+            // <http://www.unicode.org/reports/tr9/#W5>
             ET => {
                 match prev_class {
                     EN => processing_classes[i] = EN,
                     _ => et_run_indices.push(i), // In case this is followed by an EN.
                 }
             }
             class => {
                 if removed_by_x9(class) {
@@ -131,17 +129,18 @@ pub fn resolve_weak(sequence: &Isolating
                 _ => {}
             }
         }
     }
 }
 
 /// 3.3.5 Resolving Neutral Types
 ///
-/// http://www.unicode.org/reports/tr9/#Resolving_Neutral_Types
+/// <http://www.unicode.org/reports/tr9/#Resolving_Neutral_Types>
+#[cfg_attr(feature = "flame_it", flame)]
 pub fn resolve_neutral(
     sequence: &IsolatingRunSequence,
     levels: &[Level],
     processing_classes: &mut [BidiClass],
 ) {
     let e: BidiClass = levels[sequence.runs[0].start].bidi_class();
     let mut indices = sequence.runs.iter().flat_map(Clone::clone);
     let mut prev_class = sequence.sos;
@@ -174,18 +173,18 @@ pub fn resolve_neutral(
                         next_class = sequence.eos;
                         break;
                     }
                 };
             }
 
             // N1-N2.
             //
-            // http://www.unicode.org/reports/tr9/#N1
-            // http://www.unicode.org/reports/tr9/#N2
+            // <http://www.unicode.org/reports/tr9/#N1>
+            // <http://www.unicode.org/reports/tr9/#N2>
             let new_class = match (prev_class, next_class) {
                 (L, L) => L,
                 (R, R) | (R, AN) | (R, EN) | (AN, R) | (AN, AN) | (AN, EN) | (EN, R) |
                 (EN, AN) | (EN, EN) => R,
                 (_, _) => e,
             };
             for j in &ni_run {
                 processing_classes[*j] = new_class;
@@ -195,35 +194,35 @@ pub fn resolve_neutral(
         prev_class = processing_classes[i];
     }
 }
 
 /// 3.3.6 Resolving Implicit Levels
 ///
 /// Returns the maximum embedding level in the paragraph.
 ///
-/// http://www.unicode.org/reports/tr9/#Resolving_Implicit_Levels
+/// <http://www.unicode.org/reports/tr9/#Resolving_Implicit_Levels>
+#[cfg_attr(feature = "flame_it", flame)]
 pub fn resolve_levels(original_classes: &[BidiClass], levels: &mut [Level]) -> Level {
     let mut max_level = Level::ltr();
 
-    assert!(original_classes.len() == levels.len());
+    assert_eq!(original_classes.len(), levels.len());
     for i in 0..levels.len() {
         match (levels[i].is_rtl(), original_classes[i]) {
-            // http://www.unicode.org/reports/tr9/#I1
-            (false, R) => levels[i].raise(1).expect("Level number error"),
             (false, AN) | (false, EN) => levels[i].raise(2).expect("Level number error"),
-            // http://www.unicode.org/reports/tr9/#I2
-            (true, L) | (true, EN) | (true, AN) => levels[i].raise(1).expect("Level number error"),
+            (false, R) | (true, L) | (true, EN) | (true, AN) => {
+                levels[i].raise(1).expect("Level number error")
+            }
             (_, _) => {}
         }
         max_level = max(max_level, levels[i]);
     }
 
     max_level
 }
 
 /// Neutral or Isolate formatting character (B, S, WS, ON, FSI, LRI, RLI, PDI)
 ///
-/// http://www.unicode.org/reports/tr9/#NI
+/// <http://www.unicode.org/reports/tr9/#NI>
 #[allow(non_snake_case)]
 fn is_NI(class: BidiClass) -> bool {
     matches!(class, B | S | WS | ON | FSI | LRI | RLI | PDI)
 }
--- a/third_party/rust/unicode-bidi/src/level.rs
+++ b/third_party/rust/unicode-bidi/src/level.rs
@@ -6,34 +6,34 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 //! Bidi Embedding Level
 //!
 //! See [`Level`](struct.Level.html) for more details.
 //!
-//! http://www.unicode.org/reports/tr9/#BD2
+//! <http://www.unicode.org/reports/tr9/#BD2>
 
 use std::convert::{From, Into};
 
 use super::char_data::BidiClass;
 
 /// Embedding Level
 ///
 /// Embedding Levels are numbers between 0 and 126 (inclusive), where even values denote a
 /// left-to-right (LTR) direction and odd values a right-to-left (RTL) direction.
 ///
 /// This struct maintains a *valid* status for level numbers, meaning that creating a new level, or
 /// mutating an existing level, with the value smaller than `0` (before conversion to `u8`) or
 /// larger than 125 results in an `Error`.
 ///
-/// http://www.unicode.org/reports/tr9/#BD2
+/// <http://www.unicode.org/reports/tr9/#BD2>
 #[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
-#[cfg_attr(feature = "with_serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
 pub struct Level(u8);
 
 pub const LTR_LEVEL: Level = Level(0);
 pub const RTL_LEVEL: Level = Level(1);
 
 const MAX_DEPTH: u8 = 125;
 /// During explicit level resolution, embedding level can go as high as `max_depth`.
 pub const MAX_EXPLICIT_DEPTH: u8 = MAX_DEPTH;
@@ -158,17 +158,17 @@ impl Level {
         }
     }
 
     // == Helpers ==
 
     /// The next LTR (even) level greater than this, or fail if number is larger than `max_depth`.
     #[inline]
     pub fn new_explicit_next_ltr(&self) -> Result<Level, Error> {
-        Level::new_explicit(self.0 + 2 & !1)
+        Level::new_explicit((self.0 + 2) & !1)
     }
 
     /// The next RTL (odd) level greater than this, or fail if number is larger than `max_depth`.
     #[inline]
     pub fn new_explicit_next_rtl(&self) -> Result<Level, Error> {
         Level::new_explicit((self.0 + 1) | 1)
     }
 
@@ -349,17 +349,17 @@ mod tests {
     fn test_string_eq() {
         assert_eq!(
             Level::vec(&[0, 1, 4, 125]),
             vec!["0".to_string(), "1".to_string(), "x".to_string(), "125".to_string()]
         );
     }
 }
 
-#[cfg(all(feature = "with_serde", test))]
+#[cfg(all(feature = "serde", test))]
 mod serde_tests {
     use serde_test::{Token, assert_tokens};
     use super::*;
 
     #[test]
     fn test_statics() {
         assert_tokens(
             &Level::ltr(),
--- a/third_party/rust/unicode-bidi/src/lib.rs
+++ b/third_party/rust/unicode-bidi/src/lib.rs
@@ -48,41 +48,49 @@
 //!   "b",
 //!   "c",
 //!   "ג",
 //!   "ב",
 //!   "א",
 //! ]);
 //! ```
 //!
-//! [tr9]: http://www.unicode.org/reports/tr9/
+//! [tr9]: <http://www.unicode.org/reports/tr9/>
 
 #![forbid(unsafe_code)]
 
+#![cfg_attr(feature="flame_it", feature(plugin, custom_attribute))]
+#![cfg_attr(feature="flame_it", plugin(flamer))]
+
+
 #[macro_use]
 extern crate matches;
 
-#[cfg(feature = "with_serde")]
+#[cfg(feature = "serde")]
 #[macro_use]
-extern crate serde_derive;
+extern crate serde;
 
-#[cfg(all(feature = "with_serde", test))]
+#[cfg(all(feature = "serde", test))]
 extern crate serde_test;
 
+#[cfg(feature = "flame_it")]
+extern crate flame;
+
+
 pub mod deprecated;
 pub mod format_chars;
 pub mod level;
 
 mod char_data;
 mod explicit;
 mod implicit;
 mod prepare;
 
 pub use char_data::{BidiClass, bidi_class, UNICODE_VERSION};
-pub use level::Level;
+pub use level::{Level, LTR_LEVEL, RTL_LEVEL};
 pub use prepare::LevelRun;
 
 use std::borrow::Cow;
 use std::cmp::{max, min};
 use std::iter::repeat;
 use std::ops::Range;
 
 use BidiClass::*;
@@ -94,133 +102,140 @@ use format_chars as chars;
 pub struct ParagraphInfo {
     /// The paragraphs boundaries within the text, as byte indices.
     ///
     /// TODO: Shrink this to only include the starting index?
     pub range: Range<usize>,
 
     /// The paragraph embedding level.
     ///
-    /// http://www.unicode.org/reports/tr9/#BD4
+    /// <http://www.unicode.org/reports/tr9/#BD4>
     pub level: Level,
 }
 
-/// Initial bidi information of the text
+/// Initial bidi information of the text.
 ///
-/// Contains the paragraphs and BidiClasses in a string of text.
+/// Contains the text paragraphs and `BidiClass` of its characters.
 #[derive(PartialEq, Debug)]
 pub struct InitialInfo<'text> {
     /// The text
     pub text: &'text str,
 
     /// The BidiClass of the character at each byte in the text.
     /// If a character is multiple bytes, its class will appear multiple times in the vector.
     pub original_classes: Vec<BidiClass>,
 
     /// The boundaries and level of each paragraph within the text.
     pub paragraphs: Vec<ParagraphInfo>,
 }
 
 impl<'text> InitialInfo<'text> {
     /// Find the paragraphs and BidiClasses in a string of text.
     ///
-    /// http://www.unicode.org/reports/tr9/#The_Paragraph_Level
+    /// <http://www.unicode.org/reports/tr9/#The_Paragraph_Level>
     ///
     /// Also sets the class for each First Strong Isolate initiator (FSI) to LRI or RLI if a strong
     /// character is found before the matching PDI.  If no strong character is found, the class will
     /// remain FSI, and it's up to later stages to treat these as LRI when needed.
+    #[cfg_attr(feature = "flame_it", flame)]
     pub fn new(text: &str, default_para_level: Option<Level>) -> InitialInfo {
         let mut original_classes = Vec::with_capacity(text.len());
 
         // The stack contains the starting byte index for each nested isolate we're inside.
         let mut isolate_stack = Vec::new();
         let mut paragraphs = Vec::new();
 
         let mut para_start = 0;
         let mut para_level = default_para_level;
 
+        #[cfg(feature = "flame_it")] flame::start("InitialInfo::new(): iter text.char_indices()");
+
         for (i, c) in text.char_indices() {
             let class = bidi_class(c);
+
+            #[cfg(feature = "flame_it")] flame::start("original_classes.extend()");
+
             original_classes.extend(repeat(class).take(c.len_utf8()));
+
+            #[cfg(feature = "flame_it")] flame::end("original_classes.extend()");
+
             match class {
+
                 B => {
                     // P1. Split the text into separate paragraphs. The paragraph separator is kept
                     // with the previous paragraph.
                     let para_end = i + c.len_utf8();
-                    paragraphs.push(
-                        ParagraphInfo {
-                            range: para_start..para_end,
-                            // P3. If no character is found in p2, set the paragraph level to zero.
-                            level: para_level.unwrap_or(Level::ltr()),
-                        }
-                    );
+                    paragraphs.push(ParagraphInfo {
+                        range: para_start..para_end,
+                        // P3. If no character is found in p2, set the paragraph level to zero.
+                        level: para_level.unwrap_or(LTR_LEVEL),
+                    });
                     // Reset state for the start of the next paragraph.
                     para_start = para_end;
                     // TODO: Support defaulting to direction of previous paragraph
                     //
-                    // http://www.unicode.org/reports/tr9/#HL1
+                    // <http://www.unicode.org/reports/tr9/#HL1>
                     para_level = default_para_level;
                     isolate_stack.clear();
                 }
+
                 L | R | AL => {
                     match isolate_stack.last() {
                         Some(&start) => {
                             if original_classes[start] == FSI {
                                 // X5c. If the first strong character between FSI and its matching
                                 // PDI is R or AL, treat it as RLI. Otherwise, treat it as LRI.
                                 for j in 0..chars::FSI.len_utf8() {
                                     original_classes[start + j] =
                                         if class == L { LRI } else { RLI };
                                 }
                             }
                         }
+
                         None => {
                             if para_level.is_none() {
                                 // P2. Find the first character of type L, AL, or R, while skipping
                                 // any characters between an isolate initiator and its matching
                                 // PDI.
-                                para_level = Some(
-                                    if class != L {
-                                        Level::rtl()
-                                    } else {
-                                        Level::ltr()
-                                    }
-                                );
+                                para_level = Some(if class != L { RTL_LEVEL } else { LTR_LEVEL });
                             }
                         }
                     }
                 }
+
                 RLI | LRI | FSI => {
                     isolate_stack.push(i);
                 }
+
                 PDI => {
                     isolate_stack.pop();
                 }
+
                 _ => {}
             }
         }
         if para_start < text.len() {
-            paragraphs.push(
-                ParagraphInfo {
-                    range: para_start..text.len(),
-                    level: para_level.unwrap_or(Level::ltr()),
-                }
-            );
+            paragraphs.push(ParagraphInfo {
+                range: para_start..text.len(),
+                level: para_level.unwrap_or(LTR_LEVEL),
+            });
         }
-        assert!(original_classes.len() == text.len());
+        assert_eq!(original_classes.len(), text.len());
+
+        #[cfg(feature = "flame_it")] flame::end("InitialInfo::new(): iter text.char_indices()");
 
         InitialInfo {
-            text: text,
-            original_classes: original_classes,
-            paragraphs: paragraphs,
+            text,
+            original_classes,
+            paragraphs,
         }
     }
 }
 
-/// Bidi information of the text
+/// Bidi information of the text.
 ///
 /// The `original_classes` and `levels` vectors are indexed by byte offsets into the text.  If a
 /// character is multiple bytes wide, then its class and level will appear multiple times in these
 /// vectors.
 // TODO: Impl `struct StringProperty<T> { values: Vec<T> }` and use instead of Vec<T>
 #[derive(Debug, PartialEq)]
 pub struct BidiInfo<'text> {
     /// The text
@@ -241,21 +256,22 @@ pub struct BidiInfo<'text> {
 
 impl<'text> BidiInfo<'text> {
     /// Split the text into paragraphs and determine the bidi embedding levels for each paragraph.
     ///
     /// TODO: In early steps, check for special cases that allow later steps to be skipped. like
     /// text that is entirely LTR.  See the `nsBidi` class from Gecko for comparison.
     ///
     /// TODO: Support auto-RTL base direction
+    #[cfg_attr(feature = "flame_it", flame)]
     pub fn new(text: &str, default_para_level: Option<Level>) -> BidiInfo {
         let InitialInfo {
-            text: _,
             original_classes,
             paragraphs,
+            ..
         } = InitialInfo::new(text, default_para_level);
 
         let mut levels = Vec::<Level>::with_capacity(text.len());
         let mut processing_classes = original_classes.clone();
 
         for para in &paragraphs {
             let text = &text[para.range.clone()];
             let original_classes = &original_classes[para.range.clone()];
@@ -263,59 +279,62 @@ impl<'text> BidiInfo<'text> {
 
             let new_len = levels.len() + para.range.len();
             levels.resize(new_len, para.level);
             let levels = &mut levels[para.range.clone()];
 
             explicit::compute(
                 text,
                 para.level,
-                &original_classes,
+                original_classes,
                 levels,
                 processing_classes,
             );
 
-            let sequences = prepare::isolating_run_sequences(para.level, &original_classes, levels);
+            let sequences = prepare::isolating_run_sequences(para.level, original_classes, levels);
             for sequence in &sequences {
                 implicit::resolve_weak(sequence, processing_classes);
                 implicit::resolve_neutral(sequence, levels, processing_classes);
             }
             implicit::resolve_levels(processing_classes, levels);
 
-            assign_levels_to_removed_chars(para.level, &original_classes, levels);
+            assign_levels_to_removed_chars(para.level, original_classes, levels);
         }
 
         BidiInfo {
-            text: text,
-            original_classes: original_classes,
-            paragraphs: paragraphs,
-            levels: levels,
+            text,
+            original_classes,
+            paragraphs,
+            levels,
         }
     }
 
     /// Re-order a line based on resolved levels and return only the embedding levels, one `Level`
     /// per *byte*.
+    #[cfg_attr(feature = "flame_it", flame)]
     pub fn reordered_levels(&self, para: &ParagraphInfo, line: Range<usize>) -> Vec<Level> {
         let (levels, _) = self.visual_runs(para, line.clone());
         levels
     }
 
     /// Re-order a line based on resolved levels and return only the embedding levels, one `Level`
     /// per *character*.
+    #[cfg_attr(feature = "flame_it", flame)]
     pub fn reordered_levels_per_char(
         &self,
         para: &ParagraphInfo,
         line: Range<usize>,
     ) -> Vec<Level> {
         let levels = self.reordered_levels(para, line);
         self.text.char_indices().map(|(i, _)| levels[i]).collect()
     }
 
 
     /// Re-order a line based on resolved levels and return the line in display order.
+    #[cfg_attr(feature = "flame_it", flame)]
     pub fn reorder_line(&self, para: &ParagraphInfo, line: Range<usize>) -> Cow<'text, str> {
         let (levels, runs) = self.visual_runs(para, line.clone());
 
         // If all isolating run sequences are LTR, no reordering is needed
         if runs.iter().all(|run| levels[run.start].is_ltr()) {
             return self.text[line.clone()].into();
         }
 
@@ -329,93 +348,94 @@ impl<'text> BidiInfo<'text> {
         }
         result.into()
     }
 
     /// Find the level runs within a line and return them in visual order.
     ///
     /// `line` is a range of bytes indices within `levels`.
     ///
-    /// http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels
+    /// <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
+    #[cfg_attr(feature = "flame_it", flame)]
     pub fn visual_runs(
         &self,
         para: &ParagraphInfo,
         line: Range<usize>,
     ) -> (Vec<Level>, Vec<LevelRun>) {
         assert!(line.start <= self.levels.len());
         assert!(line.end <= self.levels.len());
 
         let mut levels = self.levels.clone();
 
         // Reset some whitespace chars to paragraph level.
-        // http://www.unicode.org/reports/tr9/#L1
+        // <http://www.unicode.org/reports/tr9/#L1>
         let line_str: &str = &self.text[line.clone()];
         let mut reset_from: Option<usize> = Some(0);
         let mut reset_to: Option<usize> = None;
         for (i, c) in line_str.char_indices() {
             match self.original_classes[i] {
                 // Ignored by X9
                 RLE | LRE | RLO | LRO | PDF | BN => {}
                 // Segment separator, Paragraph separator
                 B | S => {
-                    assert!(reset_to == None);
+                    assert_eq!(reset_to, None);
                     reset_to = Some(i + c.len_utf8());
                     if reset_from == None {
                         reset_from = Some(i);
                     }
                 }
                 // Whitespace, isolate formatting
                 WS | FSI | LRI | RLI | PDI => {
                     if reset_from == None {
                         reset_from = Some(i);
                     }
                 }
                 _ => {
                     reset_from = None;
                 }
             }
             if let (Some(from), Some(to)) = (reset_from, reset_to) {
+                #[cfg_attr(feature = "cargo-clippy", allow(needless_range_loop))]
                 for j in from..to {
                     levels[j] = para.level;
                 }
                 reset_from = None;
                 reset_to = None;
             }
         }
         if let Some(from) = reset_from {
+            #[cfg_attr(feature = "cargo-clippy", allow(needless_range_loop))]
             for j in from..line_str.len() {
                 levels[j] = para.level;
             }
         }
 
         // Find consecutive level runs.
         let mut runs = Vec::new();
         let mut start = line.start;
-        let mut level = levels[start];
-        let mut min_level = level;
-        let mut max_level = level;
+        let mut run_level = levels[start];
+        let mut min_level = run_level;
+        let mut max_level = run_level;
 
-        for i in (start + 1)..line.end {
-            let new_level = levels[i];
-            if new_level != level {
+        for (i, &new_level) in levels.iter().enumerate().take(line.end).skip(start + 1) {
+            if new_level != run_level {
                 // End of the previous run, start of a new one.
                 runs.push(start..i);
                 start = i;
-                level = new_level;
-
-                min_level = min(level, min_level);
-                max_level = max(level, max_level);
+                run_level = new_level;
+                min_level = min(run_level, min_level);
+                max_level = max(run_level, max_level);
             }
         }
         runs.push(start..line.end);
 
         let run_count = runs.len();
 
         // Re-order the odd runs.
-        // http://www.unicode.org/reports/tr9/#L2
+        // <http://www.unicode.org/reports/tr9/#L2>
 
         // Stop at the lowest *odd* level.
         min_level = min_level.new_lowest_ge_rtl().expect("Level error");
 
         while max_level >= min_level {
             // Look for the start of a sequence of consecutive runs of max_level or higher.
             let mut seq_start = 0;
             while seq_start < run_count {
@@ -433,19 +453,19 @@ impl<'text> BidiInfo<'text> {
                     seq_end += 1;
                 }
 
                 // Reverse the runs within this sequence.
                 runs[seq_start..seq_end].reverse();
 
                 seq_start = seq_end;
             }
-            max_level
-                .lower(1)
-                .expect("Lowering embedding level below zero");
+            max_level.lower(1).expect(
+                "Lowering embedding level below zero",
+            );
         }
 
         (levels, runs)
     }
 
     /// If processed text has any computed RTL levels
     ///
     /// This information is usually used to skip re-ordering of text when no RTL level is present
@@ -454,16 +474,17 @@ impl<'text> BidiInfo<'text> {
         level::has_rtl(&self.levels)
     }
 }
 
 /// Assign levels to characters removed by rule X9.
 ///
 /// The levels assigned to these characters are not specified by the algorithm.  This function
 /// assigns each one the level of the previous character, to avoid breaking level runs.
+#[cfg_attr(feature = "flame_it", flame)]
 fn assign_levels_to_removed_chars(para_level: Level, classes: &[BidiClass], levels: &mut [Level]) {
     for i in 0..levels.len() {
         if prepare::removed_by_x9(classes[i]) {
             levels[i] = if i > 0 { levels[i - 1] } else { para_level };
         }
     }
 }
 
@@ -473,218 +494,212 @@ mod tests {
     use super::*;
 
     #[test]
     fn test_initial_text_info() {
         let text = "a1";
         assert_eq!(
             InitialInfo::new(text, None),
             InitialInfo {
-                text: &text,
+                text,
                 original_classes: vec![L, EN],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..2,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                 ],
             }
         );
 
         let text = "غ א";
         assert_eq!(
             InitialInfo::new(text, None),
             InitialInfo {
-                text: &text,
+                text,
                 original_classes: vec![AL, AL, WS, R, R],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..5,
-                        level: Level::rtl(),
+                        level: RTL_LEVEL,
                     },
                 ],
             }
         );
 
         let text = "a\u{2029}b";
         assert_eq!(
             InitialInfo::new(text, None),
             InitialInfo {
-                text: &text,
+                text,
                 original_classes: vec![L, B, B, B, L],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..4,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                     ParagraphInfo {
                         range: 4..5,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                 ],
             }
         );
 
         let text = format!("{}א{}a", chars::FSI, chars::PDI);
         assert_eq!(
             InitialInfo::new(&text, None),
             InitialInfo {
                 text: &text,
                 original_classes: vec![RLI, RLI, RLI, R, R, PDI, PDI, PDI, L],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..9,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                 ],
             }
         );
     }
 
     #[test]
     fn test_process_text() {
         let text = "abc123";
         assert_eq!(
-            BidiInfo::new(text, Some(Level::ltr())),
+            BidiInfo::new(text, Some(LTR_LEVEL)),
             BidiInfo {
-                text: &text,
+                text,
                 levels: Level::vec(&[0, 0, 0, 0, 0, 0]),
                 original_classes: vec![L, L, L, EN, EN, EN],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..6,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                 ],
             }
         );
 
         let text = "abc אבג";
         assert_eq!(
-            BidiInfo::new(text, Some(Level::ltr())),
+            BidiInfo::new(text, Some(LTR_LEVEL)),
             BidiInfo {
-                text: &text,
+                text,
                 levels: Level::vec(&[0, 0, 0, 0, 1, 1, 1, 1, 1, 1]),
                 original_classes: vec![L, L, L, WS, R, R, R, R, R, R],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..10,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                 ],
             }
         );
         assert_eq!(
-            BidiInfo::new(text, Some(Level::rtl())),
+            BidiInfo::new(text, Some(RTL_LEVEL)),
             BidiInfo {
-                text: &text,
+                text,
                 levels: Level::vec(&[2, 2, 2, 1, 1, 1, 1, 1, 1, 1]),
                 original_classes: vec![L, L, L, WS, R, R, R, R, R, R],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..10,
-                        level: Level::rtl(),
+                        level: RTL_LEVEL,
                     },
                 ],
             }
         );
 
         let text = "אבג abc";
         assert_eq!(
-            BidiInfo::new(text, Some(Level::ltr())),
+            BidiInfo::new(text, Some(LTR_LEVEL)),
             BidiInfo {
-                text: &text,
+                text,
                 levels: Level::vec(&[1, 1, 1, 1, 1, 1, 0, 0, 0, 0]),
                 original_classes: vec![R, R, R, R, R, R, WS, L, L, L],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..10,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                 ],
             }
         );
         assert_eq!(
             BidiInfo::new(text, None),
             BidiInfo {
-                text: &text,
+                text,
                 levels: Level::vec(&[1, 1, 1, 1, 1, 1, 1, 2, 2, 2]),
                 original_classes: vec![R, R, R, R, R, R, WS, L, L, L],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..10,
-                        level: Level::rtl(),
+                        level: RTL_LEVEL,
                     },
                 ],
             }
         );
 
         let text = "غ2ظ א2ג";
         assert_eq!(
-            BidiInfo::new(text, Some(Level::ltr())),
+            BidiInfo::new(text, Some(LTR_LEVEL)),
             BidiInfo {
-                text: &text,
+                text,
                 levels: Level::vec(&[1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1]),
                 original_classes: vec![AL, AL, EN, AL, AL, WS, R, R, EN, R, R],
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..11,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                 ],
             }
         );
 
         let text = "a א.\nג";
         assert_eq!(
             BidiInfo::new(text, None),
             BidiInfo {
-                text: &text,
+                text,
                 original_classes: vec![L, WS, R, R, CS, B, R, R],
                 levels: Level::vec(&[0, 0, 1, 1, 0, 0, 1, 1]),
                 paragraphs: vec![
                     ParagraphInfo {
                         range: 0..6,
-                        level: Level::ltr(),
+                        level: LTR_LEVEL,
                     },
                     ParagraphInfo {
                         range: 6..8,
-                        level: Level::rtl(),
+                        level: RTL_LEVEL,
                     },
                 ],
             }
         );
 
         /// BidiTest:69635 (AL ET EN)
         let bidi_info = BidiInfo::new("\u{060B}\u{20CF}\u{06F9}", None);
         assert_eq!(bidi_info.original_classes, vec![AL, AL, ET, ET, ET, EN, EN]);
     }
 
     #[test]
     fn test_bidi_info_has_rtl() {
         // ASCII only
         assert_eq!(BidiInfo::new("123", None).has_rtl(), false);
-        assert_eq!(BidiInfo::new("123", Some(Level::ltr())).has_rtl(), false);
-        assert_eq!(BidiInfo::new("123", Some(Level::rtl())).has_rtl(), false);
+        assert_eq!(BidiInfo::new("123", Some(LTR_LEVEL)).has_rtl(), false);
+        assert_eq!(BidiInfo::new("123", Some(RTL_LEVEL)).has_rtl(), false);
         assert_eq!(BidiInfo::new("abc", None).has_rtl(), false);
-        assert_eq!(BidiInfo::new("abc", Some(Level::ltr())).has_rtl(), false);
-        assert_eq!(BidiInfo::new("abc", Some(Level::rtl())).has_rtl(), false);
+        assert_eq!(BidiInfo::new("abc", Some(LTR_LEVEL)).has_rtl(), false);
+        assert_eq!(BidiInfo::new("abc", Some(RTL_LEVEL)).has_rtl(), false);
         assert_eq!(BidiInfo::new("abc 123", None).has_rtl(), false);
         assert_eq!(BidiInfo::new("abc\n123", None).has_rtl(), false);
 
         // With Hebrew
         assert_eq!(BidiInfo::new("אבּג", None).has_rtl(), true);
-        assert_eq!(
-            BidiInfo::new("אבּג", Some(Level::ltr())).has_rtl(),
-            true
-        );
-        assert_eq!(
-            BidiInfo::new("אבּג", Some(Level::rtl())).has_rtl(),
-            true
-        );
+        assert_eq!(BidiInfo::new("אבּג", Some(LTR_LEVEL)).has_rtl(), true);
+        assert_eq!(BidiInfo::new("אבּג", Some(RTL_LEVEL)).has_rtl(), true);
         assert_eq!(BidiInfo::new("abc אבּג", None).has_rtl(), true);
         assert_eq!(BidiInfo::new("abc\nאבּג", None).has_rtl(), true);
         assert_eq!(BidiInfo::new("אבּג abc", None).has_rtl(), true);
         assert_eq!(BidiInfo::new("אבּג\nabc", None).has_rtl(), true);
         assert_eq!(BidiInfo::new("אבּג 123", None).has_rtl(), true);
         assert_eq!(BidiInfo::new("אבּג\n123", None).has_rtl(), true);
     }
 
@@ -783,17 +798,19 @@ mod tests {
             .collect()
     }
 
     fn reordered_levels_per_char_for_paras(text: &str) -> Vec<Vec<Level>> {
         let bidi_info = BidiInfo::new(text, None);
         bidi_info
             .paragraphs
             .iter()
-            .map(|para| bidi_info.reordered_levels_per_char(para, para.range.clone()))
+            .map(|para| {
+                bidi_info.reordered_levels_per_char(para, para.range.clone())
+            })
             .collect()
     }
 
     #[test]
     fn test_reordered_levels() {
 
         /// BidiTest:946 (LRI PDI)
         let text = "\u{2067}\u{2069}";
@@ -825,17 +842,17 @@ mod tests {
             reordered_levels_per_char_for_paras("\u{0605}\u{2067}\u{202C}\u{0590}"),
             vec![&["2", "0", "x", "1"]]
         );
          */
     }
 }
 
 
-#[cfg(all(feature = "with_serde", test))]
+#[cfg(all(feature = "serde", test))]
 mod serde_tests {
     use serde_test::{Token, assert_tokens};
     use super::*;
 
     #[test]
     fn test_levels() {
         let text = "abc אבג";
         let bidi_info = BidiInfo::new(text, None);
--- a/third_party/rust/unicode-bidi/src/prepare.rs
+++ b/third_party/rust/unicode-bidi/src/prepare.rs
@@ -4,17 +4,17 @@
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 //! 3.3.3 Preparations for Implicit Processing
 //!
-//! http://www.unicode.org/reports/tr9/#Preparations_for_Implicit_Processing
+//! <http://www.unicode.org/reports/tr9/#Preparations_for_Implicit_Processing>
 
 use std::cmp::max;
 use std::ops::Range;
 
 use super::char_data::BidiClass;
 use super::level::Level;
 
 use BidiClass::*;
@@ -36,34 +36,35 @@ pub struct IsolatingRunSequence {
 
 /// Compute the set of isolating run sequences.
 ///
 /// An isolating run sequence is a maximal sequence of level runs such that for all level runs
 /// except the last one in the sequence, the last character of the run is an isolate initiator
 /// whose matching PDI is the first character of the next level run in the sequence.
 ///
 /// Note: This function does *not* return the sequences in order by their first characters.
+#[cfg_attr(feature = "flame_it", flame)]
 pub fn isolating_run_sequences(
     para_level: Level,
     original_classes: &[BidiClass],
     levels: &[Level],
 ) -> Vec<IsolatingRunSequence> {
     let runs = level_runs(levels, original_classes);
 
     // Compute the set of isolating run sequences.
-    // http://www.unicode.org/reports/tr9/#BD13
+    // <http://www.unicode.org/reports/tr9/#BD13>
     let mut sequences = Vec::with_capacity(runs.len());
 
     // When we encounter an isolate initiator, we push the current sequence onto the
     // stack so we can resume it after the matching PDI.
     let mut stack = vec![Vec::new()];
 
     for run in runs {
         assert!(run.len() > 0);
-        assert!(stack.len() > 0);
+        assert!(!stack.is_empty());
 
         let start_class = original_classes[run.start];
         let end_class = original_classes[run.end - 1];
 
         let mut sequence = if start_class == PDI && stack.len() > 1 {
             // Continue a previous sequence interrupted by an isolate.
             stack.pop().unwrap()
         } else {
@@ -77,100 +78,96 @@ pub fn isolating_run_sequences(
             // Resume this sequence after the isolate.
             stack.push(sequence);
         } else {
             // This sequence is finished.
             sequences.push(sequence);
         }
     }
     // Pop any remaning sequences off the stack.
-    sequences.extend(stack.into_iter().rev().filter(|seq| seq.len() > 0));
+    sequences.extend(stack.into_iter().rev().filter(|seq| !seq.is_empty()));
 
     // Determine the `sos` and `eos` class for each sequence.
-    // http://www.unicode.org/reports/tr9/#X10
+    // <http://www.unicode.org/reports/tr9/#X10>
     sequences
         .into_iter()
-        .map(
-            |sequence: Vec<LevelRun>| {
-                assert!(!sequence.is_empty());
+        .map(|sequence: Vec<LevelRun>| {
+            assert!(!sequence.is_empty());
 
-                let start_of_seq = sequence[0].start;
-                let end_of_seq = sequence[sequence.len() - 1].end;
-                let seq_level = levels[start_of_seq];
+            let start_of_seq = sequence[0].start;
+            let end_of_seq = sequence[sequence.len() - 1].end;
+            let seq_level = levels[start_of_seq];
 
-                #[cfg(test)]
-                for run in sequence.clone() {
-                    for idx in run {
-                        if not_removed_by_x9(&original_classes[idx]) {
-                            assert_eq!(seq_level, levels[idx]);
-                        }
+            #[cfg(test)]
+            for run in sequence.clone() {
+                for idx in run {
+                    if not_removed_by_x9(&original_classes[idx]) {
+                        assert_eq!(seq_level, levels[idx]);
                     }
                 }
+            }
 
-                // Get the level of the last non-removed char before the runs.
-                let pred_level = match original_classes[..start_of_seq]
-                          .iter()
-                          .rposition(not_removed_by_x9) {
-                    Some(idx) => levels[idx],
-                    None => para_level,
-                };
+            // Get the level of the last non-removed char before the runs.
+            let pred_level = match original_classes[..start_of_seq].iter().rposition(
+                not_removed_by_x9,
+            ) {
+                Some(idx) => levels[idx],
+                None => para_level,
+            };
 
-                // Get the level of the next non-removed char after the runs.
-                let succ_level = if matches!(original_classes[end_of_seq - 1], RLI | LRI | FSI) {
-                    para_level
-                } else {
-                    match original_classes[end_of_seq..]
-                              .iter()
-                              .position(not_removed_by_x9) {
-                        Some(idx) => levels[end_of_seq + idx],
-                        None => para_level,
-                    }
-                };
+            // Get the level of the next non-removed char after the runs.
+            let succ_level = if matches!(original_classes[end_of_seq - 1], RLI | LRI | FSI) {
+                para_level
+            } else {
+                match original_classes[end_of_seq..].iter().position(
+                    not_removed_by_x9,
+                ) {
+                    Some(idx) => levels[end_of_seq + idx],
+                    None => para_level,
+                }
+            };
 
-                IsolatingRunSequence {
-                    runs: sequence,
-                    sos: max(seq_level, pred_level).bidi_class(),
-                    eos: max(seq_level, succ_level).bidi_class(),
-                }
+            IsolatingRunSequence {
+                runs: sequence,
+                sos: max(seq_level, pred_level).bidi_class(),
+                eos: max(seq_level, succ_level).bidi_class(),
             }
-        )
+        })
         .collect()
 }
 
 /// Finds the level runs in a paragraph.
 ///
-/// http://www.unicode.org/reports/tr9/#BD7
+/// <http://www.unicode.org/reports/tr9/#BD7>
 fn level_runs(levels: &[Level], original_classes: &[BidiClass]) -> Vec<LevelRun> {
-    assert!(levels.len() == original_classes.len());
+    assert_eq!(levels.len(), original_classes.len());
 
     let mut runs = Vec::new();
-    if levels.len() == 0 {
+    if levels.is_empty() {
         return runs;
     }
 
     let mut current_run_level = levels[0];
     let mut current_run_start = 0;
     for i in 1..levels.len() {
-        if !removed_by_x9(original_classes[i]) {
-            if levels[i] != current_run_level {
-                // End the last run and start a new one.
-                runs.push(current_run_start..i);
-                current_run_level = levels[i];
-                current_run_start = i;
-            }
+        if !removed_by_x9(original_classes[i]) && levels[i] != current_run_level {
+            // End the last run and start a new one.
+            runs.push(current_run_start..i);
+            current_run_level = levels[i];
+            current_run_start = i;
         }
     }
     runs.push(current_run_start..levels.len());
 
     runs
 }
 
 /// Should this character be ignored in steps after X9?
 ///
-/// http://www.unicode.org/reports/tr9/#X9
+/// <http://www.unicode.org/reports/tr9/#X9>
 pub fn removed_by_x9(class: BidiClass) -> bool {
     matches!(class, RLE | LRE | RLO | LRO | PDF | BN)
 }
 
 // For use as a predicate for `position` / `rposition`
 pub fn not_removed_by_x9(class: &BidiClass) -> bool {
     !removed_by_x9(*class)
 }
@@ -183,17 +180,17 @@ mod tests {
     fn test_level_runs() {
         assert_eq!(level_runs(&Level::vec(&[]), &[]), &[]);
         assert_eq!(
             level_runs(&Level::vec(&[0, 0, 0, 1, 1, 2, 0, 0]), &[L; 8]),
             &[0..3, 3..5, 5..6, 6..8]
         );
     }
 
-    // From http://www.unicode.org/reports/tr9/#BD13
+    // From <http://www.unicode.org/reports/tr9/#BD13>
     #[cfg_attr(rustfmt, rustfmt_skip)]
     #[test]
     fn test_isolating_run_sequences() {
 
         // == Example 1 ==
         // text1·RLE·text2·PDF·RLE·text3·PDF·text4
         // index        0    1  2    3    4  5    6  7
         let classes = &[L, RLE, L, PDF, RLE, L, PDF, L];
@@ -228,17 +225,17 @@ mod tests {
         let mut sequences = isolating_run_sequences(para_level, classes, &Level::vec(levels));
         sequences.sort_by(|a, b| a.runs[0].clone().cmp(b.runs[0].clone()));
         assert_eq!(
             sequences.iter().map(|s| s.runs.clone()).collect::<Vec<_>>(),
             vec![vec![0..2, 11..13], vec![2..4, 9..11], vec![4..6], vec![6..8], vec![8..9]]
         );
     }
 
-    // From http://www.unicode.org/reports/tr9/#X10
+    // From <http://www.unicode.org/reports/tr9/#X10>
     #[cfg_attr(rustfmt, rustfmt_skip)]
     #[test]
     fn test_isolating_run_sequences_sos_and_eos() {
 
         // == Example 1 ==
         // text1·RLE·text2·LRE·text3·PDF·text4·PDF·RLE·text5·PDF·text6
         // index        0    1  2    3  4    5  6    7    8  9   10  11
         let classes = &[L, RLE, L, LRE, L, PDF, L, PDF, RLE, L, PDF,  L];
copy from third_party/rust/unreachable/.cargo-checksum.json
copy to third_party/rust/unreachable-0.1.1/.cargo-checksum.json
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unreachable-0.1.1/.travis.yml
@@ -0,0 +1,19 @@
+language: rust
+sudo: false
+
+script:
+    - cargo build
+    - cargo test
+    - cargo bench --no-run
+    - cargo doc
+
+after_success:
+    - if [ "$TRAVIS_PULL_REQUEST" == false && test == "TRAVIS_BRANCH" == "master" ]; then
+    - curl https://raw.githubusercontent.com/reem/rust-gh-docs/master/make-docs.sh > docs.sh
+    - chmod u+x docs.sh
+    - ./docs.sh reem project-name
+
+env:
+  global:
+    secure: QPYL1XUr4CyK/2DXlsYC1eCpWRpyEiqQSd/FFVR+YdP/rOJ7AyAXQqPhfgjDBQwvc6E2fUiyYjoV/xe1a757DDeZKlgd8Lp20fSDwvNt/Ejx8ueh3h3kuOtgDpIGSKX/l+XC+ltDpzjhh7bowI2/fOEf+kE53jvu9i4PiLnKdlY=
+
copy from third_party/rust/unreachable/Cargo.toml
copy to third_party/rust/unreachable-0.1.1/Cargo.toml
copy from third_party/rust/unreachable/README.md
copy to third_party/rust/unreachable-0.1.1/README.md
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unreachable-0.1.1/src/lib.rs
@@ -0,0 +1,77 @@
+#![cfg_attr(test, deny(warnings))]
+#![deny(missing_docs)]
+
+//! # unreachable
+//!
+//! An unreachable code optimization hint in stable rust, and some useful
+//! extension traits for `Option` and `Result`.
+//!
+
+#![no_std]
+
+extern crate void;
+
+use core::mem;
+
+/// Hint to the optimizer that any code path which calls this function is
+/// statically unreachable and can be removed.
+///
+/// Calling this function in reachable code invokes undefined behavior. Be
+/// very, very sure this is what you want; often, a simple `panic!` is more
+/// suitable.
+#[inline]
+pub unsafe fn unreachable() -> ! {
+    let x: &void::Void = mem::transmute(1usize);
+    void::unreachable(*x)
+}
+
+/// An extension trait for `Option<T>` providing unchecked unwrapping methods.
+pub trait UncheckedOptionExt<T> {
+    /// Get the value out of this Option without checking for None.
+    unsafe fn unchecked_unwrap(self) -> T;
+
+    /// Assert that this Option is a None to the optimizer.
+    unsafe fn unchecked_unwrap_none(self);
+}
+
+/// An extension trait for `Result<T, E>` providing unchecked unwrapping methods.
+pub trait UncheckedResultExt<T, E> {
+    /// Get the value out of this Result without checking for Err.
+    unsafe fn unchecked_unwrap_ok(self) -> T;
+
+    /// Get the error out of this Result without checking for Ok.
+    unsafe fn unchecked_unwrap_err(self) -> E;
+}
+
+impl<T> UncheckedOptionExt<T> for Option<T> {
+    unsafe fn unchecked_unwrap(self) -> T {
+        match self {
+            Some(x) => x,
+            None => unreachable()
+        }
+    }
+
+    unsafe fn unchecked_unwrap_none(self) {
+        match self {
+            Some(_) => unreachable(),
+            None => ()
+        }
+    }
+}
+
+impl<T, E> UncheckedResultExt<T, E> for Result<T, E> {
+    unsafe fn unchecked_unwrap_ok(self) -> T {
+        match self {
+            Ok(x) => x,
+            Err(_) => unreachable()
+        }
+    }
+
+    unsafe fn unchecked_unwrap_err(self) -> E {
+        match self {
+            Ok(_) => unreachable(),
+            Err(e) => e
+        }
+    }
+}
+
--- a/third_party/rust/unreachable/.cargo-checksum.json
+++ b/third_party/rust/unreachable/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"180cc837b1ea2ce0ed737c2e15208e83abf6f92291a77ed1ebcc564c628c2077","Cargo.toml":"cc09349f0610a327f3562a4c44b9c3889e5a9bf43c290ce436bfb98a4e66b0ed","README.md":"447088161e4b8c6060ae830d41ba2adf3cac2dbd8b1195c618b062878832be82","src/lib.rs":"2cb4bbb6a0c7058e49f5bbc0c1e2f208b5374cf70c495813401a357f9dfad188"},"package":"1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"}
\ No newline at end of file
+{"files":{".travis.yml":"180cc837b1ea2ce0ed737c2e15208e83abf6f92291a77ed1ebcc564c628c2077","Cargo.toml":"9347536f7400ac984522823ce009af0c6c8daca66a51715b653b6ec98436967d","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"9a5633009ff51b0a74dd81f7576fce531fea6097cd377867f6ce445617b6fa78","README.md":"bd81710532521de9e3eaf29c1b4a6e17ef0c169c6fe5e43f03dd463babae3f50","src/lib.rs":"2cb4bbb6a0c7058e49f5bbc0c1e2f208b5374cf70c495813401a357f9dfad188"},"package":"382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"}
\ No newline at end of file
--- a/third_party/rust/unreachable/Cargo.toml
+++ b/third_party/rust/unreachable/Cargo.toml
@@ -1,13 +1,13 @@
 [package]
 
 name = "unreachable"
-version = "0.1.1"
+version = "1.0.0"
 authors = ["Jonathan Reem <jonathan.reem@gmail.com>"]
 repository = "https://github.com/reem/rust-unreachable.git"
 description = "An unreachable code optimization hint in stable rust."
 readme = "README.md"
-license = "MIT"
+license = "MIT / Apache-2.0"
 
 [dependencies.void]
 version = "1"
 default-features = false
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unreachable/LICENSE-APACHE
@@ -0,0 +1,202 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
new file mode 100644
--- /dev/null
+++ b/third_party/rust/unreachable/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) 2015 The rust-unreachable Developers
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- a/third_party/rust/unreachable/README.md
+++ b/third_party/rust/unreachable/README.md
@@ -15,10 +15,21 @@ unreachable = "0.1"
 ```
 
 ## Author
 
 [Jonathan Reem](https://medium.com/@jreem) is the primary author and maintainer of unreachable.
 
 ## License
 
-MIT
+Licensed under either of
+
+ * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
+
+at your option.
 
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally
+submitted for inclusion in the work by you, as defined in the Apache-2.0
+license, shall be dual licensed as above, without any additional terms or
+conditions.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/version_check/.cargo-checksum.json
@@ -0,0 +1,1 @@
+{"files":{"Cargo.toml":"dad6a4a872650afdecb540fa006f1a62527578ae2c7460e41ea6fd553dd317d4","LICENSE":"ce1f970284c4ab06e90671a984086692dc44da3e2b8ee86444d79b6f77bcf9e7","README.md":"27659fafbe25cb1a91dcfe30c6fd8c001ef9faea08b241f644b0b701e5ff3835","src/lib.rs":"8d73765fea27c9171502c57707801b4afd3fd355cad087a84f523677d2444978"},"package":"6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/third_party/rust/version_check/Cargo.toml
@@ -0,0 +1,24 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "version_check"
+version = "0.1.3"
+authors = ["Sergio Benitez <sb@sergio.bz>"]
+description = "Tiny crate to check the version of the installed/running rustc."
+documentation = "https://docs.rs/version_check/"
+readme = "README.md"
+keywords = ["version", "rustc", "minimum", "check"]
+license = "MIT"
+repository = "https://github.com/SergioBenitez/version_check"
+
+[dependencies]
new file mode 100644
--- /dev/null
+++ b/third_party/rust/version_check/LICENSE
@@ -0,0 +1,19 @@
+The MIT License (MIT)
+Copyright (c) 2017 Sergio Benitez
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
new file mode 100644
--- /dev/null
+++ b/third_party/rust/version_check/README.md
@@ -0,0 +1,64 @@
+# version\_check
+
+This tiny crate checks that the running or installed `rustc` meets some version
+requirements. The version is queried by calling the Rust compiler with
+`--version`. The path to the compiler is determined first via the `RUSTC`
+environment variable. If it is not set, then `rustc` is used. If that fails, no
+determination is made, and calls return `None`.
+
+## Usage
+
+Add to your `Cargo.toml` file:
+
+```toml
+[dependencies]
+version_check = "0.1"
+```
+
+## Examples
+
+Check that the running compiler is a nightly release:
+
+```rust
+extern crate version_check;
+
+match version_check::is_nightly() {
+    Some(true) => "running a nightly",
+    Some(false) => "not nightly",
+    None => "couldn't figure it out"
+};
+```
+
+Check that the running compiler is at least version `1.13.0`:
+
+```rust
+extern crate version_check;
+
+match version_check::is_min_version("1.13.0") {
+    Some((true, version)) => format!("Yes! It's: {}", version),
+    Some((false, version)) => format!("No! {} is too old!", version),
+    None => "couldn't figure it out".into()
+};
+```
+
+Check that the running compiler was released on or after `2016-12-18`:
+
+```rust
+extern crate version_check;
+
+match version_check::is_min_date("2016-12-18") {
+    Some((true, date)) => format!("Yes! It's: {}", date),
+    Some((false, date)) => format!("No! {} is too long ago!", date),
+    None => "couldn't figure it out".into()
+};
+```
+
+## Alternatives
+
+This crate is dead simple with no dependencies. If you need something more and
+don't care about panicking if the version cannot be obtained or adding
+dependencies, see [rustc_version](https://crates.io/crates/rustc_version).
+
+## License
+
+MIT. Have fun!
new file mode 100644
--- /dev/null
+++ b/third_party/rust/version_check/src/lib.rs
@@ -0,0 +1,246 @@
+//! This tiny crate checks that the running or installed `rustc` meets some
+//! version requirements. The version is queried by calling the Rust compiler
+//! with `--version`. The path to the compiler is determined first via the
+//! `RUSTC` environment variable. If it is not set, then `rustc` is used. If
+//! that fails, no determination is made, and calls return `None`.
+//!
+//! # Example
+//!
+//! Check that the running compiler is a nightly release:
+//!
+//! ```rust
+//! extern crate version_check;
+//!
+//! match version_check::is_nightly() {
+//!     Some(true) => "running a nightly",
+//!     Some(false) => "not nightly",
+//!     None => "couldn't figure it out"
+//! };
+//! ```
+//!
+//! Check that the running compiler is at least version `1.13.0`:
+//!
+//! ```rust
+//! extern crate version_check;
+//!
+//! match version_check::is_min_version("1.13.0") {
+//!     Some((true, version)) => format!("Yes! It's: {}", version),
+//!     Some((false, version)) => format!("No! {} is too old!", version),
+//!     None => "couldn't figure it out".into()
+//! };
+//! ```
+//!
+//! Check that the running compiler was released on or after `2016-12-18`:
+//!
+//! ```rust
+//! extern crate version_check;
+//!
+//! match version_check::is_min_date("2016-12-18") {
+//!     Some((true, date)) => format!("Yes! It's: {}", date),
+//!     Some((false, date)) => format!("No! {} is too long ago!", date),
+//!     None => "couldn't figure it out".into()
+//! };
+//! ```
+//!
+//! # Alternatives
+//!
+//! This crate is dead simple with no dependencies. If you need something more
+//! and don't care about panicking if the version cannot be obtained or adding
+//! dependencies, see [rustc_version](https://crates.io/crates/rustc_version).
+
+use std::env;
+use std::process::Command;
+
+// Convert a string of %Y-%m-%d to a single u32 maintaining ordering.
+fn str_to_ymd(ymd: &str) -> Option<u32> {
+    let ymd: Vec<u32> = ymd.split("-").filter_map(|s| s.parse::<u32>().ok()).collect();
+    if ymd.len() != 3 {
+        return None
+    }
+
+    let (y, m, d) = (ymd[0], ymd[1], ymd[2]);
+    Some((y << 9) | (m << 5) | d)
+}
+
+// Convert a string with prefix major-minor-patch to a single u64 maintaining
+// ordering. Assumes none of the components are > 1048576.
+fn str_to_mmp(mmp: &str) -> Option<u64> {
+    let mut mmp: Vec<u16> = mmp.split('-')
+        .nth(0)
+        .unwrap_or("")
+        .split('.')
+        .filter_map(|s| s.parse::<u16>().ok())
+        .collect();
+
+    if mmp.is_empty() {
+        return None
+    }
+
+    while mmp.len() < 3 {
+        mmp.push(0);
+    }
+
+    let (maj, min, patch) = (mmp[0] as u64, mmp[1] as u64, mmp[2] as u64);
+    Some((maj << 32) | (min << 16) | patch)
+}
+
+/// Returns (version, date) as available.
+fn version_and_date_from_rustc_version(s: &str) -> (Option<String>, Option<String>) {
+    let mut components = s.split(" ");
+    let version = components.nth(1);
+    let date = components.nth(1).map(|s| s.trim_right().trim_right_matches(")"));
+    (version.map(|s| s.to_string()), date.map(|s| s.to_string()))
+}
+
+/// Returns (version, date) as available.
+fn get_version_and_date() -> Option<(Option<String>, Option<String>)> {
+    env::var("RUSTC").ok()
+        .and_then(|rustc| Command::new(rustc).arg("--version").output().ok())
+        .or_else(|| Command::new("rustc").arg("--version").output().ok())
+        .and_then(|output| String::from_utf8(output.stdout).ok())
+        .map(|s| version_and_date_from_rustc_version(&s))
+}
+
+/// Checks that the running or installed `rustc` was released no earlier than
+/// some date.
+///
+/// The format of `min_date` must be YYYY-MM-DD. For instance: `2016-12-20` or
+/// `2017-01-09`.
+///
+/// If the date cannot be retrieved or parsed, or if `min_date` could not be
+/// parsed, returns `None`. Otherwise returns a tuple where the first value is
+/// `true` if the installed `rustc` is at least from `min_data` and the second
+/// value is the date (in YYYY-MM-DD) of the installed `rustc`.
+pub fn is_min_date(min_date: &str) -> Option<(bool, String)> {
+    if let Some((_, Some(actual_date_str))) = get_version_and_date() {
+        str_to_ymd(&actual_date_str)
+            .and_then(|actual| str_to_ymd(min_date).map(|min| (min, actual)))
+            .map(|(min, actual)| (actual >= min, actual_date_str))
+    } else {
+        None
+    }
+}
+
+/// Checks that the running or installed `rustc` is at least some minimum
+/// version.
+///
+/// The format of `min_version` is a semantic version: `1.3.0`, `1.15.0-beta`,
+/// `1.14.0`, `1.16.0-nightly`, etc.
+///
+/// If the version cannot be retrieved or parsed, or if `min_version` could not
+/// be parsed, returns `None`. Otherwise returns a tuple where the first value
+/// is `true` if the installed `rustc` is at least `min_version` and the second
+/// value is the version (semantic) of the installed `rustc`.
+pub fn is_min_version(min_version: &str) -> Option<(bool, String)> {
+    if let Some((Some(actual_version_str), _)) = get_version_and_date() {
+        str_to_mmp(&actual_version_str)
+            .and_then(|actual| str_to_mmp(min_version).map(|min| (min, actual)))
+            .map(|(min, actual)| (actual >= min, actual_version_str))
+    } else {
+        None
+    }
+}
+
+fn version_channel_is(channel: &str) -> Option<bool> {
+    get_version_and_date()
+        .and_then(|(version_str_opt, _)|  version_str_opt)
+        .map(|version_str| version_str.contains(channel))
+}
+
+/// Determines whether the running or installed `rustc` is on the nightly
+/// channel.
+///
+/// If the version could not be determined, returns `None`. Otherwise returns
+/// `Some(true)` if the running version is a nightly release, and `Some(false)`
+/// otherwise.
+pub fn is_nightly() -> Option<bool> {
+    version_channel_is("nightly")
+}
+
+/// Determines whether the running or installed `rustc` is on the beta channel.
+///
+/// If the version could not be determined, returns `None`. Otherwise returns
+/// `Some(true)` if the running version is a beta release, and `Some(false)`
+/// otherwise.
+pub fn is_beta() -> Option<bool> {
+    version_channel_is("beta")
+}
+
+/// Determines whether the running or installed `rustc` is on the dev channel.
+///
+/// If the version could not be determined, returns `None`. Otherwise returns
+/// `Some(true)` if the running version is a dev release, and `Some(false)`
+/// otherwise.
+pub fn is_dev() -> Option<bool> {
+    version_channel_is("dev")
+}
+
+/// Determines whether the running or installed `rustc` supports feature flags.
+/// In other words, if the channel is either "nightly" or "dev".
+///
+/// If the version could not be determined, returns `None`. Otherwise returns
+/// `Some(true)` if the running version supports features, and `Some(false)`
+/// otherwise.
+pub fn supports_features() -> Option<bool> {
+    match is_nightly() {
+        b@Some(true) => b,
+        _ => is_dev()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::version_and_date_from_rustc_version;
+    use super::str_to_mmp;
+
+    macro_rules! check_mmp {
+        ($string:expr => ($x:expr, $y:expr, $z:expr)) => (
+            if let Some(mmp) = str_to_mmp($string) {
+                let expected = $x << 32 | $y << 16 | $z;
+                if mmp != expected {
+                    panic!("{} didn't parse as {}.{}.{}.", $string, $x, $y, $z);
+                }
+            } else {
+                panic!("{} didn't parse for mmp testing.", $string);
+            }
+        )
+    }
+
+    macro_rules! check_version {
+        ($s:expr => ($x:expr, $y:expr, $z:expr)) => (
+            if let (Some(version_str), _) = version_and_date_from_rustc_version($s) {
+                check_mmp!(&version_str => ($x, $y, $z));
+            } else {
+                panic!("{} didn't parse for version testing.", $s);
+            }
+        )
+    }
+
+    #[test]
+    fn test_str_to_mmp() {
+        check_mmp!("1.18.0" => (1, 18, 0));
+        check_mmp!("1.19.0" => (1, 19, 0));
+        check_mmp!("1.19.0-nightly" => (1, 19, 0));
+        check_mmp!("1.12.2349" => (1, 12, 2349));
+        check_mmp!("0.12" => (0, 12, 0));
+        check_mmp!("1.12.5" => (1, 12, 5));
+        check_mmp!("1.12" => (1, 12, 0));
+        check_mmp!("1" => (1, 0, 0));
+    }
+
+    #[test]
+    fn test_version_parse() {
+        check_version!("rustc 1.18.0" => (1, 18, 0));
+        check_version!("rustc 1.8.0" => (1, 8, 0));
+        check_version!("rustc 1.20.0-nightly" => (1, 20, 0));
+        check_version!("rustc 1.20" => (1, 20, 0));
+        check_version!("rustc 1.3" => (1, 3, 0));
+        check_version!("rustc 1" => (1, 0, 0));
+        check_version!("rustc 1.2.5.6" => (1, 2, 5));
+        check_version!("rustc 1.5.1-beta" => (1, 5, 1));
+        check_version!("rustc 1.20.0-nightly (d84693b93 2017-07-09)" => (1, 20, 0));
+        check_version!("rustc 1.20.0 (d84693b93 2017-07-09)" => (1, 20, 0));
+        check_version!("rustc 1.20.0 (2017-07-09)" => (1, 20, 0));
+        check_version!("rustc 1.20.0-dev (2017-07-09)" => (1, 20, 0));
+    }
+}