================
@@ -0,0 +1,41 @@
+#ifdef LIBC_COPT_PRINTF_MODULAR
+#include "src/__support/arg_list.h"
+
+#define LIBC_PRINTF_DEFINE_MODULAR
+#include "src/stdio/printf_core/float_dec_converter.h"
+#include "src/stdio/printf_core/float_hex_converter.h"
+#include "src/stdio/printf_core/parser.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace printf_core {
+template class Parser<internal::ArgList>;
+template class Parser<internal::DummyArgList<false>>;
+template class Parser<internal::DummyArgList<true>>;
+template class Parser<internal::StructArgList<false>>;
+template class Parser<internal::StructArgList<true>>;
+
+#define INSTANTIATE_CONVERT_FN(NAME)                                           
\
+  template int NAME<WriteMode::FILL_BUFF_AND_DROP_OVERFLOW>(                   
\
+      Writer<WriteMode::FILL_BUFF_AND_DROP_OVERFLOW> * writer,                 
\
+      const FormatSection &to_conv);                                           
\
+  template int NAME<WriteMode::FLUSH_TO_STREAM>(                               
\
+      Writer<WriteMode::FLUSH_TO_STREAM> * writer,                             
\
+      const FormatSection &to_conv);                                           
\
+  template int NAME<WriteMode::RESIZE_AND_FILL_BUFF>(                          
\
+      Writer<WriteMode::RESIZE_AND_FILL_BUFF> * writer,                        
\
+      const FormatSection &to_conv);                                           
\
+  template int NAME<WriteMode::RUNTIME_DISPATCH>(                              
\
+      Writer<WriteMode::RUNTIME_DISPATCH> * writer,                            
\
+      const FormatSection &to_conv)
+
+INSTANTIATE_CONVERT_FN(convert_float_decimal);
+INSTANTIATE_CONVERT_FN(convert_float_dec_exp);
+INSTANTIATE_CONVERT_FN(convert_float_dec_auto);
+INSTANTIATE_CONVERT_FN(convert_float_hex_exp);
+
+} // namespace printf_core
+} // namespace LIBC_NAMESPACE_DECL
+
+// Bring this file into the link if __printf_float is referenced.
+extern "C" void __printf_float() {}
----------------
statham-arm wrote:

OK – of course you're right that those workarounds can easily be added later. 
As long as you've thought about this and checked it, I'm happy.

(Now I've slept on it, I think I vaguely recall that one rationale for 
armlink's choice of behavior is that it makes partial linking change the 
semantics less: if you combine a bunch of `.o` files into one big `.o`, then 
passing the combined file to a full link step has a very similar effect to 
passing the individual files one by one.)

https://github.com/llvm/llvm-project/pull/147426
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to