gcc -Wl,-O1 -Wl,--as-needed This will be used to link .o files into an executable.