Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: pass -fno-ident in Windows gitian descriptor #17948

Merged
merged 1 commit into from
Feb 17, 2020

Conversation

fanquake
Copy link
Member

@fanquake fanquake commented Jan 17, 2020

-fno-ident prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

For example, in the v0.19.0.1 Windows release binaries, there are > 1000 GCC compiler version strings embedded:

# GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
strings bitcoind.exe | rg GCC | wc -l
    1021

They end up collected in the end of the.rdata section, and cannot be removed by strip. i.e:

objdump --section=.rdata --full-contents bitcoind.exe
...
 cfcc00 00000000 00000000 00000000 00000000  ................
 cfcc10 00000000 00000000 00000000 00000000  ................
 cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
 cfcc30 20323031 37303431 35000000 00000000   20170415.......
 cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
 cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
 cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
 cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...

The flag is available for Clang and GCC.

Relevant code in GCC:

  /* Attach a special .ident directive to the end of the file to identify
     the version of GCC which compiled this code.  The format of the .ident
     string is patterned after the ones produced by native SVR4 compilers.  */
  if (!flag_no_ident)
    {
      const char *pkg_version = "(GNU) ";
      char *ident_str;


      if (strcmp ("(GCC) ", pkgversion_string))
	pkg_version = pkgversion_string;


      ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
      targetm.asm_out.output_ident (ident_str);
    }

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 17, 2020

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

Conflicts

No conflicts as of last run.

@practicalswift
Copy link
Contributor

Concept ACK

In addition to binary bloat reduction I assume this can't hurt from a deterministic builds perspective too.

FWIW: Chromium builds with -fno-ident IIRC.

@laanwj
Copy link
Member

laanwj commented Jan 17, 2020

ACK on passing this for the gitian / distributed binaries.

I'm less sure this is something that always needs to be passed by the build system, even for builds from sources and distro packages (which will have their own policy in regard to this).

@practicalswift
Copy link
Contributor

I'm less sure this is something that always needs to be passed by the build system, even for builds from sources and distro packages (which will have their own policy in regard to this).

What could be the drawback? Just curious :)

@DrahtBot
Copy link
Contributor

Gitian builds

File commit a654626
(master)
commit 24a38f4
(master and this pull)
bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz 7895a840c95d5b33... dc4c9781c31d6e22...
bitcoin-0.19.99-aarch64-linux-gnu.tar.gz f8bc224a926e91d3... 930bc0dabf940215...
bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz 00c38704f521a1e8... 6e0aa684aa4d192e...
bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz 000ddb8c912fa6cd... e6b519149e995731...
bitcoin-0.19.99-i686-pc-linux-gnu-debug.tar.gz 200b1c38944a974b... 8c6f0166708b9cfa...
bitcoin-0.19.99-i686-pc-linux-gnu.tar.gz d93a628e83397dee... 665e5f71a4a68343...
bitcoin-0.19.99-osx-unsigned.dmg 812a252820cf7a16... e7d2df6d42102da0...
bitcoin-0.19.99-osx64.tar.gz 2aad3d0a0a0d285c... f0f881b7fede1cab...
bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz d1b75bb5ff1eac59... 7f2ee57d16188c69...
bitcoin-0.19.99-riscv64-linux-gnu.tar.gz f2701b17b4a630ee... c1db32ac35ee227c...
bitcoin-0.19.99-win64-debug.zip 16318dba8cf0660e... 8c89eff3bfeba5ec...
bitcoin-0.19.99-win64-setup-unsigned.exe 2aa39517c8fff989... 3dec300f43061821...
bitcoin-0.19.99-win64.zip 622c25693f469997... f2611e77e9eef3d9...
bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz d5c9e11b1e22532d... fefeff37a3e224f4...
bitcoin-0.19.99-x86_64-linux-gnu.tar.gz 6037241e14a5367f... 33bc9a57ce076b0a...
bitcoin-0.19.99.tar.gz 3eb0788e811facc9... e22d7b26a4a30ae1...
bitcoin-core-linux-0.20-res.yml e6d51241a0566433... df9aae83b9b6ead0...
bitcoin-core-osx-0.20-res.yml 74d556dfd12603d2... 98e3579fed1cbc28...
bitcoin-core-win-0.20-res.yml db3040a4bf8b762c... b426524bbcc8eb40...
linux-build.log 2e4f0e5925d7556b... 9ad0a507a02a9b86...
osx-build.log 540464b4a328f14d... 564438d4b83a744f...
win-build.log 7b29a5f8528dda6d... a8109e085636dcaf...
bitcoin-core-linux-0.20-res.yml.diff f8198acd8a9a62c7...
bitcoin-core-osx-0.20-res.yml.diff a6090235c3628b52...
bitcoin-core-win-0.20-res.yml.diff cec994067e30b653...
linux-build.log.diff 0589de62261b0346...
osx-build.log.diff b636d2899a98a530...
win-build.log.diff ead78e44e2a1278d...

