[PATCH] D19272: [ELF] - linkerscript AT keyword (in output section description) implemented.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 15:15:09 PDT 2016
ruiu added a comment.
I wonder if you are implementing this feature for some specific product. For example, are you trying to link some kernel or something? Or are you doing this for the sake of completeness? It seems to me that AT command is a tricky option that you want to use only when you are dealing with embedded systems or something.
================
Comment at: ELF/LinkerScript.cpp:250
@@ -249,1 +249,3 @@
+uint64_t LinkerScript::getLma(uint64_t VA, StringRef SectionName) {
+ auto I = LmaExpr.find(SectionName);
----------------
Can you name this getLoadAddr and add comments what the load address is?
================
Comment at: ELF/Writer.cpp:1467-1470
@@ -1466,3 +1466,6 @@
- // If flags changed then we want new load segment.
+ bool HasLma = Script->hasLma(Sec->getName());
+ // If AT linker script command was used for section or if flags were
+ // changed, then we want new load segment.
uintX_t NewFlags = toPhdrFlags(Sec->getFlags());
+ if (HasLma || Flags != NewFlags) {
----------------
Then please explain why we need to do this instead of what we are doing here in the comment.
// Segments are contiguous memory regions that has the same attributes
// (e.g. executable or writable). There is one phdr for each segment. Therefore,
// we need to create a new phdr when the next section has different flags or
// is loaded at a discontiguous address using AT linker script command.
http://reviews.llvm.org/D19272
More information about the llvm-commits
mailing list