]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
unicore32: simplify linker script generation for decompressor
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 8 Mar 2019 05:30:35 +0000 (14:30 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 13 Mar 2019 17:39:11 +0000 (02:39 +0900)
When I was searching for unneeded $(KCONFIG_CONFIG) usages, I noticed
this strange build dependency.

It can use $(call if_changed,...) in case ZTEXTADDR and ZBSSADDR are
changed, but even a simpler way is to use the pattern rule in
scripts/Makefile.build. This is what arch/arm/boot/compressed/Makefile
does.

I did only build test. I confirmed equivalent vmlinux.lds was generated.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/unicore32/boot/compressed/Makefile
arch/unicore32/boot/compressed/vmlinux.lds.S [new file with mode: 0644]
arch/unicore32/boot/compressed/vmlinux.lds.in [deleted file]

index 9aecdd3ddc4828242b7387061c71447cb44082e4..150fafc32fb080f8b46ec2ba547f502cefe186b0 100644 (file)
@@ -61,7 +61,4 @@ $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head.o $(obj)/piggy.o \
 ZTEXTADDR      := 0x03000000
 ZBSSADDR       := ALIGN(4)
 
-SEDFLAGS_lds   = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
-$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/unicore32/boot/Makefile $(KCONFIG_CONFIG)
-       @sed "$(SEDFLAGS_lds)" < $< > $@
-
+CPPFLAGS_vmlinux.lds = -DTEXT_START="$(ZTEXTADDR)" -DBSS_START="$(ZBSSADDR)"
diff --git a/arch/unicore32/boot/compressed/vmlinux.lds.S b/arch/unicore32/boot/compressed/vmlinux.lds.S
new file mode 100644 (file)
index 0000000..d5a3ce2
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * linux/arch/unicore/boot/compressed/vmlinux.lds.in
+ *
+ * Code specific to PKUnity SoC and UniCore ISA
+ *
+ * Copyright (C) 2001-2010 GUAN Xue-tao
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+OUTPUT_ARCH(unicore32)
+ENTRY(_start)
+SECTIONS
+{
+  /DISCARD/ : {
+    /*
+     * Discard any r/w data - this produces a link error if we have any,
+     * which is required for PIC decompression.  Local data generates
+     * GOTOFF relocations, which prevents it being relocated independently
+     * of the text/got segments.
+     */
+    *(.data)
+  }
+
+  . = TEXT_START;
+  _text = .;
+
+  .text : {
+    _start = .;
+    *(.start)
+    *(.text)
+    *(.text.*)
+    *(.fixup)
+    *(.gnu.warning)
+    *(.rodata)
+    *(.rodata.*)
+    *(.piggydata)
+    . = ALIGN(4);
+  }
+
+  _etext = .;
+
+  /* Assume size of decompressed image is 4x the compressed image */
+  _image_size = (_etext - _text) * 4;
+
+  _got_start = .;
+  .got                 : { *(.got) }
+  _got_end = .;
+  .got.plt             : { *(.got.plt) }
+  _edata = .;
+
+  . = BSS_START;
+  __bss_start = .;
+  .bss                 : { *(.bss) }
+  _end = .;
+
+  .stack               : { *(.stack) }
+  .comment 0           : { *(.comment) }
+}
+
diff --git a/arch/unicore32/boot/compressed/vmlinux.lds.in b/arch/unicore32/boot/compressed/vmlinux.lds.in
deleted file mode 100644 (file)
index d5a3ce2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * linux/arch/unicore/boot/compressed/vmlinux.lds.in
- *
- * Code specific to PKUnity SoC and UniCore ISA
- *
- * Copyright (C) 2001-2010 GUAN Xue-tao
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-OUTPUT_ARCH(unicore32)
-ENTRY(_start)
-SECTIONS
-{
-  /DISCARD/ : {
-    /*
-     * Discard any r/w data - this produces a link error if we have any,
-     * which is required for PIC decompression.  Local data generates
-     * GOTOFF relocations, which prevents it being relocated independently
-     * of the text/got segments.
-     */
-    *(.data)
-  }
-
-  . = TEXT_START;
-  _text = .;
-
-  .text : {
-    _start = .;
-    *(.start)
-    *(.text)
-    *(.text.*)
-    *(.fixup)
-    *(.gnu.warning)
-    *(.rodata)
-    *(.rodata.*)
-    *(.piggydata)
-    . = ALIGN(4);
-  }
-
-  _etext = .;
-
-  /* Assume size of decompressed image is 4x the compressed image */
-  _image_size = (_etext - _text) * 4;
-
-  _got_start = .;
-  .got                 : { *(.got) }
-  _got_end = .;
-  .got.plt             : { *(.got.plt) }
-  _edata = .;
-
-  . = BSS_START;
-  __bss_start = .;
-  .bss                 : { *(.bss) }
-  _end = .;
-
-  .stack               : { *(.stack) }
-  .comment 0           : { *(.comment) }
-}
-