[PATCH 2/2] jail: elf: Remove MIPS 64 warning

Hauke Mehrtens hauke at hauke-m.de
Mon Nov 1 06:52:55 PDT 2021


The procd jails are working fine on MIPS64 too now.

I saw this error message when add_path_and_deps() was called which calls
elf_load_deps() again under some conditions. This is happening because
gcc_mips64_bug_work_around is stored in the data segment.

We have a call trace like this:
elf_load_deps()
  gcc_mips64_bug_work_around = 1;
  call add_path_and_deps()
    call elf_load_deps()
      gcc_mips64_bug_work_around = 1;
      error if gcc_mips64_bug_work_around =! 1
      gcc_mips64_bug_work_around = 0;
      return;
    return;
  error if gcc_mips64_bug_work_around =! 1
  return;

I got the same error messages on MIPS 32 BE, when I removed the compile
check.

This was tested in qemu on MIPS 64 BE and MIPS64 LE.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 jail/elf.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/jail/elf.c b/jail/elf.c
index 18a7b7c..176d046 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -235,11 +235,7 @@ int elf_load_deps(const char *path, const char *map)
 	unsigned long dyn_offset, dyn_size;
 	unsigned long load_offset, load_vaddr;
 	unsigned long interp_offset;
-#if defined(__mips__) && (__mips == 64)
-	static int gcc_mips64_bug_work_around;
 
-	gcc_mips64_bug_work_around = 1;
-#endif
 	if (elf_find_section(map, PT_LOAD, &load_offset, NULL, &load_vaddr)) {
 		ERROR("failed to load the .load section from %s\n", path);
 		return -1;
@@ -256,14 +252,6 @@ int elf_load_deps(const char *path, const char *map)
 
 	int clazz = map[EI_CLASS];
 
-#if defined(__mips__) && (__mips == 64)
-	if (gcc_mips64_bug_work_around != 1) {
-		ERROR("compiler bug: GCC for MIPS64 should be fixed!\n");
-		return -1;
-	}
-	gcc_mips64_bug_work_around = 0;
-#endif
-
 	if (clazz == ELFCLASS32)
 		return elf32_scan_dynamic(map, dyn_offset, dyn_size, load_vaddr - load_offset);
 	else if (clazz == ELFCLASS64)
-- 
2.30.2




More information about the openwrt-devel mailing list