arm: lib: Split asm symbols into different .text subsections
Split each symbol in lib1funcs into different .text.foo section instead
of placing all of them into plain .text . This allows the linker to collect
and discard unused assembler symbols.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S
index 408839b..f1becda 100644
--- a/arch/arm/lib/lib1funcs.S
+++ b/arch/arm/lib/lib1funcs.S
@@ -196,6 +196,7 @@
ENTRY(__udivsi3)
ENTRY(__aeabi_uidiv)
UNWIND(.fnstart)
+.pushsection .text.__udivsi3, "ax"
subs r2, r1, #1
reteq lr
@@ -219,12 +220,14 @@
mov r0, r0, lsr r2
ret lr
+.popsection
UNWIND(.fnend)
ENDPROC(__udivsi3)
ENDPROC(__aeabi_uidiv)
ENTRY(__umodsi3)
UNWIND(.fnstart)
+.pushsection .text.__umodsi3, "ax"
subs r2, r1, #1 @ compare divisor with 1
bcc Ldiv0
@@ -238,12 +241,14 @@
ret lr
+.popsection
UNWIND(.fnend)
ENDPROC(__umodsi3)
ENTRY(__divsi3)
ENTRY(__aeabi_idiv)
UNWIND(.fnstart)
+.pushsection .text.__divsi3, "ax"
cmp r1, #0
eor ip, r0, r1 @ save the sign of the result.
@@ -280,12 +285,14 @@
rsbmi r0, r0, #0
ret lr
+.popsection
UNWIND(.fnend)
ENDPROC(__divsi3)
ENDPROC(__aeabi_idiv)
ENTRY(__modsi3)
UNWIND(.fnstart)
+.pushsection .text.__modsi3, "ax"
cmp r1, #0
beq Ldiv0
@@ -305,6 +312,7 @@
rsbmi r0, r0, #0
ret lr
+.popsection
UNWIND(.fnend)
ENDPROC(__modsi3)
@@ -313,6 +321,7 @@
ENTRY(__aeabi_uidivmod)
UNWIND(.fnstart)
UNWIND(.save {r0, r1, ip, lr} )
+.pushsection .text.__aeabi_uidivmod, "ax"
stmfd sp!, {r0, r1, ip, lr}
bl __aeabi_uidiv
@@ -321,12 +330,15 @@
sub r1, r1, r3
ret lr
+.popsection
UNWIND(.fnend)
ENDPROC(__aeabi_uidivmod)
ENTRY(__aeabi_idivmod)
UNWIND(.fnstart)
UNWIND(.save {r0, r1, ip, lr} )
+.pushsection .text.__aeabi_uidivmod, "ax"
+
stmfd sp!, {r0, r1, ip, lr}
bl __aeabi_idiv
ldmfd sp!, {r1, r2, ip, lr}
@@ -334,6 +346,7 @@
sub r1, r1, r3
ret lr
+.popsection
UNWIND(.fnend)
ENDPROC(__aeabi_idivmod)
@@ -343,16 +356,21 @@
UNWIND(.fnstart)
UNWIND(.pad #4)
UNWIND(.save {lr})
+.pushsection .text.Ldiv0, "ax"
+
str lr, [sp, #-8]!
bl __div0
mov r0, #0 @ About as wrong as it could be.
ldr pc, [sp], #8
+
+.popsection
UNWIND(.fnend)
ENDPROC(Ldiv0)
/* Thumb-1 specialities */
#if defined(CONFIG_SYS_THUMB_BUILD) && !defined(CONFIG_HAS_THUMB2)
ENTRY(__gnu_thumb1_case_sqi)
+.pushsection .text.__gnu_thumb1_case_sqi, "ax"
push {r1}
mov r1, lr
lsrs r1, r1, #1
@@ -362,9 +380,11 @@
add lr, lr, r1
pop {r1}
bx lr
+.popsection
ENDPROC(__gnu_thumb1_case_sqi)
ENTRY(__gnu_thumb1_case_uqi)
+.pushsection .text.__gnu_thumb1_case_uqi, "ax"
push {r1}
mov r1, lr
lsrs r1, r1, #1
@@ -374,9 +394,11 @@
add lr, lr, r1
pop {r1}
bx lr
+.popsection
ENDPROC(__gnu_thumb1_case_uqi)
ENTRY(__gnu_thumb1_case_shi)
+.pushsection .text.__gnu_thumb1_case_shi, "ax"
push {r0, r1}
mov r1, lr
lsrs r1, r1, #1
@@ -387,9 +409,11 @@
add lr, lr, r1
pop {r0, r1}
bx lr
+.popsection
ENDPROC(__gnu_thumb1_case_shi)
ENTRY(__gnu_thumb1_case_uhi)
+.pushsection .text.__gnu_thumb1_case_uhi, "ax"
push {r0, r1}
mov r1, lr
lsrs r1, r1, #1
@@ -400,5 +424,6 @@
add lr, lr, r1
pop {r0, r1}
bx lr
+.popsection
ENDPROC(__gnu_thumb1_case_uhi)
#endif