Evian
Evian

Reputation: 1207

assembly -- difference between `.text` and `.section __TEXT` on macOS?

When writing assembly codes manually on macOS, .section .text will lead to "unexpected token in '.section' directive" error, and to fix is to remove .section token.

But when I generate assembly codes via clang like clang xxxx.cpp -S, it turns out something like

.section    __TEXT,__text,regular,pure_instructions

What is the difference between these two ways?

Upvotes: 2

Views: 2095

Answers (1)

Evian
Evian

Reputation: 1207

I finally figure out. According to apple's doc OS X Assembler Reference, directive .text is section (__TEXT,__text)

Upvotes: 2

Related Questions