-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libs: Add static compatiblity check for Rust
This patch adds a static compatiblity check for most of structures from NuttX, which is used by Rust. Currently, for most of them have a reserved field, which is for possible future use, you can refer to https://github.com/no1wudi/libc/blob/39277b5357cb2aa7af1bd8344956ec292c35abed/src/unix/nuttx/mod.rs#L71 for more details. I think we should define the initial version carefully, to avoid compatiblity problems in future as much as possible: 1. Struct reserved size is 2 pointer size, is it sufficient? 2. Which option should we preferred to use? Such as SYSTEM_TIME64 and FS_LARGEFILE? 3. Should we enable it by default to cover more cases in build CI? It can prevent introduce compatiblity issues. Signed-off-by: Huang Qi <[email protected]>
- Loading branch information
Showing
6 changed files
with
1,015 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# ############################################################################## | ||
# libs/librust/CMakeLists.txt | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. The ASF licenses this | ||
# file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
# ############################################################################## | ||
|
||
if(CONFIG_LIBRUST) | ||
target_sources(c PRIVATE lib_rust.c) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# For a description of the syntax of this configuration file, | ||
# see the file kconfig-language.txt in the NuttX tools repository. | ||
# | ||
|
||
config LIBRUST | ||
bool "Rust Runtime Compatibility Static Checker" | ||
default y | ||
depends on SYSTEM_TIME64 | ||
depends on FS_LARGEFILE | ||
depends on !SMALL_MEMORY | ||
depends on TLS_NELEM > 0 | ||
---help--- | ||
This option enables building and linking with Rust language support. | ||
Currently, it only do static checking for the compatibility of structs | ||
between Rust and C side. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
############################################################################ | ||
# libs/libc/librust/Make.defs | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. The | ||
# ASF licenses this file to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance with the | ||
# License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
############################################################################ | ||
|
||
ifeq ($(CONFIG_LIBRUST),y) | ||
# Add the librust C files to the build | ||
|
||
CSRCS += lib_rust.c | ||
|
||
# Add the librust directory to the build | ||
|
||
DEPPATH += --dep-path librust | ||
VPATH += :librust | ||
endif |
Oops, something went wrong.