Discussion:
using autoconf to create build scripts for Assembly language programs
Basin Ilya
2018-06-08 07:36:51 UTC
Permalink
It might be late, but if you ever want to use /usr/bin/as, here's what you need to change:

- In AM_INIT_AUTOMAKE add '-Wno-override' after '-Wall' to allow override Automake rules:

AM_INIT_AUTOMAKE([-Wall -Wno-override -Werror])

- In Makefile.am add the custom rule:

.s.o:
$(AS) $(ASFLAGS) -o $@ $<

- Don't use AM_CCASFLAGS.
Thanks for the reply, that did help a bit but was not able to remove the
-c option
I passed./configure CCAS=/usr/bin/as CFLAGS=''
make all-am
make[1]: Entering directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
/usr/bin/as --gstabs+ -c -o hello.o hello.s
The automake documentation states that when you use AM_PROG_AS, your
assembler MUST behave like a C compiler, in that it MUST accept -c and -o.
If /usr/bin/as does not accept -c, then you'll have to provide a
shell-script wrapper that adds that functionality on top of /usr/bin/as, at
least according to the automake documentation.
But again, the autoconf list is not the best list to be asking this;
you'll (hopefully) get better response on the automake list, since it is an
automake feature you are trying to use.
I was able to resolve it now using gcc itself instead of /usr/binas to
compile and link the assembler using below method
Makefile.am
bin_PROGRAMS = hello
hello_SOURCES = hello.s
hello_LDFLAGS=-nostdlib -lgcc -Wl,-e_start
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
_______________________________________________
Autoconf mailing list
https://lists.gnu.org/mailman/listinfo/autoconf
mallapadi niranjan
2018-06-08 12:24:53 UTC
Permalink
Post by Basin Ilya
AM_INIT_AUTOMAKE([-Wall -Wno-override -Werror])
- Don't use AM_CCASFLAGS.
Thanks that did help, but for linker it still uses gcc , can we override
that too to use /usr/bin/ld , ?

bin_PROGRAMS = hello
hello_SOURCES = hello.s
ASFLAGS = -gstabs+
hello_LDFLAGS=-nostdlib -lgcc -Wl,-e_start

.s.o:
$(AS) $(ASFLAGS) -o $@ $<


output of make after the above changes:

