File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,11 @@ \subsection{Build Depends}
298298includes itself twice). This is to help resolve as many dependencies as possible. In the last pass
299299the symbol \texttt {LTM\_ LAST } will be defined. This is useful for `` trims'' .
300300
301+ Note that the configuration system relies
302+ on dead code elimination. Unfortunately this can result in linking errors on compilers which
303+ perform insufficient dead code elimination. In particular MSVC with the /Od option enabled shows this issue.
304+ The issue can be resolved by passing the /O option instead to the compiler.
305+
301306\subsection {Build Trims }
302307A trim is a manner of removing functionality from a function that is not required. For instance,
303308to perform RSA cryptography you only require exponentiation with odd moduli so even moduli support
Original file line number Diff line number Diff line change @@ -117,6 +117,25 @@ mp_err s_read_wincsp(void *p, size_t n);
117117mp_err s_read_getrandom (void * p , size_t n );
118118mp_err s_read_urandom (void * p , size_t n );
119119
120+ /*
121+ * Note: libtommath relies on dead code elimination
122+ * for the configuration system, i.e., the MP_HAS macro.
123+ *
124+ * If you observe linking errors in this functions,
125+ * your compiler does not perform the dead code compilation
126+ * such that the unused functions are still referenced.
127+ *
128+ * This happens for example for MSVC if the /Od compilation
129+ * option is given. The option /Od instructs MSVC to
130+ * not perform any "optimizations", not even removal of
131+ * dead code wrapped in `if (0)` blocks.
132+ *
133+ * If you still insist on compiling with /Od, simply
134+ * comment out the lines which result in linking errors.
135+ *
136+ * We intentionally don't fix this issue in order
137+ * to have a single point of failure for misconfigured compilers.
138+ */
120139mp_err s_mp_rand_platform (void * p , size_t n )
121140{
122141 mp_err err = MP_ERR ;
You can’t perform that action at this time.
0 commit comments