diff mbox series

[2/3] mips: Start using ldflags-y for 32/64bit LDFLAGS

Message ID 20200327135202.16788-2-trini@konsulko.com
State New
Headers show
Series [1/3] riscv: Start using ldflags-y for 32/64bit LDFLAGS | expand

Commit Message

Tom Rini March 27, 2020, 1:52 p.m. UTC
To prepare to update our Kbuild logic, start switching some of our cases
of adding different bit/endian linker flags via ldflags-y

Cc: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
Signed-off-by: Tom Rini <trini at konsulko.com>
---
 arch/mips/config.mk | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Daniel Schwierzeck March 27, 2020, 3:08 p.m. UTC | #1
Hi Tom,

Am 27.03.20 um 14:52 schrieb Tom Rini:
> To prepare to update our Kbuild logic, start switching some of our cases
> of adding different bit/endian linker flags via ldflags-y
> 
> Cc: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
>  arch/mips/config.mk | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/mips/config.mk b/arch/mips/config.mk
> index 9d3a84539a7d..f8180dcd396c 100644
> --- a/arch/mips/config.mk
> +++ b/arch/mips/config.mk
> @@ -4,8 +4,8 @@
>  # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
>  
>  ifdef CONFIG_SYS_BIG_ENDIAN
> -32bit-emul		:= elf32btsmip
> -64bit-emul		:= elf64btsmip
> +ldflags-$(CONFIG_32BIT) += -m elf32btsmip
> +ldflags-$(CONFIG_64BIT)	+= -m elf64btsmip
>  32bit-bfd		:= elf32-tradbigmips
>  64bit-bfd		:= elf64-tradbigmips
>  PLATFORM_CPPFLAGS	+= -EB
> @@ -13,8 +13,8 @@ PLATFORM_LDFLAGS	+= -EB
>  endif
>  
>  ifdef CONFIG_SYS_LITTLE_ENDIAN
> -32bit-emul		:= elf32ltsmip
> -64bit-emul		:= elf64ltsmip
> +ldflags-$(CONFIG_32BIT) += -m elf32btsmip
> +ldflags-$(CONFIG_64BIT)	+= -m elf64btsmip
>  32bit-bfd		:= elf32-tradlittlemips
>  64bit-bfd		:= elf64-tradlittlemips
>  PLATFORM_CPPFLAGS	+= -EL
> @@ -23,18 +23,18 @@ endif
>  
>  ifdef CONFIG_32BIT
>  PLATFORM_CPPFLAGS	+= -mabi=32
> -PLATFORM_LDFLAGS	+= -m $(32bit-emul)
>  OBJCOPYFLAGS		+= -O $(32bit-bfd)
>  CONFIG_STANDALONE_LOAD_ADDR	?= 0x80200000
>  endif
>  
>  ifdef CONFIG_64BIT
>  PLATFORM_CPPFLAGS	+= -mabi=64
> -PLATFORM_LDFLAGS	+= -m$(64bit-emul)
>  OBJCOPYFLAGS		+= -O $(64bit-bfd)
>  CONFIG_STANDALONE_LOAD_ADDR	?= 0xffffffff80200000
>  endif
>  
> +PLATFORM_LDFLAGS += $(ldflags-y)

is this change really necessary? I'd like to keep that in sync with MIPS
Linux. And MIPS Linux simply changed to

KBUILD_LDFLAGS          += -m $(ld-emul)

