public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Named bss sections
@ 1997-09-02  7:15 Christian Iseli
  1997-09-02  9:18 ` Gavin Koch
  1997-09-04 22:30 ` Jeffrey A Law
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Iseli @ 1997-09-02  7:15 UTC (permalink / raw)
  To: egcs

In the gcc snapshot distributed by Cygnus with the cygwin32 tools, there was support
for named bss sections which had been added by someone at Cygnus.  This support
has disappeared from egcs.  Was there any reason?  If not, the following patch should
re-enable this.

Cheers,
					Christian


	* varasm.c (assemble_variable): Enable named bss sections.

*** varasm.c.orig	Mon Aug 11 17:57:14 1997
--- varasm.c	Tue Sep  2 10:05:38 1997
*************** assemble_variable (decl, top_level, at_e
*** 1350,1355 ****
--- 1350,1360 ----
    /* Handle uninitialized definitions.  */
  
    if ((DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)
+       /* Don't use bss if target supports attribute section and decl wants
+          to be in a specific section.  */
+ #ifdef ASM_OUTPUT_SECTION_NAME
+       && DECL_SECTION_NAME (decl) == NULL_TREE
+ #endif
        /* If the target can't output uninitialized but not common global data
  	 in .bss, then we have to use .data.  */
  #if ! defined (ASM_OUTPUT_BSS) && ! defined (ASM_OUTPUT_ALIGNED_BSS)

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Named bss sections
@ 1997-09-08  6:50 Christian Iseli
  1997-09-08  7:58 ` Jeffrey A Law
  1997-09-08 10:32 ` Martin Mares
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Iseli @ 1997-09-08  6:50 UTC (permalink / raw)
  To: law; +Cc: egcs

> Exactly what problem are you trying to solve.  As Gavin noted, we
> pulled that patch out as we thought it wasn't strictly necessary.
> 
> If it's necessary on your target, can you please explain why?

When you work with embedded targets, it is usually necessary to specify
where the variables reside in memory.  Most small processors have some
special mean of accessing certain area of their memory, e.g., the first
256 bytes of the RAM (0000 through 00FF) are often seen as "page 0" RAM
and the processor has special instructions to access that particular RAM area.
Moreover, most embedded target have I/O ports mapped in RAM at specific address
and defining those ports using sections is convenient.

Specifying where data reside in RAM is done through sectionning.  You tell
the linker to put a particular section of data at a specified RAM address.

GCC has provision to put global and static variables in user specified sections
using the section attribute, and though it says in the manual that it should
only be used for initialized variables, I see no hard reason for this restriction.
Using the -fno-common flag can partly solve the problem, except that local common
symbols are still output through the ASM_OUTPUT_LOCAL macro and are implicitely
forced to the .data section.

Basically, I want to be able to specify a section for any variable, not only
initialized ones.  For example, if a variable represents some input port mapped
in RAM, it would be wrong to have to initialize it to some value.

					Christian

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Named bss sections
@ 1997-09-09  4:15 Christian Iseli
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Iseli @ 1997-09-09  4:15 UTC (permalink / raw)
  To: law; +Cc: egcs

> I'll ask my question another way :-)  Show me a variable declaration that
> specifies a specific section, but doesn't end up where it belongs and is
> fixed by your patch.

Ah, now I see it.  Turns out my target code uses ENCODE_SECTION_INFO to decide
if it wants to put some small variables in a special section.  The code I wrote
forgot to clear the DECL_COMMON flag after assigning the variable to a section.
Silly me... the patch is not needed now that my other code is corrected.

					Christian

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

end of thread, other threads:[~1997-09-09  4:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-02  7:15 Named bss sections Christian Iseli
1997-09-02  9:18 ` Gavin Koch
1997-09-04 22:30 ` Jeffrey A Law
1997-09-08  6:50 Christian Iseli
1997-09-08  7:58 ` Jeffrey A Law
1997-09-08 10:32 ` Martin Mares
1997-09-09  4:15 Christian Iseli

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).