diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-03-22 19:26:18 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-03-22 19:26:18 +0000 |
commit | 7afe0000f60335bc50d19802bdb19b1196de720e (patch) | |
tree | e23da17abce833acac38b192a11db8cad2666156 /test/MC/ARM | |
parent | 0d277ab1bad4af37ffeb8110d6bbc84f4f0a905b (diff) |
ARM IAS: properly handle function entries in .thumb
When a label is parsed, check if there is type information available for the
label. If so, check if the symbol is a function. If the symbol is a function
and we are in thumb mode and no explicit thumb_func has been emitted, adjust the
symbol data to indicate that the function definition is a thumb function.
The application of this inferencing is improved value handling in the object
file (the required thumb bit is set on symbols which are thumb functions). It
also helps improve compatibility with binutils.
The one complication that arises from this handling is the MCAsmStreamer. The
default implementation of getOrCreateSymbolData in MCStreamer does not support
tracking the symbol data. In order to support the semantics of thumb functions,
track symbol data in assembly streamer. Although O(n) in number of labels in
the TU, this is already done in various other streamers and as such the memory
overhead is not a practical concern in this scenario.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204544 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/ARM')
-rw-r--r-- | test/MC/ARM/thumb-types.s | 82 | ||||
-rw-r--r-- | test/MC/ARM/thumb_set.s | 3 |
2 files changed, 83 insertions, 2 deletions
diff --git a/test/MC/ARM/thumb-types.s b/test/MC/ARM/thumb-types.s new file mode 100644 index 00000000000..2fd71525bab --- /dev/null +++ b/test/MC/ARM/thumb-types.s @@ -0,0 +1,82 @@ +@ RUN: llvm-mc -triple armv7-elf -filetype obj -o - %s | llvm-readobj -t \ +@ RUN: | FileCheck %s + + .syntax unified + + .thumb + + .type implicit_function,%function +implicit_function: + nop + + .type implicit_data,%object +implicit_data: + .long 0 + + .arm + .type arm_function,%function +arm_function: + nop + + .thumb + + .text + +untyped_text_label: + nop + + .type explicit_function,%function +explicit_function: + nop + + .data + +untyped_data_label: + nop + + .type explicit_data,%object +explicit_data: + .long 0 + +@ CHECK: Symbol { +@ CHECK: Name: arm_function +@ CHECK: Value: 0x6 +@ CHECK: Type: Function +@ CHECK: } + +@ CHECK: Symbol { +@ CHECK: Name: explicit_data +@ CHECK: Value: 0x2 +@ CHECK: Type: Object +@ CHECK: } + +@ CHECK: Symbol { +@ CHECK: Name: explicit_function +@ CHECK: Value: 0xD +@ CHECK: Type: Function +@ CHECK: } + +@ CHECK: Symbol { +@ CHECK: Name: implicit_data +@ CHECK: Value: 0x2 +@ CHECK: Type: Object +@ CHECK: } + +@ CHECK: Symbol { +@ CHECK: Name: implicit_function +@ CHECK: Value: 0x1 +@ CHECK: Type: Function +@ CHECK: } + +@ CHECK: Symbol { +@ CHECK: Name: untyped_data_label +@ CHECK: Value: 0x0 +@ CHECK: Type: None +@ CHECK: } + +@ CHECK: Symbol { +@ CHECK: Name: untyped_text_label +@ CHECK: Value: 0xA +@ CHECK: Type: None +@ CHECK: } + diff --git a/test/MC/ARM/thumb_set.s b/test/MC/ARM/thumb_set.s index 7381a98134d..d0bc9858ddc 100644 --- a/test/MC/ARM/thumb_set.s +++ b/test/MC/ARM/thumb_set.s @@ -79,8 +79,7 @@ beta: @ CHECK: Symbol { @ CHECK: Name: alpha -@ CHECK: Value: 0x6 -@ XFAIL-CHECK: Value: 0x7 +@ CHECK: Value: 0x7 @ CHECK: Type: Function @ CHECK: } |