]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - include/asm-generic/vmlinux.lds.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next
[mv-sheeva.git] / include / asm-generic / vmlinux.lds.h
index 6ad76bf5fb40dd03b03682fa561b943ad209650d..29ca8f53ffbe203fc00960e495fb39c3f959fc51 100644 (file)
  *     BSS_SECTION(0, 0, 0)
  *     _end = .;
  *
- *     /DISCARD/ : {
- *             EXIT_TEXT
- *             EXIT_DATA
- *             EXIT_CALL
- *     }
  *     STABS_DEBUG
  *     DWARF_DEBUG
+ *
+ *     DISCARDS                // must be the last
  * }
  *
  * [__init_begin, __init_end] is the init section that may be freed after init
@@ -91,7 +88,8 @@
 #endif
 
 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
-#define MCOUNT_REC()   VMLINUX_SYMBOL(__start_mcount_loc) = .; \
+#define MCOUNT_REC()   . = ALIGN(8);                           \
+                       VMLINUX_SYMBOL(__start_mcount_loc) = .; \
                        *(__mcount_loc)                         \
                        VMLINUX_SYMBOL(__stop_mcount_loc) = .;
 #else
        /* __*init sections */                                          \
        __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) {         \
                *(.ref.rodata)                                          \
-               MCOUNT_REC()                                            \
                DEV_KEEP(init.rodata)                                   \
                DEV_KEEP(exit.rodata)                                   \
                CPU_KEEP(init.rodata)                                   \
        MEM_DISCARD(init.data)                                          \
        KERNEL_CTORS()                                                  \
        *(.init.rodata)                                                 \
+       MCOUNT_REC()                                                    \
        DEV_DISCARD(init.rodata)                                        \
        CPU_DISCARD(init.rodata)                                        \
        MEM_DISCARD(init.rodata)
 #define INIT_RAM_FS
 #endif
 
+/*
+ * Default discarded sections.
+ *
+ * Some archs want to discard exit text/data at runtime rather than
+ * link time due to cross-section references such as alt instructions,
+ * bug table, eh_frame, etc.  DISCARDS must be the last of output
+ * section definitions so that such archs put those in earlier section
+ * definitions.
+ */
+#define DISCARDS                                                       \
+       /DISCARD/ : {                                                   \
+       EXIT_TEXT                                                       \
+       EXIT_DATA                                                       \
+       EXIT_CALL                                                       \
+       *(.discard)                                                     \
+       }
+
 /**
  * PERCPU_VADDR - define output section for percpu area
  * @vaddr: explicit base address (optional)