[PATCH] D139092: [LLD][ELF] Cortex-M Security Extensions (CMSE) Support

Amilendra Kodithuwakku via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 10:32:04 PDT 2023


amilendra marked an inline comment as done.
amilendra added inline comments.


================
Comment at: lld/ELF/Relocations.cpp:1346
   const RelTy &rel = *i;
   uint32_t symIndex = rel.getSymbol(config->isMips64EL);
+  StringRef symName = sec->getFile<ELFT>()->getSymbol(symIndex).getName();
----------------
peter.smith wrote:
> While I think this will work. I'm thinking that there could be a less intrusive way of achieving this. As I understand it when we create SG veneers we have input sections with `sym`, and `__acle_sym` defined to the same address. All relocations and references are to `sym`. 
> 
> In the current implementation, we redirect relocations from `sym` to `__acle_sym` and then it looks like we overwrite `sym` in finalize with the value of the SG Veneer.
> 
> Could we use a similar mechanism to `SymbolTable::wrap()` and essentially exchange `__acle_sym` with `sym` so that all references to `sym` go to `__acle_sym` we are then free to overwrite `sym`? 
Exchanging `__acle_sym` with `sym` in `SymbolTable->symVector` doesn't seem to work because `InputFiles->symbols[]` will continue to point to `sym` which is what the Relocations are using. So I had to change `InputFiles->symbols[]` to point to `__acle_sym`. However this implementation seems better than my previous attemp because it could be localized to only the Arm backend. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139092/new/

https://reviews.llvm.org/D139092



More information about the llvm-commits mailing list