=================================================================== Index: ldexp.c --- ldexp.c 21 Jan 2005 04:15:58 -0000 1.42 +++ ldexp.c 12 Feb 2005 00:11:51 -0000 @@ -50,6 +50,9 @@ struct exp_data_seg exp_data_seg; segment_type *segments; +/* Principally used for diagnostics. */ +static bfd_boolean assigning_to_dot = FALSE; + /* Print the string representation of the given token. Surround it with spaces if INFIX_P is TRUE. */ @@ -595,7 +598,8 @@ fold_name (etree_type *tree, } } } - else if (allocation_done == lang_final_phase_enum) + else if (allocation_done == lang_final_phase_enum + || assigning_to_dot) einfo (_("%F%S: undefined symbol `%s' referenced in expression\n"), tree->name.name); else if (h->type == bfd_link_hash_new) @@ -754,10 +758,13 @@ exp_fold_tree (etree_type *tree, || (allocation_done == lang_final_phase_enum && current_section == abs_output_section)) { + /* Notify the folder that this is an assignment to dot. */ + assigning_to_dot = TRUE; result = exp_fold_tree (tree->assign.src, current_section, - allocation_done, dot, - dotp); + allocation_done, dot, dotp); + assigning_to_dot = FALSE; + if (! result.valid_p) einfo (_("%F%S invalid assignment to location counter\n")); else =================================================================== Index: testsuite/ld-scripts/align.exp --- testsuite/ld-scripts/align.exp 8 Apr 2004 00:51:37 -0000 1.2 +++ testsuite/ld-scripts/align.exp 12 Feb 2005 00:11:51 -0000 @@ -22,7 +22,7 @@ if [istarget "rs6000-*-aix*"] { return } -set testname "ALIGN" +set testname "align1" if ![ld_assemble $as $srcdir/$subdir/align.s tmpdir/align.o] { unresolved $testname @@ -34,3 +34,7 @@ if ![ld_simple_link $ld tmpdir/align "-T } else { pass $testname } + +run_dump_test align2a +run_dump_test align2b +run_dump_test align2c =================================================================== Index: testsuite/ld-scripts/align2.t --- testsuite/ld-scripts/align2.t 1 Jan 1970 00:00:00 -0000 +++ testsuite/ld-scripts/align2.t 12 Feb 2005 00:11:51 -0000 @@ -0,0 +1,6 @@ +SECTIONS +{ + .text : {*(.text)} + . = ALIGN(data_align); + .data : {*(.data)} +} =================================================================== Index: testsuite/ld-scripts/align2a.d --- testsuite/ld-scripts/align2a.d 1 Jan 1970 00:00:00 -0000 +++ testsuite/ld-scripts/align2a.d 12 Feb 2005 00:11:51 -0000 @@ -0,0 +1,13 @@ +# ld: --defsym data_align=16 -T align2.t +# objdump: --section-headers + +[^:]+: +file format.* + +Sections: +Idx +Name +Size +VMA +LMA +File +off +Algn + +0 +\.text +00000004 +00000000 +00000000 +00001000 +2\*\*2 + +CONTENTS, +ALLOC, +LOAD, +READONLY, +CODE + +1 +\.data +00000004 +00000010 +00000010 +00001010 +2\*\*2 + +CONTENTS, +ALLOC, +LOAD, +DATA + +2 +\.bss +00000000 +00000014 +00000014 +00001014 +2\*\*2 + +ALLOC =================================================================== Index: testsuite/ld-scripts/align2a.s --- testsuite/ld-scripts/align2a.s 1 Jan 1970 00:00:00 -0000 +++ testsuite/ld-scripts/align2a.s 12 Feb 2005 00:11:51 -0000 @@ -0,0 +1,4 @@ + .text + .long 0 + .data + .long 0x12345678 =================================================================== Index: testsuite/ld-scripts/align2b.d --- testsuite/ld-scripts/align2b.d 1 Jan 1970 00:00:00 -0000 +++ testsuite/ld-scripts/align2b.d 12 Feb 2005 00:11:51 -0000 @@ -0,0 +1,13 @@ +# ld: --defsym data_align=32 -T align2.t +# objdump: --section-headers + +[^:]+: +file +format.* + +Sections: +Idx +Name +Size +VMA +LMA +File off +Algn + +0 +\.text +00000004 +00000000 +00000000 +00001000 +2\*\*2 + +CONTENTS, +ALLOC, +LOAD, +READONLY, +CODE + +1 +\.data +00000004 +00000020 +00000020 +00001020 +2\*\*2 + +CONTENTS, +ALLOC, +LOAD, +DATA + +2 +\.bss +00000000 +00000024 +00000024 +00001024 +2\*\*2 + +ALLOC =================================================================== Index: testsuite/ld-scripts/align2b.s --- testsuite/ld-scripts/align2b.s 1 Jan 1970 00:00:00 -0000 +++ testsuite/ld-scripts/align2b.s 12 Feb 2005 00:11:51 -0000 @@ -0,0 +1,4 @@ + .text + .long 0 + .data + .long 0x12345678 =================================================================== Index: testsuite/ld-scripts/align2c.d --- testsuite/ld-scripts/align2c.d 1 Jan 1970 00:00:00 -0000 +++ testsuite/ld-scripts/align2c.d 12 Feb 2005 00:11:51 -0000 @@ -0,0 +1,2 @@ +# ld: -T align2.t +# error: undefined symbol.*in expression =================================================================== Index: testsuite/ld-scripts/align2c.s --- testsuite/ld-scripts/align2c.s 1 Jan 1970 00:00:00 -0000 +++ testsuite/ld-scripts/align2c.s 12 Feb 2005 00:11:51 -0000 @@ -0,0 +1,4 @@ + .text + .long 0 + .data + .long 0x12345678