[pkg-d-commits] [ldc] 94/211: LDMD: Prevent object file collisions when creating static libs

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit 44e7511e46689471a01c8c36ef37b776773bf379
Author: Martin <noone at nowhere.com>
Date:   Sat Oct 15 00:45:12 2016 +0200

    LDMD: Prevent object file collisions when creating static libs
    
    Approximate DMD behavior by naming the temporary object files uniquely
    and, if successful, removing all generated object files.
    
    Executables and shared libs imply -singleobj => no collisions.
---
 driver/ldmd.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/driver/ldmd.cpp b/driver/ldmd.cpp
index e0db5bc..66e9ed4 100644
--- a/driver/ldmd.cpp
+++ b/driver/ldmd.cpp
@@ -888,6 +888,14 @@ void buildCommandLine(std::vector<const char *> &r, const Params &p) {
   }
   if (p.emitStaticLib) {
     r.push_back("-lib");
+
+    // DMD seems to emit objects directly into the static lib being generated.
+    // No object files are created and therefore they never collide due to
+    // duplicate .d filenames (in different dirs).
+    // Approximate that behavior by naming the object files uniquely via -oq and
+    // instructing LDC to remove the object files on success.
+    r.push_back("-oq");
+    r.push_back("-cleanup-obj");
   }
   // -quiet is the default in (newer?) frontend versions, just ignore it.
   if (p.release) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list