<div dir="ltr"><div>Could dmd/ldc/gdc produce user defined attributes embedded (eg as json string) embedded in some section of the object file/static/shared library, eg:</div><div><br></div><div>```</div><div><div>{"compiler" : "dmd", "version" : "2.072", "flags" : "-O -debug"}</div><div>```</div></div><div><br></div><div>with some way to write and read those attributes, so that tooling can give informative warnings or errors when attempting to link together several libraries whose attributes don't match (user defined function can decide what matches based on those attributes), or to select which libraries to link if there are several choices</div><div><br></div><div><br></div>NOTE: posted a more general question here [1] beyond just D usage<div><br></div><div>[1] <a href="http://stackoverflow.com/questions/41240093/how-to-annotate-a-compilation-output-object-library-file-with-compiler-annotat">http://stackoverflow.com/questions/41240093/how-to-annotate-a-compilation-output-object-library-file-with-compiler-annotat</a></div><div><div><br></div><div>quote from that question:</div><div>----</div><div><br></div></div><div><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">Use cases:</p><ul style="margin:0px 0px 1em 30px;padding:0px;border:0px;font-size:15px;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif"><li style="margin:0px 0px 0.5em;padding:0px;border:0px;word-wrap:break-word"><p style="margin:0px;padding:0px;border:0px;clear:both">either the linker ld or some other user defined tool could use this metadata to give informative warnings or errors when attempting to link together several libraries whose attributes don't match (eg when linking libraries compiles with -std=c++11 with others compiled without this)</p></li><li style="margin:0px 0px 0.5em;padding:0px;border:0px;word-wrap:break-word"><p style="margin:0px;padding:0px;border:0px;clear:both">this would provide much more user friendly error messages compared to the usual hard to debug undefined symbol errors, eg: undefined reference to <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">llvm::Twine::str[abi:cxx11]()</code> <a href="https://github.com/ldc-developers/ldc/issues/1928" rel="nofollow noreferrer" style="margin:0px;padding:0px;border:0px;color:rgb(0,89,153);text-decoration:none">https://github.com/ldc-developers/ldc/issues/1928</a> or other errors that are due to compilation flag mismatches (eg missing <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida console","liberation mono","dejavu sans mono","bitstream vera sans mono","courier new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">-debug</code> from <a href="https://github.com/rejectedsoftware/vibe.d/issues/740#issuecomment-268039416" rel="nofollow noreferrer" style="margin:0px;padding:0px;border:0px;color:rgb(0,89,153);text-decoration:none">https://github.com/rejectedsoftware/vibe.d/issues/740#issuecomment-268039416</a>)</p></li><li style="margin:0px;padding:0px;border:0px;word-wrap:break-word"><p style="margin:0px;padding:0px;border:0px;clear:both">make it possible for tools to read the embedded metadata and find the most appropriate matching libraries to link when multiple ones are available</p></li></ul><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif">NOTE: the only thing I could find was <a href="https://gcc.gnu.org/onlinedocs/gccint/LTO-object-file-layout.html" rel="nofollow noreferrer" style="margin:0px;padding:0px;border:0px;color:rgb(0,89,153);text-decoration:none">https://gcc.gnu.org/onlinedocs/gccint/LTO-object-file-layout.html</a> but not sure if that's relevant or how I would write (and later read) such user defined attributes:</p><blockquote style="margin:0px 0px 10px;padding:10px;border-width:0px 0px 0px 2px;border-top-style:initial;border-right-style:initial;border-bottom-style:initial;border-left-style:solid;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:rgb(255,235,142);font-size:15px;quotes:none;background-color:rgb(255,248,220);color:rgb(36,39,41);font-family:arial,"helvetica neue",helvetica,sans-serif"><p style="margin:0px;padding:0px;border:0px;clear:both">Command line options (.gnu.lto_.opts): This section contains the command line options used to generate the object files</p></blockquote></div></div>