2018-08-28 16:13:51

by Philippe Reynes

[permalink] [raw]
Subject: [PATCH] MIPS: Fix computation on entry point

Since commit 27c524d17430 ("MIPS: Use the entry point from the ELF
file header"), the kernel entry point is computed with a grep on
"start address" on the output of objdump. It works fine when the
default language is english but it may fail on other language (for
example in French, the grep should be done on "adresse de départ").
To fix this computation on most machine, I propose to force the
language to english with "LC_ALL=C".

Fixes: 27c524d17430 ("MIPS: Use the entry point from the ELF file header")

Signed-off-by: Philippe Reynes <[email protected]>
---
arch/mips/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d74b374..835aa8f 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -258,7 +258,7 @@ load-y = $(CONFIG_PHYSICAL_START)
endif

# Sign-extend the entry point to 64 bits if retrieved as a 32-bit number.
-entry-y = $(shell $(OBJDUMP) -f vmlinux 2>/dev/null \
+entry-y = $(shell LC_ALL=C $(OBJDUMP) -f vmlinux 2>/dev/null \
| sed -n '/^start address / { \
s/^.* //; \
s/0x\([0-7].......\)$$/0x00000000\1/; \
--
2.7.4



2018-08-29 17:59:20

by Paul Burton

[permalink] [raw]
Subject: Re: [PATCH] MIPS: Fix computation on entry point

Hi Philippe,

On Tue, Aug 28, 2018 at 05:52:50PM +0200, Philippe Reynes wrote:
> Since commit 27c524d17430 ("MIPS: Use the entry point from the ELF
> file header"), the kernel entry point is computed with a grep on
> "start address" on the output of objdump. It works fine when the
> default language is english but it may fail on other language (for
> example in French, the grep should be done on "adresse de d?part").

D'oh!

> To fix this computation on most machine, I propose to force the
> language to english with "LC_ALL=C".

I wonder if it's time to bite the bullet & just write a little custom
program to do what we need, rather than trying to wrangle standard tools
that *almost* do what we need but not quite... Patch incoming.

Thanks,
Paul