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

elfutils: add patch that fixes compilation under gcc8 #40705

Merged
merged 2 commits into from May 18, 2018

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
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

patches = [
./debug-info-from-env.patch
# From: https://patchwork.openembedded.org/patch/149575/
./0001-Ensure-that-packed-structs-follow-the-gcc-memory-lay.patch
Copy link
Contributor

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 <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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
Contributor

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
Contributor

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
Contributor

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
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants