diff mbox series

[1/1] arch/powerpc: Don't assume start_text & head_end align

Message ID 20190313033852.13028-1-alastair@au1.ibm.com (mailing list archive)
State Rejected
Headers show
Series [1/1] arch/powerpc: Don't assume start_text & head_end align | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch next (9580b71b5a7863c24a9bd18bcd2ad759b86b1eff)
snowpatch_ozlabs/build-ppc64le success build succeeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-ppc64be success build succeeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-ppc64e success build succeeded & removed 0 sparse warning(s)
snowpatch_ozlabs/build-pmac32 success build succeeded & removed 0 sparse warning(s)
snowpatch_ozlabs/checkpatch warning total: 0 errors, 3 warnings, 0 checks, 24 lines checked

Commit Message

Alastair D'Silva March 13, 2019, 3:38 a.m. UTC
From: Alastair D'Silva <alastair@d-silva.org>

When building LTO kernels, the start_text symbol is not guaranteed to mark
the end of the head section.

Instead, look explicitly for __head_end.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 arch/powerpc/tools/head_check.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Christophe Leroy Sept. 8, 2022, 6:42 a.m. UTC | #1
Le 13/03/2019 à 04:38, Alastair D'Silva a écrit :
> From: Alastair D'Silva <alastair@d-silva.org>
> 
> When building LTO kernels, the start_text symbol is not guaranteed to mark
> the end of the head section.
> 
> Instead, look explicitly for __head_end.

Could you please give more details ?

Have you encountered a problem ?

 From commit c494adefef9f ("powerpc/64: Tool to check head sections 
location sanity"), I understand that we want to make sure text_start is 
where it is, not that __head_end is.

Thanks
Christophe


> 
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> ---
>   arch/powerpc/tools/head_check.sh | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/tools/head_check.sh b/arch/powerpc/tools/head_check.sh
> index ad9e57209aa4..1b0f634038c3 100644
> --- a/arch/powerpc/tools/head_check.sh
> +++ b/arch/powerpc/tools/head_check.sh
> @@ -44,7 +44,7 @@ nm="$1"
>   vmlinux="$2"
>   
>   # gcc-4.6-era toolchain make _stext an A (absolute) symbol rather than T
> -$nm "$vmlinux" | grep -e " [TA] _stext$" -e " t start_first_256B$" -e " a text_start$" -e " t start_text$" -m4 > .tmp_symbols.txt
> +$nm "$vmlinux" | grep -e " [TA] _stext$" -e " t start_first_256B$" -e " a text_start$" -e " T __head_end$" -m4 > .tmp_symbols.txt
>   
>   
>   vma=$(cat .tmp_symbols.txt | grep -e " [TA] _stext$" | cut -d' ' -f1)
> @@ -63,12 +63,12 @@ fi
>   
>   top_vma=$(echo $vma | cut -d'0' -f1)
>   
> -expected_start_text_addr=$(cat .tmp_symbols.txt | grep " a text_start$" | cut -d' ' -f1 | sed "s/^0/$top_vma/")
> +expected_head_end_addr=$(cat .tmp_symbols.txt | grep " a text_start$" | cut -d' ' -f1 | sed "s/^0/$top_vma/")
>   
> -start_text_addr=$(cat .tmp_symbols.txt | grep " t start_text$" | cut -d' ' -f1)
> +head_end_addr=$(cat .tmp_symbols.txt | grep " T __head_end$" | cut -d' ' -f1)
>   
> -if [ "$start_text_addr" != "$expected_start_text_addr" ]; then
> -	echo "ERROR: start_text address is $start_text_addr, should be $expected_start_text_addr"
> +if [ "$head_end_addr" != "$expected_head_end_addr" ]; then
> +	echo "ERROR: __head_end address is $head_end_addr, should be $expected_head_end_addr"
>   	echo "ERROR: try to enable LD_HEAD_STUB_CATCH config option"
>   	echo "ERROR: see comments in arch/powerpc/tools/head_check.sh"
>
diff mbox series

Patch

diff --git a/arch/powerpc/tools/head_check.sh b/arch/powerpc/tools/head_check.sh
index ad9e57209aa4..1b0f634038c3 100644
--- a/arch/powerpc/tools/head_check.sh
+++ b/arch/powerpc/tools/head_check.sh
@@ -44,7 +44,7 @@  nm="$1"
 vmlinux="$2"
 
 # gcc-4.6-era toolchain make _stext an A (absolute) symbol rather than T
-$nm "$vmlinux" | grep -e " [TA] _stext$" -e " t start_first_256B$" -e " a text_start$" -e " t start_text$" -m4 > .tmp_symbols.txt
+$nm "$vmlinux" | grep -e " [TA] _stext$" -e " t start_first_256B$" -e " a text_start$" -e " T __head_end$" -m4 > .tmp_symbols.txt
 
 
 vma=$(cat .tmp_symbols.txt | grep -e " [TA] _stext$" | cut -d' ' -f1)
@@ -63,12 +63,12 @@  fi
 
 top_vma=$(echo $vma | cut -d'0' -f1)
 
-expected_start_text_addr=$(cat .tmp_symbols.txt | grep " a text_start$" | cut -d' ' -f1 | sed "s/^0/$top_vma/")
+expected_head_end_addr=$(cat .tmp_symbols.txt | grep " a text_start$" | cut -d' ' -f1 | sed "s/^0/$top_vma/")
 
-start_text_addr=$(cat .tmp_symbols.txt | grep " t start_text$" | cut -d' ' -f1)
+head_end_addr=$(cat .tmp_symbols.txt | grep " T __head_end$" | cut -d' ' -f1)
 
-if [ "$start_text_addr" != "$expected_start_text_addr" ]; then
-	echo "ERROR: start_text address is $start_text_addr, should be $expected_start_text_addr"
+if [ "$head_end_addr" != "$expected_head_end_addr" ]; then
+	echo "ERROR: __head_end address is $head_end_addr, should be $expected_head_end_addr"
 	echo "ERROR: try to enable LD_HEAD_STUB_CATCH config option"
 	echo "ERROR: see comments in arch/powerpc/tools/head_check.sh"