For some reason this created a new topic rather than post to existing one...
 
I have refactored the code from my previous submission to move the code from all 3 places to functions.
For both functions: I have chosen sed code from gcc-cross.inc (replaces the paths with "/host" rather than "/" as gcc-target did). This unification shouldn't affect the functionality, only what will be seen instead of sysroot paths.
For remove_sysroot_paths_from_checksum_options: I saw that gcc-target.inc and gcc-cross.inc erase STAGING_DIR_TARGET and STAGING_DIR_HOST respectively. To preserve this behavior, I pass them as parameters and use ${1} in sed.
 
Since I am not that familiar with possible differences between regular shell scripting and shell scripting inside of bitbake recipes, could you confirm that I parameterized the function correctly?