@laanwj
Copy link
Member

laanwj commented Jan 20, 2020

What could be the drawback? Just curious :)

What if someone is building from source for some platform and wants these idents in the binary for some reason? There's no way to enable them.

Having done embedded development where the intent is to compile all the software with the same set of compiler flags, I (personally) dislike it if projects provide unnecessary (it doesn't fix a bug or otherwise) gcc or linker flags when building from source.

If you think there's no reason at all to include these kind of "what compiled me" signifiers, please look at annobin, which goes even further and stores the command line options too for every compilation unit in the binary, it can be used for auditing post-compilation that the expected compiler/settings were used (such as security/hardening options)—it's impossible to rule these things out as "useful for noone".

So while I'm okay for leaving this out of the distributed binaries (we don't care), I don't want to decide this for everyone building the software hardwired in the build system.

@dongcarl
Copy link
Contributor

What if someone is building from source for some platform and wants these idents in the binary for some reason? There's no way to enable them.

True, this is worthwhile addition, but let's do that thru gitian descriptors.

I think we could also add the same flag to our depends hosts; looking for Concept ACK/NACKs on that.

If we're just doing this for release, then perhaps this is not necessary.

@sipa
Copy link
Member

sipa commented Jan 21, 2020

It's unclear to me what the goal is. Do we care about the 100 bytes or so this adds to our binary, or is this intended to improve some form of privacy?

@maflcko
Copy link
Member

maflcko commented Jan 21, 2020

Agree with @sipa. I don't see the danger of having these strings in the gitian/guix binary. Especially if this is going to be conditionally applied to only gitian builds, it might lead to further issues and build file code complexity.

@fanquake
Copy link
Member Author

100 bytes or so this adds to our binary

This currently adds > 3600 bytes to the Windows binaries.

I don't see the danger of having these strings in the gitian/guix binary.

I don't see a reason for us to be shipping around 1000s of bytes of useless data. Can you elaborate on the build system issues / complexity you foresee? We are already applying certain flags conditionally during gitian builds.

Given the 3 concept ACK above I'll adjust these changes as suggested.

@sipa
Copy link
Member

sipa commented Jan 21, 2020

I think even 3600 bytes compared to a multi-megabyte binary is negligible.

@luke-jr
Copy link
Member

luke-jr commented Jan 27, 2020

Agree with @laanwj: Fine for the gitian binaries, but leave normal builds alone. If the user wants -fno-ident, he can specify it or even make it a default option.

@DrahtBot
Copy link
Contributor

Needs rebase

This prevents compilers from emitting compiler name and
version number info that can needlessly bloat binaries.

Accepted by Clang and GCC. See:

https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn

https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident
@fanquake fanquake changed the title build: pass -fno-ident to prevent compilers emitting ident directives build: pass -fno-ident in Windows gitian descriptor Feb 13, 2020
@fanquake
Copy link
Member Author

Rebased, updated to just pass -fno-ident in the Windows gitian descriptor and added additional info to the PR description. Comparing two depends builds, this removes > 6000 bytes from the binary.

@practicalswift
Copy link
Contributor

ACK 530d02a

@DrahtBot
Copy link
Contributor

Gitian builds

