diff options
Diffstat (limited to 'scripts/link-vmlinux.sh')
-rwxr-xr-x | scripts/link-vmlinux.sh | 103 |
1 files changed, 38 insertions, 65 deletions
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index be56a1153014..9045823c7be7 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -4,7 +4,7 @@ # link vmlinux # # vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and -# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.o files +# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.a files # from top-level directories in the kernel tree, others are specified in # arch/$(ARCH)/Makefile. Ordering when linking is important, and # $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives @@ -18,7 +18,7 @@ # | +--< init/version.o + more # | # +--< $(KBUILD_VMLINUX_MAIN) -# | +--< drivers/built-in.o mm/built-in.o + more +# | +--< drivers/built-in.a mm/built-in.a + more # | # +--< $(KBUILD_VMLINUX_LIBS) # | +--< lib/lib.a + more @@ -51,17 +51,15 @@ info() # # Traditional incremental style of link does not require this step # -# built-in.o output file +# built-in.a output file # archive_builtin() { - if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then - info AR built-in.o - rm -f built-in.o; - ${AR} rcsTP${KBUILD_ARFLAGS} built-in.o \ - ${KBUILD_VMLINUX_INIT} \ - ${KBUILD_VMLINUX_MAIN} - fi + info AR built-in.a + rm -f built-in.a; + ${AR} rcsTP${KBUILD_ARFLAGS} built-in.a \ + ${KBUILD_VMLINUX_INIT} \ + ${KBUILD_VMLINUX_MAIN} } # Link of vmlinux.o used for section mismatch analysis @@ -70,20 +68,13 @@ modpost_link() { local objects - if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then - objects="--whole-archive \ - built-in.o \ - --no-whole-archive \ - --start-group \ - ${KBUILD_VMLINUX_LIBS} \ - --end-group" - else - objects="${KBUILD_VMLINUX_INIT} \ - --start-group \ - ${KBUILD_VMLINUX_MAIN} \ - ${KBUILD_VMLINUX_LIBS} \ - --end-group" - fi + objects="--whole-archive \ + built-in.a \ + --no-whole-archive \ + --start-group \ + ${KBUILD_VMLINUX_LIBS} \ + --end-group" + ${LD} ${LDFLAGS} -r -o ${1} ${objects} } @@ -96,46 +87,28 @@ vmlinux_link() local objects if [ "${SRCARCH}" != "um" ]; then - if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then - objects="--whole-archive \ - built-in.o \ - --no-whole-archive \ - --start-group \ - ${KBUILD_VMLINUX_LIBS} \ - --end-group \ - ${1}" - else - objects="${KBUILD_VMLINUX_INIT} \ - --start-group \ - ${KBUILD_VMLINUX_MAIN} \ - ${KBUILD_VMLINUX_LIBS} \ - --end-group \ - ${1}" - fi - - ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ + objects="--whole-archive \ + built-in.a \ + --no-whole-archive \ + --start-group \ + ${KBUILD_VMLINUX_LIBS} \ + --end-group \ + ${1}" + + ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ -T ${lds} ${objects} else - if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then - objects="-Wl,--whole-archive \ - built-in.o \ - -Wl,--no-whole-archive \ - -Wl,--start-group \ - ${KBUILD_VMLINUX_LIBS} \ - -Wl,--end-group \ - ${1}" - else - objects="${KBUILD_VMLINUX_INIT} \ - -Wl,--start-group \ - ${KBUILD_VMLINUX_MAIN} \ - ${KBUILD_VMLINUX_LIBS} \ - -Wl,--end-group \ - ${1}" - fi - - ${CC} ${CFLAGS_vmlinux} -o ${2} \ - -Wl,-T,${lds} \ - ${objects} \ + objects="-Wl,--whole-archive \ + built-in.a \ + -Wl,--no-whole-archive \ + -Wl,--start-group \ + ${KBUILD_VMLINUX_LIBS} \ + -Wl,--end-group \ + ${1}" + + ${CC} ${CFLAGS_vmlinux} -o ${2} \ + -Wl,-T,${lds} \ + ${objects} \ -lutil -lrt -lpthread rm -f linux fi @@ -191,7 +164,7 @@ cleanup() rm -f .tmp_System.map rm -f .tmp_kallsyms* rm -f .tmp_vmlinux* - rm -f built-in.o + rm -f built-in.a rm -f System.map rm -f vmlinux rm -f vmlinux.o @@ -296,8 +269,8 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o # step 3 - size1=$(stat -c "%s" .tmp_kallsyms1.o) - size2=$(stat -c "%s" .tmp_kallsyms2.o) + size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms1.o) + size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms2.o) if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then kallsymso=.tmp_kallsyms3.o |