I have a script that needs to prevent gcc from passing -L with the standard library paths to ld. Using -nostdlib inhibits the -lc -lgcc etc. but not the -L. Using -Wl,-nostdlib prevents the linker from using its own standard path, but doesn’t stop gcc from passing -L with the standard paths. Is there any way to ensure that gcc calls the linker with nothing in the library path expect the directories I explicitly write on the command line?
I have a script that needs to prevent gcc from passing -L with the
Share
I found a solution but it depends on gcc 4.4 or later for the
-wrapperoption (slightly updated version of the script):My version of this wrapper is tuned to re-add alternate
crt1.oandlibcandlibgccfiles in place of the ones it prevents access to, but you could just as easily omit them if needed.