Skip to content

Commit 593cdd9

Browse files
committed
Force removal of .note.GNU-stack section
Also use INSERT in linker scripts to allow multiple scripts to work together.
1 parent 92f91af commit 593cdd9

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Diff for: CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,15 @@ add_custom_command(
111111
-no-pie
112112
-Wl,-r
113113
${rust_ldscript}
114+
-Wl,-T ${CMAKE_CURRENT_SOURCE_DIR}/gnu-stack.ld
114115
-Wl,--whole-archive ${rust_staticlib}
115116
-Wl,--no-whole-archive $<TARGET_OBJECTS:rust_c>
116117
-o ${rust_obj}
117-
DEPENDS ${rust_staticlib} $<TARGET_OBJECTS:rust_c>
118+
DEPENDS
119+
${rust_staticlib}
120+
$<TARGET_OBJECTS:rust_c>
121+
${CMAKE_CURRENT_SOURCE_DIR}/rust-smem.ld
122+
${CMAKE_CURRENT_SOURCE_DIR}/gnu-stack.ld
118123
COMMAND_EXPAND_LISTS
119124
)
120125
add_custom_target(rust_final DEPENDS ${rust_obj})

Diff for: gnu-stack.ld

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SECTIONS
2+
{
3+
/DISCARD/ : { *(.note.GNU-stack) }
4+
} INSERT AFTER .text;

Diff for: rust-smem.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ SECTIONS
22
{
33
data_smem_rust_std_partition_data : { *librust_app.a:*(.data .data.*) }
44
data_smem_rust_std_partition_bss : { *librust_app.a:*(.bss .bss.* COMMON COMMON.*) }
5-
}
5+
} INSERT BEFORE .data;

0 commit comments

Comments
 (0)