> +
>  PLATFORM_CPPFLAGS += -D__MIPS__
>  PLATFORM_ELFENTRY = "__start"
>  PLATFORM_ELFFLAGS += -B mips $(OBJCOPYFLAGS)
>
Tom Rini March 27, 2020, 3:12 p.m. UTC | #2
On Fri, Mar 27, 2020 at 04:08:16PM +0100, Daniel Schwierzeck wrote:
> Hi Tom,
> 
> Am 27.03.20 um 14:52 schrieb Tom Rini:
> > To prepare to update our Kbuild logic, start switching some of our cases
> > of adding different bit/endian linker flags via ldflags-y
> > 
> > Cc: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
> > Signed-off-by: Tom Rini <trini at konsulko.com>
> > ---
> >  arch/mips/config.mk | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/mips/config.mk b/arch/mips/config.mk
> > index 9d3a84539a7d..f8180dcd396c 100644
> > --- a/arch/mips/config.mk
> > +++ b/arch/mips/config.mk
> > @@ -4,8 +4,8 @@
> >  # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> >  
> >  ifdef CONFIG_SYS_BIG_ENDIAN
> > -32bit-emul		:= elf32btsmip
> > -64bit-emul		:= elf64btsmip
> > +ldflags-$(CONFIG_32BIT) += -m elf32btsmip
> > +ldflags-$(CONFIG_64BIT)	+= -m elf64btsmip
> >  32bit-bfd		:= elf32-tradbigmips
> >  64bit-bfd		:= elf64-tradbigmips
> >  PLATFORM_CPPFLAGS	+= -EB
> > @@ -13,8 +13,8 @@ PLATFORM_LDFLAGS	+= -EB
> >  endif
> >  
> >  ifdef CONFIG_SYS_LITTLE_ENDIAN
> > -32bit-emul		:= elf32ltsmip
> > -64bit-emul		:= elf64ltsmip
> > +ldflags-$(CONFIG_32BIT) += -m elf32btsmip
> > +ldflags-$(CONFIG_64BIT)	+= -m elf64btsmip
> >  32bit-bfd		:= elf32-tradlittlemips
> >  64bit-bfd		:= elf64-tradlittlemips
> >  PLATFORM_CPPFLAGS	+= -EL
> > @@ -23,18 +23,18 @@ endif
> >  
> >  ifdef CONFIG_32BIT
> >  PLATFORM_CPPFLAGS	+= -mabi=32
> > -PLATFORM_LDFLAGS	+= -m $(32bit-emul)
> >  OBJCOPYFLAGS		+= -O $(32bit-bfd)
> >  CONFIG_STANDALONE_LOAD_ADDR	?= 0x80200000
> >  endif
> >  
> >  ifdef CONFIG_64BIT
> >  PLATFORM_CPPFLAGS	+= -mabi=64
> > -PLATFORM_LDFLAGS	+= -m$(64bit-emul)
> >  OBJCOPYFLAGS		+= -O $(64bit-bfd)
> >  CONFIG_STANDALONE_LOAD_ADDR	?= 0xffffffff80200000
> >  endif
> >  
> > +PLATFORM_LDFLAGS += $(ldflags-y)
> 
> is this change really necessary? I'd like to keep that in sync with MIPS
> Linux. And MIPS Linux simply changed to
> 
> KBUILD_LDFLAGS          += -m $(ld-emul)

