Skip to content

Commit cb1efea

Browse files
clazissClaudiu Zissulescu
authored and
Claudiu Zissulescu
committed
binutils: Relax from BL to BL_S instruction.
Adds to linker relaxation the possibility of performing linker relaxation from BL instruction to BL_S, if possible. This relaxation also requires the object file to be prepared for shrinking by the assembler. If that operation is not performed, then this linker relaxation operation will not take place. bfd/ xxxx-xx-xx Claudiu Zissulescu <[email protected]> * bfd-in2.h: Regenerate. * elf32-arc.c (arc_elf_merge_attributes): Take into account if an object can be relaxed. (ICARRY): Define. (arc_relax_delete_bytes): New function. (arc_elf_relax_section): Add BL to BL_S relaxation rule. * libbfd.h: Regenerate. * reloc.c: Add extra relocs. binutils/ xxxx-xx-xx Claudiu Zissulescu <[email protected]> * readelf.c (display_arc_attribute): Recognize relaxable object. gas/ xxxx-xx-xx Claudiu Zissulescu <[email protected]> * config/tc-arc.c (relaxation_state): Change it from int to bfd_boolean. (enum options): Add linker_relax option. (md_longopts): Likewise. (md_begin): Initialize linkrelax variable. (md_apply_fix): Cleanup unused code. (md_parse_option): Recognize linker_relax option. (arc_make_nops): New function. (arc_handle_align): Change it to generate ARC_ALIGN reloc when needed. (tc_arc_fix_adjustable): All relocs are using the original symbol. (arc_cons_fix_new): Generate corresponding relocs when we have symbol difference. (arc_set_public_attributes): Set relaxable attribute whenever is necessary. (arc_allow_local_substract): New function. * config/tc-arc.h (TC_LINKRELAX_FIXUP): Define. (LINKER_RELAXING_SHRINKS_ONLY): Likewise. (TC_VALIDATE_FIX): Update with known relocs. (TC_FORCE_RELOCATION_SUB_LOCAL): Delete. (md_allow_local_subtract): Define. (TC_VALIDATE_FIX_SUB): Delete. include/ xxxx-xx-xx Claudiu Zissulescu <[email protected]> * elf/arc-reloc.def (ARC_S9H_PCREL): Add new reloc. (ARC_S7H_PCREL): Likewise. (ARC_S8H_PCREL): Likewise. (ARC_S10H_PCREL): Likewise. (ARC_S13H_PCREL): Likewise. (ARC_ALIGN): Likewise. (ARC_ADD8): Likewise. (ARC_ADD16): Likewise. (ARC_SUB8): Likewise. (ARC_SUB16): Likewise. (ARC_SUB32): Likewise. * opcode/arc-func.h (replace_bits9): New function. (replace_bits10): Likewise. (replace_bits7): Likewise. (replace_disp8h): Likewise. (replace_bits13): Likewise. ld/ xxxx-xx-xx Claudiu Zissulescu <[email protected]> * emulparams/arcelf.sh (EXTRA_EM_FILE): Add. * emulparams/arcv2elf.sh (EXTRA_EM_FILE): Likewise. * emulparams/arcv2elfx.sh (EXTRA_EM_FILE): Likewise. * emultempl/arcelf.em: New file. * testsuite/ld-arc/jli-simple.rd: New file. * testsuite/ld-arc/relax-call-1.d: Likewise. * testsuite/ld-arc/relax-call-1.s: Likewise. * testsuite/ld-arc/relax-call-2.d: Likewise. * testsuite/ld-arc/relax-call-2.s: Likewise. * testsuite/ld-arc/relax-call-3.d: Likewise. * testsuite/ld-arc/relax-call-3.s: Likewise. opcodes/ xxxx-xx-xx Claudiu Zissulescu <[email protected]> * arc-opc.c (SIMM9_A16_8): Use external reloc. (SIMM10_A16_7_S): Likewise. (SIMM7_A16_10_S): Likewise. (SIMM8_A16_9_S): Likewise. (SIMM13_A16_20): Likewise. [RLX][FIX] Fix relocations when we don't linkrelax
1 parent 9288e0f commit cb1efea

21 files changed

+900
-124
lines changed

bfd/bfd-in2.h

+11
Original file line numberDiff line numberDiff line change
@@ -3423,6 +3423,17 @@ pc-relative or some form of GOT-indirect relocation. */
34233423
BFD_RELOC_ARC_S21H_PCREL_PLT,
34243424
BFD_RELOC_ARC_NPS_CMEM16,
34253425
BFD_RELOC_ARC_JLI_SECTOFF,
3426+
BFD_RELOC_ARC_S7H_PCREL,
3427+
BFD_RELOC_ARC_S8H_PCREL,
3428+
BFD_RELOC_ARC_S9H_PCREL,
3429+
BFD_RELOC_ARC_S10H_PCREL,
3430+
BFD_RELOC_ARC_S13H_PCREL,
3431+
BFD_RELOC_ARC_ALIGN,
3432+
BFD_RELOC_ARC_ADD8,
3433+
BFD_RELOC_ARC_ADD16,
3434+
BFD_RELOC_ARC_SUB8,
3435+
BFD_RELOC_ARC_SUB16,
3436+
BFD_RELOC_ARC_SUB32,
34263437

34273438
/* ADI Blackfin 16 bit immediate absolute reloc. */
34283439
BFD_RELOC_BFIN_16_IMM,

0 commit comments

Comments
 (0)