[PATCH] D150870: [lld][Arm] Big Endian - Byte invariant support.

Simi Pallipurath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 06:01:16 PDT 2023


simpal01 added inline comments.


================
Comment at: lld/ELF/Arch/ARM.cpp:969
+// Add a mapping symbol to the mapping symbol list.
+void elf::addArmMappingSymbols(Defined *sym) {
+  if (!isArmMapSymbol(sym) && !isDataMapSymbol(sym) && !isThumbMapSymbol(sym))
----------------
peter.smith wrote:
> We are only adding a single symbol, whereas the name `addArmMappingSymbols` implies many symbols.
> 
> We should also be careful with using push_back here as we need to make sure that the mapping symbols are sorted. As it happens the way the code is used today push_back is fine as we always add the symbols in ascending order, but it would be easy to make a mistake in the future.
> 
> Possible solutions include:
> * use insert rather than push_back
> * sort the section map for the section after push_back
> * possibly delay the sorting of the mapping symbols till the first use.
> * change the name to push rather than add, make sure there is a comment to state that symbols must be pushed in ascending order.
I am sorting the mapping symbols already in this patch just before using it. I have introduced a new function named sortArmMappingSymbols which calls inside getArmMappingSymbols. By this time all the local and synthetic mapping symbols are added into the sectionmap. Sorry i could have been mentioned about it in my previous comments. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150870



More information about the llvm-commits mailing list