How to disable position independent code (PIC) in CMake code generation for PIL?
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Divyanshu
2024-6-26
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!