All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alpha: Fix missing symbol versions for str{,n}{cat,cpy}
@ 2023-01-13 22:00 Ben Hutchings
  2023-02-25  4:32 ` Matt Turner
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2023-01-13 22:00 UTC (permalink / raw)
  To: linux-alpha; +Cc: John Paul Adrian Glaubitz

[-- Attachment #1: Type: text/plain, Size: 2747 bytes --]

Now that modpost extracts symbol versions from *.cmd files, it can't
find the versions for these 4 symbols.  This is due to the way we link
their objects together ahead of the full vmlinux link.  genksyms puts
their symbol CRCs in .str{,n}{cat,cpy}.o.cmd, but modpost only reads
the .sty{,n}cpy.o.cmd files.

Instead of using the linker for this, add assembly sources that
concatenate the appropriate routines with include directives.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Fixes: f292d875d0dc ("modpost: extract symbol versions from *.cmd files")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/alpha/lib/Makefile  | 14 --------------
 arch/alpha/lib/stycpy.S  | 13 +++++++++++++
 arch/alpha/lib/styncpy.S | 13 +++++++++++++
 3 files changed, 26 insertions(+), 14 deletions(-)
 create mode 100644 arch/alpha/lib/stycpy.S
 create mode 100644 arch/alpha/lib/styncpy.S

diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile
index 1cc74f7b50ef..8f1c32a25a40 100644
--- a/arch/alpha/lib/Makefile
+++ b/arch/alpha/lib/Makefile
@@ -45,17 +45,3 @@ AFLAGS___remlu.o =       -DREM -DINTSIZE
 $(addprefix $(obj)/,__divqu.o __remqu.o __divlu.o __remlu.o): \
 						$(src)/$(ev6-y)divide.S FORCE
 	$(call if_changed_rule,as_o_S)
-
-# There are direct branches between {str*cpy,str*cat} and stx*cpy.
-# Ensure the branches are within range by merging these objects.
-
-LDFLAGS_stycpy.o := -r
-LDFLAGS_styncpy.o := -r
-
-$(obj)/stycpy.o: $(obj)/strcpy.o $(obj)/$(ev67-y)strcat.o \
-		 $(obj)/$(ev6-y)stxcpy.o FORCE
-	$(call if_changed,ld)
-
-$(obj)/styncpy.o: $(obj)/strncpy.o $(obj)/$(ev67-y)strncat.o \
-		 $(obj)/$(ev6-y)stxncpy.o FORCE
-	$(call if_changed,ld)
diff --git a/arch/alpha/lib/stycpy.S b/arch/alpha/lib/stycpy.S
new file mode 100644
index 000000000000..bf2b0238209e
--- /dev/null
+++ b/arch/alpha/lib/stycpy.S
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * There are direct branches between strcpy, strcat, and stxcpy.
+ * Ensure the branches are within range by concatenating their code.
+ */
+#include "strcpy.S"
+#ifdef CONFIG_ALPHA_EV6
+#include "ev6-strcat.S"
+#include "ev6-stxcpy.S"
+#else
+#include "strcat.S"
+#include "stxcpy.S"
+#endif
diff --git a/arch/alpha/lib/styncpy.S b/arch/alpha/lib/styncpy.S
new file mode 100644
index 000000000000..213d1678be2a
--- /dev/null
+++ b/arch/alpha/lib/styncpy.S
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * There are direct branches between strncpy, strncat, and stxncpy.
+ * Ensure the branches are within range by concatenating their code.
+ */
+#include "strncpy.S"
+#ifdef CONFIG_ALPHA_EV6
+#include "ev6-strncat.S"
+#include "ev6-stxncpy.S"
+#else
+#include "strncat.S"
+#include "stxncpy.S"
+#endif

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] alpha: Fix missing symbol versions for str{,n}{cat,cpy}
  2023-01-13 22:00 [PATCH] alpha: Fix missing symbol versions for str{,n}{cat,cpy} Ben Hutchings
@ 2023-02-25  4:32 ` Matt Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2023-02-25  4:32 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: linux-alpha, John Paul Adrian Glaubitz

On Fri, Jan 13, 2023 at 5:02 PM Ben Hutchings <ben@decadent.org.uk> wrote:
>
> Now that modpost extracts symbol versions from *.cmd files, it can't
> find the versions for these 4 symbols.  This is due to the way we link
> their objects together ahead of the full vmlinux link.  genksyms puts
> their symbol CRCs in .str{,n}{cat,cpy}.o.cmd, but modpost only reads
> the .sty{,n}cpy.o.cmd files.
>
> Instead of using the linker for this, add assembly sources that
> concatenate the appropriate routines with include directives.
>
> Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Fixes: f292d875d0dc ("modpost: extract symbol versions from *.cmd files")
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Thanks a bunch for the patch!

