This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH gold/6584]] Bad gzip magic number on boot of x86_64 kernel
- From: Kris Van Hees <kris dot van dot hees at oracle dot com>
- To: binutils at sourceware dot org
- Cc: Ian Lance Taylor <iant at google dot com>, cryptooctoploid at gmail dot com
- Date: Thu, 5 Jun 2008 11:55:14 -0400
- Subject: [PATCH gold/6584]] Bad gzip magic number on boot of x86_64 kernel
- References: <20080529205212.GQ13586@oracle.com>
Oracle has a full copyright assignment in place with the FSF.
This patch provides a fix for ticket #6584 'kernel image decompression fails on
64bit machines (linked with gold)'. Analysis of the problem showed that the
gzip'd image was found to be 8 bytes into the .data section, whereas a kernel
linked with the old ld placed the image 4 bytes into the .data section.
Further code analysis indicated that this discrepancy is due to gold applying
a 64-bit alignment to the image as it is encapsulated as an ELF object. The
old linker uses an 8-bit alignment for the .data section of ELF encapsulated
binary data.
The patch below corrects this problem. It was generated against cvs HEAD.
With this patch the kernel decompression completes successfully, and the kernel
execution commences. My testing didn't result in a fully working system due
to other circumstances, but the testing did prove that the patch does resolve
the issue reported in this PR.
Testsuite execution has been verified to be identical between the unpatched and
the patched version. No regressions were found.
Cheers,
Kris
ChangeLog entry:
================
2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
PR 6584
* binary.cc (Binary_to_elf::sized_convert): Fix .data
alignment.
Patch:
======
Index: gold/binary.cc
===================================================================
RCS file: /cvs/src/src/gold/binary.cc,v
retrieving revision 1.2
diff -u -r1.2 binary.cc
--- gold/binary.cc 2 Apr 2008 20:58:21 -0000 1.2
+++ gold/binary.cc 5 Jun 2008 15:18:41 -0000
@@ -207,7 +207,7 @@
| elfcpp::SHF_WRITE),
data_offset,
filesize, 0, 0,
- align, 0, &pout);
+ 1, 0, &pout);
this->write_section_header<size, big_endian>(".symtab", &shstrtab,
elfcpp::SHT_SYMTAB,
0, symtab_offset, 4 * sym_size,