> On 25 Oct 2023, at 15:02, Christian Lindig <[email protected]> wrote:
>
>
>
>> On 25 Oct 2023, at 14:52, Edwin Török <[email protected]> wrote:
>>
>> From: Edwin Török <[email protected]>
>>
>> The code currently uses GCC to compile OCaml C stubs directly,
>> and although in most cases this works, it is not entirely correct.
>>
>> This will fail if the OCaml runtime has been recompiled to use and link with
>> ASAN for example
>> (or other situations where a flag needs to be used consistently in
>> everything that is linked into the same binary).
>>
>> Use the OCaml compiler instead, which knows how to invoke the correct C
>> compiler with the correct flags,
>> and append the Xen specific CFLAGS to that instead.
>>
>> Drop the explicit -fPIC and -I$(ocamlc -where): these will now be provided
>> by the compiler as needed.
>>
>> Use -verbose so we see the actuall full C compiler command line invocation
>> done by the OCaml compiler.
>>
>> Signed-off-by: Edwin Török <[email protected]>
>
> Acked-by: Christian Lindig <[email protected]>
>
> I like using the OCaml compiler to compile stubs as it knows how to handle C
> files and will invoke the C compiler with the correct flags. However, this is
> the kind of change that would be good to have tested on all supported
> platforms. I therefore invite comments from those who maintain the build
> process.
There was a CI failure. I've pushed an updated version of this patch here:
https://gitlab.com/xen-project/people/edwintorok/xen/-/commit/137ffad324eb82884e7ac6f46f618459d365693e
If it passes the CI this time I'll send out a V2, looks like the -fPIC flag is
needed on some platforms and is not automatically added by the OCaml compiler.
Best regards,
--Edwin