Pretty sure it was the only way I got ci20 to continue to build.  I'll
go try a one-off local branch and re-confirm now that I have other
issues resolved too.  Thanks!
Tom Rini March 27, 2020, 3:17 p.m. UTC | #3
On Fri, Mar 27, 2020 at 04:08:16PM +0100, Daniel Schwierzeck wrote:
> Hi Tom,
> 
> Am 27.03.20 um 14:52 schrieb Tom Rini:
> > To prepare to update our Kbuild logic, start switching some of our cases
> > of adding different bit/endian linker flags via ldflags-y
> > 
> > Cc: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
> > Signed-off-by: Tom Rini <trini at konsulko.com>
> > ---
> >  arch/mips/config.mk | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/mips/config.mk b/arch/mips/config.mk
> > index 9d3a84539a7d..f8180dcd396c 100644
> > --- a/arch/mips/config.mk
> > +++ b/arch/mips/config.mk
> > @@ -4,8 +4,8 @@
> >  # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> >  
> >  ifdef CONFIG_SYS_BIG_ENDIAN
> > -32bit-emul		:= elf32btsmip
> > -64bit-emul		:= elf64btsmip
> > +ldflags-$(CONFIG_32BIT) += -m elf32btsmip
> > +ldflags-$(CONFIG_64BIT)	+= -m elf64btsmip
> >  32bit-bfd		:= elf32-tradbigmips
> >  64bit-bfd		:= elf64-tradbigmips
> >  PLATFORM_CPPFLAGS	+= -EB
> > @@ -13,8 +13,8 @@ PLATFORM_LDFLAGS	+= -EB
> >  endif
> >  
> >  ifdef CONFIG_SYS_LITTLE_ENDIAN
> > -32bit-emul		:= elf32ltsmip
> > -64bit-emul		:= elf64ltsmip
> > +ldflags-$(CONFIG_32BIT) += -m elf32btsmip
> > +ldflags-$(CONFIG_64BIT)	+= -m elf64btsmip
> >  32bit-bfd		:= elf32-tradlittlemips
> >  64bit-bfd		:= elf64-tradlittlemips
> >  PLATFORM_CPPFLAGS	+= -EL
> > @@ -23,18 +23,18 @@ endif
> >  
> >  ifdef CONFIG_32BIT
> >  PLATFORM_CPPFLAGS	+= -mabi=32
> > -PLATFORM_LDFLAGS	+= -m $(32bit-emul)
> >  OBJCOPYFLAGS		+= -O $(32bit-bfd)
> >  CONFIG_STANDALONE_LOAD_ADDR	?= 0x80200000
> >  endif
> >  
> >  ifdef CONFIG_64BIT
> >  PLATFORM_CPPFLAGS	+= -mabi=64
> > -PLATFORM_LDFLAGS	+= -m$(64bit-emul)
> >  OBJCOPYFLAGS		+= -O $(64bit-bfd)
> >  CONFIG_STANDALONE_LOAD_ADDR	?= 0xffffffff80200000
> >  endif
> >  
> > +PLATFORM_LDFLAGS += $(ldflags-y)
> 
> is this change really necessary? I'd like to keep that in sync with MIPS
> Linux. And MIPS Linux simply changed to
> 
> KBUILD_LDFLAGS          += -m $(ld-emul)

OK, looks like this was a side-effect of when I was still debugging
other link problems, please disregard this and 1/3 as well.  I'll post
v2 once I've done a world build of mips/riscv.  Thanks!
diff mbox series

Patch

diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 9d3a84539a7d..f8180dcd396c 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -4,8 +4,8 @@ 
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
 ifdef CONFIG_SYS_BIG_ENDIAN
-32bit-emul		:= elf32btsmip
-64bit-emul		:= elf64btsmip
+ldflags-$(CONFIG_32BIT) += -m elf32btsmip
+ldflags-$(CONFIG_64BIT)	+= -m elf64btsmip
 32bit-bfd		:= elf32-tradbigmips
 64bit-bfd		:= elf64-tradbigmips
 PLATFORM_CPPFLAGS	+= -EB
@@ -13,8 +13,8 @@  PLATFORM_LDFLAGS	+= -EB
 endif
 
 ifdef CONFIG_SYS_LITTLE_ENDIAN
-32bit-emul		:= elf32ltsmip
-64bit-emul		:= elf64ltsmip
+ldflags-$(CONFIG_32BIT) += -m elf32btsmip
+ldflags-$(CONFIG_64BIT)	+= -m elf64btsmip
 32bit-bfd		:= elf32-tradlittlemips
 64bit-bfd		:= elf64-tradlittlemips
 PLATFORM_CPPFLAGS	+= -EL
@@ -23,18 +23,18 @@  endif
 
 ifdef CONFIG_32BIT
 PLATFORM_CPPFLAGS	+= -mabi=32
-PLATFORM_LDFLAGS	+= -m $(32bit-emul)
 OBJCOPYFLAGS		+= -O $(32bit-bfd)
 CONFIG_STANDALONE_LOAD_ADDR	?= 0x80200000
 endif
 
 ifdef CONFIG_64BIT
 PLATFORM_CPPFLAGS	+= -mabi=64
-PLATFORM_LDFLAGS	+= -m$(64bit-emul)
 OBJCOPYFLAGS		+= -O $(64bit-bfd)
 CONFIG_STANDALONE_LOAD_ADDR	?= 0xffffffff80200000
 endif
 
+PLATFORM_LDFLAGS += $(ldflags-y)
+
 PLATFORM_CPPFLAGS += -D__MIPS__
 PLATFORM_ELFENTRY = "__start"
 PLATFORM_ELFFLAGS += -B mips $(OBJCOPYFLAGS)