How to disable position independent code (PIC) in CMake code generation for PIL?
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi. I'm trying to create a PIL connectivity configuration for a board with a Cortex-M3 processor, using the "modern" method of target package and CMake. The code that is being generated is PIC, and I need it to not be PIC because I really do not want to write a bootloader. I simply want to run a PIL simulation and confirm that everything is calculated correctly. Handling a PIE is wasted effort.
However, I cannot see any way to disable PIC. In the internal files of the coder toolbox, file "writeCMakeLists.m" which generates the CMakeLists.txt from what I can see, the following is written:
% Always compile using position independent code
% Static libraries built without PIC might cause a failure when linked by a shared library
% See g2329017
cmakeTarget.Properties(end+1) = coder.make.internal.cmake.NameValuePair('PREFIX', '""');
cmakeTarget.Properties(end+1) = coder.make.internal.cmake.NameValuePair('POSITION_INDEPENDENT_CODE', 'ON');
So from that I take that PIC is forced on the generated code. I would like to know if there is any way to disable PIC, or, as a last resort, if modifying the above Matlab file to disable PIC would have any unintended consequences (this is a bit complicated since I don't have admin at work to modify program files, but as a last resort can be done).
Thank you.
0 comentarios
Respuestas (1)
Divyanshu
el 26 de Jun. de 2024
Hi Peter,
As per my understanding from the comments specified in the internal file of the toolbox, 'PIC' is intentionally enabled or kept always 'on' for avoiding failures while linking shared libraries with static libraries.
Therefore, there should not be a way/option to disable it directly.
For more details, you may reach out to support:
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!