cmake: Remove check_link_map.py
This script is looking for a hyperspecific error (mismatched padding
when linking into two simultaneous output sections) that bit us once,
in an era where the linker scripts were less unified. We haven't seen
it crop up since, and multiple platforms have changed the way they do
this anyway.
It's needless complexity. Junk it.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bc2dcd..b21bc7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1216,18 +1216,6 @@
set(GAP_FILL "--gap-fill;0xff")
endif()
-if(CONFIG_CHECK_LINK_MAP)
- list(APPEND
- post_build_commands
- COMMAND
- ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/check_link_map.py ${KERNEL_MAP_NAME}
- )
- list(APPEND
- post_build_byproducts
- ${KERNEL_MAP_NAME}
- )
-endif()
-
if(CONFIG_BUILD_OUTPUT_HEX)
list(APPEND
post_build_commands
diff --git a/Kconfig.zephyr b/Kconfig.zephyr
index e235c4d..18ed282 100644
--- a/Kconfig.zephyr
+++ b/Kconfig.zephyr
@@ -188,13 +188,6 @@
help
Code entry symbol, to be set at linking phase.
-config CHECK_LINK_MAP
- bool "Check linker map"
- default y
- help
- Run a linker address generation validity checker at the end of the
- build.
-
config LINKER_SORT_BY_ALIGNMENT
bool "Sort input sections by alignment"
default y
diff --git a/scripts/check_link_map.py b/scripts/check_link_map.py
deleted file mode 100755
index 1643fa9..0000000
--- a/scripts/check_link_map.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python3
-import fileinput
-import re
-import sys
-
-# Linker address generation validity checker. By default, GNU ld is
-# broken when faced with sections where the load address (i.e. the
-# spot in the XIP program binary where initialized data lives) differs
-# from the virtual address (i.e. the location in RAM where that data
-# will live at runtime. We need to be sure we're using the
-# ALIGN_WITH_INPUT feature correctly everywhere, which is hard --
-# especially so given that many of these bugs are semi-invisible at
-# runtime (most initialized data is still a bunch of zeros and often
-# "works" even if it's wrong).
-#
-# This quick test just checks the offsets between sequential segments
-# with separate VMA/LMA addresses and verifies that the size deltas
-# are identical.
-#
-# Note that this is assuming that the address generation is always
-# in-order and that there is only one "ROM" LMA block. It's possible
-# to write a valid linker script that will fail this script, but we
-# don't have such a use case and one isn't forseen.
-
-section_re = re.compile(r'(?x)' # (allow whitespace)
- r'^([a-zA-Z0-9_\.]+) \s+' # name
- r' (0x[0-9a-f]+) \s+' # addr
- r' (0x[0-9a-f]+)\s*') # size
-
-load_addr_re = re.compile('load address (0x[0-9a-f]+)')
-
-in_prologue = True
-lma = 0
-last_sec = None
-
-for line in fileinput.input():
- # Skip the header junk
- if line.find("Linker script and memory map") >= 0:
- in_prologue = False
- continue
-
- match = section_re.match(line.rstrip())
- if match:
- sec = match.group(1)
- vma = int(match.group(2), 16)
- size = int(match.group(3), 16)
-
- if sec == "bss":
- # Make sure we don't compare the last section of kernel data
- # with the first section of application data, the kernel's bss
- # and noinit are in between.
- last_sec = None
- continue
-
- lmatch = load_addr_re.search(line.rstrip())
- if lmatch:
- lma = int(lmatch.group(1), 16)
- else:
- last_sec = None
- continue
-
- if last_sec is not None:
- dv = vma - last_vma
- dl = lma - last_lma
- if dv != dl:
- sys.stderr.write("ERROR: section %s is %d bytes "
- "in the virtual/runtime address space, "
- "but only %d in the loaded/XIP section!\n"
- % (last_sec, dv, dl))
- sys.exit(1)
-
- last_sec = sec
- last_vma = vma
- last_lma = lma