Skip to content

Commit c01dc7b

Browse files
committed
Managed build fixes
1 parent e1fbc73 commit c01dc7b

File tree

7 files changed

+12
-19
lines changed

7 files changed

+12
-19
lines changed

src/coreclr/tools/Common/Compiler/DependencyAnalysis/Relocation.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public enum RelocType
2020
IMAGE_REL_BASED_LOONGARCH64_PC = 0x16, // LoongArch64: pcalau12i+imm12
2121
IMAGE_REL_BASED_LOONGARCH64_JIR = 0x17, // LoongArch64: pcaddu18i+jirl
2222
IMAGE_REL_BASED_RISCV64_PC = 0x18, // RiscV64: auipc
23+
IMAGE_REL_BASED_RISCV64_JALR = 0x19, // RiscV64: jalr (indirect jump)
2324
IMAGE_REL_BASED_RELPTR32 = 0x7C, // 32-bit relative address from byte starting reloc
2425
// This is a special NGEN-specific relocation type
2526
// for relative pointer (used to make NGen relocation

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_RiscV64/RiscV64ReadyToRunGenericHelperNode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ protected void EmitDictionaryLookup(NodeFactory factory, ref RiscV64Emitter enco
4747
// should be reported by someone else - the system should not rely on it coming from here.
4848
if (!relocsOnly && _hasInvalidEntries)
4949
{
50-
encoder.EmitXOR(encoder.TargetRegister.IntraProcedureCallScratch1, result, 0);
51-
encoder.EmitJE(encoder.TargetRegister.IntraProcedureCallScratch1, GetBadSlotHelper(factory));
50+
encoder.EmitXORI(encoder.TargetRegister.IntraProcedureCallScratch1, result, 0);
51+
encoder.EmitJALR(Register.X0, encoder.TargetRegister.IntraProcedureCallScratch1, 0);
5252
}
5353
}
5454

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/Dwarf/DwarfBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public DwarfBuilder(
8686
_codeRelocType = RelocType.IMAGE_REL_BASED_DIR64;
8787
break;
8888

89-
case TargetArchitecture.RISCV64:
89+
case TargetArchitecture.RiscV64:
9090
_targetPointerSize = 8;
9191
_frameRegister = 8; // FP
9292
_codeRelocType = RelocType.IMAGE_REL_BASED_DIR64;

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/Dwarf/DwarfCie.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public DwarfCie(TargetArchitecture targetArchitecture)
9393
InitialCFAOffset = 0;
9494
break;
9595

96-
case TargetArchitecture.RISCV64:
96+
case TargetArchitecture.RiscV64:
9797
CodeAlignFactor = 1;
9898
DataAlignFactor = -8;
9999
ReturnAddressRegister = 1; // RA

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/Dwarf/DwarfExpressionBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public static int DwarfRegNum(TargetArchitecture architecture, int regNum)
165165
// Normal registers are directly mapped
166166
return regNum;
167167

168-
case TargetArchitecture.RISCV64:
168+
case TargetArchitecture.RiscV64:
169169
// Normal registers are directly mapped
170170
return regNum;
171171

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/ElfNative.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,9 +607,6 @@ internal static class ElfNative
607607
public const uint R_RISCV_PLT64 = 48;
608608
public const uint R_RISCV_COPY64 = 49;
609609
public const uint R_RISCV_RELATIVE64 = 50;
610-
public const uint R_RISCV_TLS_DTPMOD64 = 51;
611-
public const uint R_RISCV_TLS_DTPREL64 = 52;
612-
public const uint R_RISCV_TLS_TPREL64 = 53;
613610
public const uint R_RISCV_64_ADD = 54;
614611
public const uint R_RISCV_64_SUB = 55;
615612
public const uint R_RISCV_64_HI20 = 56;

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/ElfObjectWriter.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public ElfObjectWriter(NodeFactory factory, ObjectWritingOptions options)
6060
TargetArchitecture.ARM => EM_ARM,
6161
TargetArchitecture.ARM64 => EM_AARCH64,
6262
TargetArchitecture.LoongArch64 => EM_LOONGARCH,
63-
TargetArchitecture.RiscV64 => EN_RISCV,
63+
TargetArchitecture.RiscV64 => EM_RISCV,
6464
_ => throw new NotSupportedException("Unsupported architecture")
6565
};
6666
_useInlineRelocationAddends = _machine is EM_386 or EM_ARM;
@@ -537,7 +537,7 @@ private void EmitRelocationsLoongArch64(int sectionIndex, List<SymbolicRelocatio
537537
}
538538
}
539539

540-
private void EmitRelocationsRiscV(int sectionIndex, List<SymbolicRelocation> relocationList)
540+
private void EmitRelocationsRiscV64(int sectionIndex, List<SymbolicRelocation> relocationList)
541541
{
542542
if (relocationList.Count > 0)
543543
{
@@ -553,12 +553,8 @@ private void EmitRelocationsRiscV(int sectionIndex, List<SymbolicRelocation> rel
553553
IMAGE_REL_BASED_DIR64 => R_RISCV_64,
554554
IMAGE_REL_BASED_HIGHLOW => R_RISCV_32,
555555
IMAGE_REL_BASED_RELPTR32 => R_RISCV_RELATIVE,
556-
IMAGE_REL_BASED_RISCV_CALL => R_RISCV_CALL,
557-
IMAGE_REL_BASED_RISCV_JUMP_SLOT => R_RISCV_JUMP_SLOT,
558-
IMAGE_REL_BASED_RISCV_TLS_LE => R_RISCV_TLS_LE,
559-
IMAGE_REL_BASED_RISCV_TLS_GD => R_RISCV_TLS_GD,
560-
IMAGE_REL_BASED_RISCV_TLS_IE => R_RISCV_TLS_IE,
561-
IMAGE_REL_BASED_RISCV_TLS_LD => R_RISCV_TLS_LD,
556+
IMAGE_REL_BASED_RISCV64_PC => R_RISCV_PCREL_HI20,
557+
IMAGE_REL_BASED_RISCV64_JALR => R_RISCV_CALL32,
562558
_ => throw new NotSupportedException("Unknown relocation type: " + symbolicRelocation.Type)
563559
};
564560

@@ -567,11 +563,10 @@ private void EmitRelocationsRiscV(int sectionIndex, List<SymbolicRelocation> rel
567563
BinaryPrimitives.WriteInt64LittleEndian(relocationEntry.Slice(16), symbolicRelocation.Addend);
568564
relocationStream.Write(relocationEntry);
569565

570-
if (symbolicRelocation.Type is IMAGE_REL_BASED_RISCV_CALL)
566+
if (symbolicRelocation.Type is IMAGE_REL_BASED_RISCV64_PC)
571567
{
572-
// Add an additional entry for the CALL relocation type
573568
BinaryPrimitives.WriteUInt64LittleEndian(relocationEntry, (ulong)symbolicRelocation.Offset + 4);
574-
BinaryPrimitives.WriteUInt64LittleEndian(relocationEntry.Slice(8), ((ulong)symbolIndex << 32) | (type + 1));
569+
BinaryPrimitives.WriteUInt64LittleEndian(relocationEntry.Slice(8), ((ulong)symbolIndex << 32) | type + 1);
575570
BinaryPrimitives.WriteInt64LittleEndian(relocationEntry.Slice(16), symbolicRelocation.Addend);
576571
relocationStream.Write(relocationEntry);
577572
}

0 commit comments

Comments
 (0)