2005-05-01 21:24:50

by Jeff Dike

[permalink] [raw]
Subject: [PATCH 1/22] UML - Include the linker script rather than symlink it

>From Al Viro:

Make vmlinux.lds.S include appopriate script instead of playing
games with symlinks.

Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Jeff Dike <[email protected]>

Index: linux-2.6.11-mm/arch/um/Makefile
===================================================================
--- linux-2.6.11-mm.orig/arch/um/Makefile 2005-04-30 12:57:43.000000000 -0400
+++ linux-2.6.11-mm/arch/um/Makefile 2005-04-30 12:58:23.000000000 -0400
@@ -96,15 +96,11 @@

$(shell cd $(ARCH_DIR) && ln -sf Kconfig_$(SUBARCH) Kconfig_arch)

-prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
- $(ARCH_DIR)/kernel/vmlinux.lds.S
+prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)

LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib

-LD_SCRIPT-$(CONFIG_LD_SCRIPT_STATIC) := uml.lds.S
-LD_SCRIPT-$(CONFIG_LD_SCRIPT_DYN) := dyn.lds.S
-
CPP_MODE-$(CONFIG_MODE_TT) := -DMODE_TT
CONFIG_KERNEL_STACK_ORDER ?= 2
STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
@@ -145,15 +141,6 @@
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
-o -name '*.gcov' \) -type f -print | xargs rm -f

-#We need to re-preprocess this when the symlink dest changes.
-#So we touch it when needed.
-$(ARCH_DIR)/kernel/vmlinux.lds.S: FORCE
- $(Q)if [ "$(shell readlink $@)" != "$(LD_SCRIPT-y)" ]; then \
- echo ' SYMLINK $@'; \
- ln -sf $(LD_SCRIPT-y) $@; \
- touch $@; \
- fi;
-
$(SYMLINK_HEADERS):
@echo ' SYMLINK $@'
$(Q)cd $(TOPDIR)/$(dir $@) ; \
Index: linux-2.6.11-mm/arch/um/kernel/Makefile
===================================================================
--- linux-2.6.11-mm.orig/arch/um/kernel/Makefile 2005-04-30 12:57:43.000000000 -0400
+++ linux-2.6.11-mm/arch/um/kernel/Makefile 2005-04-30 12:59:28.000000000 -0400
@@ -4,7 +4,6 @@
#

extra-y := vmlinux.lds
-clean-files := vmlinux.lds.S

obj-y = checksum.o config.o exec_kern.o exitcode.o \
helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o mem_user.o \
Index: linux-2.6.11-mm/arch/um/kernel/vmlinux.lds.S
===================================================================
--- linux-2.6.11-mm.orig/arch/um/kernel/vmlinux.lds.S 2005-04-30 12:56:25.000000000 -0400
+++ linux-2.6.11-mm/arch/um/kernel/vmlinux.lds.S 2005-04-30 12:58:23.000000000 -0400
@@ -1,113 +1,6 @@
-#include <asm-generic/vmlinux.lds.h>
-
-OUTPUT_FORMAT(ELF_FORMAT)
-OUTPUT_ARCH(ELF_ARCH)
-ENTRY(_start)
-jiffies = jiffies_64;
-
-SECTIONS
-{
- /*This must contain the right address - not quite the default ELF one.*/
- PROVIDE (__executable_start = START);
- . = START + SIZEOF_HEADERS;
-
- /* Used in arch/um/kernel/mem.c. Any memory between START and __binary_start
- * is remapped.*/
- __binary_start = .;
-#ifdef MODE_TT
- .thread_private : {
- __start_thread_private = .;
- errno = .;
- . += 4;
- arch/um/kernel/tt/unmap_fin.o (.data)
- __end_thread_private = .;
- }
- . = ALIGN(4096);
- .remap : { arch/um/kernel/tt/unmap_fin.o (.text) }
-
- /* We want it only if we are in MODE_TT. In both cases, however, when MODE_TT
- * is off the resulting binary segfaults.*/
-
- . = ALIGN(4096); /* Init code and data */
+#include <linux/config.h>
+#ifdef CONFIG_LD_SCRIPT_STATIC
+#include "uml.lds.S"
+#else
+#include "dyn.lds.S"
#endif
-
- _stext = .;
- __init_begin = .;
- .init.text : {
- _sinittext = .;
- *(.init.text)
- _einittext = .;
- }
- . = ALIGN(4096);
-
- .text :
- {
- *(.text)
- SCHED_TEXT
- LOCK_TEXT
- *(.fixup)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- *(.gnu.linkonce.t*)
-
- . = ALIGN(4096);
- __syscall_stub_start = .;
- *(.__syscall_stub*)
- __syscall_stub_end = .;
- . = ALIGN(4096);
- }
-
- #include "asm/common.lds.S"
-
- init.data : { *(init.data) }
- .data :
- {
- . = ALIGN(KERNEL_STACK_SIZE); /* init_task */
- *(.data.init_task)
- *(.data)
- *(.gnu.linkonce.d*)
- CONSTRUCTORS
- }
- .data1 : { *(.data1) }
- .ctors :
- {
- *(.ctors)
- }
- .dtors :
- {
- *(.dtors)
- }
-
- .got : { *(.got.plt) *(.got) }
- .dynamic : { *(.dynamic) }
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata : { *(.sdata) }
- _edata = .;
- PROVIDE (edata = .);
- . = ALIGN(0x1000);
- .sbss :
- {
- __bss_start = .;
- PROVIDE(_bss_start = .);
- *(.sbss)
- *(.scommon)
- }
- .bss :
- {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
-}


2005-05-03 00:06:40

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/22] UML - Include the linker script rather than symlink it

