All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6] poky-tiny: enable section removal
@ 2020-11-13 22:14 Sinan Kaya
  2020-11-14 16:14 ` [poky] " Richard Purdie
  2020-11-14 20:23 ` Paul Barker
  0 siblings, 2 replies; 6+ messages in thread
From: Sinan Kaya @ 2020-11-13 22:14 UTC (permalink / raw)
  To: poky; +Cc: Sinan Kaya

Use GCC sections flags so that unused sections can be garbage
collected at link time.

Signed-off-by: Sinan Kaya <okaya@kernel.org>
---
 meta-poky/conf/distro/include/gcsections.inc | 19 +++++++++++++++++++
 meta-poky/conf/distro/poky-tiny.conf         |  3 +++
 2 files changed, 22 insertions(+)
 create mode 100644 meta-poky/conf/distro/include/gcsections.inc

diff --git a/meta-poky/conf/distro/include/gcsections.inc b/meta-poky/conf/distro/include/gcsections.inc
new file mode 100644
index 00000000000..d94f25913bb
--- /dev/null
+++ b/meta-poky/conf/distro/include/gcsections.inc
@@ -0,0 +1,19 @@
+CFLAGS_SECTION_REMOVAL = "-ffunction-sections -fdata-sections"
+LDFLAGS_SECTION_REMOVAL = "-Wl,--gc-sections"
+
+# packages with build problems using sections
+CFLAGS_SECTION_REMOVAL_pn-glibc = ""
+LDFLAGS_SECTION_REMOVAL_pn-glibc = ""
+CFLAGS_section_removal_pn-cairo = ""
+LDFLAGS_section_removal_pn-cairo = ""
+CFLAGS_section_removal_pn-perl = ""
+LDFLAGS_section_removal_pn-perl = ""
+
+# omit section removal on native builds
+CFLAGS_SECTION_REMOVAL_class-native = ""
+LDFLAGS_SECTION_REMOVAL_class-native = ""
+
+# set default for all targets
+CFLAGS_append = " ${CFLAGS_SECTION_REMOVAL}"
+LDFLAGS_append = " ${LDFLAGS_SECTION_REMOVAL}"
+
diff --git a/meta-poky/conf/distro/poky-tiny.conf b/meta-poky/conf/distro/poky-tiny.conf
index c6d4b88f83d..9507a68a11e 100644
--- a/meta-poky/conf/distro/poky-tiny.conf
+++ b/meta-poky/conf/distro/poky-tiny.conf
@@ -29,6 +29,8 @@
 # [ ] Modify busybox to allow for DISTRO_FEATURES-like confiruration
 
 require conf/distro/poky.conf
+require conf/distro/include/gcsections.inc
+
 DISTRO = "poky-tiny"
 DISTROOVERRIDES = "poky:poky-tiny"
 TCLIBC = "musl"
@@ -122,3 +124,4 @@ PNBLACKLIST[core-image-weston] = "not buildable with poky-tiny"
 
 # Disable python usage in opkg-utils since it won't build with tiny config
 PACKAGECONFIG_remove_pn-opkg-utils = "python"
+
-- 
2.17.1


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

* Re: [poky] [PATCH v6] poky-tiny: enable section removal
  2020-11-13 22:14 [PATCH v6] poky-tiny: enable section removal Sinan Kaya
@ 2020-11-14 16:14 ` Richard Purdie
  2020-11-14 20:06   ` Sinan Kaya
  2020-11-14 20:23 ` Paul Barker
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2020-11-14 16:14 UTC (permalink / raw)
  To: Sinan Kaya, poky

On Fri, 2020-11-13 at 22:14 +0000, Sinan Kaya wrote:
> Use GCC sections flags so that unused sections can be garbage
> collected at link time.
> 
> Signed-off-by: Sinan Kaya <okaya@kernel.org>
> ---
>  meta-poky/conf/distro/include/gcsections.inc | 19
> +++++++++++++++++++
>  meta-poky/conf/distro/poky-tiny.conf         |  3 +++
>  2 files changed, 22 insertions(+)
>  create mode 100644 meta-poky/conf/distro/include/gcsections.inc

Still seems to be the same?

https://autobuilder.yoctoproject.org/typhoon/#/builders/15/builds/2984

How are you testing this? I know people can have problems with patches
but this is getting a little silly :(.

Cheers,

Richard


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

* Re: [poky] [PATCH v6] poky-tiny: enable section removal
  2020-11-14 16:14 ` [poky] " Richard Purdie
