-
Notifications
You must be signed in to change notification settings - Fork 8.2k
SDK 1.0 linker compatibility fixes #94359
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
SDK 1.0 linker compatibility fixes #94359
Conversation
The linker may want to know the desired optimization level as when the multilib configuration includes -Os as a selector. Adopt the same pattern as the assembler optimization flags by allowing toolchains to specify linker optimization flags which default to the compiler optimization flags and the apply those using add_link_options. Signed-off-by: Keith Packard <[email protected]>
With inclusion of the optimization flag into the multilib selection process, we cannot compute the compiler library path when the compiler's target.cmake is processed as LINKER_OPTIMIZATION_FLAG is not computed until much later. Instead, add a function (compiler_file_path) which can be used to locate the appropriate crtbegin.o and crtend.o files. Delay computation of lib_include_dir and rt_library until after all compiler flags have been computed by adding compiler_set_linker_properties and calling that just before toolchain_linker_finalize is invoked. Place default implementations of both of these functions in a new file, cmake/compiler/target_template.cmake, where we assume the compiler works like gcc or clang and handlers the --print-file-name and --print-libgcc-file-name options. Compilers needing alternate implementations can override these functions in their target.cmake files. These implementations require that no generator expressions are necessary for the compiler to compute the right library paths. This mechanism is also used to take any additional compiler options by adding a new (optional) linker function, toolchain_linker_add_compiler_options, which maps compiler options to equivalent linker options, discarding any that aren't applicable. Signed-off-by: Keith Packard <[email protected]>
|
|
Hi @keith-packard, looks like this one just broke our ARC MWDT toolchain as we don't have --print-libgcc-file-name. |
You'll need to provide |
|
sorry for not responding earlier, this broke us (IAR) as well, but it should be easy and clear to fix, so no problems :) |



SDK 1.0 provides -O2 and -Os versions of each library and startup files. These are selected with the compiler optimization flag. The first patch in this series adopts the style of the recent asm optimization flag for linker usage. The second patch delays computation of startup file paths until after the optimization style has been chosen.