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

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

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

Changes: https://git.openjdk.java.net/jdk/pull/4390/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4390&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8268327
  Stats: 273 lines in 5 files changed: 203 ins; 58 del; 12 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4390.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4390/head:pull/4390

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

Reply via email to