> ---
>  arch/alpha/lib/Makefile  | 14 --------------
>  arch/alpha/lib/stycpy.S  | 13 +++++++++++++
>  arch/alpha/lib/styncpy.S | 13 +++++++++++++
>  3 files changed, 26 insertions(+), 14 deletions(-)
>  create mode 100644 arch/alpha/lib/stycpy.S
>  create mode 100644 arch/alpha/lib/styncpy.S
>
> diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile
> index 1cc74f7b50ef..8f1c32a25a40 100644
> --- a/arch/alpha/lib/Makefile
> +++ b/arch/alpha/lib/Makefile
> @@ -45,17 +45,3 @@ AFLAGS___remlu.o =       -DREM -DINTSIZE
>  $(addprefix $(obj)/,__divqu.o __remqu.o __divlu.o __remlu.o): \
>                                                 $(src)/$(ev6-y)divide.S FORCE
>         $(call if_changed_rule,as_o_S)
> -
> -# There are direct branches between {str*cpy,str*cat} and stx*cpy.
> -# Ensure the branches are within range by merging these objects.
> -
> -LDFLAGS_stycpy.o := -r
> -LDFLAGS_styncpy.o := -r
> -
> -$(obj)/stycpy.o: $(obj)/strcpy.o $(obj)/$(ev67-y)strcat.o \
> -                $(obj)/$(ev6-y)stxcpy.o FORCE
> -       $(call if_changed,ld)
> -
> -$(obj)/styncpy.o: $(obj)/strncpy.o $(obj)/$(ev67-y)strncat.o \
> -                $(obj)/$(ev6-y)stxncpy.o FORCE
> -       $(call if_changed,ld)
> diff --git a/arch/alpha/lib/stycpy.S b/arch/alpha/lib/stycpy.S
> new file mode 100644
> index 000000000000..bf2b0238209e
> --- /dev/null
> +++ b/arch/alpha/lib/stycpy.S
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * There are direct branches between strcpy, strcat, and stxcpy.
> + * Ensure the branches are within range by concatenating their code.
> + */
> +#include "strcpy.S"
> +#ifdef CONFIG_ALPHA_EV6
> +#include "ev6-strcat.S"

  AS      arch/alpha/lib/stycpy.o
arch/alpha/lib/stycpy.S:8:10: fatal error: ev6-strcat.S: No such file
or directory
    8 | #include "ev6-strcat.S"
      |          ^~~~~~~~~~~~~~

There's no ev6-strcat.S, but there is an ev67-strcat.S. I guess that's
what we want here, along with s/CONFIG_ALPHA_EV6/CONFIG_ALPHA_EV67'.

It's EV67-only because of the cttz instruction.

> +#include "ev6-stxcpy.S"
> +#else
> +#include "strcat.S"
> +#include "stxcpy.S"
> +#endif
> diff --git a/arch/alpha/lib/styncpy.S b/arch/alpha/lib/styncpy.S
> new file mode 100644
> index 000000000000..213d1678be2a
> --- /dev/null
> +++ b/arch/alpha/lib/styncpy.S
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * There are direct branches between strncpy, strncat, and stxncpy.
> + * Ensure the branches are within range by concatenating their code.
> + */
> +#include "strncpy.S"
> +#ifdef CONFIG_ALPHA_EV6
> +#include "ev6-strncat.S"

  AS      arch/alpha/lib/styncpy.o
arch/alpha/lib/styncpy.S:8:10: fatal error: ev6-strncat.S: No such
file or directory
    8 | #include "ev6-strncat.S"
      |          ^~~~~~~~~~~~~~~
compilation terminated.

Same thing here. ev67-strncat.S. s/CONFIG_ALPHA_EV6/CONFIG_ALPHA_EV67'
above as well.

> +#include "ev6-stxncpy.S"
> +#else
> +#include "strncat.S"
> +#include "stxncpy.S"
> +#endif

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

end of thread, other threads:[~2023-02-25  4:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 22:00 [PATCH] alpha: Fix missing symbol versions for str{,n}{cat,cpy} Ben Hutchings
2023-02-25  4:32 ` Matt Turner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.