perf: Add LDFLAGS to allow build of old kernels without patching
PATCH 1/1 perf: Add LDFLAGS to allow build of old kernels without patching
The LDFLAGS is required or some old kernels fails due missing symbols and this is preferred than requiring patches to every old supported kernel.
Fixes [YOCTO: #5221]
--- meta/recipes-kernel/perf/perf.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
meta/recipes-kernel/perf/perf.bb +7 -2
@@ -60,6 +60,11 @@ B = "${WORKDIR}/${BPN}-${PV}" SCRIPTING_DEFINES = "${@perf_feature_enabled('perf-scripting', '', 'NO_LIBPERL=1 NO_LIBPYTHON=1',d)}" TUI_DEFINES = "${@perf_feature_enabled('perf-tui', '', 'NO_NEWT=1',d)}" +# The LDFLAGS is required or some old kernels fails due missing +# symbols and this is preferred than requiring patches to every old +# supported kernel. +LDFLAGS="-ldl -lutil" + EXTRA_OEMAKE = \ '-C ${S}/tools/perf \ O=${B} \
@@ -88,13 +93,13 @@ PARALLEL_MAKE = "" do_compile() { # Linux kernel build system is expected to do the right thing - unset CFLAGS LDFLAGS + unset CFLAGS oe_runmake all } do_install() { # Linux kernel build system is expected to do the right thing - unset CFLAGS LDFLAGS + unset CFLAGS oe_runmake DESTDIR=${D} install # we are checking for this make target to be compatible with older perf versions if [ "${@perf_feature_enabled('perf-scripting', 1, 0, d)}" = "1" -a $(grep install-python_ext ${S}/tools/perf/Makefile) = "0"]; then
Signature · 1 line
1.8.4.rc3
Quoted 6 lines · Otavio Salvador
The LDFLAGS is required or some old kernels fails due missing symbols and this is preferred than requiring patches to every old supported kernel.
Fixes [YOCTO: #5221]
Confirmed here as well, I was able to build my perf tests, and the meta-fsl-ppc ones have been confirmed in the bug, and with Otavio's confirmation here .. we should be good to go .. I hope :)
Cheers,
Bruce
Quoted 44 lines
Signed-off-by Otavio Salvador <[email protected]>--- meta/recipes-kernel/perf/perf.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)meta/recipes-kernel/perf/perf.bb +7
-3@@ -60,6 +60,11 @@ B = "${WORKDIR}/${BPN}-${PV}" SCRIPTING_DEFINES = "${@perf_feature_enabled('perf-scripting', '', 'NO_LIBPERL=1 NO_LIBPYTHON=1',d)}" TUI_DEFINES = "${@perf_feature_enabled('perf-tui', '', 'NO_NEWT=1',d)}" +# The LDFLAGS is required or some old kernels fails due missing +# symbols and this is preferred than requiring patches to every old +# supported kernel. +LDFLAGS="-ldl -lutil" + EXTRA_OEMAKE = \ '-C ${S}/tools/perf \ O=${B} \@@ -88,13 +93,13 @@ PARALLEL_MAKE = "" do_compile() { # Linux kernel build system is expected to do the right thing - unset CFLAGS LDFLAGS + unset CFLAGS oe_runmake all } do_install() { # Linux kernel build system is expected to do the right thing - unset CFLAGS LDFLAGS + unset CFLAGS oe_runmake DESTDIR=${D} install # we are checking for this make target to be compatible with older perf versions if [ "${@perf_feature_enabled('perf-scripting', 1, 0, d)}" = "1" -a $(grep install-python_ext ${S}/tools/perf/Makefile) = "0"]; then --1.8.4.rc3
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Quoted 10 lines · Otavio Salvador
The LDFLAGS is required or some old kernels fails due missing symbols and this is preferred than requiring patches to every old supported kernel.
Fixes [YOCTO: #5221]
Signed-off-by Otavio Salvador <[email protected]>--- meta/recipes-kernel/perf/perf.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Doesn't this reintroduce the problem you previously fixed though with things rebuilding because the flags changed?
Cheers,
Richard
Quoted 32 lines
meta/recipes-kernel/perf/perf.bb +7
-2@@ -60,6 +60,11 @@ B = "${WORKDIR}/${BPN}-${PV}" SCRIPTING_DEFINES = "${@perf_feature_enabled('perf-scripting', '', 'NO_LIBPERL=1 NO_LIBPYTHON=1',d)}" TUI_DEFINES = "${@perf_feature_enabled('perf-tui', '', 'NO_NEWT=1',d)}" +# The LDFLAGS is required or some old kernels fails due missing +# symbols and this is preferred than requiring patches to every old +# supported kernel. +LDFLAGS="-ldl -lutil" + EXTRA_OEMAKE = \ '-C ${S}/tools/perf \ O=${B} \@@ -88,13 +93,13 @@ PARALLEL_MAKE = "" do_compile() { # Linux kernel build system is expected to do the right thing - unset CFLAGS LDFLAGS + unset CFLAGS oe_runmake all } do_install() { # Linux kernel build system is expected to do the right thing - unset CFLAGS LDFLAGS + unset CFLAGS oe_runmake DESTDIR=${D} install # we are checking for this make target to be compatible with older perf versions if [ "${@perf_feature_enabled('perf-scripting', 1, 0, d)}" = "1" -a $(grep install-python_ext ${S}/tools/perf/Makefile) = "0"]; then
Quoted 7 lines · Richard Purdie
Quoted 6 lines · Otavio Salvador
The LDFLAGS is required or some old kernels fails due missing symbols and this is preferred than requiring patches to every old supported kernel.
Fixes [YOCTO: #5221]
Quoted 7 lines
Quoted 4 lines
Signed-off-by Otavio Salvador <[email protected]>--- meta/recipes-kernel/perf/perf.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)Doesn't this reintroduce the problem you previously fixed though with things rebuilding because the flags changed?
I'm doing a test on just that right now, but as far as I can tell, as long as they
are consistent between the compile and install, we should be fine. It was when one was clobbered and one wasn't before, that the rebuilds were triggering.
Bruce
Quoted 47 lines
Cheers,
Richard
Quoted 22 lines
meta/recipes-kernel/perf/perf.bb +6
-1@@ -60,6 +60,11 @@ B = "${WORKDIR}/${BPN}-${PV}" SCRIPTING_DEFINES = "${@perf_feature_enabled('perf-scripting', '', 'NO_LIBPERL=1 NO_LIBPYTHON=1',d)}" TUI_DEFINES = "${@perf_feature_enabled('perf-tui', '', 'NO_NEWT=1',d)}" +# The LDFLAGS is required or some old kernels fails due missing +# symbols and this is preferred than requiring patches to every old +# supported kernel. +LDFLAGS="-ldl -lutil" + EXTRA_OEMAKE = \ '-C ${S}/tools/perf \ O=${B} \@@ -88,13 +93,13 @@ PARALLEL_MAKE = "" do_compile() { # Linux kernel build system is expected to do the right thing - unset CFLAGS LDFLAGS + unset CFLAGSmeta/recipes-kernel/perf/perf.bb PARALLEL_MAKE = "" · line 105
Quoted 10 lines
meta/recipes-kernel/perf/perf.bb +1
-1oe_runmake all } do_install() { # Linux kernel build system is expected to do the right thing - unset CFLAGS LDFLAGS + unset CFLAGS oe_runmake DESTDIR=${D} install # we are checking for this make target to be compatible with older perf versions if [ "${@perf_feature_enabled('perf-scripting', 1, 0, d)}" = "1" -a $(grep install-python_ext ${S}/tools/perf/Makefile) = "0"]; then_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Quoted 5 lines · Otavio Salvador
The LDFLAGS is required or some old kernels fails due missing symbols and this is preferred than requiring patches to every old supported kernel.
...
+LDFLAGS="-ldl -lutil"
What is with -Wl,-as-needed or the gnu-hash ldflags which are applied usually? Perhaps, hacks like
----do_configure_prepend() {
cat <<"EOF" > ${S}/tools/perf/x.mk
include Makefile
CFLAGS += ${CFLAGS}
LDLAGS += ${LDFLAGS}
EOF
}
EXTRA_OEMAKE = ... -f x.mk
----
would be a better way?
Enrico
Quoted 10 lines · Enrico Scholz
Quoted 5 lines · Otavio Salvador
The LDFLAGS is required or some old kernels fails due missing symbols and this is preferred than requiring patches to every old supported kernel.
...
+LDFLAGS="-ldl -lutil"What is with -Wl,-as-needed or the gnu-hash ldflags which are applied usually? Perhaps, hacks like
We don't want to influence the perf build from the build system, unless we absolutely have to. We want to use the flags and configs that are contained within the kernel, just as we do with anything from the kernel tree in general.
Quoted 10 lines
----
do_configure_prepend(){
cat <<"EOF" >${S}/tools/perf/x.mk
includeMakefile
CFLAGS += ${CFLAGS}
LDLAGS += ${LDFLAGS}
EOF
}
Quoted 4 lines
EXTRA_OEMAKE= ... -f x.mk
----would be a better way?
We only want to influence LDFLAGS at the moment, and we'll work to get an EXTRA_LDFLAGS into the mainline kernel, so creating less scaffolding, versus more, is what we are shooting for here :)
Bruce
Quoted 7 lines
Enrico
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Bruce Ashfield <[email protected]>
Quoted 9 lines · writes:
Quoted 4 lines
Quoted 1 line
+LDFLAGS="-ldl -lutil"
What is with -Wl,-as-needed or the gnu-hash ldflags which are applied usually? Perhaps, hacks like
We don't want to influence the perf build from the build system, unless we absolutely have to. We want to use the flags and configs that are contained within the kernel, just as we do with anything from the kernel tree in general.
Userspace programs should always be built with optimization flags of the build system. E.g. it would be wrong when packages override our idea of optimization (-Os/-O2/-O6), generation of debug symbols or stripping of debug symbols.
Kernel itself is an exception because it is tied very much to gcc and its behaviour. But things like
| CFLAGS = -fno-omit-frame-pointer -ggdb3
in the perf Makefile must be overridable by the build system.
Enrico
Quoted 18 lines · Enrico Scholz
Bruce Ashfield <[email protected]>
Quoted 9 lines · writes:
Quoted 4 lines
Quoted 1 line
+LDFLAGS="-ldl -lutil"
What is with -Wl,-as-needed or the gnu-hash ldflags which are applied usually? Perhaps, hacks like
We don't want to influence the perf build from the build system, unless we absolutely have to. We want to use the flags and configs that are contained within the kernel, just as we do with anything from the kernel tree in general.
Userspace programs should always be built with optimization flags of the build system. E.g. it would be wrong when packages override our idea of optimization (-Os/-O2/-O6), generation of debug symbols or stripping of debug symbols.
Quoted 6 lines
Kernel itself is an exception because it is tied very much to gcc and its behaviour. But things like
| CFLAGS = -fno-omit-frame-pointer -ggdb3
in the perf
Makefilemust be overridable by the build system.
I don't agree on this. perf is tied to kernel and part of its code so I think same exception rule apply for it as well.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Quoted 2 lines · Otavio Salvador
I don't agree on this. perf is tied to kernel and part of its code so I think same exception rule apply for it as well.
perf ships with the kernel but is a pure userspace program. It does not require any special setup ('make configure'), it links against complex userspace gui frameworks and uses userspace headers.
Enrico
Quoted 8 lines · Enrico Scholz
Quoted 2 lines · Otavio Salvador
I don't agree on this. perf is tied to kernel and part of its code so I think same exception rule apply for it as well.
perf ships with the kernel but is a pure userspace program. It does not require any special setup ('make configure'), it links against complex userspace gui frameworks and uses userspace headers.
yes, we realize this .. we have a long a complicated history with perf and the related build issues.
We are stating our general policy, interfere with it's build as little as possible.
Use extension variables, not clobber variables, etc.
Otherwise, we end up creating our own issues, and have the bugs to prove it :)
Bruce
Quoted 7 lines
Enrico
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Quoted 11 lines · Bruce Ashfield
Quoted 8 lines · Enrico Scholz
Quoted 2 lines · Otavio Salvador
I don't agree on this. perf is tied to kernel and part of its code so I think same exception rule apply for it as well.
perf ships with the kernel but is a pure userspace program. It does not require any special setup ('make configure'), it links against complex userspace gui frameworks and uses userspace headers.
Quoted 8 lines
yes, we realize this .. we have a long a complicated history with perf and the related build issues.
We are stating our general policy, interfere with it's build as little as possible.
Use extension variables, not clobber variables, etc.Otherwise, we end up creating our own issues, and have the bugs to prove it :)
For the record, I do think Enrico does have a valid point here. We do put things in CFLAGS and LDFLAGS which we expect *all* userspace to be built with. Things like the hash style, preferred debugging symbol options and so on are expected to be used for all userspace binaries.
So somehow we do need to ensure that when the kernel is building userspace binaries, it does use the options we expect and match the rest of the system.
Equally, I do understand the kernel build system is a complex beast in its own right.
We don't have to solve this instantly, but in general its considered a bug if things like the hash-style in LDFLAGS don't make it to the linker commandline. We do have QA tests that check for this, however they don't function as they used to since we hard set the option on when we compile the linker now :/.
Cheers,
Richard
Quoted 30 lines · Richard Purdie
Quoted 11 lines · Bruce Ashfield
Quoted 8 lines · Enrico Scholz
Quoted 2 lines · Otavio Salvador
I don't agree on this. perf is tied to kernel and part of its code so I think same exception rule apply for it as well.
perf ships with the kernel but is a pure userspace program. It does not require any special setup ('make configure'), it links against complex userspace gui frameworks and uses userspace headers.
Quoted 8 lines
yes, we realize this .. we have a long a complicated history with perf and the related build issues.
We are stating our general policy, interfere with it's build as little as possible.
Use extension variables, not clobber variables, etc.Otherwise, we end up creating our own issues, and have the bugs to prove it :)
For the record, I do think Enrico does have a valid point here. We do put things in CFLAGS and LDFLAGS which we expect *all* userspace to be built with. Things like the hash style, preferred debugging symbol options and so on are expected to be used for all userspace binaries.
So somehow we do need to ensure that when the kernel is building userspace binaries, it does use the options we expect and match the rest of the system.
Quoted 8 lines
Equally, I do understand the kernel build system is a complex beast in its own right.
We don't have to solve this instantly, but in general its considered a bug if things like the hash-style in LDFLAGS don't make it to the linker commandline. We do have QA tests that check for this, however they don't function as they used to since we hard set the option on when we compile the linker now :/.
Right, don't get me wrong in my comments. I'm just saying that I'd rather add to the flags, versus completely clobber them. Since us imposing the complete set of flags, is what has caused us the pain .. not adding to them.
Bruce
Quoted 9 lines
Cheers,
Richard
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Quoted 41 lines · Bruce Ashfield
Quoted 30 lines · Richard Purdie
Quoted 11 lines · Bruce Ashfield
Quoted 8 lines · Enrico Scholz
Quoted 2 lines · Otavio Salvador
I don't agree on this. perf is tied to kernel and part of its code so I think same exception rule apply for it as well.
perf ships with the kernel but is a pure userspace program. It does not require any special setup ('make configure'), it links against complex userspace gui frameworks and uses userspace headers.
Quoted 8 lines
yes, we realize this .. we have a long a complicated history with perf and the related build issues.
We are stating our general policy, interfere with it's build as little as possible.
Use extension variables, not clobber variables, etc.Otherwise, we end up creating our own issues, and have the bugs to prove it :)
For the record, I do think Enrico does have a valid point here. We do put things in CFLAGS and LDFLAGS which we expect *all* userspace to be built with. Things like the hash style, preferred debugging symbol options and so on are expected to be used for all userspace binaries.
So somehow we do need to ensure that when the kernel is building userspace binaries, it does use the options we expect and match the rest of the system.
Quoted 8 lines
Equally, I do understand the kernel build system is a complex beast in its own right.
We don't have to solve this instantly, but in general its considered a bug if things like the hash-style in LDFLAGS don't make it to the linker commandline. We do have QA tests that check for this, however they don't function as they used to since we hard set the option on when we compile the linker now :/.
Quoted 3 lines
Right, don't get me wrong in my comments. I'm just saying that I'd rather add to the flags, versus completely clobber them. Since us imposing the complete set of flags, is what has caused us the pain .. not adding to them.
Isn't that what the patch at the start of this thread is doing though (clobbering, not adding)? :/
I really need to figure out whether to take this patch or not and it looks like there isn't an easy answer...
Cheers,
Richard
Quoted 42 lines · Richard Purdie
Quoted 41 lines · Bruce Ashfield
Quoted 38 lines · Richard Purdie
Quoted 11 lines · Bruce Ashfield
Quoted 8 lines · Enrico Scholz
Quoted 2 lines · Otavio Salvador
I don't agree on this. perf is tied to kernel and part of its code so I think same exception rule apply for it as well.
perf ships with the kernel but is a pure userspace program. It does not require any special setup ('make configure'), it links against complex userspace gui frameworks and uses userspace headers.
Quoted 8 lines
yes, we realize this .. we have a long a complicated history with perf and the related build issues.
We are stating our general policy, interfere with it's build as little as possible.
Use extension variables, not clobber variables, etc.Otherwise, we end up creating our own issues, and have the bugs to prove it :)
For the record, I do think Enrico does have a valid point here. We do put things in CFLAGS and LDFLAGS which we expect *all* userspace to be built with. Things like the hash style, preferred debugging symbol options and so on are expected to be used for all userspace binaries.
So somehow we do need to ensure that when the kernel is building userspace binaries, it does use the options we expect and match the rest of the system.
Equally, I do understand the kernel build system is a complex beast in its own right.
We don't have to solve this instantly, but in general its considered a bug if things like the hash-style in LDFLAGS don't make it to the linker commandline. We do have QA tests that check for this, however they don't function as they used to since we hard set the option on when we compile the linker now :/.
Quoted 6 lines
Quoted 3 lines
Right, don't get me wrong in my comments. I'm just saying that I'd rather add to the flags, versus completely clobber them. Since us imposing the complete set of flags, is what has caused us the pain .. not adding to them.
Isn't that what the patch at the start of this thread is doing though (clobbering, not adding)? :/
It definitely is, and I had put in the bugzilla that it is a compromise for now, since perf only offers EXTRA_CFLAGS and not EXTRA_LDFLAGS. I'll see about addressing that upstream once we get out of this fix :)
Bruce
Quoted 8 lines
I really need to figure out whether to take this patch or not and it looks like there isn't an easy answer...
Cheers,
Richard
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Quoted 1 line · Bruce Ashfield
On Wed, Sep 18, 2013 at 12:23 PM, Richard Purdie
...
Quoted 6 lines
Quoted 2 lines
Isn't that what the patch at the start of this thread is doing though (clobbering, not adding)? :/
It definitely is, and I had put in the bugzilla that it is a compromise for now, since perf only offers
EXTRA_CFLAGSand notEXTRA_LDFLAGS. I'll see about addressing that upstream once we get out of this fix :)
For now, this seems to address all urgent issues; so please pick this one.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
meta/recipes-kernel/perf/perf.bb B = "${WORKDIR}/${BPN}-${PV}" · line 66
Quoted 4 lines · Otavio Salvador
meta/recipes-kernel/perf/perf.bb +4
-0+# The LDFLAGS is required or some old kernels fails due missing +# symbols and this is preferred than requiring patches to every old +# supported kernel. +LDFLAGS="-ldl -lutil"
LDFLAGS is usually the wrong variable for extra libs (it might conflict with '-Wl,-as-needed' or lib-grouping). Adding new libs to perf seems to require the modification of EXTLIBS because of
| LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group | ... |$(OUTPUT)perf-%: %.o $(PERFLIBS) | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
Enrico