This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [RFA] Coff SEC_LOAD vs SEC_NEVER_LOAD
"Svein E. Seldal" <Svein.Seldal@solidas.com> writes:
> Ian Lance Taylor wrote:
> > It gets turned on for COFF STYP_NOLOAD sections, and for output
> > sections marked as NOLOAD in linker scripts.
>
> Well, that is my headache right now. ld does not turn on the
> STYP_NOLOAD regardless of NOLOAD's use or not. A quick debug of ld
> reveals that the sec_to_styp_flags() convertion function in bfd is
> called with the value 0, which is incorrect for this section.
>
> Yet earlier on, lang_enter_output_section_statement() in ld is called
> for each segment and returns 0x400 for those segments which uses the
> NOLOAD statement. So somewhere inbetween something is filtering our
> flags.
lang_enter_output_section_statement() sets a value in a
lang_output_section_statement struct, not in an asection. So I guess
the question is the SEC_NEVER_LOAD doesn't move to the output asection
struct. I would expect that to happen in lang_add_section(), when the
output section is created via a call to init_os().
> BTW. This is correct linkscript syntax, right:
> .dummy (NOLOAD) : { . += 0x2; }
Looks about right to me.
> When it comes to the gdb bug, I found this construct:
>
> if (bfd_get_section_flags (abfd, asec) & SEC_LOAD)
>
> Would you reccommend submitting a patch to gdb which would exclude the
> segments with SEC_NEVER_LOAD?
>
> -or-
>
> Modify the entire BFD and do s/SEC_NEVER_LOAD/!SEC_LOAD/? This is a
> big job that I'm not feeling called to do....
I think I would recommend none of the above. If you can get
SEC_NEVER_LOAD to be set for your output section, then I would expect
STYP_NOLOAD to be set in the COFF file. Then there is some chance
that SEC_LOAD will not be set when gdb reads the file. If SEC_LOAD is
still set for a STYP_NOLOAD section, that might be a bug.
Ian