Created attachment 5702 [details] testcase While the 2.21 release links the attached testcase just fine, the 2.21 branch taken at Apr 19th fails to link it with > ld -T romlayout32seg.lds code32seg.o -o rom32seg.o romlayout32seg.lds:66 cannot move location counter backwards (from 00000000000067b0 to 00000000000067a0) If one changes the linker script to add 0x4 more room for the sections (which corresponds to their alignment) like *(.rodata.__func__.10274) . = ( 0x6782 - code32seg_start ) ; *(.rodata.__func__.8035) . = ( 0x6796 - code32seg_start ) ; *(.rodata.__func__.8048) . = ( 0x67aa - code32seg_start ) ; *(.rodata.__func__.8075) . = ( 0x67c0 - code32seg_start ) ; *(.rodata.__func__.8115) then the link succeeds. This looks like a bogus alignment calculation as with the size of 0xe for the section 0x10 should be enough space to properly align the data.
Similar issue happens on 64bit.
Confirmed also with the current 2.21 branch head and also with 2010-12-04 Alan Modra <amodra@gmail.com> * ldlang.c (lang_size_sections_1): Align lma using same alignment as for vma. reverted (that just looked maybe related).
Mine. Looks to be caused by the fix for PR12380. That delayed setting expld.phase = lang_final_phase_enum until just before the final lang_do_assignments, breaking the assignments done in lang_relax_sections.
CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2011-05-03 14:56:14 Modified files: ld : ChangeLog ldexp.c ldexp.h ldlang.c ldlang.h pe-dll.c Log message: PR ld/12726 * ldexp.h (lang_phase_type): Add lang_assigning_phase_enum. * ldexp.c (exp_fold_tree_1): Correct assign to dot comment. Don't assign to dot when lang_assigning_phase_enum. * ldlang.h (lang_do_assignments): Update prototype. * ldlang.c (lang_do_assignments): Add phase parameter. Update all callers. * pe-dll.c (pe_dll_fill_sections, pe_exe_fill_sections): Update lang_do_assignments calls. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2324&r2=1.2325 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldexp.c.diff?cvsroot=src&r1=1.93&r2=1.94 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldexp.h.diff?cvsroot=src&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.c.diff?cvsroot=src&r1=1.366&r2=1.367 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.h.diff?cvsroot=src&r1=1.96&r2=1.97 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/pe-dll.c.diff?cvsroot=src&r1=1.136&r2=1.137
CVSROOT: /cvs/src Module name: src Branch: binutils-2_21-branch Changes by: amodra@sourceware.org 2011-05-03 15:16:40 Modified files: ld : ChangeLog ldexp.c ldexp.h ldlang.c ldlang.h pe-dll.c Log message: PR ld/12726 * ldexp.h (lang_phase_type): Add lang_assigning_phase_enum. * ldexp.c (exp_fold_tree_1): Correct assign to dot comment. Don't assign to dot when lang_assigning_phase_enum. * ldlang.h (lang_do_assignments): Update prototype. * ldlang.c (lang_do_assignments): Add phase parameter. Update all callers. * pe-dll.c (pe_dll_fill_sections, pe_exe_fill_sections): Update lang_do_assignments calls. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.2222.2.20&r2=1.2222.2.21 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldexp.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.87.2.1&r2=1.87.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldexp.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.23.2.1&r2=1.23.2.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.347.2.3&r2=1.347.2.4 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.h.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.91.2.2&r2=1.91.2.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/pe-dll.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.133&r2=1.133.2.1
Fixed