diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-07-05 18:01:53 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-07-05 18:01:53 +0000 |
commit | 5e3b36f8799d7928f5c5ac5e871c0968b5874369 (patch) | |
tree | 819e2ed544aa1320a504ea740f2435ba9a6a395c /gdb/testsuite/gdb.base/prelink.exp | |
parent | 86e4bafc3b0bb0148b95807d37b36aae14cdf56c (diff) | |
download | gdb-5e3b36f8799d7928f5c5ac5e871c0968b5874369.zip gdb-5e3b36f8799d7928f5c5ac5e871c0968b5874369.tar.gz gdb-5e3b36f8799d7928f5c5ac5e871c0968b5874369.tar.bz2 |
gdb/testsuite/
* gdb.base/attach-pie-misread.exp: Load prelink-support.exp. Replace
build_executable by build_executable_own_libs. Replace "prelink -R"
execution by a call of prelink_yes. Comment why "prelink -r" needs no
change.
* gdb.base/break-interp.exp: Load prelink-support.exp. Rename calls of
copy to file_copy. Move setting opts --dynamic-linker and -rpath,
mkdir $dir and ldd its parsing and copying to lib/prelink-support.exp.
Replace build_executable by build_executable_own_libs's function
build_executable_own_libs.
(prelinkNO): Create new stub to call prelink_no.
(prelinkYES): Create new stub to call prelink_yes.
(test_attach): Rename calls of copy to file_copy.
(section_get, prelinkNO_run, prelinkNO, prelinkYES, symlink_resolve)
(copy): Move to ...
* lib/prelink-support.exp: ... a new file. Rename prelinkNO to
prelink_no, prelinkYES to prelink_yes, copy to file_copy.
* gdb.base/prelink.exp: Disable testcase also for is_remote and
skip_shlib_tests. Load prelink-support.exp. Replace gdb_compile with
special flags by gdb_compile_shlib. Replace second gdb_compile by
build_executable_own_libs. Replace "prelink -R" execution by a call of
prelink_yes. Replace "prelink -u" and second "prelink -R" execution by
a second call of prelink_yes. Replace restart commands by
clean_restart.
(prelink): Rename to ...
(seen displacement message): ... this test. Extend its expectation
strictness.
Diffstat (limited to 'gdb/testsuite/gdb.base/prelink.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/prelink.exp | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/gdb/testsuite/gdb.base/prelink.exp b/gdb/testsuite/gdb.base/prelink.exp index 1803a80..8931c9f 100644 --- a/gdb/testsuite/gdb.base/prelink.exp +++ b/gdb/testsuite/gdb.base/prelink.exp @@ -23,8 +23,7 @@ if $tracelevel then { } -# are we on a target board -if ![isnative] then { +if { ![isnative] || [is_remote host] || [skip_shlib_tests]} { return } @@ -36,32 +35,31 @@ if {$gcc_compiled == 0} { return -1 } +load_lib prelink-support.exp + set testfile "prelink" set libsrcfile ${testfile}-lib.c set libfile ${objdir}/${subdir}/${testfile}.so -if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} { + +# Use -soname so that the new library gets copied by build_executable_own_libs. + +if { [gdb_compile_shlib "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" [list debug "additional_flags=-Wl,-soname,[file tail ${libfile}]"]] != ""} { # If creating the shared library fails, maybe we don't have the right tools return -1 } -# `--no-exec-shield' is for i386 where prelink in the exec-shield mode is -# forced to push all the libraries tight together to fit into the first two -# memory areas (either the ASCII Shield area or at least below the executable). -# In this case its -R option cannot be applied and we falsely FAIL here as if -# the system is already prelinked prelink has no choice how to randomize the -# single new unprelinked library address without wasting the first one/two -# memory areas. We do not care of the efficiency of loading such resulting -# exec-shield unfriendly prelinked library. -if {[catch "system \"prelink -qNR --no-exec-shield ${libfile}\""] != 0} { - # Maybe we don't have prelink. +set srcfile ${testfile}.c +set executable ${testfile}t +set binfile ${objdir}/${subdir}/${executable} +set prelink_args [build_executable_own_libs ${testfile}.exp $executable $srcfile [list debug "additional_flags=-Wl,${libfile},-rpath,[file dirname ${libfile}]"]] +if {$prelink_args == ""} { return -1 } -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile}t -if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${libfile}" "${binfile}" executable [list debug "additional_flags=-Wl,-rpath,${objdir}/${subdir}"]] != ""} { - return -1; +if ![prelink_yes $prelink_args] { + # Maybe we don't have prelink. + return -1 } set found 0 @@ -94,20 +92,16 @@ if { $found == 0 } { return 0 } -if {[catch "system \"prelink -uN ${libfile}\""] != 0} { - untested "${testfile}.so was not prelinked, maybe system libraries are not prelinked?" - return 0 +# Relink $libfile to a different address. +if ![prelink_yes $prelink_args] { + return -1 } -catch "system \"prelink -qNR --no-exec-shield ${libfile}\"" # Start with a fresh gdb -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart $executable # Print the "adjusting expectations" message. gdb_test_no_output "set verbose on" -gdb_test "core-file $objdir/$subdir/prelink.core" {Using PIC \(Position Independent Code\) prelink displacement.*} "prelink" +gdb_test "core-file $objdir/$subdir/prelink.core" "Using PIC \\(Position Independent Code\\) prelink displacement 0x\[^0\]\[0-9a-f\]* for \[^\r\n\]*[file tail ${libfile}].*" "seen displacement message" |