Commit 51b26ada authored by Linus Torvalds's avatar Linus Torvalds Committed by Ingo Molnar

x86: unify arch/x86/boot/compressed/vmlinux_*.lds

Look at the:

	diff -u arch/x86/boot/compressed/vmlinux_*.lds

output and realize that they're basially exactly the same except for
trivial naming differences, and the fact that the 64-bit version has a
"pgtable" thing.

So unify them.

There's some trivial cleanup there (make the output format a Kconfig thing
rather than doing #ifdef's for it, and unify both 32-bit and 64-bit BSS
end to "_ebss", where 32-bit used to use the traditional "_end"), but
other than that it's really very mindless and straigt conversion.

For example, I think we should aim to remove "startup_32" vs "startup_64",
and just call it "startup", and get rid of one more difference. I didn't
do that.

Also, notice the comment in the unified vmlinux.lds.S talks about
"head_64" and "startup_32" which is an odd and incorrect mix, but that was
actually what the old 64-bit only lds file had, so the confusion isn't
new, and now that mixing is arguably more accurate thanks to the
vmlinux.lds.S file being shared between the two cases ;)

[ Impact: cleanup, unification ]
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 0a3ec21f
...@@ -47,6 +47,11 @@ config X86 ...@@ -47,6 +47,11 @@ config X86
select HAVE_KERNEL_BZIP2 select HAVE_KERNEL_BZIP2
select HAVE_KERNEL_LZMA select HAVE_KERNEL_LZMA
config OUTPUT_FORMAT
string
default "elf32-i386" if X86_32
default "elf64-x86-64" if X86_64
config ARCH_DEFCONFIG config ARCH_DEFCONFIG
string string
default "arch/x86/configs/i386_defconfig" if X86_32 default "arch/x86/configs/i386_defconfig" if X86_32
......
...@@ -19,7 +19,7 @@ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ ...@@ -19,7 +19,7 @@ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
LDFLAGS := -m elf_$(UTS_MACHINE) LDFLAGS := -m elf_$(UTS_MACHINE)
LDFLAGS_vmlinux := -T LDFLAGS_vmlinux := -T
$(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE
$(call if_changed,ld) $(call if_changed,ld)
@: @:
......
...@@ -88,9 +88,9 @@ ENTRY(startup_32) ...@@ -88,9 +88,9 @@ ENTRY(startup_32)
* where decompression in place becomes safe. * where decompression in place becomes safe.
*/ */
pushl %esi pushl %esi
leal _end(%ebp), %esi leal _ebss(%ebp), %esi
leal _end(%ebx), %edi leal _ebss(%ebx), %edi
movl $(_end - startup_32), %ecx movl $(_ebss - startup_32), %ecx
std std
rep rep
movsb movsb
...@@ -121,7 +121,7 @@ relocated: ...@@ -121,7 +121,7 @@ relocated:
*/ */
xorl %eax,%eax xorl %eax,%eax
leal _edata(%ebx),%edi leal _edata(%ebx),%edi
leal _end(%ebx), %ecx leal _ebss(%ebx), %ecx
subl %edi,%ecx subl %edi,%ecx
cld cld
rep rep
......
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT)
#ifdef CONFIG_X86_64
OUTPUT_ARCH(i386:x86-64) OUTPUT_ARCH(i386:x86-64)
ENTRY(startup_64) ENTRY(startup_64)
#else
OUTPUT_ARCH(i386)
ENTRY(startup_32)
#endif
SECTIONS SECTIONS
{ {
/* Be careful parts of head_64.S assume startup_32 is at /* Be careful parts of head_64.S assume startup_32 is at
...@@ -38,11 +45,13 @@ SECTIONS ...@@ -38,11 +45,13 @@ SECTIONS
*(.bss) *(.bss)
*(.bss.*) *(.bss.*)
*(COMMON) *(COMMON)
#ifdef CONFIG_X86_64
. = ALIGN(8); . = ALIGN(8);
_end_before_pgt = . ; _end_before_pgt = . ;
. = ALIGN(4096); . = ALIGN(4096);
pgtable = . ; pgtable = . ;
. = . + 4096 * 6; . = . + 4096 * 6;
#endif
_ebss = .; _ebss = .;
} }
} }
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(startup_32)
SECTIONS
{
/* Be careful parts of head_32.S assume startup_32 is at
* address 0.
*/
. = 0;
.text.head : {
_head = . ;
*(.text.head)
_ehead = . ;
}
.rodata.compressed : {
*(.rodata.compressed)
}
.text : {
_text = .; /* Text */
*(.text)
*(.text.*)
_etext = . ;
}
.rodata : {
_rodata = . ;
*(.rodata) /* read-only data */
*(.rodata.*)
_erodata = . ;
}
.data : {
_data = . ;
*(.data)
*(.data.*)
_edata = . ;
}
.bss : {
_bss = . ;
*(.bss)
*(.bss.*)
*(COMMON)
_end = . ;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment