[PATCH] D74927: [MC][ARM] make Thumb function also if type attribute is set

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 18:19:24 PST 2021


MaskRay added a comment.

Code LG. There are some test suggestions.



================
Comment at: llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp:597
+    unsigned Type = cast<MCSymbolELF>(Symbol)->getType();
+    if ((Type == ELF::STT_FUNC || Type == ELF::STT_GNU_IFUNC) &&
+        Symbol->isDefined())
----------------
Needs an ifunc test.

Defining ifunc is usually two lines

```
.type ifunc, %gnu_indirect_function
.set ifunc, resolver
```

For a STB_GLOBAL ifunc (common cases), add `.globl ifunc`


================
Comment at: llvm/test/MC/ARM/thumb-function-address.s:13
+@ CHECK:     Name: func_label (7)
+@ CHECK:     Value: 0x1
+@ CHECK:     Size: 0
----------------
After `Name:`, it is recommended to use `CHECK-NEXT:` to make sure the `Value:` matches the next line, not a faraway line which happens to have `Value: 0x1`.

```
CHECK:      Symbol {
CHECK:      Name: func_label
CHECK-NEXT:    Value: 0x1
```


================
Comment at: llvm/test/MC/ARM/thumb-function-address.s:20
+@ CHECK:   }
+
----------------
Please add another case suggested by Peter:

```
@@ Note: GNU as sets the value to 1.
.thumb
label:
bx lr
.arm
bx lr
.type label, %function
```
The value is 0 (1 in GNU as)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74927/new/

https://reviews.llvm.org/D74927



More information about the llvm-commits mailing list