for (; list != NULL; list = list->next)
{
/* There are 4 byte type + 4 byte datasz for each property. */
- size += 4 + 4 + list->property.pr_datasz;
+ unsigned int datasz;
+ if (list->property.pr_type == GNU_PROPERTY_STACK_SIZE)
+ datasz = align_size;
+ else
+ datasz = list->property.pr_datasz;
+ size += 4 + 4 + datasz;
/* Align each property. */
size = (size + (align_size - 1)) & ~(align_size - 1);
}
unsigned int align_size)
{
unsigned int descsz;
+ unsigned int datasz;
Elf_External_Note *e_note;
e_note = (Elf_External_Note *) contents;
for (; list != NULL; list = list->next)
{
/* There are 4 byte type + 4 byte datasz for each property. */
- bfd_h_put_32 (abfd, list->property.pr_type,
- contents + size);
- bfd_h_put_32 (abfd, list->property.pr_datasz,
- contents + size + 4);
+ if (list->property.pr_type == GNU_PROPERTY_STACK_SIZE)
+ datasz = align_size;
+ else
+ datasz = list->property.pr_datasz;
+ bfd_h_put_32 (abfd, list->property.pr_type, contents + size);
+ bfd_h_put_32 (abfd, datasz, contents + size + 4);
size += 4 + 4;
/* Write out property value. */
switch (list->property.pr_kind)
{
case property_number:
- switch (list->property.pr_datasz)
+ switch (datasz)
{
default:
/* Never should happen. */
/* Never should happen. */
abort ();
}
- size += list->property.pr_datasz;
+ size += datasz;
/* Align each property. */
size = (size + (align_size - 1)) & ~ (align_size - 1);
{
bfd_size_type size;
bfd_byte *contents;
- unsigned int align_size = bed->s->elfclass == ELFCLASS64 ? 8 : 4;
+ unsigned int align_size = elfclass == ELFCLASS64 ? 8 : 4;
sec = bfd_get_section_by_name (first_pbfd,
NOTE_GNU_PROPERTY_SECTION_NAME);
return NULL;
}
+ /* Fix up GNU properties. */
+ if (bed->fixup_gnu_properties)
+ bed->fixup_gnu_properties (info, &elf_properties (first_pbfd));
+
+ if (elf_properties (first_pbfd) == NULL)
+ {
+ /* Discard .note.gnu.property section if all properties have
+ been removed. */
+ sec->output_section = bfd_abs_section_ptr;
+ return NULL;
+ }
+
/* Compute the section size. */
list = elf_properties (first_pbfd);
size = elf_get_gnu_property_section_size (list, align_size);