llvm-6502/test/MC/ARM/eh-directive-section.s
Rafael Espindola b4b0b34181 Write relocation sections contiguously.
Linkers normally read all the relocations upfront to compute the references
between sections. Putting them together is a bit more cache friendly.

I benchmarked linking a Release+Asserts clang with gold on a vm. I tried all
4 combinations of --gc-sections/no --gc-section hot and cold cache.

I cleared the cache with

echo 3 > /proc/sys/vm/drop_caches

and warmed it up by running the link once before timing the subsequent ones.

With cold cache and --gc-sections the time goes from

1.86130781665 +- 0.01713126697463843 seconds
to
1.82370735105 +- 0.014127522318814516 seconds

With cold cache and no --gc-sections the time goes from

1.6087245435500002 +- 0.012999066825178644 seconds
to
1.5687122041500001 +- 0.013145850126026619 seconds

With hot cache and no --gc-sections the time goes from

0.926200939 ( +-  0.33% ) seconds
to
0.907200079 ( +-  0.31% ) seconds

With hot cache and gc sections the time goes from

1.183038049 ( +-  0.34% ) seconds
to
1.147355862 ( +-  0.39% ) seconds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-17 08:11:38 +00:00

181 lines
6.0 KiB
ArmAsm

@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
@ RUN: | llvm-readobj -s -sd -sr -t > %t
@ RUN: FileCheck %s < %t
@ RUN: FileCheck --check-prefix=RELOC %s < %t
@ Check the combination of .section, .fnstart, and .fnend directives.
@ For the functions in .text section, the exception handling index (EXIDX)
@ should be generated in .ARM.exidx, and the exception handling table (EXTAB)
@ should be generated in .ARM.extab.
@ For the functions in custom section specified by .section directives,
@ the EXIDX should be generated in ".ARM.exidx[[SECTION_NAME]]", and the EXTAB
@ should be generated in ".ARM.extab[[SECTION_NAME]]".
.syntax unified
@-------------------------------------------------------------------------------
@ .TEST1 section
@-------------------------------------------------------------------------------
.section .TEST1
.globl func1
.align 2
.type func1,%function
.fnstart
func1:
bx lr
.personality __gxx_personality_v0
.handlerdata
.fnend
@-------------------------------------------------------------------------------
@ TEST2 section (without the dot in the beginning)
@-------------------------------------------------------------------------------
.section TEST2
.globl func2
.align 2
.type func2,%function
.fnstart
func2:
bx lr
.personality __gxx_personality_v0
.handlerdata
.fnend
@-------------------------------------------------------------------------------
@ Check the .TEST1 section.
@-------------------------------------------------------------------------------
@ CHECK: Sections [
@ CHECK: Section {
@ CHECK: Index: 4
@ CHECK: Name: .TEST1
@ CHECK: SectionData (
@ CHECK: 0000: 1EFF2FE1 |../.|
@ CHECK: )
@ CHECK: }
@-------------------------------------------------------------------------------
@ Check the .ARM.extab.TEST1 section, the EXTAB of .TEST1 section.
@-------------------------------------------------------------------------------
@ CHECK: Section {
@ CHECK: Name: .ARM.extab.TEST1
@ CHECK: SectionData (
@ CHECK: 0000: 00000000 B0B0B000 |........|
@ CHECK: )
@ CHECK: }
@ RELOC: Section {
@ RELOC: Name: .rel.ARM.extab.TEST1
@ RELOC: Relocations [
@ RELOC: 0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
@ RELOC: ]
@ RELOC: }
@-------------------------------------------------------------------------------
@ Check the.ARM.exidx.TEST1 section, the EXIDX of .TEST1 section.
@-------------------------------------------------------------------------------
@ CHECK: Section {
@ CHECK: Name: .ARM.exidx.TEST1
@-------------------------------------------------------------------------------
@ This section should linked with .TEST1 section.
@-------------------------------------------------------------------------------
@ CHECK: Link: 4
@-------------------------------------------------------------------------------
@ The first word should be relocated to the code address in .TEST1 section.
@ The second word should be relocated to the EHTAB entry in .ARM.extab.TEST1
@ section.
@-------------------------------------------------------------------------------
@ CHECK: SectionData (
@ CHECK: 0000: 00000000 00000000 |........|
@ CHECK: )
@ CHECK: }
@ RELOC: Section {
@ RELOC: Name: .rel.ARM.exidx.TEST1
@ RELOC: Relocations [
@ RELOC: 0x0 R_ARM_PREL31 .TEST1 0x0
@ RELOC: 0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
@ RELOC: ]
@ RELOC: }
@-------------------------------------------------------------------------------
@ Check the TEST2 section (without the dot in the beginning)
@-------------------------------------------------------------------------------
@ CHECK: Section {
@ CHECK: Index: 7
@ CHECK: Name: TEST2
@ CHECK: SectionData (
@ CHECK: 0000: 1EFF2FE1 |../.|
@ CHECK: )
@ CHECK: }
@-------------------------------------------------------------------------------
@ Check the .ARM.extabTEST2 section, the EXTAB of TEST2 section.
@-------------------------------------------------------------------------------
@ CHECK: Section {
@ CHECK: Name: .ARM.extabTEST2
@ CHECK: SectionData (
@ CHECK: 0000: 00000000 B0B0B000 |........|
@ CHECK: )
@ CHECK: }
@ RELOC: Section {
@ RELOC: Name: .rel.ARM.extabTEST2
@ RELOC: Relocations [
@ RELOC: 0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
@ RELOC: ]
@ RELOC: }
@-------------------------------------------------------------------------------
@ Check the .ARM.exidxTEST2 section, the EXIDX of TEST2 section.
@-------------------------------------------------------------------------------
@ CHECK: Section {
@ CHECK: Name: .ARM.exidxTEST2
@-------------------------------------------------------------------------------
@ This section should linked with TEST2 section.
@-------------------------------------------------------------------------------
@ CHECK: Link: 7
@-------------------------------------------------------------------------------
@ The first word should be relocated to the code address in TEST2 section.
@ The second word should be relocated to the EHTAB entry in .ARM.extabTEST2
@ section.
@-------------------------------------------------------------------------------
@ CHECK: SectionData (
@ CHECK: 0000: 00000000 00000000 |........|
@ CHECK: )
@ CHECK: }
@ RELOC: Section {
@ RELOC: Name: .rel.ARM.exidxTEST2
@ RELOC: Relocations [
@ RELOC: 0x0 R_ARM_PREL31 TEST2 0x0
@ RELOC: 0x4 R_ARM_PREL31 .ARM.extabTEST2 0x0
@ RELOC: ]
@ RELOC: }
@-------------------------------------------------------------------------------
@ Check the symbols and the sections they belong to
@-------------------------------------------------------------------------------
@ CHECK: Symbols [
@ CHECK: Symbol {
@ CHECK: Name: func1
@ CHECK: Section: .TEST1 (0x4)
@ CHECK: }
@ CHECK: Symbol {
@ CHECK: Name: func2
@ CHECK: Section: TEST2 (0x7)
@ CHECK: }
@ CHECK: ]