binutils-gdb/ld/testsuite
Nelson Chu 39ff0b8123 RISC-V: Report warning when linking the objects with different priv specs.
We do know some conflicts among different privileged specs.  For linker,
the safest approach is that don't allow the object linked with others which
may cause conflicts.  But this may cause inconvenience since not all objects
with conflicting priv specs are linked will cause problems.  But it is hard
to know the detailed conflict cases for linker, so we probably need a option
to tell linker that we do know there are no conflicts, or we are willing to
take risks to link the objects with conflicted priv specs.  But the option
is still under discussion.

Therefore, we can report warnings rather than errors when linking the objects
with conflicted priv specs.  This not only makes the linker more flexible,
but also warns people that the conflicts may happen.  We also need to update
the output priv spec version once the input priv spec is newer.

	bfd/
	* elfxx-riscv.c (struct priv_spec_t priv_specs[]): Move them from
	opcodes/riscv-opc.c to bfd/elfxx-riscv.c, since we need it in linker.
	(riscv_get_priv_spec_class): Likewise.
	(riscv_get_priv_spec_name): Likewise.
	(riscv_get_priv_spec_class_from_numbers): New function, convert
	the version numbers into string, then call riscv_get_priv_spec_class
	to get the priv spec class.
	* elfxx-riscv.h (riscv_get_priv_spec_class): Move forward declaration
	from include/opcode/riscv.h to bfd/elfxx-riscv.h.
	(riscv_get_priv_spec_name): Likewise.
	(riscv_get_priv_spec_class_from_numbers): New forward declaration.
	(opcode/riscv.h): Include it in the header rather than elfxx-riscv.c.
	* elfnn-riscv.c (riscv_merge_attributes):  Get the priv spec classes
	of input and output objects form their priv spec attributes by
	riscv_get_priv_spec_class_from_numbers.  Report warning rather than
	errors when linking objects with differnet priv spec versions.  We do
	know v1.9.1 may have conflicts to other versions, so report the
	warning, too.  After that, update the output priv spec version to the
	newest one so far.

	gas/
	* config/tc-riscv.c (buf_size, buf): Remove the unused variables.
	(riscv_set_default_priv_spec): Get the priv spec version from the
	priv spec attributes by riscv_get_priv_spec_class_from_numbers.

	include/
	* opcode/riscv.h (riscv_get_priv_spec_class): Move the function
	forward declarations to bfd/elfxx-riscv.h.
	(riscv_get_priv_spec_name): Likewise.

	opcodes/
	* riscv-opc.c: Move the structures and functions to bfd/elfxx-riscv.c.
	* riscv-dis.c: Include elfxx-riscv.h.

	ld/
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Updated.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Updated.
2020-06-22 10:01:14 +08:00
..
config Emit a warning when -z relro is unsupported 2020-06-19 09:50:20 +09:30
ld-aarch64
ld-alpha ecoff testsuite fixes 2020-06-20 10:59:11 +09:30
ld-arc
ld-arm
ld-auto-import
ld-avr
ld-bootstrap
ld-bpf
ld-cdtest
ld-checks
ld-cris
ld-crx
ld-csky
ld-cygwin
ld-d10v
ld-discard Unnecessary load_lib in ld testsuite 2020-06-15 15:07:13 +09:30
ld-dynamic
ld-elf Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-elfcomm
ld-elfvers ld testsuite fixes for alpha 2020-06-19 10:01:09 +09:30
ld-elfvsb Use __asm__ rather than asm in ld testsuite 2020-06-16 22:13:20 +09:30
ld-elfweak Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-fastcall Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-frv
ld-gc Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-h8300
ld-i386 Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-ia64 Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-ifunc ld testsuite fixes for alpha 2020-06-19 10:01:09 +09:30
ld-libs
ld-linkonce PR26103 testcase 2020-06-15 12:11:27 +09:30
ld-m68hc11
ld-m68k
ld-mep Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-metag
ld-mips-elf Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-misc
ld-mmix
ld-mn10300
ld-msp430-elf
ld-nds32
ld-nios2 Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-or1k
ld-pdp11
ld-pe Use __asm__ rather than asm in ld testsuite 2020-06-16 22:13:20 +09:30
ld-pie
ld-plugin Re: ld testsuite fixes for alpha 2020-06-19 12:59:30 +09:30
ld-powerpc
ld-pru
ld-riscv-elf RISC-V: Report warning when linking the objects with different priv specs. 2020-06-22 10:01:14 +08:00
ld-s12z
ld-s390
ld-scripts Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-selective Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-sh SH gas configure and ld tests 2020-06-20 10:56:39 +09:30
ld-shared
ld-size Use __asm__ rather than asm in ld testsuite 2020-06-16 22:13:20 +09:30
ld-sparc
ld-spu
ld-srec
ld-tic6x Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-tilegx
ld-tilepro
ld-undefined
ld-unique
ld-v850
ld-vax-elf
ld-visium
ld-vxworks
ld-x86-64 Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ld-xc16x
ld-xstormy16
ld-xtensa
ld-z8k
ld-z80
lib Remove perror from ld_assemble, ld_compile and ld_nm 2020-06-20 15:53:37 +09:30
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-9303