Skip to content

elfutils: add patch that fixes compilation under gcc8#40705

Merged
xeji merged 2 commits intoNixOS:gcc8from
Synthetica9:elfutils-gcc8-fix
May 18, 2018
Merged

elfutils: add patch that fixes compilation under gcc8#40705
xeji merged 2 commits intoNixOS:gcc8from
Synthetica9:elfutils-gcc8-fix

Conversation

@Synthetica9
Copy link
Member

Motivation for this change

Was failing: https://hydra.nixos.org/build/73828348/nixlog/2

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Synthetica9 Synthetica9 changed the title elfutil: add patch that fixes compilation under gcc8 elfutils: add patch that fixes compilation under gcc8 May 17, 2018
@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. labels May 17, 2018
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: elfutils

Partial log (click to expand)

shrinking /nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170/lib/elfutils/libebl_arm-0.170.so
shrinking /nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170/lib/elfutils/libebl_bpf-0.170.so
shrinking /nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170/lib/libelf-0.170.so
shrinking /nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170/lib/libdw-0.170.so
strip is /nix/store/85wqgd5aj4g57g1fsrnmdbq4mf1kz957-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170/lib  /nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170/bin
patching script interpreter paths in /nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170
/nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170/bin/eu-make-debug-archive: interpreter directive changed from "/bin/sh" to "/nix/store/sq6jb5limj5dsxbglam036fnvlfmn81f-bash-4.4-p19/bin/sh"
checking for references to /build in /nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170...
/nix/store/npf2h77rgvj9wpysg0p5fqgfb6abda2p-elfutils-0.170

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: elfutils

Partial log (click to expand)

shrinking /nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170/lib/elfutils/libebl_i386-0.170.so
shrinking /nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170/lib/libasm-0.170.so
shrinking /nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170/lib/libdw-0.170.so
shrinking /nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170/lib/libelf-0.170.so
strip is /nix/store/ks7k1wdljx2knaayzr528cwbj6v970km-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170/lib  /nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170/bin
patching script interpreter paths in /nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170
/nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170/bin/eu-make-debug-archive: interpreter directive changed from "/bin/sh" to "/nix/store/xdzakdwslnr0skxr9y6lr475c8sra4h1-bash-4.4-p19/bin/sh"
checking for references to /build in /nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170...
/nix/store/vzh7alpbbnhd18ymxfr4qbwy746mvxi2-elfutils-0.170

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use

# From: https://patchwork.openembedded.org/patch/149575/
(fetchpatch {
  name = "0001-Ensure-that-packed-structs-follow-the-gcc-memory-lay.patch";
  url = https://patchwork.openembedded.org/patch/149575/raw/;
  sha256 = "0000000000000000000000000000000000000000000000000000000000000000";
})

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that also possible if it's a patch within a patch? (The patch that is linked adds a patch file, it isn't just the patch)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant part of the linked patch:

diff --git a/meta/recipes-devtools/elfutils/files/0001-Ensure-that-packed-structs-follow-the-gcc-memory-lay.patch b/meta/recipes-devtools/elfutils/files/0001-Ensure-that-packed-structs-follow-the-gcc-memory-lay.patch
new file mode 100644
index 0000000000..cf4d1dfe75
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0001-Ensure-that-packed-structs-follow-the-gcc-memory-lay.patch
@@ -0,0 +1,34 @@ 
+From 732913a8c35c7b25c0cbf6903cab1ad6b602b525 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 22 Mar 2018 22:44:03 -0700
+Subject: [PATCH] Ensure that packed structs follow the gcc memory layout
+
+Partial backport of
+https://sourceware.org/git/?p=elfutils.git;a=commit;h=17d7194d291bf91d130b78e06cbe27b290e0376d
+
+Helps fixing alignment errors e.g.
+linux-core-note.c:116:1: error: alignment 2 of 'struct m68k_prstatus
+' is less than 4 [-Werror=packed-not-aligned]
+ ;
+ ^
+
+Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=17d7194d291bf91d130b78e06cbe27b290e0376d]
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ backends/linux-core-note.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c
+index 5f06c896..9faae4c3 100644
+--- a/backends/linux-core-note.c
++++ b/backends/linux-core-note.c
+@@ -111,7 +111,7 @@ struct EBLHOOK(prstatus)
+   FIELD (INT, pr_fpvalid);
+ }
+ #ifdef ALIGN_PRSTATUS
+-  __attribute__ ((packed, aligned (ALIGN_PRSTATUS)))
++  attribute_packed __attribute__ ((aligned (ALIGN_PRSTATUS)))
+ #endif
+ ;
+ 

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: elfutils

