Skip to content

Commit 5d277de

Browse files
Claudiu ZissulescuShahab Vahedi
Claudiu Zissulescu
authored and
Shahab Vahedi
committed
arc: Add Synopsys ARC64 machine to BFD.
The new Synopsys's ARC64 architecture is capable to run either 64-bit ISA or 32-bit ISA. The new 32-bit ISA is not compatible with the old Synopsys ARCv1/ARCv2 ISA, however, it retains a lot of common concepts. Thus, this patch is reusing the old ARC BFD backend and adds the necessary bits for the new architecture in a similar way as it is done for RISCV backend. bfd/ xxxx-xx-xx Claudiu Zissulescu <[email protected]> * bfd/Makefile.am: Add ARC64 files. * bfd/Makefile.in: Regerate. * bfd/arc-got.h (TCB_SIZE): Depends on the target architecture. (GOT_ENTRY_SIZE): New define. (write_in_got): Likewise. (read_from_got): Likewise. (align_power): Likewise. (arc_got_entry_type_for_reloc): Use RELA_SIZE and GOT_ENTRY_SIZE. (arc_fill_got_info_for_reloc): Update formating. (relocate_fix_got_relocs_for_got_info): Likewise. (arc_static_sym_data): Deleted structure. (get_static_sym_data): Deleted function. (relocate_fix_got_relocs_for_got_info): Use symbol static data. (create_got_dynrelocs_for_single_entry): Update formating. (create_got_dynrelocs_for_got_info): Likewise. * bfd/arc-plt.c: New file. * bfd/arc-plt.def: Add ARC64 PLT entry. * bfd/arc-plt.h: Clean it up, move functionality to arc-plt.c file. * bfd/archures.c: Add ARC64 target. * bfd/config.bfd: Likewise. * bfd/configure.ac: Likewise. * bfd/bfd-in2.h: Regenerate. * bfd/configure: Likewise. * bfd/libbfd.h: Likewise. * bfd/cpu-arc.c: Clean it up. * bfd/cpu-arc64.c: New file. * bfd/elf32-arc.c: Renamed to elfnn-arc.c. * bfd/elfnn-arc.c: New file. * bfd/reloc.c: Add new ARC64 relocs. * bfd/targets.c: Add ARC64 target. Signed-off-by: Claudiu Zissulescu <[email protected]> add patch 8
1 parent 7cc9f77 commit 5d277de

17 files changed

+1565
-780
lines changed

bfd/Makefile.am

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ ALL_MACHINES = \
9999
cpu-alpha.lo \
100100
cpu-amdgcn.lo \
101101
cpu-arc.lo \
102+
cpu-arc64.lo \
102103
cpu-arm.lo \
103104
cpu-avr.lo \
104105
cpu-bfin.lo \
@@ -182,6 +183,7 @@ ALL_MACHINES_CFILES = \
182183
cpu-alpha.c \
183184
cpu-amdgcn.c \
184185
cpu-arc.c \
186+
cpu-arc64.c \
185187
cpu-arm.c \
186188
cpu-avr.c \
187189
cpu-bfin.c \
@@ -263,6 +265,7 @@ ALL_MACHINES_CFILES = \
263265
# The .o files needed by all of the 32 bit vectors that are configured into
264266
# target_vector in targets.c if configured with --enable-targets=all.
265267
BFD32_BACKENDS = \
268+
arc-plt.lo \
266269
aout-cris.lo \
267270
aout-ns32k.lo \
268271
aout32.lo \
@@ -398,6 +401,7 @@ BFD32_BACKENDS = \
398401
xtensa-modules.lo
399402

