Skip to content
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

Support VxWorks "muncher" for C++ #244

Open
jhnphm opened this issue Jan 28, 2021 · 4 comments
Open

Support VxWorks "muncher" for C++ #244

jhnphm opened this issue Jan 28, 2021 · 4 comments

Comments

@jhnphm
Copy link

jhnphm commented Jan 28, 2021

Is your feature request related to a problem? Please describe.
VxWorks requires a tool called a "muncher" in order to generate stubs required for static destructors/constructors to run, when building for C++.

Describe the solution you'd like
Run the muncher. An example implementation is below:

In VxWorks-CFE.cmake, change

set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE})

to

if(NOT DEFINED CMAKE_CXX_CREATE_SHARED_MODULE)
    set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE})
endif()

Somewhere in the target-specific PSP cmakefiles or toolchain file, define something like (the below is for SP0-S, derived from the workbench-generated makefiles)

set(VSB_DIR "${WIND_BASE}/target/lib")
set(VXMUNCHER_TAGS ${VSB_DIR}/tags/ppc/PPC85XX/e500v2common/dkm.tags)
set(VXMUNCHER_TCL "tclsh ${WIND_BASE}/host/resource/hutils/tcl/munch.tcl -c ppc -tags ${VXMUNCHER_TAGS}")
set(VXMUNCHER_COMPILE_FLAGS "-O2 -fstrength-reduce -te500v2 -mhard-float -fno-implicit-fp -mstrict-align -fno-builtin -fdollars-in-identifiers -c")
set(VX_LINK_FLAGS "-r -nostdlib -Wl,-X -T ${WIND_BASE}/target/h/tool/gnu/ldscripts/link.OUT")


set(CMAKE_CXX_CREATE_SHARED_MODULE
    "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> ${VX_LINK_FLAGS} <LINK_FLAGS> <OBJECTS> -o <TARGET>.PartialImage.out <LINK_LIBRARIES>"
    "${CMAKE_NM} <TARGET>.PartialImage.out | ${VXMUNCHER_TCL} > <TARGET>.ctdt.c"
    "<CMAKE_C_COMPILER> -c <TARGET>.ctdt.c -o <TARGET>.ctdt.c.o ${VXMUNCHER_COMPILE_FLAGS}"
    "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <TARGET>.PartialImage.out <TARGET>.ctdt.c.o -o <TARGET> ${VX_LINK_FLAGS}"
)

Describe alternatives you've considered
Leave CMAKE_CXX_CREATE_SHARED_MODULE unset so it can be overridden in the toolchain file.

Additional context
N/A

Requester Info
John N Pham, Northrop Grumman

@ghost
Copy link

ghost commented Jan 28, 2021

John, it's up to the user to figure out how to integrate cFS into their build environment. I don't think this is something we would consider since we aren't a c++ project either. Someone else correct me if I'm wrong.

@skliper
Copy link
Contributor

skliper commented Jan 28, 2021

As @klystron78 mentioned, this would probably be more appropriate in a mission specific PSP (for the SP0 or whatever you are using). Right now our scope for the open source is still c (unless/until we get resources to expand support/testing to include c++).

@jhnphm
Copy link
Author

jhnphm commented Jan 28, 2021

In that case, perhaps leave CMAKE_CXX_CREATE_SHARED_MODULE unset if it's not supported so it can be overridden in the toolchain file/PSP ? Although I guess the PSP repo is for the most part cloned and owned so it's not a huge deal if left as-is.

@skliper
Copy link
Contributor

skliper commented Feb 12, 2021

@mprather was the CMAKE_CXX_CREATE_SHARED_MODULE the issue for you also?

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

No branches or pull requests

2 participants