public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* binutils-2.15 requires flex/lex?
@ 2004-05-18  5:00 Ralf Corsepius
  2004-05-18 14:08 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Ralf Corsepius @ 2004-05-18  5:00 UTC (permalink / raw)
  To: Binutils List

Hi, 

trying to build the original binutils-2.15-tarball on a system without
having flex nor lex installed, causes this build error:

/usr/src/rpm/BUILD/rtems-4.7-sh-rtems4.7-binutils-2.15/binutils-2.15/ld/configure: line 4417: flex: command not found
checking for flex... lex
checking for yywrap in -ll... no
checking lex output file root...
/usr/src/rpm/BUILD/rtems-4.7-sh-rtems4.7-binutils-2.15/binutils-2.15/ld/configure: line 4505:
configure: error: cannot find output from lex; giving up
make: *** [configure-ld] Error 1

Ralf


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

* Re: binutils-2.15 requires flex/lex?
  2004-05-18  5:00 binutils-2.15 requires flex/lex? Ralf Corsepius
@ 2004-05-18 14:08 ` Daniel Jacobowitz
  2004-05-18 14:40   ` Objcopy and alignment Dave Murphy
  2004-05-19  3:29   ` binutils-2.15 requires flex/lex? Ralf Corsepius
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-05-18 14:08 UTC (permalink / raw)
  To: Ralf Corsepius; +Cc: Binutils List

On Tue, May 18, 2004 at 07:00:16AM +0200, Ralf Corsepius wrote:
> Hi, 
> 
> trying to build the original binutils-2.15-tarball on a system without
> having flex nor lex installed, causes this build error:
> 
> /usr/src/rpm/BUILD/rtems-4.7-sh-rtems4.7-binutils-2.15/binutils-2.15/ld/configure: line 4417: flex: command not found
> checking for flex... lex
> checking for yywrap in -ll... no
> checking lex output file root...
> /usr/src/rpm/BUILD/rtems-4.7-sh-rtems4.7-binutils-2.15/binutils-2.15/ld/configure: line 4505:
> configure: error: cannot find output from lex; giving up
> make: *** [configure-ld] Error 1

Please re-run this with sh -x.  I can't see how that happened; what
should have happened was "checking for flex... no".

-- 
Daniel Jacobowitz

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

* Objcopy and alignment
  2004-05-18 14:08 ` Daniel Jacobowitz
@ 2004-05-18 14:40   ` Dave Murphy
  2004-05-18 15:12     ` Dave Korn
  2004-05-19  3:29   ` binutils-2.15 requires flex/lex? Ralf Corsepius
  1 sibling, 1 reply; 5+ messages in thread
From: Dave Murphy @ 2004-05-18 14:40 UTC (permalink / raw)
  To: Binutils List

Is it possible to specify the alignment of binary data when using objcopy to
generate object  files from raw data? Failing that, can obcopy be told to
pad the length to, say, an even multiple of 4 bytes?

I'm currently using objcopy to link data in the executable for an embedded
target using makefile rules like this, to generate headers along with the
object file :-

define bin2o
	cp $(<) $(*).tmp
	$(OBJCOPY) -I binary -O elf32-littlearm -B arm \
	--rename-section .data=.rodata,readonly,data,contents \
	--redefine-sym _binary_$*_tmp_start=$*\
	--redefine-sym _binary_$*_tmp_end=$*_end\
	--redefine-sym _binary_$*_tmp_size=$*_size\
	$(*).tmp $(@)
	echo "extern const u8" $(*)"[];" > $(*).h
	echo "extern const u32" $(*)_size[]";" >> $(*).h
	rm $(*).tmp
endef

#---------------------------------------------------------------------------
------
%.o	:	%.pcx
#---------------------------------------------------------------------------
------
	@echo $(notdir $<)
	@$(bin2o)

occasionally the data is an odd length so any data following becomes
misaligned.


I've looked at the online docs -
http://sources.redhat.com/binutils/docs-2.15/binutils/objcopy.html and I can
see options for adjusting various addresses and a pad-to address option. How
can these options be used without knowing the addresses of the object being
modified? Surely they can't be known until link time?


Dave

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

* RE: Objcopy and alignment
  2004-05-18 14:40   ` Objcopy and alignment Dave Murphy
