Skip to content

Commit fa3e817

Browse files
define NO_EXEC_STACK_DIRECTIVE
1 parent a449c60 commit fa3e817

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

libc/src/__support/assembly.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- assembly.h - libc assembler support macros based on compiler-rt's -===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
#ifndef LLVM_LIBC_SRC___SUPPORT_ASSEMBLY_H
9+
#define LLVM_LIBC_SRC___SUPPORT_ASSEMBLY_H
10+
11+
#ifndef __ASSEMBLER__
12+
#error "No not include assembly.h in non-asm sources"
13+
#endif
14+
15+
#if defined(ELF) && (defined(__GNU__) || defined(__FreeBSD__) || \
16+
defined(__Fuchsia__) || defined(__linux__))
17+
#define NO_EXEC_STACK_DIRECTIVE .section.note.GNU - stack, "", % progbits
18+
#else
19+
#define NO_EXEC_STACK_DIRECTIVE
20+
#endif
21+
22+
#endif // LLVM_LIBC_SRC___SUPPORT_ASSEMBLY_H

libc/src/setjmp/x86_64/setjmp.S

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "src/__support/assembly.h"
10+
911
#define paste(ns) _ZN22 ## ns ## 6setjmpEP9__jmp_buf
1012
#define expand(x) paste(x)
1113
#define LIBC_NAMESPACE_setjump expand(LIBC_NAMESPACE)
@@ -47,4 +49,4 @@ LIBC_NAMESPACE_setjump:
4749
.size setjump, . - setjump
4850
.size LIBC_NAMESPACE_setjump, . - LIBC_NAMESPACE_setjump
4951

50-
.section .note.GNU-stack, "", @progbits
52+
NO_EXEC_STACK_DIRECTIVE

0 commit comments

Comments
 (0)