diff options
author | Ian Lance Taylor <ian@airs.com> | 2008-04-10 01:02:46 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2008-04-10 01:02:46 +0000 |
commit | 2cefc35727da245c5b39b51551a488ba7f211689 (patch) | |
tree | 51af9f38d3b5cc096cb3060b5a7bd2bfda0663df /gold/testsuite | |
parent | a4bb589a17b1956f507e961ab998c09b8c54be5d (diff) | |
download | gdb-2cefc35727da245c5b39b51551a488ba7f211689.zip gdb-2cefc35727da245c5b39b51551a488ba7f211689.tar.gz gdb-2cefc35727da245c5b39b51551a488ba7f211689.tar.bz2 |
PR gold/5996
* script-sections.cc (Sections_element::allocate_to_segment): Add
orphan parameter.
(Output_section_definition::allocate_to_segment): Likewise.
(Orphan_output_section::allocate_to_segment): Likewise.
(Script_sections::attach_sections_using_phdrs_clause): Don't
propagate non-PT_LOAD segments to orphan sections.
* testsuite/Makefile.am (script_test_3.stdout): Generate using
readelf rather than objdump.
* testsuite/script_test_3.sh: Adjust accordingly. Test that
.interp section and PT_INTERP segment are the same size.
* testsuite/Makefile.in: Rebuild.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 2 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 2 | ||||
-rwxr-xr-x | gold/testsuite/script_test_3.sh | 35 |
3 files changed, 34 insertions, 5 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index ffb99c4..a27166e 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -692,7 +692,7 @@ MOSTLYCLEANFILES += script_test_3.stdout script_test_3: basic_test.o gcctestdir/ld script_test_3.t $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t script_test_3.stdout: script_test_3 - $(TEST_OBJDUMP) -p script_test_3 > script_test_3.stdout + $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout endif GCC endif NATIVE_LINKER diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index fea5a39..90f6d9e 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -1970,7 +1970,7 @@ uninstall-am: uninstall-info-am @GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_3: basic_test.o gcctestdir/ld script_test_3.t @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t @GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_3.stdout: script_test_3 -@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_OBJDUMP) -p script_test_3 > script_test_3.stdout +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/gold/testsuite/script_test_3.sh b/gold/testsuite/script_test_3.sh index 338e5ce..cddb69a 100755 --- a/gold/testsuite/script_test_3.sh +++ b/gold/testsuite/script_test_3.sh @@ -52,8 +52,37 @@ check_count() fi } -check_count script_test_3.stdout "INTERP off" 1 -check_count script_test_3.stdout "LOAD off" 3 -check_count script_test_3.stdout "DYNAMIC off" 1 +check_count script_test_3.stdout "^ INTERP" 1 +check_count script_test_3.stdout "^ LOAD" 3 +check_count script_test_3.stdout "^ DYNAMIC" 1 + +# Make sure that the size of the INTERP segment is the same as the +# size of the .interp section. +section=`fgrep .interp script_test_3.stdout | grep PROGBITS` +if test "$section" = ""; then + echo "Did not find .interp section" + echo "" + echo "Actual output below:" + cat script_test_3.stdout + exit 1 +fi +# Remove the brackets around the section number, since they can give +# an unpredictable number of fields. +section=`echo "$section" | sed -e 's/[][]*//g'` +section_size=`echo "$section" | awk '{ print $6; }'` + +segment=`grep '^ INTERP' script_test_3.stdout` +# We already checked above that we have an INTERP segment. +segment_size=`echo "$segment" | awk '{ print $5; }'` + +# Now $section_size looks like 000013 and $segment_size looks like +# 0x00013. Both numbers are in hex. +section_size=`echo "$section_size" | sed -e 's/^0*//'` +segment_size=`echo "$segment_size" | sed -e 's/^0x//' -e 's/^0*//'` + +if test "$section_size" != "$segment_size"; then + echo ".interp size $section_size != PT_INTERP size $segment_size" + exit 1 +fi exit 0 |