diff mbox

[U-Boot] arm: put .hash, .got.plt and .machine_param back in binaries

Message ID 1386920650-31190-1-git-send-email-albert.u.boot@aribaud.net
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Albert ARIBAUD Dec. 13, 2013, 7:44 a.m. UTC
Some targets will build fine but not boot if sections .hash and
.got.plt are not present in the binary. Add them back.

Also, Exynos machines require .machine_param section in SPL.
Add it.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
This patch was prepared with the help of Rajeshwari Birge.
Please test, especially if you own an Exynos-based board.

 arch/arm/config.mk                  | 2 +-
 arch/arm/cpu/armv7/exynos/config.mk | 7 +++++++
 arch/arm/cpu/u-boot.lds             | 3 +--
 spl/Makefile                        | 3 ++-
 4 files changed, 11 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/exynos/config.mk

Comments

Rajeshwari Birje Dec. 13, 2013, 7:59 a.m. UTC | #1
Hi Albert,

Tested on SMDK5250 and working fine.

Tested by: Rajeshwari S Shinde <rajeshwari.s@samsung.com>

Regards,
Rajeshwari.

On Fri, Dec 13, 2013 at 1:14 PM, Albert ARIBAUD
<albert.u.boot@aribaud.net> wrote:
> Some targets will build fine but not boot if sections .hash and
> .got.plt are not present in the binary. Add them back.
>
> Also, Exynos machines require .machine_param section in SPL.
> Add it.
>
> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---
> This patch was prepared with the help of Rajeshwari Birge.
> Please test, especially if you own an Exynos-based board.
>
>  arch/arm/config.mk                  | 2 +-
>  arch/arm/cpu/armv7/exynos/config.mk | 7 +++++++
>  arch/arm/cpu/u-boot.lds             | 3 +--
>  spl/Makefile                        | 3 ++-
>  4 files changed, 11 insertions(+), 4 deletions(-)
>  create mode 100644 arch/arm/cpu/armv7/exynos/config.mk
>
> diff --git a/arch/arm/config.mk b/arch/arm/config.mk
> index fd3e5fb..5d39d39 100644
> --- a/arch/arm/config.mk
> +++ b/arch/arm/config.mk
> @@ -105,4 +105,4 @@ PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations)
>  endif
>
>  # limit ourselves to the sections we want in the .bin.
> -OBJCFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rel.dyn
> +OBJCFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn
> diff --git a/arch/arm/cpu/armv7/exynos/config.mk b/arch/arm/cpu/armv7/exynos/config.mk
> new file mode 100644
> index 0000000..ee0d2da
> --- /dev/null
> +++ b/arch/arm/cpu/armv7/exynos/config.mk
> @@ -0,0 +1,7 @@
> +#
> +# Copyright (C) Albert ARIBAUD <albert.u.boot@aribaud.net>
> +#
> +# SPDX-License-Identifier:     GPL-2.0+
> +#
> +
> +SPL_OBJCFLAGS += -j .machine_param
> diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
> index 9463a33..4da5d24 100644
> --- a/arch/arm/cpu/u-boot.lds
> +++ b/arch/arm/cpu/u-boot.lds
> @@ -92,8 +92,6 @@ SECTIONS
>         }
>
>         .dynsym _end : { *(.dynsym) }
> -       .hash : { *(.hash) }
> -       .got.plt : { *(.got.plt) }
>         .dynbss : { *(.dynbss) }
>         .dynstr : { *(.dynstr*) }
>         .dynamic : { *(.dynamic*) }
> @@ -101,4 +99,5 @@ SECTIONS
>         .interp : { *(.interp*) }
>         .gnu : { *(.gnu*) }
>         .ARM.exidx : { *(.ARM.exidx*) }
> +       .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
>  }
> diff --git a/spl/Makefile b/spl/Makefile
> index 2a787af..b95582b 100644
> --- a/spl/Makefile
> +++ b/spl/Makefile
> @@ -171,7 +171,8 @@ $(obj)$(BOARD)-spl.bin: $(obj)u-boot-spl.bin
>  endif
>
>  $(obj)$(SPL_BIN).bin:  $(obj)$(SPL_BIN)
> -       $(OBJCOPY) $(OBJCFLAGS) -O binary $< $@
> +       $(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O srec $< $(obj)$(SPL_BIN).srec
> +       $(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O binary $< $@
>
>  GEN_UBOOT = \
>         cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \
> --
> 1.8.3.2
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Masahiro Yamada Dec. 13, 2013, 8:15 a.m. UTC | #2
Hello Albert.


>  $(obj)$(SPL_BIN).bin:	$(obj)$(SPL_BIN)
> -	$(OBJCOPY) $(OBJCFLAGS) -O binary $< $@
> +	$(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O srec $< $(obj)$(SPL_BIN).srec
> +	$(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O binary $< $@

The new file .srec is not mentioned in the commit log.
Is it your intentional change?

If so, please describe them separetely.



Best Regards
Masahiro Yamada
Albert ARIBAUD Dec. 13, 2013, 9:58 a.m. UTC | #3
Hi Masahiro,

On Fri, 13 Dec 2013 17:15:51 +0900, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:

> Hello Albert.
> 
> 
> >  $(obj)$(SPL_BIN).bin:	$(obj)$(SPL_BIN)
> > -	$(OBJCOPY) $(OBJCFLAGS) -O binary $< $@
> > +	$(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O srec $< $(obj)$(SPL_BIN).srec
> > +	$(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O binary $< $@
> 
> The new file .srec is not mentioned in the commit log.
> Is it your intentional change?
>
> If so, please describe them separetely.

Thanks for spotting this.

Actually it is not intentional; I had added it in my tests so that I
could compare binaries from different builds more easily. Unless people
think it should stay, I will remove it through a v2 patch.

> Best Regards
> Masahiro Yamada

Amicalement,
Rajeshwari Birje Dec. 26, 2013, 3:44 a.m. UTC | #4
Hi Albert,

Any idea when are you getting this patch in as it is effecting the SMDK5250
booting.

Regards,
Rajeshwari


On Fri, Dec 13, 2013 at 3:28 PM, Albert ARIBAUD
<albert.u.boot@aribaud.net>wrote:

> Hi Masahiro,
>
> On Fri, 13 Dec 2013 17:15:51 +0900, Masahiro Yamada
> <yamada.m@jp.panasonic.com> wrote:
>
> > Hello Albert.
> >
> >
> > >  $(obj)$(SPL_BIN).bin:      $(obj)$(SPL_BIN)
> > > -   $(OBJCOPY) $(OBJCFLAGS) -O binary $< $@
> > > +   $(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O srec $<
> $(obj)$(SPL_BIN).srec
> > > +   $(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O binary $< $@
> >
> > The new file .srec is not mentioned in the commit log.
> > Is it your intentional change?
> >
> > If so, please describe them separetely.
>
> Thanks for spotting this.
>
> Actually it is not intentional; I had added it in my tests so that I
> could compare binaries from different builds more easily. Unless people
> think it should stay, I will remove it through a v2 patch.
>
> > Best Regards
> > Masahiro Yamada
>
> Amicalement,
> --
> Albert.
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
diff mbox

Patch

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index fd3e5fb..5d39d39 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -105,4 +105,4 @@  PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations)
 endif
 
 # limit ourselves to the sections we want in the .bin.
-OBJCFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rel.dyn
+OBJCFLAGS += -j .text -j .rodata -j .hash -j .data -j .got.plt -j .u_boot_list -j .rel.dyn
diff --git a/arch/arm/cpu/armv7/exynos/config.mk b/arch/arm/cpu/armv7/exynos/config.mk
new file mode 100644
index 0000000..ee0d2da
--- /dev/null
+++ b/arch/arm/cpu/armv7/exynos/config.mk
@@ -0,0 +1,7 @@ 
+#
+# Copyright (C) Albert ARIBAUD <albert.u.boot@aribaud.net>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+SPL_OBJCFLAGS += -j .machine_param
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index 9463a33..4da5d24 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -92,8 +92,6 @@  SECTIONS
 	}
 
 	.dynsym _end : { *(.dynsym) }
-	.hash : { *(.hash) }
-	.got.plt : { *(.got.plt) }
 	.dynbss : { *(.dynbss) }
 	.dynstr : { *(.dynstr*) }
 	.dynamic : { *(.dynamic*) }
@@ -101,4 +99,5 @@  SECTIONS
 	.interp : { *(.interp*) }
 	.gnu : { *(.gnu*) }
 	.ARM.exidx : { *(.ARM.exidx*) }
+	.gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
 }
diff --git a/spl/Makefile b/spl/Makefile
index 2a787af..b95582b 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -171,7 +171,8 @@  $(obj)$(BOARD)-spl.bin: $(obj)u-boot-spl.bin
 endif
 
 $(obj)$(SPL_BIN).bin:	$(obj)$(SPL_BIN)
-	$(OBJCOPY) $(OBJCFLAGS) -O binary $< $@
+	$(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O srec $< $(obj)$(SPL_BIN).srec
+	$(OBJCOPY) $(OBJCFLAGS) $(SPL_OBJCFLAGS) -O binary $< $@
 
 GEN_UBOOT = \
 	cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \