@@ -49,15 +49,15 @@ class ARM final : public TargetInfo {
4949 void relocate (uint8_t *loc, const Relocation &rel,
5050 uint64_t val) const override ;
5151
52+ DenseMap<InputSection *, SmallVector<const Defined *, 0 >> sectionMap;
53+
5254private:
53- void encodeAluGroup (uint8_t *loc, const Relocation &rel, uint64_t val,
54- int group, bool check) const ;
55+ void encodeAluGroup (uint8_t *loc, const Relocation &rel, uint64_t val,
56+ int group, bool check) const ;
5557};
5658enum class CodeState { Data = 0 , Thumb = 2 , Arm = 4 };
5759} // namespace
5860
59- static DenseMap<InputSection *, SmallVector<const Defined *, 0 >> sectionMap{};
60-
6161ARM::ARM (Ctx &ctx) : TargetInfo(ctx) {
6262 copyRel = R_ARM_COPY;
6363 relativeRel = R_ARM_RELATIVE;
@@ -1047,10 +1047,10 @@ static bool isDataMapSymbol(const Symbol *b) {
10471047 return b->getName () == " $d" || b->getName ().starts_with (" $d." );
10481048}
10491049
1050- void elf::sortArmMappingSymbols () {
1050+ void elf::sortArmMappingSymbols (Ctx &ctx ) {
10511051 // For each input section make sure the mapping symbols are sorted in
10521052 // ascending order.
1053- for (auto &kv : sectionMap) {
1053+ for (auto &kv : static_cast <ARM &>(*ctx. target ). sectionMap ) {
10541054 SmallVector<const Defined *, 0 > &mapSyms = kv.second ;
10551055 llvm::stable_sort (mapSyms, [](const Defined *a, const Defined *b) {
10561056 return a->value < b->value ;
@@ -1063,6 +1063,7 @@ void elf::addArmInputSectionMappingSymbols(Ctx &ctx) {
10631063 // The linker generated mapping symbols for all the synthetic
10641064 // sections are adding into the sectionmap through the function
10651065 // addArmSyntheitcSectionMappingSymbol.
1066+ auto §ionMap = static_cast <ARM &>(*ctx.target ).sectionMap ;
10661067 for (ELFFileBase *file : ctx.objectFiles ) {
10671068 for (Symbol *sym : file->getLocalSymbols ()) {
10681069 auto *def = dyn_cast<Defined>(sym);
@@ -1088,7 +1089,7 @@ void elf::addArmSyntheticSectionMappingSymbol(Defined *sym) {
10881089 return ;
10891090 if (auto *sec = cast_if_present<InputSection>(sym->section ))
10901091 if (sec->flags & SHF_EXECINSTR)
1091- sectionMap[sec].push_back (sym);
1092+ static_cast <ARM &>(*sec-> file -> ctx . target ). sectionMap [sec].push_back (sym);
10921093}
10931094
10941095static void toLittleEndianInstructions (uint8_t *buf, uint64_t start,
@@ -1109,7 +1110,9 @@ static void toLittleEndianInstructions(uint8_t *buf, uint64_t start,
11091110// identify half open intervals of Arm code [$a, non $a) and Thumb code
11101111// [$t, non $t) and convert these to little endian a word or half word at a
11111112// time respectively.
1112- void elf::convertArmInstructionstoBE8 (InputSection *sec, uint8_t *buf) {
1113+ void elf::convertArmInstructionstoBE8 (Ctx &ctx, InputSection *sec,
1114+ uint8_t *buf) {
1115+ auto §ionMap = static_cast <ARM &>(*ctx.target ).sectionMap ;
11131116 auto it = sectionMap.find (sec);
11141117 if (it == sectionMap.end ())
11151118 return ;
0 commit comments