@ 2020-11-14 20:06   ` Sinan Kaya
  0 siblings, 0 replies; 6+ messages in thread
From: Sinan Kaya @ 2020-11-14 20:06 UTC (permalink / raw)
  To: Richard Purdie, poky

On 11/14/2020 11:14 AM, Richard Purdie wrote:
> Still seems to be the same?
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/15/builds/2984
> 
> How are you testing this? I know people can have problems with patches
> but this is getting a little silly :(.

Let me take a closer look. I originally tested this on thud and dunfell.
I have not tested against master branch.

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

* Re: [poky] [PATCH v6] poky-tiny: enable section removal
  2020-11-13 22:14 [PATCH v6] poky-tiny: enable section removal Sinan Kaya
  2020-11-14 16:14 ` [poky] " Richard Purdie
@ 2020-11-14 20:23 ` Paul Barker
  2020-11-14 20:53   ` Sinan Kaya
  1 sibling, 1 reply; 6+ messages in thread
From: Paul Barker @ 2020-11-14 20:23 UTC (permalink / raw)
  To: Sinan Kaya; +Cc: poky

On Fri, 13 Nov 2020 at 22:14, Sinan Kaya <okaya@kernel.org> wrote:
>
> Use GCC sections flags so that unused sections can be garbage
> collected at link time.
>
> Signed-off-by: Sinan Kaya <okaya@kernel.org>
> ---
>  meta-poky/conf/distro/include/gcsections.inc | 19 +++++++++++++++++++
>  meta-poky/conf/distro/poky-tiny.conf         |  3 +++
>  2 files changed, 22 insertions(+)
>  create mode 100644 meta-poky/conf/distro/include/gcsections.inc
>
> diff --git a/meta-poky/conf/distro/include/gcsections.inc b/meta-poky/conf/distro/include/gcsections.inc
> new file mode 100644
> index 00000000000..d94f25913bb
> --- /dev/null
> +++ b/meta-poky/conf/distro/include/gcsections.inc
> @@ -0,0 +1,19 @@
> +CFLAGS_SECTION_REMOVAL = "-ffunction-sections -fdata-sections"
> +LDFLAGS_SECTION_REMOVAL = "-Wl,--gc-sections"
> +
> +# packages with build problems using sections
> +CFLAGS_SECTION_REMOVAL_pn-glibc = ""
> +LDFLAGS_SECTION_REMOVAL_pn-glibc = ""
> +CFLAGS_section_removal_pn-cairo = ""
> +LDFLAGS_section_removal_pn-cairo = ""
> +CFLAGS_section_removal_pn-perl = ""
> +LDFLAGS_section_removal_pn-perl = ""

Are you sure "section_removal" should be lower case here?

> +
> +# omit section removal on native builds
> +CFLAGS_SECTION_REMOVAL_class-native = ""
> +LDFLAGS_SECTION_REMOVAL_class-native = ""

This still applies the flags to -nativesdk builds, possibly to other
builds as well. Instead you should only append the flags for
class-target.

> +
> +# set default for all targets
> +CFLAGS_append = " ${CFLAGS_SECTION_REMOVAL}"
> +LDFLAGS_append = " ${LDFLAGS_SECTION_REMOVAL}"

This isn't ideal. You should use CFLAGS_append_class-target and
similar for LDFLAGS here.

> +

This looks like stray whitespace.

