In linux kernel in the implementation of spinlocks, e.g. http://lxr.linux.no/#linux+v2.6.18/include/asm-i386/semaphore.h#L97
97static inline void down(struct semaphore * sem)
98{
99 might_sleep();
100 __asm__ __volatile__(
101 "# atomic down operation
"
102 LOCK_PREFIX "decl %0
" /* --sem->count */
103 "js 2f
"
104 "1:
"
105 LOCK_SECTION_START("")
106 "2: lea %0,%%eax
"
107 "call __down_failed
"
108 "jmp 1b
"
109 LOCK_SECTION_END
110 :"+m" (sem->count)
111 :
112 :"memory","ax");
113}
LOCK_SECTION_START and LOCK_SECTION_END are used. They are defined in http://lxr.linux.no/#linux+v2.6.18/include/linux/spinlock.h#L63 as
61#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME
62
63#define LOCK_SECTION_START(extra)
64 ".subsection 1
"
65 extra
66 ".ifndef " LOCK_SECTION_NAME "
"
67 LOCK_SECTION_NAME ":
"
68 ".endif
"
69
70#define LOCK_SECTION_END
71 ".previous
"
So all locked operations are partly putted in subsection 1
or section .text.lock.SMTH_STRING.
What reason is for it?