Thanks Christopher - I've since posted to binutils mailing list and had
a helpful response.
Original post:
http://lists.gnu.org/archive/html/bug-binutils/2014-03/msg00076.html
Response:
http://lists.gnu.org/archive/html/bug-binutils/2014-03/msg00086.html
As you noted and is also clearly implied in feedback memory sections do
not overlap.
It's verified by examining flags for allegedly overlapping sections
using objdump utility.
As stated in the response, flags indicate that not all sections may be
residing in memory.
===========================================================================================================
On Fri, Mar 14, 2014 at 11:15:38AM +1100, Sam address at hidden wrote:
/ $ objdump -h airdac_.exe/
/ airdac_.exe: file format pei-i386/
/ Sections:/
/ Idx Name Size VMA LMA File off Algn/
/ 0 .text 008d8980 00401000 00401000 00000400 2**4/
/ CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA/
/ .../
/ 7 .debug_info 151e2063 028ca000 028ca000 024b3000 2**0 <==/ /VMA
and SIZE match-up with trace above/
/ CONTENTS, READONLY, DEBUGGING/
As you can see from the flags above, .debug_info is not ALLOC, LOAD.
This means the section is not loaded into memory and the VMA is
irrelevant. Another DLL could well occupy this space, because
airdac_.exe does not use that memory.
--
Alan Modra
Australia Development Lab, IBM
===========================================================================================================
This raises questions around how dumper determines what sections should
be excluded.
Dumper does this using the following function inside of
.../src/winsup/utils/parse_pe.cc:
...
73 select_data_section (bfd * abfd, asection * sect, PTR obj)
74 {
75 exclusion *excl_list = (exclusion *) obj;
76
77 if ((sect->flags & (SEC_CODE | SEC_DEBUGGING)) &&
78 sect->vma && bfd_get_section_size (sect))
79 {
80 excl_list->add ((LPBYTE) sect->vma, (SIZE_T)
bfd_get_section_size (sect));
81 deb_printf ("excluding section: %20s %08lx\n", sect->name,
82 bfd_get_section_size (sect));
83 }
84 }
...
As seen any section which is flagged as either CODE or DEBUGGING is
excluded from the dump.
Question is should this section test also check if it's resident in
memory i.e. code mod as follows?
...
77 if ((sect->flags & (SEC_CODE | SEC_DEBUGGING)) &&
78 (sect->flags & (SEC_LOAD | SEC_ALLOC)) && <==
CODE ADDITION
79 sect->vma && bfd_get_section_size (sect))
...
This would prevent overlaps in excl_list as tested sections resolving
true would have valid VMAs.
Regards,
Sam
On 12/03/14 15:39, Christopher Faylor wrote:
On Wed, Mar 12, 2014 at 03:03:52PM +1100, Sam Liapis at constrainttec dot com
wrote:
Thanks Corinna I appreciate the response.
Question 2: IS THE CODE MODIFICATION AN ACCEPTABLE SOLUTION TO THE PROBLEM?
> Maybe, but first it would be helpful if somebody could explain why
> sections should be able to overlap at all. That's puzzling me.
>
> As for patches, did you seehttp://cygwin.com/contrib.html
> For small, obvious patches, we don't need the copyright assignment.
> Rule of thumb is < 10 lines.
I'm happy to submit minor patches on both points covered in the original
post.
However as you noted I'll wait for someone to first explain if/why
sections overlap.
I doubt we'll get an answer here. Possibly someone in the binutils mailing
list would know but I think it's probably safe to assume that sections don't
overlap.
cgf
--
Problem reports:http://cygwin.com/problems.html
FAQ:http://cygwin.com/faq/
Documentation:http://cygwin.com/docs.html
Unsubscribe info:http://cygwin.com/ml/#unsubscribe-simple
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple