bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #34539] 1.99: grub2 built with gold linker doesn't even start


From: Mike Frysinger
Subject: [bug #34539] 1.99: grub2 built with gold linker doesn't even start
Date: Mon, 22 Oct 2012 04:33:25 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1290.1 Safari/537.13

Follow-up Comment #2, bug #34539 (project grub):

i think the latest comment contains typos.  gold will use the wrong address if
you specify "-Wl,-Ttext,8200" (namely, it'll use 0x2008 and not 0x8200).  it
will work fine if you prefix the address with a hex value like
"-Wl,-Ttext,0x8200".

$ gcc -o 1.img -ffreestanding -Wl,-Ttext,8200 1.S -nostdlib -m32
$ readelf -S 1.img | grep text
  [ 1] .text             PROGBITS        00002008 001008 000000 00  AX  0   0 
4
$ gcc -o 1.img -ffreestanding -Wl,-Ttext,0x8200 1.S -nostdlib -m32
$ readelf -S 1.img | grep text
  [ 1] .text             PROGBITS        00008200 000200 000000 00  AX  0   0 
4

upstream bug:
http://sourceware.org/bugzilla/show_bug.cgi?id=14187

it's trivial to workaround in grub2: add a 0x prefix to addresses with the
-Ttext flag.  a quick grep shows at least:
configure.ac:      CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}
${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100"

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34539>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]