This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD] Relayout?
"Doug Kwan (éæå)" <dougkwan@google.com> writes:
> I would like to do layout multiple times for stub generation on
> ARM.
This does not make sense conceptually, at least in my concept of layout.
When we reach Layout::finalize, the linker is supposed to know the final
sizes of all normal sections. Layout::finalize then handles creating
the symbol table, the dynamic section and so forth. Running that code
again does not make sense.
What you are after is a kind of relaxation. I think that is just two
parts of Layout::finalize, the first of which is only really relevant if
there is a linker script with a SECTIONS clause:
// If there is a SECTIONS clause, put all the input sections into
// the required order.
Output_segment* load_seg;
if (this->script_options_->saw_sections_clause())
load_seg = this->set_section_addresses_from_script(symtab);
else if (parameters->options().relocatable())
load_seg = NULL;
else
load_seg = this->find_first_load_seg();
and
// Set the file offsets of all the segments, and all the sections
// they contain.
off_t off;
if (!parameters->options().relocatable())
off = this->set_segment_offsets(target, load_seg, &shndx);
else
off = this->set_relocatable_section_offsets(file_header, &shndx);
So I don't think unfinalize is conceptually the way to go. I think the
right approach is going to be along the lines of doing the first step of
finalization (compute the dynamic symbol table, et. al.), then a loop
which sets section addresses and calls a target specific relaxation
routine, then the last step of finalization (compute the regular symbol
table, et. al.).
Ian