@ 2004-05-18 15:12     ` Dave Korn
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Korn @ 2004-05-18 15:12 UTC (permalink / raw)
  To: 'Binutils List'

> -----Original Message-----
> From: binutils-owner  On Behalf Of Dave Murphy
> Sent: 18 May 2004 15:40

> Is it possible to specify the alignment of binary data when 
> using objcopy to
> generate object  files from raw data? Failing that, can 
> obcopy be told to
> pad the length to, say, an even multiple of 4 bytes?


  Since you're using a whole load of shell scripting already, why not just
add a little bit more: you can pad a file $FILE to length four by processing
it like this:

echo -n $(( `cat ${FILE} | wc -c` & 3 )) | sed -e 's/0//g' | sed -e
's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g' >> ${FILE}

  I'm not second-nature enough with sed script syntax to know if all those
substitutions can be put into a single sed invocation, but that would be an
obvious optimisation if you can.  Here's an example, run against a bunch of
text files I generated from identical starting copies:

dk@mace /repository> cp size0.txt size1.txt
dk@mace /repository> cp size0.txt size2.txt
dk@mace /repository> cp size0.txt size3.txt
dk@mace /repository> cp size0.txt size4.txt
dk@mace /repository> cp size0.txt size5.txt
dk@mace /repository> echo -n a >>size1.txt
dk@mace /repository> echo -n ab >>size2.txt
dk@mace /repository> echo -n abc >>size3.txt
dk@mace /repository> echo -n abcd >>size4.txt
dk@mace /repository> echo -n abcde >>size5.txt
dk@mace /repository> ls -la size?.txt
-rw-r--r--    1 dk       Domain U      124 May 18 15:59 size0.txt
-rw-r--r--    1 dk       Domain U      125 May 18 16:06 size1.txt
-rw-r--r--    1 dk       Domain U      126 May 18 16:06 size2.txt
-rw-r--r--    1 dk       Domain U      127 May 18 16:06 size3.txt
-rw-r--r--    1 dk       Domain U      128 May 18 16:06 size4.txt
-rw-r--r--    1 dk       Domain U      129 May 18 16:07 size5.txt
dk@mace /repository> echo $(( `cat size0.txt | wc -c` & 3 )) | sed -e
's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g'

dk@mace /repository> echo $(( `cat size1.txt | wc -c` & 3 )) | sed -e
's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g'
XXX
dk@mace /repository> echo $(( `cat size2.txt | wc -c` & 3 )) | sed -e
's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g'
XX
dk@mace /repository> echo $(( `cat size3.txt | wc -c` & 3 )) | sed -e
's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g'
X
dk@mace /repository> echo $(( `cat size4.txt | wc -c` & 3 )) | sed -e
's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g'

dk@mace /repository> echo $(( `cat size5.txt | wc -c` & 3 )) | sed -e
's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g'
XXX
dk@mace /repository> # now try actually doing the append!
dk@mace /repository> echo -n $(( `cat size0.txt | wc -c` & 3 )) | sed
-e 's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g' >>
size
0.txt
dk@mace /repository> echo -n $(( `cat size1.txt | wc -c` & 3 )) | sed
-e 's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g' >>
size
1.txt
dk@mace /repository> echo -n $(( `cat size2.txt | wc -c` & 3 )) | sed
-e 's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g' >>
size
2.txt
dk@mace /repository> echo -n $(( `cat size3.txt | wc -c` & 3 )) | sed
-e 's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g' >>
size
3.txt
dk@mace /repository> echo -n $(( `cat size4.txt | wc -c` & 3 )) | sed
-e 's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g' >>
size
4.txt
dk@mace /repository> echo -n $(( `cat size5.txt | wc -c` & 3 )) | sed
-e 's/0//g' | sed -e 's/1/XXX/g' | sed -e 's/2/XX/g' | sed -e 's/3/X/g' >>
size
5.txt
dk@mace /repository> # and verify that's fixed our file sizes for us!
dk@mace /repository> ls -la size?.txt
-rw-r--r--    1 dk       Domain U      124 May 18 15:59 size0.txt
-rw-r--r--    1 dk       Domain U      128 May 18 16:08 size1.txt
-rw-r--r--    1 dk       Domain U      128 May 18 16:08 size2.txt
-rw-r--r--    1 dk       Domain U      128 May 18 16:08 size3.txt
-rw-r--r--    1 dk       Domain U      128 May 18 16:06 size4.txt
-rw-r--r--    1 dk       Domain U      132 May 18 16:09 size5.txt




    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

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

* Re: binutils-2.15 requires flex/lex?
  2004-05-18 14:08 ` Daniel Jacobowitz
  2004-05-18 14:40   ` Objcopy and alignment Dave Murphy
@ 2004-05-19  3:29   ` Ralf Corsepius
  1 sibling, 0 replies; 5+ messages in thread