> diff --git a/meta-poky/conf/distro/poky-tiny.conf b/meta-poky/conf/distro/poky-tiny.conf
> index c6d4b88f83d..9507a68a11e 100644
> --- a/meta-poky/conf/distro/poky-tiny.conf
> +++ b/meta-poky/conf/distro/poky-tiny.conf
> @@ -29,6 +29,8 @@
>  # [ ] Modify busybox to allow for DISTRO_FEATURES-like confiruration
>
>  require conf/distro/poky.conf
> +require conf/distro/include/gcsections.inc
> +
>  DISTRO = "poky-tiny"
>  DISTROOVERRIDES = "poky:poky-tiny"
>  TCLIBC = "musl"
> @@ -122,3 +124,4 @@ PNBLACKLIST[core-image-weston] = "not buildable with poky-tiny"
>
>  # Disable python usage in opkg-utils since it won't build with tiny config
>  PACKAGECONFIG_remove_pn-opkg-utils = "python"
> +

This also looks like stray whitespace.

-- 
Paul Barker
Konsulko Group

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

* Re: [poky] [PATCH v6] poky-tiny: enable section removal
  2020-11-14 20:23 ` Paul Barker
@ 2020-11-14 20:53   ` Sinan Kaya
  2020-11-14 22:24     ` Paul Barker
  0 siblings, 1 reply; 6+ messages in thread
From: Sinan Kaya @ 2020-11-14 20:53 UTC (permalink / raw)
  To: Paul Barker; +Cc: poky

On 11/14/2020 3:23 PM, Paul Barker wrote:
> On Fri, 13 Nov 2020 at 22:14, Sinan Kaya <okaya@kernel.org> wrote:
>>
>> Use GCC sections flags so that unused sections can be garbage
>> collected at link time.
>>
>> Signed-off-by: Sinan Kaya <okaya@kernel.org>
>> ---
>>  meta-poky/conf/distro/include/gcsections.inc | 19 +++++++++++++++++++
>>  meta-poky/conf/distro/poky-tiny.conf         |  3 +++
>>  2 files changed, 22 insertions(+)
>>  create mode 100644 meta-poky/conf/distro/include/gcsections.inc
>>
>> diff --git a/meta-poky/conf/distro/include/gcsections.inc b/meta-poky/conf/distro/include/gcsections.inc
>> new file mode 100644
>> index 00000000000..d94f25913bb
>> --- /dev/null
>> +++ b/meta-poky/conf/distro/include/gcsections.inc
>> @@ -0,0 +1,19 @@
>> +CFLAGS_SECTION_REMOVAL = "-ffunction-sections -fdata-sections"
>> +LDFLAGS_SECTION_REMOVAL = "-Wl,--gc-sections"
>> +
>> +# packages with build problems using sections
>> +CFLAGS_SECTION_REMOVAL_pn-glibc = ""
>> +LDFLAGS_SECTION_REMOVAL_pn-glibc = ""
>> +CFLAGS_section_removal_pn-cairo = ""
>> +LDFLAGS_section_removal_pn-cairo = ""
>> +CFLAGS_section_removal_pn-perl = ""
>> +LDFLAGS_section_removal_pn-perl = ""
> 
> Are you sure "section_removal" should be lower case here?
> 

Copy/paste screw up.

>> +
>> +# omit section removal on native builds
>> +CFLAGS_SECTION_REMOVAL_class-native = ""
>> +LDFLAGS_SECTION_REMOVAL_class-native = ""
> 
> This still applies the flags to -nativesdk builds, possibly to other
> builds as well. Instead you should only append the flags for
> class-target.
> 

This was my original version. Khem wanted to increase the scope to
nativesdk too. I'll go back to class-target.

>> +
>> +# set default for all targets
>> +CFLAGS_append = " ${CFLAGS_SECTION_REMOVAL}"
>> +LDFLAGS_append = " ${LDFLAGS_SECTION_REMOVAL}"
> 
> This isn't ideal. You should use CFLAGS_append_class-target and
> similar for LDFLAGS here.
> 

sounds good.

>> +
> 
> This looks like stray whitespace.
> 

ok

>> diff --git a/meta-poky/conf/distro/poky-tiny.conf b/meta-poky/conf/distro/poky-tiny.conf
>> index c6d4b88f83d..9507a68a11e 100644
>> --- a/meta-poky/conf/distro/poky-tiny.conf
>> +++ b/meta-poky/conf/distro/poky-tiny.conf
>> @@ -29,6 +29,8 @@
>>  # [ ] Modify busybox to allow for DISTRO_FEATURES-like confiruration
>>
>>  require conf/distro/poky.conf
>> +require conf/distro/include/gcsections.inc
>> +
>>  DISTRO = "poky-tiny"
>>  DISTROOVERRIDES = "poky:poky-tiny"
>>  TCLIBC = "musl"
>> @@ -122,3 +124,4 @@ PNBLACKLIST[core-image-weston] = "not buildable with poky-tiny"
>>
>>  # Disable python usage in opkg-utils since it won't build with tiny config
>>  PACKAGECONFIG_remove_pn-opkg-utils = "python"
>> +
> 
> This also looks like stray whitespace.
> 

ok


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

* Re: [poky] [PATCH v6] poky-tiny: enable section removal
  2020-11-14 20:53   ` Sinan Kaya
