All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH] minios: use NULL sentinel at end of [CD]TOR list
Date: Fri, 19 Aug 2011 17:51:09 -0700	[thread overview]
Message-ID: <4E4F04FD.6020600@goop.org> (raw)

Use the NULL pointer at the end of the [CD]TOR list rather than relying
on a count.

I hit a linker bug where the [CD]TOR list count was being miscomputed,
but its just simpler to use a sentinel.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

diff -r b81c0417b901 extras/mini-os/arch/ia64/minios-ia64.lds
--- a/extras/mini-os/arch/ia64/minios-ia64.lds	Wed Aug 17 16:08:41 2011 -0700
+++ b/extras/mini-os/arch/ia64/minios-ia64.lds	Wed Aug 17 17:04:10 2011 -0700
@@ -55,7 +55,6 @@
   .ctors : AT(ADDR(.ctors) - (((5<<(61))+0x100000000) - (1 << 20)))
 	{
         __CTOR_LIST__ = .;
-        QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
         *(.ctors)
 	CONSTRUCTORS
         QUAD(0)
@@ -65,7 +64,6 @@
   .dtors : AT(ADDR(.dtors) - (((5<<(61))+0x100000000) - (1 << 20)))
         {
         __DTOR_LIST__ = .;
-        QUAD((__DTOR_END__ - __DTOR_LIST__) / 8 - 2)
         *(.dtors)
         QUAD(0)
         __DTOR_END__ = .;
diff -r b81c0417b901 extras/mini-os/arch/x86/minios-x86_32.lds
--- a/extras/mini-os/arch/x86/minios-x86_32.lds	Wed Aug 17 16:08:41 2011 -0700
+++ b/extras/mini-os/arch/x86/minios-x86_32.lds	Wed Aug 17 17:04:10 2011 -0700
@@ -30,7 +30,6 @@
 
   .ctors : {
         __CTOR_LIST__ = .;
-        LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
         *(.ctors)
 	CONSTRUCTORS
         LONG(0)
@@ -39,7 +38,6 @@
 
   .dtors : {
         __DTOR_LIST__ = .;
-        LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
         *(.dtors)
         LONG(0)
         __DTOR_END__ = .;
diff -r b81c0417b901 extras/mini-os/arch/x86/minios-x86_64.lds
--- a/extras/mini-os/arch/x86/minios-x86_64.lds	Wed Aug 17 16:08:41 2011 -0700
+++ b/extras/mini-os/arch/x86/minios-x86_64.lds	Wed Aug 17 17:04:10 2011 -0700
@@ -30,7 +30,6 @@
 
   .ctors : {
         __CTOR_LIST__ = .;
-        QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
         *(.ctors)
 	CONSTRUCTORS
         QUAD(0)
@@ -39,7 +38,6 @@
 
   .dtors : {
         __DTOR_LIST__ = .;
-        QUAD((__DTOR_END__ - __DTOR_LIST__) / 8 - 2)
         *(.dtors)
         QUAD(0)
         __DTOR_END__ = .;
diff -r b81c0417b901 extras/mini-os/main.c
--- a/extras/mini-os/main.c	Wed Aug 17 16:08:41 2011 -0700
+++ b/extras/mini-os/main.c	Wed Aug 17 17:04:10 2011 -0700
@@ -153,7 +153,7 @@
 
     __libc_init_array();
     environ = envp;
-    for (i = 1; i <= __CTOR_LIST__[0]; i++)
+    for (i = 0; __CTOR_LIST__[i] != 0; i++)
         ((void((*)(void)))__CTOR_LIST__[i]) ();
     tzset();
 
@@ -164,7 +164,7 @@
 {
     int i;
 
-    for (i = 1; i <= __DTOR_LIST__[0]; i++)
+    for (i = 0; __DTOR_LIST__[i] != 0; i++)
         ((void((*)(void)))__DTOR_LIST__[i]) ();
     close_all_files();
     __libc_fini_array();

                 reply	other threads:[~2011-08-20  0:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4E4F04FD.6020600@goop.org \
    --to=jeremy@goop.org \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=xen-devel@lists.xensource.com \
    /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.