ld: add --package-metadata
[binutils-gdb.git] / bfd / elf.c
index c493aa5b172b1b6c64c3d79012013f5ee5f60336..468d37f5028fe78886c91bb7088edb13621a9425 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6779,8 +6779,12 @@ _bfd_elf_write_object_contents (bfd *abfd)
     return false;
 
   /* This is last since write_shdrs_and_ehdr can touch i_shdrp[0].  */
-  if (t->o->build_id.after_write_object_contents != NULL)
-    return (*t->o->build_id.after_write_object_contents) (abfd);
+  if (t->o->build_id.after_write_object_contents != NULL
+      && !(*t->o->build_id.after_write_object_contents) (abfd))
+    return false;
+  if (t->o->package_metadata.after_write_object_contents != NULL
+      && !(*t->o->package_metadata.after_write_object_contents) (abfd))
+    return false;
 
   return true;
 }