[PATCH] MachObjectWriter: optimize the string table for common suffices
hans at chromium.org
Mon Oct 6 10:15:11 PDT 2014
Comment at: lib/MC/StringTableBuilder.cpp:72
@@ -68,2 +71,3 @@
+ StringTable += '\x00';
> Would it make sense to have an else clause that asserted the kind was ELF? Maybe use a fully covered switch? My thinking is that it would make it easier to catch potential bugs if we ever added a new object file format.
Sounds good to me. I've turned it into a switch, and did the same above.
Comment at: test/MC/MachO/variable-exprs.s:208
@@ -207,3 +207,3 @@
// CHECK-I386: ('n_desc', 0)
-// CHECK-I386: ('n_value', 4)
+// CHECK-I386: ('n_value', 7)
// CHECK-I386: ('_string', 'd2')
> hans wrote:
> > This is the only part where I'm not sure what's going on :/
> Obligatory arcane Mach-O infodump:
> > If the type is N_INDR then the symbol is defined to be the same as another symbol.
> > In this case the n_value field is an index into the string table of the other symbol's name.
> `d2` is defined to be the same as `d`. `d` has a `n_strx` of 7. This means that `d2` should have an `n_value` of 7 as well.
Thanks for digging that out! Now it makes sense :)
More information about the llvm-commits