-
Notifications
You must be signed in to change notification settings - Fork 217
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
Fix #641, add OS_ModuleLoad flags #643
Fix #641, add OS_ModuleLoad flags #643
Conversation
f553c98
to
d068af0
Compare
Add flags to indicate symbol visibility for OS_ModuleLoad(). By default (flags=0) symbols will have global visibility, which should be the same as existing behavior.
d068af0
to
c70936e
Compare
This can be reviewed if there is time.... mainly looking for feedback regarding addition of the flags parameter. This changeset to OSAL is fully functional (contains all unit test updates, all passing, etc) but if accepted it will need a corresponding patch to CFE to pass in a value for flags. |
CCB 2020-11-04 APPROVED
|
This restores the original behavior when using OS_SymbolLookup on POSIX, so it doesn't return OS_ERR_NOT_IMPLEMENTED. This is required for transitional purposes. Will submit a separate bug about use platform-dependent logic here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.. Nothing needed in the RTEMS implementation ?
Correct! AFAIK RTEMS has a flat namespace, like VxWorks - so no change is needed for its "dlopen()" call. It will ignore the flag. I built and sanity checked my RTEMS 4.11.3, seems to boot and run fine, so long as you've also merged nasa/cFE#1000. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a functional test? If not, should add to go with the new APIs. Could be done as a separate issue.
@jphickey will you add these to this PR? If not can you open a new PR for them? |
I don't think we need to add anything more? The current functional tests (in But we cannot verify symbol visibility because it won't necessarily be consistent across platforms (i.e. the underlying OS may or may not actually implement the capability). So as a result the only thing we can actually vaildate in functional test remains the current operation. |
Sounds good to me, I'll merge this then. @skliper do we need to document this testing limitation anywhere else other than in this thread? |
The functional test should report if the underlying OS supports the functionality or not (basically check the result, if it works report as such and if it doesn't report that it's not supported). It's not a "Failure" for it not to be supported, but should report. |
Could also make it one of the tests that require analysis to fully pass... worth a check in the end to confirm it's the expected result. It would be an issue if it's expected to work and doesn't. |
This flag is really just a hint to the OSAL about how the app plans to use the module being loaded. The OSAL may or may not actually do anything differently. Since functional tests only use public APIs, there is no way for a functional tests to determine if its supposed to have an effect or not. The expected pattern is:
And this is the pattern used/implemented by the functional tests now, and as such it is confirmed to work correctly. But the issue is that an app doing this "wrongly" i.e. using LOCAL load flags with So while we could add an OSAL test to call the "wrong" combinations of these functions - we'd have to pass the test either way - or at least it will be an MIR result regardless of what OSAL returned. So I don't see much value in doing this. |
I misinterpreted "But we cannot verify symbol visibility..." to mean it isn't being checked functionally for the correct behavior. As long as the functional test is confirming the correct behavior for the correct combination I'm good with it (no need for testing incorrect combination). |
Right - by that statement I only meant that if a module is loaded w/LOCAL - we cannot verify that its symbols are not also visible via the global lookup function. They might be, and its not a failure if they are. |
* Add nasa/cFE#984 * Add nasa/cFE#980 * Add nasa/cFE#867 * Add nasa/osal#638 and update cfe due to rebase * Add nasa/cFE#987 * Add nasa/to_lab#64 and nasa/sample_app#104 * Add nasa/osal#643 * Add nasa/cFE#1000 * Add nasa/ci_lab#58 * Add doxygen fixes for nasa/osal#643 * Add nasa/cFE#1013 * Add nasa/cFE#1011 * Add nasa/ci_lab#61 * Add nasa/sample_app#109 * Bump versions and point to submodules main Co-authored-by: Joseph Hickey <joseph.p.hickey@nasa.gov>
Describe the contribution
Add a "flags" parameter to OS_ModuleLoad() and use this to indicate the desired symbol visibility - either GLOBAL (0, the default, and matches current behavior) or LOCAL, which means symbols are hidden from other modules.
This is intended as a "hint" to OSAL as to how the module will be used - LOCAL prevents other modules from binding to symbols in this module, thereby ensuring/preserving the ability to unload in the future. CFE should use LOCAL flag for apps, and GLOBAL flags for libraries, which are typically not ever unloaded.
Fixes #641
Testing performed
Build and run unit test
Sanity check CFE (update/patch required update to CFE to add flags parameter on API call)
Expected behavior changes
No impact to behavior if flags are passed as 0.
System(s) tested on
Ubuntu 20.04
Additional context
Related to nasa/cFE#952
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.