[JITLink][MachO] Fix common symbol size plumbing.

This fixes the underlying bug that was exposed by 298e183e81.
This commit is contained in:
Lang Hames 2019-12-19 20:41:59 -08:00
parent de21704ba9
commit d9220b580b
3 changed files with 7 additions and 2 deletions

View File

@ -873,7 +873,7 @@ public:
uint64_t Alignment, bool IsLive) {
auto &Sym = Symbol::constructCommon(
Allocator.Allocate<Symbol>(),
createBlock(Section, Address, Size, Alignment, 0), Name, Size, S,
createBlock(Section, Size, Address, Alignment, 0), Name, Size, S,
IsLive);
Section.addSymbol(Sym);
return Sym;

View File

@ -313,7 +313,7 @@ Error MachOLinkGraphBuilder::graphifyRegularSymbols() {
return make_error<JITLinkError>("Anonymous common symbol at index " +
Twine(KV.first));
NSym.GraphSymbol = &G->addCommonSymbol(
*NSym.Name, NSym.S, getCommonSection(), NSym.Value, 0,
*NSym.Name, NSym.S, getCommonSection(), 0, NSym.Value,
1ull << MachO::GET_COMM_ALIGN(NSym.Desc),
NSym.Desc & MachO::N_NO_DEAD_STRIP);
} else {

View File

@ -4,6 +4,11 @@
.section __TEXT,__text,regular,pure_instructions
# Check that common symbols work.
# jitlink-check: *{4}common_symbol = 0
# jitlink-check: common_symbol[1:0] = 0
.comm common_symbol,4,2
.align 4, 0x90
Lanon_func:
retq