[PATCH] D18499: [ELF] - Implemented prototype of location counter support.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 06:36:06 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:40
@@ +39,3 @@
+  if (S.getAsInteger(0, V)) {
+    error("malformed number: " + V);
+    return 0;
----------------
ruiu wrote:
> You probably have to do this
> 
>   error("malformed number: " + Twine(V))
I think what I want is:

```
error("malformed number: " + S);
```

Updated testcase.

================
Comment at: ELF/LinkerScript.cpp:115
@@ +114,3 @@
+
+  uintX_t ThreadBssOffset = 0;
+  uintX_t VA =
----------------
ruiu wrote:
> Call fixupLocations here instead of exporting it and call it from the Writer.
Done.

================
Comment at: ELF/LinkerScript.cpp:129-130
@@ +128,4 @@
+        });
+    if (I == S.end())
+      continue;
+
----------------
ruiu wrote:
> This shouldn't happen now, no?
This can happen. Imagine asm code:

```
.global _start
_start:
 nop
```

and script that contains section description, but this section is absent in code above:

```
SECTIONS {
 .stub : { *(.stub) }
}
```

Since there is no such section, OutputSections list will not contain it, but location node will still be created and needs to be skipped then.

================
Comment at: ELF/LinkerScript.cpp:485-492
@@ +484,9 @@
+
+template void
+LinkerScript::fixupLocations(std::vector<OutputSectionBase<ELF32LE> *> &);
+template void
+LinkerScript::fixupLocations(std::vector<OutputSectionBase<ELF32BE> *> &);
+template void
+LinkerScript::fixupLocations(std::vector<OutputSectionBase<ELF64LE> *> &);
+template void
+LinkerScript::fixupLocations(std::vector<OutputSectionBase<ELF64BE> *> &);
----------------
ruiu wrote:
> Remove.
Done.

================
Comment at: ELF/LinkerScript.h:68-69
@@ -55,1 +67,4 @@
   template <class ELFT> bool shouldKeep(InputSectionBase<ELFT> *S);
+  template <class ELFT>
+  void fixupLocations(std::vector<OutputSectionBase<ELFT> *> &);
+  template <class ELFT>
----------------
ruiu wrote:
> Make it private.
Done.


http://reviews.llvm.org/D18499





More information about the llvm-commits mailing list