<snip>
[***@mydevel foobar]$ make
make all-am
make[1]: Entering directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
as -gstabs+ -o hello.o hello.s
gcc -g -O2 -nostdlib -lgcc -Wl,-e_start -o hello hello.o
make[1]: Leaving directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
</snip>
Post by Basin Ilya
Thanks for the reply, that did help a bit but was not able to remove
the
-c option
I passed./configure CCAS=/usr/bin/as CFLAGS=''
make all-am
make[1]: Entering directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
/usr/bin/as --gstabs+ -c -o hello.o hello.s
The automake documentation states that when you use AM_PROG_AS, your
assembler MUST behave like a C compiler, in that it MUST accept -c and
-o.
If /usr/bin/as does not accept -c, then you'll have to provide a
shell-script wrapper that adds that functionality on top of
/usr/bin/as, at
least according to the automake documentation.
But again, the autoconf list is not the best list to be asking this;
you'll (hopefully) get better response on the automake list, since it
is an
automake feature you are trying to use.
I was able to resolve it now using gcc itself instead of /usr/binas to
compile and link the assembler using below method
Makefile.am
bin_PROGRAMS = hello
hello_SOURCES = hello.s
hello_LDFLAGS=-nostdlib -lgcc -Wl,-e_start
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
_______________________________________________
Autoconf mailing list
https://lists.gnu.org/mailman/listinfo/autoconf
Basin Ilya
2018-06-08 13:18:59 UTC
Permalink
Post by mallapadi niranjan
Post by Basin Ilya
It might be late, but if you ever want to use /usr/bin/as, here's what you
AM_INIT_AUTOMAKE([-Wall -Wno-override -Werror])
- Don't use AM_CCASFLAGS.
Thanks that did help, but for linker it still uses gcc , can we override
that too to use /usr/bin/ld , ?
bin_PROGRAMS = hello
hello_SOURCES = hello.s
ASFLAGS = -gstabs+
hello_LDFLAGS=-nostdlib -lgcc -Wl,-e_start
<snip>
make all-am
make[1]: Entering directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
as -gstabs+ -o hello.o hello.s
gcc -g -O2 -nostdlib -lgcc -Wl,-e_start -o hello hello.o
make[1]: Leaving directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
</snip>
Post by Basin Ilya
Thanks for the reply, that did help a bit but was not able to remove
the
-c option
I passed./configure CCAS=/usr/bin/as CFLAGS=''
make all-am
make[1]: Entering directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
/usr/bin/as --gstabs+ -c -o hello.o hello.s
The automake documentation states that when you use AM_PROG_AS, your
assembler MUST behave like a C compiler, in that it MUST accept -c and
-o.
If /usr/bin/as does not accept -c, then you'll have to provide a
shell-script wrapper that adds that functionality on top of
/usr/bin/as, at
least according to the automake documentation.
But again, the autoconf list is not the best list to be asking this;
you'll (hopefully) get better response on the automake list, since it
is an
automake feature you are trying to use.
I was able to resolve it now using gcc itself instead of /usr/binas to
compile and link the assembler using below method
Makefile.am
bin_PROGRAMS = hello
hello_SOURCES = hello.s
hello_LDFLAGS=-nostdlib -lgcc -Wl,-e_start
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
_______________________________________________
Autoconf mailing list
https://lists.gnu.org/mailman/listinfo/autoconf
_______________________________________________
Autoconf mailing list
https://lists.gnu.org/mailman/listinfo/autoconf
mallapadi niranjan
2018-06-08 13:34:23 UTC
Permalink
Thanks that resolved the issue.
Post by Basin Ilya
Post by mallapadi niranjan
Post by Basin Ilya
It might be late, but if you ever want to use /usr/bin/as, here's what
you
Post by mallapadi niranjan
Post by Basin Ilya
- In AM_INIT_AUTOMAKE add '-Wno-override' after '-Wall' to allow
override
Post by mallapadi niranjan
Post by Basin Ilya
AM_INIT_AUTOMAKE([-Wall -Wno-override -Werror])
- Don't use AM_CCASFLAGS.
Thanks that did help, but for linker it still uses gcc , can we override
that too to use /usr/bin/ld , ?
bin_PROGRAMS = hello
hello_SOURCES = hello.s
ASFLAGS = -gstabs+
hello_LDFLAGS=-nostdlib -lgcc -Wl,-e_start
<snip>
make all-am
make[1]: Entering directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
as -gstabs+ -o hello.o hello.s
gcc -g -O2 -nostdlib -lgcc -Wl,-e_start -o hello hello.o
make[1]: Leaving directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
</snip>
Post by Basin Ilya
Thanks for the reply, that did help a bit but was not able to
remove
Post by mallapadi niranjan
Post by Basin Ilya
the
-c option
I passed./configure CCAS=/usr/bin/as CFLAGS=''
make all-am
make[1]: Entering directory
`/home/ashok/practice/ia32/myasm/autotools/foobar'
/usr/bin/as --gstabs+ -c -o hello.o hello.s
The automake documentation states that when you use AM_PROG_AS, your
assembler MUST behave like a C compiler, in that it MUST accept -c and
-o.
If /usr/bin/as does not accept -c, then you'll have to provide a
shell-script wrapper that adds that functionality on top of
/usr/bin/as, at
least according to the automake documentation.
But again, the autoconf list is not the best list to be asking this;
you'll (hopefully) get better response on the automake list, since it
is an
automake feature you are trying to use.
I was able to resolve it now using gcc itself instead of /usr/binas to
compile and link the assembler using below method
Makefile.am
bin_PROGRAMS = hello
hello_SOURCES = hello.s
hello_LDFLAGS=-nostdlib -lgcc -Wl,-e_start
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
_______________________________________________
Autoconf mailing list
https://lists.gnu.org/mailman/listinfo/autoconf
_______________________________________________
Autoconf mailing list
https://lists.gnu.org/mailman/listinfo/autoconf
Loading...