[Fwd: [PATCH] cr16-elf: position independent code (PIC) support]

M R Swami Reddy MR.Swami.Reddy@nsc.com
Tue Nov 25 09:54:00 GMT 2008


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


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bfd.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20081125/baed0402/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gas.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20081125/baed0402/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: include.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20081125/baed0402/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ld.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20081125/baed0402/attachment-0003.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: opcodes.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20081125/baed0402/attachment-0004.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cr16-gas-pic-testcases.tar
Type: application/x-tar
Size: 20480 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20081125/baed0402/attachment.tar>


More information about the Binutils mailing list