Hello Nick,
Updated patch as per comments. Could you please review the updated patch.
ChangeLog:
gas/ChangeLog:
2008-11-25 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* doc/c-cr16.texi (cr16-operand specifiers): Add got/GOT and
cgot/cGOT.
===
include/elf/ChangeLog
2008-11-25 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* cr16.h (R_CR16_GOT_REGREL20, R_CR16_GOTC_REGREL20 and
R_CR16_GLOB_DAT): New relocations.
====
bfd/ChangeLog:
2008-11-25 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* elf32-cr16.c: Comment typo and style fix.
===
Test results:
> make check-gas
=====
=== gas Summary ===
# of expected passes 135
../as-new 2.19.50.20081124
====
> make check-binutils
==
=== binutils Summary ===
# of expected passes 54
# of untested testcases 6
# of unsupported tests 1
====
Thanks
Swami
-------- Original Message --------
Subject: [Fwd: [PATCH] cr16-elf: position independent code (PIC) support]
Date: Tue, 25 Nov 2008 15:23:51 +0530
From: M R Swami Reddy <MR.Swami.Reddy@nsc.com>
To: binutils@sources.redhat.com <binutils@sources.redhat.com>
Hello,
After the patch, "gas" and "binutils" test results are:
> make check-gas
=====
=== gas Summary ===
# of expected passes 135
../as-new 2.19.50.20081124
====
> make check-binutils
==
=== binutils Summary ===
# of expected passes 54
# of untested testcases 6
# of unsupported tests 1
====
Thanks
Swami
-------- Original Message --------
Subject: [PATCH] cr16-elf: position independent code (PIC) support
Date: Tue, 25 Nov 2008 13:55:53 +0530
From: M R Swami Reddy <MR.Swami.Reddy@nsc.com>
To: binutils@sourceware.org, Nick Clifton <nickc@redhat.com>
Hello,
Patch to add PIC support in binutils tools for cr16 target.
Could you please review the patch.
bfd/ChangeLog:
2008-11-25 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* Add PIC support for CR16 target.
* elf32-cr16.c (R_CR16_GOT_REGREL20, R_CR16_GOTC_REGREL20 and
R_CR16_GLOB_DAT): New macros
(cr16_elf_howto_table): Add entries for for R_CR16_GOT_REGREL20,
R_CR16_GOTC_REGREL20 and R_CR16_GLOB_DAT.
(cr16_reloc_map): Ditto
(_bfd_cr16_elf_create_got_section): New function to create
GOT section.
(_bfd_cr16_elf_create_dynamic_sections): New function to
create dynamic
section.
(_bfd_cr16_elf_adjust_dynamic_symbol): New function to adjust
symbol
defined by dynamic object.
(_bfd_cr16_elf_size_dynamic_sections): New function to find
the size
of dynamic section.
(_bfd_cr16_elf_finish_dynamic_symbol): New function to handle
dynamic
symbols.
(_bfd_cr16_elf_finish_dynamic_symbol): New function to handle
dynamic
sections.
(bfd_cr16_elf32_create_embedded_relocs): New function to create
embedded relocs in .emreloc section in memory for .data.rel
section.
(_bfd_cr16_elf_reloc_type_class): New function for classify
reloc types.
(cr16_elf_check_relocs): New function for checking reloc
types in
first phase.
(cr16_elf_final_link_relocate): Update for handling the new
reloc
types R_CR16_GOT_REGREL20 and R_CR16_GOTC_REGREL20.
(elf32_cr16_relax_section): Update relax implementation.
* reloc.c (bfd_reloc_code_type): Add entries for
R_CR16_GOT_REGREL20,
R_CR16_GOTC_REGREL20 and R_CR16_GLOB_DAT.
* bfd-in.h (bfd_boolean
bfd_cr16_elf32_create_embedded_relocs): Declared
* libbfd.h, bfd-in2.h: Regenerate.
===
gas/ChangeLog:
2008-11-25 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* config/tc-cr16.h (GLOBAL_OFFSET_TABLE_NAME): Defined
* config/tc-cr16.c (md_pseudo_table): Add "4byte" directive to
md_pseudo_table and accept @c prefix, same as long directive.
(cr16_cons_fix_new): Initialize rtype to BFD_RELOC_UNUSED.
config/tc-cr16.c (tc_gen_reloc): Declare a variable of type
bfd_reloc_code_real_type and set it for GOT related relocations.
(md_undefined_symbol): Defined
(process_label_constant): Added checks for GOT/got and cGOT/cGOT
prefixes with constant label and set the appropriate
relocation type.
* NEWS: Add cr16 target PIC support.
======
gas/testsuite/ChangeLog:
2008-11-25 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* gas/cr16/pic1.s: New.
* gas/cr16/pic1.d: New.
* gas/cr16/pic2.s: New.
* gas/cr16/pic2.d: New.
* gas/cr16/pic.exp: Run pic tests.
====
include/elf/ChangeLog:
2008-11-25 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* cr16.h (R_CR16_GOT_REGREL20, R_CR16_GOTC_REGREL20 and
R_CR16_GLOB_DAT): New relocations.
===
opcodes/ChangeLog:
* cr16-dis.c (match_opcode): Truncate mcode to 32 bit and
adjusted the mask for 32-bit branch instruction.
===
ld/ChanegeLog:
==
2008-11-25 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
* emultempl/cr16elf.em (cr16_after_open): New function to handle
CR16 ELF embedded reloc creation (ld --embedded-relocs).
(check_sections): New function.
(LDEMUL_AFTER_OPEN): Define.
* emulparams/elf32cr16.sh (EMBEDDED): Define.
* NEWS: Add comment.
======
NOTE: The above patch includes a few bug fixes also.
Thanks
Swami