Skip to content

IAR build fixes before 1.1.0/4.1.0/3.6.6: framework support#289

Merged
gilles-peskine-arm merged 4 commits intoMbed-TLS:mainfrom
gilles-peskine-arm:iar-1.1.0-framework
Mar 16, 2026
Merged

IAR build fixes before 1.1.0/4.1.0/3.6.6: framework support#289
gilles-peskine-arm merged 4 commits intoMbed-TLS:mainfrom
gilles-peskine-arm:iar-1.1.0-framework

Conversation

@gilles-peskine-arm
Copy link
Copy Markdown
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Mar 11, 2026

Fix the build of the library and the unit tests with IAR.

Also fix a problem with the structure of test helper code that I introduced in #279 and which is causing me a problem in a security fix: part of test_common.h should have been in tests/src, not tests/include/test.

PR checklist

The header `test_common.h` contains two kinds of things:

* Things to do at the beginning of individual C files. Specifically,
  defining macros that notify system headers about what we want from them.
  Keep those in `test_common.h`, which will subsequently be moved out of
  the include directory.
* Things to do at the beginning of every header. In particular, read the
  library configuration. Move them to a new header `build_info.h`,
  which is the only one intended to be included from headers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Include `"test_common.h"` as the first thing in C files, and
`<test/build_info.h>` as the first thing in header files.

This requires moving `<test/test_common.h>` to its intended location
`"test_common.h"`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes IAR build issues for the library/unit tests by restructuring test build-configuration includes and adding IAR-specific compatibility knobs in the test harness.

Changes:

  • Introduce tests/include/test/build_info.h and switch test headers to include it (instead of test_common.h) for consistent build configuration and private-access support.
  • Move C-file-only setup into tests/src/test_common.h and ensure test .c files include it first.
  • Add IAR-specific defines and warning suppression for successful compilation with IAR.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/src/threading_helpers.c Include test_common.h first for consistent compiler/test setup.
tests/src/test_memory.c Include test_common.h first for consistent compiler/test setup.
tests/src/test_common.h Add IAR _DLIB_FILE_DESCRIPTOR define; include test/build_info.h for test build config.
tests/src/random.c Include test_common.h first for consistent compiler/test setup.
tests/src/psa_memory_poisoning_wrappers.c Include test_common.h first for consistent compiler/test setup.
tests/src/psa_exercise_key.c Include test_common.h; suppress an IAR-specific diagnostic.
tests/src/psa_crypto_stubs.c Include test_common.h first for consistent compiler/test setup.
tests/src/psa_crypto_helpers.c Include test_common.h first for consistent compiler/test setup.
tests/src/pk_helpers.c Include test_common.h first for consistent compiler/test setup.
tests/src/helpers.c Include test_common.h first for consistent compiler/test setup.
tests/src/fake_external_rng_for_test.c Include test_common.h first for consistent compiler/test setup.
tests/src/bignum_helpers.c Replace direct private-access define with test_common.h include.
tests/src/bignum_codepath_check.c Include test_common.h first for consistent compiler/test setup.
tests/src/asn1_helpers.c Include test_common.h first for consistent compiler/test setup.
tests/include/test/threading_helpers.h Switch to including new build_info.h (test header build config).
tests/include/test/random.h Switch to including new build_info.h (test header build config).
tests/include/test/psa_memory_poisoning_wrappers.h Switch to including new build_info.h (test header build config).
tests/include/test/psa_helpers.h Switch to including new build_info.h (test header build config).
tests/include/test/psa_exercise_key.h Switch to including new build_info.h (test header build config).
tests/include/test/psa_crypto_helpers.h Switch to including new build_info.h (test header build config).
tests/include/test/pk_helpers.h Switch to including new build_info.h (test header build config).
tests/include/test/memory.h Switch to including new build_info.h (test header build config).
tests/include/test/macros.h Switch to including new build_info.h (test header build config).
tests/include/test/helpers.h Switch to including new build_info.h (test header build config).
tests/include/test/fake_external_rng_for_test.h Switch to including new build_info.h (test header build config).
tests/include/test/constant_flow.h Switch to including new build_info.h (test header build config).
tests/include/test/build_info.h New header centralizing test header build configuration and private-access enablement.
tests/include/test/bignum_helpers.h Switch to including new build_info.h (test header build config).
tests/include/test/bignum_codepath_check.h Switch to including new build_info.h (test header build config).
tests/include/test/asn1_helpers.h Switch to including new build_info.h (test header build config).
tests/include/test/arguments.h Switch to including new build_info.h (test header build config).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@valeriosetti valeriosetti self-requested a review March 12, 2026 11:58
Copy link
Copy Markdown
Contributor

@valeriosetti valeriosetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only current failure on the CI (DTLS proxy: 3d, gnutls client, fragmentation, nbio=2) looks spurious and changes look good to me, so I approve

@gilles-peskine-arm
Copy link
Copy Markdown
Contributor Author

I've restarted the CI since we want to see it pass.

@bjwtaylor bjwtaylor self-requested a review March 12, 2026 15:26
Comment thread tests/include/test/build_info.h
Comment thread tests/src/psa_exercise_key.c
Copy link
Copy Markdown

@bjwtaylor bjwtaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good as long as we can get the CI to pass.

@github-project-automation github-project-automation Bot moved this from In Development to Has Approval in Roadmap pull requests (new board) Mar 13, 2026
@gilles-peskine-arm gilles-peskine-arm added approved Design and code approved - may be waiting for CI or backports and removed needs-ci Needs to pass CI tests labels Mar 13, 2026
@gilles-peskine-arm gilles-peskine-arm merged commit d1a8b5b into Mbed-TLS:main Mar 16, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Has Approval to Done in Roadmap pull requests (new board) Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Design and code approved - may be waiting for CI or backports priority-very-high Highest priority - prioritise this over other review work size-s Estimated task size: small (~2d)

Development

Successfully merging this pull request may close these issues.

4 participants