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

Jorn Vernee jvernee at openjdk.java.net
Tue Jun 8 14:25:22 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

This pull request has now been integrated.

Changeset: 8158b822
Author:    Jorn Vernee <jvernee at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/8158b82269513a60c13bb10a6edfa82f806e8efc
Stats:     273 lines in 5 files changed: 203 ins; 58 del; 12 mod

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

Reviewed-by: erikj, sundar

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

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



More information about the build-dev mailing list