Skip to contentSkip to conversation

perf: Fix to obey LD failure on host i686

PATCH In review Sujith H 3 participants 6 messages Sep 8, 2016 – Sep 21, 2016

lore
Share & tools
lore

Sujith H

author
#0 lore raw

PATCH 1/1 perf: Fix to obey LD failure on host i686

From: Christopher Larson <[email protected]>

When built on an i686 host for qemux86-64 without the fix to obey LD and it fails:

/scratch/dogwood/toolchains/x86_64/bin/i686-pc-linux-gnu-ld:
Relocatable linking with relocations from format elf64-x86-64 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/fs.o)
to format elf32-i386 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/libapi-in.o) is not supported

This is because LD includes HOST_LD_ARCH, which contains TUNE_LDARGS, which is -m elf32_x86_64 for x86_64. Without that, direct use of ld will fail.

---
 meta/recipes-kernel/perf/perf.bb | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/recipes-kernel/perf/perf.bb +9 -0
index 88e3a0a..85fe0ea 100644
@@ -79,6 +79,7 @@ EXTRA_OEMAKE = '\
     ARCH=${ARCH} \
     CC="${CC}" \
     AR="${AR}" \
+    LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
     perfexecdir=${libexecdir} \
     NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} \
@@ -98,6 +99,14 @@ EXTRA_OEMAKE += "\
     'infodir=${@os.path.relpath(infodir, prefix)}' \
 "
 
+do_configure_prepend () {
+    for makefile in "${S}/tools/perf/Makefile.perf" \
+                    "${S}/tools/lib/api/Makefile"; do
+        if [ -e "$makefile" ]; then
+            sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' "$makefile"
+        fi
+    done
+}
 
 do_compile() {
 	# Linux kernel build system is expected to do the right thing
Signature · 1 line
1.9.1
#1 lore raw
Quoted 34 lines · Sujith H

From: Christopher Larson <[email protected]>

When built on an i686 host for qemux86-64 without the fix to obey LD and it fails:

/scratch/dogwood/toolchains/x86_64/bin/i686-pc-linux-gnu-ld:
Relocatable linking with relocations from format elf64-x86-64 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/fs.o)
to format elf32-i386 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/libapi-in.o) is not supported

This is because LD includes HOST_LD_ARCH, which contains TUNE_LDARGS, which is -m elf32_x86_64 for x86_64. Without that, direct use of ld will fail.

---
 meta/recipes-kernel/perf/perf.bb | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/recipes-kernel/perf/perf.bb +1 -0
index 88e3a0a..85fe0ea 100644
@@ -79,6 +79,7 @@ EXTRA_OEMAKE = '\
     ARCH=${ARCH} \
     CC="${CC}" \
     AR="${AR}" \
+    LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
     perfexecdir=${libexecdir} \
     NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} \
@@ -98,6 +99,14 @@ EXTRA_OEMAKE += "\
     'infodir=${@os.path.relpath(infodir, prefix)}' \

meta/recipes-kernel/perf/perf.bb EXTRA_OEMAKE += "\ · line 109

Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +8 -0
 "
 
+do_configure_prepend () {
+    for makefile in "${S}/tools/perf/Makefile.perf" \
+                    "${S}/tools/lib/api/Makefile"; do
+        if [ -e "$makefile" ]; then
+            sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' "$makefile"
+        fi
+    done
+}

Isn't passing LD via the Make command line enough to over-ride these definitions in the Makefiles?

Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +0 -1
 do_compile() {
        # Linux kernel build system is expected to do the right thing
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

author
#2 lore raw
Quoted 42 lines · Andre McCurdy
Quoted 8 lines · Sujith H

From: Christopher Larson <[email protected]>

When built on an i686 host for qemux86-64 without the fix to obey LD and it fails:

/scratch/dogwood/toolchains/x86_64/bin/i686-pc-linux-gnu-ld:
Relocatable linking with relocations from format elf64-x86-64 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_

64-mel-linux/perf/1.0-r9/perf-1.0/fs/fs.o)

Quoted 1 line

to format elf32-i386 (/scratch/dogwood/perf-ld-

test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf- 1.0/fs/libapi-in.o)

Quoted 4 lines

is not supported

This is because LD includes HOST_LD_ARCH, which contains TUNE_LDARGS, which is -m elf32_x86_64 for x86_64. Without that, direct use of ld will

fail.

Review

Quoted 8 lines
---
 meta/recipes-kernel/perf/perf.bb | 9 +++++++++
 1 file changed, 9 insertions(+)
(quoted diff) +0 -0

b/meta/recipes-kernel/perf/perf.bb

Quoted 15 lines

index 88e3a0a..85fe0ea 100644

meta/recipes-kernel/perf/perf.bb +1 -0
@@ -79,6 +79,7 @@ EXTRA_OEMAKE = '\
     ARCH=${ARCH} \
     CC="${CC}" \
     AR="${AR}" \
+    LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
     perfexecdir=${libexecdir} \
     NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} \
@@ -98,6 +99,14 @@ EXTRA_OEMAKE += "\
     'infodir=${@os.path.relpath(infodir, prefix)}' \
 "
 
Quoted 12 lines

meta/recipes-kernel/perf/perf.bb EXTRA_OEMAKE += "\ · line 109

Quoted 8 lines
meta/recipes-kernel/perf/perf.bb +8 -0
+do_configure_prepend () {
+    for makefile in "${S}/tools/perf/Makefile.perf" \
+                    "${S}/tools/lib/api/Makefile"; do
+        if [ -e "$makefile" ]; then
+            sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' "$makefile"
+        fi
+    done
+}

Isn't passing LD via the Make command line enough to over-ride these definitions in the Makefiles?

Unfortunately that didn't helped I believe. That's the reason, this patch was created.

Quoted 12 lines
Quoted 11 lines
meta/recipes-kernel/perf/perf.bb +0 -1
 do_compile() {
        # Linux kernel build system is expected to do the right thing
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 7 lines
സുജിത് ഹരിദാസന്
Bangalore
<Project>Contributor to KDE project
<Project>Contributor to Yocto project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
<Blog> http://sujithh.info
C-x C-c
#3 lore raw
Quoted 59 lines · sujith h
Quoted 41 lines · Andre McCurdy
Quoted 8 lines · Sujith H

From: Christopher Larson <[email protected]>

When built on an i686 host for qemux86-64 without the fix to obey LD and it fails:

/scratch/dogwood/toolchains/x86_64/bin/i686-pc-linux-gnu-ld:
Relocatable linking with relocations from format elf64-x86-64 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf

/1.0-r9/perf-1.0/fs/fs.o)

Quoted 1 line

to format elf32-i386 (/scratch/dogwood/perf-ld-test

/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/libapi-in.o)

Quoted 4 lines

is not supported

This is because LD includes HOST_LD_ARCH, which contains TUNE_LDARGS, which is -m elf32_x86_64 for x86_64. Without that, direct use of ld

will fail.

meta/recipes-kernel/

Quoted 8 lines
---
 meta/recipes-kernel/perf/perf.bb | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/recipes-kernel/ renamed from meta/recipes-kernel/perf/perf.bb +0 -0

perf/perf.bb

Quoted 15 lines

index 88e3a0a..85fe0ea 100644

meta/recipes-kernel/perf/perf.bb +1 -0
@@ -79,6 +79,7 @@ EXTRA_OEMAKE = '\
     ARCH=${ARCH} \
     CC="${CC}" \
     AR="${AR}" \
+    LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
     perfexecdir=${libexecdir} \
     NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} \
@@ -98,6 +99,14 @@ EXTRA_OEMAKE += "\
     'infodir=${@os.path.relpath(infodir, prefix)}' \
 "
 
Quoted 12 lines

meta/recipes-kernel/perf/perf.bb EXTRA_OEMAKE += "\ · line 109

Quoted 8 lines
meta/recipes-kernel/perf/perf.bb +8 -0
+do_configure_prepend () {
+    for makefile in "${S}/tools/perf/Makefile.perf" \
+                    "${S}/tools/lib/api/Makefile"; do
+        if [ -e "$makefile" ]; then
+            sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' "$makefile"
+        fi
+    done
+}

Isn't passing LD via the Make command line enough to over-ride these definitions in the Makefiles?

Quoted 3 lines

Unfortunately that didn't helped I believe. That's the reason, this patch was created.

The patch mirrored the handling of CC/AR, which also used sed at the time the append was created. If upstream removed the sed for those, then we can remove it for LD as well, presumably. I’d recommend actually testing that.

Signature · 5 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#4 lore raw
Quoted 59 lines · Christopher Larson
Quoted 57 lines · sujith h
Quoted 53 lines · Andre McCurdy
Quoted 38 lines · Sujith H

From: Christopher Larson <[email protected]>

When built on an i686 host for qemux86-64 without the fix to obey LD and it fails:

/scratch/dogwood/toolchains/x86_64/bin/i686-pc-linux-gnu-ld:
Relocatable linking with relocations from format elf64-x86-64

(/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/fs.o) to format elf32-i386 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_64-mel-linux/perf/1.0-r9/perf-1.0/fs/libapi-in.o) is not supported

This is because LD includes HOST_LD_ARCH, which contains TUNE_LDARGS, which is -m elf32_x86_64 for x86_64. Without that, direct use of ld will fail.

---
 meta/recipes-kernel/perf/perf.bb | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/recipes-kernel/perf/perf.bb +1 -0
