[PATCH] [COFF] Add support for .secref and .offset directives

Timur Iskhodzhanov timurrrr at google.com
Fri Dec 20 04:45:00 PST 2013


  Also added some docs (to be tried with doxygen, "compiling...").

  Re: gas - was looking here https://sourceware.org/binutils/docs/as/Pseudo-Ops.html


================
Comment at: test/MC/COFF/static_offset.s:15
@@ +14,3 @@
+// CHECK:       SectionData (
+// CHECK-NEXT:    0000: 03000000 90909003 000000
+// CHECK-NEXT:  )
----------------
Eric Christopher wrote:
> If you could explain the numbers here in a comment it would be appreciated.
OK, done.
I've also one `ret` rather three `nop`s as in real-world examples `.offset` will likely be 4-byte aligned.

================
Comment at: test/MC/COFF/secref.s:8
@@ +7,3 @@
+
+// CHECK:       Relocations [
+// CHECK-NEXT:    0x0 IMAGE_REL_I386_SECTION .text
----------------
Eric Christopher wrote:
> What about cross section relocations?
Added more tests

================
Comment at: lib/MC/MCAssembler.cpp:963
@@ +962,3 @@
+  OSE.flush();
+  return OldSize != Data.size();
+}
----------------
Rafael Ávila de Espíndola wrote:
> Data.size() is always 4. The initialization use 4 zero bytes, so this always returns false, no? If so, why is this part of the relaxation?
> Data.size() is always 4. The initialization use 4 zero bytes, so this always returns false, no?

Yeah - good catch.
I've updated the code accordingly.

> If so, why is this part of the relaxation?

I'm not very familiar with the code, so might be doing this wrong.
Do you recommend to move writing the actual bytes of the AddrDelta?
If so, where do this belongs?


http://llvm-reviews.chandlerc.com/D2445



More information about the llvm-commits mailing list