forked from OSchip/llvm-project
llvm-ar: Don't add an unnecessary alignment in gnu mode.
This is mostly for getting stricter testing in preparation for future changes. llvm-svn: 314000
This commit is contained in:
parent
fbccb0a8d2
commit
d5d77372d4
|
@ -351,7 +351,8 @@ writeSymbolTable(raw_fd_ostream &Out, object::Archive::Kind Kind,
|
||||||
|
|
||||||
// ld64 requires the next member header to start at an offset that is
|
// ld64 requires the next member header to start at an offset that is
|
||||||
// 4 bytes aligned.
|
// 4 bytes aligned.
|
||||||
unsigned Pad = OffsetToAlignment(Out.tell(), 4);
|
unsigned Alignment = isBSDLike(Kind) ? 4 : 2;
|
||||||
|
unsigned Pad = OffsetToAlignment(Out.tell(), Alignment);
|
||||||
while (Pad--)
|
while (Pad--)
|
||||||
Out.write(uint8_t(0));
|
Out.write(uint8_t(0));
|
||||||
|
|
||||||
|
|
|
@ -122,3 +122,11 @@ RUN: llvm-ar --format=bsd rcsU %t.a %p/Inputs/trivial-object-test.macho-x86-64
|
||||||
RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN %s < %t.a
|
RUN: FileCheck --check-prefix=MACHO-SYMTAB-ALIGN %s < %t.a
|
||||||
MACHO-SYMTAB-ALIGN: !<arch>
|
MACHO-SYMTAB-ALIGN: !<arch>
|
||||||
MACHO-SYMTAB-ALIGN-NEXT: #1/12 {{..........}} 0 0 0 36 `
|
MACHO-SYMTAB-ALIGN-NEXT: #1/12 {{..........}} 0 0 0 36 `
|
||||||
|
|
||||||
|
With a gnu symbol table we only align to two
|
||||||
|
8 + 60 + 14 = 82
|
||||||
|
RUN: rm -f %t.a
|
||||||
|
RUN: llvm-ar --format=gnu rcsD %t.a %p/Inputs/trivial-object-test.macho-x86-64
|
||||||
|
RUN: FileCheck --check-prefix=GNU-SYMTAB-ALIGN %s < %t.a
|
||||||
|
GNU-SYMTAB-ALIGN: !<arch>
|
||||||
|
GNU-SYMTAB-ALIGN-NEXT: / 0 0 0 0 14 `
|
||||||
|
|
Loading…
Reference in New Issue