Skip to contentSkip to conversation

binutils doesn't like -elf2flt option

Buildroot Adam Nielsen 3 participants 14 messages Jun 15, 2013 – Jun 20, 2013

lore
Share & tools
lore
#0 lore raw

Hi all,

I'm trying to compile a toolchain with elf2flt enabled, but I'm having problems getting binutils to compile.

Normally the parameter "-W,-elf2flt" is passed to GCC to tell it to pass "-elf2flt" to the linker. elf2flt then picks this up and does what it needs to, courtesy of a wrapper script around "ld". I have set this parameter in TARGET_CFLAGS in one of the buildroot makefiles.

However when I am compiling binutils, it seems that elf2flt has not been installed yet, so it is not recognising the -elf2flt option, and gives me this error:

arm-buildroot-linux-uclibcgnueabi-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Os -Wl,-elf2flt
-DBR_BINFMT_FLAT --static -Wl,-rpath -Wl,/foo conftest.c >&5
arm-buildroot-linux-uclibcgnueabi/bin/ld: warning: cannot find entry symbol lf2flt; defaulting to 00000000000080c0

I think binutils needs to use elf2flt, otherwise any binaries it produces will not be in BFLT format, so I am guessing I need to tell buildroot to compile elf2flt before binutils. Does this sound correct? Is it even possible to compile something like that before binutils? Or do I have to somehow avoid passing the -elf2flt parameter to binutils? How might one achieve this?

Many thanks,
Adam.

#1 lore raw

Dear Adam Nielsen,

Quoted 4 lines · Adam Nielsen

I'm trying to compile a toolchain with elf2flt enabled, but I'm having problems getting binutils to compile.

Normally the parameter "-W,-elf2flt" is passed to GCC to tell it to pass

Should be -Wl,-elf2flt, but you got it correct in the log below, so I guess this one was just a typo.

Quoted 14 lines

"-elf2flt" to the linker. elf2flt then picks this up and does what it needs to, courtesy of a wrapper script around "ld". I have set this parameter in TARGET_CFLAGS in one of the buildroot makefiles.

However when I am compiling binutils, it seems that elf2flt has not been installed yet, so it is not recognising the -elf2flt option, and gives me this error:

arm-buildroot-linux-uclibcgnueabi-gcc -o conftest -D_LARGEFILE_SOURCE

(quoted diff) +0 -2
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -Os  -Wl,-elf2flt 
-DBR_BINFMT_FLAT   --static -Wl,-rpath -Wl,/foo conftest.c  >&5

arm-buildroot-linux-uclibcgnueabi/bin/ld: warning: cannot find entry symbol lf2flt; defaulting to 00000000000080c0

Quoted 5 lines

I think binutils needs to use elf2flt, otherwise any binaries it produces will not be in BFLT format, so I am guessing I need to tell buildroot to compile elf2flt before binutils. Does this sound correct? Is it even possible to compile something like that before binutils? Or do I have to somehow avoid passing the -elf2flt parameter to binutils? How might one achieve this?

Are we talking about the cross binutils (i.e the one that runs on your development PC and generates code for your target platform), or the target binutils (i.e the one that runs on your target platform and generates code for your target platform) ?

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw
In reply to Adam Nielsen
Quoted 20 lines · Adam Nielsen

Hi all,

I'm trying to compile a toolchain with elf2flt enabled, but I'm having problems getting binutils to compile.

Normally the parameter "-W,-elf2flt" is passed to GCC to tell it to pass "-elf2flt" to the linker. elf2flt then picks this up and does what it needs to, courtesy of a wrapper script around "ld". I have set this parameter in TARGET_CFLAGS in one of the buildroot makefiles.

However when I am compiling binutils, it seems that elf2flt has not been installed yet, so it is not recognising the -elf2flt option, and gives me this error:

arm-buildroot-linux-uclibcgnueabi-gcc -o conftest -D_LARGEFILE_SOURCE

(quoted diff) +0 -2
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -Os  -Wl,-elf2flt
-DBR_BINFMT_FLAT   --static -Wl,-rpath -Wl,/foo conftest.c  >&5

arm-buildroot-linux-uclibcgnueabi/bin/ld: warning: cannot find entry symbol lf2flt; defaulting to 00000000000080c0

Quoted 6 lines

I think binutils needs to use elf2flt, otherwise any binaries it produces will not be in BFLT format, so I am guessing I need to tell buildroot to compile elf2flt before binutils. Does this sound correct? Is it even possible to compile something like that before binutils? Or do I have to somehow avoid passing the -elf2flt parameter to binutils? How might one achieve this?

elf2flt already depends on binutils (it uses libbfd), so this won't
work. And as Thomas mentioned, this is only relevant for target-binutils (which you probably don't even need).

However, it looks like there is no explicit dependency on elf2flt when
building the toolchain. Probably elf2flt should be added to BASE_TARGETS, to make sure it gets built before all the rest.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw
Quoted 4 lines · Thomas Petazzoni

Are we talking about the cross binutils (i.e the one that runs on your development PC and generates code for your target platform), or the target binutils (i.e the one that runs on your target platform and generates code for your target platform) ?

I'm not entirely sure. I can run "make binutils" to cause the error, so I'm assuming it must be target binutils. But then that doesn't make sense, because I have not configured buildroot to compile binutils for my target platform (BR2_PACKAGE_BINUTILS=n).

There is a file buildroot/build/host-binutils-2.23.2/.stamp_built so I am guessing that means the cross binutils worked. So I am not sure why it is trying to compile target binutils?

Here's my buildroot config if it helps:
<http://www.shikadi.net/files/buildroot/2013-06-17.br.binutils_elf2flt_err.config>

Be warned there are a couple of new options in there I have added myself.

Quoted 3 lines · Arnout Vandecappelle

elf2flt already depends on binutils (it uses libbfd), so this won't work.
And as Thomas mentioned, this is only relevant for target-binutils (which you probably don't even need).

Hmm yes, since I'm not producing BFLT binaries (as they will run on the host) I can see that I should not be specifying these options. However since the host/cross binutils builds successfully, it seems that part is working.

Quoted 3 lines

However, it looks like there is no explicit dependency on elf2flt when
building the toolchain. Probably elf2flt should be added to BASE_TARGETS, to make sure it gets built before all the rest.

Would this mean elf2flt gets built before the target binutils, should I choose to enable it? I am guessing that is what needs to happen for this to work correctly, assuming target binutils should be built.

Many thanks,
Adam.

#4 lore raw
Quoted 10 lines · Adam Nielsen
Quoted 4 lines · Thomas Petazzoni

Are we talking about the cross binutils (i.e the one that runs on your development PC and generates code for your target platform), or the target binutils (i.e the one that runs on your target platform and generates code for your target platform) ?

I'm not entirely sure. I can run "make binutils" to cause the error, so I'm assuming it must be target binutils. But then that doesn't make sense, because I have not configured buildroot to compile binutils for my target platform (BR2_PACKAGE_BINUTILS=n).

If you explicitly ask to build binutils (for the target), then the
value of BR2_PACKAGE_BINUTILS is ignored. So 'make binutils' tries to build binutils for the target.

Quoted 22 lines

There is a file buildroot/build/host-binutils-2.23.2/.stamp_built so I am guessing that means the cross binutils worked. So I am not sure why it is trying to compile target binutils?

Here's my buildroot config if it helps:
<http://www.shikadi.net/files/buildroot/2013-06-17.br.binutils_elf2flt_err.config>

Be warned there are a couple of new options in there I have added myself.

Quoted 5 lines · Arnout Vandecappelle

elf2flt already depends on binutils (it uses libbfd), so this won't
work.
And as Thomas mentioned, this is only relevant for target-binutils (which you
probably don't even need).

Hmm yes, since I'm not producing BFLT binaries (as they will run on the host) I can see that I should not be specifying these options. However since the host/cross binutils builds successfully, it seems that part is working.

Quoted 8 lines
Quoted 4 lines

However, it looks like there is no explicit dependency on elf2flt when
building the toolchain. Probably elf2flt should be added to BASE_TARGETS, to
make sure it gets built before all the rest.

Would this mean elf2flt gets built before the target binutils, should I choose to enable it? I am guessing that is what needs to happen for this to work correctly, assuming target binutils should be built.

host-elf2flt is built before binutils, yes. (Note that host-elf2flt
will actually be called elf2flt without the host because it has not been converted to the generic package infrastructure; it's also in the toolchain directory rather than the build directory.)

Regards,
Arnout

Quoted 10 lines

Many thanks,
Adam.

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw
Quoted 3 lines

If you explicitly ask to build binutils (for the target), then the value of
BR2_PACKAGE_BINUTILS is ignored. So 'make binutils' tries to build binutils for the target.

Sorry, to clarify - I get the error running just "make", but if I want to experiment by changing build flags, I can run "make binutils" to skip recompiling gcc, uclibc, etc. and just attempt the bit that recently failed.

This is just a timesaver when testing though, the real problem is that I still get these errors from the target binutils when running "make".

Thanks,
Adam.

#6 lore raw

Dear Adam Nielsen,

Quoted 3 lines · Adam Nielsen

Sorry, to clarify - I get the error running just "make", but if I want to experiment by changing build flags, I can run "make binutils" to skip recompiling gcc, uclibc, etc. and just attempt the bit that recently failed.

I believe you're still confusing the target binutils (which gets built when you run "make binutils") with the cross binutils (which gets built together with gcc, uclibc as part of the cross-compilation toolchain, this one can be rebuilt explicitly by doing "make host-binutils").

Quoted 2 lines

This is just a timesaver when testing though, the real problem is that I still get these errors from the target binutils when running "make".

Do you need the target binutils? If you need BFLT support, your target system has no MMU, so is probably a bit memory limited, so what would you need to have binutils on your target on a small system?

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#7 lore raw
Quoted 8 lines
Quoted 3 lines

Sorry, to clarify - I get the error running just "make", but if I want to experiment by changing build flags, I can run "make binutils" to skip recompiling gcc, uclibc, etc. and just attempt the bit that recently failed.

I believe you're still confusing the target binutils (which gets built when you run "make binutils") with the cross binutils (which gets built together with gcc, uclibc as part of the cross-compilation toolchain, this one can be rebuilt explicitly by doing "make host-binutils").

That's possible, but I don't believe so. I understand that "make binutils" will compile the target binutils. But when I just run "make" it successfully builds the host binutils, then continues on to build the target binutils, where it fails. So I was just running "make binutils" as a quick way of recompiling the target binutils while I was trying to figure out a way around the problem. I now realise that the problem is this package (target binutils) shouldn't be being built at all, so you can probably forget my comment about "make binutils" now :-)

Quoted 3 lines

Do you need the target binutils? If you need BFLT support, your target system has no MMU, so is probably a bit memory limited, so what would you need to have binutils on your target on a small system?

No I don't want the target binutils, but I don't seem to be able to disable it. It's deselected in the buildroot config, but it still seems to be getting compiled. How would I go about working out why? I'm not sure how to debug all the make dependencies.

Thanks,
Adam.

#8 lore raw

Dear Adam Nielsen,

Quoted 4 lines · Adam Nielsen

No I don't want the target binutils, but I don't seem to be able to disable it. It's deselected in the buildroot config, but it still seems to be getting compiled. How would I go about working out why? I'm not sure how to debug all the make dependencies.

./support/script/graph-depends > dependencies.dot
dot -Tpdf -o dependencies.pdf dependencies.dot
<Your Preferred PDF Viewer> dependencies.pdf

and check what is pointing to "binutils". The "dot" command is part of the "graphviz" package in most distributions.

Another solution is to pastebin your full .config file somewhere and give us the link, we may be able to point what's triggering the target binutils build.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#9 lore raw
Quoted 8 lines
Quoted 4 lines

No I don't want the target binutils, but I don't seem to be able to disable it. It's deselected in the buildroot config, but it still seems to be getting compiled. How would I go about working out why? I'm not sure how to debug all the make dependencies.

./support/script/graph-depends > dependencies.dot
dot -Tpdf -o dependencies.pdf dependencies.dot
<Your Preferred PDF Viewer> dependencies.pdf

Do I need to do anything special since I am using "make O=..." to keep the output separate from the buildroot git repo? I get this when I run it in the buildroot git folder:

$ ./support/scripts/graph-depends > dep.dot
   File "./support/scripts/graph-depends", line 40
     print "Usage: graph-depends [package-name]"
                                               ^
SyntaxError: invalid syntax
$ python2 ./support/scripts/graph-depends > dep.dot
Getting targets
Traceback (most recent call last):
   File "./support/scripts/graph-depends", line 184, in <module>
     for tg in targets:
TypeError: 'NoneType' object is not iterable

And if I run it in my output folder:

$ python2 ../../../buildroot/support/scripts/graph-depends > dep.dot
Getting targets
Getting dependencies for ['elf2flt', 'ncurses', 'zlib', 'nano', 'busybox', 
'linux', 'rootfs-romfs', 'rootfs-tar', 'rootfs-cpio', 'rootfs-initramfs', 
'rootfs-squashfs']
Error getting dependencies ['elf2flt', 'ncurses', 'zlib', 'nano', 'busybox', 
'linux', 'rootfs-romfs', 'rootfs-tar', 'rootfs-cpio', 'rootfs-initramfs', 
'rootfs-squashfs']

So I'm not sure whether I need to do something differently?

Quoted 3 lines

Another solution is to pastebin your full .config file somewhere and give us the link, we may be able to point what's triggering the target binutils build.

Here's the link I posted earlier:
<http://www.shikadi.net/files/buildroot/2013-06-17.br.binutils_elf2flt_err.config>
but be aware I have made a few changes to buildroot itself (added a few new config options), but none that I am aware of that would affect binutils.

Many thanks,
Adam.

#10 lore raw

Dear Adam Nielsen,

Quoted 1 line · Adam Nielsen
$ python2 ../../../buildroot/support/scripts/graph-depends > dep.dot

This one is correct.

Quoted 9 lines

Getting targets
Getting dependencies for ['elf2flt', 'ncurses', 'zlib', 'nano', 'busybox', 'linux', 'rootfs-romfs', 'rootfs-tar', 'rootfs-cpio', 'rootfs-initramfs', 'rootfs-squashfs']
Error getting dependencies ['elf2flt', 'ncurses', 'zlib', 'nano', 'busybox', 'linux', 'rootfs-romfs', 'rootfs-tar', 'rootfs-cpio', 'rootfs-initramfs', 'rootfs-squashfs']

So I'm not sure whether I need to do something differently?

What does the output PDF looks like?

Quoted 8 lines
Quoted 3 lines

Another solution is to pastebin your full .config file somewhere and give us the link, we may be able to point what's triggering the target binutils build.

Here's the link I posted earlier:
<http://www.shikadi.net/files/buildroot/2013-06-17.br.binutils_elf2flt_err.config>
but be aware I have made a few changes to buildroot itself (added a few new config options), but none that I am aware of that would affect binutils.

Ok, thanks.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#11 lore raw
Quoted 3 lines
Quoted 1 line
$ python2 ../../../buildroot/support/scripts/graph-depends > dep.dot

This one is correct.

Great, thanks!

Quoted 11 lines
Quoted 9 lines

Getting targets
Getting dependencies for ['elf2flt', 'ncurses', 'zlib', 'nano', 'busybox', 'linux', 'rootfs-romfs', 'rootfs-tar', 'rootfs-cpio', 'rootfs-initramfs', 'rootfs-squashfs']
Error getting dependencies ['elf2flt', 'ncurses', 'zlib', 'nano', 'busybox', 'linux', 'rootfs-romfs', 'rootfs-tar', 'rootfs-cpio', 'rootfs-initramfs', 'rootfs-squashfs']

So I'm not sure whether I need to do something differently?

What does the output PDF looks like?

I can't generate the PDF, the dep.dot file is zero bytes. I'm guessing graph-depends gives up when it reports that error message.

Thanks,
Adam.

#12 lore raw

Dear Adam Nielsen,

Quoted 8 lines · Adam Nielsen
Quoted 8 lines
Quoted 8 lines

Getting targets
Getting dependencies for ['elf2flt', 'ncurses', 'zlib', 'nano', 'busybox', 'linux', 'rootfs-romfs', 'rootfs-tar', 'rootfs-cpio', 'rootfs-initramfs', 'rootfs-squashfs']
Error getting dependencies ['elf2flt', 'ncurses', 'zlib', 'nano', 'busybox', 'linux', 'rootfs-romfs', 'rootfs-tar', 'rootfs-cpio', 'rootfs-initramfs', 'rootfs-squashfs']

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

So I'm not sure whether I need to do something differently?

What does the output PDF looks like?

I can't generate the PDF, the dep.dot file is zero bytes. I'm guessing graph-depends gives up when it reports that error message.

Ah, right, elf2flt isn't a real package, so it fails.

Can you push your current Buildroot code on some Git repository so that we can have a look? I looked at your configuration, and I really don't see what could be pulling the target binutils into the build.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#13 lore raw
Quoted 5 lines

Ah, right, elf2flt isn't a real package, so it fails.

Can you push your current Buildroot code on some Git repository so that we can have a look? I looked at your configuration, and I really don't see what could be pulling the target binutils into the build.

Sure, you can get it from here:

https://github.com/Malvineous/buildroot-openipcam

Make sure to use the 'nuc700' branch. Many thanks for taking a look!

Cheers,
Adam.