@ 2020-11-14 22:24     ` Paul Barker
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Barker @ 2020-11-14 22:24 UTC (permalink / raw)
  To: Sinan Kaya, Khem Raj; +Cc: poky

On Sat, 14 Nov 2020 at 20:53, Sinan Kaya <okaya@kernel.org> wrote:
>
> On 11/14/2020 3:23 PM, Paul Barker wrote:
> > On Fri, 13 Nov 2020 at 22:14, Sinan Kaya <okaya@kernel.org> wrote:
> >>
> >> Use GCC sections flags so that unused sections can be garbage
> >> collected at link time.
> >>
> >> Signed-off-by: Sinan Kaya <okaya@kernel.org>
> >> ---
> >>  meta-poky/conf/distro/include/gcsections.inc | 19 +++++++++++++++++++
> >>  meta-poky/conf/distro/poky-tiny.conf         |  3 +++
> >>  2 files changed, 22 insertions(+)
> >>  create mode 100644 meta-poky/conf/distro/include/gcsections.inc
> >>
> >> diff --git a/meta-poky/conf/distro/include/gcsections.inc b/meta-poky/conf/distro/include/gcsections.inc
> >> new file mode 100644
> >> index 00000000000..d94f25913bb
> >> --- /dev/null
> >> +++ b/meta-poky/conf/distro/include/gcsections.inc
> >> @@ -0,0 +1,19 @@
> >> +CFLAGS_SECTION_REMOVAL = "-ffunction-sections -fdata-sections"
> >> +LDFLAGS_SECTION_REMOVAL = "-Wl,--gc-sections"
> >> +
> >> +# packages with build problems using sections
> >> +CFLAGS_SECTION_REMOVAL_pn-glibc = ""
> >> +LDFLAGS_SECTION_REMOVAL_pn-glibc = ""
> >> +CFLAGS_section_removal_pn-cairo = ""
> >> +LDFLAGS_section_removal_pn-cairo = ""
> >> +CFLAGS_section_removal_pn-perl = ""
> >> +LDFLAGS_section_removal_pn-perl = ""
> >
> > Are you sure "section_removal" should be lower case here?
> >
>
> Copy/paste screw up.
>
> >> +
> >> +# omit section removal on native builds
> >> +CFLAGS_SECTION_REMOVAL_class-native = ""
> >> +LDFLAGS_SECTION_REMOVAL_class-native = ""
> >
> > This still applies the flags to -nativesdk builds, possibly to other
> > builds as well. Instead you should only append the flags for
> > class-target.
> >
>
> This was my original version. Khem wanted to increase the scope to
> nativesdk too. I'll go back to class-target.

If that's the case I advise explicitly listing the classes you do want
the flags to apply to (_class-target & _class-nativesdk) instead of
listing the classes to exclude. That would avoid the risk of applying
flags to other classes which haven't been considered.

Khem: Any thoughts here?

-- 
Paul Barker
Konsulko Group

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

end of thread, other threads:[~2020-11-14 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 22:14 [PATCH v6] poky-tiny: enable section removal Sinan Kaya
2020-11-14 16:14 ` [poky] " Richard Purdie
2020-11-14 20:06   ` Sinan Kaya
2020-11-14 20:23 ` Paul Barker
2020-11-14 20:53   ` Sinan Kaya
2020-11-14 22:24     ` Paul Barker

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.