gitian-linux: Build binaries for 64-bit POWER #14066

pull luke-jr wants to merge 7 commits into bitcoin:master from luke-jr:gitian_power64 changing 8 files +66 −31
  1. luke-jr commented at 1:38 am on August 26, 2018: member

    A set of both big and little endian binaries, should be compatible with PowerPC 970 (Apple G5) and newer.

    Also splits libpng out of Qt (since Qt’s bundled copy is broken on POWER) and disables JPEG (since we don’t use it).

    Tested only the little endian variant, on Gentoo.

    (Based on #14065)

  2. fanquake added the label Build system on Aug 26, 2018
  3. DrahtBot commented at 4:26 am on August 26, 2018: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20451 (lint: run mypy over contrib/devtools by fanquake)
    • #20434 (contrib: Parse ELF directly for symbol and security checks by laanwj)
    • #18605 (build: Link time garbage collection by fanquake)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. laanwj commented at 7:14 am on August 27, 2018: member

    Concept ACK

    Not convinced, though, that we need a set of both big and little-endian binaries. What is the default on this platform? If you can only test little-endian, I think it’s better to leave it at that. (looks like both Debian and Fedora support LE, or are moving to it)

    Also (not for this PR): what would be really interesting is running the gitian build (for all platforms) on the secure workstation. This would remove the single point of failure of dependency Intel/AMD platforms for the build.

  5. laanwj requested review from theuni on Aug 29, 2018
  6. luke-jr commented at 0:17 am on August 30, 2018: member
    There is no default. Some older systems can only boot to big endian. Newer systems come in either BE and LE variant. Unfortunately, one cannot run even static BE binaries on LE or vice-versa (on Linux, anyway).
  7. awilfox commented at 9:13 pm on August 30, 2018: none

    At least RHEL, SuSE, and Adélie ship big-endian images.

    Big endian is simple to run in KVM paravirt on the little-endian systems with a performance hit of less than 1%. This should be very easy to test, especially with Gentoo, since Gentoo can make a cross-root somewhere and then you can just point KVM at that disk.

    Any POWER7 or older system, including most workstations before the Talos (including IBM’s post-RS and Apple’s 970), are exclusively big endian.

    Any system (of any generation) running openSuSE Tumbleweed or Adélie is exclusively big endian.

  8. MarcoFalke added the label Needs gitian build on Aug 30, 2018
  9. DrahtBot added the label Needs rebase on Aug 31, 2018
  10. DrahtBot removed the label Needs gitian build on Sep 1, 2018
  11. laanwj commented at 5:37 am on September 8, 2018: member

    Any POWER7 or older system, including most workstations before the Talos (including IBM’s post-RS and Apple’s 970), are exclusively big endian.

    Those are outside the scope of this PR, though, OP mentions this is POWER8+.

  12. luke-jr force-pushed on Sep 18, 2018
  13. luke-jr commented at 2:20 pm on September 18, 2018: member
    Rebased
  14. DrahtBot removed the label Needs rebase on Sep 18, 2018
  15. in contrib/devtools/symbol-check.py:117 in 53b7504697 outdated
    118-            (sym, _, version) = line[7].partition('@')
    119-            is_import = line[6] == 'UND'
    120+        words = line.split()
    121+        if 'Machine:' in words:
    122+            arch = words[-1]
    123+        m = re.match(r'^\s*\d+:\s*[\da-f]+\s+\d+\s(?:(?:\S+\s+){3})(?:\[.*\]\s+)?(\S+)\s+(\S+).*$', line)
    


    theuni commented at 7:47 pm on September 26, 2018:

    I have no clue what this is suppose to do.

    Perhaps a different tool like objdump or nm has output that’s more easily parsed?


    laanwj commented at 7:32 am on October 18, 2018:
    ahhh even parsing the ELF directly would be easier here than this

    luke-jr commented at 11:17 am on October 20, 2018:

    This is a fairly straightforward regex… Do we really need to ban regexs? :/

    Looking at alternatives:

    • Debian’s linter uses almost the same regex (they tolerate multiple spaces in one place this didn’t).
    • Perl’s Parse::Readelf module does some fancy parsing of column headers and stuff, and doesn’t really seem like it works (not to mention only supports printing its output, not actual code usage), and adds a lot of complexity we really don’t need.
    • pyelftools doesn’t seem to get symbol version information for some reason.

    laanwj commented at 12:21 pm on October 20, 2018:
    I don’t think it’s that complex now that you’ve explained what it does on IRC, and why the old parsing doesn’t work for POWER (due to [<localentry>: 8])—please add a comment in that regard (and thanks for investigating that readelf is apparently still the right tool for the job)
  16. in configure.ac:775 in ebd0de5e2f outdated
    673@@ -674,6 +674,11 @@ if test x$use_glibc_compat != xno; then
    674   AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk])
    675   AX_CHECK_LINK_FLAG([[-Wl,--wrap=__divmoddi4]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=__divmoddi4"])
    676   AX_CHECK_LINK_FLAG([[-Wl,--wrap=log2f]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--wrap=log2f"])
    677+  case $host in
    678+    powerpc64* | ppc64*)
    679+      AX_CHECK_LINK_FLAG([[-Wl,--no-tls-get-addr-optimize]], [COMPAT_LDFLAGS="$COMPAT_LDFLAGS -Wl,--no-tls-get-addr-optimize"])
    


    theuni commented at 7:54 pm on September 26, 2018:

    If this were a gcc switch, we would test against –tls-get-addr-optimize, then add –no-tls-get-addr-optimize to COMPAT_LDFLAGS if it succeeded. That is because gcc issues warnings for –no-foo if unsupported, but errors for –foo.

    I’m thinking we should do the same here. I don’t know how most linkers handle this, but I can’t imagine that causing any problems. That would also mean that we could safely run this check for all platforms without constraining it to specific ppc’s.


    luke-jr commented at 11:44 am on October 20, 2018:

    It should work without the no- prefix, but upon further research, I’m not sure if this is the correct solution at all.

    According to the documentation, systems without the glibc-side part can still explicitly enable the option and produce binaries that work (with a performance hit) on older systems. I’m not sure how this is technically implemented.


    luke-jr commented at 3:06 am on October 21, 2018:
    Managed to get an old glibc running and confirmed --no-tls-get-addr-optimize is in fact needed. No clue why the docs imply otherwise. :/

    luke-jr commented at 12:03 pm on October 22, 2018:

    As for the original comment:

    1. At least GNU ld errors if –no-foo is provided.
    2. Other platforms might not have compatibility issues using this flag.
  17. in depends/packages/libpng.mk:17 in b93e76c80d outdated
    12+define $(package)_config_cmds
    13+  $($(package)_autoconf)
    14+endef
    15+
    16+define $(package)_build_cmds
    17+  $(MAKE) $($(package)_build_opts) PNG_COPTS='-fPIC'
    


    theuni commented at 7:58 pm on September 26, 2018:
    Why this instead of doing it the usual way via configure?

    luke-jr commented at 8:04 am on October 21, 2018:

    No idea why, but it doesn’t seem to work the usual way via configure.

    0/usr/lib/gcc-cross/riscv64-linux-gnu/8/../../../../riscv64-linux-gnu/bin/ld: /home/ubuntu/build/bitcoin/depends/riscv64-linux-gnu/lib/libpng16.a(png.o): relocation R_RISCV_HI20 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
    1/usr/lib/gcc-cross/riscv64-linux-gnu/8/../../../../riscv64-linux-gnu/bin/ld: /home/ubuntu/build/bitcoin/depends/riscv64-linux-gnu/lib/libpng16.a(pngerror.o): relocation R_RISCV_HI20 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
    2/usr/lib/gcc-cross/riscv64-linux-gnu/8/../../../../riscv64-linux-gnu/bin/ld: /home/ubuntu/build/bitcoin/depends/riscv64-linux-gnu/lib/libpng16.a(pngget.o): relocation R_RISCV_HI20 against `__stack_chk_guard@@GLIBC_2.27' can not be used when making a shared object; recompile with -fPIC
    3...
    
  18. in contrib/gitian-descriptors/gitian-linux.yml:88 in c921a197f3 outdated
    84@@ -79,7 +85,11 @@ script: |
    85             echo "REAL=\`which -a ${i}-${prog}-8 | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
    86             echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
    87             echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
    88-            echo "exec \"\$REAL\" \"\$@\"" >> $WRAP_DIR/${i}-${prog}
    89+            if [ "${i:0:9}" = "powerpc64" ]; then
    90+                echo "exec \"\$REAL\" -mcpu=power8 -mtune=power9 \"\$@\"" >> $WRAP_DIR/${i}-${prog}
    


    theuni commented at 8:00 pm on September 26, 2018:
    This looks like something that should be handled in depends/hosts/linux.mk

    luke-jr commented at 12:02 pm on October 20, 2018:
    What if someone else wants to build for POWER7 (outside of gitian)?

    awilfox commented at 5:41 am on October 21, 2018:
    Is there a reason for specifying -mcpu=power8 here at all? VSX goes back to P7 and VMX goes back to P4…

    luke-jr commented at 7:59 am on October 21, 2018:

    Maybe not. How far back can we safely go without a noticeable performance hit?

    Would also be good to confirm #13203 still works if compiled for pre-POWER8.


    awilfox commented at 10:31 pm on October 22, 2018:
    vec_vsx_ld is POWER7; but the SHA sigma instructions are exclusive to POWER8 and newer. However, it looks like the merged code does check the hardware cap before using it, so it depends on compiler support, not build hardware support. (That is, if my understanding is correct, one could build all the way down to -mcpu=generic and you’d still get speed on P8+.)
  19. in src/Makefile.am:576 in c921a197f3 outdated
    572@@ -573,7 +573,7 @@ clean-local:
    573 check-symbols: $(bin_PROGRAMS)
    574 if GLIBC_BACK_COMPAT
    575 	@echo "Checking glibc back compat..."
    576-	$(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS)
    577+	$(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py $(BITCOIN_SYMBOL_CHECK_OPTIONS) < $(bin_PROGRAMS)
    


    theuni commented at 8:03 pm on September 26, 2018:
    What is BITCOIN_SYMBOL_CHECK_OPTIONS ? I don’t see any references to it, is this just intended to be an optional env var for local testing?

    luke-jr commented at 11:23 am on October 18, 2018:
    Should have been dropped in rebase; will remove next revision.
  20. theuni commented at 8:03 pm on September 26, 2018: member
    Concept ACK, a few questions though.
  21. MarcoFalke deleted a comment on Oct 21, 2018
  22. MarcoFalke added the label Needs gitian build on Oct 21, 2018
  23. DrahtBot removed the label Needs gitian build on Oct 22, 2018
  24. luke-jr force-pushed on Oct 22, 2018
  25. luke-jr force-pushed on Oct 22, 2018
  26. MarcoFalke added the label Needs gitian build on Oct 24, 2018
  27. MarcoFalke deleted a comment on Oct 24, 2018
  28. DrahtBot removed the label Needs gitian build on Oct 25, 2018
  29. DrahtBot added the label Needs rebase on Dec 13, 2018
  30. luke-jr referenced this in commit 3b1ba09f14 on Dec 24, 2018
  31. luke-jr referenced this in commit 34faa781d6 on Dec 24, 2018
  32. luke-jr referenced this in commit 771043a418 on Dec 24, 2018
  33. luke-jr referenced this in commit 68a678577d on Dec 24, 2018
  34. luke-jr referenced this in commit e7ce6e2082 on Dec 24, 2018
  35. luke-jr referenced this in commit 79efe21e96 on Dec 24, 2018
  36. luke-jr referenced this in commit bbbdda3716 on Dec 24, 2018
  37. luke-jr referenced this in commit 51f311ab8e on Dec 29, 2018
  38. luke-jr force-pushed on Dec 30, 2018
  39. luke-jr force-pushed on Feb 11, 2019
  40. DrahtBot removed the label Needs rebase on Feb 11, 2019
  41. practicalswift commented at 11:48 pm on February 16, 2019: contributor
    Concept ACK
  42. DrahtBot added the label Needs rebase on Feb 21, 2019
  43. practicalswift commented at 11:23 am on February 22, 2019: contributor
    @luke-jr What setup would you suggest for reviewers who want to test those binaries?
  44. awilfox commented at 6:45 pm on February 22, 2019: none

    You could spin up an IntegriCloud VPS, but I don’t know of any big endian distros that use glibc. All of them that I am aware of (Adelie, Void, etc) went to musl since it is easier to support BE on musl.

    So you’d need an older Debian or Fedora image to test the BE binary.

  45. luke-jr force-pushed on Mar 28, 2019
  46. luke-jr commented at 10:59 am on March 28, 2019: member
    Rebased, and extended support back to the PowerPC 970 (Apple G5) since it didn’t seem to have a notable performance hit on POWER9 (it actually performed better!).
  47. practicalswift commented at 11:01 am on March 28, 2019: contributor
    @luke-jr What setup would you suggest for reviewers who want to test those binaries?
  48. luke-jr commented at 11:09 am on March 28, 2019: member
    @awilfox answered that above. If you prefer to buy real hardware, I’m using https://www.raptorcs.com/content/base/products.html
  49. DrahtBot removed the label Needs rebase on Mar 28, 2019
  50. MarcoFalke deleted a comment on Mar 28, 2019
  51. MarcoFalke added the label Needs gitian build on Mar 28, 2019
  52. DrahtBot added the label Needs rebase on Mar 28, 2019
  53. DrahtBot removed the label Needs gitian build on Mar 29, 2019
  54. MarcoFalke commented at 2:06 pm on March 29, 2019: member

    Fails with:

      0> make[1]: Leaving directory '/home/ubuntu/build/bitcoin/depends/work/build/powerpc64-linux-gnu/qt/5.9.7-72625d07ee6/qtbase/config.tests/xcb_xlib'
      1 => source accepted.
      2test config.gui.libraries.xcb_xlib succeeded
      3Checking for XKB config root... 
      4test config.gui.tests.xkbconfigroot gave result /usr/share/X11/xkb
      5Checking for xkbcommon... 
      6Trying source 0 (type pkgConfig) of library xkbcommon ...
      7+ PKG_CONFIG_SYSROOT_DIR=/ PKG_CONFIG_LIBDIR=/home/ubuntu/build/bitcoin/depends/powerpc64-linux-gnu/lib/pkgconfig /usr/bin/pkg-config --exists --silence-errors xkbcommon
      8pkg-config did not find package.
      9  => source produced no result.
     10test config.gui.libraries.xkbcommon FAILED
     11Done running configuration tests.
     12
     13Configure summary:
     14
     15Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
     16Building for: bitcoin-linux-g++ (power64, CPU features: altivec)
     17Configuration: cross_compile enable_new_dtags largefile precompile_header silent release c++11 dbus no-qml-debug reduce_exports release_tools static
     18Build options:
     19  Mode ................................... release; optimized tools
     20  Optimize release build for size ........ no
     21  Building shared libraries .............. no
     22  Using C++ standard ..................... C++11
     23  Using ccache ........................... no
     24  Using gold linker ...................... no
     25  Using new DTAGS ........................ yes
     26  Using precompiled headers .............. yes
     27  Using LTCG ............................. no
     28  Target compiler supports:
     29  Build parts ............................ libs
     30Qt modules and options:
     31  Qt Concurrent .......................... no
     32  Qt D-Bus ............................... yes
     33  Qt D-Bus directly linked to libdbus .... no
     34  Qt Gui ................................. yes
     35  Qt Network ............................. yes
     36  Qt Sql ................................. no
     37  Qt Testlib ............................. yes
     38  Qt Widgets ............................. yes
     39  Qt Xml ................................. no
     40Support enabled for:
     41  Using pkg-config ....................... yes
     42  QML debugging .......................... no
     43  udev ................................... no
     44  Using system zlib ...................... yes
     45Qt Core:
     46  DoubleConversion ....................... yes
     47    Using system DoubleConversion ........ no
     48  GLib ................................... no
     49  iconv .................................. no
     50  ICU .................................... no
     51  Logging backends:
     52    journald ............................. no
     53    syslog ............................... no
     54    slog2 ................................ no
     55  Using system PCRE2 ..................... no
     56Qt Network:
     57  getaddrinfo() .......................... no
     58  getifaddrs() ........................... yes
     59  IPv6 ifname ............................ yes
     60  libproxy ............................... no
     61  OpenSSL ................................ no
     62    Qt directly linked to OpenSSL ........ no
     63  SCTP ................................... no
     64  Use system proxies ..................... yes
     65Qt Gui:
     66  Accessibility .......................... yes
     67  FreeType ............................... yes
     68    Using system FreeType ................ no
     69  HarfBuzz ............................... yes
     70    Using system HarfBuzz ................ no
     71  Fontconfig ............................. no
     72  Image formats:
     73    GIF .................................. no
     74    ICO .................................. yes
     75    JPEG ................................. no
     76      Using system libjpeg ............... no
     77    PNG .................................. yes
     78      Using system libpng ................ yes
     79  EGL .................................... no
     80  OpenVG ................................. no
     81  OpenGL:
     82    Desktop OpenGL ....................... no
     83    OpenGL ES 2.0 ........................ no
     84    OpenGL ES 3.0 ........................ no
     85    OpenGL ES 3.1 ........................ no
     86  Session Management ..................... no
     87Features used by QPA backends:
     88  evdev .................................. yes
     89  libinput ............................... no
     90  INTEGRITY HID .......................... no
     91  mtdev .................................. no
     92  tslib .................................. no
     93  xkbcommon-evdev ........................ no
     94QPA backends:
     95  DirectFB ............................... no
     96  EGLFS .................................. no
     97  LinuxFB ................................ no
     98  VNC .................................... yes
     99  Mir client ............................. no
    100  X11:
    101    Using system-provided XCB libraries .. no
    102    EGL on X11 ........................... no
    103    Xinput2 .............................. no
    104    XCB XKB .............................. yes
    105    XLib ................................. yes
    106    XCB render ........................... yes
    107    XCB GLX .............................. yes
    108    XCB Xlib ............................. yes
    109    Using system-provided xkbcommon ...... no
    110Qt Widgets:
    111  GTK+ ................................... no
    112  Styles ................................. Fusion Windows
    113Qt PrintSupport:
    114  CUPS ................................... no
    115Qt Sql:
    116  DB2 (IBM) .............................. no
    117  InterBase .............................. no
    118  MySql .................................. no
    119  OCI (Oracle) ........................... no
    120  ODBC ................................... no
    121  PostgreSQL ............................. no
    122  SQLite2 ................................ no
    123  SQLite ................................. no
    124    Using system provided SQLite ......... no
    125  TDS (Sybase) ........................... no
    126
    127Note: Using static linking will disable the use of dynamically
    128loaded plugins. Make sure to import all needed static plugins,
    129or compile needed modules into the library.
    130
    131Note: -optimized-tools is not useful in -release mode.
    132
    133Note: Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing.
    134
    135ERROR: Qt requires a compliant STL library.
    136
    137ERROR: detected a std::atomic implementation that fails for function pointers.
    138Please apply the patch corresponding to your Standard Library vendor, found in
    139  qtbase/config.tests/atomicfptr
    140
    141ERROR: Feature 'openssl-linked' was enabled, but the pre-condition '!features.securetransport && libs.openssl' failed.
    142
    143ERROR: Feature 'openssl' was enabled, but the pre-condition '!features.securetransport && (features.openssl-linked || libs.openssl_headers)' failed.
    144
    145ERROR: Feature 'system-freetype' was enabled, but the pre-condition 'features.freetype && libs.freetype' failed.
    146
    147ERROR: Feature 'fontconfig' was enabled, but the pre-condition '!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig' failed.
    148funcs.mk:243: recipe for target '/home/ubuntu/build/bitcoin/depends/work/build/powerpc64-linux-gnu/qt/5.9.7-72625d07ee6/qtbase/.stamp_configured' failed
    149make: *** [/home/ubuntu/build/bitcoin/depends/work/build/powerpc64-linux-gnu/qt/5.9.7-72625d07ee6/qtbase/.stamp_configured] Error 3
    150make: Leaving directory '/home/ubuntu/build/bitcoin/depends'
    
  55. luke-jr commented at 9:07 pm on March 29, 2019: member
    Worked for me and the bot? :/
  56. in depends/README.md:64 in a19df5fa25 outdated
    55@@ -54,6 +56,10 @@ For linux AARCH64 cross compilation:
    56 
    57     sudo apt-get install g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
    58 
    59+For linux POWER 64-bit cross compilation (there are no packages for 32-bit):
    60+
    61+    sudo apt-get install curl g++-7-powerpc64-linux-gnu binutils-powerpc64-linux-gnu g++-7-powerpc64le-linux-gnu binutils-powerpc64le-linux-gnu
    


    MarcoFalke commented at 10:00 pm on March 29, 2019:
    0    sudo apt-get install g++-powerpc64-linux-gnu binutils-powerpc64-linux-gnu g++-powerpc64le-linux-gnu binutils-powerpc64le-linux-gnu
    

    (Same as the other instructions)

  57. MarcoFalke commented at 10:20 pm on March 29, 2019: member
  58. MarcoFalke commented at 10:22 pm on March 29, 2019: member

    Worked for me and the bot? :/

    Oh, the failure is from the bot. But it passes for me locally on a fresh bionic vm:

    0apt update && apt install -y git vim htop make automake cmake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config python3 && apt install -y  g++-powerpc64-linux-gnu binutils-powerpc64-linux-gnu g++-powerpc64le-linux-gnu binutils-powerpc64le-linux-gnu
    1git clone https://github.com/luke-jr/bitcoin --depth=1 --branch gitian_power64 && cd bitcoin/depends && make -j 9 HOST=powerpc64-linux-gnu qt
    
  59. MarcoFalke added the label Needs gitian build on Mar 29, 2019
  60. luke-jr force-pushed on May 2, 2019
  61. DrahtBot removed the label Needs rebase on May 2, 2019
  62. DrahtBot removed the label Needs gitian build on May 5, 2019
  63. MarcoFalke deleted a comment on May 27, 2019
  64. MarcoFalke deleted a comment on May 27, 2019
  65. MarcoFalke added the label Needs gitian build on May 27, 2019
  66. DrahtBot removed the label Needs gitian build on May 28, 2019
  67. dongcarl commented at 7:59 pm on May 31, 2019: member
    Tested that Gitian building works on my own machine.
  68. DrahtBot added the label Needs rebase on Jul 23, 2019
  69. MarcoFalke deleted a comment on Jul 23, 2019
  70. MarcoFalke added the label Needs gitian build on Jul 23, 2019
  71. luke-jr force-pushed on Oct 14, 2019
  72. DrahtBot removed the label Needs rebase on Oct 14, 2019
  73. practicalswift commented at 7:55 am on October 14, 2019: contributor

    Concept ACK

    Diversity in testing is good. Thanks for working on this!

  74. DrahtBot removed the label Needs gitian build on Oct 15, 2019
  75. DrahtBot added the label Needs rebase on Oct 26, 2019
  76. laanwj added this to the milestone 0.20.0 on Nov 1, 2019
  77. laanwj commented at 10:42 am on November 1, 2019: member
    Would be nice to have this for 0.20.
  78. MarcoFalke added the label Needs gitian build on Nov 1, 2019
  79. MarcoFalke deleted a comment on Nov 1, 2019
  80. laanwj commented at 7:37 pm on November 8, 2019: member

    Also splits libpng out of Qt (since Qt’s bundled copy is broken on POWER) and disables JPEG (since we don’t use it).

    Could this be solved by changing to a new version of Qt? If so, I’d prefer that.

  81. MarcoFalke commented at 5:50 pm on December 9, 2019: member
    One of the commits has been cherry-picked and merged as 989fd539d5bf590c5f6070ee2a4a9e2d3018df2c
  82. in contrib/gitian-descriptors/gitian-linux.yml:90 in ba5948a8b4 outdated
    84@@ -79,7 +85,11 @@ script: |
    85             echo "REAL=\`which -a ${i}-${prog}-8 | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
    86             echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
    87             echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
    88-            echo "exec \"\$REAL\" \"\$@\"" >> $WRAP_DIR/${i}-${prog}
    89+            if [ "${i:0:9}" = "powerpc64" ]; then
    90+                echo "exec \"\$REAL\" -mcpu=970 -mtune=power9 \"\$@\"" >> $WRAP_DIR/${i}-${prog}
    


    dongcarl commented at 5:55 pm on December 9, 2019:
    Could we set these as CFLAGS/CPPFLAGS in depends instead of in the wrapper?

    luke-jr commented at 6:25 pm on December 9, 2019:
    I don’t know how reliably those get passed everywhere. Also, you mean CXXFLAGS

    dongcarl commented at 6:38 pm on December 9, 2019:

    :sweat_smile: yeah I meant CXXFLAGS…

    with depends you can just modify hosts/linux.mk… I’m also not sure about tuning for a specific cpu here (perhaps I’m understanding incorrectly), especially because this will be activated for both big and small endian HOSTs? Do you have sources for why these flags are needed?


    luke-jr commented at 6:51 pm on December 9, 2019:
    We don’t want to force these CFLAGS on everyone… just use them for gitian builds so they perform well.

    dongcarl commented at 7:16 pm on December 9, 2019:

    Sure, then we can just supply powerpc64_linux_CFLAGS='-mcpu=970 -mtune=power9' powerpc64le_linux_CFLAGS='-mcpu=970 -mtune=power9', but let’s do that in a followup :-)

    Wondering about the choice of -mcpu here… Why PowerPC 970 instead of a more generic powerpc64 or powerpc64le? My reference: https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options


    fanquake commented at 2:14 am on October 31, 2020:

    Wondering about the choice of -mcpu here… Why PowerPC 970 instead of a more generic powerpc64 or powerpc64le?

    This still atleast needs answering.


    luke-jr commented at 4:32 am on October 31, 2020:
    I don’t know. GCC doesn’t let me compare -mcpu values AFAICT. Presumably generic options wouldn’t be optimal for modern CPUs? (even 970 is pretty ancient)

    luke-jr commented at 2:15 am on November 2, 2020:
    I’m told -mcpu=970 is just powerpc64 + altivec.
  83. laanwj commented at 10:51 pm on March 6, 2020: member
    This has needed rebase for a while (if we still want this for 0.20).
  84. hebasto commented at 8:57 pm on March 15, 2020: member

    @luke-jr

    Also splits libpng out of Qt (since Qt’s bundled copy is broken on POWER)

    Just for reference:

    Could this be solved by changing to a new version of Qt? If so, I’d prefer that.

    Fixed since Qt 5.12.0 (according to the bugtracker).

  85. sipa commented at 4:24 am on March 16, 2020: member
    Would be nice to have this for 0.20.
  86. luke-jr force-pushed on Mar 16, 2020
  87. luke-jr commented at 7:48 pm on March 16, 2020: member

    Rebased and fixed a bug (GCC 8 miscompiles for LE targets with -mcpu=970)

    Considering the fragility of using the wrong -mcpu, I kept it in the wrapper…

  88. DrahtBot removed the label Needs rebase on Mar 16, 2020
  89. DrahtBot removed the label Needs gitian build on Mar 18, 2020
  90. MarcoFalke commented at 2:55 pm on March 18, 2020: member

    Excerpt:

     0+ make -j1 -C src check-security
     1make: Entering directory '/home/ubuntu/build/bitcoin/distsrc-powerpc64-linux-gnu/src'
     2Checking binary security...
     3bitcoind: failed NX
     4bitcoin-cli: failed NX
     5bitcoin-tx: failed NX
     6bitcoin-wallet: failed NX
     7test/test_bitcoin: failed NX
     8bench/bench_bitcoin: failed NX
     9qt/bitcoin-qt: failed NX
    10Makefile:18486: recipe for target 'check-security' failed
    11make: *** [check-security] Error 1
    12make: Leaving directory '/home/ubuntu/build/bitcoin/distsrc-powerpc64-linux-gnu/src'
    
  91. luke-jr commented at 4:56 am on March 24, 2020: member
    Fixed by making noexecstack explicit on all platforms (it doesn’t make sense to rely on defaults when we require it…)
  92. MarcoFalke added the label Needs gitian build on Mar 24, 2020
  93. DrahtBot removed the label Needs gitian build on Mar 25, 2020
  94. MarcoFalke deleted a comment on Mar 25, 2020
  95. MarcoFalke added the label Needs gitian build on Mar 25, 2020
  96. DrahtBot removed the label Needs gitian build on Mar 29, 2020
  97. laanwj removed this from the milestone 0.20.0 on Apr 2, 2020
  98. laanwj added this to the milestone 0.21.0 on Apr 2, 2020
  99. DrahtBot added the label Needs rebase on Apr 15, 2020
  100. MarcoFalke deleted a comment on Apr 15, 2020
  101. MarcoFalke deleted a comment on Apr 15, 2020
  102. luke-jr force-pushed on May 14, 2020
  103. DrahtBot removed the label Needs rebase on May 14, 2020
  104. DrahtBot added the label Needs rebase on Aug 10, 2020
  105. luke-jr force-pushed on Aug 17, 2020
  106. DrahtBot removed the label Needs rebase on Aug 17, 2020
  107. luke-jr commented at 4:52 am on August 20, 2020: member
    Needs rebasing on top of #19751 once that’s merged
  108. luke-jr closed this on Aug 20, 2020

  109. symbol-check: Fix readelf output parsing bf7357a6a0
  110. Support glibc-back-compat on 64-bit POWER 6711b0855f
  111. gitian: Properly quote arguments in wrappers 8782e8e72c
  112. gitian-linux: Build binaries for 64-bit POWER b74c21fad1
  113. gitian: Always specify noexecstack since we enforce it unconditionally a951c598fb
  114. luke-jr reopened this on Oct 24, 2020

  115. luke-jr force-pushed on Oct 24, 2020
  116. luke-jr force-pushed on Oct 24, 2020
  117. luke-jr commented at 1:26 pm on October 24, 2020: member
    Rebased and re-tested.
  118. MarcoFalke added the label Needs gitian build on Oct 24, 2020
  119. MarcoFalke added the label Needs Guix build on Oct 24, 2020
  120. DrahtBot commented at 11:06 am on October 25, 2020: member

    Guix builds

    File commit d67883d01e507dd22d1281f4a4860e79d6a46a47(master) commit f8cb73189115a63d45256b9340816bfce96393f5(master and this pull)
    *-aarch64-linux-gnu-debug.tar.gz 4e64895ca673f44e... 1c81820b04d543dd...
    *-aarch64-linux-gnu.tar.gz 59412baa429f4803... 5dc2a94eaa2d701b...
    *-arm-linux-gnueabihf-debug.tar.gz 463e2260deb8b17f... 5670537d76a83b2c...
    *-arm-linux-gnueabihf.tar.gz b5b819ebe904c8d3... d7bb7e2d75f2b466...
    *-riscv64-linux-gnu-debug.tar.gz 07942c124d73619a... a79ac723d8df3b89...
    *-riscv64-linux-gnu.tar.gz d8db9b1641e07df6... 48bbc2666ce652a0...
    *-win-unsigned.tar.gz 4061f534e46b79ac... 0edd48d828d0ba55...
    *-win64-debug.zip 5f9c0b65b643cab3... 3e68aba4980c4394...
    *-win64-setup-unsigned.exe 2df62ea3d8d62971... aa0bb79cebe4b9f9...
    *-win64.zip a3b3594fbcc248a8... 02c28d554ded69a3...
    *-x86_64-linux-gnu-debug.tar.gz 9a98775dcd5ac4ec... 3171288b07d28835...
    *-x86_64-linux-gnu.tar.gz 9461e33851c966c7... 16e6a1e5649a2b45...
    *.tar.gz 70f224763adead92... b0942820765c35a9...
    guix_build.log 5e2deeb86785b090... 6cd0579e43b4f588...
    guix_build.log.diff f5ec2913e23b04b6...
  121. DrahtBot removed the label Needs Guix build on Oct 25, 2020
  122. DrahtBot commented at 12:52 pm on October 26, 2020: member

    Gitian builds

    File commit d67883d01e507dd22d1281f4a4860e79d6a46a47(master) commit f8cb73189115a63d45256b9340816bfce96393f5(master and this pull)
    bitcoin-core-linux-0.21-res.yml fb2670f2f8ab0d0a... 57d59a44bffa740a...
    bitcoin-core-osx-0.21-res.yml d24523299fb03e93... 15dbc11fa63ccda4...
    bitcoin-core-win-0.21-res.yml 56c065d51ffa9fb6... 250e9b116781e91c...
    *-aarch64-linux-gnu-debug.tar.gz b4d05463fda0adac... 05b2ee6295f2e033...
    *-aarch64-linux-gnu.tar.gz 3a43937219f4fbef... c00e5233a0c93442...
    *-arm-linux-gnueabihf-debug.tar.gz 54e6c6f85955de26... e24bf2d02a8198de...
    *-arm-linux-gnueabihf.tar.gz 76dee1ea73dd31b7... feb4e7976ee0ee1d...
    *-osx-unsigned.dmg 6d0b6c8274d37dbb... 1c58228bce6b6118...
    *-osx64.tar.gz 902a69555d82322d... b13444feb8a9c24a...
    *-riscv64-linux-gnu-debug.tar.gz e87c71666376fe9a... d1bf41dc3cabb2b9...
    *-riscv64-linux-gnu.tar.gz 38c0ca912040a8b4... 0e4832f29b4f2219...
    *-win64-debug.zip f815299d5d2100f2... 2e88232c4e5ea247...
    *-win64-setup-unsigned.exe 854105d5cef6ab9c... cb5d93c039b3c21e...
    *-win64.zip e01a2d84b4fb5653... 78516aed31be5d0a...
    *-x86_64-linux-gnu-debug.tar.gz f75d8220b59ed46e... 52936ad4725853d2...
    *-x86_64-linux-gnu.tar.gz a6d8292cf44c959e... 8bdba6613953e49f...
    *.tar.gz 70f224763adead92... b0942820765c35a9...
    linux-build.log ceaaa58ad271c807... c067489d8a64916f...
    osx-build.log e48082cd327972e1... 21a106676aff913c...
    win-build.log 4c0c68075af70f26... 98e8b6f1fac30696...
    bitcoin-core-linux-0.21-res.yml.diff 52bd17632c91381e...
    bitcoin-core-osx-0.21-res.yml.diff 10814c03d2f02a18...
    bitcoin-core-win-0.21-res.yml.diff 05c123318fddccb1...
    *-powerpc64-linux-gnu-debug.tar.gz 49050c85b7776ebc...
    *-powerpc64-linux-gnu.tar.gz 76908c390ae80531...
    *-powerpc64le-linux-gnu-debug.tar.gz c84351a042c4aa31...
    *-powerpc64le-linux-gnu.tar.gz 766246b8a94227f4...
    linux-build.log.diff 6b78b10de4a501ce...
    osx-build.log.diff 89499c0a4d99986e...
    win-build.log.diff e68c80d64b8709db...
  123. DrahtBot removed the label Needs gitian build on Oct 26, 2020
  124. in contrib/devtools/security-check.py:148 in 622de1cc7e outdated
    144@@ -145,7 +145,6 @@ def check_ELF_separate_code(executable):
    145     EXPECTED_FLAGS = {
    146         # Read + execute
    147         '.init': 'R E',
    148-        '.plt': 'R E',
    


    laanwj commented at 7:55 am on October 30, 2020:

    Why remove this? Is .plt writable? We should make this specific on architecture. If POWER9 is an exception here that needs the jump table to be writable (which would be kind of insecure in itself, so this is an important security check), let’s make a specific exception for that.

    Edit: writability of the .plt section is not determined by separate-code. It’s part of “early binding”. E.g. -z,relro or -z,now.


    fanquake commented at 2:13 am on October 31, 2020:
    Agree with @laanwj. No need to wholesale relax our checks just to accommodate POWER. A special case with a comment should be fine.

    luke-jr commented at 2:12 am on November 2, 2020:
    Fixed
  125. in contrib/gitian-descriptors/gitian-linux.yml:53 in 622de1cc7e outdated
    50   FAKETIME_HOST_PROGS="gcc g++"
    51   FAKETIME_PROGS="date ar ranlib nm"
    52   HOST_CFLAGS="-O2 -g"
    53   HOST_CXXFLAGS="-O2 -g"
    54-  HOST_LDFLAGS_BASE="-static-libstdc++ -Wl,-O2"
    55+  HOST_LDFLAGS="-static-libstdc++ -Wl,-O2 -Wl,-z,noexecstack"
    


    fanquake commented at 2:20 am on October 31, 2020:
    If you’re going to add -z,noexecstack in the gitian descriptor, it should have a comment explaining why it’s here, rather than along with all of the other hardening options in configure, otherwise it’s not going to be clear why this flag is special cased.

    luke-jr commented at 2:14 am on November 2, 2020:
    I don’t know the answer to that myself. This PR is merely making explicit what was already enforced by our scripts for other platforms.
  126. luke-jr force-pushed on Nov 2, 2020
  127. laanwj removed this from the milestone 0.21.0 on Nov 2, 2020
  128. laanwj added this to the milestone 22.0 on Nov 2, 2020
  129. laanwj referenced this in commit e6441c6dec on Nov 20, 2020
  130. laanwj referenced this in commit e656dbf40f on Nov 21, 2020
  131. laanwj referenced this in commit a0a771843f on Nov 22, 2020
  132. fanquake referenced this in commit 12266bc028 on Nov 23, 2020
  133. devtools/security-check: Abstract get_ELF_header out of check_ELF_PIE 8c73a4cd36
  134. devtools/security-check: Allow .plt to be RW on PowerPC64 31dbf0b677
  135. luke-jr force-pushed on Nov 30, 2020
  136. laanwj commented at 11:27 am on December 18, 2020: member
    Now that #20434 is merged the symbol/security tooling-related changes should be able to be dropped here.
  137. DrahtBot added the label Needs rebase on Dec 18, 2020
  138. DrahtBot commented at 12:20 pm on December 18, 2020: member

    🐙 This pull request conflicts with the target branch and needs rebase.

    Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.

  139. mjdietzx referenced this in commit 85f2e5c08e on Dec 26, 2020
  140. laanwj commented at 3:36 pm on January 11, 2021: member
    Would be good to get this in early in the 0.22 cycle. But it needs rebase; ping @luke-jr .
  141. laanwj commented at 1:45 pm on January 19, 2021: member
    Closing in favor of #20963.
  142. laanwj closed this on Jan 19, 2021

  143. laanwj referenced this in commit 6a726cb534 on Jan 28, 2021
  144. DrahtBot locked this on Aug 18, 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: 2024-11-17 03:12 UTC

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