Skip to contentSkip to conversation

arm: lds: Remove libgcc eabi exception handling tables

RFC PATCH New Michal Simek 3 participants 5 messages May 9, 2013 – Jun 3, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 arm: lds: Remove libgcc eabi exception handling tables

Remove ARM eabi exception handling tables (for frame unwinding). AFAICT, u-boot stubs away the frame unwiding routines, so the tables will more or less just consume space. It should be OK to remove them.

---
Other options could be to complete u-boot/arch/arm/lib/* so that libgcc routines with exception handling dont get pulled in. Or to avoid user code (like the mentioned patch) which causes external libgcc functions to get pulled in...

---
 arch/arm/cpu/u-boot.lds | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/cpu/u-boot.lds +2 -0
index d9bbee3..e139b90 100644
@@ -106,4 +106,6 @@ SECTIONS
 	/DISCARD/ : { *(.plt*) }
 	/DISCARD/ : { *(.interp*) }
 	/DISCARD/ : { *(.gnu*) }
+	/DISCARD/ : { *(.ARM.exidx*) }
+	/DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
 }

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130509/002a4ae1/attachment.pgp>

#1 lore raw

RFC PATCH 1/1 arm: lds: Remove libgcc eabi exception handling tables

Hi Michal,

Quoted 11 lines · Michal Simek

Remove ARM eabi exception handling tables (for frame unwinding). AFAICT, u-boot stubs away the frame unwiding routines, so the tables will more or less just consume space. It should be OK to remove them.

---
Other options could be to complete u-boot/arch/arm/lib/* so that libgcc routines with exception handling dont get pulled in. Or to avoid user code (like the mentioned patch) which causes external libgcc functions to get pulled in...

Er... which mentioned patch?

Amicalement,

Signature · 1 line
Albert.
#2 lore raw

RFC PATCH 1/1 arm: lds: Remove libgcc eabi exception handling tables

Quoted 17 lines · Albert ARIBAUD

Hi Michal,

Quoted 11 lines · Michal Simek

Remove ARM eabi exception handling tables (for frame unwinding). AFAICT, u-boot stubs away the frame unwiding routines, so the tables will more or less just consume space. It should be OK to remove them.

---
Other options could be to complete u-boot/arch/arm/lib/* so that libgcc routines with exception handling dont get pulled in. Or to avoid user code (like the mentioned patch) which causes external libgcc functions to get pulled in...

Quoted 1 line

Er... which mentioned patch?

Ah yeah. Let me give you background.
After adding:
"arm: zynq: U-Boot udelay < 1000 FIX"
(sha1: d54cc007878697a92e7f696b71a3eb203c0386e2)

we have found that new program header is added to u-boot for zynq.

Program Header:
0x70000001 off 0x000405fc vaddr 0x040385fc paddr 0x040385fc align 2**2

         filesz 0x00000020 memsz 0x00000020 flags r--
    LOAD off    0x00008000 vaddr 0x04000000 paddr 0x04000000 align 2**15
         filesz 0x00041240 memsz 0x00041240 flags rwx
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rwx

Tracing down this we found that uldivmod is used
27: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_uldivmod

Based on that Edgar proposed this patch.

After my experiment we can also use the patch below to fix it because external libgcc functions are not pulled it.
But probably removing that ARM eabi exception handling tables is better solution then try to change code not to use it.
But for me it is no problem to send the patch below to fix this problem.

Thanks,
Michal

arch/arm/cpu/armv7/zynq/timer.c +3 -2
index 1b56373..4b26e96 100644
@@ -118,12 +118,13 @@ void __udelay(unsigned long usec)
        u32 timeend;
        u32 timediff;
        u32 timenow;
+       u64 temp;
 
        if (usec == 0)
                return;
 
-       countticks = (u32) (((unsigned long long) TIMER_TICK_HZ * usec) /
-                                                               1000000);
+       temp = (TIMER_TICK_HZ * usec) / 1000000;
+       countticks = (u32)temp;
 
        /* decrementing timer */
        timeend = readl(&timer_base->counter) - countticks;
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130513/720ba3d5/attachment.pgp>
#3 lore raw

RFC PATCH 1/1 arm: lds: Remove libgcc eabi exception handling tables

Hi Michal,