File commit 2a2631f
(master)
commit 85aa65d
(master and this pull)
bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz 51392e3413128845... bf456184a7a8f670...
bitcoin-0.19.99-aarch64-linux-gnu.tar.gz 9c68060f909b176a... 7dc8ef17c7192a32...
bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz a4c6bc9d98b02c39... 1a4535798a3c3a74...
bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz 91c276c85c6ea8f0... 20140eda04ac713d...
bitcoin-0.19.99-osx-unsigned.dmg 71c8478f6158f433... 94bc2170765bbffe...
bitcoin-0.19.99-osx64.tar.gz e9f498c9b0694e08... 5e8613b348908d6a...
bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz e53b974b60b018a7... 95b15cbb02618a4d...
bitcoin-0.19.99-riscv64-linux-gnu.tar.gz 3ae4b4f4bf44d8ed... a2ce5a70dff657ed...
bitcoin-0.19.99-win64-debug.zip 88fc928933abadaf... 5a6d2785c1cbd5e7...
bitcoin-0.19.99-win64-setup-unsigned.exe 78c96ebfdbda69a3... a865292bb0ae019a...
bitcoin-0.19.99-win64.zip be3e701005cfa682... aedca6a43c9fe36b...
bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz bdbbb809f6569067... 7e8399e0b50a7602...
bitcoin-0.19.99-x86_64-linux-gnu.tar.gz 185e77d19a57404c... dd03d16b067382ea...
bitcoin-0.19.99.tar.gz bd8f4dff76b14fe8... 31a2a08e442b8ee8...
bitcoin-core-linux-0.20-res.yml c3a41885d43ad9c1... 9a04e6ef24ebc519...
bitcoin-core-osx-0.20-res.yml 2ea28d851bd7def3... 10ffa681865c8396...
bitcoin-core-win-0.20-res.yml db5c46d54aa23a95... a61bb2be21dac936...
linux-build.log 67c5b5639d5edc84... 8c44572465563c1e...
osx-build.log 635adff0cbd384f3... e1c91ec51d99f5cc...
win-build.log f9061ed05f12c5c0... 4dc9afd11c210bda...
bitcoin-core-linux-0.20-res.yml.diff 9b6ac4abc7ed9bff...
bitcoin-core-osx-0.20-res.yml.diff 7f3e9b5279fd8219...
bitcoin-core-win-0.20-res.yml.diff 59eac9489364352b...
linux-build.log.diff ba7d69f4e18a1d87...
osx-build.log.diff cd974a30aca222a3...
win-build.log.diff 19187459a3ad4317...

@laanwj
Copy link
Member

laanwj commented Feb 17, 2020

ACK 530d02a

laanwj added a commit that referenced this pull request Feb 17, 2020
530d02a build: pass -fno-ident in Windows gitian descriptor (fanquake)

