Skip to content

patchelf breaks this Linux shared library #46

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

Closed
pkgw opened this issue May 8, 2015 · 9 comments
Closed

patchelf breaks this Linux shared library #46

pkgw opened this issue May 8, 2015 · 9 comments

Comments

@pkgw
Copy link

pkgw commented May 8, 2015

When I run patchelf --set-rpath '$ORIGIN' libgomp.so.1 (Git master) on this particular shared library:

http://newton.cx/~peter/files/libgomp.so.1 (86 K)

it does not report an error, but it apparently breaks the file. For instance, ldd libgomp.so.1 then reports "not a dynamic executable", and in one case loading the library yields an error of "failed to map segment from shared object".

There's probably something about this particular file where modifying the RPATH entry is not feasible, but in that case patchelf should exit with an error rather than breaking the file.

@darealshinji
Copy link
Contributor

This doesn't happen with Ubuntu's libgomp.so.1 so there's something about your library version that patchelf can't handle properly.
Here's the output of readelf -e libgomp.so.1: https://gist.github.com/darealshinji/40f8b34872bbb88feaf6
The first file is your libgomp.so.1, the second is from Ubuntu 14.04. Maybe that helps to find the error.

@pkgw
Copy link
Author

pkgw commented May 13, 2015

Well, I don't know anything about the ELF format, really. Probably the best way to find the error is to trace what patchelf is doing ... it must be overwriting an incorrect part of the file somehow, right?

There are a bunch of differences between the readelf outputs, but one that I noticed was that "Einstiegspunktadresse" is 0x3770 in the Ubuntu file and 0x3e7a804190 in my version ... those are pretty different values!

@edolstra
Copy link
Member

http://newton.cx/~peter/files/libgomp.so.1 gives a 404 BTW.

@pkgw
Copy link
Author

pkgw commented May 13, 2015

Whoops, I forgot that I needed to preserve that file! It's back up again.

@darealshinji
Copy link
Contributor

@pkgw I didn't realize that the output was still set to German. I've updated the files: https://gist.github.com/darealshinji/40f8b34872bbb88feaf6

@darealshinji
Copy link
Contributor

When there is not enough space left in the ELF's header to add or modify an entry then all the entries will be copied to the end of the file. Maybe that's causing the problems.

@probonopd
Copy link

How can we best debug this systematically?

@probonopd
Copy link

Similar to/same as #99?

@domenkozar
Copy link
Member

Closing as inactive.

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

No branches or pull requests

5 participants