build: Allow export of environ symbols and work around rv64 toolchain issue #17569

pull laanwj wants to merge 5 commits into bitcoin:master from laanwj:2019_11_environ changing 3 files +32 −20
  1. laanwj commented at 9:32 AM on November 23, 2019: member

    This export was introduced in #17270 which added

    //! Necessary on some platforms
    extern char** environ;
    

    This should (finally) make the gitian build pass again (fix issue #17525.).

    Built on top of #17538 which should be merged first.

  2. build: Disallow dynamic linking against c++ library
    Ever since statically linking Qt, we've been linking the C++ library
    statically too (-static-libstdc++). Take this into
    account in the symbol checker.
    b77d5ad59f
  3. build: Bump minimum versions in symbol checker
    Debian 8 (Jessie) has:
    - g++ version 4.9.2
    - libc version 2.19
    
    Ubuntu 16.04.4 (Xenial) has:
    - g++ version 5.3.1
    - libc version 2.23.0
    
    CentOS 7 has:
    - g++ version 4.8.5
    - libc version 2.17
    
    Taking the minimum of these as our target.
    According to the GNU ABI document this corresponds to:
    
    - GCC 4.8.5: GCC_4.8.0
    - (glibc)    GLIBC_2_17
    
    Co-Authored-By: fanquake <fanquake@gmail.com>
    16a7be1663
  4. doc: add glibc 2.17 requirement to release-notes 8f15a31760
  5. build: Allow export of environ symbols
    This export was introduced in #17270 which added
    ```
    //! Necessary on some platforms
    extern char** environ;
    ```
    f6e42256fe
  6. laanwj added the label Build system on Nov 23, 2019
  7. laanwj commented at 12:59 PM on November 23, 2019: member

    I also think it'd be OK to remove the exports check completely. It was introduced back in the day because of symbol collisions between dynamically-linked Qt and the built-in statically built OpenSSL which could have scary implications.

    This hasn't been the case for ages—ever since Qt5 and before, we've statically linked Qt—and we don't even use OpenSSL anymore. I don't think a binary that exports symbols can usually cause problems (exporting excessive numbers of symbols would be an indication that something is going wrong in the link, but besides that).

    The check is already being skipped for some architectures.

  8. MarcoFalke added the label Needs gitian build on Nov 23, 2019
  9. laanwj commented at 7:00 PM on November 23, 2019: member

    It looks like there is a third problem that needs to be fixed before gitian passes again, the RISC-V binaries fail on the NX (non-executable stack) check.

    I'm really confused as to what could cause this. Will try to bisect. I suspect it's another unexpected by-effect of #17270, because it passes with 1baf7d1819317e4f4aeeaba2f9d72057e63b1fea.

    Edit: no, it's not #17270, I don't have the issue with 0bb37e437e9cb4a29476edc9fa42f3e03c8bd797

    Edit: bisected it to b49b6b0f7090cc15860d815fb0ef306ddfc718ba . Seems that linking to OpenSSL was the only thing that made it set noexecstack, on RISC-V. I'm not sure why yet, although we do explicitly pass -Wa,--noexecstack" CFLAGS there. (removed "needs gitian build" for now as i'm sure it will fail, will add it back after fixing this)

  10. laanwj removed the label Needs gitian build on Nov 23, 2019
  11. laanwj force-pushed on Nov 23, 2019
  12. laanwj added the label Needs gitian build on Nov 23, 2019
  13. laanwj commented at 10:39 PM on November 23, 2019: member

    Added a workaround to force noexecstack on RISC-V (I can't find any reason why this is different from other platforms, so blaming it on the immaturity of the toolchain, FWIW: gcc 9.2.1 on native Fedora RISC-V does get this right):

        # Workaround for Ubuntu's g++ compiler for RV64, which
        # doesn't add .note.GNU-stack sections automatically unlike other platforms,
        # resulting in a NX failure of the binary in security-check.py
        # TODO: remove this when no longer needed
        if [ "${i}" = "riscv64-linux-gnu" ]; then
          HOST_LDFLAGS="${HOST_LDFLAGS_BASE} -Wl,-z,noexecstack"
        else
          HOST_LDFLAGS="${HOST_LDFLAGS_BASE}"
        fi
    

    This is necessary now that the flag is no longer "inherited" through OpenSSL's build settings.

    I think this should be it.

  14. DrahtBot commented at 3:59 AM on November 24, 2019: member

    <!--a722867cd34abeea1fadc8d60700f111-->

    Gitian builds

    File commit 0b79caf658019de2c65a53c9e11fd1d2f4c369b6<br>(master) commit 32870545c8ab5860b44bd96936c69a27b493d1da<br>(master and this pull)
    bitcoin-0.19.99-osx-unsigned.dmg 2f8db30ccf876813... 82343ad664875e96...
    bitcoin-0.19.99-osx64.tar.gz e692e7414fd60d08... eb1e8c377377a213...
    bitcoin-0.19.99-win64-debug.zip d5aac0d177e3dd19... b34cd515f1dbb637...
    bitcoin-0.19.99-win64-setup-unsigned.exe 99e74ad4f140b9f8... ea20a481f8622076...
    bitcoin-0.19.99-win64.zip 5ee17a36809deed3... 66f3245a53c8ada3...
    bitcoin-0.19.99.tar.gz 60c0d2b9351b2072... 4cd8c5397c650f69...
    bitcoin-core-osx-0.20-res.yml 496ef99b99af9cbc... 48332aaaa2c60e36...
    bitcoin-core-win-0.20-res.yml e59bdc5fb20fdf13... 309ecb699ef99f07...
    linux-build.log 3a0ebaaea4f04719... 82589ac811ca3239...
    osx-build.log ac5e595f7863b747... b34943c2650f8d33...
    win-build.log 0e887a344ee447e9... 7d58d84db71362f8...
    bitcoin-core-osx-0.20-res.yml.diff 895a4bab149fe1af...
    bitcoin-core-win-0.20-res.yml.diff f1ed4819b157fd5c...
    linux-build.log.diff 061419aa8adac16c...
    osx-build.log.diff 8cec15944eb98c34...
    win-build.log.diff c57597d6d218619c...
  15. DrahtBot removed the label Needs gitian build on Nov 24, 2019
  16. MarcoFalke added the label Needs gitian build on Nov 24, 2019
  17. laanwj commented at 11:49 AM on November 24, 2019: member

    Issue (hopefully correctly) reported upstream: https://bugs.launchpad.net/ubuntu/+source/gcc-8-cross-ports/+bug/1853740 (updated commit message and comment for upstream issue)

  18. build: Add NX workaround for RV64
    Work around https://bugs.launchpad.net/ubuntu/+source/gcc-8-cross-ports/+bug/1853740.
    eafd259367
  19. laanwj force-pushed on Nov 24, 2019
  20. laanwj renamed this:
    build: Allow export of environ symbols
    build: Allow export of environ symbols and work around rv64 toolchain issue
    on Nov 24, 2019
  21. DrahtBot commented at 11:35 PM on November 24, 2019: member

    <!--a722867cd34abeea1fadc8d60700f111-->

    Gitian builds

    File commit 2eeacdfe44e5f5cbb240f92b3d7ddcdf5079dc3b<br>(master) commit 144cfbad5df96a1a4a97ba98d505700e334efa8e<br>(master and this pull)
    bitcoin-0.19.99-osx-unsigned.dmg 9d05f23d3ce7ffd1... 782f72b90f18c7c0...
    bitcoin-0.19.99-osx64.tar.gz 14fde6d21fa0df03... 053715c9149fbd25...
    bitcoin-0.19.99-win64-debug.zip c78aee8a8c2c4ae0... a52a8f036f1df958...
    bitcoin-0.19.99-win64-setup-unsigned.exe 8156ba3b081bf2c4... d7ce63f9714aa678...
    bitcoin-0.19.99-win64.zip cad87205c28ae17d... bf51d177625cdb7d...
    bitcoin-0.19.99.tar.gz 46dfa562551072cb... 5040ad08bc1e402a...
    bitcoin-core-osx-0.20-res.yml 43eae47a941ba34d... 80317d208000be54...
    bitcoin-core-win-0.20-res.yml 3e08f7574e6f4f8d... febd388c91ac60c2...
    linux-build.log 45da2e115d050f5d... e0cc8fd1cd1d3bcf...
    osx-build.log b4b31f4eab66517d... ea6285cfdd1ddfd3...
    win-build.log f7628df4d0e3626e... 4af0bea034cf10e0...
    bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz a1864a0a0db049fa...
    bitcoin-0.19.99-aarch64-linux-gnu.tar.gz 16f123fd5ecb608f...
    bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz fe966ae938727336...
    bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz 3c4527f935d82e9f...
    bitcoin-0.19.99-i686-pc-linux-gnu-debug.tar.gz a33a46e5bb9aee2a...
    bitcoin-0.19.99-i686-pc-linux-gnu.tar.gz cf61a9ce3a1da558...
    bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz 7aa8c7d73913d990...
    bitcoin-0.19.99-riscv64-linux-gnu.tar.gz e72e23083959b56f...
    bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz e3583adbf8616184...
    bitcoin-0.19.99-x86_64-linux-gnu.tar.gz be927699aacba560...
    bitcoin-core-linux-0.20-res.yml 31194810f698f0cb...
    bitcoin-core-osx-0.20-res.yml.diff 56c1281a4cddb0ce...
    bitcoin-core-win-0.20-res.yml.diff 47177a1074bd1ea2...
    linux-build.log.diff ca6a1e0fbd16a1fa...
    osx-build.log.diff 499fece744e01854...
    win-build.log.diff 0cb56cc3f2779056...
  22. DrahtBot removed the label Needs gitian build on Nov 24, 2019
  23. MarcoFalke referenced this in commit e6f167bfdf on Nov 25, 2019
  24. MarcoFalke merged this on Nov 25, 2019
  25. MarcoFalke closed this on Nov 25, 2019

  26. sidhujag referenced this in commit 912a39b439 on Nov 25, 2019
  27. laanwj added the label Needs backport (0.19) on Feb 17, 2020
  28. luke-jr referenced this in commit 52a65504b1 on Feb 18, 2020
  29. luke-jr referenced this in commit 4a3bc211d2 on Feb 18, 2020
  30. luke-jr referenced this in commit bdcfaa3318 on Feb 18, 2020
  31. luke-jr referenced this in commit 1f341753b0 on Feb 18, 2020
  32. luke-jr referenced this in commit 102547606f on Feb 18, 2020
  33. luke-jr referenced this in commit a0aad741ec on Feb 18, 2020
  34. fanquake commented at 3:19 AM on February 24, 2020: member

    I'm going to untag this as needing backport to 0.19, as per my comments here:

    Is backporting either of these really required?

    The changes that necessitated https://github.com/bitcoin/bitcoin/commit/f6e42256fe8900ed90f9644906b77f97e1600952 (https://github.com/bitcoin/bitcoin/pull/18175/commits/102547606f512f791ded0a610afe9f41b3ef2666 here) are not in the 0.19 branch.

    As for https://github.com/bitcoin/bitcoin/pull/17569/commits/eafd2593674b6890418a50eadf69425071b824e4, the 0.19.1rc2 RISCV binaries still have GNU_STACK marked as RW, because we're still receiving it from OpenSSL:

  35. fanquake removed the label Needs backport (0.19) on Feb 24, 2020
  36. sidhujag referenced this in commit f569979667 on Nov 10, 2020
  37. PastaPastaPasta referenced this in commit b184989b4d on Sep 17, 2021
  38. thelazier referenced this in commit 45c6fd5823 on Sep 25, 2021
  39. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me