[PATCH] internal error for backwards .org

Bob Wilson bwilson@tensilica.com
Tue Jun 24 01:51:00 GMT 2008


The assembler fails to catch some cases where .org directives attempt to move 
backwards in the output.  If you are generating DWARF2 line info, this leads to 
an internal error.  Here is an example:

Contents of test "bkwd.s":
         .org 0x20
         nop
         .org 0x10
         nop

% as -gdwarf2 bkwd.s
bkwd.s: Assembler messages:
bkwd.s:3: Error: attempt to .org/.space backwards? (-17)
bkwd.s:5: Internal error!
Assertion failure in emit_inc_line_addr at ../../gas/dwarf2dbg.c line 894.
Please report this bug.

The following patch fixes the problem, so that the assembler properly reports 
the backward .org error without the internal error:

% as -gdwarf2 bkwd.s
bkwd.s: Assembler messages:
bkwd.s:3: Error: attempt to move .org backwards

I've tested this by running the binutils testsuites for both a native i686-linux 
build and a cross xtensa-elf build.

Is this OK?

2008-06-23  Bob Wilson  <bob.wilson@acm.org>
	
	* write.c (relax_segment): Move check for backwards .org after
	subtracting the current stretch value from the growth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gas-org-back.patch
Type: text/x-diff
Size: 770 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20080624/ed3573c5/attachment.bin>


More information about the Binutils mailing list