Message ID | 20170609052417.561-2-npiggin@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Nicholas, 2017-06-09 14:24 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: > 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. Which architectures have additional files after --no-whole-archive ? I see this case only for ARCH = "um" in vmlinux_link() where it adds some -l* options after --no-whole-archive. I think it is good to close the --whole-archives everywhere. So, the code looks OK to me, but I just wondered about the log. > This matches more closely with the incremental final link. > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > scripts/link-vmlinux.sh | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh > index c80291319cb2..2a062ea130b5 100755 > --- a/scripts/link-vmlinux.sh > +++ b/scripts/link-vmlinux.sh > @@ -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 \
On Mon, 19 Jun 2017 15:16:17 +0900 Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > Hi Nicholas, > > > 2017-06-09 14:24 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: > > 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. > > Which architectures have additional files after --no-whole-archive ? > > I see this case only for ARCH = "um" in vmlinux_link() > where it adds some -l* options after --no-whole-archive. > > I think it is good to close the --whole-archives everywhere. > So, the code looks OK to me, but I just wondered about the log. Actually a number of archs seemed to get build errors without this, and they seem to come from libgcc perhaps. binfmt_elf.c:(.text+0x4851): undefined reference to `__kernel_syscall_via_epc' /c/gcc/libgcc/libgcc2.c:1318: multiple definition of `__ucmpdi2' /c/gcc/libgcc/libgcc2.c:405: multiple definition of `__lshrdi3' /c/gcc/libgcc/libgcc2.c:433: multiple definition of `__ashldi3' /c/gcc/libgcc/libgcc2.c:461: multiple definition of `__ashrdi3' /home/tony/buildall/src/gcc/libgcc/config/xtensa/lib2funcs.S:36: multiple definition of `__xtensa_libgcc_window_spill' etc m32r, parisc, xtensa seemed to be getting such errors. I wonder if the linker implicitly adds some runtime libs at the end that get caught up here. Either way I didn't look too far into it because this fix seems obviously correct and solved the problem. Thanks, Nick -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Nicholas, 2017-06-19 15:51 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: > On Mon, 19 Jun 2017 15:16:17 +0900 > Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > >> Hi Nicholas, >> >> >> 2017-06-09 14:24 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: >> > 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. >> >> Which architectures have additional files after --no-whole-archive ? >> >> I see this case only for ARCH = "um" in vmlinux_link() >> where it adds some -l* options after --no-whole-archive. >> >> I think it is good to close the --whole-archives everywhere. >> So, the code looks OK to me, but I just wondered about the log. > > Actually a number of archs seemed to get build errors without this, > and they seem to come from libgcc perhaps. > > binfmt_elf.c:(.text+0x4851): undefined reference to `__kernel_syscall_via_epc' > /c/gcc/libgcc/libgcc2.c:1318: multiple definition of `__ucmpdi2' > /c/gcc/libgcc/libgcc2.c:405: multiple definition of `__lshrdi3' > /c/gcc/libgcc/libgcc2.c:433: multiple definition of `__ashldi3' > /c/gcc/libgcc/libgcc2.c:461: multiple definition of `__ashrdi3' > > /home/tony/buildall/src/gcc/libgcc/config/xtensa/lib2funcs.S:36: multiple definition of `__xtensa_libgcc_window_spill' > > etc Oops, I did not test such architectures. > m32r, parisc, xtensa seemed to be getting such errors. I wonder if > the linker implicitly adds some runtime libs at the end that get > caught up here. Either way I didn't look too far into it because this > fix seems obviously correct and solved the problem. > > Thanks, Which toolchains do you use? I downloaded xtensa-linux- from this site: https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/ I see a different error for xtensa. I applied all of you 5 patches, but xtensa build still fails. LD vmlinux.o xtensa-linux-ld: internal error /home/tony/buildall/src/binutils/ld/ldlang.c 6178 Could you check it?
On Mon, 19 Jun 2017 17:14:22 +0900 Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > Hi Nicholas, > > > 2017-06-19 15:51 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: > > On Mon, 19 Jun 2017 15:16:17 +0900 > > Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > > > >> Hi Nicholas, > >> > >> > >> 2017-06-09 14:24 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: > >> > 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. > >> > >> Which architectures have additional files after --no-whole-archive ? > >> > >> I see this case only for ARCH = "um" in vmlinux_link() > >> where it adds some -l* options after --no-whole-archive. > >> > >> I think it is good to close the --whole-archives everywhere. > >> So, the code looks OK to me, but I just wondered about the log. > > > > Actually a number of archs seemed to get build errors without this, > > and they seem to come from libgcc perhaps. > > > > binfmt_elf.c:(.text+0x4851): undefined reference to `__kernel_syscall_via_epc' > > /c/gcc/libgcc/libgcc2.c:1318: multiple definition of `__ucmpdi2' > > /c/gcc/libgcc/libgcc2.c:405: multiple definition of `__lshrdi3' > > /c/gcc/libgcc/libgcc2.c:433: multiple definition of `__ashldi3' > > /c/gcc/libgcc/libgcc2.c:461: multiple definition of `__ashrdi3' > > > > /home/tony/buildall/src/gcc/libgcc/config/xtensa/lib2funcs.S:36: multiple definition of `__xtensa_libgcc_window_spill' > > > > etc > > > Oops, I did not test such architectures. > > > > m32r, parisc, xtensa seemed to be getting such errors. I wonder if > > the linker implicitly adds some runtime libs at the end that get > > caught up here. Either way I didn't look too far into it because this > > fix seems obviously correct and solved the problem. > > > > Thanks, > > > Which toolchains do you use? I just had them run through the kbuild 0day tests. Not sure exactly what they use. > I downloaded xtensa-linux- from this site: > https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/ > > > I see a different error for xtensa. > > > I applied all of you 5 patches, but xtensa build still fails. > > LD vmlinux.o > xtensa-linux-ld: internal error > /home/tony/buildall/src/binutils/ld/ldlang.c 6178 > > > Could you check it? Ahh, the old ld: internal error... what ld version is that? Thanks, Nick -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Nicholas, 2017-06-19 17:27 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: > On Mon, 19 Jun 2017 17:14:22 +0900 > Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > >> Hi Nicholas, >> >> >> 2017-06-19 15:51 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: >> > On Mon, 19 Jun 2017 15:16:17 +0900 >> > Masahiro Yamada <yamada.masahiro@socionext.com> wrote: >> > >> >> Hi Nicholas, >> >> >> >> >> >> 2017-06-09 14:24 GMT+09:00 Nicholas Piggin <npiggin@gmail.com>: >> >> > 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. >> >> >> >> Which architectures have additional files after --no-whole-archive ? >> >> >> >> I see this case only for ARCH = "um" in vmlinux_link() >> >> where it adds some -l* options after --no-whole-archive. >> >> >> >> I think it is good to close the --whole-archives everywhere. >> >> So, the code looks OK to me, but I just wondered about the log. >> > >> > Actually a number of archs seemed to get build errors without this, >> > and they seem to come from libgcc perhaps. >> > >> > binfmt_elf.c:(.text+0x4851): undefined reference to `__kernel_syscall_via_epc' >> > /c/gcc/libgcc/libgcc2.c:1318: multiple definition of `__ucmpdi2' >> > /c/gcc/libgcc/libgcc2.c:405: multiple definition of `__lshrdi3' >> > /c/gcc/libgcc/libgcc2.c:433: multiple definition of `__ashldi3' >> > /c/gcc/libgcc/libgcc2.c:461: multiple definition of `__ashrdi3' >> > >> > /home/tony/buildall/src/gcc/libgcc/config/xtensa/lib2funcs.S:36: multiple definition of `__xtensa_libgcc_window_spill' >> > >> > etc >> >> >> Oops, I did not test such architectures. >> >> >> > m32r, parisc, xtensa seemed to be getting such errors. I wonder if >> > the linker implicitly adds some runtime libs at the end that get >> > caught up here. Either way I didn't look too far into it because this >> > fix seems obviously correct and solved the problem. >> > >> > Thanks, >> >> >> Which toolchains do you use? > > I just had them run through the kbuild 0day tests. Not sure exactly > what they use. > >> I downloaded xtensa-linux- from this site: >> https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/ >> >> >> I see a different error for xtensa. >> >> >> I applied all of you 5 patches, but xtensa build still fails. >> >> LD vmlinux.o >> xtensa-linux-ld: internal error >> /home/tony/buildall/src/binutils/ld/ldlang.c 6178 >> >> >> Could you check it? > > Ahh, the old ld: internal error... what ld version is that? > seems 2.24 according to the following: masahiro@pug:~$ xtensa-linux-ld -v GNU ld (GNU Binutils) 2.24
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index c80291319cb2..2a062ea130b5 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -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 \
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> --- scripts/link-vmlinux.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)