Note that there are some explanatory texts on larger screens.

plurals
  1. PO`ar` library override timestamp
    primarykey
    data
    text
    <p>the .a archive format header requires a timestamp. This has led to countless headaches when I rebuild a static library, mainly because I can't exactly reproduce the original binary.</p> <p>For example (this is on my Mac, but the same thing happens in x64 linux):</p> <pre><code>$ cat foo.h int foo(); $ cat foo.c #include "foo.h" int foo() { return 3; } $ gcc -fno-pic -m64 -arch x86_64 -I/usr/local/include -O3 -c foo.c -o foo.o -fpic $ ar rcs libfoo.a foo.o $ md5 libfoo.a MD5 (libfoo.a) = 0d0e6606185de4e994c47f4a0e54c1c4 $ mv libfoo.a libfoo.a1 $ ar rcs libfoo.a foo.o $ md5 libfoo.a MD5 (libfoo.a) = 22a69d42e1325ae8f978c2a18a4886da </code></pre> <p>To prove to myself that the only difference was time, I took a diff based on hexdump:</p> <pre><code>$ diff &lt;(hexdump libfoo.a) &lt;(hexdump libfoo.a1) 2,3c2,3 &lt; 0000010 20 20 20 20 20 20 20 20 31 33 31 31 30 34 33 30 &lt; 0000020 38 36 20 20 35 30 31 20 20 20 32 30 20 20 20 20 --- &gt; 0000010 20 20 20 20 20 20 20 20 31 33 31 31 30 34 32 38 &gt; 0000020 37 31 20 20 35 30 31 20 20 20 32 30 20 20 20 20 </code></pre> <p>which, if you backsolve using the header format, corresponds to the time field.</p> <p>Manpage gives no indication of whether or not it is possible to override the timestamp from the header. Any thoughts?</p> <p>Edit: yes, it is possible to go back and physically hack the file to use an arbitrary timestamp. yes, it is possible to change the program's behavior. Given the circumstances surrounding the situation, not all of which are strictly technical in nature, a tool to manually change the timestamp is not acceptable, nor is a modified version of <code>ar</code>, nor is messing with the actual system time.</p> <p>Edit: In this circumstance, I have to prove that, without any unacceptable deviation from the build path, the binaries can be produced from source. In some industries (e.g. finance) this is apparently a standard practice. A handrolled tool to change the timestamps is unacceptable (because a special tool, which was not in the original build path, was used). A handrolled version of <code>ar</code> is unacceptable (similar problem). The problem with changing system clock is that the build would have to be perfectly coordinated (it is an hour-long build with a lot of libraries and binaries). Acceptable solutions include:</p> <ul> <li>flags to AR or other programs that could override the timestamp in the library</li> <li>an existing (age > 1 year) tool to do this</li> <li>flags to GCC that could override the timestamp coming from ar when doing the linking</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload