All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Why are some global vars part of the image, and some not?
Date: Fri, 03 Nov 2006 16:19:40 -0600	[thread overview]
Message-ID: <454BC07C.4090704@freescale.com> (raw)
In-Reply-To: <454BBB85.5040507@freescale.com>

Timur Tabi wrote:

> #ifdef CFG_SPD_BUS_NUM
> static volatile unsigned int i2c_bus_num = CFG_SPD_BUS_NUM;
> #else
> static volatile unsigned int i2c_bus_num = 0;
> #endif

Ok, I fixed my problem by changing the above line to:

static volatile unsigned int i2c_bus_num __attribute__ ((section ("data"))) = 0;

Is "data" the right section to use?  Here's my lds file:

OUTPUT_ARCH(powerpc)
SECTIONS
{
   /* Read-only sections, merged into text segment: */
   . = + SIZEOF_HEADERS;
   .interp : { *(.interp) }
   .hash          : { *(.hash)		}
   .dynsym        : { *(.dynsym)		}
   .dynstr        : { *(.dynstr)		}
   .rel.text      : { *(.rel.text)		}
   .rela.text     : { *(.rela.text) 	}
   .rel.data      : { *(.rel.data)		}
   .rela.data     : { *(.rela.data) 	}
   .rel.rodata    : { *(.rel.rodata) 	}
   .rela.rodata   : { *(.rela.rodata) 	}
   .rel.got       : { *(.rel.got)		}
   .rela.got      : { *(.rela.got)		}
   .rel.ctors     : { *(.rel.ctors)	}
   .rela.ctors    : { *(.rela.ctors)	}
   .rel.dtors     : { *(.rel.dtors)	}
   .rela.dtors    : { *(.rela.dtors)	}
   .rel.bss       : { *(.rel.bss)		}
   .rela.bss      : { *(.rela.bss)		}
   .rel.plt       : { *(.rel.plt)		}
   .rela.plt      : { *(.rela.plt)		}
   .init          : { *(.init)	}
   .plt : { *(.plt) }
   .text      :
   {
     cpu/mpc83xx/start.o	(.text)
     *(.text)
     *(.fixup)
     *(.got1)
     . = ALIGN(16);
     *(.rodata)
     *(.rodata1)
     *(.rodata.str1.4)
     *(.eh_frame)
   }
   .fini      : { *(.fini)    } =0
   .ctors     : { *(.ctors)   }
   .dtors     : { *(.dtors)   }

   /* Read-write section, merged into data segment: */
   . = (. + 0x0FFF) & 0xFFFFF000;
   _erotext = .;
   PROVIDE (erotext = .);
   .reloc   :
   {
     *(.got)
     _GOT2_TABLE_ = .;
     *(.got2)
     _FIXUP_TABLE_ = .;
     *(.fixup)
   }
   __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;

   .data    :
   {
     *(.data)
     *(.data1)
     *(.sdata)
     *(.sdata2)
     *(.dynamic)
     CONSTRUCTORS
   }
   _edata  =  .;
   PROVIDE (edata = .);

   . = .;
   __u_boot_cmd_start = .;
   .u_boot_cmd : { *(.u_boot_cmd) }
   __u_boot_cmd_end = .;


   . = .;
   __start___ex_table = .;
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;

   . = ALIGN(4096);
   __init_begin = .;
   .text.init : { *(.text.init) }
   .data.init : { *(.data.init) }
   . = ALIGN(4096);
   __init_end = .;

   __bss_start = .;
   .bss       :
   {
    *(.sbss) *(.scommon)
    *(.dynbss)
    *(.bss)
    *(COMMON)
   }
   _end = . ;
   PROVIDE (end = .);
}
ENTRY(_start)

-- 
Timur Tabi
Linux Kernel Developer @ Freescale

  reply	other threads:[~2006-11-03 22:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-03 21:58 [U-Boot-Users] Why are some global vars part of the image, and some not? Timur Tabi
2006-11-03 22:19 ` Timur Tabi [this message]
2006-11-03 23:47   ` Wolfgang Denk
2006-11-04  0:09     ` Timur Tabi
2006-11-04  0:33       ` Wolfgang Denk
2006-11-03 23:44 ` Wolfgang Denk
2006-11-04  0:07   ` Timur Tabi
2006-11-04  0:31     ` Wolfgang Denk
2006-11-04  1:38       ` Timur Tabi
2006-11-04  2:04         ` Wolfgang Denk
2006-11-06 17:43           ` Scott Wood
2006-11-06 18:03             ` Jerry Van Baren
2006-11-06 18:08               ` Timur Tabi
2006-11-06 18:48                 ` Jerry Van Baren
2006-11-06 18:56                   ` Scott Wood
2006-11-06 19:06                     ` Jerry Van Baren
2006-11-06 19:46                       ` Scott Wood
2006-11-06 19:54                         ` Timur Tabi
2006-11-06 20:13                         ` Jerry Van Baren
2006-11-06 20:21                           ` Timur Tabi
2006-11-06 20:44                             ` Wolfgang Denk
2006-11-06 20:35                         ` Tolunay Orkun
2006-11-06 20:29                 ` Wolfgang Denk
2006-11-06 20:26             ` Wolfgang Denk
2006-11-06 20:48               ` Scott Wood
2006-11-06 21:15                 ` Wolfgang Denk

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=454BC07C.4090704@freescale.com \
    --to=timur@freescale.com \
    --cc=u-boot@lists.denx.de \
    /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 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.