compile: -nostdinc -nostdinc++ -include {ewl prefix} -ffunction- sections -fdata-sections
link: -nostartfiles -nostdlib -nodefaultlib --gc-sections -T{lcf file} --start-group -lc -lc++ -lgcc -lhosted -lrt -lsupc++ --end- group
If you use the linker tool, (for example powerpc-eabi-ld) then pass the library paths, start-up files and the libraries manually.
Therefor the recommended option is to use the compiler driver (for example powerpc-eabi-gcc) for linking the required object files and libraries to generate the executable. The compiler driver will search and pick the required libraries ( libc.a, libgcc.a) automatically.
Check if the user is using the correct driver (for example powerpc-eabi-gcc for C programs and powerpc-eabi-g++ for C++ programs)
By default when linking with the compiler driver, it picks the default start-up code. To avoid using the default start up file, pass ' -nostartfiles' option to the compiler driver while linking.
By default, the linker usually resolves the symbols from left to right. So if any library/object (e.g libA) is dependent on another library/object (e.g libB) then we should pass libA first. And if there is inter-dependency between these libraries, then pass these libraries between '-start-group' and '--end- group'.