This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH gold/6584]] Bad gzip magic number on boot of x86_64 kernel


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,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]