From: Ralf Corsepius @ 2004-05-19  3:29 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Binutils List

On Tue, 2004-05-18 at 16:08, Daniel Jacobowitz wrote:
> On Tue, May 18, 2004 at 07:00:16AM +0200, Ralf Corsepius wrote:
> > Hi, 
> > 
> > trying to build the original binutils-2.15-tarball on a system without
> > having flex nor lex installed, causes this build error:

Sorry, I had shortened the log too much. Here is a new one:
...
checking for bison... bison -y
checking for flex... no
checking for lex... no
/home/columbo/src/rpms/BUILD/rtems-4.7-sh-rtems4.7-binutils-2.15/binutils-2.15/ld/configure: line 4417: flex: command not foundchecking for flex... lex
checking for yywrap in -ll... no
checking lex output file root...
/home/columbo/src/rpms/BUILD/rtems-4.7-sh-rtems4.7-binutils-2.15/binutils-2.15/ld/configure: line 4505: lex: command not found
configure: error: cannot find output from lex; giving up
make: *** [configure-ld] Error 1

> Please re-run this with sh -x.  I can't see how that happened; what
> should have happened was "checking for flex... no".

As you can see from the log above the there are 2 checks for flex/lex
(Both from AM_PROG_LEX in ld/aclocal.m4).
The first one (originating from AC_CHECK_PROGS) reports "no", the second
one (originating from AC_PROG_LEX) causes the error.

The error referring to line 4417 stems from this (sh -x):
+ test -n ''
+
LEX=/home/columbo/src/rpms/BUILD/rtems-4.7-sh-rtems4.7-binutils-2.15/binutils-2.15/missing
+ flex
/home/columbo/src/rpms/BUILD/rtems-4.7-sh-rtems4.7-binutils-2.15/binutils-2.15/ld/configure: line 4417: flex: command not found

Origin of this is line 4417 in ld/configure:
test -n "$LEX" || LEX=""$missing_dir/missing flex""

AFAIS, the LEX="".."" assignement is not quoted correctly.

Furthermore, comparing automake-1.4's aclocal-1.4/lex.m4 against
automake-1.5's aclocal-1.5/lex.m4 indicates this to be a known bug in
automake:

--- /usr/share/aclocal-1.4/lex.m4       2003-04-26 01:01:45.000000000 +0200
+++ /usr/share/aclocal-1.5/lex.m4       2003-06-06 23:53:29.000000000 +0200
@@ -1,10 +1,10 @@
 ## Replacement for AC_PROG_LEX and AC_DECL_YYTEXT
 ## by Alexandre Oliva <oliva@dcc.unicamp.br>
  
-dnl AM_PROG_LEX
-dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
+# AM_PROG_LEX
+# Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
 AC_DEFUN([AM_PROG_LEX],
-[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
-AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+AC_CHECK_PROGS(LEX, flex lex, [${am_missing_run}flex])
 AC_PROG_LEX
 AC_DECL_YYTEXT])

=> I tripped a bug in the version of automake being used by ld's
configuration.

Potential fixes could be 
* to hack the lex.m4 of the automake you seem to be using for ld.
(1.4p5; The bug still seems to be present in the 1.4p6 shipped with FC1)

Changing lex.m4 this way probably will help:
-AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
+AC_CHECK_PROGS(LEX, flex lex, [$missing_dir/missing flex])

* to upgrade to a newer automake.


Ralf



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

end of thread, other threads:[~2004-05-19  3:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-18  5:00 binutils-2.15 requires flex/lex? Ralf Corsepius
2004-05-18 14:08 ` Daniel Jacobowitz
2004-05-18 14:40   ` Objcopy and alignment Dave Murphy
2004-05-18 15:12     ` Dave Korn
2004-05-19  3:29   ` binutils-2.15 requires flex/lex? Ralf Corsepius

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