Pull request description:

  `-fno-ident` prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

  For example, in the `v0.19.0.1` Windows release binaries, there are > 1000 GCC compiler version strings embedded:
  ```bash
  # GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
  strings bitcoind.exe | rg GCC | wc -l
      1021
  ```

  They end up collected in the end of the`.rdata` section, and cannot be removed by `strip`. i.e:

  ```bash
  objdump --section=.rdata --full-contents bitcoind.exe
  ...
   cfcc00 00000000 00000000 00000000 00000000  ................
   cfcc10 00000000 00000000 00000000 00000000  ................
   cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
   cfcc30 20323031 37303431 35000000 00000000   20170415.......
   cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
   cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...
  ```

  The flag is available for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident).

  Relevant code in [GCC](https://github.com/gcc-mirror/gcc/blob/master/gcc/toplev.c#L565-L578):
  ```c
    /* Attach a special .ident directive to the end of the file to identify
       the version of GCC which compiled this code.  The format of the .ident
       string is patterned after the ones produced by native SVR4 compilers.  */
    if (!flag_no_ident)
      {
        const char *pkg_version = "(GNU) ";
        char *ident_str;

        if (strcmp ("(GCC) ", pkgversion_string))
  	pkg_version = pkgversion_string;

        ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
        targetm.asm_out.output_ident (ident_str);
      }
  ```

ACKs for top commit:
  practicalswift:
    ACK 530d02a
  laanwj:
    ACK 530d02a

Tree-SHA512: b3b28f43ec483dee28d1df8548fe72425bf00e750701825c256395f6aa7b23256eb27609b51779b86aed108b6eaa3912181a9d8282e23eebf9cee7784f9fabe0
@laanwj laanwj merged commit 530d02a into bitcoin:master Feb 17, 2020
@fanquake fanquake deleted the pass_fno_ident branch February 17, 2020 12:10
MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request Apr 10, 2020
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
530d02a build: pass -fno-ident in Windows gitian descriptor (fanquake)

Pull request description:

  `-fno-ident` prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

  For example, in the `v0.19.0.1` Windows release binaries, there are > 1000 GCC compiler version strings embedded:
  ```bash
  # GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
  strings bitcoind.exe | rg GCC | wc -l
      1021
  ```

  They end up collected in the end of the`.rdata` section, and cannot be removed by `strip`. i.e:

  ```bash
  objdump --section=.rdata --full-contents bitcoind.exe
  ...
   cfcc00 00000000 00000000 00000000 00000000  ................
   cfcc10 00000000 00000000 00000000 00000000  ................
   cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
   cfcc30 20323031 37303431 35000000 00000000   20170415.......
   cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
   cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...
  ```

  The flag is available for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident).

  Relevant code in [GCC](https://github.com/gcc-mirror/gcc/blob/master/gcc/toplev.c#L565-L578):
  ```c
    /* Attach a special .ident directive to the end of the file to identify
       the version of GCC which compiled this code.  The format of the .ident
       string is patterned after the ones produced by native SVR4 compilers.  */
    if (!flag_no_ident)
      {
        const char *pkg_version = "(GNU) ";
        char *ident_str;

        if (strcmp ("(GCC) ", pkgversion_string))
  	pkg_version = pkgversion_string;

        ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
        targetm.asm_out.output_ident (ident_str);
      }
  ```

ACKs for top commit:
  practicalswift:
    ACK 530d02a
  laanwj:
    ACK 530d02a

Tree-SHA512: b3b28f43ec483dee28d1df8548fe72425bf00e750701825c256395f6aa7b23256eb27609b51779b86aed108b6eaa3912181a9d8282e23eebf9cee7784f9fabe0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
530d02a build: pass -fno-ident in Windows gitian descriptor (fanquake)

Pull request description:

  `-fno-ident` prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

  For example, in the `v0.19.0.1` Windows release binaries, there are > 1000 GCC compiler version strings embedded:
  ```bash
  # GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
  strings bitcoind.exe | rg GCC | wc -l
      1021
  ```

  They end up collected in the end of the`.rdata` section, and cannot be removed by `strip`. i.e:

  ```bash
  objdump --section=.rdata --full-contents bitcoind.exe
  ...
   cfcc00 00000000 00000000 00000000 00000000  ................
   cfcc10 00000000 00000000 00000000 00000000  ................
   cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
   cfcc30 20323031 37303431 35000000 00000000   20170415.......
   cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
   cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...
  ```

  The flag is available for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident).

  Relevant code in [GCC](https://github.com/gcc-mirror/gcc/blob/master/gcc/toplev.c#L565-L578):
  ```c
    /* Attach a special .ident directive to the end of the file to identify
       the version of GCC which compiled this code.  The format of the .ident
       string is patterned after the ones produced by native SVR4 compilers.  */
    if (!flag_no_ident)
      {
        const char *pkg_version = "(GNU) ";
        char *ident_str;

        if (strcmp ("(GCC) ", pkgversion_string))
  	pkg_version = pkgversion_string;

        ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
        targetm.asm_out.output_ident (ident_str);
      }
  ```

ACKs for top commit:
  practicalswift:
    ACK 530d02a
  laanwj:
    ACK 530d02a

Tree-SHA512: b3b28f43ec483dee28d1df8548fe72425bf00e750701825c256395f6aa7b23256eb27609b51779b86aed108b6eaa3912181a9d8282e23eebf9cee7784f9fabe0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
530d02a build: pass -fno-ident in Windows gitian descriptor (fanquake)

Pull request description:

  `-fno-ident` prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

  For example, in the `v0.19.0.1` Windows release binaries, there are > 1000 GCC compiler version strings embedded:
  ```bash
  # GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
  strings bitcoind.exe | rg GCC | wc -l
      1021
  ```

  They end up collected in the end of the`.rdata` section, and cannot be removed by `strip`. i.e:

  ```bash
  objdump --section=.rdata --full-contents bitcoind.exe
  ...
   cfcc00 00000000 00000000 00000000 00000000  ................
   cfcc10 00000000 00000000 00000000 00000000  ................
   cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
   cfcc30 20323031 37303431 35000000 00000000   20170415.......
   cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
   cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...
  ```

  The flag is available for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident).

  Relevant code in [GCC](https://github.com/gcc-mirror/gcc/blob/master/gcc/toplev.c#L565-L578):
  ```c
    /* Attach a special .ident directive to the end of the file to identify
       the version of GCC which compiled this code.  The format of the .ident
       string is patterned after the ones produced by native SVR4 compilers.  */
    if (!flag_no_ident)
      {
        const char *pkg_version = "(GNU) ";
        char *ident_str;

        if (strcmp ("(GCC) ", pkgversion_string))
  	pkg_version = pkgversion_string;

        ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
        targetm.asm_out.output_ident (ident_str);
      }
  ```

ACKs for top commit:
  practicalswift:
    ACK 530d02a
  laanwj:
    ACK 530d02a

Tree-SHA512: b3b28f43ec483dee28d1df8548fe72425bf00e750701825c256395f6aa7b23256eb27609b51779b86aed108b6eaa3912181a9d8282e23eebf9cee7784f9fabe0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
530d02a build: pass -fno-ident in Windows gitian descriptor (fanquake)

Pull request description:

  `-fno-ident` prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

  For example, in the `v0.19.0.1` Windows release binaries, there are > 1000 GCC compiler version strings embedded:
  ```bash
  # GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
  strings bitcoind.exe | rg GCC | wc -l
      1021
  ```

  They end up collected in the end of the`.rdata` section, and cannot be removed by `strip`. i.e:

  ```bash
  objdump --section=.rdata --full-contents bitcoind.exe
  ...
   cfcc00 00000000 00000000 00000000 00000000  ................
   cfcc10 00000000 00000000 00000000 00000000  ................
   cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
   cfcc30 20323031 37303431 35000000 00000000   20170415.......
   cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
   cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...
  ```

  The flag is available for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident).

  Relevant code in [GCC](https://github.com/gcc-mirror/gcc/blob/master/gcc/toplev.c#L565-L578):
  ```c
    /* Attach a special .ident directive to the end of the file to identify
       the version of GCC which compiled this code.  The format of the .ident
       string is patterned after the ones produced by native SVR4 compilers.  */
    if (!flag_no_ident)
      {
        const char *pkg_version = "(GNU) ";
        char *ident_str;

        if (strcmp ("(GCC) ", pkgversion_string))
  	pkg_version = pkgversion_string;

        ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
        targetm.asm_out.output_ident (ident_str);
      }
  ```

ACKs for top commit:
  practicalswift:
    ACK 530d02a
  laanwj:
    ACK 530d02a

Tree-SHA512: b3b28f43ec483dee28d1df8548fe72425bf00e750701825c256395f6aa7b23256eb27609b51779b86aed108b6eaa3912181a9d8282e23eebf9cee7784f9fabe0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
530d02a build: pass -fno-ident in Windows gitian descriptor (fanquake)

Pull request description:

  `-fno-ident` prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

  For example, in the `v0.19.0.1` Windows release binaries, there are > 1000 GCC compiler version strings embedded:
  ```bash
  # GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
  strings bitcoind.exe | rg GCC | wc -l
      1021
  ```

  They end up collected in the end of the`.rdata` section, and cannot be removed by `strip`. i.e:

  ```bash
  objdump --section=.rdata --full-contents bitcoind.exe
  ...
   cfcc00 00000000 00000000 00000000 00000000  ................
   cfcc10 00000000 00000000 00000000 00000000  ................
   cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
   cfcc30 20323031 37303431 35000000 00000000   20170415.......
   cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
   cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...
  ```

  The flag is available for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident).

  Relevant code in [GCC](https://github.com/gcc-mirror/gcc/blob/master/gcc/toplev.c#L565-L578):
  ```c
    /* Attach a special .ident directive to the end of the file to identify
       the version of GCC which compiled this code.  The format of the .ident
       string is patterned after the ones produced by native SVR4 compilers.  */
    if (!flag_no_ident)
      {
        const char *pkg_version = "(GNU) ";
        char *ident_str;

        if (strcmp ("(GCC) ", pkgversion_string))
  	pkg_version = pkgversion_string;

        ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
        targetm.asm_out.output_ident (ident_str);
      }
  ```

ACKs for top commit:
  practicalswift:
    ACK 530d02a
  laanwj:
    ACK 530d02a

Tree-SHA512: b3b28f43ec483dee28d1df8548fe72425bf00e750701825c256395f6aa7b23256eb27609b51779b86aed108b6eaa3912181a9d8282e23eebf9cee7784f9fabe0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 14, 2021
530d02a build: pass -fno-ident in Windows gitian descriptor (fanquake)

Pull request description:

  `-fno-ident` prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

  For example, in the `v0.19.0.1` Windows release binaries, there are > 1000 GCC compiler version strings embedded:
  ```bash
  # GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
  strings bitcoind.exe | rg GCC | wc -l
      1021
  ```

  They end up collected in the end of the`.rdata` section, and cannot be removed by `strip`. i.e:

  ```bash
  objdump --section=.rdata --full-contents bitcoind.exe
  ...
   cfcc00 00000000 00000000 00000000 00000000  ................
   cfcc10 00000000 00000000 00000000 00000000  ................
   cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
   cfcc30 20323031 37303431 35000000 00000000   20170415.......
   cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
   cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...
  ```

  The flag is available for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident).

  Relevant code in [GCC](https://github.com/gcc-mirror/gcc/blob/master/gcc/toplev.c#L565-L578):
  ```c
    /* Attach a special .ident directive to the end of the file to identify
       the version of GCC which compiled this code.  The format of the .ident
       string is patterned after the ones produced by native SVR4 compilers.  */
    if (!flag_no_ident)
      {
        const char *pkg_version = "(GNU) ";
        char *ident_str;

        if (strcmp ("(GCC) ", pkgversion_string))
  	pkg_version = pkgversion_string;

        ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
        targetm.asm_out.output_ident (ident_str);
      }
  ```

ACKs for top commit:
  practicalswift:
    ACK 530d02a
  laanwj:
    ACK 530d02a

Tree-SHA512: b3b28f43ec483dee28d1df8548fe72425bf00e750701825c256395f6aa7b23256eb27609b51779b86aed108b6eaa3912181a9d8282e23eebf9cee7784f9fabe0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 14, 2021
530d02a build: pass -fno-ident in Windows gitian descriptor (fanquake)

Pull request description:

  `-fno-ident` prevents compilers from emitting compiler name and version number information that can needlessly bloat binaries.

  For example, in the `v0.19.0.1` Windows release binaries, there are > 1000 GCC compiler version strings embedded:
  ```bash
  # GCC: (GNU) 7.3-posix 20180312... & GCC: (GNU) 6.3.0 20170415.......
  strings bitcoind.exe | rg GCC | wc -l
      1021
  ```

  They end up collected in the end of the`.rdata` section, and cannot be removed by `strip`. i.e:

  ```bash
  objdump --section=.rdata --full-contents bitcoind.exe
  ...
   cfcc00 00000000 00000000 00000000 00000000  ................
   cfcc10 00000000 00000000 00000000 00000000  ................
   cfcc20 4743433a 2028474e 55292036 2e332e30  GCC: (GNU) 6.3.0
   cfcc30 20323031 37303431 35000000 00000000   20170415.......
   cfcc40 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc50 6f736978 20323031 38303331 32000000  osix 20180312...
   cfcc60 4743433a 2028474e 55292037 2e332d70  GCC: (GNU) 7.3-p
   cfcc70 6f736978 20323031 38303331 32000000  osix 20180312...
  ```

  The flag is available for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-qn) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-ident).

  Relevant code in [GCC](https://github.com/gcc-mirror/gcc/blob/master/gcc/toplev.c#L565-L578):
  ```c
    /* Attach a special .ident directive to the end of the file to identify
       the version of GCC which compiled this code.  The format of the .ident
       string is patterned after the ones produced by native SVR4 compilers.  */
    if (!flag_no_ident)
      {
        const char *pkg_version = "(GNU) ";
        char *ident_str;

        if (strcmp ("(GCC) ", pkgversion_string))
  	pkg_version = pkgversion_string;

        ident_str = ACONCAT (("GCC: ", pkg_version, version_string, NULL));
        targetm.asm_out.output_ident (ident_str);
      }
  ```

ACKs for top commit:
  practicalswift:
    ACK 530d02a
  laanwj:
    ACK 530d02a

Tree-SHA512: b3b28f43ec483dee28d1df8548fe72425bf00e750701825c256395f6aa7b23256eb27609b51779b86aed108b6eaa3912181a9d8282e23eebf9cee7784f9fabe0
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants