[syslinux:elflink] ldlinux: Tag __syslinux_init() as __constructor

syslinux-bot for Matt Fleming matt.fleming at intel.com
Tue Apr 17 11:24:12 PDT 2012

Commit-ID:  0132132022e73d5720121695a9b96fe2eb264d80
Gitweb:     http://www.syslinux.org/commit/0132132022e73d5720121695a9b96fe2eb264d80
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Mon, 2 Apr 2012 12:53:59 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Tue, 17 Apr 2012 10:58:33 +0100

ldlinux: Tag __syslinux_init() as __constructor

We don't need to have control over exactly when __syslinux_init() is
executed, it just needs to be before we call syslinux_get_adv(). Let's
apply the __constructor tag to __syslinux_init() so that it is
executed before we enter ldlinux.c32's main(). This partially reverts
commit 487b67a9ce ("ldlinux: Remove __constructor attribute") because
we can now have __constructor functions in ldlinux.

By not calling __syslinux_init() directly we also avoid the following
build warning,

ldlinux.c: In function ‘main’:
ldlinux.c:131:2: warning: implicit declaration of function ‘__syslinux_init’

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

 com32/elflink/ldlinux/adv.c     |    2 +-
 com32/elflink/ldlinux/ldlinux.c |    1 -
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/com32/elflink/ldlinux/adv.c b/com32/elflink/ldlinux/adv.c
index 7869547..b81361f 100644
--- a/com32/elflink/ldlinux/adv.c
+++ b/com32/elflink/ldlinux/adv.c
@@ -40,7 +40,7 @@ void *__syslinux_adv_ptr;
 size_t __syslinux_adv_size;
 extern void adv_init(void);
-void __syslinux_init(void)
+void __constructor __syslinux_init(void)
     static com32sys_t reg;
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 56777b1..3cf6513 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -128,7 +128,6 @@ int main(int argc, char **argv)
-	__syslinux_init();
 	adv = syslinux_getadv(ADV_BOOTONCE, &count);
 	if (adv && count) {

More information about the Syslinux-commits mailing list