Jeff Dike <[email protected]> wrote:
>
> >From Al Viro:
>
> Make vmlinux.lds.S include appopriate script instead of playing
> games with symlinks.
>
> Signed-off-by: Al Viro <[email protected]>
> Signed-off-by: Jeff Dike <[email protected]>

Confused.

> Index: linux-2.6.11-mm/arch/um/kernel/vmlinux.lds.S
> ===================================================================
> --- linux-2.6.11-mm.orig/arch/um/kernel/vmlinux.lds.S 2005-04-30 12:56:25.000000000 -0400
> +++ linux-2.6.11-mm/arch/um/kernel/vmlinux.lds.S 2005-04-30 12:58:23.000000000 -0400
> @@ -1,113 +1,6 @@

That file doesn't exist and I think this patch doesn't want to patch it
anyway.

I'll just drop the vmlinux.lds.S chunk...

2005-05-03 00:24:59

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH 1/22] UML - Include the linker script rather than symlink it

On Mon, May 02, 2005 at 05:06:54PM -0700, Andrew Morton wrote:
> That file doesn't exist and I think this patch doesn't want to patch it
> anyway.
>
> I'll just drop the vmlinux.lds.S chunk...

Correct patch is on ftp.linux.org.uk/pub/people/viro/UM0-uml-ldscript-RC12-rc3

Short version of the story: current tree plays with a symlink from
vmlinux.lds.S to one of two files, depending on the config. That doesn't
work well and confused vmlinux.lds.S chunk is actually a demonstration of
breakage - symlink had not been properly cleaned up.

New variant has _fixed_ vmlinux.lds.S - real file with
#include <linux/config.h>
#ifdef CONFIG_LD_SCRIPT_STATIC
#include "uml.lds.S"
#else
#include "dyn.lds.S"
#endif
in it and no symlink magic in makefiles. Since we feed it through cpp
anyway, we can simply let cpp do all work - including picking the right
script depending on config.

2005-05-03 00:43:49

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/22] UML - Include the linker script rather than symlink it

Al Viro <[email protected]> wrote:
>
> On Mon, May 02, 2005 at 05:06:54PM -0700, Andrew Morton wrote:
> > That file doesn't exist and I think this patch doesn't want to patch it
> > anyway.
> >
> > I'll just drop the vmlinux.lds.S chunk...
>
> Correct patch is on ftp.linux.org.uk/pub/people/viro/UM0-uml-ldscript-RC12-rc3

OK...

There's a bit of a tangle going on in arch/um/kernel/Makefile, but it's
fairly simple stuff.

I put a rolled-up patch against 2.6.12-rc3 at
http://www.zip.com.au/~akpm/linux/patches/stuff/x.bz2 if someone wants to
check it all.

Is this all considered post-2.6.12 material?

2005-05-03 01:17:22

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH 1/22] UML - Include the linker script rather than symlink it

On Mon, May 02, 2005 at 05:44:05PM -0700, Andrew Morton wrote:
>
> There's a bit of a tangle going on in arch/um/kernel/Makefile, but it's
> fairly simple stuff.
>
> I put a rolled-up patch against 2.6.12-rc3 at
> http://www.zip.com.au/~akpm/linux/patches/stuff/x.bz2 if someone wants to
> check it all.

Broken, due to missing mk_sc patch (it should go before mk_thread one;
how the hell did the latter manage to apply at all?)

> Is this all considered post-2.6.12 material?

Once all patches are in there - up to Jeff ;-) Seriously, kbuild patchkit
is decently tested and has obviously no impact on other architectures. So
that one is up to maintainer of architecture in question...

2005-05-03 01:29:35

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/22] UML - Include the linker script rather than symlink it

