diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2019-02-10 09:29:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-10 09:29:10 -0500 |
commit | 57cb5fe1f29f53aad5d2e05cf86b40bcbe23b45a (patch) | |
tree | b627ce5a576b436bcc8720979b11ad4574e7a211 /pkgs/development/tools | |
parent | 64edccb463432a937f00943db22a8cd36245ec27 (diff) | |
parent | f470720aa8aa86c034eecb210b70fb0dc470e9a1 (diff) | |
download | nixlib-57cb5fe1f29f53aad5d2e05cf86b40bcbe23b45a.tar nixlib-57cb5fe1f29f53aad5d2e05cf86b40bcbe23b45a.tar.gz nixlib-57cb5fe1f29f53aad5d2e05cf86b40bcbe23b45a.tar.bz2 nixlib-57cb5fe1f29f53aad5d2e05cf86b40bcbe23b45a.tar.lz nixlib-57cb5fe1f29f53aad5d2e05cf86b40bcbe23b45a.tar.xz nixlib-57cb5fe1f29f53aad5d2e05cf86b40bcbe23b45a.tar.zst nixlib-57cb5fe1f29f53aad5d2e05cf86b40bcbe23b45a.zip |
Merge pull request #55519 from FlorianFranzen/staging
Staging
Diffstat (limited to 'pkgs/development/tools')
17 files changed, 1351 insertions, 357 deletions
diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh index f095103ee044..c21e10bb0616 100755 --- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh +++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh @@ -75,6 +75,13 @@ cmakeConfigurePhase() { # And build always Release, to ensure optimisation flags cmakeFlags="-DCMAKE_BUILD_TYPE=${cmakeBuildType:-Release} -DCMAKE_SKIP_BUILD_RPATH=ON $cmakeFlags" + # Disable user package registry to avoid potential side effects + # and unecessary attempts to access non-existent home folder + # https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#disabling-the-package-registry + cmakeFlags="-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON $cmakeFlags" + cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON $cmakeFlags" + cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON $cmakeFlags" + if [ "$buildPhase" = ninjaBuildPhase ]; then cmakeFlags="-GNinja $cmakeFlags" fi diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix index 96e044073259..3651884253ad 100644 --- a/pkgs/development/tools/build-managers/meson/default.nix +++ b/pkgs/development/tools/build-managers/meson/default.nix @@ -1,12 +1,12 @@ { lib, python3Packages, stdenv, writeTextDir, substituteAll, targetPackages }: python3Packages.buildPythonApplication rec { - version = "0.49.0"; + version = "0.49.1"; pname = "meson"; src = python3Packages.fetchPypi { inherit pname version; - sha256 = "0895igla1qav8k250z2qv03a0fg491wzzkfpbk50wwq848vmbkd0"; + sha256 = "05wr4kn88aqq2cbzqx59zj56410c9d42wracb4cjs70mvq0lp50s"; }; postFixup = '' diff --git a/pkgs/development/tools/build-managers/ninja/default.nix b/pkgs/development/tools/build-managers/ninja/default.nix index e70291ce51a5..8cce2b88317d 100644 --- a/pkgs/development/tools/build-managers/ninja/default.nix +++ b/pkgs/development/tools/build-managers/ninja/default.nix @@ -1,18 +1,27 @@ -{ stdenv, fetchFromGitHub, python, buildDocs ? true, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxslt, re2c }: +{ stdenv, fetchFromGitHub, fetchpatch, python, buildDocs ? true, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxslt, re2c }: with stdenv.lib; stdenv.mkDerivation rec { name = "ninja-${version}"; - version = "1.8.2"; + version = "1.9.0"; src = fetchFromGitHub { owner = "ninja-build"; repo = "ninja"; rev = "v${version}"; - sha256 = "16scq9hcq6c5ap6sy8j4qi75qps1zvrf3p79j1vbrvnqzp928i5f"; + sha256 = "1q0nld3g0d210zmdjyjzjz2xb2bw1s58gj6zsx7p8q30yh0wg610"; }; + patches = [ + # Make builds reproducible by generating the same IDs from the same inputs. + (fetchpatch { + name = "consistent-doc-ids"; + url = "https://github.com/ninja-build/ninja/commit/9aa947471fcfc607bec6d92a1a6eed5c692edbaf.patch"; + sha256 = "0zsg46jflsh644jccrcgyfalr7fkzrv041kyi8644nyk923gcrl9"; + }) + ]; + nativeBuildInputs = [ python re2c ] ++ optionals buildDocs [ asciidoc docbook_xml_dtd_45 docbook_xsl libxslt.bin ]; buildPhase = '' diff --git a/pkgs/development/tools/build-managers/rebar3/default.nix b/pkgs/development/tools/build-managers/rebar3/default.nix index e96852602fc7..6d64c82f90ff 100644 --- a/pkgs/development/tools/build-managers/rebar3/default.nix +++ b/pkgs/development/tools/build-managers/rebar3/default.nix @@ -1,46 +1,46 @@ { stdenv, fetchurl, - fetchHex, erlang, hermeticRebar3 ? true, + fetchHex, erlang, tree, hexRegistrySnapshot }: let - version = "3.6.1"; + version = "3.9.0"; bootstrapper = ./rebar3-nix-bootstrap; erlware_commons = fetchHex { pkg = "erlware_commons"; - version = "1.2.0"; - sha256 = "149kkn9gc9cjgvlmakygq475r63q2rry31s29ax0s425dh37sfl7"; + version = "1.3.1"; + sha256 = "7aada93f368d0a0430122e39931b7fb4ac9e94dbf043cdc980ad4330fd9cd166"; }; ssl_verify_fun = fetchHex { pkg = "ssl_verify_fun"; version = "1.1.3"; - sha256 = "1zljxashfhqmiscmf298vhr880ppwbgi2rl3nbnyvsfn0mjhw4if"; + sha256 = "2e120e6505d6e9ededb2836611dfe2f7028432dc280957998e154307b5ea92fe"; }; certifi = fetchHex { pkg = "certifi"; - version = "2.0.0"; - sha256 = "075v7cvny52jbhnskchd3fp68fxgp7qfvdls0haamcycxrn0dipx"; + version = "2.3.1"; + sha256 = "e12d667d042c11d130594bae2b0097e63836fe8b1e6d6b2cc48f8bb7a2cf7d68"; }; providers = fetchHex { pkg = "providers"; version = "1.7.0"; - sha256 = "19p4rbsdx9lm2ihgvlhxyld1q76kxpd7qwyqxxsgmhl5r8ln3rlb"; + sha256 = "8be66129ca85c2fa74efd8737cdaedd31c1c1af51dd2fd601495a6def4cae4a6"; }; getopt = fetchHex { pkg = "getopt"; version = "1.0.1"; - sha256 = "174mb46c2qd1f4a7507fng4vvscjh1ds7rykfab5rdnfp61spqak"; + sha256 = "53e1ab83b9ceb65c9672d3e7a35b8092e9bdc9b3ee80721471a161c10c59959c"; }; bbmustache = fetchHex { pkg = "bbmustache"; - version = "1.5.0"; - sha256 = "0xg3r4lxhqifrv32nm55b4zmkflacc1s964g15p6y6jfx6v4y1zd"; + version = "1.6.0"; + sha256 = "53e02d296512a57be03a98c91541b34d2ca64930268030b2d12364a0332015df"; }; relx = fetchHex { pkg = "relx"; - version = "3.26.0"; - sha256 = "1f810rb01kdidpa985s321ycg3y4hvqpzbk263n6i1bfnqykkvv9"; + version = "3.28.0"; + sha256 = "8afb871c0a2a27f0063d973903fc64d2207bc705ecc3607462920683d24ac7b5"; }; cf = fetchHex { pkg = "cf"; @@ -49,59 +49,71 @@ let }; cth_readable = fetchHex { pkg = "cth_readable"; - version = "1.4.2"; - sha256 = "1pjid4f60pp81ds01rqa6ybksrnzqriw3aibilld1asn9iabxkav"; + version = "1.4.3"; + sha256 = "0wr0hba6ka74s3628jrrd7ynjdh7syxigkh7ildg8fgi20ab88fd"; }; eunit_formatters = fetchHex { pkg = "eunit_formatters"; version = "0.5.0"; sha256 = "1jb3hzb216r29x2h4pcjwfmx1k81431rgh5v0mp4x5146hhvmj6n"; }; - rebar3_hex = fetchHex { - pkg = "rebar3_hex"; - version = "4.0.0"; - sha256 = "0k0ykx1lz62r03dpbi2zxsvrxgnr5hj67yky0hjrls09ynk4682v"; + hex_core = fetchHex { + pkg = "hex_core"; + version = "0.4.0"; + sha256 = "8ace8c6cfa10df4cb8be876f42f7446890e124203c094cc7b4e7616fb8de5d7f"; + }; + parse_trans = fetchHex { + pkg = "parse_trans"; + version = "3.3.0"; + sha256 = "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"; }; in stdenv.mkDerivation { name = "rebar3-${version}"; - inherit version; + inherit version erlang; src = fetchurl { url = "https://github.com/rebar/rebar3/archive/${version}.tar.gz"; - sha256 = "0cqhqymzh10pfyxqiy4hcg3d2myz3chx0y4m2ixmq8zk81acics0"; + sha256 = "14prx5bkyy9sisnp5rj2058xpylq80xygsj1hq8b7m0awvj3r9wy"; }; inherit bootstrapper; - patches = if hermeticRebar3 == true - then [ ./hermetic-rebar3.patch ] - else []; + buildInputs = [ erlang tree ]; - buildInputs = [ erlang tree ]; + # TODO: Remove registry snapshot propagatedBuildInputs = [ hexRegistrySnapshot ]; postPatch = '' ${erlang}/bin/escript ${bootstrapper} registry-only + mkdir -p _checkouts mkdir -p _build/default/lib/ - mkdir -p _build/default/plugins - cp --no-preserve=mode -R ${erlware_commons} _build/default/lib/erlware_commons - cp --no-preserve=mode -R ${providers} _build/default/lib/providers - cp --no-preserve=mode -R ${getopt} _build/default/lib/getopt - cp --no-preserve=mode -R ${bbmustache} _build/default/lib/bbmustache - cp --no-preserve=mode -R ${certifi} _build/default/lib/certifi - cp --no-preserve=mode -R ${cf} _build/default/lib/cf - cp --no-preserve=mode -R ${cth_readable} _build/default/lib/cth_readable - cp --no-preserve=mode -R ${eunit_formatters} _build/default/lib/eunit_formatters - cp --no-preserve=mode -R ${relx} _build/default/lib/relx - cp --no-preserve=mode -R ${ssl_verify_fun} _build/default/lib/ssl_verify_fun - cp --no-preserve=mode -R ${rebar3_hex} _build/default/plugins/rebar3_hex + + cp --no-preserve=mode -R ${erlware_commons} _checkouts/erlware_commons + cp --no-preserve=mode -R ${providers} _checkouts/providers + cp --no-preserve=mode -R ${getopt} _checkouts/getopt + cp --no-preserve=mode -R ${bbmustache} _checkouts/bbmustache + cp --no-preserve=mode -R ${certifi} _checkouts/certifi + cp --no-preserve=mode -R ${cf} _checkouts/cf + cp --no-preserve=mode -R ${cth_readable} _checkouts/cth_readable + cp --no-preserve=mode -R ${eunit_formatters} _checkouts/eunit_formatters + cp --no-preserve=mode -R ${relx} _checkouts/relx + cp --no-preserve=mode -R ${ssl_verify_fun} _checkouts/ssl_verify_fun + cp --no-preserve=mode -R ${hex_core} _checkouts/hex_core + cp --no-preserve=mode -R ${parse_trans} _checkouts/parse_trans + + # Bootstrap script expects the dependencies in _build/default/lib + # TODO: Make it accept checkouts? + for i in _checkouts/* ; do + ln -s $(pwd)/$i $(pwd)/_build/default/lib/ + done ''; buildPhase = '' HOME=. escript bootstrap ''; + installPhase = '' mkdir -p $out/bin cp rebar3 $out/bin/rebar3 @@ -109,7 +121,7 @@ stdenv.mkDerivation { meta = { homepage = https://github.com/rebar/rebar3; - description = "rebar 3.0 is an Erlang build tool that makes it easy to compile and test Erlang applications, port drivers and releases"; + description = "rebar 3 is an Erlang build tool that makes it easy to compile and test Erlang applications, port drivers and releases"; longDescription = '' rebar is a self-contained Erlang script, so it's easy to distribute or diff --git a/pkgs/development/tools/build-managers/rebar3/hermetic-rebar3.patch b/pkgs/development/tools/build-managers/rebar3/hermetic-rebar3.patch deleted file mode 100644 index 59004561126c..000000000000 --- a/pkgs/development/tools/build-managers/rebar3/hermetic-rebar3.patch +++ /dev/null @@ -1,103 +0,0 @@ -diff --git a/bootstrap b/bootstrap -index 5dedd713..864056c4 100755 ---- a/bootstrap -+++ b/bootstrap -@@ -101,7 +101,7 @@ extract(Binary) -> - request(Url) -> - HttpOptions = [{relaxed, true} | get_proxy_auth()], - -- case httpc:request(get, {Url, []}, -+ case rebar_hermeticity:request(get, {Url, []}, - HttpOptions, - [{body_format, binary}], - rebar) of -diff --git a/src/rebar_hermeticity.erl b/src/rebar_hermeticity.erl -index e69de29b..8f6cc7d0 100644 ---- a/src/rebar_hermeticity.erl -+++ b/src/rebar_hermeticity.erl -@@ -0,0 +1,42 @@ -+%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- -+%% ex: ts=4 sw=4 et -+%% ------------------------------------------------------------------- -+%% -+%% rebar: Erlang Build Tools -+%% -+%% Copyright (c) 2016 Eric Merritt (eric@merritt.tech) -+%% -+%% 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. -+%% ------------------------------------------------------------------- -+-module(rebar_hermeticity). -+ -+-export([request/5]). -+ -+-include("rebar.hrl"). -+ -+%% ==================================================================== -+%% Public API -+%% ==================================================================== -+ -+request(Method, {Url, _Headers}, _HTTPOptions, _Options, _Profile) -> -+ ?ERROR("A request is being made that violates Nix hermicity " -+ "This request has been stopped. Details of the request " -+ "are as follows:", []), -+ ?ERROR("Request: ~p ~s", [Method, Url]), -+ erlang:halt(1). -diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl -index 2cf167ee..6080aaca 100644 ---- a/src/rebar_pkg_resource.erl -+++ b/src/rebar_pkg_resource.erl -@@ -127,7 +127,7 @@ make_vsn(_) -> - request(Url, ETag) -> - HttpOptions = [{ssl, ssl_opts(Url)}, - {relaxed, true} | rebar_utils:get_proxy_auth()], -- case httpc:request(get, {Url, [{"if-none-match", "\"" ++ ETag ++ "\""} -+ case rebar_hermeticity:request(get, {Url, [{"if-none-match", "\"" ++ ETag ++ "\""} - || ETag =/= false] ++ - [{"User-Agent", rebar_utils:user_agent()}]}, - HttpOptions, [{body_format, binary}], rebar) of -diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl -index 17446311..4d44d794 100644 ---- a/src/rebar_prv_update.erl -+++ b/src/rebar_prv_update.erl -@@ -38,6 +38,8 @@ init(State) -> - {ok, State1}. - - -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. -+do(State) -> {ok, State}. -+-ifdef(non_hermetic). - do(State) -> - try - case rebar_packages:registry_dir(State) of -@@ -53,7 +55,7 @@ do(State) -> - {ok, Url} -> - HttpOptions = [{relaxed, true} | rebar_utils:get_proxy_auth()], - ?DEBUG("Fetching registry from ~p", [Url]), -- case httpc:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]}, -+ case rebar_hermeticity:request(get, {Url, [{"User-Agent", rebar_utils:user_agent()}]}, - HttpOptions, [{stream, TmpFile}, {sync, true}], - rebar) of - {ok, saved_to_file} -> -@@ -77,6 +79,7 @@ do(State) -> - ?DEBUG("Error creating package index: ~p ~p", [C, S]), - throw(?PRV_ERROR(package_index_write)) - end. -+-endif. - - -spec format_error(any()) -> iolist(). - format_error({package_parse_cdn, Uri}) -> diff --git a/pkgs/development/tools/erlang/hex2nix/default.nix b/pkgs/development/tools/erlang/hex2nix/default.nix index e21749f90d02..5a24c3c95256 100644 --- a/pkgs/development/tools/erlang/hex2nix/default.nix +++ b/pkgs/development/tools/erlang/hex2nix/default.nix @@ -1,29 +1,21 @@ -{ fetchFromGitHub, buildRebar3, +{ fetchFromGitHub, fetchRebar3Deps, rebar3Relx }: - # Erlang dependencies: - ibrowse_4_2_2, - getopt_0_8_2, - erlware_commons_1_0_0, - jsx_2_8_0 }: - -buildRebar3 rec { +rebar3Relx rec { name = "hex2nix"; version = "0.0.6-a31eadd7"; + releaseType = "escript"; + + checkouts = fetchRebar3Deps { + inherit name version; + src = "${src}/rebar.config"; + sha256 = "1b59vk6ynakdiwqd1s6axaj9bvkaaq7ll28b48nv613z892h7nm5"; + }; + src = fetchFromGitHub { owner = "erlang-nix"; repo = "hex2nix"; rev = "a31eadd7af2cbdac1b87991b378e98ea4fb40ae0"; sha256 = "1hnkrksyrbpq2gq25rfsrnm86n0g3biab88gswm3zj88ddrz6dyk"; }; - - beamDeps = [ ibrowse_4_2_2 jsx_2_8_0 erlware_commons_1_0_0 getopt_0_8_2 ]; - - enableDebugInfo = true; - - installPhase = '' - runHook preInstall - make PREFIX=$out install - runHook postInstall - ''; - } +} diff --git a/pkgs/development/tools/erlang/relx-exe/default.nix b/pkgs/development/tools/erlang/relx-exe/default.nix index 9bbdc8c8334d..2c32cc5c6706 100644 --- a/pkgs/development/tools/erlang/relx-exe/default.nix +++ b/pkgs/development/tools/erlang/relx-exe/default.nix @@ -1,49 +1,19 @@ -{ stdenv, buildHex +{ stdenv, fetchHex, fetchRebar3Deps, rebar3Relx }: -, getopt_0_8_2, erlware_commons_1_0_0, cf_0_2_2 }: - -let - providers_1_6_0 = buildHex { - name = "providers"; - version = "1.6.0"; - sha256 = "0byfa1h57n46jilz4q132j0vk3iqc0v1vip89li38gb1k997cs0g"; - beamDeps = [ getopt_0_8_2 ]; - }; - bbmustache_1_0_4 = buildHex { - name = "bbmustache"; - version = "1.0.4"; - sha256 = "04lvwm7f78x8bys0js33higswjkyimbygp4n72cxz1kfnryx9c03"; - }; - -in -buildHex rec { +rebar3Relx rec { name = "relx-exe"; version = "3.23.1"; - hexPkg = "relx"; - sha256 = "13j7wds2d7b8v3r9pwy3zhwhzywgwhn6l9gm3slqzyrs1jld0a9d"; + releaseType = "escript"; - beamDeps = [ - providers_1_6_0 - getopt_0_8_2 - erlware_commons_1_0_0 - cf_0_2_2 - bbmustache_1_0_4 - ]; - - postBuild = '' - HOME=. rebar3 escriptize - ''; - - postInstall = '' - mkdir -p "$out/bin" - cp -r "_build/default/bin/relx" "$out/bin/relx" - ''; - - meta = { - description = "Executable command for Relx"; - license = stdenv.lib.licenses.asl20; - homepage = "https://github.com/erlware/relx"; - maintainers = with stdenv.lib.maintainers; [ ericbmerritt ]; + src = fetchHex { + pkg = "relx"; + sha256 = "13j7wds2d7b8v3r9pwy3zhwhzywgwhn6l9gm3slqzyrs1jld0a9d"; + version = "3.23.1"; }; + checkouts = fetchRebar3Deps { + inherit name version; + src = "${src}/rebar.lock"; + sha256 = "046b1lb9rymndlvzmin3ppa3vkssjqspyfp98869k11s5avg76hd"; + }; } diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch b/pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch new file mode 100644 index 000000000000..5a047b0f0703 --- /dev/null +++ b/pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch @@ -0,0 +1,517 @@ +From 6737a6b34f4823deb7142f27b4074831a37ac1e1 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" <hjl.tools@gmail.com> +Date: Fri, 20 Jul 2018 09:18:47 -0700 +Subject: [PATCH] x86: Add a GNU_PROPERTY_X86_ISA_1_USED note if needed + +When -z separate-code, which is enabled by default for Linux/x86, is +used to create executable, ld won't place any data in the code-only +PT_LOAD segment. If there are no data sections placed before the +code-only PT_LOAD segment, the program headers won't be mapped into +any PT_LOAD segment. When the executable tries to access it (based +on the program header address passed in AT_PHDR), it will lead to +segfault. This patch inserts a GNU_PROPERTY_X86_ISA_1_USED note if +there may be no data sections before the text section so that the +first PT_LOAD segment won't be code-only and will contain the program +header. + +Testcases are adjusted to either pass "-z noseparate-code" to ld or +discard the .note.gnu.property section. A Linux/x86 run-time test is +added. + +bfd/ + + PR ld/23428 + * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): If the + separate code program header is needed, make sure that the first + read-only PT_LOAD segment has no code by adding a + GNU_PROPERTY_X86_ISA_1_USED note. + +ld/ + + PR ld/23428 + * testsuite/ld-elf/linux-x86.S: New file. + * testsuite/ld-elf/linux-x86.exp: Likewise. + * testsuite/ld-elf/pr23428.c: Likewise. + * testsuite/ld-elf/sec64k.exp: Pass "-z noseparate-code" to ld + for Linux/x86 targets. + * testsuite/ld-i386/abs-iamcu.d: Likewise. + * testsuite/ld-i386/abs.d: Likewise. + * testsuite/ld-i386/pr12718.d: Likewise. + * testsuite/ld-i386/pr12921.d: Likewise. + * testsuite/ld-x86-64/abs-k1om.d: Likewise. + * testsuite/ld-x86-64/abs-l1om.d: Likewise. + * testsuite/ld-x86-64/abs.d: Likewise. + * testsuite/ld-x86-64/pr12718.d: Likewise. + * testsuite/ld-x86-64/pr12921.d: Likewise. + * testsuite/ld-linkonce/zeroeh.ld: Discard .note.gnu.property + section. + * testsuite/ld-scripts/print-memory-usage.t: Likewise. + * testsuite/ld-scripts/size-2.t: Likewise. + * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use ld + to create executable if language is "asm". + +(cherry picked from commit 241e64e3b42cd9eba514b8e0ad2ef39a337f10a5) +--- + bfd/elfxx-x86.c | 60 ++++++++++++++----- + ld/testsuite/ld-elf/linux-x86.S | 63 ++++++++++++++++++++ + ld/testsuite/ld-elf/linux-x86.exp | 46 ++++++++++++++ + ld/testsuite/ld-elf/pr23428.c | 43 +++++++++++++ + ld/testsuite/ld-elf/sec64k.exp | 2 + + ld/testsuite/ld-i386/abs-iamcu.d | 2 +- + ld/testsuite/ld-i386/abs.d | 2 +- + ld/testsuite/ld-i386/pr12718.d | 2 +- + ld/testsuite/ld-i386/pr12921.d | 2 +- + ld/testsuite/ld-linkonce/zeroeh.ld | 1 + + ld/testsuite/ld-scripts/print-memory-usage.t | 2 + + ld/testsuite/ld-scripts/size-2.t | 1 + + ld/testsuite/ld-x86-64/abs-k1om.d | 2 +- + ld/testsuite/ld-x86-64/abs-l1om.d | 2 +- + ld/testsuite/ld-x86-64/abs.d | 2 +- + ld/testsuite/ld-x86-64/pr12718.d | 2 +- + ld/testsuite/ld-x86-64/pr12921.d | 2 +- + ld/testsuite/lib/ld-lib.exp | 5 +- + 20 files changed, 248 insertions(+), 25 deletions(-) + create mode 100644 ld/testsuite/ld-elf/linux-x86.S + create mode 100644 ld/testsuite/ld-elf/linux-x86.exp + create mode 100644 ld/testsuite/ld-elf/pr23428.c + +diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c +index a2497aab86..2e4ff88f1f 100644 +--- a/bfd/elfxx-x86.c ++++ b/bfd/elfxx-x86.c +@@ -2524,6 +2524,7 @@ _bfd_x86_elf_link_setup_gnu_properties + const struct elf_backend_data *bed; + unsigned int class_align = ABI_64_P (info->output_bfd) ? 3 : 2; + unsigned int got_align; ++ bfd_boolean has_text = FALSE; + + features = 0; + if (info->ibt) +@@ -2538,24 +2539,59 @@ _bfd_x86_elf_link_setup_gnu_properties + if (bfd_get_flavour (pbfd) == bfd_target_elf_flavour + && bfd_count_sections (pbfd) != 0) + { ++ if (!has_text) ++ { ++ /* Check if there is no non-empty text section. */ ++ sec = bfd_get_section_by_name (pbfd, ".text"); ++ if (sec != NULL && sec->size != 0) ++ has_text = TRUE; ++ } ++ + ebfd = pbfd; + + if (elf_properties (pbfd) != NULL) + break; + } + +- if (ebfd != NULL && features) ++ bed = get_elf_backend_data (info->output_bfd); ++ ++ htab = elf_x86_hash_table (info, bed->target_id); ++ if (htab == NULL) ++ return pbfd; ++ ++ if (ebfd != NULL) + { +- /* If features is set, add GNU_PROPERTY_X86_FEATURE_1_IBT and +- GNU_PROPERTY_X86_FEATURE_1_SHSTK. */ +- prop = _bfd_elf_get_property (ebfd, +- GNU_PROPERTY_X86_FEATURE_1_AND, +- 4); +- prop->u.number |= features; +- prop->pr_kind = property_number; ++ prop = NULL; ++ if (features) ++ { ++ /* If features is set, add GNU_PROPERTY_X86_FEATURE_1_IBT and ++ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */ ++ prop = _bfd_elf_get_property (ebfd, ++ GNU_PROPERTY_X86_FEATURE_1_AND, ++ 4); ++ prop->u.number |= features; ++ prop->pr_kind = property_number; ++ } ++ else if (has_text ++ && elf_properties (ebfd) == NULL ++ && elf_tdata (info->output_bfd)->o->build_id.sec == NULL ++ && !htab->elf.dynamic_sections_created ++ && !info->traditional_format ++ && (info->output_bfd->flags & D_PAGED) != 0 ++ && info->separate_code) ++ { ++ /* If the separate code program header is needed, make sure ++ that the first read-only PT_LOAD segment has no code by ++ adding a GNU_PROPERTY_X86_ISA_1_USED note. */ ++ prop = _bfd_elf_get_property (ebfd, ++ GNU_PROPERTY_X86_ISA_1_USED, ++ 4); ++ prop->u.number = GNU_PROPERTY_X86_ISA_1_486; ++ prop->pr_kind = property_number; ++ } + + /* Create the GNU property note section if needed. */ +- if (pbfd == NULL) ++ if (prop != NULL && pbfd == NULL) + { + sec = bfd_make_section_with_flags (ebfd, + NOTE_GNU_PROPERTY_SECTION_NAME, +@@ -2581,12 +2617,6 @@ error_alignment: + + pbfd = _bfd_elf_link_setup_gnu_properties (info); + +- bed = get_elf_backend_data (info->output_bfd); +- +- htab = elf_x86_hash_table (info, bed->target_id); +- if (htab == NULL) +- return pbfd; +- + htab->r_info = init_table->r_info; + htab->r_sym = init_table->r_sym; + +diff --git a/ld/testsuite/ld-elf/linux-x86.S b/ld/testsuite/ld-elf/linux-x86.S +new file mode 100644 +index 0000000000..bdf40c6e01 +--- /dev/null ++++ b/ld/testsuite/ld-elf/linux-x86.S +@@ -0,0 +1,63 @@ ++ .text ++ .globl _start ++ .type _start,@function ++ .p2align 4 ++_start: ++ xorl %ebp, %ebp ++#ifdef __LP64__ ++ popq %rdi ++ movq %rsp, %rsi ++ andq $~15, %rsp ++#elif defined __x86_64__ ++ mov (%rsp),%edi ++ addl $4,%esp ++ movl %esp, %esi ++ andl $~15, %esp ++#else ++ popl %esi ++ movl %esp, %ecx ++ andl $~15, %esp ++ ++ subl $8,%esp ++ pushl %ecx ++ pushl %esi ++#endif ++ ++ call main ++ ++ hlt ++ ++ .type syscall, @function ++ .globl syscall ++ .p2align 4 ++syscall: ++#ifdef __x86_64__ ++ movq %rdi, %rax /* Syscall number -> rax. */ ++ movq %rsi, %rdi /* shift arg1 - arg5. */ ++ movq %rdx, %rsi ++ movq %rcx, %rdx ++ movq %r8, %r10 ++ movq %r9, %r8 ++ movq 8(%rsp),%r9 /* arg6 is on the stack. */ ++ syscall /* Do the system call. */ ++#else ++ push %ebp ++ push %edi ++ push %esi ++ push %ebx ++ mov 0x2c(%esp),%ebp ++ mov 0x28(%esp),%edi ++ mov 0x24(%esp),%esi ++ mov 0x20(%esp),%edx ++ mov 0x1c(%esp),%ecx ++ mov 0x18(%esp),%ebx ++ mov 0x14(%esp),%eax ++ int $0x80 ++ pop %ebx ++ pop %esi ++ pop %edi ++ pop %ebp ++#endif ++ ret /* Return to caller. */ ++ .size syscall, .-syscall ++ .section .note.GNU-stack,"",@progbits +diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp +new file mode 100644 +index 0000000000..36217c6fb4 +--- /dev/null ++++ b/ld/testsuite/ld-elf/linux-x86.exp +@@ -0,0 +1,46 @@ ++# Expect script for simple native Linux/x86 tests. ++# Copyright (C) 2018 Free Software Foundation, Inc. ++# ++# This file is part of the GNU Binutils. ++# ++# 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 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, write to the Free Software ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++# MA 02110-1301, USA. ++# ++ ++# Test very simple native Linux/x86 programs with linux-x86.S. ++if { ![isnative] || [which $CC] == 0 \ ++ || (![istarget "i?86-*-linux*"] \ ++ && ![istarget "x86_64-*-linux*"] \ ++ && ![istarget "amd64-*-linux*"]) } { ++ return ++} ++ ++# Add $PLT_CFLAGS if PLT is expected. ++global PLT_CFLAGS ++# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required. ++global NOPIE_CFLAGS NOPIE_LDFLAGS ++ ++run_ld_link_exec_tests [list \ ++ [list \ ++ "Run PR ld/23428 test" \ ++ "--no-dynamic-linker -z separate-code" \ ++ "" \ ++ { linux-x86.S pr23428.c } \ ++ "pr23428" \ ++ "pass.out" \ ++ "$NOPIE_CFLAGS -fno-asynchronous-unwind-tables" \ ++ "asm" \ ++ ] \ ++] +diff --git a/ld/testsuite/ld-elf/pr23428.c b/ld/testsuite/ld-elf/pr23428.c +new file mode 100644 +index 0000000000..3631ed7926 +--- /dev/null ++++ b/ld/testsuite/ld-elf/pr23428.c +@@ -0,0 +1,43 @@ ++#include <unistd.h> ++#include <link.h> ++#include <syscall.h> ++ ++#define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1) ++ ++int ++main (int argc, char **argv) ++{ ++ char **ev = &argv[argc + 1]; ++ char **evp = ev; ++ ElfW(auxv_t) *av; ++ const ElfW(Phdr) *phdr = NULL; ++ size_t phnum = 0; ++ size_t loadnum = 0; ++ int fd = STDOUT_FILENO; ++ size_t i; ++ ++ while (*evp++ != NULL) ++ ; ++ ++ av = (ElfW(auxv_t) *) evp; ++ ++ for (; av->a_type != AT_NULL; ++av) ++ switch (av->a_type) ++ { ++ case AT_PHDR: ++ phdr = (const void *) av->a_un.a_val; ++ break; ++ case AT_PHNUM: ++ phnum = av->a_un.a_val; ++ break; ++ } ++ ++ for (i = 0; i < phnum; i++, phdr++) ++ if (phdr->p_type == PT_LOAD) ++ loadnum++; ++ ++ syscall (SYS_write, fd, STRING_COMMA_LEN ("PASS\n")); ++ ++ syscall (SYS_exit, !loadnum); ++ return 0; ++} +diff --git a/ld/testsuite/ld-elf/sec64k.exp b/ld/testsuite/ld-elf/sec64k.exp +index b58139e9dd..3909c0eaa1 100644 +--- a/ld/testsuite/ld-elf/sec64k.exp ++++ b/ld/testsuite/ld-elf/sec64k.exp +@@ -177,6 +177,8 @@ if { ![istarget "d10v-*-*"] + foreach sfile $sfiles { puts $ofd "#source: $sfile" } + if { [istarget spu*-*-*] } { + puts $ofd "#ld: --local-store 0:0" ++ } elseif { [istarget "i?86-*-linux*"] || [istarget "x86_64-*-linux*"] } { ++ puts $ofd "#ld: -z noseparate-code" + } else { + puts $ofd "#ld:" + } +diff --git a/ld/testsuite/ld-i386/abs-iamcu.d b/ld/testsuite/ld-i386/abs-iamcu.d +index ac9beff2e5..aba7d6b03f 100644 +--- a/ld/testsuite/ld-i386/abs-iamcu.d ++++ b/ld/testsuite/ld-i386/abs-iamcu.d +@@ -2,7 +2,7 @@ + #source: abs.s + #source: zero.s + #as: --32 -march=iamcu +-#ld: -m elf_iamcu ++#ld: -m elf_iamcu -z noseparate-code + #objdump: -rs -j .text + + .*: file format .* +diff --git a/ld/testsuite/ld-i386/abs.d b/ld/testsuite/ld-i386/abs.d +index e660aca524..191ee4456a 100644 +--- a/ld/testsuite/ld-i386/abs.d ++++ b/ld/testsuite/ld-i386/abs.d +@@ -2,7 +2,7 @@ + #as: --32 + #source: abs.s + #source: zero.s +-#ld: -melf_i386 ++#ld: -melf_i386 -z noseparate-code + #objdump: -rs + + .*: file format .* +diff --git a/ld/testsuite/ld-i386/pr12718.d b/ld/testsuite/ld-i386/pr12718.d +index ec51540a42..7eba52d95e 100644 +--- a/ld/testsuite/ld-i386/pr12718.d ++++ b/ld/testsuite/ld-i386/pr12718.d +@@ -1,6 +1,6 @@ + #name: PR ld/12718 + #as: --32 +-#ld: -melf_i386 ++#ld: -melf_i386 -z noseparate-code + #readelf: -S + + There are 5 section headers, starting at offset 0x[0-9a-f]+: +diff --git a/ld/testsuite/ld-i386/pr12921.d b/ld/testsuite/ld-i386/pr12921.d +index e49079b3c8..ea2da3eb51 100644 +--- a/ld/testsuite/ld-i386/pr12921.d ++++ b/ld/testsuite/ld-i386/pr12921.d +@@ -1,6 +1,6 @@ + #name: PR ld/12921 + #as: --32 +-#ld: -melf_i386 ++#ld: -melf_i386 -z noseparate-code + #readelf: -S --wide + + There are 7 section headers, starting at offset 0x[0-9a-f]+: +diff --git a/ld/testsuite/ld-linkonce/zeroeh.ld b/ld/testsuite/ld-linkonce/zeroeh.ld +index b22eaa12c9..f89855a08f 100644 +--- a/ld/testsuite/ld-linkonce/zeroeh.ld ++++ b/ld/testsuite/ld-linkonce/zeroeh.ld +@@ -2,4 +2,5 @@ SECTIONS { + .text 0xa00 : { *(.text); *(.gnu.linkonce.t.*) } + .gcc_except_table 0x2000 : { *(.gcc_except_table) } + .eh_frame 0x4000 : { *(.eh_frame) } ++ /DISCARD/ : { *(.note.gnu.property) } + } +diff --git a/ld/testsuite/ld-scripts/print-memory-usage.t b/ld/testsuite/ld-scripts/print-memory-usage.t +index 5ff057a5e3..6eda1d2dc4 100644 +--- a/ld/testsuite/ld-scripts/print-memory-usage.t ++++ b/ld/testsuite/ld-scripts/print-memory-usage.t +@@ -11,4 +11,6 @@ SECTIONS + *(.data) + *(.rw) + } ++ ++ /DISCARD/ : { *(.note.gnu.property) } + } +diff --git a/ld/testsuite/ld-scripts/size-2.t b/ld/testsuite/ld-scripts/size-2.t +index 723863995e..c3c4eddab4 100644 +--- a/ld/testsuite/ld-scripts/size-2.t ++++ b/ld/testsuite/ld-scripts/size-2.t +@@ -18,4 +18,5 @@ SECTIONS + LONG (SIZEOF (.tdata)) + LONG (SIZEOF (.tbss)) + } :image ++ /DISCARD/ : { *(.note.gnu.property) } + } +diff --git a/ld/testsuite/ld-x86-64/abs-k1om.d b/ld/testsuite/ld-x86-64/abs-k1om.d +index 2c26639fc0..6b0fde0eed 100644 +--- a/ld/testsuite/ld-x86-64/abs-k1om.d ++++ b/ld/testsuite/ld-x86-64/abs-k1om.d +@@ -2,7 +2,7 @@ + #source: ../ld-i386/abs.s + #source: ../ld-i386/zero.s + #as: --64 -march=k1om +-#ld: -m elf_k1om ++#ld: -m elf_k1om -z noseparate-code + #objdump: -rs -j .text + + .*: file format .* +diff --git a/ld/testsuite/ld-x86-64/abs-l1om.d b/ld/testsuite/ld-x86-64/abs-l1om.d +index 1fb96d44b7..f87869f9d0 100644 +--- a/ld/testsuite/ld-x86-64/abs-l1om.d ++++ b/ld/testsuite/ld-x86-64/abs-l1om.d +@@ -2,7 +2,7 @@ + #source: ../ld-i386/abs.s + #source: ../ld-i386/zero.s + #as: --64 -march=l1om +-#ld: -m elf_l1om ++#ld: -m elf_l1om -z noseparate-code + #objdump: -rs -j .text + #target: x86_64-*-linux* + +diff --git a/ld/testsuite/ld-x86-64/abs.d b/ld/testsuite/ld-x86-64/abs.d +index b24b018639..d99ab4685d 100644 +--- a/ld/testsuite/ld-x86-64/abs.d ++++ b/ld/testsuite/ld-x86-64/abs.d +@@ -1,7 +1,7 @@ + #name: Absolute non-overflowing relocs + #source: ../ld-i386/abs.s + #source: ../ld-i386/zero.s +-#ld: ++#ld: -z noseparate-code + #objdump: -rs + + .*: file format .* +diff --git a/ld/testsuite/ld-x86-64/pr12718.d b/ld/testsuite/ld-x86-64/pr12718.d +index 07d17325d0..2c503ffbaa 100644 +--- a/ld/testsuite/ld-x86-64/pr12718.d ++++ b/ld/testsuite/ld-x86-64/pr12718.d +@@ -1,6 +1,6 @@ + #name: PR ld/12718 + #as: --64 +-#ld: -melf_x86_64 ++#ld: -melf_x86_64 -z noseparate-code + #readelf: -S --wide + + There are 5 section headers, starting at offset 0x[0-9a-f]+: +diff --git a/ld/testsuite/ld-x86-64/pr12921.d b/ld/testsuite/ld-x86-64/pr12921.d +index 6fe6abee09..1162d55818 100644 +--- a/ld/testsuite/ld-x86-64/pr12921.d ++++ b/ld/testsuite/ld-x86-64/pr12921.d +@@ -1,6 +1,6 @@ + #name: PR ld/12921 + #as: --64 +-#ld: -melf_x86_64 ++#ld: -melf_x86_64 -z noseparate-code + #readelf: -S --wide + + There are 7 section headers, starting at offset 0x[0-9a-f]+: +diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp +index cfbefe9028..1095091882 100644 +--- a/ld/testsuite/lib/ld-lib.exp ++++ b/ld/testsuite/lib/ld-lib.exp +@@ -1482,7 +1482,10 @@ proc run_ld_link_exec_tests { ldtests args } { + continue + } + +- if { [ string match "c++" $lang ] } { ++ if { [ string match "asm" $lang ] } { ++ set link_proc ld_link ++ set link_cmd $ld ++ } elseif { [ string match "c++" $lang ] } { + set link_proc ld_link + set link_cmd $CXX + } else { +-- +2.20.1 + diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch b/pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch new file mode 100644 index 000000000000..ca50d9a57cd1 --- /dev/null +++ b/pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch @@ -0,0 +1,137 @@ +From 28a27bdbb9500797e6767f80c8128b09112aeed5 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" <hjl.tools@gmail.com> +Date: Sat, 11 Aug 2018 06:41:33 -0700 +Subject: [PATCH] x86: Properly add X86_ISA_1_NEEDED property + +Existing properties may be removed during property merging. We avoid +adding X86_ISA_1_NEEDED property only if existing properties won't be +removed. + +bfd/ + + PR ld/23428 + * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Don't + add X86_ISA_1_NEEDED property only if existing properties won't + be removed. + +ld/ + + PR ld/23428 + * testsuite/ld-elf/dummy.s: New file. + * testsuite/ld-elf/linux-x86.S: Add X86_FEATURE_1_AND property. + * testsuite/ld-elf/linux-x86.exp: Add dummy.s to pr23428. + +(cherry picked from commit ab9e342807d132182892de1be1a92d6e91a5c1da) +--- + bfd/elfxx-x86.c | 28 ++++++++++++++++++++++------ + ld/testsuite/ld-elf/dummy.s | 1 + + ld/testsuite/ld-elf/linux-x86.S | 28 ++++++++++++++++++++++++++++ + ld/testsuite/ld-elf/linux-x86.exp | 2 +- + 6 files changed, 66 insertions(+), 7 deletions(-) + create mode 100644 ld/testsuite/ld-elf/dummy.s + +diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c +index 7ccfd25815..2d8f7b640b 100644 +--- a/bfd/elfxx-x86.c ++++ b/bfd/elfxx-x86.c +@@ -2588,7 +2588,6 @@ _bfd_x86_elf_link_setup_gnu_properties + prop->pr_kind = property_number; + } + else if (has_text +- && elf_properties (ebfd) == NULL + && elf_tdata (info->output_bfd)->o->build_id.sec == NULL + && !htab->elf.dynamic_sections_created + && !info->traditional_format +@@ -2598,11 +2597,28 @@ _bfd_x86_elf_link_setup_gnu_properties + /* If the separate code program header is needed, make sure + that the first read-only PT_LOAD segment has no code by + adding a GNU_PROPERTY_X86_ISA_1_NEEDED note. */ +- prop = _bfd_elf_get_property (ebfd, +- GNU_PROPERTY_X86_ISA_1_NEEDED, +- 4); +- prop->u.number = GNU_PROPERTY_X86_ISA_1_486; +- prop->pr_kind = property_number; ++ elf_property_list *list; ++ bfd_boolean need_property = TRUE; ++ ++ for (list = elf_properties (ebfd); list; list = list->next) ++ switch (list->property.pr_type) ++ { ++ case GNU_PROPERTY_STACK_SIZE: ++ case GNU_PROPERTY_NO_COPY_ON_PROTECTED: ++ case GNU_PROPERTY_X86_ISA_1_NEEDED: ++ /* These properties won't be removed during merging. */ ++ need_property = FALSE; ++ break; ++ } ++ ++ if (need_property) ++ { ++ prop = _bfd_elf_get_property (ebfd, ++ GNU_PROPERTY_X86_ISA_1_NEEDED, ++ 4); ++ prop->u.number = GNU_PROPERTY_X86_ISA_1_486; ++ prop->pr_kind = property_number; ++ } + } + + /* Create the GNU property note section if needed. */ +diff --git a/ld/testsuite/ld-elf/dummy.s b/ld/testsuite/ld-elf/dummy.s +new file mode 100644 +index 0000000000..403f98000d +--- /dev/null ++++ b/ld/testsuite/ld-elf/dummy.s +@@ -0,0 +1 @@ ++# Dummy +diff --git a/ld/testsuite/ld-elf/linux-x86.S b/ld/testsuite/ld-elf/linux-x86.S +index bdf40c6e01..d94abc1106 100644 +--- a/ld/testsuite/ld-elf/linux-x86.S ++++ b/ld/testsuite/ld-elf/linux-x86.S +@@ -61,3 +61,31 @@ syscall: + ret /* Return to caller. */ + .size syscall, .-syscall + .section .note.GNU-stack,"",@progbits ++ ++ .section ".note.gnu.property", "a" ++#ifdef __LP64__ ++ .p2align 3 ++#else ++ .p2align 2 ++#endif ++ .long 1f - 0f /* name length */ ++ .long 5f - 2f /* data length */ ++ .long 5 /* note type */ ++0: .asciz "GNU" /* vendor name */ ++1: ++#ifdef __LP64__ ++ .p2align 3 ++#else ++ .p2align 2 ++#endif ++2: .long 0xc0000002 /* pr_type. */ ++ .long 4f - 3f /* pr_datasz. */ ++3: ++ .long 0x2 ++4: ++#ifdef __LP64__ ++ .p2align 3 ++#else ++ .p2align 2 ++#endif ++5: +diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp +index 36217c6fb4..f6f5a80853 100644 +--- a/ld/testsuite/ld-elf/linux-x86.exp ++++ b/ld/testsuite/ld-elf/linux-x86.exp +@@ -37,7 +37,7 @@ run_ld_link_exec_tests [list \ + "Run PR ld/23428 test" \ + "--no-dynamic-linker -z separate-code" \ + "" \ +- { linux-x86.S pr23428.c } \ ++ { linux-x86.S pr23428.c dummy.s } \ + "pr23428" \ + "pass.out" \ + "$NOPIE_CFLAGS -fno-asynchronous-unwind-tables" \ +-- +2.20.1 + diff --git a/pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch b/pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch new file mode 100644 index 000000000000..866d6db8ce24 --- /dev/null +++ b/pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch @@ -0,0 +1,583 @@ +From d55c3e36094f06bb1fb02f5eac19fdccf1d91f7e Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" <hjl.tools@gmail.com> +Date: Wed, 8 Aug 2018 06:09:15 -0700 +Subject: [PATCH] x86: Properly merge GNU_PROPERTY_X86_ISA_1_USED +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Without the GNU_PROPERTY_X86_ISA_1_USED property, all ISAs may be used. +If a bit in the GNU_PROPERTY_X86_ISA_1_USED property is unset, the +corresponding x86 instruction set isn’t used. When merging properties +from 2 input files and one input file doesn't have the +GNU_PROPERTY_X86_ISA_1_USED property, the output file shouldn't have +it neither. This patch removes the GNU_PROPERTY_X86_ISA_1_USED +property if an input file doesn't have it. + +This patch replaces the GNU_PROPERTY_X86_ISA_1_USED property with the +GNU_PROPERTY_X86_ISA_1_NEEDED property which is the minimum ISA +requirement. + +bfd/ + + PR ld/23486 + * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove + GNU_PROPERTY_X86_ISA_1_USED if an input file doesn't have it. + (_bfd_x86_elf_link_setup_gnu_properties): Adding the + GNU_PROPERTY_X86_ISA_1_NEEDED, instead of + GNU_PROPERTY_X86_ISA_1_USED, property. + +ld/ + + PR ld/23486 + * testsuite/ld-i386/i386.exp: Run PR ld/23486 tests. + * testsuite/ld-x86-64/x86-64.exp: Likewise. + * testsuite/ld-i386/pr23486a.d: New file. + * testsuite/ld-i386/pr23486b.d: Likewise. + * testsuite/ld-x86-64/pr23486a-x32.d: Likewise. + * testsuite/ld-x86-64/pr23486a.d: Likewise. + * testsuite/ld-x86-64/pr23486a.s: Likewise. + * testsuite/ld-x86-64/pr23486b-x32.d: Likewise. + * testsuite/ld-x86-64/pr23486b.d: Likewise. + * testsuite/ld-x86-64/pr23486b.s: Likewise. + * testsuite/ld-i386/property-3.r: Remove "x86 ISA used". + * testsuite/ld-i386/property-4.r: Likewise. + * testsuite/ld-i386/property-5.r: Likewise. + * testsuite/ld-i386/property-x86-ibt3a.d: Likewise. + * testsuite/ld-i386/property-x86-ibt3b.d: Likewise. + * testsuite/ld-i386/property-x86-shstk3a.d: Likewise. + * testsuite/ld-i386/property-x86-shstk3b.d: Likewise. + * testsuite/ld-x86-64/property-3.r: Likewise. + * testsuite/ld-x86-64/property-4.r: Likewise. + * testsuite/ld-x86-64/property-5.r: Likewise. + * testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise. + * testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise. + * testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise. + * testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise. + * testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise. + * testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise. + * testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise. + * testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise. + +(cherry picked from commit f7309df20c4e787041cedc4a6aced89c15259e54) +--- + bfd/elfxx-x86.c | 25 ++++++++++++--- + ld/testsuite/ld-i386/i386.exp | 2 ++ + ld/testsuite/ld-i386/pr23486a.d | 10 ++++++ + ld/testsuite/ld-i386/pr23486b.d | 10 ++++++ + ld/testsuite/ld-i386/property-3.r | 1 - + ld/testsuite/ld-i386/property-4.r | 1 - + ld/testsuite/ld-i386/property-5.r | 1 - + ld/testsuite/ld-i386/property-x86-ibt3a.d | 5 ++- + ld/testsuite/ld-i386/property-x86-ibt3b.d | 5 ++- + ld/testsuite/ld-i386/property-x86-shstk3a.d | 5 ++- + ld/testsuite/ld-i386/property-x86-shstk3b.d | 5 ++- + ld/testsuite/ld-x86-64/pr23486a-x32.d | 10 ++++++ + ld/testsuite/ld-x86-64/pr23486a.d | 10 ++++++ + ld/testsuite/ld-x86-64/pr23486a.s | 30 +++++++++++++++++ + ld/testsuite/ld-x86-64/pr23486b-x32.d | 10 ++++++ + ld/testsuite/ld-x86-64/pr23486b.d | 10 ++++++ + ld/testsuite/ld-x86-64/pr23486b.s | 30 +++++++++++++++++ + ld/testsuite/ld-x86-64/property-3.r | 1 - + ld/testsuite/ld-x86-64/property-4.r | 1 - + ld/testsuite/ld-x86-64/property-5.r | 1 - + .../ld-x86-64/property-x86-ibt3a-x32.d | 5 ++- + ld/testsuite/ld-x86-64/property-x86-ibt3a.d | 5 ++- + .../ld-x86-64/property-x86-ibt3b-x32.d | 5 ++- + ld/testsuite/ld-x86-64/property-x86-ibt3b.d | 5 ++- + .../ld-x86-64/property-x86-shstk3a-x32.d | 5 ++- + ld/testsuite/ld-x86-64/property-x86-shstk3a.d | 5 ++- + .../ld-x86-64/property-x86-shstk3b-x32.d | 5 ++- + ld/testsuite/ld-x86-64/property-x86-shstk3b.d | 5 ++- + ld/testsuite/ld-x86-64/x86-64.exp | 4 +++ + 31 files changed, 211 insertions(+), 47 deletions(-) + create mode 100644 ld/testsuite/ld-i386/pr23486a.d + create mode 100644 ld/testsuite/ld-i386/pr23486b.d + create mode 100644 ld/testsuite/ld-x86-64/pr23486a-x32.d + create mode 100644 ld/testsuite/ld-x86-64/pr23486a.d + create mode 100644 ld/testsuite/ld-x86-64/pr23486a.s + create mode 100644 ld/testsuite/ld-x86-64/pr23486b-x32.d + create mode 100644 ld/testsuite/ld-x86-64/pr23486b.d + create mode 100644 ld/testsuite/ld-x86-64/pr23486b.s + +--- a/bfd/elfxx-x86.c ++++ b/bfd/elfxx-x86.c +@@ -2407,12 +2407,27 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, + switch (pr_type) + { + case GNU_PROPERTY_X86_ISA_1_USED: ++ if (aprop == NULL || bprop == NULL) ++ { ++ /* Only one of APROP and BPROP can be NULL. */ ++ if (aprop != NULL) ++ { ++ /* Remove this property since the other input file doesn't ++ have it. */ ++ aprop->pr_kind = property_remove; ++ updated = TRUE; ++ } ++ break; ++ } ++ goto or_property; ++ + case GNU_PROPERTY_X86_ISA_1_NEEDED: + if (aprop != NULL && bprop != NULL) + { ++or_property: + number = aprop->u.number; + aprop->u.number = number | bprop->u.number; +- /* Remove the property if ISA bits are empty. */ ++ /* Remove the property if all bits are empty. */ + if (aprop->u.number == 0) + { + aprop->pr_kind = property_remove; +@@ -2428,14 +2443,14 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, + { + if (aprop->u.number == 0) + { +- /* Remove APROP if ISA bits are empty. */ ++ /* Remove APROP if all bits are empty. */ + aprop->pr_kind = property_remove; + updated = TRUE; + } + } + else + { +- /* Return TRUE if APROP is NULL and ISA bits of BPROP ++ /* Return TRUE if APROP is NULL and all bits of BPROP + aren't empty to indicate that BPROP should be added + to ABFD. */ + updated = bprop->u.number != 0; +@@ -2582,9 +2597,9 @@ _bfd_x86_elf_link_setup_gnu_properties + { + /* If the separate code program header is needed, make sure + that the first read-only PT_LOAD segment has no code by +- adding a GNU_PROPERTY_X86_ISA_1_USED note. */ ++ adding a GNU_PROPERTY_X86_ISA_1_NEEDED note. */ + prop = _bfd_elf_get_property (ebfd, +- GNU_PROPERTY_X86_ISA_1_USED, ++ GNU_PROPERTY_X86_ISA_1_NEEDED, + 4); + prop->u.number = GNU_PROPERTY_X86_ISA_1_486; + prop->pr_kind = property_number; +diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp +index 6d794fe653..78dad02579 100644 +--- a/ld/testsuite/ld-i386/i386.exp ++++ b/ld/testsuite/ld-i386/i386.exp +@@ -462,6 +462,8 @@ run_dump_test "pr23189" + run_dump_test "pr23194" + run_dump_test "pr23372a" + run_dump_test "pr23372b" ++run_dump_test "pr23486a" ++run_dump_test "pr23486b" + + if { !([istarget "i?86-*-linux*"] + || [istarget "i?86-*-gnu*"] +diff --git a/ld/testsuite/ld-i386/pr23486a.d b/ld/testsuite/ld-i386/pr23486a.d +new file mode 100644 +index 0000000000..41a6dcf7d5 +--- /dev/null ++++ b/ld/testsuite/ld-i386/pr23486a.d +@@ -0,0 +1,10 @@ ++#source: ../ld-x86-64/pr23486a.s ++#source: ../ld-x86-64/pr23486b.s ++#as: --32 ++#ld: -r -m elf_i386 ++#readelf: -n ++ ++Displaying notes found in: .note.gnu.property ++ Owner Data size Description ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586 +diff --git a/ld/testsuite/ld-i386/pr23486b.d b/ld/testsuite/ld-i386/pr23486b.d +new file mode 100644 +index 0000000000..08019b7274 +--- /dev/null ++++ b/ld/testsuite/ld-i386/pr23486b.d +@@ -0,0 +1,10 @@ ++#source: ../ld-x86-64/pr23486b.s ++#source: ../ld-x86-64/pr23486a.s ++#as: --32 ++#ld: -r -m elf_i386 ++#readelf: -n ++ ++Displaying notes found in: .note.gnu.property ++ Owner Data size Description ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586 +diff --git a/ld/testsuite/ld-i386/property-3.r b/ld/testsuite/ld-i386/property-3.r +index 0ed91f5922..d03203c1e5 100644 +--- a/ld/testsuite/ld-i386/property-3.r ++++ b/ld/testsuite/ld-i386/property-3.r +@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property + Owner Data size Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 +- x86 ISA used: 586, SSE + x86 ISA needed: i486, 586 + #pass +diff --git a/ld/testsuite/ld-i386/property-4.r b/ld/testsuite/ld-i386/property-4.r +index cb2bc15d9a..da295eb6c7 100644 +--- a/ld/testsuite/ld-i386/property-4.r ++++ b/ld/testsuite/ld-i386/property-4.r +@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property + Owner Data size Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 +- x86 ISA used: i486, 586, SSE + x86 ISA needed: i486, 586, SSE + #pass +diff --git a/ld/testsuite/ld-i386/property-5.r b/ld/testsuite/ld-i386/property-5.r +index 552965058c..e4141594b3 100644 +--- a/ld/testsuite/ld-i386/property-5.r ++++ b/ld/testsuite/ld-i386/property-5.r +@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property + Owner Data size Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x900000 +- x86 ISA used: i486, 586, SSE + x86 ISA needed: i486, 586, SSE + #pass +diff --git a/ld/testsuite/ld-i386/property-x86-ibt3a.d b/ld/testsuite/ld-i386/property-x86-ibt3a.d +index 4bb35b00fb..0aedea1614 100644 +--- a/ld/testsuite/ld-i386/property-x86-ibt3a.d ++++ b/ld/testsuite/ld-i386/property-x86-ibt3a.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: i486, 586, SSE2, SSE3 +- x86 ISA needed: 586, SSE, SSE3, SSE4_1 ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: 586, SSE, SSE3, SSE4_1 +diff --git a/ld/testsuite/ld-i386/property-x86-ibt3b.d b/ld/testsuite/ld-i386/property-x86-ibt3b.d +index 418d58a8f7..bd69ac6478 100644 +--- a/ld/testsuite/ld-i386/property-x86-ibt3b.d ++++ b/ld/testsuite/ld-i386/property-x86-ibt3b.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: i486, 586, SSE2, SSE3 +- x86 ISA needed: 586, SSE, SSE3, SSE4_1 ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: 586, SSE, SSE3, SSE4_1 +diff --git a/ld/testsuite/ld-i386/property-x86-shstk3a.d b/ld/testsuite/ld-i386/property-x86-shstk3a.d +index e261038f60..76d2a39f2c 100644 +--- a/ld/testsuite/ld-i386/property-x86-shstk3a.d ++++ b/ld/testsuite/ld-i386/property-x86-shstk3a.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: i486, 586, SSE2, SSE3 +- x86 ISA needed: 586, SSE, SSE3, SSE4_1 ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: 586, SSE, SSE3, SSE4_1 +diff --git a/ld/testsuite/ld-i386/property-x86-shstk3b.d b/ld/testsuite/ld-i386/property-x86-shstk3b.d +index 25f3d2361e..e770ecffa5 100644 +--- a/ld/testsuite/ld-i386/property-x86-shstk3b.d ++++ b/ld/testsuite/ld-i386/property-x86-shstk3b.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: i486, 586, SSE2, SSE3 +- x86 ISA needed: 586, SSE, SSE3, SSE4_1 ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: 586, SSE, SSE3, SSE4_1 +diff --git a/ld/testsuite/ld-x86-64/pr23486a-x32.d b/ld/testsuite/ld-x86-64/pr23486a-x32.d +new file mode 100644 +index 0000000000..6d9fa68cdb +--- /dev/null ++++ b/ld/testsuite/ld-x86-64/pr23486a-x32.d +@@ -0,0 +1,10 @@ ++#source: pr23486a.s ++#source: pr23486b.s ++#as: --x32 ++#ld: -r -m elf32_x86_64 ++#readelf: -n ++ ++Displaying notes found in: .note.gnu.property ++ Owner Data size Description ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586 +diff --git a/ld/testsuite/ld-x86-64/pr23486a.d b/ld/testsuite/ld-x86-64/pr23486a.d +new file mode 100644 +index 0000000000..dc2b7bf760 +--- /dev/null ++++ b/ld/testsuite/ld-x86-64/pr23486a.d +@@ -0,0 +1,10 @@ ++#source: pr23486a.s ++#source: pr23486b.s ++#as: --64 -defsym __64_bit__=1 ++#ld: -r -m elf_x86_64 ++#readelf: -n ++ ++Displaying notes found in: .note.gnu.property ++ Owner Data size Description ++ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586 +diff --git a/ld/testsuite/ld-x86-64/pr23486a.s b/ld/testsuite/ld-x86-64/pr23486a.s +new file mode 100644 +index 0000000000..a07d0c7ced +--- /dev/null ++++ b/ld/testsuite/ld-x86-64/pr23486a.s +@@ -0,0 +1,30 @@ ++ .section ".note.gnu.property", "a" ++.ifdef __64_bit__ ++ .p2align 3 ++.else ++ .p2align 2 ++.endif ++ .long 1f - 0f /* name length. */ ++ .long 4f - 1f /* data length. */ ++ /* NT_GNU_PROPERTY_TYPE_0 */ ++ .long 5 /* note type. */ ++0: ++ .asciz "GNU" /* vendor name. */ ++1: ++.ifdef __64_bit__ ++ .p2align 3 ++.else ++ .p2align 2 ++.endif ++ /* GNU_PROPERTY_X86_ISA_1_USED */ ++ .long 0xc0000000 /* pr_type. */ ++ .long 3f - 2f /* pr_datasz. */ ++2: ++ .long 0xa ++3: ++.ifdef __64_bit__ ++ .p2align 3 ++.else ++ .p2align 2 ++.endif ++4: +diff --git a/ld/testsuite/ld-x86-64/pr23486b-x32.d b/ld/testsuite/ld-x86-64/pr23486b-x32.d +new file mode 100644 +index 0000000000..0445e69d82 +--- /dev/null ++++ b/ld/testsuite/ld-x86-64/pr23486b-x32.d +@@ -0,0 +1,10 @@ ++#source: pr23486b.s ++#source: pr23486a.s ++#as: --x32 ++#ld: -r -m elf32_x86_64 ++#readelf: -n ++ ++Displaying notes found in: .note.gnu.property ++ Owner Data size Description ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586 +diff --git a/ld/testsuite/ld-x86-64/pr23486b.d b/ld/testsuite/ld-x86-64/pr23486b.d +new file mode 100644 +index 0000000000..dc2b7bf760 +--- /dev/null ++++ b/ld/testsuite/ld-x86-64/pr23486b.d +@@ -0,0 +1,10 @@ ++#source: pr23486a.s ++#source: pr23486b.s ++#as: --64 -defsym __64_bit__=1 ++#ld: -r -m elf_x86_64 ++#readelf: -n ++ ++Displaying notes found in: .note.gnu.property ++ Owner Data size Description ++ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586 +diff --git a/ld/testsuite/ld-x86-64/pr23486b.s b/ld/testsuite/ld-x86-64/pr23486b.s +new file mode 100644 +index 0000000000..c5167eeb65 +--- /dev/null ++++ b/ld/testsuite/ld-x86-64/pr23486b.s +@@ -0,0 +1,30 @@ ++ .section ".note.gnu.property", "a" ++.ifdef __64_bit__ ++ .p2align 3 ++.else ++ .p2align 2 ++.endif ++ .long 1f - 0f /* name length. */ ++ .long 4f - 1f /* data length. */ ++ /* NT_GNU_PROPERTY_TYPE_0 */ ++ .long 5 /* note type. */ ++0: ++ .asciz "GNU" /* vendor name. */ ++1: ++.ifdef __64_bit__ ++ .p2align 3 ++.else ++ .p2align 2 ++.endif ++ /* GNU_PROPERTY_X86_ISA_1_NEEDED */ ++ .long 0xc0000001 /* pr_type. */ ++ .long 3f - 2f /* pr_datasz. */ ++2: ++ .long 0x3 ++3: ++.ifdef __64_bit__ ++ .p2align 3 ++.else ++ .p2align 2 ++.endif ++4: +diff --git a/ld/testsuite/ld-x86-64/property-3.r b/ld/testsuite/ld-x86-64/property-3.r +index 0ed91f5922..d03203c1e5 100644 +--- a/ld/testsuite/ld-x86-64/property-3.r ++++ b/ld/testsuite/ld-x86-64/property-3.r +@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property + Owner Data size Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 +- x86 ISA used: 586, SSE + x86 ISA needed: i486, 586 + #pass +diff --git a/ld/testsuite/ld-x86-64/property-4.r b/ld/testsuite/ld-x86-64/property-4.r +index cb2bc15d9a..da295eb6c7 100644 +--- a/ld/testsuite/ld-x86-64/property-4.r ++++ b/ld/testsuite/ld-x86-64/property-4.r +@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property + Owner Data size Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 +- x86 ISA used: i486, 586, SSE + x86 ISA needed: i486, 586, SSE + #pass +diff --git a/ld/testsuite/ld-x86-64/property-5.r b/ld/testsuite/ld-x86-64/property-5.r +index 552965058c..e4141594b3 100644 +--- a/ld/testsuite/ld-x86-64/property-5.r ++++ b/ld/testsuite/ld-x86-64/property-5.r +@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property + Owner Data size Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x900000 +- x86 ISA used: i486, 586, SSE + x86 ISA needed: i486, 586, SSE + #pass +diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d +index 011426f5a4..4cec728dc7 100644 +--- a/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d ++++ b/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1 +- x86 ISA needed: i486, 586, SSE2, SSE3 ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586, SSE2, SSE3 +diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3a.d b/ld/testsuite/ld-x86-64/property-x86-ibt3a.d +index 1b4229a037..a8df49a351 100644 +--- a/ld/testsuite/ld-x86-64/property-x86-ibt3a.d ++++ b/ld/testsuite/ld-x86-64/property-x86-ibt3a.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1 +- x86 ISA needed: i486, 586, SSE2, SSE3 ++ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586, SSE2, SSE3 +diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d +index 290ed6abf1..c112626711 100644 +--- a/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d ++++ b/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1 +- x86 ISA needed: i486, 586, SSE2, SSE3 ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586, SSE2, SSE3 +diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3b.d b/ld/testsuite/ld-x86-64/property-x86-ibt3b.d +index 1142e03272..f10dffdc2c 100644 +--- a/ld/testsuite/ld-x86-64/property-x86-ibt3b.d ++++ b/ld/testsuite/ld-x86-64/property-x86-ibt3b.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1 +- x86 ISA needed: i486, 586, SSE2, SSE3 ++ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586, SSE2, SSE3 +diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d +index 819542d181..0147a3c7b6 100644 +--- a/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d ++++ b/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1 +- x86 ISA needed: i486, 586, SSE2, SSE3 ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586, SSE2, SSE3 +diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3a.d b/ld/testsuite/ld-x86-64/property-x86-shstk3a.d +index 4c5d0e0a18..1f8c2dc929 100644 +--- a/ld/testsuite/ld-x86-64/property-x86-shstk3a.d ++++ b/ld/testsuite/ld-x86-64/property-x86-shstk3a.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1 +- x86 ISA needed: i486, 586, SSE2, SSE3 ++ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586, SSE2, SSE3 +diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d +index ba181e0bc5..7ca2539ca5 100644 +--- a/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d ++++ b/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1 +- x86 ISA needed: i486, 586, SSE2, SSE3 ++ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586, SSE2, SSE3 +diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3b.d b/ld/testsuite/ld-x86-64/property-x86-shstk3b.d +index 5216f385dd..f66a40e449 100644 +--- a/ld/testsuite/ld-x86-64/property-x86-shstk3b.d ++++ b/ld/testsuite/ld-x86-64/property-x86-shstk3b.d +@@ -6,6 +6,5 @@ + + Displaying notes found in: .note.gnu.property + Owner Data size Description +- GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0 +- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1 +- x86 ISA needed: i486, 586, SSE2, SSE3 ++ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 ++ Properties: x86 ISA needed: i486, 586, SSE2, SSE3 +diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp +index 6edb9e86f4..ae21e554ad 100644 +--- a/ld/testsuite/ld-x86-64/x86-64.exp ++++ b/ld/testsuite/ld-x86-64/x86-64.exp +@@ -403,6 +403,10 @@ run_dump_test "pr23372a" + run_dump_test "pr23372a-x32" + run_dump_test "pr23372b" + run_dump_test "pr23372b-x32" ++run_dump_test "pr23486a" ++run_dump_test "pr23486a-x32" ++run_dump_test "pr23486b" ++run_dump_test "pr23486b-x32" + + if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} { + return +-- +2.20.1 + diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index 787a5dbc646e..4e2f26fd691b 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -1,5 +1,5 @@ { stdenv, lib, buildPackages -, fetchurl, zlib, autoreconfHook264 +, fetchurl, zlib, autoreconfHook # Enabling all targets increases output size to a multiple. , withAllTargets ? false, libbfd, libopcodes , enableShared ? true @@ -12,7 +12,7 @@ let # Remove gold-symbol-visibility patch when updating, the proper fix # is now upstream. # https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=330b90b5ffbbc20c5de6ae6c7f60c40fab2e7a4f;hp=99181ccac0fc7d82e7dabb05dc7466e91f1645d3 - version = "2.30"; + version = "2.31.1"; basename = "binutils-${version}"; # The targetPrefix prepended to binary names to allow multiple binuntils on the # PATH to both be usable. @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl { url = "mirror://gnu/binutils/${basename}.tar.bz2"; - sha256 = "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg"; + sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z"; }); patches = [ @@ -55,10 +55,11 @@ stdenv.mkDerivation rec { # https://sourceware.org/bugzilla/show_bug.cgi?id=22868 ./gold-symbol-visibility.patch - # Version 2.30 introduced strict requirements on ELF relocations which cannot - # be satisfied on aarch64 platform. Add backported fix from bugzilla. - # https://sourceware.org/bugzilla/show_bug.cgi?id=22764 - ./relax-R_AARCH64_ABS32-R_AARCH64_ABS16-absolute.patch + # https://sourceware.org/bugzilla/show_bug.cgi?id=23428 + # un-break features so linking against musl doesn't produce crash-only binaries + ./0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch + ./0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch + ./0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch ] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch; outputs = [ "out" "info" "man" ]; @@ -67,7 +68,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ bison ] ++ lib.optionals stdenv.targetPlatform.isiOS [ - autoreconfHook264 + autoreconfHook ]; buildInputs = [ zlib ]; diff --git a/pkgs/development/tools/misc/binutils/relax-R_AARCH64_ABS32-R_AARCH64_ABS16-absolute.patch b/pkgs/development/tools/misc/binutils/relax-R_AARCH64_ABS32-R_AARCH64_ABS16-absolute.patch deleted file mode 100644 index 6a04b3cc5588..000000000000 --- a/pkgs/development/tools/misc/binutils/relax-R_AARCH64_ABS32-R_AARCH64_ABS16-absolute.patch +++ /dev/null @@ -1,130 +0,0 @@ -diff --git a/bfd/ChangeLog b/bfd/ChangeLog -index c310da6ed3..d31f46171f 100644 ---- a/bfd/ChangeLog -+++ b/bfd/ChangeLog -@@ -1,3 +1,10 @@ -+2018-02-05 Renlin Li <renlin.li@arm.com> -+ -+ PR ld/22764 -+ * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Relax the -+ R_AARCH64_ABS32 and R_AARCH64_ABS16 for absolute symbol. Apply the -+ check for writeable section as well. -+ - 2018-01-27 Nick Clifton <nickc@redhat.com> - - This is the 2.30 release: -diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c -index d5711e0eb1..973188220b 100644 ---- a/bfd/elfnn-aarch64.c -+++ b/bfd/elfnn-aarch64.c -@@ -7074,10 +7074,19 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, - #if ARCH_SIZE == 64 - case BFD_RELOC_AARCH64_32: - #endif -- if (bfd_link_pic (info) -- && (sec->flags & SEC_ALLOC) != 0 -- && (sec->flags & SEC_READONLY) != 0) -+ if (bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0) - { -+ if (h != NULL -+ /* This is an absolute symbol. It represents a value instead -+ of an address. */ -+ && ((h->root.type == bfd_link_hash_defined -+ && bfd_is_abs_section (h->root.u.def.section)) -+ /* This is an undefined symbol. */ -+ || h->root.type == bfd_link_hash_undefined)) -+ break; -+ -+ /* For local symbols, defined global symbols in a non-ABS section, -+ it is assumed that the value is an address. */ - int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START; - _bfd_error_handler - /* xgettext:c-format */ -diff --git a/ld/ChangeLog b/ld/ChangeLog -index 6337cd0cb6..1aaa6da3b5 100644 ---- a/ld/ChangeLog -+++ b/ld/ChangeLog -@@ -1,3 +1,11 @@ -+2018-02-05 Renlin Li <renlin.li@arm.com> -+ -+ PR ld/22764 -+ * testsuite/ld-aarch64/emit-relocs-258.s: Define symbol as an address. -+ * testsuite/ld-aarch64/emit-relocs-259.s: Likewise. -+ * testsuite/ld-aarch64/pr22764.s: New. -+ * testsuite/ld-aarch64/pr22764.d: New. -+ - 2018-01-27 Nick Clifton <nickc@redhat.com> - - This is the 2.30 release: -diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp -index f31089361b..d766f3736b 100644 ---- a/ld/testsuite/ld-aarch64/aarch64-elf.exp -+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp -@@ -275,6 +275,7 @@ run_dump_test "pr17415" - run_dump_test_lp64 "tprel_g2_overflow" - run_dump_test "tprel_add_lo12_overflow" - run_dump_test "protected-data" -+run_dump_test_lp64 "pr22764" - - # ifunc tests - run_dump_test "ifunc-1" -diff --git a/ld/testsuite/ld-aarch64/emit-relocs-258.s b/ld/testsuite/ld-aarch64/emit-relocs-258.s -index f724776243..87bb657c5d 100644 ---- a/ld/testsuite/ld-aarch64/emit-relocs-258.s -+++ b/ld/testsuite/ld-aarch64/emit-relocs-258.s -@@ -1,5 +1,6 @@ -+.global dummy - .text -- -+dummy: - ldr x0, .L1 - - .L1: -diff --git a/ld/testsuite/ld-aarch64/emit-relocs-259.s b/ld/testsuite/ld-aarch64/emit-relocs-259.s -index 7e1ba3ceb4..0977c9d869 100644 ---- a/ld/testsuite/ld-aarch64/emit-relocs-259.s -+++ b/ld/testsuite/ld-aarch64/emit-relocs-259.s -@@ -1,5 +1,6 @@ -+.global dummy - .text -- -+dummy: - ldr x0, .L1 - - .L1: -diff --git a/ld/testsuite/ld-aarch64/pr22764.d b/ld/testsuite/ld-aarch64/pr22764.d -new file mode 100644 -index 0000000000..997519f469 ---- /dev/null -+++ b/ld/testsuite/ld-aarch64/pr22764.d -@@ -0,0 +1,18 @@ -+#source: pr22764.s -+#ld: -shared -T relocs.ld -defsym sym_abs1=0x1 -defsym sym_abs2=0x2 -defsym sym_abs3=0x3 -e0 --emit-relocs -+#notarget: aarch64_be-*-* -+#objdump: -dr -+#... -+ -+Disassembly of section \.text: -+ -+0000000000010000 \<\.text\>: -+ 10000: d503201f nop -+ ... -+ 10004: R_AARCH64_ABS64 sym_abs1 -+ 1000c: 00000002 \.word 0x00000002 -+ 1000c: R_AARCH64_ABS32 sym_abs2 -+ 10010: 0003 \.short 0x0003 -+ 10010: R_AARCH64_ABS16 sym_abs3 -+ 10012: 0000 \.short 0x0000 -+ 10014: d503201f nop -diff --git a/ld/testsuite/ld-aarch64/pr22764.s b/ld/testsuite/ld-aarch64/pr22764.s -new file mode 100644 -index 0000000000..25e36b4a12 ---- /dev/null -+++ b/ld/testsuite/ld-aarch64/pr22764.s -@@ -0,0 +1,6 @@ -+ .text -+ nop -+ .xword sym_abs1 -+ .word sym_abs2 -+ .short sym_abs3 -+ nop diff --git a/pkgs/development/tools/misc/ctags/wrapped.nix b/pkgs/development/tools/misc/ctags/wrapped.nix index 75ae9f1ba8b2..ed265b4489b3 100644 --- a/pkgs/development/tools/misc/ctags/wrapped.nix +++ b/pkgs/development/tools/misc/ctags/wrapped.nix @@ -14,7 +14,7 @@ with pkgs.stdenv.lib; # the derivation. use language extensions specified by args ctagsWrapped = makeOverridable ( {args, name} : pkgs.writeScriptBin name '' - #!/bin/sh + #!${stdenv.shell} exec ${pkgs.ctags}/bin/ctags ${concatStringsSep " " (map escapeShellArg args)} "$@" '') { args = let x = pkgs.ctagsWrapped; in concatLists [ diff --git a/pkgs/development/tools/misc/distcc/default.nix b/pkgs/development/tools/misc/distcc/default.nix index cef399eb5c12..e80a37d37dd5 100644 --- a/pkgs/development/tools/misc/distcc/default.nix +++ b/pkgs/development/tools/misc/distcc/default.nix @@ -53,7 +53,7 @@ let mkdir -p $out/bin if [ -x "${gcc.cc}/bin/gcc" ]; then cat > $out/bin/gcc << EOF - #!/bin/sh + #!${stdenv.shell} ${extraConfig} exec ${distcc}/bin/distcc gcc "\$@" EOF @@ -61,7 +61,7 @@ let fi if [ -x "${gcc.cc}/bin/g++" ]; then cat > $out/bin/g++ << EOF - #!/bin/sh + #!${stdenv.shell} ${extraConfig} exec ${distcc}/bin/distcc g++ "\$@" EOF diff --git a/pkgs/development/tools/misc/opengrok/default.nix b/pkgs/development/tools/misc/opengrok/default.nix index c8fdf246bcf1..f7b77cdc418d 100644 --- a/pkgs/development/tools/misc/opengrok/default.nix +++ b/pkgs/development/tools/misc/opengrok/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { mkdir -p $out cp -a * $out/ substituteInPlace $out/bin/OpenGrok --replace "/bin/uname" "${coreutils}/bin/uname" - substituteInPlace $out/bin/Messages --replace "#!/bin/ksh" "#!/bin/sh" + substituteInPlace $out/bin/Messages --replace "#!/bin/ksh" "#!${stdenv.shell}" wrapProgram $out/bin/OpenGrok \ --prefix PATH : "${stdenv.lib.makeBinPath [ ctags git ]}" \ --set JAVA_HOME "${jre}" \ diff --git a/pkgs/development/tools/parsing/bison/3.x.nix b/pkgs/development/tools/parsing/bison/3.x.nix index 3d5f09b7bc3e..09d7daa97bff 100644 --- a/pkgs/development/tools/parsing/bison/3.x.nix +++ b/pkgs/development/tools/parsing/bison/3.x.nix @@ -1,15 +1,14 @@ { stdenv, fetchurl, m4, perl, help2man }: stdenv.mkDerivation rec { - name = "bison-3.2.4"; + pname = "bison"; + version = "3.3.1"; src = fetchurl { - url = "mirror://gnu/bison/${name}.tar.gz"; - sha256 = "16n7xs3sa1rlhs8y8zg4gi2s2kbkz8d69w3xp935wjykk0i3wryb"; + url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz"; + sha256 = "0sz6rzmfz5scian0a28lrvkrsd0108dmxrxpqh4nyi2ahlglbma1"; }; - patches = []; # remove on another rebuild - nativeBuildInputs = [ m4 perl ] ++ stdenv.lib.optional stdenv.isSunOS help2man; propagatedBuildInputs = [ m4 ]; diff --git a/pkgs/development/tools/rust/rustfmt/default.nix b/pkgs/development/tools/rust/rustfmt/default.nix index 4684841cf478..dac00aa4c969 100644 --- a/pkgs/development/tools/rust/rustfmt/default.nix +++ b/pkgs/development/tools/rust/rustfmt/default.nix @@ -2,16 +2,16 @@ rustPlatform.buildRustPackage rec { name = "rustfmt-${version}"; - version = "1.0.0"; + version = "1.0.1"; src = fetchFromGitHub { owner = "rust-lang"; repo = "rustfmt"; rev = "${version}"; - sha256 = "17ady2zq4jcbgawgpfszrkp6kxabb2f261g82y2az7nfax1h1pwy"; + sha256 = "1l18ycbq3125sq8v3wgma630wd6kclarlf8f51cmi9blk322jg9p"; }; - cargoSha256 = "0v8iq50h9368kai3m710br5cxc3p6mpbwz1v6gaf5802n48liqs8"; + cargoSha256 = "1557783icdzlwn02c5zl4362yl85r5zj4nkjv80p6896yli9hk9h"; buildInputs = stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security; |