public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: GCC Development <gcc@gcc.gnu.org>
Subject: Re: Use -ftls-model=local-exec for RTEMS by default?
Date: Wed, 20 Jul 2022 11:28:39 +0200	[thread overview]
Message-ID: <ab6e2b74-e738-2e12-494e-b1f713082f92@embedded-brains.de> (raw)
In-Reply-To: <de6f30ad-f4a5-e870-3e69-202675b54532@embedded-brains.de>

On 20/07/2022 10:43, Sebastian Huber wrote:
> Hello,
> 
> RTEMS applications are usually fully statically linked together with the 
> operating system. So, we can use the -ftls-model=local-exec TLS model. 
> The default value for this option is defined in common.opt:
> 
> ftls-model=
> Common Joined RejectNegative Enum(tls_model) Var(flag_tls_default) 
> Init(TLS_MODEL_GLOBAL_DYNAMIC)
> -ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec]    
> Set the default thread-local storage code generation model.
> 
> Would it be possible to customize the default value for RTEMS?

I think this could be done by adding

#define CC1_SPEC "%{!ftls-model=*:-ftls-model=local-exec}"

to gcc/config/rtems.h. However, the CC1_SPEC is also defined by several 
targets. Would it be possible to add an OS_CC1_SPEC like this?

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index bb07cc244e3..7ddabc888b0 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -709,6 +709,12 @@ proper position among the other output files.  */
  #define CC1_SPEC ""
  #endif

+/* config.h can define OS_CC1_SPEC to provide extra args to cc1 and cc1plus
+   or operating system specific extra switch-translations.  */
+#ifndef OS_CC1_SPEC
+#define OS_CC1_SPEC ""
+#endif
+
  /* config.h can define CC1PLUS_SPEC to provide extra args to cc1plus
     or extra switch-translations.  */
  #ifndef CC1PLUS_SPEC
@@ -1194,7 +1200,7 @@ proper position among the other output files.  */
  static const char *asm_debug = ASM_DEBUG_SPEC;
  static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC;
  static const char *cpp_spec = CPP_SPEC;
-static const char *cc1_spec = CC1_SPEC;
+static const char *cc1_spec = CC1_SPEC OS_CC1_SPEC;
  static const char *cc1plus_spec = CC1PLUS_SPEC;
  static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
  static const char *link_ssp_spec = LINK_SSP_SPEC;

How does Ada get its default TLS model?

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

  reply	other threads:[~2022-07-20  9:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20  8:43 Sebastian Huber
2022-07-20  9:28 ` Sebastian Huber [this message]
2022-07-20 11:41   ` Alexander Monakov
2022-07-20 11:48     ` Sebastian Huber
2022-07-20 13:01       ` Alexander Monakov
2022-07-21  5:25         ` Sebastian Huber
2022-07-21  8:03           ` Iain Sandoe
2022-07-22 11:19             ` Sebastian Huber
2022-07-22 11:35               ` Iain Sandoe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ab6e2b74-e738-2e12-494e-b1f713082f92@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).