Bulid regression with VDSO enabled
Quoted 52 lines · Stefan Agner
Quoted 11 lines · Nathan Lynch
A relevant difference would seem to be that ld defaults to gold for this toolchain:
$ arm-angstrom-linux-gnueabi-ld --version GNU gold (GNU Binutils 2.24) 1.11 ...I've not been explicitly testing the vdso code with gold until now, sorry. Is gold a "supported" linker for the ARM kernel these days? If I disable
CONFIG_VDSOI encounter this during final link:Quoted 8 lines
LD
init/built-in.o
arm-angstrom-linux-gnueabi-ld: --pic-veneer: unknown option arm-angstrom-linux-gnueabi-ld: use the --help option for usage informationI've managed to recreate this locally now, and I'll see what can be done. Commit
378ed3ccd2a0"x86, vdso: Make the vdso linker script compatible with Gold" looks relevant.This error does not look like the error I have:
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N /build/ags/oe-core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so[.hash]:
Bad value
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N /build/ags/oe-core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so:
Bad value
make[2]: *** [arch/arm/vdso/vdso.so] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
I just updated my toolchain to Linaro's 2014.11 based version, still
using meta-linaro/OpenEmbedded build system, but still the same issue.
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N /build/linuxdev/oe-core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so[.hash]:
Bad value
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N /build/linuxdev/oe-core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so:
Bad value
make[2]: *** [arch/arm/vdso/vdso.so] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....
Quoted 3 lines
The toolchain comes with GCC version 4.9.3... So the problem seems to be quite unrelated to the toolchain version, but more to the actual configuration of the toolchain.
This kind of thing annoys me. Your statement here is totally incorrect because you're counting the number of apples and reporting it as the number of oranges.
The version of GCC has nothing to do with the version of the linker. The linker is part of binutils, which is an entirely separate software package from the compiler.
What I know is that this works with the stock GNU binutils version 2.22, which is what I'm using here. Can you report which version of binutils you're using please (and I hope that if it has non-upstream changes, that the version number reflects that fact.)
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
Quoted 57 lines · Russell King - ARM Linux
Quoted 52 lines · Stefan Agner
Quoted 11 lines · Nathan Lynch
A relevant difference would seem to be that ld defaults to gold for this toolchain:
$ arm-angstrom-linux-gnueabi-ld --version GNU gold (GNU Binutils 2.24) 1.11 ...I've not been explicitly testing the vdso code with gold until now, sorry. Is gold a "supported" linker for the ARM kernel these days? If I disable
CONFIG_VDSOI encounter this during final link:Quoted 8 lines
LD
init/built-in.o
arm-angstrom-linux-gnueabi-ld: --pic-veneer: unknown option arm-angstrom-linux-gnueabi-ld: use the --help option for usage informationI've managed to recreate this locally now, and I'll see what can be done. Commit
378ed3ccd2a0"x86, vdso: Make the vdso linker script compatible with Gold" looks relevant.This error does not look like the error I have:
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N /build/ags/oe-core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so[.hash]:
Bad value
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N /build/ags/oe-core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so:
Bad value
make[2]: *** [arch/arm/vdso/vdso.so] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
I just updated my toolchain to Linaro's 2014.11 based version, still
using meta-linaro/OpenEmbedded build system, but still the same issue.
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N /build/linuxdev/oe-core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so[.hash]:
Bad value
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try
linking with -N /build/linuxdev/oe-core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so:
Bad value
make[2]: *** [arch/arm/vdso/vdso.so] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....Quoted 3 lines
The toolchain comes with GCC version 4.9.3... So the problem seems to be quite unrelated to the toolchain version, but more to the actual configuration of the toolchain.
Quoted 7 lines
This kind of thing annoys me. Your statement here is totally incorrect because you're counting the number of apples and reporting it as the number of oranges.
The version of GCC has nothing to do with the version of the linker. The linker is part of binutils, which is an entirely separate software package from the compiler.
Yeah sure, sorry about that. The essence I wanted to convey was that it happens with two different releases of the Linaro toolchain, which happens to be denoted with the GCC version number + that year.month thing. The two versions which come with Angstrom/meta-linaro are:
- Linaro toolchain 4.8-2014.04 (which comes with Angstrom 2014.06, meta-linaro, daisy branch)
- Linaro toolchain 4.9-2014.11 (which comes with Angstrom 2014.12, meta-linaro, dizzy branch)
Quoted 4 lines
What I know is that this works with the stock GNU binutils version 2.22, which is what I'm using here. Can you report which version of binutils you're using please (and I hope that if it has non-upstream changes, that the version number reflects that fact.)
The newer toolchain does, while the older does not:
...ld.bfd --version
GNU ld (GNU Binutils) Linaro 2014.11-2 2.24.0.20141017
...ld.bfd --version
GNU ld (GNU Binutils) 2.24
It looks like the Linaro release 2014.04 really did not alter binutils. However, meta-linaro, the OpenEmbedded build layer, puts several patches on-top of that, but failing to alter the version number.
Quite likely that the problem come with one of those patches. But the linaro-dev mailing list on CC, maybe somebody knows more?
--
Stefan
Quoted 65 lines · Stefan Agner
Quoted 64 lines · Nathan Lynch
Quoted 42 lines · Stefan Agner
Quoted 30 lines · Nathan Lynch
Quoted 29 lines · Stefan Agner
Quoted 16 lines · Nathan Lynch
Quoted 12 lines · Stefan Agner
OBJCOPY
arch/arm/vdso/vdso.so
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try linking with -N arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so[.hash]: Bad value
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try linking with -N arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so: Bad value make[2]: *** [arch/arm/vdso/vdso.so] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....Quoted 2 lines
I'm using GCC 4.8.3 (Linaro GCC 4.8-2014.04) on Fedora 21. Any specific new requirements to the toolchain or a bug?
Quoted 6 lines
I've not encountered this before, and I'm not able to recreate it with that toolchain.
If you're using the Linaro toolchain I would expect the name of objcopy to be arm-linux-gnueabihf-objcopy, but your log shows arm-angstrom-linux-gnueabi-objcopy. What's going on there?
The toolchain is built by the OpenEmbedded build system. I used the Angstrom distribution, which uses the Linaro Layer (daisy branch) which built that toolchain:
https://git.linaro.org/openembedded/meta-linaro.git/shortlog/refs/heads/daisyQuoted 5 lines
Quoted 2 lines
I tried the official release and I also could not reproduce the issue, so it seems to be toolchain related...?
Okay thanks, that gives me more to go on. I probably won't be able to devote more time to this today, but hopefully tomorrow.
FWIW, I just looked into it a bit more myself, however don't understand what is wrong with that toolchain so far. The generated linker command looks good for both toolchains, it is really that one linker creates the problem with the very same arguments while the other does not.
Quoted 4 lines
The toolchain generated by OpenEmbedded is probably quite different from the official releases. There are a bunch of configurations which are tweaked depending on the local OE configuration as well:
https://github.com/openembedded/oe-core/blob/master/meta/recipes-devtools/gcc/gcc-configure-common.incA relevant difference would seem to be that ld defaults to gold for this toolchain:
$ arm-angstrom-linux-gnueabi-ld --version GNU gold (GNU Binutils 2.24) 1.11 ...I've not been explicitly testing the vdso code with gold until now, sorry. Is gold a "supported" linker for the ARM kernel these days? If I disable
CONFIG_VDSOI encounter this during final link:LD
init/built-in.o
arm-angstrom-linux-gnueabi-ld: --pic-veneer: unknown option arm-angstrom-linux-gnueabi-ld: use the --help option for usage information
Quoted 5 lines
Quoted 3 lines
I've managed to recreate this locally now, and I'll see what can be done. Commit
378ed3ccd2a0"x86, vdso: Make the vdso linker script compatible with Gold" looks relevant.This error does not look like the error I have:
I can see I perhaps phrased that badly; when I said I can recreate "this" I meant I could recreate the issue you reported. I was intending to point out that even if the vdso build with gold is fixed or worked around, the kernel still won't link because gold doesn't implement --pic-veneer.
Quoted 3 lines
Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
When I try this, ld.gold is used regardless.
You can tell by doing and checking for a NT_GNU_GOLD_VERSION note:
$ readelf -n arch/arm/vdso/vdso.so.raw
Displaying notes found at file offset 0x000001bc with length 0x00000040:
Owner Data size Description
GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version)
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
Build ID: f025409550acb7f955c61d95691291da078e6688Quoted 87 lines · Nathan Lynch
Quoted 65 lines · Stefan Agner
Quoted 64 lines · Nathan Lynch
Quoted 42 lines · Stefan Agner
Quoted 30 lines · Nathan Lynch
Quoted 29 lines · Stefan Agner
Quoted 16 lines · Nathan Lynch
Quoted 12 lines · Stefan Agner
OBJCOPY
arch/arm/vdso/vdso.so
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try linking with -N arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so[.hash]: Bad value
BFD:arch/arm/vdso/vdso.so: Not enough room for program headers, try linking with -N arm-angstrom-linux-gnueabi-objcopy:arch/arm/vdso/vdso.so: Bad value make[2]: *** [arch/arm/vdso/vdso.so] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....Quoted 2 lines
I'm using GCC 4.8.3 (Linaro GCC 4.8-2014.04) on Fedora 21. Any specific new requirements to the toolchain or a bug?
Quoted 6 lines
I've not encountered this before, and I'm not able to recreate it with that toolchain.
If you're using the Linaro toolchain I would expect the name of objcopy to be arm-linux-gnueabihf-objcopy, but your log shows arm-angstrom-linux-gnueabi-objcopy. What's going on there?
The toolchain is built by the OpenEmbedded build system. I used the Angstrom distribution, which uses the Linaro Layer (daisy branch) which built that toolchain:
https://git.linaro.org/openembedded/meta-linaro.git/shortlog/refs/heads/daisyQuoted 5 lines
Quoted 2 lines
I tried the official release and I also could not reproduce the issue, so it seems to be toolchain related...?
Okay thanks, that gives me more to go on. I probably won't be able to devote more time to this today, but hopefully tomorrow.
FWIW, I just looked into it a bit more myself, however don't understand what is wrong with that toolchain so far. The generated linker command looks good for both toolchains, it is really that one linker creates the problem with the very same arguments while the other does not.
Quoted 4 lines
The toolchain generated by OpenEmbedded is probably quite different from the official releases. There are a bunch of configurations which are tweaked depending on the local OE configuration as well:
https://github.com/openembedded/oe-core/blob/master/meta/recipes-devtools/gcc/gcc-configure-common.incA relevant difference would seem to be that ld defaults to gold for this toolchain:
$ arm-angstrom-linux-gnueabi-ld --version GNU gold (GNU Binutils 2.24) 1.11 ...I've not been explicitly testing the vdso code with gold until now, sorry. Is gold a "supported" linker for the ARM kernel these days? If I disable
CONFIG_VDSOI encounter this during final link:LD
init/built-in.o
arm-angstrom-linux-gnueabi-ld: --pic-veneer: unknown option arm-angstrom-linux-gnueabi-ld: use the --help option for usage informationQuoted 5 lines
Quoted 3 lines
I've managed to recreate this locally now, and I'll see what can be done. Commit
378ed3ccd2a0"x86, vdso: Make the vdso linker script compatible with Gold" looks relevant.This error does not look like the error I have:
I can see I perhaps phrased that badly; when I said I can recreate "this" I meant I could recreate the issue you reported. I was intending to point out that even if the vdso build with gold is fixed or worked around, the kernel still won't link because gold doesn't implement --pic-veneer.
Quoted 3 lines
Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
When I try this, ld.gold is used regardless.
You can tell by doing and checking for a
NT_GNU_GOLD_VERSIONnote:
Quoted 8 lines
$ readelf -n arch/arm/vdso/vdso.so.rawDisplaying notes found at file offset
0x000001bcwith length0x00000040:Owner Data size Description GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: f025409550acb7f955c61d95691291da078e6688
Hm, you are right. When deleting moving ld.bfd to ld, which makes the BFD linker as default, compiling works flawless.
However, so far LD=${CROSS_COMPILE}ld.bfc seems to work for other build objects, at least those do not have this note. For instance time.o does not return anything:
$ readelf -n arch/arm/kernel/time.o
So it seems to be a vdso.so.raw specific problem not using the specified linker...?
--
Stefan
Quoted 19 lines · Stefan Agner
Quoted 9 lines · Nathan Lynch
Quoted 3 lines · Stefan Agner
Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
When I try this, ld.gold is used regardless.
You can tell by doing and checking for a
NT_GNU_GOLD_VERSIONnote:Quoted 8 lines
$ readelf -n arch/arm/vdso/vdso.so.rawDisplaying notes found at file offset
0x000001bcwith length0x00000040:Owner Data size Description GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: f025409550acb7f955c61d95691291da078e6688
Quoted 8 lines
Hm, you are right. When deleting moving ld.bfd to ld, which makes the BFD linker as default, compiling works flawless.
However, so far LD=${CROSS_COMPILE}ld.bfc seems to work for other build objects, at least those do not have this note. For instance time.o does not return anything:
$ readelf -n arch/arm/kernel/time.o
This is just an object file that hasn't been linked, but your general point stands -- LD is honored by other parts of the build.
Quoted 2 lines
So it seems to be a vdso.so.raw specific problem not using the specified linker...?
Yes, since it's produced by an invocation of $(CC) which is expected to call the linker implicitly, and this is how the toolchain's default linker ends up getting used even when you set LD on the command line.
If I'm not mistaken, implicitly performing a link through the compiler seems to be 1) conventional for all VDSOs, not just ARM's, but 2) unusual for other parts of the kernel build.
I suppose it's possible to make arch/arm/vdso/Makefile honor LD, but it would basically entail a rewrite. In the meantime, using -fuse-ld=bfd may suffice:
arch/arm/vdso/Makefile +1 -0
@@ -43,6 +43,7 @@ quiet_cmd_vdsold = VDSO $@ cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \ $(call cc-ldoption, -Wl$(comma)--build-id) \ -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ + $(call cc-option, -fuse-ld=bfd) \ -Wl,-z,common-page-size=4096 -o $@ quiet_cmd_vdsomunge = MUNGE $@
Hi Nathan,
Quoted 23 lines · Nathan Lynch
Quoted 22 lines · Stefan Agner
Quoted 9 lines · Nathan Lynch
Quoted 3 lines · Stefan Agner
Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
When I try this, ld.gold is used regardless.
You can tell by doing and checking for a
NT_GNU_GOLD_VERSIONnote:Quoted 8 lines
$ readelf -n arch/arm/vdso/vdso.so.rawDisplaying notes found at file offset
0x000001bcwith length0x00000040:Owner Data size Description GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: f025409550acb7f955c61d95691291da078e6688Hm, you are right. When deleting moving ld.bfd to ld, which makes the BFD linker as default, compiling works flawless.
Quoted 10 lines
Quoted 5 lines
However, so far LD=${CROSS_COMPILE}ld.bfc seems to work for other build objects, at least those do not have this note. For instance time.o does not return anything:
$ readelf -n arch/arm/kernel/time.oThis is just an object file that hasn't been linked, but your general point stands -- LD is honored by other parts of the build.
I suppose this implies that the build only chokes on --pic-veneer when linking the VDSO, and nowhere else?
Quoted 33 lines
Quoted 2 lines
So it seems to be a vdso.so.raw specific problem not using the specified linker...?
Yes, since it's produced by an invocation of $(CC) which is expected to call the linker implicitly, and this is how the toolchain's default linker ends up getting used even when you set LD on the command line.
If I'm not mistaken, implicitly performing a link through the compiler seems to be 1) conventional for all VDSOs, not just ARM's, but 2) unusual for other parts of the kernel build.
I suppose it's possible to make
arch/arm/vdso/Makefilehonor LD, but it would basically entail a rewrite. In the meantime, using -fuse-ld=bfd may suffice:arch/arm/vdso/Makefile +1
-0@@ -43,6 +43,7 @@ quiet_cmd_vdsold = VDSO $@ cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \ $(call cc-ldoption, -Wl$(comma)--build-id) \ -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ + $(call cc-option, -fuse-ld=bfd) \ -Wl,-z,common-page-size=4096 -o $@ quiet_cmd_vdsomunge = MUNGE $@_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 9 lines · Nathan Lynch
I suppose it's possible to make
arch/arm/vdso/Makefilehonor LD, but it would basically entail a rewrite. In the meantime, using -fuse-ld=bfd may suffice:arch/arm/vdso/Makefile +0
-0
arch/arm/vdso/Makefile quiet_cmd_vdsold = VDSO $@ · line 47
Quoted 5 lines
arch/arm/vdso/Makefile +1
-0@@ -43,6 +43,7 @@ quiet_cmd_vdsold = VDSO $@ cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \ $(call cc-ldoption, -Wl$(comma)--build-id) \ -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ + $(call cc-option, -fuse-ld=bfd) \ -Wl,-z,common-page-size=4096 -o $@
Would it make more sense to have something like:
VDSO_LDFLAGS := -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ -Wl,-z,common-page-size=4096 \ $(call cc-ldoption, -Wl$(comma)--build-id) \ $(call cc-option, -fuse-ld=bfd)
and then have:
cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \ -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
Also, do we want to use cc-option or cc-ldoption (this question becomes obvious when you arrange the Makefile as I have above...)? cc-option doesn't result in the linker actually being run, where as cc-ldoption does.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
Quoted 8 lines · Stefan Agner
However, so far LD=${CROSS_COMPILE}ld.bfc seems to work for other build objects, at least those do not have this note. For instance time.o does not return anything:
$ readelf -n arch/arm/kernel/time.oSo it seems to be a vdso.so.raw specific problem not using the specified linker...?
Remember that most of the kernel source is about building the kernel, where we explicitly call the linker directly.
This is about building a user visible object, and we go through the compiler front end for that.
My only worry is if we were to pick up (eg) libgcc.so* as a dependency, but that's highly unlikely to go unnoticed if it were to happen, as my cross-toolchain doesn't have libgcc.so available. ;)
Given that there's gold out there which doesn't work for the VDSO, I think the solution Nathan has come up with in his reply to your email is the best resolution to this.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
Quoted 60 lines · Nathan Lynch
Quoted 19 lines · Stefan Agner
Quoted 9 lines · Nathan Lynch
Quoted 3 lines · Stefan Agner
Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
When I try this, ld.gold is used regardless.
You can tell by doing and checking for a
NT_GNU_GOLD_VERSIONnote:Quoted 8 lines
$ readelf -n arch/arm/vdso/vdso.so.rawDisplaying notes found at file offset
0x000001bcwith length0x00000040:Owner Data size Description GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: f025409550acb7f955c61d95691291da078e6688Quoted 8 lines
Hm, you are right. When deleting moving ld.bfd to ld, which makes the BFD linker as default, compiling works flawless.
However, so far LD=${CROSS_COMPILE}ld.bfc seems to work for other build objects, at least those do not have this note. For instance time.o does not return anything:
$ readelf -n arch/arm/kernel/time.oThis is just an object file that hasn't been linked, but your general point stands -- LD is honored by other parts of the build.
Quoted 2 lines
So it seems to be a vdso.so.raw specific problem not using the specified linker...?
Yes, since it's produced by an invocation of $(CC) which is expected to call the linker implicitly, and this is how the toolchain's default linker ends up getting used even when you set LD on the command line.
If I'm not mistaken, implicitly performing a link through the compiler seems to be 1) conventional for all VDSOs, not just ARM's, but 2) unusual for other parts of the kernel build.
I suppose it's possible to make
arch/arm/vdso/Makefilehonor LD, but it would basically entail a rewrite. In the meantime, using -fuse-ld=bfd may suffice:arch/arm/vdso/Makefile +1
-0@@ -43,6 +43,7 @@ quiet_cmd_vdsold = VDSO $@ cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \ $(call cc-ldoption, -Wl$(comma)--build-id) \ -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ + $(call cc-option, -fuse-ld=bfd) \ -Wl,-z,common-page-size=4096 -o $@
Quoted 1 line
quiet_cmd_vdsomunge= MUNGE $@
Thanks Nathan, your solution looks reasonable. I figured that the option is available since GCC 4.8, so it should work probably for most toolchains which try to make use of gold linker as default.
Unfortunately, I hit another problem with the configuration on my build host. With your patch applied, I get:
collect2: fatal error: cannot find 'ld'
compilation terminated.
make[2]: *** [arch/arm/vdso/vdso.so.raw] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....
OpenEmbedded distinguish between three toolchains for the target:
- Native (on the target)
- Host (on the host which builds the whole image, usually x86_64)
- SDK (on a third architecture for application development, usually x86 or x86_64, the toolchain which I published the link to)
I use x86_64 as host and SDK architecture, nevertheless it seems that the toolchains are configured differently. The Host toolchain (the one which shows the error above) uses "--enable-gold=default" when configuring binutils. With that option, ld.bfd is still being built, but ld is by default gold, without any additional doing (cp/ln -f..). Currently it seems to me that this difference triggers a problem with -fuse-ld=bfd.
However, I don't think that this problem invalidates your proposed solution.
--
Stefan
Quoted 68 lines · Stefan Agner
Quoted 60 lines · Nathan Lynch
Quoted 19 lines · Stefan Agner
Quoted 9 lines · Nathan Lynch
Quoted 3 lines · Stefan Agner
Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
When I try this, ld.gold is used regardless.
You can tell by doing and checking for a
NT_GNU_GOLD_VERSIONnote:Quoted 8 lines
$ readelf -n arch/arm/vdso/vdso.so.rawDisplaying notes found at file offset
0x000001bcwith length0x00000040:Owner Data size Description GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: f025409550acb7f955c61d95691291da078e6688Quoted 8 lines
Hm, you are right. When deleting moving ld.bfd to ld, which makes the BFD linker as default, compiling works flawless.
However, so far LD=${CROSS_COMPILE}ld.bfc seems to work for other build objects, at least those do not have this note. For instance time.o does not return anything:
$ readelf -n arch/arm/kernel/time.oThis is just an object file that hasn't been linked, but your general point stands -- LD is honored by other parts of the build.
Quoted 2 lines
So it seems to be a vdso.so.raw specific problem not using the specified linker...?
Yes, since it's produced by an invocation of $(CC) which is expected to call the linker implicitly, and this is how the toolchain's default linker ends up getting used even when you set LD on the command line.
If I'm not mistaken, implicitly performing a link through the compiler seems to be 1) conventional for all VDSOs, not just ARM's, but 2) unusual for other parts of the kernel build.
I suppose it's possible to make
arch/arm/vdso/Makefilehonor LD, but it would basically entail a rewrite. In the meantime, using -fuse-ld=bfd may suffice:arch/arm/vdso/Makefile +1
-0@@ -43,6 +43,7 @@ quiet_cmd_vdsold = VDSO $@ cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \ $(call cc-ldoption, -Wl$(comma)--build-id) \ -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ + $(call cc-option, -fuse-ld=bfd) \ -Wl,-z,common-page-size=4096 -o $@Quoted 1 line
quiet_cmd_vdsomunge= MUNGE $@Thanks Nathan, your solution looks reasonable. I figured that the option is available since GCC 4.8, so it should work probably for most toolchains which try to make use of gold linker as default.
Quoted 7 lines
Unfortunately, I hit another problem with the configuration on my build host. With your patch applied, I get:
collect2: fatal error: cannot find 'ld'
compilation terminated.
make[2]: *** [arch/arm/vdso/vdso.so.raw] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....
Sorry for the noise, it turns out when using no paths in CROSS_COMPILE and instead add the location of the toolchain to PATH properly, this second issue is fixed.
--
Stefan
Quoted 32 lines · Ard Biesheuvel
Hi Nathan,
Quoted 29 lines · Nathan Lynch
Quoted 27 lines · Stefan Agner
Quoted 9 lines · Nathan Lynch
Quoted 3 lines · Stefan Agner
Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
When I try this, ld.gold is used regardless.
You can tell by doing and checking for a
NT_GNU_GOLD_VERSIONnote:Quoted 8 lines
$ readelf -n arch/arm/vdso/vdso.so.rawDisplaying notes found at file offset
0x000001bcwith length0x00000040:Owner Data size Description GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: f025409550acb7f955c61d95691291da078e6688Hm, you are right. When deleting moving ld.bfd to ld, which makes the BFD linker as default, compiling works flawless.
However, so far LD=${CROSS_COMPILE}ld.bfc seems to work for other build objects, at least those do not have this note. For instance time.o does not return anything:
$ readelf -n arch/arm/kernel/time.o
Quoted 7 lines
Quoted 4 lines
This is just an object file that hasn't been linked, but your general point stands -- LD is honored by other parts of the build.
I suppose this implies that the build only chokes on --pic-veneer when linking the VDSO, and nowhere else?
No, --pic-veneer isn't the problem for the VDSO; for better or worse LDFLAGS is ignored for the VDSO build.
Quoted 77 lines · Stefan Agner
Quoted 68 lines · Stefan Agner
Quoted 60 lines · Nathan Lynch
Quoted 19 lines · Stefan Agner
Quoted 9 lines · Nathan Lynch
Quoted 3 lines · Stefan Agner
Also, I used the BFD linker by adding LD=${CROSS_COMPILE}ld.bfd to the build command. Interestingly thought, I had the same issue when using gold linker...
When I try this, ld.gold is used regardless.
You can tell by doing and checking for a
NT_GNU_GOLD_VERSIONnote:Quoted 8 lines
$ readelf -n arch/arm/vdso/vdso.so.rawDisplaying notes found at file offset
0x000001bcwith length0x00000040:Owner Data size Description GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: f025409550acb7f955c61d95691291da078e6688Quoted 8 lines
Hm, you are right. When deleting moving ld.bfd to ld, which makes the BFD linker as default, compiling works flawless.
However, so far LD=${CROSS_COMPILE}ld.bfc seems to work for other build objects, at least those do not have this note. For instance time.o does not return anything:
$ readelf -n arch/arm/kernel/time.oThis is just an object file that hasn't been linked, but your general point stands -- LD is honored by other parts of the build.
Quoted 2 lines
So it seems to be a vdso.so.raw specific problem not using the specified linker...?
Yes, since it's produced by an invocation of $(CC) which is expected to call the linker implicitly, and this is how the toolchain's default linker ends up getting used even when you set LD on the command line.
If I'm not mistaken, implicitly performing a link through the compiler seems to be 1) conventional for all VDSOs, not just ARM's, but 2) unusual for other parts of the kernel build.
I suppose it's possible to make
arch/arm/vdso/Makefilehonor LD, but it would basically entail a rewrite. In the meantime, using -fuse-ld=bfd may suffice:arch/arm/vdso/Makefile +1
-0@@ -43,6 +43,7 @@ quiet_cmd_vdsold = VDSO $@ cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \ $(call cc-ldoption, -Wl$(comma)--build-id) \ -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ + $(call cc-option, -fuse-ld=bfd) \ -Wl,-z,common-page-size=4096 -o $@Quoted 1 line
quiet_cmd_vdsomunge= MUNGE $@Thanks Nathan, your solution looks reasonable. I figured that the option is available since GCC 4.8, so it should work probably for most toolchains which try to make use of gold linker as default.
Quoted 7 lines
Unfortunately, I hit another problem with the configuration on my build host. With your patch applied, I get:
collect2: fatal error: cannot find 'ld'
compilation terminated.
make[2]: *** [arch/arm/vdso/vdso.so.raw] Error 1
make[1]: *** [arch/arm/vdso] Error 2
make[1]: *** Waiting for unfinished jobs....
Quoted 3 lines
Sorry for the noise, it turns out when using no paths in
CROSS_COMPILEand instead add the location of the toolchain to PATH properly, this second issue is fixed.
I should have mentioned that this is the tradeoff with using -fuse-ld... the requested linker needs to be in $PATH.
So, you lose if:
1. You're using e.g. CROSS_COMPILE=/usr/local/bin/arm-linux-gnu-gcc;
2. /usr/local/bin isn't in PATH;
3. Your toolchain is configured to use gold by default;
4. And you enable CONFIG_VDSO.
I am okay with accepting this as a limitation if Russell is.
Sorry for the delay in following up on this.
Quoted 23 lines · Russell King - ARM Linux
Quoted 9 lines · Nathan Lynch
I suppose it's possible to make
arch/arm/vdso/Makefilehonor LD, but it would basically entail a rewrite. In the meantime, using -fuse-ld=bfd may suffice:arch/arm/vdso/Makefile +0
-0arch/arm/vdso/Makefile quiet_cmd_vdsold = VDSO $@ · line 47
Quoted 5 lines
arch/arm/vdso/Makefile +1
-0@@ -43,6 +43,7 @@ quiet_cmd_vdsold = VDSO $@ cmd_vdsold = $(CC) $(c_flags) -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) \ $(call cc-ldoption, -Wl$(comma)--build-id) \ -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ + $(call cc-option, -fuse-ld=bfd) \ -Wl,-z,common-page-size=4096 -o $@Would it make more sense to have something like:
VDSO_LDFLAGS := -Wl,-Bsymbolic -Wl,-z,max-page-size=4096 \ -Wl,-z,common-page-size=4096 \ $(call cc-ldoption, -Wl$(comma)--build-id) \ $(call cc-option, -fuse-ld=bfd)
Quoted 4 lines
and then have:
cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \ -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
Yes, I can see value in grouping linker directives into one variable; there are a few in ccflags-y that could be moved to VDSO_LDFLAGS as well.
Quoted 4 lines
Also, do we want to use cc-option or cc-ldoption (this question becomes obvious when you arrange the
Makefileas I have above...)? cc-option doesn't result in the linker actually being run, where as cc-ldoption does.
It's a corner case, but cc-option and cc-ldoption result in different failure modes when gold is the default linker and the bfd linker is not in $PATH:
With $(call cc-option, -fuse-ld=bfd):
VDSO arch/arm/vdso/vdso.so.raw
collect2: fatal error: cannot find 'ld'
With $(call cc-ldoption, -fuse-ld=bfd):
VDSO arch/arm/vdso/vdso.so.raw HOSTCC arch/arm/vdso/vdsomunge MUNGE arch/arm/vdso/vdso.so.dbg
OBJCOPY arch/arm/vdso/vdso.so
BFD: arch/arm/vdso/vdso.so: Not enough room for program headers, try linking with -N
That is, since using cc-ldoption invokes the linker, and the bfd linker isn't found, -fuse-ld=bfd is omitted from the command and gold gets run, resulting in the same symptom as the report that started this thread.
I think the first one gives more of a clue as to what the user can do to remedy the situation, so that's what I'd slightly prefer.