[1/1] gcc: Support configure option --with-linker-hash-style

Message ID 20171215232530.9388-1-stefan.froberg@petroprogram.com
State New
Headers show
Series
  • [1/1] gcc: Support configure option --with-linker-hash-style
Related show

Commit Message

Stefan Fröberg Dec. 15, 2017, 11:25 p.m.
This will set the default hash style that GCC will 
always use during linking.

Signed-off-by: Stefan Fröberg <stefan.froberg@petroprogram.com>
---
 package/gcc/Config.in.host | 27 +++++++++++++++++++++++++++
 package/gcc/gcc.mk         | 12 ++++++++++++
 2 files changed, 39 insertions(+)

Comments

Thomas Petazzoni Dec. 16, 2017, 3:23 p.m. | #1
Hello,

On Sat, 16 Dec 2017 01:25:30 +0200, Stefan Fröberg wrote:
> This will set the default hash style that GCC will 
> always use during linking.
> 
> Signed-off-by: Stefan Fröberg <stefan.froberg@petroprogram.com>

Could you explain the motivation for configuring the default hash
style? If "gnu" gives the best application startup time, why would we
use a different one?

Generally, the commit log lacks a bit of background, i.e the "why" we
would want such a change.

Thanks!

Thomas
Stefan Fröberg Dec. 17, 2017, 2:30 p.m. | #2
Hi Thomas

Well, I was just worried that if setting the linking hash style to stone
(aka "gnu") then could
it maybe break builds in some other archs than x86, x86_64 and ARM ?

So I played carefull and made it configurable by choice.

Im not sure but I think that option has been hiding in GCC since 4.x and
buildroot lowest is 4.9.
So if it's okay I can cook another patch where it just set's it in stone
without choice ?

-S-

Thomas Petazzoni kirjoitti 16.12.2017 klo 17:23:
> Hello,
>
> On Sat, 16 Dec 2017 01:25:30 +0200, Stefan Fröberg wrote:
>> This will set the default hash style that GCC will 
>> always use during linking.
>>
>> Signed-off-by: Stefan Fröberg <stefan.froberg@petroprogram.com>
> Could you explain the motivation for configuring the default hash
> style? If "gnu" gives the best application startup time, why would we
> use a different one?
>
> Generally, the commit log lacks a bit of background, i.e the "why" we
> would want such a change.
>
> Thanks!
>
> Thomas

Patch

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 70cce0a5c5..b9391392e1 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -152,3 +152,30 @@  config BR2_GCC_ENABLE_GRAPHITE
 
 comment "graphite support needs gcc >= 5.x"
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5
+
+choice 
+	prompt "Hash style used during linking"
+	default BR2_GCC_HASH_STYLE_GNU
+	help
+	  This tells GCC to pass --hash-style=choice option to the
+	  linker for all final links where choice can be one of
+	  "gnu", "sysv" or "both".
+	  Using "gnu" should give best application startup time.
+
+config BR2_GCC_HASH_STYLE_GNU
+	bool "gnu"
+	help
+	  For new style GNU ".gnu.hash" section.
+
+config BR2_GCC_HASH_STYLE_SYSV
+	bool "sysv"
+	help
+	  For classic ELF ".hash" section.
+
+config BR2_GCC_HASH_STYLE_BOTH
+	bool "both"
+	help
+	  For both the classic ELF ".hash" and
+	  new style GNU ".gnu.hash".
+
+endchoice	  
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 27fc1e987c..51bb22d0e9 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -183,6 +183,18 @@  else
 HOST_GCC_COMMON_CONF_OPTS += --without-isl --without-cloog
 endif
 
+ifeq ((BR2_GCC_HASH_STYLE_GNU),y)
+HOST_GCC_COMMON_CONF_OPTS += --with-linker-hash-style=gnu
+endif
+
+ifeq ((BR2_GCC_HASH_STYLE_SYSV),y)
+HOST_GCC_COMMON_CONF_OPTS += --with-linker-hash-style=sysv
+endif
+
+ifeq ((BR2_GCC_HASH_STYLE_BOTH),y)
+HOST_GCC_COMMON_CONF_OPTS += --with-linker-hash-style=both
+endif
+
 ifeq ($(BR2_arc)$(BR2_or1k),y)
 HOST_GCC_COMMON_DEPENDENCIES += host-flex host-bison
 endif