Partial log (click to expand)

shrinking /nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170/lib/elfutils/libebl_arm-0.170.so
shrinking /nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170/lib/elfutils/libebl_bpf-0.170.so
shrinking /nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170/lib/libelf-0.170.so
shrinking /nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170/lib/libdw-0.170.so
strip is /nix/store/85wqgd5aj4g57g1fsrnmdbq4mf1kz957-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170/lib  /nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170/bin
patching script interpreter paths in /nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170
/nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170/bin/eu-make-debug-archive: interpreter directive changed from "/bin/sh" to "/nix/store/sq6jb5limj5dsxbglam036fnvlfmn81f-bash-4.4-p19/bin/sh"
checking for references to /build in /nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170...
/nix/store/cj8pd8zlpxma7i59msgag11pwdcms5iz-elfutils-0.170

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: elfutils

Partial log (click to expand)

shrinking /nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170/lib/elfutils/libebl_i386-0.170.so
shrinking /nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170/lib/libasm-0.170.so
shrinking /nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170/lib/libdw-0.170.so
shrinking /nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170/lib/libelf-0.170.so
strip is /nix/store/ks7k1wdljx2knaayzr528cwbj6v970km-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170/lib  /nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170/bin
patching script interpreter paths in /nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170
/nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170/bin/eu-make-debug-archive: interpreter directive changed from "/bin/sh" to "/nix/store/xdzakdwslnr0skxr9y6lr475c8sra4h1-bash-4.4-p19/bin/sh"
checking for references to /build in /nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170...
/nix/store/fg9k0dmzvyn2hiwxxdvqvvhxvhfiz664-elfutils-0.170

@Synthetica9
Copy link
Member Author

@jtojnar Better?

patches = ./debug-info-from-env.patch;
patches = [
./debug-info-from-env.patch
(fetchpatch {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetchurl should be enough here, it is just a static file.

url = http://git.openembedded.org/openembedded-core/plain/meta/recipes-devtools/elfutils/files/0001-Ensure-that-packed-structs-follow-the-gcc-memory-lay.patch?id=49aae1d75ff1c6a9643c30a8cc5776a2ffa83dd3;
sha256 = "09y4x1yaqm84w7cy1sf57a6g8ah49b0349dsj2a81wy4flw8ih5j";
})
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please dedent this.

patches = ./debug-info-from-env.patch;
patches = [
./debug-info-from-env.patch
(fetchpatch {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep the source comment, or mention that it is for GCC 8, or something

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: elfutils

Partial log (click to expand)

shrinking /nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170/bin/eu-ar
shrinking /nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170/bin/eu-unstrip
shrinking /nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170/bin/eu-stack
shrinking /nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170/bin/eu-elfcompress
strip is /nix/store/85wqgd5aj4g57g1fsrnmdbq4mf1kz957-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170/lib  /nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170/bin
patching script interpreter paths in /nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170
/nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170/bin/eu-make-debug-archive: interpreter directive changed from "/bin/sh" to "/nix/store/sq6jb5limj5dsxbglam036fnvlfmn81f-bash-4.4-p19/bin/sh"
checking for references to /build in /nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170...
/nix/store/mycsi0qc9hjgzvl4j3dkfnnd0y58qflr-elfutils-0.170

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: elfutils

Partial log (click to expand)

shrinking /nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170/lib/elfutils/libebl_i386-0.170.so
shrinking /nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170/lib/libasm-0.170.so
shrinking /nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170/lib/libdw-0.170.so
shrinking /nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170/lib/libelf-0.170.so
strip is /nix/store/ks7k1wdljx2knaayzr528cwbj6v970km-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170/lib  /nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170/bin
patching script interpreter paths in /nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170
/nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170/bin/eu-make-debug-archive: interpreter directive changed from "/bin/sh" to "/nix/store/xdzakdwslnr0skxr9y6lr475c8sra4h1-bash-4.4-p19/bin/sh"
checking for references to /build in /nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170...
/nix/store/f8hzbrz6xw822hfdzvw0j8g7m95mcxrv-elfutils-0.170

@xeji xeji merged commit b12448c into NixOS:gcc8 May 18, 2018
lheckemann added a commit that referenced this pull request Sep 7, 2019
adrianpk added a commit to adrianpk/nixpkgs that referenced this pull request May 31, 2024
* elfutils: add patch that fixes compilation under gcc8

* elfutils: follow advice from @jtojnar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants