kbuild: thin archives final link close --whole-archives option
authorNicholas Piggin <npiggin@gmail.com>
Fri, 9 Jun 2017 05:24:13 +0000 (15:24 +1000)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 30 Jun 2017 00:03:02 +0000 (09:03 +0900)
Close the --whole-archives option with --no-whole-archive. Some
architectures end up including additional .o and files multiple
times after this, and they get duplicate symbols when they are
brought under the --whole-archives option.

This matches more closely with the incremental final link.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/link-vmlinux.sh

index c80291319cb2e20e15df93b685b8065ffdd9742e..2a062ea130b5fca90d68e24bf2ae6e644340cf12 100755 (executable)
@@ -63,7 +63,7 @@ modpost_link()
        local objects
 
        if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
-               objects="--whole-archive built-in.o"
+               objects="--whole-archive built-in.o --no-whole-archive"
        else
                objects="${KBUILD_VMLINUX_INIT}                         \
                        --start-group                                   \
@@ -83,7 +83,7 @@ vmlinux_link()
 
        if [ "${SRCARCH}" != "um" ]; then
                if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
-                       objects="--whole-archive built-in.o ${1}"
+                       objects="--whole-archive built-in.o ${1} --no-whole-archive"
                else
                        objects="${KBUILD_VMLINUX_INIT}                 \
                                --start-group                           \
@@ -96,7 +96,7 @@ vmlinux_link()
                        -T ${lds} ${objects}
        else
                if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
-                       objects="-Wl,--whole-archive built-in.o ${1}"
+                       objects="-Wl,--whole-archive built-in.o ${1} -Wl,--no-whole-archive"
                else
                        objects="${KBUILD_VMLINUX_INIT}                 \
                                -Wl,--start-group                       \