Skip to content

Commit 419eb73

Browse files
Disable linker warning (earlephilhower#1114)
In arm-gnu-toolchain-12.2 we see this warning, that's not relevant to pico. Disable it. warning: blink.elf has a LOAD segment with RWX permissions Fixes earlephilhower#1029
1 parent 488bd66 commit 419eb73

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/rp2_common/pico_standard_link/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,20 @@ if (NOT TARGET pico_standard_link)
9494
target_compile_options(pico_standard_link INTERFACE -ffunction-sections -fdata-sections)
9595
target_link_options(pico_standard_link INTERFACE "LINKER:--gc-sections")
9696
endif()
97+
98+
# Ignore warnings about rwx segments introduced in binutils 2.39
99+
execute_process(COMMAND ${CMAKE_C_COMPILER} -print-prog-name=ld RESULT_VARIABLE RUN_C_RESULT OUTPUT_VARIABLE FULL_LD_PATH
100+
OUTPUT_STRIP_TRAILING_WHITESPACE)
101+
if (${RUN_C_RESULT} EQUAL 0)
102+
execute_process(COMMAND ${FULL_LD_PATH} --help RESULT_VARIABLE RUN_LD_RESULT OUTPUT_VARIABLE LD_HELP_OUTPUT
103+
OUTPUT_STRIP_TRAILING_WHITESPACE)
104+
if (${RUN_LD_RESULT} EQUAL 0)
105+
set(RWX_WARNING "no-warn-rwx-segments")
106+
string(FIND "${LD_HELP_OUTPUT}" "${RWX_WARNING}" LD_RWX_WARNING_SUPPORTED)
107+
if (${LD_RWX_WARNING_SUPPORTED} GREATER -1)
108+
target_link_options(pico_standard_link INTERFACE "LINKER:--${RWX_WARNING}")
109+
endif()
110+
endif()
111+
endif()
112+
97113
endif()

0 commit comments

Comments
 (0)