Added COMMONPAGESIZE to fix ld -z relro
Add DWARF2 information from gcc to GAS. Enable CFI.
  * config/tc-or1k.h:
  (tc_cfi_frame_initial_instructions) define.
  (or1k_cfi_frame_initial_instructions) prototype (body in tc-or1k.c)
  * config/tc-or1k.c:
  (or1k_cfi_frame_initial_instructions) set SP as the default CFA reg.
gdb: add or1k and or1knd target support

This patch is pretty much a copy of the current
GDB 7.2 port of the openrisc processor.

It now supports or1knd (no delay slot target).
This architecture has not been tested.
The default target is or1k (with delay slot).
You can change the target arch with:

(gdb) set architecture or1knd
The target architecture is assumed to be or1knd

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
sim: Add or1ksim support

This patch adds or1ksim support. This simulator is the default
choice. Two configure options were added:

--disable-or1ksim: disable or1ksim and use the CGEN simulator instead.

--whith-or1ksim=PATH: gives the or1ksim installation path. If not
given, /opt/or1ksim is used as default search path.

The GDB testsuite has been run against or1ksim. Here are the results:

		=== gdb Summary ===

-# of expected passes		14845
-# of unexpected failures	450
-# of expected failures		32
-# of known failures		36
-# of unresolved testcases	97
-# of untested testcases	62
-# of unsupported tests		164

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k: Add or1k DejaGnu board configurations

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Merge pull request #5 from Franck79/prepare_patch2

Add or1k gdb and or1ksim support
Support for TLS GD/IE/LE. LD is not supported.

	* reloc.c: Add R_OR1K_TLS_GD_HI16,
	R_OR1K_TLS_GD_LO16, R_OR1K_TLS_LDM_HI16, R_OR1K_TLS_LDM_HI16,
	R_OR1K_TLS_LDM_LO16, R_OR1K_TLS_LDO_HI16, R_OR1K_TLS_LDO_LO16,
	R_OR1K_TLS_IE_HI16, R_OR1K_TLS_IE_LO16, R_OR1K_TLS_LE_HI16,
	R_OR1K_TLS_LE_LO16, R_OR1K_TLS_TPOFF, R_OR1K_TLS_DTPOFF,
	R_OR1K_TLS_DTPMOD.
	* elf32-or1k.c (or1k_elf_howto_table): Add R_OR1K_TLS_GD_HI16,
	R_OR1K_TLS_GD_LO16, R_OR1K_TLS_LDM_HI16, R_OR1K_TLS_LDM_HI16,
	R_OR1K_TLS_LDM_LO16, R_OR1K_TLS_LDO_HI16, R_OR1K_TLS_LDO_LO16,
	R_OR1K_TLS_IE_HI16, R_OR1K_TLS_IE_LO16, R_OR1K_TLS_LE_HI16,
	R_OR1K_TLS_LE_LO16.
	(or1k_reloc_map): Likewise.
	(TLS_*): Defined TLS type macros.
	(elf_or1k_link_hash_entry): Added tls_type.
	(elf_or1k_obj_tdata): New.
	(elf_or1k_tdata): New.
	(elf_or1k_local_tls_type): New.
	(elf_or1k_mkobject): New.
	(or1k_elf_link_hash_newfunc): Set default TLS type to UNKNOWN.
	(tpoff): New.
	(or1k_elf_relocate_section): Relocation logic for TLS.
	(or1k_elf_check_relocs): Likewise.
	(or1k_elf_check_relocs): Fixed combreloc bug by using
	_bfd_elf_make_dynamic_reloc_section instead of bfd_make_section.
	(or1k_elf_finish_dynamic_symbol): Do not handle TLS symbols.
	(allocate_dynrelocs): Handle TLS types which needs more GOT / reloc
	space.
	(or1k_elf_size_dynamic_sections): Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Likewise.
	* or1k.opc (parse simm16): Add parsing for tls*(), gottp*().
	* config/tc-or1k.c (or1k_apply_fix): Mark TLS related symbols as TLS.
	* tc-or1k.h: Hook for or1k_apply_fix.
	* elf/or1k.h (START_RELOC_NUMBERS): Add R_OR1K_TLS_GD_HI16,
	R_OR1K_TLS_GD_LO16, R_OR1K_TLS_LDM_HI16, R_OR1K_TLS_LDM_HI16,
	R_OR1K_TLS_LDM_LO16, R_OR1K_TLS_LDO_HI16, R_OR1K_TLS_LDO_LO16,
	R_OR1K_TLS_IE_HI16, R_OR1K_TLS_IE_LO16, R_OR1K_TLS_LE_HI16,
	R_OR1K_TLS_LE_LO16, R_OR1K_TLS_TPOFF, R_OR1K_TLS_DTPOFF,
	R_OR1K_TLS_DTPMOD.
	* ld/emulparams/elf32or1k_linux.sh (GENERATE_COMBRELOC_SCRIPT): Define
	to yes.
	* ld/scripttempl/or1k.sc: Delete unused file.
	* or1k-asm.c: Regenerate
