All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Eclair: scan the last xen-syms linking pass on Arm
@ 2026-10-07 17:12 Dmytro Prokopchuk1
  2026-10-07 18:07 ` Nicola Vetrini
  0 siblings, 1 reply; 3+ messages in thread
From: Dmytro Prokopchuk1 @ 2026-10-07 17:12 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org
  Cc: Dmytro Prokopchuk1, Nicola Vetrini, Doug Goldstein,
	Stefano Stabellini

The hide pattern .xen-syms.[013] leaves pass 2 visible. On x86
LAST_LINKING_PASS is 2, so that is the final link. On Arm
LAST_LINKING_PASS is 3 and the final image is .xen-syms.3. Pass 2 is
usually only a symlink, so Eclair saw no program link and reported every
translation unit as unreachable.

Before the analysis build, read LAST_LINKING_PASS from the architecture
makefile and the pass numbers from the foreach list in
xen/scripts/Makefile.link. Hide every pass except that one. An earlier
pass that is a real link stays hidden.

Fixes: a401b5c9dc35 ("Eclair: re-enable scanning of the (almost) final linking step")
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
---
Current patch isn't tested, sent just for review (if this accepted, I'll run pipeline).

Changes in v2:
- update commit message
- generate hide pattern before analysis
- read LAST_LINKING_PASS from the arch Makefile and pass numbers from the Makefile.link

Link to v1:
https://patchew.org/Xen/2f67ef7c4593d3ab94b75b5b819e7e046e055796.1791293680.git.dmytro._5Fprokopchuk1@epam.com/
---
 .../eclair_analysis/ECLAIR/analysis.ecl       |  2 +-
 automation/eclair_analysis/ECLAIR/analyze.sh  |  3 +++
 .../ECLAIR/generate-xen-syms-passes.sh        | 20 +++++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100755 automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh

diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl b/automation/eclair_analysis/ECLAIR/analysis.ecl
index c6e1a7a95d..df1006bcaa 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -37,7 +37,7 @@ their Standard Library equivalents."
 -doc_begin="Do not analyze intermediate linking artifacts, as they do not differ from their final
 counterparts for the purposes of MISRA C static analysis."
 -file_tag+={xen_efi_tmp, "^xen/\\.xen\\.efi\\.([01]|alt\\..*)$"}
--file_tag+={xen_syms_tmp, "^xen/\\.xen-syms\\.[013]$"}
+-eval_file=xen_syms_passes.ecl
 -frames+={hide, "kind(program)&&target(xen_syms_tmp||xen_efi_tmp)"}
 -doc_end
 
diff --git a/automation/eclair_analysis/ECLAIR/analyze.sh b/automation/eclair_analysis/ECLAIR/analyze.sh
index 2356fc4007..ef59e87212 100755
--- a/automation/eclair_analysis/ECLAIR/analyze.sh
+++ b/automation/eclair_analysis/ECLAIR/analyze.sh
@@ -78,6 +78,9 @@ export ECLAIR_PROJECT_NAME="XEN_${VARIANT}-${SET}"
 rm -rf "${ECLAIR_OUTPUT_DIR:?}/*"
 mkdir -p "${ECLAIR_DATA_DIR}"
 
+# Generate hide pattern.
+"${SCRIPT_DIR}/generate-xen-syms-passes.sh"
+
 # Perform the build (from scratch) in an ECLAIR environment.
 "${ECLAIR_BIN_DIR}eclair_env" \
     "-config_file='${SCRIPT_DIR}/analysis.ecl'" \
diff --git a/automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh b/automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh
new file mode 100755
index 0000000000..e3795e8234
--- /dev/null
+++ b/automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Hide every xen-syms linking pass except LAST_LINKING_PASS.
+# The pass list is the foreach in xen/scripts/Makefile.link.
+
+set -e
+
+cd "$(dirname "$0")"
+arch=$(echo "${XEN_TARGET_ARCH}" | sed -e 's/x86.*/x86/' -e 's/arm.*/arm/')
+last=$(sed -n 's/^LAST_LINKING_PASS *:= *\([0-9]\).*/\1/p' \
+    "../../../xen/arch/${arch}/Makefile" | head -n 1)
+passes=$(sed -n 's/.*foreach n,\([0-9 ]*\).*/\1/p' \
+    ../../../xen/scripts/Makefile.link | head -n 1)
+test -n "${last}"
+test -n "${passes}"
+hidden=$(printf '%s' "${passes}" | tr -d " ${last}")
+
+printf '%s\n' \
+    "-file_tag+={xen_syms_tmp, \"^xen/\\\\.xen-syms\\\\.[${hidden}]\$\"}" \
+    >xen_syms_passes.ecl
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Eclair: scan the last xen-syms linking pass on Arm
  2026-10-07 17:12 [PATCH v2] Eclair: scan the last xen-syms linking pass on Arm Dmytro Prokopchuk1
@ 2026-10-07 18:07 ` Nicola Vetrini
  2026-10-12 20:23   ` Dmytro Prokopchuk1
  0 siblings, 1 reply; 3+ messages in thread
From: Nicola Vetrini @ 2026-10-07 18:07 UTC (permalink / raw)
  To: Dmytro Prokopchuk1; +Cc: xen-devel, Doug Goldstein, Stefano Stabellini

On 2026-10-07 19:12, Dmytro Prokopchuk1 wrote:
> The hide pattern .xen-syms.[013] leaves pass 2 visible. On x86
> LAST_LINKING_PASS is 2, so that is the final link. On Arm
> LAST_LINKING_PASS is 3 and the final image is .xen-syms.3. Pass 2 is
> usually only a symlink, so Eclair saw no program link and reported 
> every
> translation unit as unreachable.
> 
> Before the analysis build, read LAST_LINKING_PASS from the architecture
> makefile and the pass numbers from the foreach list in
> xen/scripts/Makefile.link. Hide every pass except that one. An earlier
> pass that is a real link stays hidden.
> 
> Fixes: a401b5c9dc35 ("Eclair: re-enable scanning of the (almost) final 
> linking step")
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
> ---
> Current patch isn't tested, sent just for review (if this accepted, 
> I'll run pipeline).
> 
> Changes in v2:
> - update commit message
> - generate hide pattern before analysis
> - read LAST_LINKING_PASS from the arch Makefile and pass numbers from 
> the Makefile.link
> 
> Link to v1:
> https://patchew.org/Xen/2f67ef7c4593d3ab94b75b5b819e7e046e055796.1791293680.git.dmytro._5Fprokopchuk1@epam.com/
> ---
>  .../eclair_analysis/ECLAIR/analysis.ecl       |  2 +-
>  automation/eclair_analysis/ECLAIR/analyze.sh  |  3 +++
>  .../ECLAIR/generate-xen-syms-passes.sh        | 20 +++++++++++++++++++
>  3 files changed, 24 insertions(+), 1 deletion(-)
>  create mode 100755 
> automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh
> 
> diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl 
> b/automation/eclair_analysis/ECLAIR/analysis.ecl
> index c6e1a7a95d..df1006bcaa 100644
> --- a/automation/eclair_analysis/ECLAIR/analysis.ecl
> +++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
> @@ -37,7 +37,7 @@ their Standard Library equivalents."
>  -doc_begin="Do not analyze intermediate linking artifacts, as they do 
> not differ from their final
>  counterparts for the purposes of MISRA C static analysis."
>  -file_tag+={xen_efi_tmp, "^xen/\\.xen\\.efi\\.([01]|alt\\..*)$"}
> --file_tag+={xen_syms_tmp, "^xen/\\.xen-syms\\.[013]$"}
> +-eval_file=xen_syms_passes.ecl
>  -frames+={hide, "kind(program)&&target(xen_syms_tmp||xen_efi_tmp)"}
>  -doc_end
> 

> diff --git a/automation/eclair_analysis/ECLAIR/analyze.sh 
> b/automation/eclair_analysis/ECLAIR/analyze.sh
> index 2356fc4007..ef59e87212 100755
> --- a/automation/eclair_analysis/ECLAIR/analyze.sh
> +++ b/automation/eclair_analysis/ECLAIR/analyze.sh
> @@ -78,6 +78,9 @@ export ECLAIR_PROJECT_NAME="XEN_${VARIANT}-${SET}"
>  rm -rf "${ECLAIR_OUTPUT_DIR:?}/*"
>  mkdir -p "${ECLAIR_DATA_DIR}"
> 
> +# Generate hide pattern.
> +"${SCRIPT_DIR}/generate-xen-syms-passes.sh"
> +

I would prefer it integrated in [1] instead, running in prepare.sh. At 
least we keep these calls to ECL generation scripts together.

[1] 
https://gitlab.com/xen-project/hardware/xen/-/blob/staging/automation/eclair_analysis/ECLAIR/generate_ecl.sh?ref_type=heads

>  # Perform the build (from scratch) in an ECLAIR environment.
>  "${ECLAIR_BIN_DIR}eclair_env" \
>      "-config_file='${SCRIPT_DIR}/analysis.ecl'" \
> diff --git 
> a/automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh 
> b/automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh
> new file mode 100755
> index 0000000000..e3795e8234
> --- /dev/null
> +++ b/automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh
> @@ -0,0 +1,20 @@
> +#!/bin/bash
> +
> +# Hide every xen-syms linking pass except LAST_LINKING_PASS.
> +# The pass list is the foreach in xen/scripts/Makefile.link.
> +
> +set -e
> +
> +cd "$(dirname "$0")"
> +arch=$(echo "${XEN_TARGET_ARCH}" | sed -e 's/x86.*/x86/' -e 
> 's/arm.*/arm/')
> +last=$(sed -n 's/^LAST_LINKING_PASS *:= *\([0-9]\).*/\1/p' \
> +    "../../../xen/arch/${arch}/Makefile" | head -n 1)
> +passes=$(sed -n 's/.*foreach n,\([0-9 ]*\).*/\1/p' \
> +    ../../../xen/scripts/Makefile.link | head -n 1)
> +test -n "${last}"
> +test -n "${passes}"
> +hidden=$(printf '%s' "${passes}" | tr -d " ${last}")
> +
> +printf '%s\n' \
> +    "-file_tag+={xen_syms_tmp, 
> \"^xen/\\\\.xen-syms\\\\.[${hidden}]\$\"}" \
> +    >xen_syms_passes.ecl

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Eclair: scan the last xen-syms linking pass on Arm
  2026-10-07 18:07 ` Nicola Vetrini