index 88e3a0a..85fe0ea 100644
@@ -79,6 +79,7 @@ EXTRA_OEMAKE = '\
     ARCH=${ARCH} \
     CC="${CC}" \
     AR="${AR}" \
+    LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
     perfexecdir=${libexecdir} \
     NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} \
@@ -98,6 +99,14 @@ EXTRA_OEMAKE += "\
     'infodir=${@os.path.relpath(infodir, prefix)}' \

meta/recipes-kernel/perf/perf.bb EXTRA_OEMAKE += "\ · line 109

Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +8 -0
 "
 
+do_configure_prepend () {
+    for makefile in "${S}/tools/perf/Makefile.perf" \
+                    "${S}/tools/lib/api/Makefile"; do
+        if [ -e "$makefile" ]; then
+            sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' "$makefile"
+        fi
+    done
+}

Isn't passing LD via the Make command line enough to over-ride these definitions in the Makefiles?

Quoted 6 lines
Quoted 2 lines

Unfortunately that didn't helped I believe. That's the reason, this patch was created.

The patch mirrored the handling of CC/AR, which also used sed at the time the append was created. If upstream removed the sed for those, then we can remove it for LD as well, presumably. I’d recommend actually testing that.

Brief testing suggests that commenting out LD in
${S}/tools/lib/api/Makefile is still required.

For clarity the new sed command should probably be added next to the existing ones for CC and AR though, rather than on its own in a new do_configure_prepend().

There is no "LD = ..." line to comment out in ${S}/tools/perf/Makefile.perf.

Quoted 6 lines

--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

author
#5 lore raw
Quoted 76 lines · Andre McCurdy
Quoted 9 lines · Christopher Larson
Quoted 7 lines · sujith h
Quoted 4 lines · Andre McCurdy
Quoted 2 lines · Sujith H

From: Christopher Larson <[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

When built on an i686 host for qemux86-64 without the fix to obey LD and it fails:

/scratch/dogwood/toolchains/x86_64/bin/i686-pc-linux-gnu-ld:
Relocatable linking with relocations from format elf64-x86-64

(/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_

64-mel-linux/perf/1.0-r9/perf-1.0/fs/fs.o)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

to format elf32-i386 (/scratch/dogwood/perf-ld-test/build/tmp/work/qemux86_

64-mel-linux/perf/1.0-r9/perf-1.0/fs/libapi-in.o)

Quoted 41 lines
Quoted 41 lines
Quoted 40 lines
Quoted 27 lines

is not supported

This is because LD includes HOST_LD_ARCH, which contains TUNE_LDARGS, which is -m elf32_x86_64 for x86_64. Without that, direct use of ld will fail.

---
 meta/recipes-kernel/perf/perf.bb | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/recipes-kernel/perf/perf.bb +1 -0
index 88e3a0a..85fe0ea 100644
@@ -79,6 +79,7 @@ EXTRA_OEMAKE = '\
     ARCH=${ARCH} \
     CC="${CC}" \
     AR="${AR}" \
+    LD="${LD}" \
     EXTRA_CFLAGS="-ldw" \
     perfexecdir=${libexecdir} \
     NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} \
@@ -98,6 +99,14 @@ EXTRA_OEMAKE += "\
     'infodir=${@os.path.relpath(infodir, prefix)}' \

meta/recipes-kernel/perf/perf.bb EXTRA_OEMAKE += "\ · line 109

Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +8 -0
 "
 
+do_configure_prepend () {
+    for makefile in "${S}/tools/perf/Makefile.perf" \
+                    "${S}/tools/lib/api/Makefile"; do
+        if [ -e "$makefile" ]; then
+            sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' "$makefile"
+        fi
+    done
+}

Isn't passing LD via the Make command line enough to over-ride these definitions in the Makefiles?

Quoted 1 line
Quoted 1 line

Unfortunately that didn't helped I believe. That's the reason, this

patch

Quoted 4 lines
Quoted 1 line

was created.

The patch mirrored the handling of CC/AR, which also used sed at the time the append was created. If upstream removed the sed for those, then we

can

Quoted 1 line

remove it for LD as well, presumably. I’d recommend actually testing

that.

Brief testing suggests that commenting out LD in
${S}/tools/lib/api/Makefile is still required.

Quoted 7 lines

For clarity the new sed command should probably be added next to the existing ones for CC and AR though, rather than on its own in a new do_configure_prepend().

There is no "LD = ..." line to comment out in
${S}/tools/perf/Makefile.perf.

I will update the patch as per the suggestion.

Quoted 8 lines
Quoted 7 lines

--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

Signature · 7 lines
സുജിത് ഹരിദാസന്
Bangalore
<Project>Contributor to KDE project
<Project>Contributor to Yocto project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
<Blog> http://sujithh.info
C-x C-c