From b86b8acb939089763ff40258b87662f399b8ce7e Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Mon, 12 Jan 2015 13:11:33 -0800 Subject: cortex-m0: optimize out unused assembly helpers Put each assembly helper function in its own .text.__funcname__ section, so the linker can remove the unused ones. Also remove a few entrypoints used only by deprecated ABIs. Signed-off-by: Vincent Palatin BRANCH=samus BUG=none TEST=make buildall check the firmware size and see we are saving 88 bytes on Zinger. Original-Change-Id: I6714da671c3449220652780d47993d6c919c331c Reviewed-on: https://chromium-review.googlesource.com/240582 Reviewed-by: Alec Berg Trybot-Ready: Vincent Palatin Tested-by: Vincent Palatin Commit-Queue: Vincent Palatin (cherry picked from commit e2355ff432dcef946b2f0b260e0de763c31288de) Reviewed-on: https://chromium-review.googlesource.com/240833 Reviewed-by: Vincent Palatin (cherry picked from commit 247fa806db512768fd48a53f5bbee8cd9d12a1c7) Signed-off-by: Todd Broch Change-Id: I2deb6053014366ff6c83ed5d5f0981ae02560c60 Reviewed-on: https://chromium-review.googlesource.com/244236 Reviewed-by: Alec Berg Tested-by: Todd Broch Commit-Queue: Todd Broch --- core/cortex-m0/div.S | 25 +++---------------------- core/cortex-m0/lmul.S | 11 +---------- core/cortex-m0/thumb_case.S | 4 ++++ 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/core/cortex-m0/div.S b/core/cortex-m0/div.S index c20804e274..833465a59e 100644 --- a/core/cortex-m0/div.S +++ b/core/cortex-m0/div.S @@ -25,24 +25,13 @@ .thumb .cpu cortex-m0 - - -@ int __divsi3(int num, int denom) -@ -@ libgcc wrapper: just an alias for __aeabi_idivmod(), the remainder is ignored -@ - .thumb_func - .global __divsi3 -__divsi3: - - - @ int __aeabi_idiv(int num:r0, int denom:r1) @ @ Divide r0 by r1 and return quotient in r0 (all signed). @ Use __aeabi_uidivmod() but check signs before and change signs afterwards. @ .thumb_func + .section .text.__aeabi_idiv .global __aeabi_idiv __aeabi_idiv: @@ -77,6 +66,7 @@ L_neg_result: @ Divide r0 by r1 and return the quotient in r0 and the remainder in r1 @ .thumb_func + .section .text.__aeabi_idivmod .global __aeabi_idivmod __aeabi_idivmod: @@ -113,21 +103,12 @@ L_num_pos_bis: -@ unsigned __udivsi3(unsigned num, unsigned denom) -@ -@ libgcc wrapper: just an alias for __aeabi_uidivmod(), the remainder is ignored -@ - .thumb_func - .global __udivsi3 -__udivsi3: - - - @ unsigned __aeabi_uidiv(unsigned num, unsigned denom) @ @ Just an alias for __aeabi_uidivmod(), the remainder is ignored @ .thumb_func + .section .text.__aeabi_uidivmod .global __aeabi_uidiv __aeabi_uidiv: diff --git a/core/cortex-m0/lmul.S b/core/cortex-m0/lmul.S index 1e037a1ede..ab04fd488f 100644 --- a/core/cortex-m0/lmul.S +++ b/core/cortex-m0/lmul.S @@ -25,22 +25,13 @@ -@ long long __muldi3(long long, long long) -@ -@ libgcc wrapper: just an alias for __aeabi_lmul() -@ - .thumb_func - .global __muldi3 -__muldi3: - - - @ long long __aeabi_lmul(long long r1:r0, long long r3:r2) @ @ Multiply r1:r0 and r3:r2 and return the product in r1:r0 @ Can also be used for unsigned long product @ .thumb_func + .section .text.__aeabi_lmul .global __aeabi_lmul __aeabi_lmul: diff --git a/core/cortex-m0/thumb_case.S b/core/cortex-m0/thumb_case.S index be6c02b764..0bc8b38db0 100644 --- a/core/cortex-m0/thumb_case.S +++ b/core/cortex-m0/thumb_case.S @@ -21,6 +21,7 @@ * r0 and lr must be PRESERVED. * r12 can be clobbered. */ +.section .text.__gnu_thumb1_case_uqi .global __gnu_thumb1_case_uqi .thumb_func __gnu_thumb1_case_uqi: @@ -34,6 +35,7 @@ __gnu_thumb1_case_uqi: mov r1, r12 bx lr +.section .text.__gnu_thumb1_case_sqi .global __gnu_thumb1_case_sqi .thumb_func __gnu_thumb1_case_sqi: @@ -47,6 +49,7 @@ __gnu_thumb1_case_sqi: mov r1, r12 bx lr +.section .text.__gnu_thumb1_case_uhi .global __gnu_thumb1_case_uhi .thumb_func __gnu_thumb1_case_uhi: @@ -62,6 +65,7 @@ __gnu_thumb1_case_uhi: bx lr +.section .text.__gnu_thumb1_case_shi .global __gnu_thumb1_case_shi .thumb_func __gnu_thumb1_case_shi: -- cgit v1.2.1