htab_t section_hash_table;
/* The offset of this file. */
off_t base_offset;
+ /* List in linker order */
+ struct lto_section_list *list;
};
/* This is called for each section in the file. */
char *new_name;
struct lto_section_slot s_slot;
void **slot;
+ struct lto_section_list *list = loasd->list;
if (strncmp (name, LTO_SECTION_NAME_PREFIX,
strlen (LTO_SECTION_NAME_PREFIX)) != 0)
slot = htab_find_slot (section_hash_table, &s_slot, INSERT);
if (*slot == NULL)
{
- struct lto_section_slot *new_slot = XNEW (struct lto_section_slot);
+ struct lto_section_slot *new_slot = XCNEW (struct lto_section_slot);
new_slot->name = new_name;
new_slot->start = loasd->base_offset + offset;
new_slot->len = length;
*slot = new_slot;
+
+ if (list != NULL)
+ {
+ if (!list->first)
+ list->first = new_slot;
+ if (list->last)
+ list->last->next = new_slot;
+ list->last = new_slot;
+ }
}
else
{
the start and size of each section in the .o file. */
htab_t
-lto_obj_build_section_table (lto_file *lto_file)
+lto_obj_build_section_table (lto_file *lto_file, struct lto_section_list *list)
{
struct lto_simple_object *lo = (struct lto_simple_object *) lto_file;
htab_t section_hash_table;
gcc_assert (lo->sobj_r != NULL && lo->sobj_w == NULL);
loasd.section_hash_table = section_hash_table;
loasd.base_offset = lo->base.offset;
+ loasd.list = list;
errmsg = simple_object_find_sections (lo->sobj_r, lto_obj_add_section,
&loasd, &err);
if (errmsg != NULL)