RFR: 8268327: Upstream: 8268169: The system lookup can not find stdio functions such as printf on Windows 10

Erik Joelsson erikj at openjdk.java.net
Mon Jun 7 13:51:38 UTC 2021


On Mon, 7 Jun 2021 13:23:46 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Hi,
> 
> The documentation of `CLinker::systemLookup` [1] says this: 
> 
> 
> * Obtains a system lookup which is suitable to find symbols in the standard C libraries.
> 
> 
> However, currently it is not possible to look up common stdio.h symbols, such as `printf`, using the system lookup on Windows 10. This is because the backing library that is loaded, namely `ucrtbase.dll`, does not contain these symbols, as they are implemented in the standard library as inline functions.
> 
> This patch changes the system lookup implementation on Windows 10 to make these symbols findable as well, by using a fallback library that forces the generation of the code for the inline functions, and exposes the missing symbols as a table of function pointers.
> 
> See also the prior review of this patch for the panama-foreign repo: https://github.com/openjdk/panama-foreign/pull/547
> 
> Since the exact set of symbols findable by the system lookup is unspecified, and since the API in question (`CLinker::systemLookup`) was added only last week [2], I've elected to not create a CSR for this patch, but please let me know if one is needed).
> 
> Thanks,
> Jorn
> 
> [1] : https://github.com/openjdk/jdk/blob/master/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/CLinker.java#L134-L151
> [2] : https://github.com/openjdk/jdk/commit/a223189b069a7cfe49511d49b5b09e7107cb3cab

Build change looks good.

-------------

Marked as reviewed by erikj (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/4390



More information about the build-dev mailing list