Questions about the Hermetic Java project

dean.long at oracle.com dean.long at oracle.com
Fri Apr 19 20:49:40 UTC 2024


That probably was the wrong link to send.  According to this:

https://learn.microsoft.com/en-us/cpp/build/reference/dot-lib-files-as-linker-input?view=msvc-170

LIB can be used to create a standard library containing object files, 
which sounds like a Unix .a library.  But without an intermediate 
linking step, using .lib files from different modules to link the final 
.exe would be problematic, unless there was a way to tell the linker to 
perform /intra/-LIB symbol resolution first, before /inter/-LIB resolution.

dl

On 4/19/24 3:48 AM, Magnus Ihse Bursie wrote:
> On 2024-04-19 00:35, dean.long at oracle.com wrote:
>
>> There is also the LIB command, which creates the equivalent of a .a 
>> library, but with an explicit export list:
>>
>> https://learn.microsoft.com/en-us/cpp/build/reference/building-an-import-library-and-export-file?view=msvc-170 
>>
>
> This is where the Microsoft toolchain gets confusing. This will only 
> create an *import* library. An import library does not have a 
> corresponding concept in the clang/gcc toolchain. It is a static 
> library, yes, but it is a shim library with the single trivial purpose 
> to load and initialize the corresponding dll. So this does not help us 
> in building a "proper" static library.
>
> Unfortunately, this distinction was not entirely clear to me or the 
> other initial authors of the JDK build system, so things are confusing 
> there as well with regard to this. (I plan to address this.)
>
> /Magnus
>
>>
>> dl
>>
>> On 4/18/24 3:28 AM, Magnus Ihse Bursie wrote:
>>> What needs to be done then is:
>>>
>>> 1) Combine multiple .obj (COFF object files) into one.
>>>
>>> 2) Change the visibility of symbols that are not marked as 
>>> dll_export:ed to they appear like they were declared static.
>>>
>>> In the clang/gcc world, the first step is done by "partial linking" 
>>> by ld. That is our first blocker -- link.exe cannot do that. So the 
>>> first question is really, is there a Windows build of ld that can 
>>> work on COFF files to achieve this?
>>>
>>> The second step is done by objcopy using the "--localize-hidden" 
>>> argument. The second question is, could this work on a COFF object 
>>> file? 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/leyden-dev/attachments/20240419/1273670a/attachment.htm>


More information about the leyden-dev mailing list