Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26050f60 authored by Minghao Wang's avatar Minghao Wang
Browse files

check_elf_file: Remove skip-bad-elf-magic

Make sure check_elf_file can detect invalid elf
files.
For non elf files, specify one of the following to
skip the elf check:
- Android.bp: check_elf_files: false
- Android.mk: LOCAL_CHECK_ELF_FILES := false

Bug: 425575177
Test: Presubmits
Change-Id: Ifb41c41ddeea7b883074c4b1ff80b155acb15c7a
parent ad4e88b1
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ $(check_elf_files_stamp): $(my_prebuilt_src_file) $(my_check_elf_file_shared_lib
	$(hide) mkdir -p $(dir $@)
	$(hide) rm -f $@
	$(hide) $(CHECK_ELF_FILE) \
	    --skip-bad-elf-magic \
	    --skip-unknown-elf-machine \
	    $(if $(PRIVATE_MAX_PAGE_SIZE),--max-page-size=$(PRIVATE_MAX_PAGE_SIZE)) \
	    $(if $(PRIVATE_SONAME),--soname $(PRIVATE_SONAME)) \
+4 −0
Original line number Diff line number Diff line
@@ -413,6 +413,10 @@ class Checker(object):
        sys.exit(0)
      else:
        self._error('File "{}" must have a valid ELF magic word.'.format(path))
        self._note()
        self._note('If the file is not an elf file, bypass this check with:')
        self._note('  Android.bp: check_elf_files: false,')
        self._note('  Android.mk: LOCAL_CHECK_ELF_FILES := false')
        sys.exit(2)
    except:
      self._error('An unknown error occurred while opening "{}".'.format(path))