Bug 22804 – [REG 2.099] compiling multiple files without linking produces broken object files

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2022-02-21T22:30:12Z
Last change time
2022-02-27T19:50:57Z
Keywords
pull
Assigned to
No Owner
Creator
Rainer Schuetze

Comments

Comment #0 by r.sagitario — 2022-02-21T22:30:12Z
Compile these two files: // xfile.d module file; // xstring.d module xstring; string[] tokenizeArgs(string text) { return []; } /////// with > dmd -m32mscoff -c xfile.d xstring.d and link them with // main.d import xstring; void main(string[] args) { auto arr = tokenizeArgs(args[0]); } via > dmd -m32mscoff main.d xfile.obj xstring.obj causes xstring.obj : error LNK2005: __D5xfile12__ModuleInfoZ already defined in xfile.obj main.obj : error LNK2019: unresolved external symbol __D7xstring12tokenizeArgsFAyaZAQf referenced in function __Dmain main.exe : fatal error LNK1120: 1 unresolved externals Error: linker exited with status 1120 a) xstring.obj contains a definition for the module xfile b) the symbol for tokenizeArgs is missing from xstring.obj Looking at the object files, it seems xfile,obj is repeated inside of xstring.obj
Comment #1 by dlang-bot — 2022-02-22T13:06:35Z
@ljmf00 created dlang/dmd pull request #13704 "Fix issue 22804: multiple object files without linking produces broken files" fixing this issue: - Fix issue 22804: multiple object files without linking produces broken files Signed-off-by: Luís Ferreira <[email protected]> https://github.com/dlang/dmd/pull/13704
Comment #2 by dlang-bot — 2022-02-22T14:41:22Z
dlang/dmd pull request #13704 "Fix issue 22804: multiple object files without linking produces broken files" was merged into stable: - 7471cce04d21a26609bffeb418de272661d266ed by Luís Ferreira: Fix issue 22804: multiple object files without linking produces broken files Signed-off-by: Luís Ferreira <[email protected]> https://github.com/dlang/dmd/pull/13704
Comment #3 by dlang-bot — 2022-02-27T19:50:57Z
dlang/dmd pull request #13725 "Merge remote-tracking branch 'upstream/stable' into merge_stable" was merged into master: - db532519f73247d87b82c058b7bafdd2111b89f1 by Luís Ferreira: Fix issue 22804: multiple object files without linking produces broken files (#13704) * test: add $IMPORT_FILES variable to dshell testsuite Signed-off-by: Luís Ferreira <[email protected]> * Fix issue 22804: multiple object files without linking produces broken files Signed-off-by: Luís Ferreira <[email protected]> https://github.com/dlang/dmd/pull/13725