Al Viro <[email protected]> wrote:
>
> On Mon, May 02, 2005 at 05:44:05PM -0700, Andrew Morton wrote:
> >
> > There's a bit of a tangle going on in arch/um/kernel/Makefile, but it's
> > fairly simple stuff.
> >
> > I put a rolled-up patch against 2.6.12-rc3 at
> > http://www.zip.com.au/~akpm/linux/patches/stuff/x.bz2 if someone wants to
> > check it all.
>
> Broken, due to missing mk_sc patch (it should go before mk_thread one;

OK. I ended up with an odd-looking arch/um/sys-x86_64/util/Makefile:



# Copyright 2003 - 2004 Pathscale, Inc
# Released under the GPL

hostprogs-y := mk_sc mk_thread
always := $(hostprogs-y)

HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um


Is mk_sc still supposed to be in there?

> how the hell did the latter manage to apply at all?)

I just "fixed" things. I do it all the time.

> > Is this all considered post-2.6.12 material?
>
> Once all patches are in there - up to Jeff ;-) Seriously, kbuild patchkit
> is decently tested and has obviously no impact on other architectures. So
> that one is up to maintainer of architecture in question...

OK..

2005-05-03 01:45:28

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH 1/22] UML - Include the linker script rather than symlink it

On Mon, May 02, 2005 at 06:28:51PM -0700, Andrew Morton wrote:
> # Copyright 2003 - 2004 Pathscale, Inc
> # Released under the GPL
>
> hostprogs-y := mk_sc mk_thread
> always := $(hostprogs-y)
>
> HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um

> Is mk_sc still supposed to be in there?

Yes, along with hostflags for it.

> > how the hell did the latter manage to apply at all?)
>
> I just "fixed" things. I do it all the time.

Erm... "Gives rejects" => "ought to investigate" => "bugger it, let
submitter figure it out and resubmit" would be an obvious progression...

OK. Please, pick the following patches:
UM0-uml-ldscript-RC12-rc3
UM1-uml-os-RC12-rc3
UM2-uml-user-constants-RC12-rc3
UM3-uml-ptregs-RC12-rc3
UM4-uml-sc-RC12-rc3
UM5-uml-kernel-offsets-RC12-rc3
UM6-uml-thread-RC12-rc3
UM7-uml-util-RC12-rc3
UM8-uml-clean-RC12-rc3
UM10-uml-O-RC12-rc3
in ftp.linux.org.uk/pub/people/viro. In the order above. That's where
the beginning of Jeff's series had come from (his 1--9 and 4.5).

(In case if you wonder about UM9, that one already has an equivalent in
-mm).


2005-05-03 02:03:33

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 1/22] UML - Include the linker script rather than symlink it

Al Viro <[email protected]> wrote:
>
> On Mon, May 02, 2005 at 06:28:51PM -0700, Andrew Morton wrote:
> > # Copyright 2003 - 2004 Pathscale, Inc
> > # Released under the GPL
> >
> > hostprogs-y := mk_sc mk_thread
> > always := $(hostprogs-y)
> >
> > HOSTCFLAGS_mk_thread.o := -I$(objtree)/arch/um
>
> > Is mk_sc still supposed to be in there?
>
> Yes, along with hostflags for it.

Ah, OK.

> > > how the hell did the latter manage to apply at all?)
> >
> > I just "fixed" things. I do it all the time.
>
> Erm... "Gives rejects" => "ought to investigate" => "bugger it, let
> submitter figure it out and resubmit" would be an obvious progression...

Sometimes. Most of the time it's less work (and much less latency) just to
fix stuff up.

> OK. Please, pick the following patches:
> UM0-uml-ldscript-RC12-rc3
> UM1-uml-os-RC12-rc3
> UM2-uml-user-constants-RC12-rc3
> UM3-uml-ptregs-RC12-rc3
> UM4-uml-sc-RC12-rc3
> UM5-uml-kernel-offsets-RC12-rc3
> UM6-uml-thread-RC12-rc3
> UM7-uml-util-RC12-rc3
> UM8-uml-clean-RC12-rc3
> UM10-uml-O-RC12-rc3
> in ftp.linux.org.uk/pub/people/viro. In the order above. That's where
> the beginning of Jeff's series had come from (his 1--9 and 4.5).

OK, did that. Had one reject against
uml-kbuild-avoid-useless-rebuilds.patch, but 'twas easily fixed.

2005-05-03 12:55:56

by Jeff Dike

[permalink] [raw]
Subject: Re: [PATCH 1/22] UML - Include the linker script rather than symlink it

On Mon, May 02, 2005 at 07:02:50PM -0700, Andrew Morton wrote:
> OK, did that. Had one reject against
> uml-kbuild-avoid-useless-rebuilds.patch, but 'twas easily fixed.

Thanks. Sorry about the hassle. The vmlinux.lds botch was a symptom of
the problem Al was fixing (the uncleaned symlink in my tree causing a reject
in a clean tree), and the missing mk_sc patch was just an oversight on my
part.

Jeff