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

PIC mode on Ubuntu #1

Open
adamvm opened this issue Dec 11, 2021 · 0 comments
Open

PIC mode on Ubuntu #1

adamvm opened this issue Dec 11, 2021 · 0 comments

Comments

@adamvm
Copy link

adamvm commented Dec 11, 2021

Hi during compilation trial I had to modify Makefile due to an error:

$ make
cc -c -o cppmod.o -mcmodel=kernel -fpermissive -fno-builtin -fno-exceptions -fno-rtti -nostdinc cppmod.cpp
cc1plus: error: code model kernel does not support PIC mode
make: *** [Makefile:12: cppmod.o] Błąd 1

the solution is to extend commandline with -fno-pie

anyway I have problem with compilation:

$ make
cc -c -o cppmod.o -mcmodel=kernel -fpermissive -fno-builtin -fno-exceptions -fno-rtti -nostdinc -fno-pie cppmod.cpp
In file included from cppmod.cpp:4:
new.h:4:14: warning: ‘operator new’ takes type ‘size_t’ (‘long unsigned int’) as first parameter [-fpermissive]
4 | inline void *operator new(size_t s) {
| ^~~~~~~~
make -C /lib/modules/5.13.0-22-generic/build M=/home/adi/dev/linux-kernel-driver-cpp modules
make[1]: Wejście do katalogu '/usr/src/linux-headers-5.13.0-22-generic'
CC [M] /home/adi/dev/linux-kernel-driver-cpp/interface.o
CC [M] /home/adi/dev/linux-kernel-driver-cpp/kernel_api.o
LD [M] /home/adi/dev/linux-kernel-driver-cpp/mydrv.o
MODPOST /home/adi/dev/linux-kernel-driver-cpp/Module.symvers
/home/adi/dev/linux-kernel-driver-cpp/.cppmod.o.cmd: No such file or directory
make[2]: *** [scripts/Makefile.modpost:150: /home/adi/dev/linux-kernel-driver-cpp/Module.symvers] Błąd 1
make[1]: *** [Makefile:1794: modules] Błąd 2
make[1]: Opuszczenie katalogu '/usr/src/linux-headers-5.13.0-22-generic'
make: *** [Makefile:8: module] Błąd 2

but I think is not connected with disabling PIE, I have only Ubuntu machines so no chance to check on other one

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

1 participant