[PATCH v3 00/12] single-binary: compile once semihosting

Pierrick Bouvier posted 12 patches 2 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250804183950.3147154-1-pierrick.bouvier@linaro.org
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, Peter Maydell <peter.maydell@linaro.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
There is a newer version of this series
include/semihosting/common-semi.h             |   6 +
include/semihosting/guestfd.h                 |   7 --
include/semihosting/semihost.h                |   2 +
include/semihosting/syscalls.h                |  30 ++---
semihosting/arm-compat-semi-stub.c            |  19 +++
semihosting/arm-compat-semi.c                 |  65 ++++++++---
semihosting/guestfd.c                         |  26 +----
semihosting/syscalls.c                        | 109 +++++++++---------
...mon-semi-target.h => common-semi-target.c} |  22 ++--
...mon-semi-target.h => common-semi-target.c} |  27 +++--
semihosting/meson.build                       |  18 +--
target/arm/meson.build                        |   4 +
target/riscv/meson.build                      |   4 +
13 files changed, 190 insertions(+), 149 deletions(-)
create mode 100644 semihosting/arm-compat-semi-stub.c
rename target/arm/{common-semi-target.h => common-semi-target.c} (59%)
rename target/riscv/{common-semi-target.h => common-semi-target.c} (53%)
[PATCH v3 00/12] single-binary: compile once semihosting
Posted by Pierrick Bouvier 2 months, 1 week ago
This series compiles once semihosting files in system mode.
The most complicated file was semihosting/arm-compat-semi.c, which was carefully
cleaned in easy to understand steps.

v2
--

- use vaddr for syscalls.c/.h
- static qualifier for console_{in,out}_gf
- use vaddr for arm-compat-semi.c
- semihosting/arm-compat-semi: fix cast for common_semi_set_ret

v3
--

- keep common_semi_sys_exit_extended (Peter)

Pierrick Bouvier (12):
  semihosting/syscalls: compile once in system and per target for user
    mode
  semihosting/syscalls: replace uint64_t with vaddr where appropriate
  semihosting/guestfd: compile once for system/user
  semihosting/arm-compat-semi: change common_semi_sys_exit_extended
  target/riscv/common-semi-target: remove sizeof(target_ulong)
  target/{arm,riscv}/common-semi-target: eradicate target_ulong
  include/semihosting/common-semi: extract common_semi API
  semihosting/arm-compat-semi: eradicate sizeof(target_ulong)
  semihosting/arm-compat-semi: replace target_ulong with uint64_t
  semihosting/arm-compat-semi: eradicate target_long
  semihosting/arm-compat-semi: remove dependency on cpu.h
  semihosting/arm-compat-semi: compile once in system and per target for
    user mode

 include/semihosting/common-semi.h             |   6 +
 include/semihosting/guestfd.h                 |   7 --
 include/semihosting/semihost.h                |   2 +
 include/semihosting/syscalls.h                |  30 ++---
 semihosting/arm-compat-semi-stub.c            |  19 +++
 semihosting/arm-compat-semi.c                 |  65 ++++++++---
 semihosting/guestfd.c                         |  26 +----
 semihosting/syscalls.c                        | 109 +++++++++---------
 ...mon-semi-target.h => common-semi-target.c} |  22 ++--
 ...mon-semi-target.h => common-semi-target.c} |  27 +++--
 semihosting/meson.build                       |  18 +--
 target/arm/meson.build                        |   4 +
 target/riscv/meson.build                      |   4 +
 13 files changed, 190 insertions(+), 149 deletions(-)
 create mode 100644 semihosting/arm-compat-semi-stub.c
 rename target/arm/{common-semi-target.h => common-semi-target.c} (59%)
 rename target/riscv/{common-semi-target.h => common-semi-target.c} (53%)

-- 
2.47.2
Re: [PATCH v3 00/12] single-binary: compile once semihosting
Posted by Pierrick Bouvier 1 month, 3 weeks ago
On 2025-08-04 11:39, Pierrick Bouvier wrote:
> This series compiles once semihosting files in system mode.
> The most complicated file was semihosting/arm-compat-semi.c, which was carefully
> cleaned in easy to understand steps.
> 
> v2
> --
> 
> - use vaddr for syscalls.c/.h
> - static qualifier for console_{in,out}_gf
> - use vaddr for arm-compat-semi.c
> - semihosting/arm-compat-semi: fix cast for common_semi_set_ret
> 
> v3
> --
> 
> - keep common_semi_sys_exit_extended (Peter)
> 
> Pierrick Bouvier (12):
>    semihosting/syscalls: compile once in system and per target for user
>      mode
>    semihosting/syscalls: replace uint64_t with vaddr where appropriate
>    semihosting/guestfd: compile once for system/user
>    semihosting/arm-compat-semi: change common_semi_sys_exit_extended
>    target/riscv/common-semi-target: remove sizeof(target_ulong)
>    target/{arm,riscv}/common-semi-target: eradicate target_ulong
>    include/semihosting/common-semi: extract common_semi API
>    semihosting/arm-compat-semi: eradicate sizeof(target_ulong)
>    semihosting/arm-compat-semi: replace target_ulong with uint64_t
>    semihosting/arm-compat-semi: eradicate target_long
>    semihosting/arm-compat-semi: remove dependency on cpu.h
>    semihosting/arm-compat-semi: compile once in system and per target for
>      user mode
> 
>   include/semihosting/common-semi.h             |   6 +
>   include/semihosting/guestfd.h                 |   7 --
>   include/semihosting/semihost.h                |   2 +
>   include/semihosting/syscalls.h                |  30 ++---
>   semihosting/arm-compat-semi-stub.c            |  19 +++
>   semihosting/arm-compat-semi.c                 |  65 ++++++++---
>   semihosting/guestfd.c                         |  26 +----
>   semihosting/syscalls.c                        | 109 +++++++++---------
>   ...mon-semi-target.h => common-semi-target.c} |  22 ++--
>   ...mon-semi-target.h => common-semi-target.c} |  27 +++--
>   semihosting/meson.build                       |  18 +--
>   target/arm/meson.build                        |   4 +
>   target/riscv/meson.build                      |   4 +
>   13 files changed, 190 insertions(+), 149 deletions(-)
>   create mode 100644 semihosting/arm-compat-semi-stub.c
>   rename target/arm/{common-semi-target.h => common-semi-target.c} (59%)
>   rename target/riscv/{common-semi-target.h => common-semi-target.c} (53%)
> 

Ping on this series.
I'll be out next week, but it should be ready to be pulled once the 
trunk reopens.

Regards,
Pierrick
Re: [PATCH v3 00/12] single-binary: compile once semihosting
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
On 22/8/25 16:31, Pierrick Bouvier wrote:
> On 2025-08-04 11:39, Pierrick Bouvier wrote:
>> This series compiles once semihosting files in system mode.
>> The most complicated file was semihosting/arm-compat-semi.c, which was 
>> carefully
>> cleaned in easy to understand steps.
>>
>> v2
>> -- 
>>
>> - use vaddr for syscalls.c/.h
>> - static qualifier for console_{in,out}_gf
>> - use vaddr for arm-compat-semi.c
>> - semihosting/arm-compat-semi: fix cast for common_semi_set_ret
>>
>> v3
>> -- 
>>
>> - keep common_semi_sys_exit_extended (Peter)
>>
>> Pierrick Bouvier (12):
>>    semihosting/syscalls: compile once in system and per target for user
>>      mode
>>    semihosting/syscalls: replace uint64_t with vaddr where appropriate
>>    semihosting/guestfd: compile once for system/user
>>    semihosting/arm-compat-semi: change common_semi_sys_exit_extended
>>    target/riscv/common-semi-target: remove sizeof(target_ulong)
>>    target/{arm,riscv}/common-semi-target: eradicate target_ulong
>>    include/semihosting/common-semi: extract common_semi API
>>    semihosting/arm-compat-semi: eradicate sizeof(target_ulong)
>>    semihosting/arm-compat-semi: replace target_ulong with uint64_t
>>    semihosting/arm-compat-semi: eradicate target_long
>>    semihosting/arm-compat-semi: remove dependency on cpu.h
>>    semihosting/arm-compat-semi: compile once in system and per target for
>>      user mode
>>
>>   include/semihosting/common-semi.h             |   6 +
>>   include/semihosting/guestfd.h                 |   7 --
>>   include/semihosting/semihost.h                |   2 +
>>   include/semihosting/syscalls.h                |  30 ++---
>>   semihosting/arm-compat-semi-stub.c            |  19 +++
>>   semihosting/arm-compat-semi.c                 |  65 ++++++++---
>>   semihosting/guestfd.c                         |  26 +----
>>   semihosting/syscalls.c                        | 109 +++++++++---------
>>   ...mon-semi-target.h => common-semi-target.c} |  22 ++--
>>   ...mon-semi-target.h => common-semi-target.c} |  27 +++--
>>   semihosting/meson.build                       |  18 +--
>>   target/arm/meson.build                        |   4 +
>>   target/riscv/meson.build                      |   4 +
>>   13 files changed, 190 insertions(+), 149 deletions(-)
>>   create mode 100644 semihosting/arm-compat-semi-stub.c
>>   rename target/arm/{common-semi-target.h => common-semi-target.c} (59%)
>>   rename target/riscv/{common-semi-target.h => common-semi-target.c} 
>> (53%)
>>
> 
> Ping on this series.
> I'll be out next week, but it should be ready to be pulled once the 
> trunk reopens.

Modulo the comment on patch #9, the series is fully reviewed.


Re: [PATCH v3 00/12] single-binary: compile once semihosting
Posted by Pierrick Bouvier 1 month, 3 weeks ago
On 2025-08-22 07:56, Philippe Mathieu-Daudé wrote:
> On 22/8/25 16:31, Pierrick Bouvier wrote:
>> On 2025-08-04 11:39, Pierrick Bouvier wrote:
>>> This series compiles once semihosting files in system mode.
>>> The most complicated file was semihosting/arm-compat-semi.c, which was
>>> carefully
>>> cleaned in easy to understand steps.
>>>
>>> v2
>>> -- 
>>>
>>> - use vaddr for syscalls.c/.h
>>> - static qualifier for console_{in,out}_gf
>>> - use vaddr for arm-compat-semi.c
>>> - semihosting/arm-compat-semi: fix cast for common_semi_set_ret
>>>
>>> v3
>>> -- 
>>>
>>> - keep common_semi_sys_exit_extended (Peter)
>>>
>>> Pierrick Bouvier (12):
>>>     semihosting/syscalls: compile once in system and per target for user
>>>       mode
>>>     semihosting/syscalls: replace uint64_t with vaddr where appropriate
>>>     semihosting/guestfd: compile once for system/user
>>>     semihosting/arm-compat-semi: change common_semi_sys_exit_extended
>>>     target/riscv/common-semi-target: remove sizeof(target_ulong)
>>>     target/{arm,riscv}/common-semi-target: eradicate target_ulong
>>>     include/semihosting/common-semi: extract common_semi API
>>>     semihosting/arm-compat-semi: eradicate sizeof(target_ulong)
>>>     semihosting/arm-compat-semi: replace target_ulong with uint64_t
>>>     semihosting/arm-compat-semi: eradicate target_long
>>>     semihosting/arm-compat-semi: remove dependency on cpu.h
>>>     semihosting/arm-compat-semi: compile once in system and per target for
>>>       user mode
>>>
>>>    include/semihosting/common-semi.h             |   6 +
>>>    include/semihosting/guestfd.h                 |   7 --
>>>    include/semihosting/semihost.h                |   2 +
>>>    include/semihosting/syscalls.h                |  30 ++---
>>>    semihosting/arm-compat-semi-stub.c            |  19 +++
>>>    semihosting/arm-compat-semi.c                 |  65 ++++++++---
>>>    semihosting/guestfd.c                         |  26 +----
>>>    semihosting/syscalls.c                        | 109 +++++++++---------
>>>    ...mon-semi-target.h => common-semi-target.c} |  22 ++--
>>>    ...mon-semi-target.h => common-semi-target.c} |  27 +++--
>>>    semihosting/meson.build                       |  18 +--
>>>    target/arm/meson.build                        |   4 +
>>>    target/riscv/meson.build                      |   4 +
>>>    13 files changed, 190 insertions(+), 149 deletions(-)
>>>    create mode 100644 semihosting/arm-compat-semi-stub.c
>>>    rename target/arm/{common-semi-target.h => common-semi-target.c} (59%)
>>>    rename target/riscv/{common-semi-target.h => common-semi-target.c}
>>> (53%)
>>>
>>
>> Ping on this series.
>> I'll be out next week, but it should be ready to be pulled once the
>> trunk reopens.
> 
> Modulo the comment on patch #9, the series is fully reviewed.
> 

I'll send a v4 with this, thanks.

Re: [PATCH v3 00/12] single-binary: compile once semihosting
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
On 22/8/25 16:57, Pierrick Bouvier wrote:
> On 2025-08-22 07:56, Philippe Mathieu-Daudé wrote:
>> On 22/8/25 16:31, Pierrick Bouvier wrote:
>>> On 2025-08-04 11:39, Pierrick Bouvier wrote:
>>>> This series compiles once semihosting files in system mode.
>>>> The most complicated file was semihosting/arm-compat-semi.c, which was
>>>> carefully
>>>> cleaned in easy to understand steps.


>>> Ping on this series.
>>> I'll be out next week, but it should be ready to be pulled once the
>>> trunk reopens.
>>
>> Modulo the comment on patch #9, the series is fully reviewed.

Sorry, this was a comment for the maintainer, hoping he'd update the
comment while queuing the series, not asking you to respin another one.

Next time I'll be more verbose with such comments.

> I'll send a v4 with this, thanks.

We should be super good now ;)

Re: [PATCH v3 00/12] single-binary: compile once semihosting
Posted by Pierrick Bouvier 1 month, 3 weeks ago
On 2025-08-22 07:57, Pierrick Bouvier wrote:
> On 2025-08-22 07:56, Philippe Mathieu-Daudé wrote:
>> On 22/8/25 16:31, Pierrick Bouvier wrote:
>>> On 2025-08-04 11:39, Pierrick Bouvier wrote:
>>>> This series compiles once semihosting files in system mode.
>>>> The most complicated file was semihosting/arm-compat-semi.c, which was
>>>> carefully
>>>> cleaned in easy to understand steps.
>>>>
>>>> v2
>>>> -- 
>>>>
>>>> - use vaddr for syscalls.c/.h
>>>> - static qualifier for console_{in,out}_gf
>>>> - use vaddr for arm-compat-semi.c
>>>> - semihosting/arm-compat-semi: fix cast for common_semi_set_ret
>>>>
>>>> v3
>>>> -- 
>>>>
>>>> - keep common_semi_sys_exit_extended (Peter)
>>>>
>>>> Pierrick Bouvier (12):
>>>>      semihosting/syscalls: compile once in system and per target for user
>>>>        mode
>>>>      semihosting/syscalls: replace uint64_t with vaddr where appropriate
>>>>      semihosting/guestfd: compile once for system/user
>>>>      semihosting/arm-compat-semi: change common_semi_sys_exit_extended
>>>>      target/riscv/common-semi-target: remove sizeof(target_ulong)
>>>>      target/{arm,riscv}/common-semi-target: eradicate target_ulong
>>>>      include/semihosting/common-semi: extract common_semi API
>>>>      semihosting/arm-compat-semi: eradicate sizeof(target_ulong)
>>>>      semihosting/arm-compat-semi: replace target_ulong with uint64_t
>>>>      semihosting/arm-compat-semi: eradicate target_long
>>>>      semihosting/arm-compat-semi: remove dependency on cpu.h
>>>>      semihosting/arm-compat-semi: compile once in system and per target for
>>>>        user mode
>>>>
>>>>     include/semihosting/common-semi.h             |   6 +
>>>>     include/semihosting/guestfd.h                 |   7 --
>>>>     include/semihosting/semihost.h                |   2 +
>>>>     include/semihosting/syscalls.h                |  30 ++---
>>>>     semihosting/arm-compat-semi-stub.c            |  19 +++
>>>>     semihosting/arm-compat-semi.c                 |  65 ++++++++---
>>>>     semihosting/guestfd.c                         |  26 +----
>>>>     semihosting/syscalls.c                        | 109 +++++++++---------
>>>>     ...mon-semi-target.h => common-semi-target.c} |  22 ++--
>>>>     ...mon-semi-target.h => common-semi-target.c} |  27 +++--
>>>>     semihosting/meson.build                       |  18 +--
>>>>     target/arm/meson.build                        |   4 +
>>>>     target/riscv/meson.build                      |   4 +
>>>>     13 files changed, 190 insertions(+), 149 deletions(-)
>>>>     create mode 100644 semihosting/arm-compat-semi-stub.c
>>>>     rename target/arm/{common-semi-target.h => common-semi-target.c} (59%)
>>>>     rename target/riscv/{common-semi-target.h => common-semi-target.c}
>>>> (53%)
>>>>
>>>
>>> Ping on this series.
>>> I'll be out next week, but it should be ready to be pulled once the
>>> trunk reopens.
>>
>> Modulo the comment on patch #9, the series is fully reviewed.
>>
> 
> I'll send a v4 with this, thanks.

v4: 
https://lore.kernel.org/qemu-devel/20250822150058.18692-1-pierrick.bouvier@linaro.org/T/#u