py/persistentcode: Remove remaining native qstr linking support.

Support for architecture-specific qstr linking was removed in
d4d53e9e11, where native code was changed to
access qstr values via qstr_table.  The only remaining use for the special
qstr link table in persistentcode.c is to support native module written in
C, linked via mpy_ld.py.  But native modules can also use the standard
module-level qstr_table (and obj_table) which was introduced in the .mpy
file reworking in f2040bfc7e.

This commit removes the remaining native qstr liking support in
persistentcode.c's load_raw_code function, and adds two new relocation
options for constants.qstr_table and constants.obj_table.  mpy_ld.py is
updated to use these relocations options instead of the native qstr link
table.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2022-05-26 10:51:29 +10:00
parent 2111ca0b8f
commit b37b578214
5 changed files with 56 additions and 96 deletions

View File

@@ -976,7 +976,6 @@ class RawCodeNative(RawCode):
kind,
fun_data,
prelude_offset,
qstr_links,
scope_flags,
n_pos_args,
type_sig,
@@ -989,7 +988,6 @@ class RawCodeNative(RawCode):
self.scope_flags = scope_flags
self.n_pos_args = n_pos_args
self.qstr_links = qstr_links
self.type_sig = type_sig
if config.native_arch in (
MP_NATIVE_ARCH_X86,
@@ -1196,15 +1194,6 @@ def read_raw_code(reader, cm_escaped_name, qstr_table, obj_table, segments):
rc = RawCodeBytecode(cm_escaped_name, qstr_table, obj_table, fun_data)
else:
# Create native raw code.
qstr_links = []
if kind in (MP_CODE_NATIVE_PY, MP_CODE_NATIVE_VIPER):
# Read qstr link table.
n_qstr_link = reader.read_uint()
for _ in range(n_qstr_link):
off = reader.read_uint()
qst = read_qstr(reader, segments)
qstr_links.append((off >> 2, off & 3, qst))
native_scope_flags = 0
native_n_pos_args = 0
native_type_sig = 0
@@ -1242,7 +1231,6 @@ def read_raw_code(reader, cm_escaped_name, qstr_table, obj_table, segments):
kind,
fun_data,
prelude_offset,
qstr_links,
native_scope_flags,
native_n_pos_args,
native_type_sig,