forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user