Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions 12 tools/strip-lib.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# nulls the timestamp filed in a windows .lib archive,
# making the lib reproducable.
# nulls the timestamp field in a windows .lib archive,
# making the lib reproducible.
# the time is the TimeDateStamp in the COFF file header, four bytes at offset 4
# See https://blog.conan.io/2019/09/02/Deterministic-builds-with-C-C++.html
# also: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#archive-library-file-format
#
# There are some additional fixes added for reproducability, such as fixing the zero-padding of names in the coff
# There are some additional fixes added for reproducibility, such as fixing the zero-padding of names in the coff
# section headers.

import struct
Expand Down Expand Up @@ -82,7 +82,7 @@ def read_lib(fp):
print("longnames", result["longnames"])
h = None

# now read the headers, possibly we alread read one above.
# now read the headers, possibly we already read one above.
while True:
if h is None:
h = header_read(fp)
Expand Down Expand Up @@ -202,13 +202,13 @@ def first_lm_write(fp, lm):

def second_lm_read(fp):
# number of members
m = struct.unpack("<L", fp.read(4))[0] # unsigned long, big-endian
m = struct.unpack("<L", fp.read(4))[0] # unsigned long, little-endian
offsets = []
for _ in range(m):
offsets.append(struct.unpack("<L", fp.read(4))[0])

# number of symbols
n = struct.unpack("<L", fp.read(4))[0] # unsigned long, big-endian
n = struct.unpack("<L", fp.read(4))[0] # unsigned long, little-endian
indices = []
for _ in range(n):
indices.append(struct.unpack("<H", fp.read(2))[0]) # unsigned short
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.