mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: add symbol prefix arg to kallsyms
@ 2012-09-06 21:11 James Hogan
  2012-09-07  9:16 ` Bob Liu
  2012-11-01 20:29 ` Sam Ravnborg
  0 siblings, 2 replies; 3+ messages in thread
From: James Hogan @ 2012-09-06 21:11 UTC (permalink / raw)
  To: Mike Frysinger, Michal Marek, Sam Ravnborg, uclinux-dist-devel,
	linux-kernel

Commit 1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123 ("kbuild: link of
vmlinux moved to a script") introduced in v3.5-rc1 broke kallsyms on
architectures which have symbol prefixes.

The --symbol-prefix argument used to be added to the KALLSYMS command
line from the architecture Makefile, however this isn't picked up by the
new scripts/link-vmlinux.sh. This resulted in symbols like
kallsyms_addresses being added which weren't correctly overriding the
weak symbols such as _kallsyms_addresses. These could then trigger
BUG_ONs in kallsyms code.

This is fixed by removing the KALLSYMS addition from the architecture
Makefile, and using CONFIG_SYMBOL_PREFIX in the link-vmlinux.sh script
to determine whether to add the --symbol-prefix argument.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
 arch/blackfin/Makefile  |    1 -
 scripts/link-vmlinux.sh |    7 ++++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index d3d7e64..66cf000 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -20,7 +20,6 @@ endif
 KBUILD_AFLAGS           += $(call cc-option,-mno-fdpic)
 KBUILD_CFLAGS_MODULE    += -mlong-calls
 LDFLAGS                 += -m elf32bfin
-KALLSYMS         += --symbol-prefix=_
 
 KBUILD_DEFCONFIG := BF537-STAMP_defconfig
 
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 4629038..df48dda 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -74,8 +74,13 @@ kallsyms()
 	info KSYM ${2}
 	local kallsymopt;
 
+	if [ -n "${CONFIG_SYMBOL_PREFIX}" ]; then
+		kallsymopt="${kallsymopt} \
+			    --symbol-prefix=${CONFIG_SYMBOL_PREFIX}"
+	fi
+
 	if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
-		kallsymopt=--all-symbols
+		kallsymopt="${kallsymopt} --all-symbols"
 	fi
 
 	local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL}               \
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: add symbol prefix arg to kallsyms
  2012-09-06 21:11 [PATCH] kbuild: add symbol prefix arg to kallsyms James Hogan
@ 2012-09-07  9:16 ` Bob Liu
  2012-11-01 20:29 ` Sam Ravnborg
  1 sibling, 0 replies; 3+ messages in thread
From: Bob Liu @ 2012-09-07  9:16 UTC (permalink / raw)
  To: James Hogan
  Cc: Mike Frysinger, Michal Marek, Sam Ravnborg, uclinux-dist-devel,
	linux-kernel

Hi James,

On Fri, Sep 7, 2012 at 5:11 AM, James Hogan <james@albanarts.com> wrote:
> Commit 1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123 ("kbuild: link of
> vmlinux moved to a script") introduced in v3.5-rc1 broke kallsyms on
> architectures which have symbol prefixes.
>
> The --symbol-prefix argument used to be added to the KALLSYMS command
> line from the architecture Makefile, however this isn't picked up by the
> new scripts/link-vmlinux.sh. This resulted in symbols like
> kallsyms_addresses being added which weren't correctly overriding the
> weak symbols such as _kallsyms_addresses. These could then trigger
> BUG_ONs in kallsyms code.
>
> This is fixed by removing the KALLSYMS addition from the architecture
> Makefile, and using CONFIG_SYMBOL_PREFIX in the link-vmlinux.sh script
> to determine whether to add the --symbol-prefix argument.
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>

Yes, we also found this issue. Thank you for your fix.
I'll apply it soon.

> ---
>  arch/blackfin/Makefile  |    1 -
>  scripts/link-vmlinux.sh |    7 ++++++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
> index d3d7e64..66cf000 100644
> --- a/arch/blackfin/Makefile
> +++ b/arch/blackfin/Makefile
> @@ -20,7 +20,6 @@ endif
>  KBUILD_AFLAGS           += $(call cc-option,-mno-fdpic)
>  KBUILD_CFLAGS_MODULE    += -mlong-calls
>  LDFLAGS                 += -m elf32bfin
> -KALLSYMS         += --symbol-prefix=_
>
>  KBUILD_DEFCONFIG := BF537-STAMP_defconfig
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 4629038..df48dda 100644
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -74,8 +74,13 @@ kallsyms()
>         info KSYM ${2}
>         local kallsymopt;
>
> +       if [ -n "${CONFIG_SYMBOL_PREFIX}" ]; then
> +               kallsymopt="${kallsymopt} \
> +                           --symbol-prefix=${CONFIG_SYMBOL_PREFIX}"
> +       fi
> +
>         if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
> -               kallsymopt=--all-symbols
> +               kallsymopt="${kallsymopt} --all-symbols"
>         fi
>
>         local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL}               \
> --
> 1.7.7.6
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Regards,
--Bob

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: add symbol prefix arg to kallsyms
  2012-09-06 21:11 [PATCH] kbuild: add symbol prefix arg to kallsyms James Hogan
  2012-09-07  9:16 ` Bob Liu
@ 2012-11-01 20:29 ` Sam Ravnborg
  1 sibling, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2012-11-01 20:29 UTC (permalink / raw)
  To: James Hogan
  Cc: Mike Frysinger, Michal Marek, uclinux-dist-devel, linux-kernel

On Thu, Sep 06, 2012 at 10:11:25PM +0100, James Hogan wrote:
> Commit 1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123 ("kbuild: link of
> vmlinux moved to a script") introduced in v3.5-rc1 broke kallsyms on
> architectures which have symbol prefixes.
> 
> The --symbol-prefix argument used to be added to the KALLSYMS command
> line from the architecture Makefile, however this isn't picked up by the
> new scripts/link-vmlinux.sh. This resulted in symbols like
> kallsyms_addresses being added which weren't correctly overriding the
> weak symbols such as _kallsyms_addresses. These could then trigger
> BUG_ONs in kallsyms code.
> 
> This is fixed by removing the KALLSYMS addition from the architecture
> Makefile, and using CONFIG_SYMBOL_PREFIX in the link-vmlinux.sh script
> to determine whether to add the --symbol-prefix argument.
> 
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>

	Sam

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-01 20:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-06 21:11 [PATCH] kbuild: add symbol prefix arg to kallsyms James Hogan
2012-09-07  9:16 ` Bob Liu
2012-11-01 20:29 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®