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

2021-06-07 Thread Athijegannathan Sundararajan
On Mon, 7 Jun 2021 13:23:46 GMT, Jorn Vernee  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

LGTM

-

Marked as reviewed by sundar (Reviewer).

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


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

2021-06-07 Thread Erik Joelsson
On Mon, 7 Jun 2021 13:23:46 GMT, Jorn Vernee  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


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

2021-06-07 Thread Jorn Vernee
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=4390=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