From c3adda9fc308b06cabf2e70534905052cedb6417 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 14 Nov 2010 20:40:55 +0000 Subject: [PATCH] Instead of unconditionally emitting .globl's for the __start_set_xxx and __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined. --- sys/net/vnet.h | 7 ++++--- sys/sys/cdefs.h | 3 +-- sys/sys/linker_set.h | 4 ++-- sys/sys/pcpu.h | 7 ++++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sys/net/vnet.h b/sys/net/vnet.h index 1453194ae959..beecd436d037 100644 --- a/sys/net/vnet.h +++ b/sys/net/vnet.h @@ -95,9 +95,7 @@ struct vnet { * Location of the kernel's 'set_vnet' linker set. */ extern uintptr_t *__start_set_vnet; -__GLOBL(__start_set_vnet); extern uintptr_t *__stop_set_vnet; -__GLOBL(__stop_set_vnet); #define VNET_START (uintptr_t)&__start_set_vnet #define VNET_STOP (uintptr_t)&__stop_set_vnet @@ -195,7 +193,10 @@ extern struct sx vnet_sxlock; */ #define VNET_NAME(n) vnet_entry_##n #define VNET_DECLARE(t, n) extern t VNET_NAME(n) -#define VNET_DEFINE(t, n) t VNET_NAME(n) __section(VNET_SETNAME) __used +#define VNET_DEFINE(t, n) \ + __GLOBL("__start_" VNET_SETNAME); \ + __GLOBL("__stop_" VNET_SETNAME); \ + t VNET_NAME(n) __section(VNET_SETNAME) __used #define STATIC_VNET_DEFINE(t, n) \ VNET_DEFINE(static t, n) #define _VNET_PTR(b, n) \ diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 958c74d5ff6a..b5803a05dab2 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -401,8 +401,7 @@ #endif /* __STDC__ */ #endif /* __GNUC__ || __INTEL_COMPILER */ -#define __GLOBL1(sym) __asm__(".globl " #sym) -#define __GLOBL(sym) __GLOBL1(sym) +#define __GLOBL(sym) __asm__(".globl " sym) #if defined(__GNUC__) || defined(__INTEL_COMPILER) #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index 2edb55b24f8f..11c6b1dc63af 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -45,8 +45,8 @@ */ #ifdef __GNUCLIKE___SECTION #define __MAKE_SET(set, sym) \ - __GLOBL(__CONCAT(__start_set_,set)); \ - __GLOBL(__CONCAT(__stop_set_,set)); \ + __GLOBL("__start_set_" #set); \ + __GLOBL("__stop_set_" #set); \ static void const * const __set_##set##_sym_##sym \ __section("set_" #set) __used = &sym #else /* !__GNUCLIKE___SECTION */ diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h index d18a1509dd12..81fd7833a5b3 100644 --- a/sys/sys/pcpu.h +++ b/sys/sys/pcpu.h @@ -51,9 +51,7 @@ * Define a set for pcpu data. */ extern uintptr_t *__start_set_pcpu; -__GLOBL(__start_set_pcpu); extern uintptr_t *__stop_set_pcpu; -__GLOBL(__stop_set_pcpu); /* * Array of dynamic pcpu base offsets. Indexed by id. @@ -75,7 +73,10 @@ extern uintptr_t dpcpu_off[]; */ #define DPCPU_NAME(n) pcpu_entry_##n #define DPCPU_DECLARE(t, n) extern t DPCPU_NAME(n) -#define DPCPU_DEFINE(t, n) t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used +#define DPCPU_DEFINE(t, n) \ + __GLOBL("__start_" DPCPU_SETNAME); \ + __GLOBL("__stop_" DPCPU_SETNAME); \ + t DPCPU_NAME(n) __section(DPCPU_SETNAME) __used #define STATIC_DPCPU_DEFINE(t, n) \ DPCPU_DEFINE(static t, n)