[llvm] r294557 - Object: pad BSD ar string table to 4-bytes

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 20:40:04 PST 2017


On Wed, Feb 8, 2017 at 8:26 PM, Saleem Abdulrasool via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: compnerd
> Date: Wed Feb  8 22:26:21 2017
> New Revision: 294557
>
> URL: http://llvm.org/viewvc/llvm-project?rev=294557&view=rev
> Log:
> Object: pad BSD ar string table to 4-bytes
>
> cctools would pad the string table to a sizeof(int32_t) (explicitly
> printed out by cctools rather than 4).  This adjusts the string table to
> make it more compatible with cctools, but is insufficient to make ld64
> happy.
>
> Modified:
>     llvm/trunk/lib/Object/ArchiveWriter.cpp
>
> Modified: llvm/trunk/lib/Object/ArchiveWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ArchiveWriter.cpp?rev=294557&r1=294556&r2=294557&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Object/ArchiveWriter.cpp (original)
> +++ llvm/trunk/lib/Object/ArchiveWriter.cpp Wed Feb  8 22:26:21 2017
> @@ -316,6 +316,10 @@ writeSymbolTable(raw_fd_ostream &Out, ob
>    if (HeaderStartOffset == 0)
>      return 0;
>
> +  if (Kind == object::Archive::K_BSD)
> +    for (unsigned P = OffsetToAlignment(NameOS.tell(), sizeof(int32_t)); P--;)
> +      NameOS << '\0';
> +

Thanks. Can you please add a comment so that we don't forget about the
reason? (Also, is there a way to test this? I assume no because it
relies on ld64 specific behaviour, but asking just in case).

--
Davide


More information about the llvm-commits mailing list