]> git.hungrycats.org Git - linux/commitdiff
[PATCH] text.lock -> subsection changes.
authorDave Jones <davej@suse.de>
Fri, 8 Feb 2002 09:43:23 +0000 (01:43 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Fri, 8 Feb 2002 09:43:23 +0000 (01:43 -0800)
Make spinlocks etc use subsections of their parent sections instead of
an ELF section of their own - needed for newer binutils when the parent
sector is removed.

25 files changed:
Makefile
Rules.make
arch/cris/cris.ld
arch/i386/boot/compressed/Makefile
arch/i386/kernel/head.S
arch/i386/vmlinux.lds
arch/ia64/sn/fprom/Makefile
arch/ia64/tools/Makefile
arch/m68k/vmlinux-sun3.lds
arch/m68k/vmlinux.lds
arch/s390/vmlinux-shared.lds
arch/s390/vmlinux.lds
arch/s390x/vmlinux-shared.lds
arch/s390x/vmlinux.lds
arch/sh/vmlinux.lds.S
include/asm-i386/rwlock.h
include/asm-i386/rwsem.h
include/asm-i386/semaphore.h
include/asm-i386/softirq.h
include/asm-i386/spinlock.h
include/asm-m68k/semaphore.h
include/asm-parisc/semaphore.h
include/asm-parisc/spinlock.h
include/linux/spinlock.h
include/linux/stringify.h [new file with mode: 0644]

index 6fd5a64723a4f53f3b75d2ab76df4a06eea9b34e..0c46ea51a0328c901832f2b8c05dec5f932da08d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -332,11 +332,13 @@ include/linux/version.h: ./Makefile
        @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
        @mv -f .ver $@
 
+comma  := ,
+
 init/version.o: init/version.c include/linux/compile.h include/config/MARKER
-       $(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
+       $(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o init/version.o init/version.c
 
 init/main.o: init/main.c include/config/MARKER
-       $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $<
+       $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $*.o $<
 
 init/do_mounts.o: init/do_mounts.c include/config/MARKER
        $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $<
index d792a5cbaa6633a97dd08d415b7d8d3d948c549c..69af52710ea3296496a024361ed01972204f1727 100644 (file)
@@ -31,6 +31,8 @@ unexport subdir-m
 unexport subdir-n
 unexport subdir-
 
+comma  := ,
+
 #
 # Get things started.
 #
@@ -54,7 +56,7 @@ ALL_SUB_DIRS  := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
        $(CPP) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) $< > $@
 
 %.o: %.c
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $<
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -c -o $@ $<
        @ ( \
            echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@))))' ; \
            echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
@@ -270,7 +272,7 @@ endif # CONFIG_MODVERSIONS
 
 ifneq "$(strip $(export-objs))" ""
 $(export-objs): $(export-objs:.o=.c) $(TOPDIR)/include/linux/modversions.h
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c)
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c)
        @ ( \
            echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB)),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB)))' ; \
            echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
index d0d2af1f80471900f2e34d71042e49203108f3c3..f62b467f6be5f305e5174c8f70ea12487ab94c12 100644 (file)
@@ -24,7 +24,6 @@ SECTIONS
                *(.fixup)
                *(.text.__*)
        }
-       .text.lock : { *(.text.lock) }        /* out-of-line lock text */
 
        _etext = . ;                  /* End of text section */ 
        __etext = .;
index 22327769346f6b9cb60f8580bf4d83f737fd628c..e323873c4b261003168c22cf7f76677ff0047898 100644 (file)
@@ -32,8 +32,10 @@ bvmlinux: piggy.o $(OBJECTS)
 head.o: head.S
        $(CC) $(AFLAGS) -traditional -c head.S
 
+comma  := ,
+
 misc.o: misc.c
-       $(CC) $(CFLAGS) -c misc.c
+       $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c misc.c
 
 piggy.o:       $(SYSTEM)
        tmppiggy=_tmp_$$$$piggy; \