or1k-tdec: Add a check for NULL ptr in or1k_skip_prologue

	* or1k-tdep.c (or1k_skip_prologue): Add a check for NULL
	pointer while comparing debugformat to "dwarf".

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k-tdep.c: Add or1k_push_dummy_code an use it.

 * or1k-tdep.c (or1k_push_dummy_code): New function.
 (or1k_gdbarch_init): Override default behavior and call dummy
 from the stack. Set the push_dummy_code handler to
 or1k_push_dummy_code.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
target-description: add tdesc_find_register functions

In order to get registers names and groups from the target descriptor
file, some new functions are needed.

This patch adds:

- tdesc_find_register_name: Search FEATURE for a register REGNO and
  return its name.

- tdesc_find_register_group_name: Search FEATURE for a register
  REGNO and return its group name.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
tdesc: handle arbitrary strings in tdesc_register_in_reggroup_p

tdesc_register_in_reggroup_p in now able to handle arbitrary
groups. This is useful when groups are created while the
target descriptor file is received from the remote.

This can be the case of a soft core target processor where
registers/groups can change.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k-tdep: set gdbarch num regs to gpr + spr regs

Add a definition for SPR maximum number (OR1K_MAX_SPR_REGS).
This value is set to 64K (32 groups of 2048 registers).

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k: add target descriptor support

This patch adds target support to or1k.

Registers names and groups are dynamically created from the tdesc
remote file.

For example, we could have:

  <feature name="org.gnu.gdb.or1k.group10">
    <reg name="ttmr"  bitsize="32" regnum="2216" group="timer"/>
    <reg name="ttcr"  bitsize="32" regnum="2217" group="timer"/>
  </feature>

Then, a group "timer" would be created and timer registers would
be accessible using "info registers timer" and "set $ttmr ..."

While receiving a tdesc file from the remote, found registers and
corresponding groups can displayed using "set debug arch 1" before
setting the target to remote.

For example:

Remote debugging using :50001
Found   93 registers in feature org.gnu.gdb.or1k.group0
Found 1035 registers in feature org.gnu.gdb.or1k.group1
Found 1035 registers in feature org.gnu.gdb.or1k.group2
Found    6 registers in feature org.gnu.gdb.or1k.group3
Found    4 registers in feature org.gnu.gdb.or1k.group4
Found    2 registers in feature org.gnu.gdb.or1k.group5
Found   22 registers in feature org.gnu.gdb.or1k.group6
Found   16 registers in feature org.gnu.gdb.or1k.group7
Found    1 registers in feature org.gnu.gdb.or1k.group8
Found    2 registers in feature org.gnu.gdb.or1k.group9
Found    2 registers in feature org.gnu.gdb.or1k.group10
Found 2218 registers in the tdesc file

Available groups can be displayed with:

(gdb) maintenance print reggroups
 Group      Type
 system     user
 dmmu       user
 immu       user
 dcache     user
 icache     user
 mac        user
 debug      user
 perf       user
 power      user
 pic        user
 timer      user

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k-tdep.c: change or1k_push_dummy_code stack alignment

* or1k-tdep.c (or1k_push_dummy_code) : Use or1k_frame_align to
align the stack pointer.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k: gdb: Silence gcc warning

* gdb/ChangeLog.or1k

2013-03-15  Stefan Kristiansson  <stefan.kristiansson@saunalahti.fi>

        * or1k-tdep.c (or1k_regset_from_core_section) : Silence gcc warning
        by using %z format for size_t.