Don't emit vendor attribute section if there is no attribute to emit.

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.
This commit is contained in:
Jim Wilson 2019-01-16 13:37:35 -08:00
parent 7d7a7d7ccf
commit a4bf3d0720
4 changed files with 13 additions and 1 deletions

View 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>

View 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);
}

View 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>

View File

@ -0,0 +1,3 @@
#as: -mno-arch-attr
#readelf: -A
#source: empty.s