index 02e19533cdb8eedd9e9121ef79ee2eecfc6e2a2d..77d0323aa7e9e3dd439387b341afaf66218ce01f 100644 (file)
@@ -456,12 +456,3 @@ ENTRY(gdt_table)
        .quad 0x0000000000000000        /* 0x98 not used */
        /* Per CPU segments */
        .fill NR_CPUS*4,8,0             /* space for TSS's and LDT's */
-               
-/*
- * This is to aid debugging, the various locking macros will be putting
- * code fragments here.  When an oops occurs we'd rather know that it's
- * inside the .text.lock section rather than as some offset from whatever
- * function happens to be last in the .text segment.
- */
-.section .text.lock
-ENTRY(stext_lock)
index 1a7da033d8a3167107a3daca16b37ec4208b64a2..cd994f0b9b058aebabc2b6bbb4fe44982a736867 100644 (file)
@@ -13,7 +13,6 @@ SECTIONS
        *(.fixup)
        *(.gnu.warning)
        } = 0x9090
-  .text.lock : { *(.text.lock) }       /* out-of-line lock text */
 
   _etext = .;                  /* End of text section */
 
index 0b2b212ab12e8ae0b6a69c88d76e3c0f071786a9..4113f066672a56acab5f301074eed712056547af 100644 (file)
@@ -18,10 +18,12 @@ obj-y=fprom
 fprom: $(OBJ)
        $(LD) -static -Tfprom.lds -o fprom $(OBJ) $(LIB)
 
+comma  := ,
+
 .S.o:
        $(CC)  -D__ASSEMBLY__ $(AFLAGS) $(AFLAGS_KERNEL) -c -o $*.o $<
 .c.o:
-       $(CC)  $(CFLAGS) $(CFLAGS_KERNEL) -c -o $*.o $<
+       $(CC)  $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_KERNEL) -c -o $*.o $<
 
 clean:
        rm -f *.o fprom
index f98e2d1f35ce886ee9c491d04221c466ca149109..cdfa56f32b9d0f38d614c899c30b6701085de177 100644 (file)
@@ -31,8 +31,10 @@ ifeq ($(CROSS_COMPILE),)
 offsets.h: print_offsets
        ./print_offsets > offsets.h
 
+comma  := ,
+
 print_offsets: print_offsets.c FORCE_RECOMPILE
-       $(CC) $(CFLAGS) print_offsets.c -o $@
+       $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) print_offsets.c -o $@
 
 FORCE_RECOMPILE:
 
@@ -42,7 +44,7 @@ offsets.h: print_offsets.s
        $(AWK) -f print_offsets.awk $^ > $@
 
 print_offsets.s: print_offsets.c
-       $(CC) $(CFLAGS) -S print_offsets.c -o $@
+       $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -S print_offsets.c -o $@
 
 endif
 
index 164b11ac48e5175ff858c82a5593e18f302d7f35..7894d47f43c9fdfd110700054311cb3a45fa0649 100644 (file)
@@ -10,7 +10,6 @@ SECTIONS
        *(.head)
        *(.text)
        *(.fixup)
-       *(.text.lock)           /* out-of-line lock text */
        *(.gnu.warning)
        } = 0x4e75
   .kstrtab : { *(.kstrtab) }
index 3b9eb25b52843314356fde5b169c50135c8f70a4..aea08a896651dd244c97a6c7ca61ba65c54f942f 100644 (file)
@@ -9,7 +9,6 @@ SECTIONS
   .text : {
        *(.text)
        *(.fixup)
-       *(.text.lock)           /* out-of-line lock text */
        *(.gnu.warning)
        } = 0x4e75
   .rodata : { *(.rodata) *(.rodata.*) }
index 4956b7c7eab4b746fb9b2691ba44d08896b70886..ad325713d4a8de460c042c1fdabd09177733e2bd 100644 (file)
@@ -13,7 +13,6 @@ SECTIONS
        *(.fixup)
        *(.gnu.warning)
        } = 0x0700
-  .text.lock : { *(.text.lock) }       /* out-of-line lock text */
   .rodata : { *(.rodata) }
   .kstrtab : { *(.kstrtab) }
 
index 1b53d5bafafe017dfa63d246c433e544889546b8..c1dd3aec050c989dbb0a54ef407c09aff916f5b1 100644 (file)
@@ -13,7 +13,6 @@ SECTIONS
        *(.fixup)
        *(.gnu.warning)
        } = 0x0700
-  .text.lock : { *(.text.lock) }       /* out-of-line lock text */
   .rodata : { *(.rodata) *(.rodata.*) }
   .kstrtab : { *(.kstrtab) }
 
index 8f6d74e69247e43f5b6c090b18dc0d20df4d8c2b..1d22a5ec5aeb19534bfcf4967af18b085829989b 100644 (file)
@@ -13,7 +13,6 @@ SECTIONS
        *(.fixup)
        *(.gnu.warning)
        } = 0x0700
-  .text.lock : { *(.text.lock) }       /* out-of-line lock text */
   .rodata : { *(.rodata) }
   .kstrtab : { *(.kstrtab) }
 
index 2cc3355c8a27ea94760097a6480e86d4d8c656e1..f3e7b069a5f3bbc0f5ef115b9c9a6da3adb4f105 100644 (file)
@@ -13,7 +13,6 @@ SECTIONS
        *(.fixup)
        *(.gnu.warning)
        } = 0x0700
-  .text.lock : { *(.text.lock) }       /* out-of-line lock text */
   .rodata : { *(.rodata) *(.rodata.*) }
   .kstrtab : { *(.kstrtab) }
 
index fcbc7bd32c9c772dbb4e6c89cac357ecacfbbfad..0620024f6d013e3c738e298dd1e070ea0976da9d 100644 (file)
@@ -23,7 +23,6 @@ SECTIONS
        *(.fixup)
        *(.gnu.warning)
        } = 0x0009
-  .text.lock : { *(.text.lock) }       /* out-of-line lock text */
   .rodata : { *(.rodata) *(.rodata.*) }
   .kstrtab : { *(.kstrtab) }
 
index 9475419f9509f1a7d24ad027d719a8ca9a820c84..5c2f47040f9caf41a6b1bb7ce26027e7bc3b777d 100644 (file)
        asm volatile(LOCK "subl $1,(%0)\n\t" \
                     "js 2f\n" \
                     "1:\n" \
-                    ".section .text.lock,\"ax\"\n" \
+                    LOCK_SECTION_START("") \
                     "2:\tcall " helper "\n\t" \
                     "jmp 1b\n" \
-                    ".previous" \
+                    LOCK_SECTION_END \
                     ::"a" (rw) : "memory")
 
 #define __build_read_lock_const(rw, helper)   \
        asm volatile(LOCK "subl $1,%0\n\t" \
                     "js 2f\n" \
                     "1:\n" \
-                    ".section .text.lock,\"ax\"\n" \
+                    LOCK_SECTION_START("") \
                     "2:\tpushl %%eax\n\t" \
                     "leal %0,%%eax\n\t" \
                     "call " helper "\n\t" \
                     "popl %%eax\n\t" \
                     "jmp 1b\n" \
-                    ".previous" \
+                    LOCK_SECTION_END \
                     :"=m" (*(volatile int *)rw) : : "memory")
 
 #define __build_read_lock(rw, helper)  do { \
        asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
                     "jnz 2f\n" \
                     "1:\n" \
-                    ".section .text.lock,\"ax\"\n" \
+                    LOCK_SECTION_START("") \
                     "2:\tcall " helper "\n\t" \
                     "jmp 1b\n" \
-                    ".previous" \
+                    LOCK_SECTION_END \
                     ::"a" (rw) : "memory")
 
 #define __build_write_lock_const(rw, helper) \
        asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
                     "jnz 2f\n" \
                     "1:\n" \
-                    ".section .text.lock,\"ax\"\n" \
+                    LOCK_SECTION_START("") \
                     "2:\tpushl %%eax\n\t" \
                     "leal %0,%%eax\n\t" \
                     "call " helper "\n\t" \
                     "popl %%eax\n\t" \
                     "jmp 1b\n" \
-                    ".previous" \
+                    LOCK_SECTION_END \
                     :"=m" (*(volatile int *)rw) : : "memory")
 
 #define __build_write_lock(rw, helper) do { \
index 0d416f7aefb561f5e2172c1fef44a890a98b19ee..3cac1427238062d00c1cebf902432821de7a0c0b 100644 (file)
@@ -101,7 +101,7 @@ static inline void __down_read(struct rw_semaphore *sem)
 LOCK_PREFIX    "  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value */
                "  js        2f\n\t" /* jump if we weren't granted the lock */
                "1:\n\t"
-               ".section .text.lock,\"ax\"\n"
+               LOCK_SECTION_START("")
                "2:\n\t"
                "  pushl     %%ecx\n\t"
                "  pushl     %%edx\n\t"
@@ -109,7 +109,7 @@ LOCK_PREFIX "  incl      (%%eax)\n\t" /* adds 0x00000001, returns the old value
                "  popl      %%edx\n\t"
                "  popl      %%ecx\n\t"
                "  jmp       1b\n"
-               ".previous"
+               LOCK_SECTION_END
                "# ending down_read\n\t"
                : "+m"(sem->count)
                : "a"(sem)
@@ -130,13 +130,13 @@ LOCK_PREFIX       "  xadd      %0,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old
                "  testl     %0,%0\n\t" /* was the count 0 before? */
                "  jnz       2f\n\t" /* jump if we weren't granted the lock */
                "1:\n\t"
-               ".section .text.lock,\"ax\"\n"
+               LOCK_SECTION_START("")
                "2:\n\t"
                "  pushl     %%ecx\n\t"
                "  call      rwsem_down_write_failed\n\t"
                "  popl      %%ecx\n\t"
                "  jmp       1b\n"
-               ".previous\n"
+               LOCK_SECTION_END
                "# ending down_write"
                : "+d"(tmp), "+m"(sem->count)
                : "a"(sem)
@@ -154,7 +154,7 @@ static inline void __up_read(struct rw_semaphore *sem)
 LOCK_PREFIX    "  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
                "  js        2f\n\t" /* jump if the lock is being waited upon */
                "1:\n\t"
-               ".section .text.lock,\"ax\"\n"
+               LOCK_SECTION_START("")
                "2:\n\t"
                "  decw      %%dx\n\t" /* do nothing if still outstanding active readers */
                "  jnz       1b\n\t"
@@ -162,7 +162,7 @@ LOCK_PREFIX "  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old valu
                "  call      rwsem_wake\n\t"
                "  popl      %%ecx\n\t"
                "  jmp       1b\n"
-               ".previous\n"
+               LOCK_SECTION_END
                "# ending __up_read\n"
                : "+m"(sem->count), "+d"(tmp)
                : "a"(sem)
@@ -180,7 +180,7 @@ static inline void __up_write(struct rw_semaphore *sem)
 LOCK_PREFIX    "  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */
                "  jnz       2f\n\t" /* jump if the lock is being waited upon */
                "1:\n\t"
-               ".section .text.lock,\"ax\"\n"
+               LOCK_SECTION_START("")
                "2:\n\t"
                "  decw      %%dx\n\t" /* did the active count reduce to 0? */
                "  jnz       1b\n\t" /* jump back if not */
@@ -188,7 +188,7 @@ LOCK_PREFIX "  xaddl     %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 ->
                "  call      rwsem_wake\n\t"
                "  popl      %%ecx\n\t"
                "  jmp       1b\n"
-               ".previous\n"
+               LOCK_SECTION_END
                "# ending __up_write\n"
                : "+m"(sem->count)
                : "a"(sem), "i"(-RWSEM_ACTIVE_WRITE_BIAS)
index 76c738e7357cfe96db5d8adb17f0323bff0ccafe..a0ce1b8dba69ad9167039901372027c897a228f7 100644 (file)
@@ -122,10 +122,10 @@ static inline void down(struct semaphore * sem)
                LOCK "decl %0\n\t"     /* --sem->count */
                "js 2f\n"
                "1:\n"
-               ".section .text.lock,\"ax\"\n"
+               LOCK_SECTION_START("")
                "2:\tcall __down_failed\n\t"
                "jmp 1b\n"
