From 5129fff43c4fe08cb17d8789b8a5c778039a25c3 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Sun, 8 Jun 2003 16:45:50 +0000 Subject: [PATCH] More symbol scan logic from Alan Burlison. p4raw-id: //depot/perl@19709 --- Configure | 22 +++++++++++++++------- Porting/Glossary | 8 ++++++++ hints/solaris_2.sh | 3 +++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Configure b/Configure index 8e2a765..ed90386 100755 --- a/Configure +++ b/Configure @@ -1124,6 +1124,7 @@ uselargefiles='' uselongdouble='' usemorebits='' usemultiplicity='' +mistrustnm='' nm_opt='' nm_so_opt='' runnm='' @@ -7358,7 +7359,7 @@ csym='tlook=$1; case "$3" in -v) tf=libc.tmp; tc=""; tdc="";; -a) tf=libc.tmp; tc="[0]"; tdc="[]";; -*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";; +*) tlook="^$1\$"; tf=libc.list; tc=""; tdc="()";; esac; tx=yes; case "$reuseval-$4" in @@ -7368,14 +7369,20 @@ esac; case "$tx" in yes) tval=false; - if $test "$runnm" = "true" && $contains $tlook $tf >/dev/null 2>&1; then - tval=true; - else - echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c; - if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1; then + if $test "$runnm" = true; then + if $contains $tlook $tf >/dev/null 2>&1; then tval=true; + elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then + echo "int main() { extern void *$1$tdc; return(&$1$tc ? 0 : 1); }" > try.c; + $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true; + $test "$mistrustnm" = run -a -x try && { $run ./try >/dev/null 2>&1 || tval=false; }; + $rm -f try try.c core; fi; - $rm -f t t.c; + else + echo "#include " > try.c; + echo "int main() { extern void *$1$tdc; return(&$1$tc ? 0 : 1); }" > try.c; + $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true; + $rm -f try try.c; fi; ;; *) @@ -21154,6 +21161,7 @@ man3dir='$man3dir' man3direxp='$man3direxp' man3ext='$man3ext' mips_type='$mips_type' +mistrustnm='$mistrustnm' mkdir='$mkdir' mmaptype='$mmaptype' modetype='$modetype' diff --git a/Porting/Glossary b/Porting/Glossary index b5b24a9..771820a 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -3508,6 +3508,14 @@ mips_type (usrinc.U): This variable holds the environment type for the mips system. Possible values are "BSD 4.3" and "System V". +mistrustnm (usenm.U): + This variable can be used to establish a fallthrough for the cases + where nm fails to find a symbol. If usenm is false or usenm is true + and mistrustnm is false, this variable has no effect. If usenm is true + and mistrustnm is "compile", a test program will be compiled to try to + find any symbol that can't be located via nm lookup. If mistrustnm is + "run", the test program will be run as well as being compiled. + mkdir (Loc.U): This variable is used internally by Configure to determine the full pathname (if any) of the mkdir program. After Configure runs, diff --git a/hints/solaris_2.sh b/hints/solaris_2.sh index 75e55f7..bc49dae 100644 --- a/hints/solaris_2.sh +++ b/hints/solaris_2.sh @@ -23,6 +23,9 @@ # Solaris has secure SUID scripts d_suidsafe=${d_suidsafe:-define} +# Be paranoid about nm failing to find symbols +mistrustnm=run + # Several people reported problems with perl's malloc, especially # when use64bitall is defined or when using gcc. # http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-01/msg01318.html -- 2.7.4