@ 2026-10-12 20:23   ` Dmytro Prokopchuk1
  0 siblings, 0 replies; 3+ messages in thread
From: Dmytro Prokopchuk1 @ 2026-10-12 20:23 UTC (permalink / raw)
  To: Nicola Vetrini
  Cc: xen-devel@lists.xenproject.org, Doug Goldstein,
	Stefano Stabellini



On 10/7/26 21:07, Nicola Vetrini wrote:
> On 2026-10-07 19:12, Dmytro Prokopchuk1 wrote:
>> The hide pattern .xen-syms.[013] leaves pass 2 visible. On x86
>> LAST_LINKING_PASS is 2, so that is the final link. On Arm
>> LAST_LINKING_PASS is 3 and the final image is .xen-syms.3. Pass 2 is
>> usually only a symlink, so Eclair saw no program link and reported every
>> translation unit as unreachable.
>>
>> Before the analysis build, read LAST_LINKING_PASS from the architecture
>> makefile and the pass numbers from the foreach list in
>> xen/scripts/Makefile.link. Hide every pass except that one. An earlier
>> pass that is a real link stays hidden.
>>
>> Fixes: a401b5c9dc35 ("Eclair: re-enable scanning of the (almost) final 
>> linking step")
>> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
>> ---
>> Current patch isn't tested, sent just for review (if this accepted, 
>> I'll run pipeline).
>>
>> Changes in v2:
>> - update commit message
>> - generate hide pattern before analysis
>> - read LAST_LINKING_PASS from the arch Makefile and pass numbers from 
>> the Makefile.link
>>
>> Link to v1:
>> https://eur01.safelinks.protection.outlook.com/? 
>> url=https%3A%2F%2Fpatchew.org%2FXen%2F2f67ef7c4593d3ab94b75b5b819e7e046e055796.1791293680.git.dmytro._5Fprokopchuk1%40epam.com%2F&data=05%7C02%7Cdmytro_prokopchuk1%40epam.com%7C9b0501101af94002015708df249de48f%7Cb41b72d04e9f4c268a69f949f367c91d%7C1%7C0%7C639269932708373791%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ghw9lA2FpRo3fV7P8HBslmCEbSJB29AvKTHdgWZfr6w%3D&reserved=0
>> ---
>>  .../eclair_analysis/ECLAIR/analysis.ecl       |  2 +-
>>  automation/eclair_analysis/ECLAIR/analyze.sh  |  3 +++
>>  .../ECLAIR/generate-xen-syms-passes.sh        | 20 +++++++++++++++++++
>>  3 files changed, 24 insertions(+), 1 deletion(-)
>>  create mode 100755 automation/eclair_analysis/ECLAIR/generate-xen- 
>> syms-passes.sh
>>
>> diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl b/ 
>> automation/eclair_analysis/ECLAIR/analysis.ecl
>> index c6e1a7a95d..df1006bcaa 100644
>> --- a/automation/eclair_analysis/ECLAIR/analysis.ecl
>> +++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
>> @@ -37,7 +37,7 @@ their Standard Library equivalents."
>>  -doc_begin="Do not analyze intermediate linking artifacts, as they do 
>> not differ from their final
>>  counterparts for the purposes of MISRA C static analysis."
>>  -file_tag+={xen_efi_tmp, "^xen/\\.xen\\.efi\\.([01]|alt\\..*)$"}
>> --file_tag+={xen_syms_tmp, "^xen/\\.xen-syms\\.[013]$"}
>> +-eval_file=xen_syms_passes.ecl
>>  -frames+={hide, "kind(program)&&target(xen_syms_tmp||xen_efi_tmp)"}
>>  -doc_end
>>
> 
>> diff --git a/automation/eclair_analysis/ECLAIR/analyze.sh b/ 
>> automation/eclair_analysis/ECLAIR/analyze.sh
>> index 2356fc4007..ef59e87212 100755
>> --- a/automation/eclair_analysis/ECLAIR/analyze.sh
>> +++ b/automation/eclair_analysis/ECLAIR/analyze.sh
>> @@ -78,6 +78,9 @@ export ECLAIR_PROJECT_NAME="XEN_${VARIANT}-${SET}"
>>  rm -rf "${ECLAIR_OUTPUT_DIR:?}/*"
>>  mkdir -p "${ECLAIR_DATA_DIR}"
>>
>> +# Generate hide pattern.
>> +"${SCRIPT_DIR}/generate-xen-syms-passes.sh"
>> +
> 
> I would prefer it integrated in [1] instead, running in prepare.sh. At 
> least we keep these calls to ECL generation scripts together.

Ack. I'll prepare v3.

> 
> [1] https://eur01.safelinks.protection.outlook.com/? 
> url=https%3A%2F%2Fgitlab.com%2Fxen-project%2Fhardware%2Fxen%2F- 
> %2Fblob%2Fstaging%2Fautomation%2Feclair_analysis%2FECLAIR%2Fgenerate_ecl.sh%3Fref_type%3Dheads&data=05%7C02%7Cdmytro_prokopchuk1%40epam.com%7C9b0501101af94002015708df249de48f%7Cb41b72d04e9f4c268a69f949f367c91d%7C1%7C0%7C639269932708403274%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=roZoL%2BoiphL9a0hJhOWE9%2Fr3LSrYpf%2BOOgZRbvZ9HN0%3D&reserved=0
> 
>>  # Perform the build (from scratch) in an ECLAIR environment.
>>  "${ECLAIR_BIN_DIR}eclair_env" \
>>      "-config_file='${SCRIPT_DIR}/analysis.ecl'" \
>> diff --git a/automation/eclair_analysis/ECLAIR/generate-xen-syms- 
>> passes.sh b/automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh
>> new file mode 100755
>> index 0000000000..e3795e8234
>> --- /dev/null
>> +++ b/automation/eclair_analysis/ECLAIR/generate-xen-syms-passes.sh
>> @@ -0,0 +1,20 @@
>> +#!/bin/bash
>> +
>> +# Hide every xen-syms linking pass except LAST_LINKING_PASS.
>> +# The pass list is the foreach in xen/scripts/Makefile.link.
>> +
>> +set -e
>> +
>> +cd "$(dirname "$0")"
>> +arch=$(echo "${XEN_TARGET_ARCH}" | sed -e 's/x86.*/x86/' -e 's/arm.*/ 
>> arm/')
>> +last=$(sed -n 's/^LAST_LINKING_PASS *:= *\([0-9]\).*/\1/p' \
>> +    "../../../xen/arch/${arch}/Makefile" | head -n 1)
>> +passes=$(sed -n 's/.*foreach n,\([0-9 ]*\).*/\1/p' \
>> +    ../../../xen/scripts/Makefile.link | head -n 1)
>> +test -n "${last}"
>> +test -n "${passes}"
>> +hidden=$(printf '%s' "${passes}" | tr -d " ${last}")
>> +
>> +printf '%s\n' \
>> +    "-file_tag+={xen_syms_tmp, \"^xen/\\\\.xen-syms\\\\.[${hidden}]\$ 
>> \"}" \
>> +    >xen_syms_passes.ecl
> 


BR, Dmytro.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-12 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07 17:12 [PATCH v2] Eclair: scan the last xen-syms linking pass on Arm Dmytro Prokopchuk1
2026-10-07 18:07 ` Nicola Vetrini
2026-10-12 20:23   ` Dmytro Prokopchuk1

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.