-               ".previous"
+               LOCK_SECTION_END
                :"=m" (sem->count)
                :"c" (sem)
                :"memory");
@@ -149,10 +149,10 @@ static inline int down_interruptible(struct semaphore * sem)
                "js 2f\n\t"
                "xorl %0,%0\n"
                "1:\n"
-               ".section .text.lock,\"ax\"\n"
+               LOCK_SECTION_START("")
                "2:\tcall __down_failed_interruptible\n\t"
                "jmp 1b\n"
-               ".previous"
+               LOCK_SECTION_END
                :"=a" (result), "=m" (sem->count)
                :"c" (sem)
                :"memory");
@@ -177,10 +177,10 @@ static inline int down_trylock(struct semaphore * sem)
                "js 2f\n\t"
                "xorl %0,%0\n"
                "1:\n"
-               ".section .text.lock,\"ax\"\n"
+               LOCK_SECTION_START("")
                "2:\tcall __down_failed_trylock\n\t"
                "jmp 1b\n"
-               ".previous"
+               LOCK_SECTION_END
                :"=a" (result), "=m" (sem->count)
                :"c" (sem)
                :"memory");
@@ -203,10 +203,11 @@ static inline void up(struct semaphore * sem)
                LOCK "incl %0\n\t"     /* ++sem->count */
                "jle 2f\n"
                "1:\n"
-               ".section .text.lock,\"ax\"\n"
+               LOCK_SECTION_START("")
                "2:\tcall __up_wakeup\n\t"
                "jmp 1b\n"
-               ".previous"
+               LOCK_SECTION_END
+               ".subsection 0\n"
                :"=m" (sem->count)
                :"c" (sem)
                :"memory");
index 254224411bced5ad13f1657c066c2d2f19ce2bb9..b9f7796b296dcb153d59390c0b25bb5860c82e07 100644 (file)
@@ -33,12 +33,12 @@ do {                                                                        \
                        "jnz 2f;"                                       \
                        "1:;"                                           \
                                                                        \
-                       ".section .text.lock,\"ax\";"                   \
+                       LOCK_SECTION_START("")                          \
                        "2: pushl %%eax; pushl %%ecx; pushl %%edx;"     \
                        "call %c1;"                                     \
                        "popl %%edx; popl %%ecx; popl %%eax;"           \
                        "jmp 1b;"                                       \
-                       ".previous;"                                    \
+                       LOCK_SECTION_END                                \
                                                                        \
                : /* no output */                                       \
                : "r" (ptr), "i" (do_softirq)                           \
index dbdd68b41bd97906b79b6d3060dce709a0befda7..89118fced025bd9adb72eaa7bf45d29f8e128641 100644 (file)
@@ -56,13 +56,13 @@ typedef struct {
        "\n1:\t" \
        "lock ; decb %0\n\t" \
        "js 2f\n" \
-       ".section .text.lock,\"ax\"\n" \
+       LOCK_SECTION_START("") \
        "2:\t" \
        "cmpb $0,%0\n\t" \
        "rep;nop\n\t" \
        "jle 2b\n\t" \
        "jmp 1b\n" \
-       ".previous"
+       LOCK_SECTION_END
 
 /*
  * This works. Despite all the confusion.
index 4acf48cda6adfea96eaf88a6dcdc2e99977eea4d..8581f361c52df508cbfa160de54a1a63c538e11f 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/wait.h>
 #include <linux/spinlock.h>
 #include <linux/rwsem.h>
+#include <linux/stringify.h>
 
 #include <asm/system.h>
 #include <asm/atomic.h>
@@ -94,11 +95,10 @@ extern inline void down(struct semaphore * sem)
                "subql #1,%0@\n\t"
                "jmi 2f\n\t"
                "1:\n"
-               ".section .text.lock,\"ax\"\n"
-               ".even\n"
+               LOCK_SECTION_START(".even\n\t")
                "2:\tpea 1b\n\t"
                "jbra __down_failed\n"
-               ".previous"
+               LOCK_SECTION_END
                : /* no outputs */
                : "a" (sem1)
                : "memory");
@@ -119,11 +119,10 @@ extern inline int down_interruptible(struct semaphore * sem)
                "jmi 2f\n\t"
                "clrl %0\n"
                "1:\n"
-               ".section .text.lock,\"ax\"\n"
-               ".even\n"
+               LOCK_SECTION_START(".even\n\t")
                "2:\tpea 1b\n\t"
                "jbra __down_failed_interruptible\n"
-               ".previous"
+               LOCK_SECTION_END
                : "=d" (result)
                : "a" (sem1)
                : "memory");