400403
BFD32_BACKENDS_CFILES = \
404+
arc-plt.c \
401405
aout-cris.c \
402406
aout-ns32k.c \
403407
aout32.c \
@@ -430,7 +434,6 @@ BFD32_BACKENDS_CFILES = \
430434
elf-vxworks.c \
431435
elf.c \
432436
elf32-am33lin.c \
433-
elf32-arc.c \
434437
elf32-arm.c \
435438
elf32-avr.c \
436439
elf32-bfin.c \
@@ -540,6 +543,8 @@ BFD64_BACKENDS = \
540543
elf32-aarch64.lo \
541544
elf64-aarch64.lo \
542545
elfxx-aarch64.lo \
546+
elf32-arc64.lo \
547+
elf64-arc64.lo \
543548
aix5ppc-core.lo \
544549
aout64.lo \
545550
coff-alpha.lo \
@@ -681,6 +686,7 @@ SOURCE_CFILES = \
681686

682687
BUILD_CFILES = \
683688
elf32-aarch64.c elf64-aarch64.c \
689+
elf32-arc.c elf64-arc64.c elf32-arc64.c\
684690
elf32-ia64.c elf64-ia64.c \
685691
elf32-loongarch.c elf64-loongarch.c \
686692
elf32-riscv.c elf64-riscv.c \
@@ -842,6 +848,21 @@ elf64-aarch64.c : elfnn-aarch64.c
842848
$(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
843849
$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
844850

851+
elf32-arc.c : elfnn-arc.c
852+
rm -f elf32-arc.c
853+
$(AM_V_at)echo "#line 1 \"$(srcdir)/elfnn-arc.c\"" > $@
854+
$(AM_V_GEN)$(SED) -e s/NN/32/g -e s/AA//g < $< >> $@
855+
856+
elf64-arc64.c : elfnn-arc.c
857+
rm -f elf64-arc64.c
858+
$(AM_V_at)echo "#line 1 \"$(srcdir)/elfnn-arc.c\"" > $@
859+
$(AM_V_GEN)$(SED) -e s/NN/64/g -e s/AA/64/g < $< >> $@
860+
861+
elf32-arc64.c : elfnn-arc.c
862+
rm -f elf32-arc64.c
863+
$(AM_V_at)echo "#line 1 \"$(srcdir)/elfnn-arc.c\"" > $@
864+
$(AM_V_GEN)$(SED) -e s/NN/32/g -e s/AA/64/g < $< >> $@
865+
845866
elf32-ia64.c : elfnn-ia64.c
846867
$(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
847868
$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@

bfd/Makefile.in

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ ALL_MACHINES = \
554554
cpu-alpha.lo \
555555
cpu-amdgcn.lo \
556556
cpu-arc.lo \
557+
cpu-arc64.lo \
557558
cpu-arm.lo \
558559
cpu-avr.lo \
559560
cpu-bfin.lo \
@@ -637,6 +638,7 @@ ALL_MACHINES_CFILES = \
637638
cpu-alpha.c \
638639
cpu-amdgcn.c \
639640
cpu-arc.c \
641+
cpu-arc64.c \
640642
cpu-arm.c \
641643
cpu-avr.c \
642644
cpu-bfin.c \
@@ -719,6 +721,7 @@ ALL_MACHINES_CFILES = \
719721
# The .o files needed by all of the 32 bit vectors that are configured into
720722
# target_vector in targets.c if configured with --enable-targets=all.
721723
BFD32_BACKENDS = \
724+
arc-plt.lo \
722725
aout-cris.lo \
723726
aout-ns32k.lo \
724727
aout32.lo \
@@ -854,6 +857,7 @@ BFD32_BACKENDS = \
854857
xtensa-modules.lo
855858

856859
BFD32_BACKENDS_CFILES = \
860+
arc-plt.c \
857861
aout-cris.c \
858862
aout-ns32k.c \
859863
aout32.c \
@@ -886,7 +890,6 @@ BFD32_BACKENDS_CFILES = \
886890
elf-vxworks.c \
887891
elf.c \
888892
elf32-am33lin.c \
889-
elf32-arc.c \
890893
elf32-arm.c \
891894
elf32-avr.c \
892895
elf32-bfin.c \
@@ -997,6 +1000,8 @@ BFD64_BACKENDS = \
9971000
elf32-aarch64.lo \
9981001
elf64-aarch64.lo \
9991002
elfxx-aarch64.lo \
1003+
elf32-arc64.lo \
1004+
elf64-arc64.lo \
10001005
aix5ppc-core.lo \
10011006
aout64.lo \
10021007
coff-alpha.lo \
@@ -1137,6 +1142,7 @@ SOURCE_CFILES = \
11371142

11381143
BUILD_CFILES = \
11391144
elf32-aarch64.c elf64-aarch64.c \
1145+
elf32-arc.c elf64-arc64.c elf32-arc64.c\
11401146
elf32-ia64.c elf64-ia64.c \
11411147
elf32-loongarch.c elf64-loongarch.c \
11421148
elf32-riscv.c elf64-riscv.c \
@@ -1427,6 +1433,7 @@ distclean-compile:
14271433
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-ns32k.Plo@am__quote@
14281434
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout32.Plo@am__quote@
14291435
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout64.Plo@am__quote@
1436+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arc-plt.Plo@am__quote@
14301437
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archive.Plo@am__quote@
14311438
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archive64.Plo@am__quote@
14321439
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archures.Plo@am__quote@
@@ -1460,6 +1467,7 @@ distclean-compile:
14601467
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-alpha.Plo@am__quote@
14611468
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-amdgcn.Plo@am__quote@
14621469
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-arc.Plo@am__quote@
1470+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-arc64.Plo@am__quote@
14631471
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-arm.Plo@am__quote@
14641472
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-avr.Plo@am__quote@
14651473
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-bfin.Plo@am__quote@
@@ -1555,6 +1563,7 @@ distclean-compile:
15551563
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-aarch64.Plo@am__quote@
15561564
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-am33lin.Plo@am__quote@
15571565
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-arc.Plo@am__quote@
1566+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-arc64.Plo@am__quote@
15581567
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-arm.Plo@am__quote@
15591568
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-avr.Plo@am__quote@
15601569
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-bfin.Plo@am__quote@
@@ -1623,6 +1632,7 @@ distclean-compile:
16231632
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-aarch64.Plo@am__quote@
16241633
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-alpha.Plo@am__quote@
16251634
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-amdgcn.Plo@am__quote@
1635+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-arc64.Plo@am__quote@
16261636
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-bpf.Plo@am__quote@
16271637
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-gen.Plo@am__quote@
16281638
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@
@@ -2339,6 +2349,21 @@ elf64-aarch64.c : elfnn-aarch64.c
23392349
$(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
23402350
$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
23412351

2352+
elf32-arc.c : elfnn-arc.c
2353+
rm -f elf32-arc.c
2354+
$(AM_V_at)echo "#line 1 \"$(srcdir)/elfnn-arc.c\"" > $@
2355+
$(AM_V_GEN)$(SED) -e s/NN/32/g -e s/AA//g < $< >> $@
2356+
2357+
elf64-arc64.c : elfnn-arc.c
2358+
rm -f elf64-arc64.c
2359+
$(AM_V_at)echo "#line 1 \"$(srcdir)/elfnn-arc.c\"" > $@
2360+
$(AM_V_GEN)$(SED) -e s/NN/64/g -e s/AA/64/g < $< >> $@
2361+
2362+
elf32-arc64.c : elfnn-arc.c
2363+
rm -f elf32-arc64.c
2364+
$(AM_V_at)echo "#line 1 \"$(srcdir)/elfnn-arc.c\"" > $@
2365+
$(AM_V_GEN)$(SED) -e s/NN/32/g -e s/AA/64/g < $< >> $@
2366+
23422367
elf32-ia64.c : elfnn-ia64.c
23432368
$(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
23442369
$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@

0 commit comments

Comments
 (0)