On Wed, 14 Jul 2021, Martin Storsjö wrote:
This avoids compiling the object files that go into libmsvcrt*.a
10 times, and object files that go into libucrt*.a twice.
This reduces the number of built object files for a build for i686
from 885 to 747, and shrinks the generate Makefile.in from 9.8 MB
to 8.9 MB, by emitting per-object rules for fewer object files.
This in itself isn't a huge saving, but there's a general trend of
wanting to move more object files from libmingwex.a into libmvscr*.a,
to allow UCRT builds to use the UCRT provided version of functions
instead of statically linking our own version. And moving object files
in that direction is a bit costly currently as each of them end up
compiled multiple times.
Signed-off-by: Martin Storsjö <[email protected]>
---
This builds a separate (non-installed) static library from the def files
(named <libname>_def.a), and then merges that with the intermediate static
libraries containing the shared object files. If there's suggestions on
ways of doing it more straightforwardly, I'm all ears.
FWIW, llvm-ar actually has a (nonstandard/new) option 'L' for merging
one static library into another one, but as GNU ar doesn't have it, we
have to stick to mri scripts for merging static libraries.
We might be able to get away with just creating the target <libname>.a
from the def file and then merging in the object files directly into it
(with "OPEN <target>" instead of "CREATE <target>" in the mri script),
but llvm-ar doesn't support the OPEN command in mri scripts; in practice
those extra intermediate libs aren't an issue.
---
mingw-w64-crt/Makefile.am | 312 +++++++++++-----------
mingw-w64-crt/lib-common/crtdll.mri | 5 +
mingw-w64-crt/lib-common/msvcr100.mri | 5 +
mingw-w64-crt/lib-common/msvcr110.mri | 5 +
mingw-w64-crt/lib-common/msvcr120.mri | 5 +
mingw-w64-crt/lib-common/msvcr120_app.mri | 6 +
mingw-w64-crt/lib-common/msvcr120d.mri | 5 +
mingw-w64-crt/lib-common/msvcr80.mri | 5 +
mingw-w64-crt/lib-common/msvcr80_64.mri | 6 +
mingw-w64-crt/lib-common/msvcr90.mri | 5 +
mingw-w64-crt/lib-common/msvcr90d.mri | 5 +
mingw-w64-crt/lib-common/msvcrt-os.mri | 6 +
mingw-w64-crt/lib-common/ucrtbase.mri | 5 +
13 files changed, 213 insertions(+), 162 deletions(-)
create mode 100644 mingw-w64-crt/lib-common/crtdll.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr100.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr110.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr120.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr120_app.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr120d.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr80.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr80_64.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr90.mri
create mode 100644 mingw-w64-crt/lib-common/msvcr90d.mri
create mode 100644 mingw-w64-crt/lib-common/msvcrt-os.mri
create mode 100644 mingw-w64-crt/lib-common/ucrtbase.mri
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index edfbfc5f2..4b557105b 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -1245,6 +1220,12 @@ lib64/lib%.a: lib64/%.def
lib64/lib%.a: lib-common/%.def
$(DTDEF64) $<
+lib64/lib%_def.a: lib64/%.def
+ $(DTDEF32) $<
FWIW this is a typo here, it should be DTDEF64, in case someone wants to
try out the patch.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public