diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-10-30 00:13:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-10-30 00:13:29 +0000 |
commit | 5a384a9143afd73965e152cbbd13356b57d58c06 (patch) | |
tree | 9d8c5686a5509571361582d29afdf1fd97c32538 /elf | |
parent | 775106de7d28eed0139f76d76e7b1aab15d352df (diff) | |
download | glibc-5a384a9143afd73965e152cbbd13356b57d58c06.zip glibc-5a384a9143afd73965e152cbbd13356b57d58c06.tar.gz glibc-5a384a9143afd73965e152cbbd13356b57d58c06.tar.bz2 |
Update.
* elf/Makefile: Add rules to build and run tst-pathopt.
* elf/tst-pathopt.c: New file.
* elf/tst-pathopt.sh: New file.
* elf/pathoptobj.c: New file.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/Makefile | 15 | ||||
-rw-r--r-- | elf/pathoptobj.c | 5 | ||||
-rw-r--r-- | elf/tst-pathopt.c | 39 | ||||
-rwxr-xr-x | elf/tst-pathopt.sh | 36 |
4 files changed, 92 insertions, 3 deletions
diff --git a/elf/Makefile b/elf/Makefile index f35d3d4..6d7100e 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -53,14 +53,15 @@ distribute := $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \ nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \ nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \ reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \ - nextmod1.c nextmod2.c \ + nextmod1.c nextmod2.c pathoptobj.c \ neededobj1.c neededobj2.c neededobj3.c neededobj4.c \ unload2mod.c unload2dep.c ltglobmod1.c ltglobmod2.c include ../Makeconfig before-compile = $(objpfx)trusted-dirs.h -generated := trusted-dirs.h trusted-dirs.st +generated := trusted-dirs.h trusted-dirs.st for-renamed/renamed.so +generated-dirs := for-renamed ifeq ($(versioning),yes) ld-map = $(common-objpfx)ld.map @@ -99,6 +100,7 @@ tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ reldep reldep2 reldep3 next $(tests-nodelete-$(have-z-nodelete)) \ $(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \ neededtest3 unload2 lateglobal +test-srcs = tst-pathopt tests-vis-yes = vismain tests-nodelete-yes = nodelete tests-nodlopen-yes = nodlopen @@ -110,7 +112,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ $(modules-nodlopen-$(have-z-nodlopen)) filtmod1 filtmod2 \ reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \ neededobj1 neededobj2 neededobj3 neededobj4 \ - unload2mod unload2dep ltglobmod1 ltglobmod2 + unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj modules-vis-yes = vismod1 vismod2 vismod3 modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4 modules-nodlopen-yes = nodlopenmod @@ -240,6 +242,8 @@ CFLAGS-cache.c = $(SYSCONF-FLAGS) test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names)))) generated += $(addsuffix .so,$(strip $(modules-names))) +tests: $(objpfx)tst-pathopt.out + $(objpfx)testobj1.so: $(libdl) $(objpfx)testobj1_1.so: $(objpfx)testobj1.so $(libdl) $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl) @@ -371,3 +375,8 @@ $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so $(objpfx)lateglobal: $(libdl) $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so + +$(objpfx)tst-pathopt: $(libdl) +$(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \ + $(objpfx)pathoptobj.so + $(SHELL) -e $< $(common-objpfx) diff --git a/elf/pathoptobj.c b/elf/pathoptobj.c new file mode 100644 index 0000000..fd0618e --- /dev/null +++ b/elf/pathoptobj.c @@ -0,0 +1,5 @@ +int +in_renamed (int a) +{ + return a - 10; +} diff --git a/elf/tst-pathopt.c b/elf/tst-pathopt.c new file mode 100644 index 0000000..1f7aac2 --- /dev/null +++ b/elf/tst-pathopt.c @@ -0,0 +1,39 @@ +#include <dlfcn.h> +#include <mcheck.h> +#include <stdio.h> +#include <stdlib.h> + + +int +main (void) +{ + void *h; + int (*fp) (int); + int result; + + mtrace (); + + h = dlopen ("renamed.so", RTLD_LAZY); + if (h == NULL) + { + printf ("failed to load \"%s\": %s\n", "renamed.so", dlerror ()); + exit (1); + } + + fp = dlsym (h, "in_renamed"); + if (fp == NULL) + { + printf ("lookup of \"%s\" failed: %s\n", "in_renamed", dlerror ()); + exit (1); + } + + result = fp (10); + + if (dlclose (h) != 0) + { + printf ("failed to close \"%s\": %s\n", "renamed.so", dlerror ()); + exit (1); + } + + return result; +} diff --git a/elf/tst-pathopt.sh b/elf/tst-pathopt.sh new file mode 100755 index 0000000..7a5c8f1 --- /dev/null +++ b/elf/tst-pathopt.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Test lookup path optimization. +# Copyright (C) 2000 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 Library General Public License as +# published by the Free Software Foundation; either version 2 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with the GNU C Library; see the file COPYING.LIB. If +# not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +common_objpfx=$1 +run_program_prefix=$2 + +test -e ${common_objpfx}elf/will-be-empty && + rm -fr ${common_objpfx}elf/will-be-empty +test -d ${common_objpfx}elf/for-renamed || + mkdir ${common_objpfx}elf/for-renamed + +cp ${common_objpfx}elf/pathoptobj.so ${common_objpfx}elf/for-renamed/renamed.so + +LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \ +LC_ALL=C LD_LIBRARY_PATH=${common_objpfx}elf/will-be-empty:${common_objpfx}elf/for-renamed:${common_objpfx}.:${common_objpfx}dlfcn \ + ${common_objpfx}elf/ld.so ${common_objpfx}elf/tst-pathopt \ + > ${common_objpfx}elf/tst-pathopt.out + +exit $? |