]> granicus.if.org Git - yasm/commit
More gracefully handle absolute section refernce expansion, and allow for
authorPeter Johnson <peter@tortall.net>
Tue, 14 Mar 2006 08:52:41 +0000 (08:52 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 14 Mar 2006 08:52:41 +0000 (08:52 -0000)
commit135d4727ddf0eb2bdccfaa73500ce6f15ee11c6a
treeaf64d5c02a9d9e735afe88d2b6fed12552146bb1
parent8e98bbff236cc1593cd5e5e02986e070c7fd63cc
More gracefully handle absolute section refernce expansion, and allow for
correct detection of absolute section reference loops (fixing a crash case).
This is also needed for an ongoing rewrite of reloc/value handling.

* expr.c (expr_xform_bc_dist): Remove transformation of absolute section
references; move in changed form into...
(yasm_expr__level_tree): Here.  The new code doesn't immediately calculate
the distance from the start of the absolute section to the referenced symbol;
rather it generates an expression for this quantity.  As this actually adds
new absolute section refs to the tree, we can't expand with YASM_EXPR_SYMs,
otherwise we would expand multiple times.  Thus we need a new
YASM_EXPR_SYMEXP type that thus does not get expanded.  Unfortunately this
ripples changes a bit because everywhere *else* we look for YASM_EXPR_SYM,
we now need to look for YASM_EXPR_SYMEXP as well...
(expr_xform_bc_dist): Here.
(yasm_expr__copy_except): Here.
(yasm_expr_extract_symrec): Here.
(yasm_expr_get_symrec): Here.
(yasm_expr_print): Here.
* bin-objfmt.c (bin_objfmt_expr_xform): And here.
* expr-int.h (yasm_expr__type): Define new YASM_EXPR_SYMEXP.

* section.h (yasm_section_abs_get_sym): To implement above, we need to get
a symbol referencing the first bytecode in the absolute section.  To avoid
creating redundant symrecs, one is generated for us now.  This function
lets us get it in yasm_expr__level_tree().
* section.c (yasm_section_abs_get_sym): Implement.
(yasm_section): Add necessary SECTION_ABSOLUTE data.
(yasm_section_create_absolute): Create the symrec here.

* absloop-err.asm: New test for absolute section reference loops.

svn path=/trunk/yasm/; revision=1417
libyasm/expr-int.h
libyasm/expr.c
libyasm/section.c
libyasm/section.h
libyasm/tests/Makefile.inc
libyasm/tests/absloop-err.asm [new file with mode: 0644]
libyasm/tests/absloop-err.errwarn [new file with mode: 0644]
modules/objfmts/bin/bin-objfmt.c