GP-6007: Updated NDS32 analyzer and elf relocation handler and test

fixups
This commit is contained in:
ghidorahrex
2025-09-22 14:37:16 +00:00
parent fa7c3b1fec
commit 71cd33572c
21 changed files with 671 additions and 842 deletions

View File

@@ -16,6 +16,14 @@
#include "pcode_test.h"
#include "big_struct.h"
#ifdef HAS_LIBC
#include <string.h>
#else
void *memset(void *b, int c, size_t len);
void *memcpy(void *dst, const void *src, size_t n);
int memcmp(const void *s1, const void *s2, size_t n);
#endif
static i4 int_expectedValue;
static i4 int_actualValue;

View File

@@ -47,12 +47,14 @@ pcodeTestDefaults.has_vector = 0
pcodeTestDefaults.small_build = 0
pcodeTestDefaults.ld_library_path = ''
pcodeTestDefaults.toolchain_type = 'gcc'
pcodeTestDefaults.compile_exe = 'bin/gcc'
pcodeTestDefaults.objdump_exe = 'bin/objdump'
pcodeTestDefaults.compile_exe = 'gcc'
pcodeTestDefaults.objdump_exe = 'objdump'
pcodeTestDefaults.objdump_option = ''
pcodeTestDefaults.readelf_exe = 'bin/readelf'
pcodeTestDefaults.nm_exe = 'bin/nm'
pcodeTestDefaults.strip_exe = 'bin/strip'
pcodeTestDefaults.readelf_exe = 'readelf'
pcodeTestDefaults.exec_dir = 'bin/'
pcodeTestDefaults.exec_prefix = ''
pcodeTestDefaults.nm_exe = 'nm'
pcodeTestDefaults.strip_exe = 'strip'
pcodeTestDefaults.variants = {'O0': '-O0', 'O3': '-O3'}
pcodeTestDefaults.proc_test = ''
pcodeTestDefaults.force = False

View File

@@ -436,7 +436,7 @@ PCodeTest({
'name': 'NDS32BE',
'build_all': 1,
'toolchain': 'NDS32/nds32be-elf',
'ccflags': '',
'ccflags': '-mbig-endian',
'cclibs': '-lgcc',
'language_id': 'NDS32:BE:32:default',
})
@@ -444,9 +444,20 @@ PCodeTest({
PCodeTest({
'name': 'NDS32LE',
'build_all': 1,
'toolchain': 'NDS32/nds32le-elf',
'toolchain': 'NDS32/nds32le-elf',#'NDS32/nds32le-linux-glibc-v5d',
'ccflags': '-mlittle-endian -EL',
'cclibs': '-lgcc',
'language_id': 'NDS32:LE:32:default',
})
PCodeTest({
'name': 'NDS32AS',
'build_all': 1,
'toolchain': 'NDS32/nds32le-elf-mculib-v3s',
'exec_prefix': 'nds32le-elf-',
'ccflags': '',
'cclibs': '-lgcc',
'gcc_version': '12.2.0',
'language_id': 'NDS32:LE:32:default',
})

View File

@@ -88,7 +88,13 @@ class PCodeTestBuild(BuildUtil):
def main(self):
# make sure compiler exists and runnable
self.config.compile_exe = self.config.exec_dir + self.config.exec_prefix + self.config.compile_exe
self.config.build_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.build_exe)
self.config.strip_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.strip_exe)
self.config.objdump_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.objdump_exe)
self.config.readelf_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.readelf_exe)
self.config.nm_exe = self.config.exec_dir + str(self.config.exec_prefix) + str(self.config.nm_exe)
if not self.is_executable_file(self.which('compile_exe')):
self.log_err(self.config.format('build the Toolchain before compilation'))
return
@@ -427,6 +433,7 @@ class PCodeBuildGCC(PCodeTestBuild):
self.set_library_path(self.config.ld_library_path)
# Construct the compile/link command line and execute it
cmp = self.which('compile_exe')
cmd = [cmp] + input_files + self.cflags(output_file) + [opt_cflag, '-B', self.dirname(cmp), '-o', output_file]
out, err = self.run(cmd)