The linker traverses the linker script for different purposes using three pointers in a lang_input_statement_type: next_real_file, next and header.next. I suspect you may find this patch is incorrect due to not reordering the header.next list. See insert_input_file. -- Alan Modra