Skip to content

Commit 032f4d7

Browse files
committed
Add comment describing why 'unique,0' is needed
1 parent 6d41758 commit 032f4d7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler-rt/lib/builtins/assembly.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@
7373

7474
#if defined(__aarch64__) && defined(__ELF__) && \
7575
defined(COMPILER_RT_EXECUTE_ONLY_CODE)
76+
// The assembler always creates an implicit '.text' section with default flags
77+
// (SHF_ALLOC | SHF_EXECINSTR), which is incompatible with the execute-only
78+
// '.text' section we want to create here because of the missing
79+
// SHF_AARCH64_PURECODE section flag. To solve this, we use 'unique,0' to
80+
// differentiate the two sections. The output will therefore have two separate
81+
// sections named '.text', where code will be placed into the execute-only
82+
// '.text' section, and the implicitly-created one will be empty.
7683
#define TEXT_SECTION \
7784
.section .text,"axy",@progbits,unique,0
7885
#else

0 commit comments

Comments
 (0)