blue_bonnet
blue_bonnet

Reputation: 133

C++ support in kernel module in 64-bit system

I know C++ is not recommended in kernel module, however, we have a module written in a mix of C and C++ files, the module works well in 32-bit system (kernel 2.6), now we are trying to port the module to 64-bit system, is C++ not supported at all in 64-bit system?

Upvotes: 4

Views: 1749

Answers (2)

Maxim Razin
Maxim Razin

Reputation: 9466

Roughly speaking, to use C++ in kernel, you should get rid of all C++ runtime library dependencies, first of all, you should reimplement new/delete and remove exception handling (compile with -fno-exceptions). Actually if the 32-bit code works, those simple cases must be already resolved.

Just try to compile and load the module. If you are lucky, there will be no linkage errors, and you have a good chance for a module to work (modulo the usual set of crossplatform issues such as structure sizes and alignment). If you are not, you will receive a list of undefined symbols that will give you a hint what should be implemented or worked around.

Upvotes: 3

spraff
spraff

Reputation: 33405

It's not a question of whether the language is supported on 64-bit, but whether the libraries and other code are portable.

Upvotes: 2

Related Questions