Skip to contentSkip to conversation

kexec-tools: Fix compilation with clang

PATCH In review Oleksiy Obitotskyy 2 participants 4 messages Apr 16, 2019 – May 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexec-tools: Fix compilation with clang

clang assembler do not understand some directives e.g.

../kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S:23:2: error: unknown directive .arch i386
^ ../kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S:115:11: error: unknown token in expression ljmp %cs:*(realdest - entry16)
^

Force external assembler for purgatory and tests.

Upstream-Status: Pending

---
 ..._64-Makefile-fix-assemble-with-clang.patch | 23 +++++++++++++++++++
 .../kexec/kexec-tools_2.0.19.bb               |  2 ++
 2 files changed, 25 insertions(+)
 create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch
meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch new file +23 -0
new file mode 100644
index 0000000000..13f247982a
@@ -0,0 +1,23 @@
+--- a/purgatory/Makefile	2019-03-05 07:47:03.190429822 -0800
++++ b/purgatory/Makefile	2019-03-05 07:42:52.167623612 -0800
+@@ -31,6 +31,9 @@ include $(srcdir)/purgatory/arch/x86_64/
+ 
+ PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
+ 
++PURGATORY_EXTRA_CFLAGS += -no-integrated-as
++$(ARCH)_PURGATORY_EXTRA_CFLAGS += -no-integrated-as
++
+ PURGATORY_OBJS = $(call objify, $(PURGATORY_SRCS)) purgatory/sha256.o
+ PURGATORY_DEPS = $(call depify, $(PURGATORY_OBJS))
+ 
+--- a/kexec_test/Makefile	2019-03-05 07:45:14.757353575 -0800
++++ b/kexec_test/Makefile	2019-03-05 07:45:57.567173264 -0800
+@@ -17,6 +17,8 @@ endif
+ 
+ ifeq ($(BUILD_KEXEC_TEST),yes)
+ 
++CPPFLAGS += -no-integrated-as
++
+ KEXEC_TEST_OBJS = $(call objify, $(KEXEC_TEST_SRCS))
+ KEXEC_TEST_DEPS = $(call depify, $(KEXEC_TEST_OBJS))
+ 
meta/recipes-kernel/kexec/kexec-tools_2.0.19.bb +2 -0
index f65cd9f106..c229097d5b 100644
@@ -20,6 +20,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz
            file://0001-Disable-PIE-during-link.patch \
            "
 
+SRC_URI_append_toolchain-clang = " file://0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch"
+
 SRC_URI[md5sum] = "052458f0a35c2a3b0d2302caa3318e9f"
 SRC_URI[sha256sum] = "913c8dee918e5855a4ba60d609371390978144b4c8d15d6446ca0057b7bc5e58"
 
Signature · 1 line
2.19.1
#1 lore raw

Any comments?

Regards,
Oleksiy

Quoted 60 lines · Oleksiy Obitotskyy

clang assembler do not understand some directives e.g.

../kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S:23:2: error: unknown directive .arch i386
^ ../kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S:115:11: error: unknown token in expression ljmp %cs:*(realdest - entry16)
^

Force external assembler for purgatory and tests.

Upstream-Status: Pending

---
 ..._64-Makefile-fix-assemble-with-clang.patch | 23 +++++++++++++++++++
 .../kexec/kexec-tools_2.0.19.bb               |  2 ++
 2 files changed, 25 insertions(+)
 create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch
meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch new file +23 -0
new file mode 100644
index 0000000000..13f247982a
@@ -0,0 +1,23 @@
+--- a/purgatory/Makefile	2019-03-05 07:47:03.190429822 -0800
++++ b/purgatory/Makefile	2019-03-05 07:42:52.167623612 -0800
+@@ -31,6 +31,9 @@ include $(srcdir)/purgatory/arch/x86_64/
+ 
+ PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
+ 
++PURGATORY_EXTRA_CFLAGS += -no-integrated-as
++$(ARCH)_PURGATORY_EXTRA_CFLAGS += -no-integrated-as
++
+ PURGATORY_OBJS = $(call objify, $(PURGATORY_SRCS)) purgatory/sha256.o
+ PURGATORY_DEPS = $(call depify, $(PURGATORY_OBJS))
+ 
+--- a/kexec_test/Makefile	2019-03-05 07:45:14.757353575 -0800
++++ b/kexec_test/Makefile	2019-03-05 07:45:57.567173264 -0800
+@@ -17,6 +17,8 @@ endif
+ 
+ ifeq ($(BUILD_KEXEC_TEST),yes)
+ 
++CPPFLAGS += -no-integrated-as
++
+ KEXEC_TEST_OBJS = $(call objify, $(KEXEC_TEST_SRCS))
+ KEXEC_TEST_DEPS = $(call depify, $(KEXEC_TEST_OBJS))
+ 
meta/recipes-kernel/kexec/kexec-tools_2.0.19.bb +2 -0
index f65cd9f106..c229097d5b 100644
@@ -20,6 +20,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz
            file://0001-Disable-PIE-during-link.patch \
            "
 
+SRC_URI_append_toolchain-clang = " file://0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch"
+
 SRC_URI[md5sum] = "052458f0a35c2a3b0d2302caa3318e9f"
 SRC_URI[sha256sum] = "913c8dee918e5855a4ba60d609371390978144b4c8d15d6446ca0057b7bc5e58"
 
#2 lore raw
Quoted 2 lines · On 5/16/19 1:32 AM, Oleksiy Obitotskyi -X (oobitots - GLOBALLOGIC INC at…

Any comments?

This is same as https://bugzilla.kernel.org/show_bug.cgi?id=177321

and I think the below should have helped.

https://github.com/kraj/meta-clang/blob/master/conf/nonclangable.conf#L152-L158

If thats not helping then I would like to understand why

So lets try to fix the problem upstream first and meanwhile make fixes in meta-clang.

Quoted 65 lines

Regards,
Oleksiy

Quoted 60 lines · Oleksiy Obitotskyy

clang assembler do not understand some directives e.g.

../kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S:23:2: error: unknown directive .arch i386
^ ../kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S:115:11: error: unknown token in expression ljmp %cs:*(realdest - entry16)
^

Force external assembler for purgatory and tests.

Upstream-Status: Pending

---
  ..._64-Makefile-fix-assemble-with-clang.patch | 23 +++++++++++++++++++
  .../kexec/kexec-tools_2.0.19.bb               |  2 ++
  2 files changed, 25 insertions(+)

create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch

meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch new file +23 -0
new file mode 100644
index 0000000000..13f247982a
@@ -0,0 +1,23 @@
+--- a/purgatory/Makefile	2019-03-05 07:47:03.190429822 -0800
++++ b/purgatory/Makefile	2019-03-05 07:42:52.167623612 -0800
+@@ -31,6 +31,9 @@ include $(srcdir)/purgatory/arch/x86_64/
+
+ PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
+
++PURGATORY_EXTRA_CFLAGS += -no-integrated-as
++$(ARCH)_PURGATORY_EXTRA_CFLAGS += -no-integrated-as
++
+ PURGATORY_OBJS = $(call objify, $(PURGATORY_SRCS)) purgatory/sha256.o
+ PURGATORY_DEPS = $(call depify, $(PURGATORY_OBJS))
+
+--- a/kexec_test/Makefile	2019-03-05 07:45:14.757353575 -0800
++++ b/kexec_test/Makefile	2019-03-05 07:45:57.567173264 -0800
+@@ -17,6 +17,8 @@ endif
+
+ ifeq ($(BUILD_KEXEC_TEST),yes)
+
++CPPFLAGS += -no-integrated-as
++
+ KEXEC_TEST_OBJS = $(call objify, $(KEXEC_TEST_SRCS))
+ KEXEC_TEST_DEPS = $(call depify, $(KEXEC_TEST_OBJS))
+
meta/recipes-kernel/kexec/kexec-tools_2.0.19.bb +2 -0
index f65cd9f106..c229097d5b 100644
@@ -20,6 +20,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz
             file://0001-Disable-PIE-during-link.patch \
             "
 
+SRC_URI_append_toolchain-clang = " file://0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch"
+
  SRC_URI[md5sum] = "052458f0a35c2a3b0d2302caa3318e9f"
  SRC_URI[sha256sum] = "913c8dee918e5855a4ba60d609371390978144b4c8d15d6446ca0057b7bc5e58"
 
#3 lore raw
Quoted 5 lines · Khem Raj
Quoted 2 lines · On 5/16/19 1:32 AM, Oleksiy Obitotskyi -X (oobitots - GLOBALLOGIC INC at…

Any comments?

Quoted 7 lines

This is same as https://bugzilla.kernel.org/show_bug.cgi?id=177321

and I think the below should have helped.

https://github.com/kraj/meta-clang/blob/master/conf/nonclangable.conf#L152-L158

If thats not helping then I would like to understand why

Yes, overriding CC flags for clang toolchain is fine.

Quoted 68 lines

So lets try to fix the problem upstream first and meanwhile make fixes in meta-clang.

Quoted 64 lines

Regards,
Oleksiy

Quoted 60 lines · Oleksiy Obitotskyy

clang assembler do not understand some directives e.g.

../kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S:23:2: error: unknown directive .arch i386
^ ../kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S:115:11: error: unknown token in expression ljmp %cs:*(realdest - entry16)
^

Force external assembler for purgatory and tests.

Upstream-Status: Pending

---
  ..._64-Makefile-fix-assemble-with-clang.patch | 23 +++++++++++++++++++
  .../kexec/kexec-tools_2.0.19.bb               |  2 ++
  2 files changed, 25 insertions(+)

create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch

meta/recipes-kernel/kexec/kexec-tools/0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch new file +23 -0
new file mode 100644
index 0000000000..13f247982a
@@ -0,0 +1,23 @@
+--- a/purgatory/Makefile	2019-03-05 07:47:03.190429822 -0800
++++ b/purgatory/Makefile	2019-03-05 07:42:52.167623612 -0800
+@@ -31,6 +31,9 @@ include $(srcdir)/purgatory/arch/x86_64/
+
+ PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
+
++PURGATORY_EXTRA_CFLAGS += -no-integrated-as
++$(ARCH)_PURGATORY_EXTRA_CFLAGS += -no-integrated-as
++
+ PURGATORY_OBJS = $(call objify, $(PURGATORY_SRCS)) purgatory/sha256.o
+ PURGATORY_DEPS = $(call depify, $(PURGATORY_OBJS))
+
+--- a/kexec_test/Makefile	2019-03-05 07:45:14.757353575 -0800
++++ b/kexec_test/Makefile	2019-03-05 07:45:57.567173264 -0800
+@@ -17,6 +17,8 @@ endif
+
+ ifeq ($(BUILD_KEXEC_TEST),yes)
+
++CPPFLAGS += -no-integrated-as
++
+ KEXEC_TEST_OBJS = $(call objify, $(KEXEC_TEST_SRCS))
+ KEXEC_TEST_DEPS = $(call depify, $(KEXEC_TEST_OBJS))
+
meta/recipes-kernel/kexec/kexec-tools_2.0.19.bb +2 -0
index f65cd9f106..c229097d5b 100644
@@ -20,6 +20,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz
             file://0001-Disable-PIE-during-link.patch \
             "
 
+SRC_URI_append_toolchain-clang = " file://0001-purgatory-x86_64-Makefile-fix-assemble-with-clang.patch"
+
  SRC_URI[md5sum] = "052458f0a35c2a3b0d2302caa3318e9f"
  SRC_URI[sha256sum] = "913c8dee918e5855a4ba60d609371390978144b4c8d15d6446ca0057b7bc5e58"