diff --git a/elf/Makefile b/elf/Makefile index 27d249b..c6626e1 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -119,7 +119,8 @@ $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force) endif tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \ - tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 + tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \ + tst-auxv tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \ tst-leaks1-static tst-array1-static tst-array5-static \ tst-ptrguard1-static diff --git a/elf/rtld.c b/elf/rtld.c index c5a6538..3d207a3 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1118,6 +1118,9 @@ of this helper program; chances are you did not intend to run this program.\n\ case AT_ENTRY: av->a_un.a_val = *user_entry; break; + case AT_EXECFN: + av->a_un.a_val = (uintptr_t) _dl_argv[0]; + break; } #endif } diff --git a/elf/tst-auxv.c b/elf/tst-auxv.c new file mode 100644 index 0000000..f9701c7 --- /dev/null +++ b/elf/tst-auxv.c @@ -0,0 +1,62 @@ +/* Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include /* For HAVE_AUX_VECTOR */ + +#ifdef HAVE_AUX_VECTOR + +static int +do_test (int argc, char *argv[]) +{ +# if _STACK_GROWS_DOWN + const int incr = 1; +# else + const int incr = -1; +# endif + + char **e = __environ; + ElfW (auxv_t) *aux; + + for (; *e != NULL; e += incr) + ; + + for (aux = (ElfW (auxv_t) *) (e + incr); aux->a_type != AT_NULL; aux += incr) + if (aux->a_type == AT_EXECFN) + { + return strcmp (argv[0], (char *) aux->a_un.a_val) ? 1 : 0; + } + + fprintf (stderr, "did not find AT_EXECFN in auxv[]\n"); + return 1; +} + +#else /* HAVE_AUX_VECTOR */ + +static int +do_test(int argc, char *argv[]) +{ + return 0; +} + +#endif /* HAVE_AUX_VECTOR */ + +#include "../test-skeleton.c"