Date: Tue, 5 Jan 2016 13:23:26 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: dynamic linker command line invocation On Tue, Jan 05, 2016 at 01:00:37PM -0500, N Jain wrote: > > You never answered whether > > you were setting up the aux vector right, but if not, that's > > definitely going to cause problems. > > I am not setting any aux vectors. I only pass argv = "app.elf" and argc = 1 > to dynamic linker. > What and where I need to set "aux" vectors ? Any pointers will help.. The ELF entry point ABI is that the initial stack pointer points to an array of word-sized cells containing: argc argv argv ... argv[argc-1] argv[argc](=0) anviron environ ... 0 auxv.key auxv.val auxv.key auxv.val ... 0 The auxv items are key,val pairs where the key is one of the AT_* constants from elf.h and the value is either an integer or pointer (depending on which key it's for). At the very least you should be passing: AT_PHDR - points to the start of elf program headers AT_PHENT - size of each program header AT_PHNUM - number of program headers If you load both the main program and "interpreter" (dynamic linker) from the kernel, then these values should be for the main program's headers, and in addition you need to pass: AT_BASE - load address of the "interpreter" (dynamic linker) AT_ENTRY - entry point address of the main program, from its header On the other hand, if you only load the dynamic linker (treating it as the main program), then the program header auxv entries should hold the right values for the dynamic linker. Rich
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.