arm64: extable: sort the exception table at build time
authorWill Deacon <will.deacon@arm.com>
Wed, 8 May 2013 16:29:24 +0000 (17:29 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 15 May 2014 18:59:53 +0000 (19:59 +0100)
As is done for other architectures, sort the exception table at
build-time rather than during boot.

Since sortextable appears to be a standalone C program relying on the
host elf.h to provide EM_AARCH64, I've had to add a conditional check in
order to allow cross-compilation on machines that aren't running a
bleeding-edge libc-dev.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit adace89562c7a9645b8dc84f6e1ac7ba8756094e)
Signed-off-by: Mark Brown <broonie@linaro.org>
arch/arm64/Kconfig
arch/arm64/kernel/vmlinux.lds.S
scripts/sortextable.c

index 308a55636f76c1bde5d445d619dd52bafd20215e..7f553338d109d45fbf7747dbc63dc0d65a06d021 100644 (file)
@@ -7,6 +7,7 @@ config ARM64
        select ARM_AMBA
        select ARM_ARCH_TIMER
        select ARM_GIC
+       select BUILDTIME_EXTABLE_SORT
        select CLONE_BACKWARDS
        select COMMON_CLK
        select GENERIC_CLOCKEVENTS
index 3fae2be8b01687a89f12ef87b9a1ae13fa6ab478..5e06a1786e267db73909916b39382835ebfff5a0 100644 (file)
@@ -56,7 +56,7 @@ SECTIONS
        }
 
        RO_DATA(PAGE_SIZE)
-
+       EXCEPTION_TABLE(8)
        _etext = .;                     /* End of text and rodata section */
 
        . = ALIGN(PAGE_SIZE);
@@ -98,14 +98,6 @@ SECTIONS
                CACHELINE_ALIGNED_DATA(64)
                READ_MOSTLY_DATA(64)
 
-               /*
-                * The exception fixup table (might need resorting at runtime)
-                */
-               . = ALIGN(32);
-               __start___ex_table = .;
-               *(__ex_table)
-               __stop___ex_table = .;
-
                /*
                 * and the usual data section
                 */
index 1f10e89d15b4d03a07523e6c89482b5b0edfdc3d..f9ce1160419be2a81b7dabf097fc453fdb1ce9c3 100644 (file)
 #include <tools/be_byteshift.h>
 #include <tools/le_byteshift.h>
 
+#ifndef EM_AARCH64
+#define EM_AARCH64     183
+#endif
+
 static int fd_map;     /* File descriptor for file being modified. */
 static int mmap_failed; /* Boolean flag. */
 static void *ehdr_curr; /* current ElfXX_Ehdr *  for resource cleanup */
@@ -249,6 +253,7 @@ do_file(char const *const fname)
                custom_sort = sort_relative_table;
                break;
        case EM_ARM:
+       case EM_AARCH64:
        case EM_MIPS:
                break;
        }  /* end switch */