[llvm-dev] RFC: Re: MachO ARM assembly, why does the .set directive emit a NoDeadStrip symbol attribute for the symbol being defined?

Snider, Todd via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 2 10:27:48 PDT 2019


Given the following ARM asm source:


  .syntax unified
  .p2align 2

  .thumb
  .section .text.bar,"ax",%progbits
  .globl bar
  .type bar, %function
  .thumb_func
bar:
  mov     r3, r1
  mov     r1, r2
  mov     r2, r3
  bl      memset

  .globl foo
  .type foo, %function
  .set foo, bar

Note that when the file is assembled for MachO, the llvm back-end will set the NoDeadStrip flag on the symbol "foo".

This will cause the section that foo is defined in (.text.bar) to be retained in a link in which the assembled object file is a part, even if neither "foo" nor "bar" are referenced elsewhere in the linked application.

Why does the .set directive behave this way for MachO when there is an explicit asm directive, ".no_dead_strip," available to be used in assembly source?

~ Todd Snider
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190702/cb7c8c62/attachment.html>


More information about the llvm-dev mailing list