The attached patch fixes the case where a linker script defines the segment a section should be in (.init in the test), but for a particular input that section is empty. Without this patch Output_section_definition::allocate_to_segment will not set phdrs_list and the specified segment will not be used in the following sections (.text in the test). 2010-05-17 Rafael Espindola * script-sections.cc (Output_section_definition::allocate_to_segment): Update the phdrs_list even when if the output section is NULL. * testsuite/Makefile.am: Add test. * testsuite/Makefile.in: Regenerate. * testsuite/script_test_9.cc: New. * testsuite/script_test_9.sh: New. * testsuite/script_test_9.t: New. Cheers, -- Rafael Ávila de Espíndola