From a4bf3d0720b1093dd148b7a728f92ce690a8a034 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Wed, 16 Jan 2019 13:37:35 -0800 Subject: Don't emit vendor attribute section if there is no attribute to emit. 2019-01-16 Kito Cheng 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 | 5 +++++ bfd/elf-attrs.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 529ac73..de44928 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,4 +1,9 @@ 2019-01-16 Kito Cheng + + * elf-attrs.c (vendor_obj_attr_size): Return 0 if size is 0 even + for OBJ_ATTR_PROC. + +2019-01-16 Kito Cheng Nelson Chu * elfnn-riscv.c (in_subsets): New. diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c index d238112..bfe135e 100644 --- a/bfd/elf-attrs.c +++ b/bfd/elf-attrs.c @@ -106,7 +106,7 @@ vendor_obj_attr_size (bfd *abfd, int vendor) size += obj_attr_size (list->tag, &list->attr); /* NUL 0x1 */ - return ((size || vendor == OBJ_ATTR_PROC) + return (size ? size + 10 + strlen (vendor_name) : 0); } -- cgit v1.1