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

patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections #546

Open
akgrant43 opened this issue Mar 6, 2024 · 1 comment
Labels

Comments

@akgrant43
Copy link

Describe the bug

Attempting to patchelf a rust executable to run on NixOS and hitting the error from the subject:

$ patchelf --set-interpreter /nix/store/8mc30d49ghc8m5z96yz39srlhg5s9sjj-glibc-2.38-44/lib/ld-linux-x86-64.so.2 ./GlamorousToolkit-cli
patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections

$ patchelf --version
patchelf 0.18.0

A few notes:

  • The same error occurs with patchelf 0.15.0.
  • The command is being run on NixOS 23.11 (NixOS 23.11.20240304.617579a as I write this, but has been consistent since the problematic executables were built).
  • The executable is compiled on Ubuntu 20.04.

I've seen previous issues opened about this (#217, #255, #400) however they don't appear to be the same.

Steps To Reproduce

Download and unzip GlamorousToolkit-cli:

wget https://github.com/feenkcom/gtoolkit-vm/releases/download/v1.0.14/GlamorousToolkit-x86_64-unknown-linux-gnu.zip
unzip GlamorousToolkit-x86_64-unknown-linux-gnu.zip
cd bin

Find an interpreter (this is just for demo purposes, not production code):

GT_INTERPRETER=$(find /nix/store -name ld-linux-x86-64.so.2 | grep 2.38 | head -n 1)
echo $GT_INTERPRETER

attempt to patch the exe:

patchelf --set-interpreter $GT_INTERPRETER GlamorousToolkit-cli

The same issue occurs when attempting to to set the rpath.

Expected behavior

The executable is updated with the specified interpeter.

patchelf --version output

$ patchelf --version
patchelf 0.15.0

and

$ patchelf --version
patchelf 0.18.0

Additional context

None.

@akgrant43 akgrant43 added the bug label Mar 6, 2024
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/patchelf-cannot-normalize-pt-note-segment-non-contiguous-sht-note-sections/40561/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants