Following what we did for hw/, we need target specific common libraries
for target. We need 2 different libraries:
- code common to a base architecture
- system code common to a base architecture
For user code, it can stay compiled per target for now.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 78 +++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 61 insertions(+), 17 deletions(-)
diff --git a/meson.build b/meson.build
index 68d36ac140f..7b2cf3cd7d1 100644
--- a/meson.build
+++ b/meson.build
@@ -3684,6 +3684,8 @@ target_arch = {}
target_system_arch = {}
target_user_arch = {}
hw_common_arch = {}
+target_common_arch = {}
+target_common_system_arch = {}
# NOTE: the trace/ subdirectory needs the qapi_trace_events variable
# that is filled in by qapi/.
@@ -4087,29 +4089,59 @@ common_all = static_library('common',
# construct common libraries per base architecture
hw_common_arch_libs = {}
+target_common_arch_libs = {}
+target_common_system_arch_libs = {}
foreach target : target_dirs
config_target = config_target_mak[target]
target_base_arch = config_target['TARGET_BASE_ARCH']
+ target_inc = [include_directories('target' / target_base_arch)]
+ inc = [common_user_inc + target_inc]
- # check if already generated
- if target_base_arch in hw_common_arch_libs
- continue
- endif
+ # prevent common code to access cpu compile time definition,
+ # but still allow access to cpu.h
+ target_c_args = ['-DCPU_DEFS_H']
+ target_system_c_args = target_c_args + ['-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
if target_base_arch in hw_common_arch
- target_inc = [include_directories('target' / target_base_arch)]
- src = hw_common_arch[target_base_arch]
- lib = static_library(
- 'hw_' + target_base_arch,
- build_by_default: false,
- sources: src.all_sources() + genh,
- include_directories: common_user_inc + target_inc,
- implicit_include_directories: false,
- # prevent common code to access cpu compile time
- # definition, but still allow access to cpu.h
- c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU'],
- dependencies: src.all_dependencies())
- hw_common_arch_libs += {target_base_arch: lib}
+ if target_base_arch not in hw_common_arch_libs
+ src = hw_common_arch[target_base_arch]
+ lib = static_library(
+ 'hw_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_system_c_args,
+ dependencies: src.all_dependencies())
+ hw_common_arch_libs += {target_base_arch: lib}
+ endif
+ endif
+
+ if target_base_arch in target_common_arch
+ if target_base_arch not in target_common_arch_libs
+ src = target_common_arch[target_base_arch]
+ lib = static_library(
+ 'target_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_c_args,
+ dependencies: src.all_dependencies())
+ target_common_arch_libs += {target_base_arch: lib}
+ endif
+ endif
+
+ if target_base_arch in target_common_system_arch
+ if target_base_arch not in target_common_system_arch_libs
+ src = target_common_system_arch[target_base_arch]
+ lib = static_library(
+ 'target_system_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_system_c_args,
+ dependencies: src.all_dependencies())
+ target_common_system_arch_libs += {target_base_arch: lib}
+ endif
endif
endforeach
@@ -4282,12 +4314,24 @@ foreach target : target_dirs
target_common = common_ss.apply(config_target, strict: false)
objects = [common_all.extract_objects(target_common.sources())]
arch_deps += target_common.dependencies()
+ if target_base_arch in target_common_arch_libs
+ src = target_common_arch[target_base_arch].apply(config_target, strict: false)
+ lib = target_common_arch_libs[target_base_arch]
+ objects += lib.extract_objects(src.sources())
+ arch_deps += src.dependencies()
+ endif
if target_type == 'system' and target_base_arch in hw_common_arch_libs
src = hw_common_arch[target_base_arch].apply(config_target, strict: false)
lib = hw_common_arch_libs[target_base_arch]
objects += lib.extract_objects(src.sources())
arch_deps += src.dependencies()
endif
+ if target_type == 'system' and target_base_arch in target_common_system_arch_libs
+ src = target_common_system_arch[target_base_arch].apply(config_target, strict: false)
+ lib = target_common_system_arch_libs[target_base_arch]
+ objects += lib.extract_objects(src.sources())
+ arch_deps += src.dependencies()
+ endif
target_specific = specific_ss.apply(config_target, strict: false)
arch_srcs += target_specific.sources()
--
2.47.2
Hi Pierrick,
On 29/4/25 07:00, Pierrick Bouvier wrote:
> Following what we did for hw/, we need target specific common libraries
> for target. We need 2 different libraries:
> - code common to a base architecture
> - system code common to a base architecture
>
> For user code, it can stay compiled per target for now.
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> meson.build | 78 +++++++++++++++++++++++++++++++++++++++++------------
> 1 file changed, 61 insertions(+), 17 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 68d36ac140f..7b2cf3cd7d1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3684,6 +3684,8 @@ target_arch = {}
> target_system_arch = {}
> target_user_arch = {}
> hw_common_arch = {}
> +target_common_arch = {}
> +target_common_system_arch = {}
>
> # NOTE: the trace/ subdirectory needs the qapi_trace_events variable
> # that is filled in by qapi/.
> @@ -4087,29 +4089,59 @@ common_all = static_library('common',
>
> # construct common libraries per base architecture
> hw_common_arch_libs = {}
> +target_common_arch_libs = {}
> +target_common_system_arch_libs = {}
> foreach target : target_dirs
> config_target = config_target_mak[target]
> target_base_arch = config_target['TARGET_BASE_ARCH']
> + target_inc = [include_directories('target' / target_base_arch)]
> + inc = [common_user_inc + target_inc]
>
> - # check if already generated
> - if target_base_arch in hw_common_arch_libs
> - continue
> - endif
> + # prevent common code to access cpu compile time definition,
> + # but still allow access to cpu.h
> + target_c_args = ['-DCPU_DEFS_H']
> + target_system_c_args = target_c_args + ['-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
>
> if target_base_arch in hw_common_arch
> - target_inc = [include_directories('target' / target_base_arch)]
> - src = hw_common_arch[target_base_arch]
> - lib = static_library(
> - 'hw_' + target_base_arch,
> - build_by_default: false,
> - sources: src.all_sources() + genh,
> - include_directories: common_user_inc + target_inc,
> - implicit_include_directories: false,
> - # prevent common code to access cpu compile time
> - # definition, but still allow access to cpu.h
> - c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU'],
> - dependencies: src.all_dependencies())
> - hw_common_arch_libs += {target_base_arch: lib}
> + if target_base_arch not in hw_common_arch_libs
> + src = hw_common_arch[target_base_arch]
> + lib = static_library(
> + 'hw_' + target_base_arch,
> + build_by_default: false,
> + sources: src.all_sources() + genh,
> + include_directories: inc,
> + c_args: target_system_c_args,
> + dependencies: src.all_dependencies())
> + hw_common_arch_libs += {target_base_arch: lib}
> + endif
> + endif
> +
> + if target_base_arch in target_common_arch
> + if target_base_arch not in target_common_arch_libs
> + src = target_common_arch[target_base_arch]
> + lib = static_library(
> + 'target_' + target_base_arch,
> + build_by_default: false,
> + sources: src.all_sources() + genh,
> + include_directories: inc,
> + c_args: target_c_args,
> + dependencies: src.all_dependencies())
> + target_common_arch_libs += {target_base_arch: lib}
> + endif
> + endif
> +
> + if target_base_arch in target_common_system_arch
> + if target_base_arch not in target_common_system_arch_libs
> + src = target_common_system_arch[target_base_arch]
> + lib = static_library(
> + 'target_system_' + target_base_arch,
> + build_by_default: false,
> + sources: src.all_sources() + genh,
> + include_directories: inc,
> + c_args: target_system_c_args,
> + dependencies: src.all_dependencies())
> + target_common_system_arch_libs += {target_base_arch: lib}
> + endif
> endif
> endforeach
>
> @@ -4282,12 +4314,24 @@ foreach target : target_dirs
> target_common = common_ss.apply(config_target, strict: false)
> objects = [common_all.extract_objects(target_common.sources())]
> arch_deps += target_common.dependencies()
> + if target_base_arch in target_common_arch_libs
> + src = target_common_arch[target_base_arch].apply(config_target, strict: false)
> + lib = target_common_arch_libs[target_base_arch]
> + objects += lib.extract_objects(src.sources())
> + arch_deps += src.dependencies()
> + endif
> if target_type == 'system' and target_base_arch in hw_common_arch_libs
> src = hw_common_arch[target_base_arch].apply(config_target, strict: false)
> lib = hw_common_arch_libs[target_base_arch]
> objects += lib.extract_objects(src.sources())
> arch_deps += src.dependencies()
> endif
> + if target_type == 'system' and target_base_arch in target_common_system_arch_libs
> + src = target_common_system_arch[target_base_arch].apply(config_target, strict: false)
> + lib = target_common_system_arch_libs[target_base_arch]
> + objects += lib.extract_objects(src.sources())
> + arch_deps += src.dependencies()
> + endif
>
> target_specific = specific_ss.apply(config_target, strict: false)
> arch_srcs += target_specific.sources()
Somehow related to this patch, when converting from target_system_arch
to target_common_system_arch, emptying it, I get:
../../meson.build:4237:27: ERROR: Key microblaze is not in the dictionary.
4235 if target.endswith('-softmmu')
4236 target_type='system'
4237 t = target_system_arch[target_base_arch].apply(config_target,
strict: false)
On 4/29/25 11:01 AM, Philippe Mathieu-Daudé wrote:
> Hi Pierrick,
>
> On 29/4/25 07:00, Pierrick Bouvier wrote:
>> Following what we did for hw/, we need target specific common libraries
>> for target. We need 2 different libraries:
>> - code common to a base architecture
>> - system code common to a base architecture
>>
>> For user code, it can stay compiled per target for now.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> meson.build | 78 +++++++++++++++++++++++++++++++++++++++++------------
>> 1 file changed, 61 insertions(+), 17 deletions(-)
>>
>> diff --git a/meson.build b/meson.build
>> index 68d36ac140f..7b2cf3cd7d1 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -3684,6 +3684,8 @@ target_arch = {}
>> target_system_arch = {}
>> target_user_arch = {}
>> hw_common_arch = {}
>> +target_common_arch = {}
>> +target_common_system_arch = {}
>>
>> # NOTE: the trace/ subdirectory needs the qapi_trace_events variable
>> # that is filled in by qapi/.
>> @@ -4087,29 +4089,59 @@ common_all = static_library('common',
>>
>> # construct common libraries per base architecture
>> hw_common_arch_libs = {}
>> +target_common_arch_libs = {}
>> +target_common_system_arch_libs = {}
>> foreach target : target_dirs
>> config_target = config_target_mak[target]
>> target_base_arch = config_target['TARGET_BASE_ARCH']
>> + target_inc = [include_directories('target' / target_base_arch)]
>> + inc = [common_user_inc + target_inc]
>>
>> - # check if already generated
>> - if target_base_arch in hw_common_arch_libs
>> - continue
>> - endif
>> + # prevent common code to access cpu compile time definition,
>> + # but still allow access to cpu.h
>> + target_c_args = ['-DCPU_DEFS_H']
>> + target_system_c_args = target_c_args + ['-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
>>
>> if target_base_arch in hw_common_arch
>> - target_inc = [include_directories('target' / target_base_arch)]
>> - src = hw_common_arch[target_base_arch]
>> - lib = static_library(
>> - 'hw_' + target_base_arch,
>> - build_by_default: false,
>> - sources: src.all_sources() + genh,
>> - include_directories: common_user_inc + target_inc,
>> - implicit_include_directories: false,
>> - # prevent common code to access cpu compile time
>> - # definition, but still allow access to cpu.h
>> - c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU'],
>> - dependencies: src.all_dependencies())
>> - hw_common_arch_libs += {target_base_arch: lib}
>> + if target_base_arch not in hw_common_arch_libs
>> + src = hw_common_arch[target_base_arch]
>> + lib = static_library(
>> + 'hw_' + target_base_arch,
>> + build_by_default: false,
>> + sources: src.all_sources() + genh,
>> + include_directories: inc,
>> + c_args: target_system_c_args,
>> + dependencies: src.all_dependencies())
>> + hw_common_arch_libs += {target_base_arch: lib}
>> + endif
>> + endif
>> +
>> + if target_base_arch in target_common_arch
>> + if target_base_arch not in target_common_arch_libs
>> + src = target_common_arch[target_base_arch]
>> + lib = static_library(
>> + 'target_' + target_base_arch,
>> + build_by_default: false,
>> + sources: src.all_sources() + genh,
>> + include_directories: inc,
>> + c_args: target_c_args,
>> + dependencies: src.all_dependencies())
>> + target_common_arch_libs += {target_base_arch: lib}
>> + endif
>> + endif
>> +
>> + if target_base_arch in target_common_system_arch
>> + if target_base_arch not in target_common_system_arch_libs
>> + src = target_common_system_arch[target_base_arch]
>> + lib = static_library(
>> + 'target_system_' + target_base_arch,
>> + build_by_default: false,
>> + sources: src.all_sources() + genh,
>> + include_directories: inc,
>> + c_args: target_system_c_args,
>> + dependencies: src.all_dependencies())
>> + target_common_system_arch_libs += {target_base_arch: lib}
>> + endif
>> endif
>> endforeach
>>
>> @@ -4282,12 +4314,24 @@ foreach target : target_dirs
>> target_common = common_ss.apply(config_target, strict: false)
>> objects = [common_all.extract_objects(target_common.sources())]
>> arch_deps += target_common.dependencies()
>> + if target_base_arch in target_common_arch_libs
>> + src = target_common_arch[target_base_arch].apply(config_target, strict: false)
>> + lib = target_common_arch_libs[target_base_arch]
>> + objects += lib.extract_objects(src.sources())
>> + arch_deps += src.dependencies()
>> + endif
>> if target_type == 'system' and target_base_arch in hw_common_arch_libs
>> src = hw_common_arch[target_base_arch].apply(config_target, strict: false)
>> lib = hw_common_arch_libs[target_base_arch]
>> objects += lib.extract_objects(src.sources())
>> arch_deps += src.dependencies()
>> endif
>> + if target_type == 'system' and target_base_arch in target_common_system_arch_libs
>> + src = target_common_system_arch[target_base_arch].apply(config_target, strict: false)
>> + lib = target_common_system_arch_libs[target_base_arch]
>> + objects += lib.extract_objects(src.sources())
>> + arch_deps += src.dependencies()
>> + endif
>>
>> target_specific = specific_ss.apply(config_target, strict: false)
>> arch_srcs += target_specific.sources()
>
> Somehow related to this patch, when converting from target_system_arch
> to target_common_system_arch, emptying it, I get:
>
> ../../meson.build:4237:27: ERROR: Key microblaze is not in the dictionary.
>
> 4235 if target.endswith('-softmmu')
> 4236 target_type='system'
> 4237 t = target_system_arch[target_base_arch].apply(config_target,
> strict: false)
>
Patch 12 introduces an empty arm_common_ss and it does not seem to be a
problem.
Feel free to share your meson.build if there is a problem.
On 29/4/25 23:11, Pierrick Bouvier wrote:
> On 4/29/25 11:01 AM, Philippe Mathieu-Daudé wrote:
>> Hi Pierrick,
>>
>> On 29/4/25 07:00, Pierrick Bouvier wrote:
>>> Following what we did for hw/, we need target specific common libraries
>>> for target. We need 2 different libraries:
>>> - code common to a base architecture
>>> - system code common to a base architecture
>>>
>>> For user code, it can stay compiled per target for now.
>>>
>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>> ---
>>> meson.build | 78 ++++++++++++++++++++++++++++++++++++++++
>>> +------------
>>> 1 file changed, 61 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/meson.build b/meson.build
>>> index 68d36ac140f..7b2cf3cd7d1 100644
>>> --- a/meson.build
>>> +++ b/meson.build
>>> @@ -3684,6 +3684,8 @@ target_arch = {}
>>> target_system_arch = {}
>>> target_user_arch = {}
>>> hw_common_arch = {}
>>> +target_common_arch = {}
>>> +target_common_system_arch = {}
>>> # NOTE: the trace/ subdirectory needs the qapi_trace_events variable
>>> # that is filled in by qapi/.
>>> @@ -4087,29 +4089,59 @@ common_all = static_library('common',
>>> # construct common libraries per base architecture
>>> hw_common_arch_libs = {}
>>> +target_common_arch_libs = {}
>>> +target_common_system_arch_libs = {}
>>> foreach target : target_dirs
>>> config_target = config_target_mak[target]
>>> target_base_arch = config_target['TARGET_BASE_ARCH']
>>> + target_inc = [include_directories('target' / target_base_arch)]
>>> + inc = [common_user_inc + target_inc]
>>> - # check if already generated
>>> - if target_base_arch in hw_common_arch_libs
>>> - continue
>>> - endif
>>> + # prevent common code to access cpu compile time definition,
>>> + # but still allow access to cpu.h
>>> + target_c_args = ['-DCPU_DEFS_H']
>>> + target_system_c_args = target_c_args + ['-
>>> DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
>>> if target_base_arch in hw_common_arch
>>> - target_inc = [include_directories('target' / target_base_arch)]
>>> - src = hw_common_arch[target_base_arch]
>>> - lib = static_library(
>>> - 'hw_' + target_base_arch,
>>> - build_by_default: false,
>>> - sources: src.all_sources() + genh,
>>> - include_directories: common_user_inc + target_inc,
>>> - implicit_include_directories: false,
>>> - # prevent common code to access cpu compile time
>>> - # definition, but still allow access to cpu.h
>>> - c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-
>>> DCONFIG_SOFTMMU'],
>>> - dependencies: src.all_dependencies())
>>> - hw_common_arch_libs += {target_base_arch: lib}
>>> + if target_base_arch not in hw_common_arch_libs
>>> + src = hw_common_arch[target_base_arch]
>>> + lib = static_library(
>>> + 'hw_' + target_base_arch,
>>> + build_by_default: false,
>>> + sources: src.all_sources() + genh,
>>> + include_directories: inc,
>>> + c_args: target_system_c_args,
>>> + dependencies: src.all_dependencies())
>>> + hw_common_arch_libs += {target_base_arch: lib}
>>> + endif
>>> + endif
>>> +
>>> + if target_base_arch in target_common_arch
>>> + if target_base_arch not in target_common_arch_libs
>>> + src = target_common_arch[target_base_arch]
>>> + lib = static_library(
>>> + 'target_' + target_base_arch,
>>> + build_by_default: false,
>>> + sources: src.all_sources() + genh,
>>> + include_directories: inc,
>>> + c_args: target_c_args,
>>> + dependencies: src.all_dependencies())
>>> + target_common_arch_libs += {target_base_arch: lib}
>>> + endif
>>> + endif
>>> +
>>> + if target_base_arch in target_common_system_arch
>>> + if target_base_arch not in target_common_system_arch_libs
>>> + src = target_common_system_arch[target_base_arch]
>>> + lib = static_library(
>>> + 'target_system_' + target_base_arch,
>>> + build_by_default: false,
>>> + sources: src.all_sources() + genh,
>>> + include_directories: inc,
>>> + c_args: target_system_c_args,
>>> + dependencies: src.all_dependencies())
>>> + target_common_system_arch_libs += {target_base_arch: lib}
>>> + endif
>>> endif
>>> endforeach
>>> @@ -4282,12 +4314,24 @@ foreach target : target_dirs
>>> target_common = common_ss.apply(config_target, strict: false)
>>> objects = [common_all.extract_objects(target_common.sources())]
>>> arch_deps += target_common.dependencies()
>>> + if target_base_arch in target_common_arch_libs
>>> + src = target_common_arch[target_base_arch].apply(config_target,
>>> strict: false)
>>> + lib = target_common_arch_libs[target_base_arch]
>>> + objects += lib.extract_objects(src.sources())
>>> + arch_deps += src.dependencies()
>>> + endif
>>> if target_type == 'system' and target_base_arch in
>>> hw_common_arch_libs
>>> src = hw_common_arch[target_base_arch].apply(config_target,
>>> strict: false)
>>> lib = hw_common_arch_libs[target_base_arch]
>>> objects += lib.extract_objects(src.sources())
>>> arch_deps += src.dependencies()
>>> endif
>>> + if target_type == 'system' and target_base_arch in
>>> target_common_system_arch_libs
>>> + src =
>>> target_common_system_arch[target_base_arch].apply(config_target,
>>> strict: false)
>>> + lib = target_common_system_arch_libs[target_base_arch]
>>> + objects += lib.extract_objects(src.sources())
>>> + arch_deps += src.dependencies()
>>> + endif
>>> target_specific = specific_ss.apply(config_target, strict: false)
>>> arch_srcs += target_specific.sources()
>>
>> Somehow related to this patch, when converting from target_system_arch
"Somehow related to" ~-> "pre-existing issue exposed by"
>> to target_common_system_arch, emptying it, I get:
>>
>> ../../meson.build:4237:27: ERROR: Key microblaze is not in the
>> dictionary.
>>
>> 4235 if target.endswith('-softmmu')
>> 4236 target_type='system'
>> 4237 t = target_system_arch[target_base_arch].apply(config_target,
>> strict: false)
>>
>
> Patch 12 introduces an empty arm_common_ss and it does not seem to be a
> problem.
> Feel free to share your meson.build if there is a problem.
Empty arm_common_ss[] isn't a problem. What I'm saying is
when I move all files from target_system_arch[ARCH] to
target_common_system_arch[ARCH] I get an error because
target_system_arch[ARCH] isn't expected to be empty.
I suppose due to:
target_system_arch[target_base_arch].apply()
Yes, I can keep/add an empty source set but it makes meson
files review more cumbersome (unused source set, but if you
remove it then the build fails).
On 4/29/25 11:06 PM, Philippe Mathieu-Daudé wrote:
> On 29/4/25 23:11, Pierrick Bouvier wrote:
>> On 4/29/25 11:01 AM, Philippe Mathieu-Daudé wrote:
>>> Hi Pierrick,
>>>
>>> On 29/4/25 07:00, Pierrick Bouvier wrote:
>>>> Following what we did for hw/, we need target specific common libraries
>>>> for target. We need 2 different libraries:
>>>> - code common to a base architecture
>>>> - system code common to a base architecture
>>>>
>>>> For user code, it can stay compiled per target for now.
>>>>
>>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>>> ---
>>>> meson.build | 78 ++++++++++++++++++++++++++++++++++++++++
>>>> +------------
>>>> 1 file changed, 61 insertions(+), 17 deletions(-)
>>>>
>>>> diff --git a/meson.build b/meson.build
>>>> index 68d36ac140f..7b2cf3cd7d1 100644
>>>> --- a/meson.build
>>>> +++ b/meson.build
>>>> @@ -3684,6 +3684,8 @@ target_arch = {}
>>>> target_system_arch = {}
>>>> target_user_arch = {}
>>>> hw_common_arch = {}
>>>> +target_common_arch = {}
>>>> +target_common_system_arch = {}
>>>> # NOTE: the trace/ subdirectory needs the qapi_trace_events variable
>>>> # that is filled in by qapi/.
>>>> @@ -4087,29 +4089,59 @@ common_all = static_library('common',
>>>> # construct common libraries per base architecture
>>>> hw_common_arch_libs = {}
>>>> +target_common_arch_libs = {}
>>>> +target_common_system_arch_libs = {}
>>>> foreach target : target_dirs
>>>> config_target = config_target_mak[target]
>>>> target_base_arch = config_target['TARGET_BASE_ARCH']
>>>> + target_inc = [include_directories('target' / target_base_arch)]
>>>> + inc = [common_user_inc + target_inc]
>>>> - # check if already generated
>>>> - if target_base_arch in hw_common_arch_libs
>>>> - continue
>>>> - endif
>>>> + # prevent common code to access cpu compile time definition,
>>>> + # but still allow access to cpu.h
>>>> + target_c_args = ['-DCPU_DEFS_H']
>>>> + target_system_c_args = target_c_args + ['-
>>>> DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
>>>> if target_base_arch in hw_common_arch
>>>> - target_inc = [include_directories('target' / target_base_arch)]
>>>> - src = hw_common_arch[target_base_arch]
>>>> - lib = static_library(
>>>> - 'hw_' + target_base_arch,
>>>> - build_by_default: false,
>>>> - sources: src.all_sources() + genh,
>>>> - include_directories: common_user_inc + target_inc,
>>>> - implicit_include_directories: false,
>>>> - # prevent common code to access cpu compile time
>>>> - # definition, but still allow access to cpu.h
>>>> - c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-
>>>> DCONFIG_SOFTMMU'],
>>>> - dependencies: src.all_dependencies())
>>>> - hw_common_arch_libs += {target_base_arch: lib}
>>>> + if target_base_arch not in hw_common_arch_libs
>>>> + src = hw_common_arch[target_base_arch]
>>>> + lib = static_library(
>>>> + 'hw_' + target_base_arch,
>>>> + build_by_default: false,
>>>> + sources: src.all_sources() + genh,
>>>> + include_directories: inc,
>>>> + c_args: target_system_c_args,
>>>> + dependencies: src.all_dependencies())
>>>> + hw_common_arch_libs += {target_base_arch: lib}
>>>> + endif
>>>> + endif
>>>> +
>>>> + if target_base_arch in target_common_arch
>>>> + if target_base_arch not in target_common_arch_libs
>>>> + src = target_common_arch[target_base_arch]
>>>> + lib = static_library(
>>>> + 'target_' + target_base_arch,
>>>> + build_by_default: false,
>>>> + sources: src.all_sources() + genh,
>>>> + include_directories: inc,
>>>> + c_args: target_c_args,
>>>> + dependencies: src.all_dependencies())
>>>> + target_common_arch_libs += {target_base_arch: lib}
>>>> + endif
>>>> + endif
>>>> +
>>>> + if target_base_arch in target_common_system_arch
>>>> + if target_base_arch not in target_common_system_arch_libs
>>>> + src = target_common_system_arch[target_base_arch]
>>>> + lib = static_library(
>>>> + 'target_system_' + target_base_arch,
>>>> + build_by_default: false,
>>>> + sources: src.all_sources() + genh,
>>>> + include_directories: inc,
>>>> + c_args: target_system_c_args,
>>>> + dependencies: src.all_dependencies())
>>>> + target_common_system_arch_libs += {target_base_arch: lib}
>>>> + endif
>>>> endif
>>>> endforeach
>>>> @@ -4282,12 +4314,24 @@ foreach target : target_dirs
>>>> target_common = common_ss.apply(config_target, strict: false)
>>>> objects = [common_all.extract_objects(target_common.sources())]
>>>> arch_deps += target_common.dependencies()
>>>> + if target_base_arch in target_common_arch_libs
>>>> + src = target_common_arch[target_base_arch].apply(config_target,
>>>> strict: false)
>>>> + lib = target_common_arch_libs[target_base_arch]
>>>> + objects += lib.extract_objects(src.sources())
>>>> + arch_deps += src.dependencies()
>>>> + endif
>>>> if target_type == 'system' and target_base_arch in
>>>> hw_common_arch_libs
>>>> src = hw_common_arch[target_base_arch].apply(config_target,
>>>> strict: false)
>>>> lib = hw_common_arch_libs[target_base_arch]
>>>> objects += lib.extract_objects(src.sources())
>>>> arch_deps += src.dependencies()
>>>> endif
>>>> + if target_type == 'system' and target_base_arch in
>>>> target_common_system_arch_libs
>>>> + src =
>>>> target_common_system_arch[target_base_arch].apply(config_target,
>>>> strict: false)
>>>> + lib = target_common_system_arch_libs[target_base_arch]
>>>> + objects += lib.extract_objects(src.sources())
>>>> + arch_deps += src.dependencies()
>>>> + endif
>>>> target_specific = specific_ss.apply(config_target, strict: false)
>>>> arch_srcs += target_specific.sources()
>>>
>>> Somehow related to this patch, when converting from target_system_arch
>
> "Somehow related to" ~-> "pre-existing issue exposed by"
>
>>> to target_common_system_arch, emptying it, I get:
>>>
>>> ../../meson.build:4237:27: ERROR: Key microblaze is not in the
>>> dictionary.
>>>
>>> 4235 if target.endswith('-softmmu')
>>> 4236 target_type='system'
>>> 4237 t = target_system_arch[target_base_arch].apply(config_target,
>>> strict: false)
>>>
>>
>> Patch 12 introduces an empty arm_common_ss and it does not seem to be a
>> problem.
>> Feel free to share your meson.build if there is a problem.
>
> Empty arm_common_ss[] isn't a problem. What I'm saying is
> when I move all files from target_system_arch[ARCH] to
> target_common_system_arch[ARCH] I get an error because
> target_system_arch[ARCH] isn't expected to be empty.
> I suppose due to:
>
> target_system_arch[target_base_arch].apply()
>
> Yes, I can keep/add an empty source set but it makes meson
> files review more cumbersome (unused source set, but if you
> remove it then the build fails).
Oh, I see.
Then, you just need to add a conditional
"if target_base_arch in target_system_arch" around this spot, and remove
the dictionary entry set in target/microblaze/meson.build.
- target_arch += {'microblaze': microblaze_ss}
This target was much quicker than arm, it's nice :)
© 2016 - 2025 Red Hat, Inc.