diff mbox series

[XEN,v2] automation/eclair: add a deviation for MISRA C:2012 Rule 8.6

Message ID b9eee04bb7c6436f4951a8737eee60c68cda9df7.1699893554.git.federico.serafini@bugseng.com (mailing list archive)
State New, archived
Headers show
Series [XEN,v2] automation/eclair: add a deviation for MISRA C:2012 Rule 8.6 | expand

Commit Message

Federico Serafini Nov. 14, 2023, 4:42 p.m. UTC
Update ECLAIR configuration to take into account the search
procedure adopted by Unix linkers.
Update deviations.rst accordingly and tag Rule 8.6 as "clean".

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
Changes is v2:
  - deviation is based on xen/lib/*;
  - justification improved;
  - reflected changes to deviations.ecl;
  - tagged rule as "clean".
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 11 +++++++++++
 automation/eclair_analysis/ECLAIR/tagging.ecl    |  2 +-
 docs/misra/deviations.rst                        | 12 ++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

Comments

Stefano Stabellini Nov. 14, 2023, 10:26 p.m. UTC | #1
On Tue, 14 Nov 2023, Federico Serafini wrote:
> Update ECLAIR configuration to take into account the search
> procedure adopted by Unix linkers.
> Update deviations.rst accordingly and tag Rule 8.6 as "clean".
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
diff mbox series

Patch

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index d8170106b4..d12ac2e28e 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -214,6 +214,17 @@  definition is compiled-out or optimized-out by the compiler)"
 -config=MC3R1.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
 -doc_end
 
+-doc_begin="The search procedure for Unix linkers is well defined, see ld(1)
+manual: \"The linker will search an archive only once, at the location where it
+is specified on the command line. If the archive defines a symbol which was
+undefined in some object which appeared before the archive on the command line,
+the linker will include the appropriate file(s) from the archive\".
+In Xen, thanks to the order in which file names appear in the build commands,
+if arch-specific definitions are present, they get always linked in before
+searching in the lib.a archive resulting from xen/lib."
+-config=MC3R1.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
+-doc_end
+
 -doc_begin="The gnu_inline attribute without static is deliberately allowed."
 -config=MC3R1.R8.10,declarations+={deliberate,"property(gnu_inline)"}
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 78a0bc948b..d0824830d7 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -30,7 +30,7 @@ 
 
 -doc_begin="Clean guidelines: new violations for these guidelines are not accepted."
 
--service_selector={clean_guidelines_common,"MC3R1.D1.1||MC3R1.D2.1||MC3R1.D4.11||MC3R1.D4.14||MC3R1.R1.1||MC3R1.R1.3||MC3R1.R1.4||MC3R1.R2.2||MC3R1.R3.1||MC3R1.R3.2||MC3R1.R4.1||MC3R1.R5.1||MC3R1.R5.2||MC3R1.R5.4||MC3R1.R6.1||MC3R1.R6.2||MC3R1.R7.1||MC3R1.R8.1||MC3R1.R8.5||MC3R1.R8.8||MC3R1.R8.10||MC3R1.R8.12||MC3R1.R8.14||MC3R1.R9.2||MC3R1.R9.4||MC3R1.R9.5||MC3R1.R12.5||MC3R1.R17.3||MC3R1.R17.4||MC3R1.R17.6||MC3R1.R21.13||MC3R1.R21.19||MC3R1.R21.21||MC3R1.R22.2||MC3R1.R22.4||MC3R1.R22.5||MC3R1.R22.6"
+-service_selector={clean_guidelines_common,"MC3R1.D1.1||MC3R1.D2.1||MC3R1.D4.11||MC3R1.D4.14||MC3R1.R1.1||MC3R1.R1.3||MC3R1.R1.4||MC3R1.R2.2||MC3R1.R3.1||MC3R1.R3.2||MC3R1.R4.1||MC3R1.R5.1||MC3R1.R5.2||MC3R1.R5.4||MC3R1.R6.1||MC3R1.R6.2||MC3R1.R7.1||MC3R1.R8.1||MC3R1.R8.5||MC3R1.R8.6||MC3R1.R8.8||MC3R1.R8.10||MC3R1.R8.12||MC3R1.R8.14||MC3R1.R9.2||MC3R1.R9.4||MC3R1.R9.5||MC3R1.R12.5||MC3R1.R17.3||MC3R1.R17.4||MC3R1.R17.6||MC3R1.R21.13||MC3R1.R21.19||MC3R1.R21.21||MC3R1.R22.2||MC3R1.R22.4||MC3R1.R22.5||MC3R1.R22.6"
 }
 
 -setq=target,getenv("XEN_TARGET_ARCH")
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 8511a18925..0d18e33780 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -147,6 +147,18 @@  Deviations related to MISRA C:2012 Rules:
        definition is compiled-out or optimized-out by the compiler).
      - Tagged as `deliberate` in ECLAIR.
 
+   * - R8.6
+     - The search procedure for Unix linkers is well defined, see ld(1) manual:
+       "The linker will search an archive only once, at the location where it
+       is specified on the command line. If the archive defines a symbol which
+       was undefined in some object which appeared before the archive on the
+       command line, the linker will include the appropriate file(s) from the
+       archive".
+       In Xen, thanks to the order in which file names appear in the build
+       commands, if arch-specific definitions are present, they get always
+       linked in before searching in the lib.a archive resulting from xen/lib.
+     - Tagged as `deliberate` for ECLAIR.
+
    * - R8.10
      - The gnu_inline attribute without static is deliberately allowed.
      - Tagged as `deliberate` for ECLAIR.