Skip to content

arm: adapt to being built as multilib #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

badochov
Copy link
Contributor

@badochov badochov commented Mar 20, 2025

JIRA: RTOS-1028

Description

Multilib support is very basic and the multilibs are virtually useless as the syscalls are not implemented. To add proper support the ASM code should be chosen for each version based on GCC flags not target.

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

Copy link

github-actions bot commented Mar 20, 2025

Unit Test Results

7 958 tests   7 434 ✅  40m 41s ⏱️
  470 suites    524 💤
    1 files        0 ❌

Results for commit 920a997.

♻️ This comment has been updated with latest results.

@@ -14,9 +14,19 @@ else ifneq (,$(findstring v8m,$(TARGET_SUFF)))
include arch/arm/v8m/Makefile
else ifneq (,$(findstring v8r,$(TARGET_SUFF)))
include arch/arm/v8r/Makefile
else ifneq (,$(findstring v8r,$(TARGET_SUFF)))
Copy link
Member

Choose a reason for hiding this comment

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

replicated from lines 15-16

else ifneq (,$(findstring v8r,$(TARGET_SUFF)))
include arch/arm/v8r/Makefile
else ifeq ($(TARGET_SUBFAMILY),multilib)
# TODO: Try to include correct Makefile if possible in case of a multilib.
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little bit afraid that we will build non-fuctioning subvariants for supported targets while building the toolchain - eg. which implementation of setjmp will be used for armv7m7-imx117x with FDPIC enabled? (it's not a standard phoenix target, so it will be built only by multilib option?

Maybe we should try to inspect CFLAGS (march/mcpu options)? Or try using output of $(CC) $(CFALGS) -print-multi-directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would be the go to solution, however, I don't think I have time to fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note, however, that when we create such a configuration and build simply libphoenix during building the target then correct implementation will be used, as install is make target is called

char *strncpy(char *dest, const char *src, size_t n)
{
size_t i = 0;
while (((i < n) && (src[i] != '\0'))) {
Copy link
Member

Choose a reason for hiding this comment

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

this is not a valid implementation of strncpy (zero-fill all of the remaining place, don't add `'\0' if it doesn't fit)

}


int strncmp(const char *s1, const char *s2, size_t count)
Copy link
Member

Choose a reason for hiding this comment

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

invalid - strncmp("a", "ab", 2) returns 0 (should return negative value)

}


int strcmp(const char *s1, const char *s2)
Copy link
Member

Choose a reason for hiding this comment

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

invalid - strcmp("a", "ab") returns 0 (should return negative value)

{
size_t i = 0;
while ((src[i] != '\0')) {
((char *)dest)[i] = ((const char *)src)[i];
Copy link
Member

Choose a reason for hiding this comment

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

why do we need explicit casts here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

copied from memcpy

@badochov badochov force-pushed the badochov/multilib branch from 317e341 to 7d4d2a9 Compare March 26, 2025 19:54
@badochov badochov requested a review from nalajcie March 26, 2025 19:58
@badochov badochov force-pushed the badochov/multilib branch from 7d4d2a9 to 26fe01e Compare March 27, 2025 11:06
.globl sym; \
.type sym, %function; \
sym: \
bl abort; \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bl as b may have to short range

.globl _signal_trampoline
.type _signal_trampoline, %function
_signal_trampoline:
bl abort
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bl as b may have to short range

@badochov badochov force-pushed the badochov/multilib branch from 26fe01e to 920a997 Compare March 27, 2025 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants