public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] CDL and makefile output
@ 2008-11-13  1:00 Jesper Skov
  2008-11-13  1:06 ` Bart Veer
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Skov @ 2008-11-13  1:00 UTC (permalink / raw)
  To: ecos-discuss

I am looking for a way to replace the below in hal.cdl:

    make -priority 250 {
        <PREFIX>/lib/extras.o: <PREFIX>/lib/libextras.a
        $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
    }

with something along the lines of:

--- hal.cdl	(revision 25)
+++ hal.cdl	(working copy)
@@ -71,10 +71,21 @@

     make -priority 250 {
         <PREFIX>/lib/extras.o: <PREFIX>/lib/libextras.a
-        $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
+        $(CC) $(CFLAGS) $(EXTRAS_LDFLAGS) -o $@ $<
     }

+        cdl_option CYGBLD_GLOBAL_EXTRAS_LDFLAGS {
+            display "Extras.o linker flags"
+            flavor  data
+	      parent  CYGBLD_GLOBAL_OPTIONS
+            no_define
+            default_value { "-nostdlib -Wl,-r -Wl,--whole-archive" }
+            description   "
+                This option controls the extras.o linker flags. Individual
+                packages may define options which override these global flags."
+        }


So I can modify the EXTRAS_LDFLAGS in a platform HAL.

Unfortunately, as far as I remember, CDL doesn't allow CDL values to
expanded in the make section. And I couldn't find anything to that
effect in the documentation or in the existing CDL files, so I figure
not much changed in this regard in the past 6 years. Or am I wrong?

Suggestions for alternative ways of handling this obviously accepted :)

Cheers,
Jesper

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* Re: [ECOS] CDL and makefile output
  2008-11-13  1:00 [ECOS] CDL and makefile output Jesper Skov
@ 2008-11-13  1:06 ` Bart Veer
  2008-11-14 16:16   ` Jesper Skov
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Veer @ 2008-11-13  1:06 UTC (permalink / raw)
  To: Jesper Skov; +Cc: ecos-discuss

>>>>> "Jesper" == Jesper Skov <jskov@zoftcorp.dk> writes:

    Jesper> I am looking for a way to replace the below in hal.cdl:
    Jesper>     make -priority 250 {
    Jesper>         <PREFIX>/lib/extras.o: <PREFIX>/lib/libextras.a
    Jesper>         $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
    Jesper>     }

    Jesper> with something along the lines of:

    Jesper> --- hal.cdl	(revision 25)
    Jesper> +++ hal.cdl	(working copy)
    Jesper> @@ -71,10 +71,21 @@

    Jesper>      make -priority 250 {
    Jesper>          <PREFIX>/lib/extras.o: <PREFIX>/lib/libextras.a
    Jesper> -        $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
    Jesper> +        $(CC) $(CFLAGS) $(EXTRAS_LDFLAGS) -o $@ $<
    Jesper>      }

    Jesper> +        cdl_option CYGBLD_GLOBAL_EXTRAS_LDFLAGS {
    Jesper> +            display "Extras.o linker flags"
    Jesper> +            flavor  data
    Jesper> +	      parent  CYGBLD_GLOBAL_OPTIONS
    Jesper> +            no_define
    Jesper> +            default_value { "-nostdlib -Wl,-r -Wl,--whole-archive" }
    Jesper> +            description   "
    Jesper> +                This option controls the extras.o linker flags. Individual
    Jesper> +                packages may define options which override these global flags."
    Jesper> +        }


    Jesper> So I can modify the EXTRAS_LDFLAGS in a platform HAL.

    Jesper> Unfortunately, as far as I remember, CDL doesn't allow CDL
    Jesper> values to expanded in the make section. And I couldn't
    Jesper> find anything to that effect in the documentation or in
    Jesper> the existing CDL files, so I figure not much changed in
    Jesper> this regard in the past 6 years. Or am I wrong?

    Jesper> Suggestions for alternative ways of handling this
    Jesper> obviously accepted :)

Sadly nothing has changed in this area, i.e. the makefile generator is
now another six years overdue for a major overhaul.

If you really need to do something like this, it is possible but not
easy. You can invoke a Tcl script from inside a custom build step,
along similar lines to the memalloc package. That Tcl script can read
in install/include/pkgconf/ecos.mak and anything else in pkgconf/ that
contains relevant options, e.g. your CYGBLD_GLOBAL_EXTRAS_LDFLAGS. It
can then exec the linker with the appropriate options.

Bart
    
-- 
Bart Veer                                   eCos Configuration Architect
eCosCentric Limited    The eCos experts      http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK.      Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* Re: [ECOS] CDL and makefile output
  2008-11-13  1:06 ` Bart Veer
@ 2008-11-14 16:16   ` Jesper Skov
  2008-11-14 17:40     ` Jonathan Larmour
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Skov @ 2008-11-14 16:16 UTC (permalink / raw)
  To: Bart Veer; +Cc: ecos-discuss

On Wed, Nov 12, 2008 at 10:15 PM, Bart Veer <bartv@ecoscentric.com> wrote:
> If you really need to do something like this, it is possible but not
> easy. You can invoke a Tcl script from inside a custom build step,
> along similar lines to the memalloc package. That Tcl script can read
> in install/include/pkgconf/ecos.mak and anything else in pkgconf/ that
> contains relevant options, e.g. your CYGBLD_GLOBAL_EXTRAS_LDFLAGS. It
> can then exec the linker with the appropriate options.

Uh, not liking the looks of that. Partly because I've never really
used Tcl, partly because keeping the logic in the makefile would be
nicer (IMHO, of course).

So I tried to see if I could do it in a simpler fashion. And I found a
solution after some tinkering. The real question is now, would
something like the below be accepted in a contribution?

Index: hal.cdl
===================================================================
--- hal.cdl	(revision 26)
+++ hal.cdl	(working copy)
@@ -71,10 +71,22 @@

     make -priority 250 {
         <PREFIX>/lib/extras.o: <PREFIX>/lib/libextras.a
-        $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
+        $(CC) $(CFLAGS) $(shell grep " EXTRAS_LDFLAGS "
$(PREFIX)/include/pkgconf/system.h | cut -d' '  -f 3-) -o $@ $<
     }

+    cdl_option CYGBLD_GLOBAL_EXTRAS_LDFLAGS {
+        display "Extras.o linker flags"
+        flavor  data
+	    parent  CYGBLD_GLOBAL_OPTIONS
+        no_define
+        define -file=system.h EXTRAS_LDFLAGS
+        default_value { "-nostdlib -Wl,-r -Wl,--whole-archive" }
+        description   "
+            This option controls the extras.o linker flags. Individual
+            packages may define options which override these global flags."
+    }


I have only tested in on BSD/OS X (where it works as intended) but I
can't see why it shouldn't work on Linux and Windows/CygWin.

Comments?

Cheers,
Jesper

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* Re: [ECOS] CDL and makefile output
  2008-11-14 16:16   ` Jesper Skov
@ 2008-11-14 17:40     ` Jonathan Larmour
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Larmour @ 2008-11-14 17:40 UTC (permalink / raw)
  To: Jesper Skov; +Cc: ecos-discuss

Jesper Skov wrote:
> On Wed, Nov 12, 2008 at 10:15 PM, Bart Veer <bartv@ecoscentric.com> wrote:
>> If you really need to do something like this, it is possible but not
>> easy. You can invoke a Tcl script from inside a custom build step,
>> along similar lines to the memalloc package. That Tcl script can read
>> in install/include/pkgconf/ecos.mak and anything else in pkgconf/ that
>> contains relevant options, e.g. your CYGBLD_GLOBAL_EXTRAS_LDFLAGS. It
>> can then exec the linker with the appropriate options.
> 
> Uh, not liking the looks of that. Partly because I've never really
> used Tcl, partly because keeping the logic in the makefile would be
> nicer (IMHO, of course).
> 
> So I tried to see if I could do it in a simpler fashion. And I found a
> solution after some tinkering. The real question is now, would
> something like the below be accepted in a contribution?
> 
> Index: hal.cdl
> ===================================================================
> --- hal.cdl	(revision 26)
> +++ hal.cdl	(working copy)
> @@ -71,10 +71,22 @@
> 
>      make -priority 250 {
>          <PREFIX>/lib/extras.o: <PREFIX>/lib/libextras.a
> -        $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
> +        $(CC) $(CFLAGS) $(shell grep " EXTRAS_LDFLAGS "
> $(PREFIX)/include/pkgconf/system.h | cut -d' '  -f 3-) -o $@ $<
>      }
> 
> +    cdl_option CYGBLD_GLOBAL_EXTRAS_LDFLAGS {
> +        display "Extras.o linker flags"
> +        flavor  data
> +	    parent  CYGBLD_GLOBAL_OPTIONS
> +        no_define
> +        define -file=system.h EXTRAS_LDFLAGS
> +        default_value { "-nostdlib -Wl,-r -Wl,--whole-archive" }
> +        description   "
> +            This option controls the extras.o linker flags. Individual
> +            packages may define options which override these global flags."
> +    }
> 
> 
> I have only tested in on BSD/OS X (where it works as intended) but I
> can't see why it shouldn't work on Linux and Windows/CygWin.

You've blocked out how bizarre cygwin can be sometimes :-). I remember
having problems with doing things like that because of text-mode mount
points in cygwin. Depending on where something was run from and/or the
value of the CYGWIN environment variable, you could get embedded carriage
returns cropping up in the output from things like that. Pipes were usually
the biggest headache. I'm not saying it would definitely happen. I don't
think even at the time I fully got my head round when it would and wouldn't
happen.

I don't know whether this is even more gross or not, but what you could do
is have a lower priority make rule in your platform HAL. So it would run
the unmodified hal.cdl generic version above, and then run your one,
replacing the extras.o file.

Another possibility might be to change the linker script. This would need
checking but I think extras.o is only referenced from the linker script,
and I don't think is referenced anywhere else. So your platform HAL could
generate a different filename to extras.o and the synth hal linker script
could have:

#ifndef CYGBLD_HAL_EXTRAS_FILENAME
#define CYGBLD_HAL_EXTRAS_FILENAME extras.o
#endif
INPUT(CYGBLD_HAL_EXTRAS_FILENAME)

What options do you need to add?

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------       Opinions==mine

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

end of thread, other threads:[~2008-11-14 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-13  1:00 [ECOS] CDL and makefile output Jesper Skov
2008-11-13  1:06 ` Bart Veer
2008-11-14 16:16   ` Jesper Skov
2008-11-14 17:40     ` Jonathan Larmour

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