@@ -145,11 +144,10 @@ extern inline int down_trylock(struct semaphore * sem)
                "jmi 2f\n\t"
                "clrl %0\n"
                "1:\n"
-               ".section .text.lock,\"ax\"\n"
-               ".even\n"
+               LOCK_SECTION_START(".even\n\t")
                "2:\tpea 1b\n\t"
                "jbra __down_failed_trylock\n"
-               ".previous"
+               LOCK_SECTION_END
                : "=d" (result)
                : "a" (sem1)
                : "memory");
@@ -175,12 +173,11 @@ extern inline void up(struct semaphore * sem)
                "addql #1,%0@\n\t"
                "jle 2f\n"
                "1:\n"
-               ".section .text.lock,\"ax\"\n"
-               ".even\n"
+               LOCK_SECTION_START(".even\n\t")
                "2:\t"
                "pea 1b\n\t"
                "jbra __up_wakeup\n"
-               ".previous"
+               LOCK_SECTION_END
                : /* no outputs */
                : "a" (sem1)
                : "memory");
index 54a8d54b787eebd353c665870ef99762e15626eb..1434908edb4680cfe446b6407ab757e2cc2fdfc9 100644 (file)
  *
  */
 
-/* if you're going to use out-of-line slowpaths, use .section .lock.text,
- * not .text.lock or the -ffunction-sections monster will eat you alive
- */
-
 #include <linux/spinlock.h>
 #include <linux/rwsem.h>
 
index 7a59ed694de4653be0e804cb9dd5d9d62a57910d..15c6d00fce04fbc69304e2935f4d87420c9212ca 100644 (file)
@@ -3,10 +3,6 @@
 
 #include <asm/system.h>
 
-/* if you're going to use out-of-line slowpaths, use .section .lock.text,
- * not .text.lock or the -ffunction-sections monster will eat you alive
- */
-
 /* we seem to be the only architecture that uses 0 to mean locked - but we
  * have to.  prumpf */
 
index 440ba7df43eca3de13d1a3d09dcce9668410cc36..dc27910a6ad5f94e34e43d44dbc6d7af9a01c6db 100644 (file)
                                                if (!__r) local_bh_enable();   \
                                                __r; })
 
+/* Must define these before including other files, inline functions need them */
+
+#include <linux/stringify.h>
+
+#define LOCK_SECTION_NAME                      \
+       ".text.lock." __stringify(KBUILD_BASENAME)
+
+#define LOCK_SECTION_START(extra)              \
+       ".subsection 1\n\t"                     \
+       extra                                   \
+       ".ifndef " LOCK_SECTION_NAME "\n\t"     \
+       LOCK_SECTION_NAME ":\n\t"               \
+       ".endif\n\t"
+
+#define LOCK_SECTION_END                       \
+       ".previous\n\t"
+
 #ifdef CONFIG_SMP
 #include <asm/spinlock.h>
 
diff --git a/include/linux/stringify.h b/include/linux/stringify.h
new file mode 100644 (file)
index 0000000..0b43883
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __LINUX_STRINGIFY_H
+#define __LINUX_STRINGIFY_H
+
+/* Indirect stringification.  Doing two levels allows the parameter to be a
+ * macro itself.  For example, compile with -DFOO=bar, __stringify(FOO)
+ * converts to "bar".
+ */
+
+#define __stringify_1(x)       #x
+#define __stringify(x)         __stringify_1(x)
+
+#endif /* !__LINUX_STRINGIFY_H */