Quoted 35 lines · Michal Simek
Quoted 17 lines · Albert ARIBAUD

Hi Michal,

Quoted 11 lines · Michal Simek

Remove ARM eabi exception handling tables (for frame unwinding). AFAICT, u-boot stubs away the frame unwiding routines, so the tables will more or less just consume space. It should be OK to remove them.

---
Other options could be to complete u-boot/arch/arm/lib/* so that libgcc routines with exception handling dont get pulled in. Or to avoid user code (like the mentioned patch) which causes external libgcc functions to get pulled in...

Quoted 1 line

Er... which mentioned patch?

Ah yeah. Let me give you background.
After adding:
"arm: zynq: U-Boot udelay < 1000 FIX"
(sha1: d54cc007878697a92e7f696b71a3eb203c0386e2)

we have found that new program header is added to u-boot for zynq.

Program Header:
0x70000001 off 0x000405fc vaddr 0x040385fc paddr 0x040385fc align 2**2

         filesz 0x00000020 memsz 0x00000020 flags r--
    LOAD off    0x00008000 vaddr 0x04000000 paddr 0x04000000 align 2**15
         filesz 0x00041240 memsz 0x00041240 flags rwx
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rwx
Quoted 4 lines

Tracing down this we found that uldivmod is used
27: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_uldivmod

Based on that Edgar proposed this patch.

Ok, so Michal and I just did some fiddling with zynq builds and *exidx* sections.

By default the *exidx* sections are between rodata and data, so removing them causes many apparent changes at the binary level. However, builds of zynq based on ARM master with the patch above vs master with a patch mapping *exidx* sections after BSS gives identical binaries. Thus the RFC has no functional effect.

Also, ARM EHABI states that [exception] Tables are not required for ABI compliance at the C/Assembler level but are required for C++.

http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf

So as long as we don't put any C++ code in U-Boot (a prospect that I don't see happening any time soon), this RFC is safe and either is a no-op or removes useless bytes from the binary.

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

RFC PATCH 1/1 arm: lds: Remove libgcc eabi exception handling tables

Hi Albert,

Quoted 54 lines · Albert ARIBAUD

Hi Michal,

Quoted 35 lines · Michal Simek
Quoted 17 lines · Albert ARIBAUD

Hi Michal,

Quoted 11 lines · Michal Simek

Remove ARM eabi exception handling tables (for frame unwinding). AFAICT, u-boot stubs away the frame unwiding routines, so the tables will more or less just consume space. It should be OK to remove them.

---
Other options could be to complete u-boot/arch/arm/lib/* so that libgcc routines with exception handling dont get pulled in. Or to avoid user code (like the mentioned patch) which causes external libgcc functions to get pulled in...

Quoted 1 line

Er... which mentioned patch?

Ah yeah. Let me give you background.
After adding:
"arm: zynq: U-Boot udelay < 1000 FIX"
(sha1: d54cc007878697a92e7f696b71a3eb203c0386e2)

we have found that new program header is added to u-boot for zynq.

Program Header:
0x70000001 off 0x000405fc vaddr 0x040385fc paddr 0x040385fc align 2**2

         filesz 0x00000020 memsz 0x00000020 flags r--
    LOAD off    0x00008000 vaddr 0x04000000 paddr 0x04000000 align 2**15
         filesz 0x00041240 memsz 0x00041240 flags rwx
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rwx
Quoted 4 lines

Tracing down this we found that uldivmod is used
27: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_uldivmod

Based on that Edgar proposed this patch.

Ok, so Michal and I just did some fiddling with zynq builds and *exidx* sections.

By default the *exidx* sections are between rodata and data, so removing them causes many apparent changes at the binary level. However, builds of zynq based on ARM master with the patch above vs master with a patch mapping *exidx* sections after BSS gives identical binaries. Thus the RFC has no functional effect.

Quoted 8 lines

Also, ARM EHABI states that [exception] Tables are not required for ABI compliance at the C/Assembler level but are required for C++.

http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf

So as long as we don't put any C++ code in U-Boot (a prospect that I don't see happening any time soon), this RFC is safe and either is a no-op or removes useless bytes from the binary.

Any update on this?
Have you decided to add or not to add to this release?
If you I need to fix zynq timer code do not use exception handling table.

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130603/d512a8e6/attachment.pgp>