Don't emit vendor attribute section if there is no attribute to emit.
authorJim Wilson <jimw@sifive.com>
Wed, 16 Jan 2019 21:37:35 +0000 (13:37 -0800)
committerJim Wilson <jimw@sifive.com>
Wed, 16 Jan 2019 21:37:35 +0000 (13:37 -0800)
2019-01-16  Kito Cheng  <kito@andestech.com>
bfd/
* elf-attrs.c (vendor_obj_attr_size): Return 0 if size is 0 even
for OBJ_ATTR_PROC.
gas/
* testsuite/gas/riscv/attribute-empty.d: New.

bfd/ChangeLog
bfd/elf-attrs.c
gas/ChangeLog
gas/testsuite/gas/riscv/attribute-empty.d [new file with mode: 0644]

index 529ac73cf9b5c5fbafe2e5bc529a3c24742414d4..de44928162c9e1470261723dbd5a27edfb3182cb 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-16  Kito Cheng  <kito@andestech.com>
+
+       * elf-attrs.c (vendor_obj_attr_size): Return 0 if size is 0 even
+       for OBJ_ATTR_PROC.
+
 2019-01-16  Kito Cheng  <kito@andestech.com>
            Nelson Chu  <nelson@andestech.com>
 
index d238112c49b49a4bd049e3f205669192911f1293..bfe135e7fbb6179b6d4c28436f31dcbd4a36de01 100644 (file)
@@ -106,7 +106,7 @@ vendor_obj_attr_size (bfd *abfd, int vendor)
     size += obj_attr_size (list->tag, &list->attr);
 
   /* <size> <vendor_name> NUL 0x1 <size> */
-  return ((size || vendor == OBJ_ATTR_PROC)
+  return (size
          ? size + 10 + strlen (vendor_name)
          : 0);
 }
index 3228342d4b789318ae890768ee65c099ad8d2096..cd80c48673c5b251b5be5d44558990981c59900c 100644 (file)
@@ -1,3 +1,7 @@
+2019-01-16  Kito Cheng  <kito@andestech.com>
+
+       * testsuite/gas/riscv/attribute-empty.d: New.
+
 2019-01-16  Kito Cheng  <kito@andestech.com>
            Nelson Chu  <nelson@andestech.com>
 
diff --git a/gas/testsuite/gas/riscv/attribute-empty.d b/gas/testsuite/gas/riscv/attribute-empty.d
new file mode 100644 (file)
index 0000000..4f0982a
--- /dev/null
@@ -0,0 +1,3 @@
+#as: -mno-arch-attr
+#readelf: -A
+#source: empty.s