Bug 2464 - [2.16.1 regression] ld produces unusable elilo.efi executable
Summary: [2.16.1 regression] ld produces unusable elilo.efi executable
Status: RESOLVED WORKSFORME
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.17
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on: 1487
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-15 23:10 UTC by Matthias Klose
Modified: 2006-03-20 00:23 UTC (History)
3 users (show)

See Also:
Host: i386-linux
Target:
Build:
Last reconfirmed:


Attachments
A patch for gnu-efi 3.0b (354 bytes, patch)
2006-03-17 20:11 UTC, H.J. Lu
Details | Diff
A patch for elilo 3.6 (526 bytes, patch)
2006-03-17 20:13 UTC, H.J. Lu
Details | Diff
An updated patch for gnu-efi 3.0b (378 bytes, patch)
2006-03-17 21:40 UTC, H.J. Lu
Details | Diff
A modified patch for gnu-efi 3.0b (377 bytes, patch)
2006-03-17 21:50 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2006-03-15 23:10:20 UTC
current HEAD (20060315) produces an unusable elilo.efi executable (elilo-3.6)
objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j
.reloc --target=efi-app-ia32 elilo.so elilo.efi

Before the patch in PR/1487, that gave a binary that ran. Afterwards, it gives a
binary that fails to run.

Binaries are available at http://www.codon.org.uk/~mjg59/tmp/efi/
Comment 1 H.J. Lu 2006-03-16 22:08:42 UTC
Please provide a working elilo.so.
Comment 2 H.J. Lu 2006-03-16 23:09:47 UTC
Please also tell me which version of binutils works.
Comment 3 H.J. Lu 2006-03-16 23:22:09 UTC
I couldn't even get simple EFI applications in gnu-efi 3.0a to work on
IA32 with various versions of gcc and binutils.
Comment 4 H.J. Lu 2006-03-17 02:36:55 UTC
I can use gcc 2.96 from RH 7.3 and the Linux binutils 2.13.90.0.4 to
generate working EFI applications.
Comment 5 Matthew Garrett 2006-03-17 02:49:54 UTC
gnu-efi 3.0a is incompatible with gcc 4, to the best of my knowledge. Using
gcc-4.0 with -march=i386 and binutils before 2005-10-23 I can build working
elilo binaries. After that date (to be precise, the patch to fix PR/1487) I
can't. I'll try to get an elilo.so from a working build and attach it.
Comment 6 H.J. Lu 2006-03-17 03:16:19 UTC
I don't need elilo.so since I can generate working EFI applications. We have 2
problems here, gcc and binutils. Which gcc can be used for gnu-efi? I know gcc
2.96 works and gcc 3.2 doesn't work. How about gcc 3.4 and gcc 4.1?
Comment 7 Matthew Garrett 2006-03-17 03:43:47 UTC
gcc-4.0.3 appears to work with gnu-efi 3.0b. I'm using the tarball and diff from
http://ftp.uk.debian.org/debian/pool/main/g/gnu-efi/ .
Comment 8 H.J. Lu 2006-03-17 03:52:46 UTC
What was the date of last working binutils, which I can use to check out
from binutils CVS mainline with

# cvs co -D "xxxxx"
Comment 9 Matthew Garrett 2006-03-17 03:59:54 UTC
2005-10-24 is broken, but narrowing it down further (based on the times) the
patch you committed for that (dated the 23rd, but appeared on the 24th judging
by CVS timstamps) is the turning point - before that, I get working binaries,
and afterwards I get broken ones.
Comment 10 H.J. Lu 2006-03-17 05:31:58 UTC
Do you have a list of known working/non-working gcc versions?
Comment 11 Matthew Garrett 2006-03-17 13:53:56 UTC
Every gcc version I've tested works, providing I use -march=i386.
Comment 12 H.J. Lu 2006-03-17 16:59:14 UTC
I tried -march=i386 with gcc version 4.0.3 20060213 and gcc version 3.4.6 20060301 
using binutils 2.16.91 20051023. I couldn't get a working EFI application.
Comment 13 Matthew Garrett 2006-03-17 17:09:37 UTC
Which version of gnu-efi are you using?
Comment 14 H.J. Lu 2006-03-17 17:13:31 UTC
gnu-efi 3.0b works with gcc 3.4, 4.0 and 4.1.
Comment 15 Matthew Garrett 2006-03-17 17:17:20 UTC
Sorry, I'm not entirely clear on that - you're using gnu-efi 3.0b? I had to
build that with -march=i386 as well, but once I had done had no problem in
building elilo with older binutils (regardless of gcc version). 486 instructions
appear to make some EFI implementations unhappy.
Comment 16 H.J. Lu 2006-03-17 20:11:37 UTC
Created attachment 927 [details]
A patch for gnu-efi 3.0b

The bug is in the linker scripts in gnu-efi 3.0b. With this patch, there is
no need to use -march=i386. The current binutils and gcc should work correctly
for both ia32 and i64.
Comment 17 H.J. Lu 2006-03-17 20:13:10 UTC
Created attachment 928 [details]
A patch for elilo 3.6

The comments in elilo 3.6 about gcc versions for ia32 are misleading. This
patch removes them.
Comment 18 H.J. Lu 2006-03-17 20:13:46 UTC
The problem is in gnu-efi 3.0b, not binutils.
Comment 19 Matthew Garrett 2006-03-17 20:46:37 UTC
Hmm. I still appear to need -march=i386, but other than that can build
successfully. Thanks!
Comment 20 H.J. Lu 2006-03-17 21:00:53 UTC
Which gcc are you using? -march=i386 shouldn't be needed.
Comment 21 Matthew Garrett 2006-03-17 21:21:06 UTC
gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu1)

It defaults to targetting i486.
Comment 22 H.J. Lu 2006-03-17 21:40:05 UTC
Created attachment 929 [details]
An updated patch for gnu-efi 3.0b

This new patch should work for gcc 4.0.3.
Comment 23 H.J. Lu 2006-03-17 21:50:19 UTC
Created attachment 930 [details]
A modified patch for gnu-efi 3.0b

This patch makes linker script similar to normal linker.
Comment 24 Matthew Garrett 2006-03-20 00:23:06 UTC
That appears to be perfect. Thanks!