From eebed210c5e62cfe0f9f8de4173099f2d32faae9 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Sun, 10 Jan 2016 11:42:28 +0100 Subject: UPSTREAM: scripts/sortextable: add support for ET_DYN binaries Add support to scripts/sortextable for handling relocatable (PIE) executables, whose ELF type is ET_DYN, not ET_EXEC. Other than adding support for the new type, no changes are needed. Signed-off-by: Ard Biesheuvel Signed-off-by: Catalin Marinas Bug: 30369029 Patchset: kaslr-arm64-4.4 (cherry picked from commit 7b957b6e603623ef8b2e8222fa94b976df613fa2) Signed-off-by: Jeff Vander Stoep Change-Id: If55296ef4934b99c38ceb5acbd7c4a7fb23f24c1 --- scripts/sortextable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/sortextable.c b/scripts/sortextable.c index c2423d913b46..ecefa0a634f8 100644 --- a/scripts/sortextable.c +++ b/scripts/sortextable.c @@ -266,9 +266,9 @@ do_file(char const *const fname) break; } /* end switch */ if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 - || r2(&ehdr->e_type) != ET_EXEC + || (r2(&ehdr->e_type) != ET_EXEC && r2(&ehdr->e_type) != ET_DYN) || ehdr->e_ident[EI_VERSION] != EV_CURRENT) { - fprintf(stderr, "unrecognized ET_EXEC file %s\n", fname); + fprintf(stderr, "unrecognized ET_EXEC/ET_DYN file %s\n", fname); fail_file(); } @@ -304,7 +304,7 @@ do_file(char const *const fname) if (r2(&ehdr->e_ehsize) != sizeof(Elf32_Ehdr) || r2(&ehdr->e_shentsize) != sizeof(Elf32_Shdr)) { fprintf(stderr, - "unrecognized ET_EXEC file: %s\n", fname); + "unrecognized ET_EXEC/ET_DYN file: %s\n", fname); fail_file(); } do32(ehdr, fname, custom_sort); @@ -314,7 +314,7 @@ do_file(char const *const fname) if (r2(&ghdr->e_ehsize) != sizeof(Elf64_Ehdr) || r2(&ghdr->e_shentsize) != sizeof(Elf64_Shdr)) { fprintf(stderr, - "unrecognized ET_EXEC file: %s\n", fname); + "unrecognized ET_EXEC/ET_DYN file: %s\n", fname); fail_file(); } do64(ghdr, fname, custom_sort); -- cgit v1.2.3 From 161994d19e72907ec95e545d1129675c9c966f1a Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 1 Jan 2016 15:02:12 +0100 Subject: UPSTREAM: arm64: switch to relative exception tables Instead of using absolute addresses for both the exception location and the fixup, use offsets relative to the exception table entry values. Not only does this cut the size of the exception table in half, it is also a prerequisite for KASLR, since absolute exception table entries are subject to dynamic relocation, which is incompatible with the sorting of the exception table that occurs at build time. This patch also introduces the _ASM_EXTABLE preprocessor macro (which exists on x86 as well) and its _asm_extable assembly counterpart, as shorthands to emit exception table entries. Acked-by: Will Deacon Signed-off-by: Ard Biesheuvel Signed-off-by: Catalin Marinas Bug: 30369029 Patchset: kaslr-arm64-4.4 (cherry picked from commit 6c94f27ac847ff8ef15b3da5b200574923bd6287) Signed-off-by: Jeff Vander Stoep Change-Id: Icedda8ee8c32843c439765783816d7d71ca0073a --- scripts/sortextable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/sortextable.c b/scripts/sortextable.c index ecefa0a634f8..19d83647846c 100644 --- a/scripts/sortextable.c +++ b/scripts/sortextable.c @@ -282,12 +282,12 @@ do_file(char const *const fname) case EM_386: case EM_X86_64: case EM_S390: + case EM_AARCH64: custom_sort = sort_relative_table; break; case EM_ARCOMPACT: case EM_ARCV2: case EM_ARM: - case EM_AARCH64: case EM_MICROBLAZE: case EM_MIPS: case EM_XTENSA: -- cgit v1.2.3 From 18a3ceeb5e7a8e88909014722d0b5be418aa2b1a Mon Sep 17 00:00:00 2001 From: Shashank Mittal Date: Fri, 10 Feb 2017 14:52:32 -0800 Subject: scripts: Makefile: add support to compile DT overlay blobs Add support to compile device tree overlay blob. 'dtbo-y' target can be used to specify DT overlay blob. '-obj' must be specified to list base and overlay blobs. Change-Id: Ib5036c70ba46374619cc43f9f7b697e1a444aebf Signed-off-by: Shashank Mittal --- scripts/Makefile.build | 5 +++++ scripts/Makefile.dtbo | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 scripts/Makefile.dtbo (limited to 'scripts') diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 01df30af4d4a..45473ca4290c 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -64,6 +64,11 @@ ifneq ($(hostprogs-y)$(hostprogs-m),) include scripts/Makefile.host endif +# Do not include host rules unless needed +ifneq ($(dtbo-y),) +include scripts/Makefile.dtbo +endif + ifneq ($(KBUILD_SRC),) # Create output directory if not already present _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) diff --git a/scripts/Makefile.dtbo b/scripts/Makefile.dtbo new file mode 100644 index 000000000000..db4a0f4b9a56 --- /dev/null +++ b/scripts/Makefile.dtbo @@ -0,0 +1,24 @@ +__dtbo := $(sort $(dtbo-y)) + +dtbo-base := $(sort $(foreach m,$(__dtbo),$($(m)-base))) +dtbo := $(foreach m,$(__dtbo),$(if $($(m)-base),$(m))) + +__dtbo := $(addprefix $(obj)/,$(__dtbo)) +dtbo-base := $(addprefix $(obj)/,$(dtbo-base)) +dtbo := $(addprefix $(obj)/,$(dtbo)) + +ifneq ($(DTC_OVERLAY_TEST_EXT),) +DTC_OVERLAY_TEST = $(DTC_OVERLAY_TEST_EXT) +quiet_cmd_dtbo_verify = VERIFY $@ +cmd_dtbo_verify = $(DTC_OVERLAY_TEST) $(addprefix $(obj)/,$($(@F)-base)) $@ $(dot-target).dtb +else +cmd_dtbo_verify = true +endif + +$(obj)/%.dtbo: $(src)/%.dts FORCE + $(call if_changed_dep,dtc) + $(call if_changed,dtbo_verify) + +$(call multi_depend, $(dtbo), , -base) + +always += $(dtbo) -- cgit v1.2.3 From 47c6fb9e6368a8f7bd7f4605e8e90e49c1732d02 Mon Sep 17 00:00:00 2001 From: Shashank Mittal Date: Fri, 10 Feb 2017 15:15:23 -0800 Subject: scripts: Makefile: add support to use external DTC Add support to use external DTC to compile device tree blobs. Change-Id: I268d2332d5328c3b0050b35c96f91e8ef9e1f6f8 Signed-off-by: Shashank Mittal --- scripts/Makefile.lib | 8 +++++++- scripts/dtc/Makefile | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 861a2acd8cba..46881f329561 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -287,10 +287,16 @@ cmd_dt_S_dtb= \ $(obj)/%.dtb.S: $(obj)/%.dtb $(call cmd,dt_S_dtb) +ifneq ($(DTC_EXT),) +DTC = $(DTC_EXT) +else +DTC = $(objtree)/scripts/dtc/dtc +endif + quiet_cmd_dtc = DTC $@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ - $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \ + $(DTC) -O dtb -o $@ -b 0 \ -i $(dir $<) $(DTC_FLAGS) \ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 2a48022c41e7..2eb4aec040f4 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile @@ -1,7 +1,9 @@ # scripts/dtc makefile hostprogs-y := dtc +ifeq ($(DTC_EXT),) always := $(hostprogs-y) +endif dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ srcpos.o checks.o util.o -- cgit v1.2.3 From 8eb24ae4dcd3e2b40a9b0f7ca585ff0dab2350c0 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Fri, 7 Apr 2017 15:22:19 -0700 Subject: UPSTREAM: checkpatch: special audit for revert commit line Currently checkpatch.pl does not recognize git's default commit revert message and will complain about the hash format. Add special audit for revert commit message line to fix it. Signed-off-by: Wei Wang Acked-by: Joe Perches Bug: 37158168 Test: checkpatch.pl --patch [diff] and no longer see failure Change-Id: I65cf9a46874621dd6d5c349d2d3ca3b862d61ba3 --- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2b3c22808c3b..e70147742cce 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2348,6 +2348,7 @@ sub process { # Check for git id commit length and improperly formed commit descriptions if ($in_commit_log && !$commit_log_possible_stack_dump && + $line !~ /^This reverts commit [0-9a-f]{7,40}/ && ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || ($line =~ /\b[0-9a-f]{12,40}\b/i && $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i && -- cgit v1.2.3