Issues with the dot '.' symbol and the .fill directive

Dave Rager rageratwork@gmail.com
Thu Mar 15 21:53:00 GMT 2007


Forgive my noob-ish-ness. I'm not sure if I'm not understanding
something correctly or if I've stumbled on a genuine bug. What I
thought I understood and which worked with 2.15 seems to now be broken
on 2.16 and 2.17.

Here is some sample code that demonstrates the problem on each machine
I've tried so far.

.fill 4,1,0xff
.long .            # outputs a 4
#.fill 32 - 8,1,0  # works on all
#.fill 32 - .,1,0   # works on 2.15, does not work on 2.16 or 2.17
#.space 32 - .      # works on 2.15, does not work on 2.16 or 2.17
#. = . + 32 - .     # silly thing to do but works on 2.17

The goal is to fill the remaining bytes after the code with 0s in a
flat binary using the .fill directive. As I've understood from the
docs, .fill 32 - ., 1, 0 will write (32 - .) or 24 1-byte 0s.

Using any one of the commented lines works as expected with 2.15.

00000000  FF FF FF FF 04 00 00 00 00 00 00 00 00 00 00 00 ................
00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Compiling on 2.16 or 2.17  with line 4 uncommented produces the following error:

test.s: Assembler messages:
test.s:4: Error: .space specifies non-absolute value

gdb shows the first part of the conditional on line 2009 of write.c to
be the culprit:

(S_GET_SEGMENT (symbolP) != absolute_section) evaluates to true.

Since this section of code hasn't changed between 2.15 and 2.17, I've
been digging around to find where this value is set and where it may
be modified. So far I haven't found anything out of the ordinary but
then I'm not completely familiar with this code.

Interestingly, in both 2.15 and 2.17 the call to S_GET_VALUE (symbolP)
just before the conditional returns the expected value of 24.

So, is this a bug (smells like it :-) or expected behavior? Let me
know if I'm missing something... or if I'm just off my rocker!

Thanks,
Dave.



More information about the Binutils mailing list