LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 41707 - llvm-ranlib does not support -D flag
Summary: llvm-ranlib does not support -D flag
Status: RESOLVED FIXED
Alias: None
Product: tools
Classification: Unclassified
Component: llvm-ar (show other bugs)
Version: trunk
Hardware: PC All
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords: beginner
Depends on:
Blocks:
 
Reported: 2019-05-02 03:35 PDT by Alexander Richardson
Modified: 2020-01-02 04:48 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Richardson 2019-05-02 03:35:09 PDT
I have been trying to build FreeBSD (well CheriBSD actually) with llvm binutils instead of elftoolchain utilities.
I noticed that building static archives was failing because ranlib is invoked with the -D flag which is not supported by llvm-ranlib.

FreeBSD manpage:

     -D      When used in combination with the -r or -q option, with the -s
             option without other options, or when invoked as ranlib, insert
             0's instead of the real mtime, uid and gid values and 0644
             instead of file mode from the members named by arguments file
             ....  This ensures that checksums on the resulting archives are
             reproducible when member contents are identical.  This option is
             enabled by default.  If multiple -D and -U options are specified
             on the command line, the final one takes precedence.

GNU manpage:
       -D  Operate in deterministic mode.  The symbol map archive member's header will show zero for the UID, GID, and timestamp.  When this option is used, multiple runs will produce identical
           output files.

           If binutils was configured with --enable-deterministic-archives, then this mode is on by default.  It can be disabled with the -U option, described below.
Comment 1 Jordan Rupprecht 2019-05-03 11:11:47 PDT
llvm-ar supports both D and U, but it looks like we don't have that hooked up for the ranlib entry point. We should add those.

As for local workarounds: deterministic is the default for llvm-ar/llvm-ranlib, so you can just remove it. Or you can run "llvm-ar Ds" since ranlib == ar s.
Comment 2 Alexander Richardson 2020-01-02 04:48:43 PST
Fixed in https://reviews.llvm.org/rG535b3c6b2f1c81ed91942ebd9ea06a1022dc59a1