This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Removing empty sections from elf_bfd_discard_info


Hi!

I found one more problem with the --eh-frame-hdr patch, which is common
to the stabs optimization code as well (where I copied it from).
  if (sec->_cooked_size == 0)
    sec->flags |= SEC_EXCLUDE;
really doesn't work at all, section sizing code in ld doesn't care about
this. Neither works setting sec->output_section to bfd_abs_section_ptr.

What do you think is best to tackle this?

As this is not the first time I'm having problems with this (the first time
with SHF_MERGE patches early this year), I'd prefer an invasive patch of
changing the meaning of _cooked_size. Currently, 0 means _cooked_size was
not set, use _raw_size, which clashes with desired size of 0.
IMHO it would be far better to use some magic value, BFD_NO_COOKED_SIZE
or whatever ((bfd_size_type) -1 seems like a good value) and make
_cooked_size 0 be really that the section adds 0 bytes; perhaps also add
some macro BFD_SET_COOKED_SIZE(sec) which would do the very common:
if ((sec)->_cooked_size == BFD_NO_COOKED_SIZE)
  (sec)->_cooked_size = (sec)->_raw_size

Alternatively, ldlang.c would need to be changed to cope with SEC_EXCLUDE
and ldwrite.c allow output_section not to match output_statement section
if it is bfd_abs_section.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]