Search notes:

gcc -Wl,linker-option

gcc -Wl,-option passes the linker specific option -option to the linker.

prog.c

I am going to compile and link the following simple program:
#include <stdio.h>

int main() {
    return 0;
}
Github repository about-gcc, path: /options/Wl/prog.c

Makefile

When I link the program, we want to pass the -t flag to the linker so that it traces the names of the input files that the linker processes.
This can be achieved by invoking gcc with -Wl,-t:
a.out: prog.o
	@gcc -Wl,-t $^ -o $@

prog.o: prog.c
	@gcc -c $< -o $@
Github repository about-gcc, path: /options/Wl/Makefile

Output

The output of the -t option on my machine is:
/usr/bin/ld: mode elf_x86_64
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/crtbeginS.o
prog.o
libgcc_s.so.1 (/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/../../../../lib/libgcc_s.so.1)
/usr/lib/libc.so.6
(/usr/lib/libc_nonshared.a)elf-init.oS
/usr/lib/ld-linux-x86-64.so.2
/usr/lib/ld-linux-x86-64.so.2
libgcc_s.so.1 (/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/../../../../lib/libgcc_s.so.1)
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.1/../../../../lib/crtn.o

See also

GCC options

Index