Re: [RFA] New port: CR16: BFD Changes required by the gdb port

Pedro Alves
2012-12-14T18:52:28Z

On 11/26/2012 07:03 AM, Kaushik Phatak wrote:
> diff -uprN ./gdb_src.orig/opcodes/cr16-dis.c ./gdb_src/opcodes/cr16-dis.c
> --- ./gdb_src.orig/opcodes/cr16-dis.c 2012-05-17 20:43:25.000000000 +0530
> +++ ./gdb_src/opcodes/cr16-dis.c 2012-11-26 11:21:43.000000000 +0530
> @@ -36,9 +36,6 @@
> /* Set Bit Mask - a mask to set all bits starting from offset 'offs'. */
> #define SBM(offs) ((((1 << (32 - offs)) -1) << (offs)))
>
> -typedef unsigned long dwordU;
> -typedef unsigned short wordU;
> -
> typedef struct
> {
> dwordU val;
> @@ -317,7 +314,7 @@ build_mask (void)
>
> /* Search for a matching opcode. Return 1 for success, 0 for failure. */
>
> -static int
> +int
> match_opcode (void)
> {
> unsigned long mask;
> @@ -734,7 +731,7 @@ print_arguments (ins *currentInsn, bfd_v
>
> /* Build the instruction's arguments. */
>
> -static void
> +void
> make_instruction (void)
> {
> int i;

...

> --- ./gdb_src.orig/include/opcode/cr16.h 2010-04-15 15:56:09.000000000 +0530
> +++ ./gdb_src/include/opcode/cr16.h 2012-11-16 12:43:59.000000000 +0530
> @@ -435,4 +435,17 @@ extern const inst *instruction;
> typedef long long int LONGLONG;
> typedef unsigned long long ULONGLONG;
>
> +/* Data types for opcode handling. */
> +typedef unsigned long dwordU;
> +typedef unsigned short wordU;
> +
> +/* Globals to store opcode data and build the instruction. */
> +extern wordU words[3];
> +extern ULONGLONG allWords;
> +extern ins currInsn;
> +
> +/* Prototypes for function in cr16-dis.c. */
> +void make_instruction (void);
> +int match_opcode (void);
> +
> #endif /* _CR16_H_ */

It'd be nice if all these exported symbols were prefixed, to avoid
namespace collisions.

--
Pedro Alves