[PATCH] ia64: force all kernel sections into one and the same segment

Linux Kernel Mailing List <[email protected]> Fri, 02 Jul 2004 21:27:03 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1450, 2004/07/02 15:27:03-06:00, [email protected]

	[PATCH] ia64: force all kernel sections into one and the same segment
	
	Older versions of the linker do not handle cross-segment segment-relative
	relocations properly.  This becomes a real problem when the linker decides
	to put .text and .text.init into different segments (for whatever reasons)
	because in that case, broken linkers will produce a broken unwind section,
	which can cause nasty Heisenbugs, where, for example, unwinding may or may
	not work depending on the exact value of the IP in a function.
	
	[Backport of Keith Owens' 2.6 change]



 vmlinux.lds.S |    7 +++++++
 1 files changed, 7 insertions(+)


diff -Nru a/arch/ia64/vmlinux.lds.S b/arch/ia64/vmlinux.lds.S
--- a/arch/ia64/vmlinux.lds.S	2005-03-24 09:03:37 -08:00
+++ b/arch/ia64/vmlinux.lds.S	2005-03-24 09:03:37 -08:00
@@ -7,6 +7,10 @@
 OUTPUT_FORMAT("elf64-ia64-little")
 OUTPUT_ARCH(ia64)
 ENTRY(phys_start)
+PHDRS {
+  code   PT_LOAD;
+  data   PT_LOAD;
+}
 SECTIONS
 {
   /* Sections to be discarded */
@@ -23,6 +27,7 @@
   v = PAGE_OFFSET;	/* this symbol is here to make debugging easier... */
   phys_start = _start - PAGE_OFFSET;
 
+  code : { } :code
   . = KERNEL_START;
 
   _text = .;
@@ -142,6 +147,7 @@
   .kstrtab : AT(ADDR(.kstrtab) - PAGE_OFFSET)
 	{ *(.kstrtab) }
 
+  data : { } :data
   .data : AT(ADDR(.data) - PAGE_OFFSET)
 	{ *(.data) *(.gnu.linkonce.d*) CONSTRUCTORS }
 
@@ -165,6 +171,7 @@
   . = ALIGN(64 / 8);
   _end = .;
 
+  code : { } :code
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }