Date: Tue, 16 May 2017 20:38:56 -0400 From: John Regan <saxindustries@...il.com> To: musl@...ts.openwall.com Subject: Question about setting argv when manually using dynamic linker Hi there - I was wondering if it's possible to somehow set argv when calling the dynamic linker to load a program. The reason I want to do this (in case there's a better way) - I was looking into compiling programs with musl libc, and distributing the binaries with the needed libc.so file, so I could have a directory structure like: /bin | app /lib | libc.so | some_other_lib.so I can set the rpath to $ORIGIN/../lib so the whole folder is relocatable, but as far as i know, there's no equivalent concept for setting the dynamic linker with a path that's relative to the binary. My current idea is to have a wrapper script, so my structure would be something like: /bin | app.bin <- actual binary | app /lib | libc.so | some_other_lib.so The 'app' script could find the actual, absolute path to itself and figure out where libc.so is, ending with a line like exec /path/to/libc.so /path/to/app.bin arg1 arg2 etc I'd like to retain whatever was actually typed on the command line (in this case, set argv to "app"), since many apps look at argv to change behavior, ie - gzip vs gunzip. I tried seeing if there was some switch I could pass to the linker, etc - as far as I can tell, there's no easy way to do this. Thanks in advance!! -John Regan Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.