GCC/ld/rules.ld adjustment
Posted: Wed Mar 23, 2016 10:37 am
I would like to suggest a small adjustment to GCC/ld/rules.ld file (patch attached), against the current svn. The point is that this makes it possible to use custom ld scripts without extra hassle of copying over rules* ld files as well.
Explanation: if rules* files do not reside in the same directory as the main ld script (e.g. STM32F042x4.ld which doesn't come with the mainline ChibiOS - so I put it in the project directory) then the INCLUDE commands can't find the rules_*.ld files in the main ChibiOS tree. It's because the search paths passed normally to linker are 1) wherever the main ld script is; and 2) os/common/startup/ARMCMx/compilers/GCC
However the rules_* ld files are not there, they're in the 'ld' subdirectory of 2).
With this patch, I can 'INCLUDE ld/rules.ld' in my main project ld script, and then the nested INCLUDEs in the rules.ld find the rules_*.ld correctly.
This makes no change to the demos/ldscripts included in the mainline ChibiOS because of 2) above.
Explanation: if rules* files do not reside in the same directory as the main ld script (e.g. STM32F042x4.ld which doesn't come with the mainline ChibiOS - so I put it in the project directory) then the INCLUDE commands can't find the rules_*.ld files in the main ChibiOS tree. It's because the search paths passed normally to linker are 1) wherever the main ld script is; and 2) os/common/startup/ARMCMx/compilers/GCC
However the rules_* ld files are not there, they're in the 'ld' subdirectory of 2).
With this patch, I can 'INCLUDE ld/rules.ld' in my main project ld script, and then the nested INCLUDEs in the rules.ld find the rules_*.ld correctly.
This makes no change to the demos/ldscripts included in the mainline ChibiOS because of 2) above.