linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Arc: fix entry point calculation for locales other than english
@ 2015-11-03 17:34 Lada Trimasova
  2015-11-04 11:56 ` Vineet Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Lada Trimasova @ 2015-11-03 17:34 UTC (permalink / raw)
  To: linux-snps-arc; +Cc: linux-kernel, Lada Trimasova, Vineet Gupta, Alexey Brodkin

The problem was detected while making uImage.
To find the line with entry point address in the result
of the "readelf -h vmlinux" command "grep ENTRY POINT" is used.

But if the operating system locale is not english,
command readelf returns lines in local language.

Grep cannot find the line which contains "ENTRY POINT" in english.
Our decision uses readelf key which displays the symbol table.
Using grep _stext it finds the line with entry point in this table.

Signed-off-by: Lada Trimasova <ltrimas@synopsys.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
---
 arch/arc/boot/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arc/boot/Makefile b/arch/arc/boot/Makefile
index e597cb34..fa89a47 100644
--- a/arch/arc/boot/Makefile
+++ b/arch/arc/boot/Makefile
@@ -6,8 +6,7 @@ targets := vmlinux.bin vmlinux.bin.gz uImage
 
 OBJCOPYFLAGS= -O binary -R .note -R .note.gnu.build-id -R .comment -S
 
-LINUX_START_TEXT = $$(readelf -h vmlinux | \
-			grep "Entry point address" | grep -o 0x.*)
+LINUX_START_TEXT = $$(readelf -s vmlinux | grep _stext | awk '{print $$2}')
 
 UIMAGE_LOADADDR    = $(CONFIG_LINUX_LINK_BASE)
 UIMAGE_ENTRYADDR   = $(LINUX_START_TEXT)
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Arc: fix entry point calculation for locales other than english
  2015-11-03 17:34 [PATCH] Arc: fix entry point calculation for locales other than english Lada Trimasova
@ 2015-11-04 11:56 ` Vineet Gupta
  0 siblings, 0 replies; 2+ messages in thread
From: Vineet Gupta @ 2015-11-04 11:56 UTC (permalink / raw)
  To: Lada Trimasova, linux-snps-arc; +Cc: linux-kernel, Alexey Brodkin

On Tuesday 03 November 2015 11:04 PM, Lada Trimasova wrote:
> The problem was detected while making uImage.
> To find the line with entry point address in the result
> of the "readelf -h vmlinux" command "grep ENTRY POINT" is used.
> 
> But if the operating system locale is not english,
> command readelf returns lines in local language.
> 
> Grep cannot find the line which contains "ENTRY POINT" in english.
> Our decision uses readelf key which displays the symbol table.
> Using grep _stext it finds the line with entry point in this table.
> 
> Signed-off-by: Lada Trimasova <ltrimas@synopsys.com>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> ---
>  arch/arc/boot/Makefile | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arc/boot/Makefile b/arch/arc/boot/Makefile
> index e597cb34..fa89a47 100644
> --- a/arch/arc/boot/Makefile
> +++ b/arch/arc/boot/Makefile
> @@ -6,8 +6,7 @@ targets := vmlinux.bin vmlinux.bin.gz uImage
>  
>  OBJCOPYFLAGS= -O binary -R .note -R .note.gnu.build-id -R .comment -S
>  
> -LINUX_START_TEXT = $$(readelf -h vmlinux | \
> -			grep "Entry point address" | grep -o 0x.*)
> +LINUX_START_TEXT = $$(readelf -s vmlinux | grep _stext | awk '{print $$2}')


This seems too fragile. You are assuming _stext will be the entry point which I
recently changed and merged in Linux tree for 4.4-rc1.

See commit 3971cdc202f638f252e39316d42492ace04cc1b1
"ARC: boot: Support Halt-on-reset and Run-on-reset SMP booting modes"

And even if we change ur patch to use re_Service, it is still not future proof. We
need to somehow rely on elf header for this !

I do see your problem but lets us see how other arches do it !

>  
>  UIMAGE_LOADADDR    = $(CONFIG_LINUX_LINK_BASE)
>  UIMAGE_ENTRYADDR   = $(LINUX_START_TEXT)
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-04 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 17:34 [PATCH] Arc: fix entry point calculation for locales other than english Lada Trimasova
2015-11-04 11:56 ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).