1 /* Copyright (C) 1991 Free Software Foundation, Inc.
3 This file is part of GLD, the Gnu Linker.
5 GLD is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 1, or (at your option)
10 GLD is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GLD; see the file COPYING. If not, write to
17 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 * Revision 1.1 1991/03/21 21:28:45 gumby
25 * Revision 1.3 1991/03/16 22:19:21 rich
28 * Revision 1.2 1991/03/15 18:52:42 rich
31 * Revision 1.1 1991/03/13 00:48:23 chrisb
34 * Revision 1.8 1991/03/10 09:31:28 rich
36 * Makefile config.h ld-emul.c ld-emul.h ld-gld.c ld-gld960.c
37 * ld-lnk960.c ld.h lddigest.c ldexp.c ldexp.h ldfile.c ldfile.h
38 * ldgram.y ldinfo.h ldlang.c ldlang.h ldlex.h ldlex.l ldmain.c
39 * ldmain.h ldmisc.c ldmisc.h ldsym.c ldsym.h ldversion.c
40 * ldversion.h ldwarn.h ldwrite.c ldwrite.h y.tab.h
42 * As of this round of changes, ld now builds on all hosts of (Intel960)
43 * interest and copy passes my copy test on big endian hosts again.
45 * Revision 1.7 1991/03/09 03:31:03 sac
46 * After a fatal info message, the output file is deleted.
48 * Revision 1.6 1991/03/09 03:25:06 sac
49 * Added support for LONG, SHORT and BYTE keywords in scripts
51 * Revision 1.5 1991/03/06 21:59:31 sac
52 * Completed G++ support
54 * Revision 1.4 1991/03/06 02:26:02 sac
55 * Added support for constructor sections.
56 * Remove parsing ambiguity.
59 * Revision 1.3 1991/02/22 17:15:01 sac
60 * Added RCS keywords and copyrights
72 #include "ldgram.tab.h"
83 extern unsigned int undefined_global_sym_count
;
85 static char *startup_file
;
86 static lang_input_statement_type
*first_file
;
87 lang_statement_list_type statement_list
;
88 lang_statement_list_type
*stat_ptr
= &statement_list
;
89 lang_statement_list_type lang_output_section_statement
;
90 lang_statement_list_type input_file_chain
;
91 lang_statement_list_type file_chain
;
92 extern char *current_file
;
93 static boolean placed_commons
= false;
95 boolean lang_float_flag
;
97 static lang_output_section_statement_type
*default_common_section
;
101 PROTO(static void, print_statements
,(void));
102 PROTO(static void, print_statement
,(lang_statement_union_type
*,
103 lang_output_section_statement_type
*));
108 boolean lang_has_input_file
= false;
111 extern bfd
*output_bfd
;
112 size_t largest_section
;
115 extern enum bfd_architecture ldfile_output_architecture
;
116 extern unsigned long ldfile_output_machine
;
117 extern char *ldfile_output_machine_name
;
120 extern ldsym_type
*symbol_head
;
123 unsigned int commons_pending
;
128 extern args_type command_line
;
129 extern ld_config_type config
;
135 lang_output_section_statement_type
*create_object_symbols
;
137 extern boolean had_script
;
138 static boolean map_option_f
;
141 boolean had_output_filename
= false;
142 extern boolean write_map
;
149 size_t longest_section_name
= 8;
152 lang_input_statement_type
*script_file
;
154 section_userdata_type common_section_userdata
;
155 asection common_section
;
158 #define cat(a,b) a##b
160 #define cat(a,b) a/**/b
163 #define new_stat(x,y) (cat(x,_type)*) new_statement(cat(x,_enum), sizeof(cat(x,_type)),y)
165 #define outside_section_address(q) ( (q)->output_offset + (q)->output_section->vma)
167 #define outside_symbol_address(q) ((q)->value + outside_section_address(q->section))
169 boolean option_longmap
= false;
171 static void lang_list_init(list
)
172 lang_statement_list_type
*list
;
174 list
->head
= (lang_statement_union_type
*)NULL
;
175 list
->tail
= &list
->head
;
182 printf("%*s", -longest_section_name
, name
);
198 printf("%8lx", value
);
204 printf("%5x", (unsigned)value
);
207 print_alignment(value
)
210 printf("2**%2u",value
);
216 printf("%04x",(unsigned)value
);
221 lang_statement_union_type
*new_statement(type
, size
, list
)
222 enum statement_enum type
;
224 lang_statement_list_type
*list
;
226 lang_statement_union_type
*new = (lang_statement_union_type
*)
228 new->header
.type
= type
;
229 new->header
.next
= (lang_statement_union_type
*)NULL
;
230 lang_statement_append(list
, new, &new->header
.next
);
234 static lang_input_statement_type
*
235 new_afile(name
, file_type
, target
)
237 lang_input_file_enum_type file_type
;
240 lang_input_statement_type
*p
= new_stat(lang_input_statement
,
242 lang_has_input_file
= true;
245 case lang_input_file_is_symbols_only_enum
:
247 p
->is_archive
=false;
249 p
->local_sym_name
= name
;
250 p
->just_syms_flag
= true;
251 p
->search_dirs_flag
= false;
253 case lang_input_file_is_fake_enum
:
255 p
->is_archive
=false;
257 p
->local_sym_name
= name
;
258 p
->just_syms_flag
= false;
259 p
->search_dirs_flag
=false;
262 case lang_input_file_is_l_enum
:
263 p
->is_archive
= true;
266 p
->local_sym_name
= concat("-l",name
,"");
267 p
->just_syms_flag
= false;
268 p
->search_dirs_flag
= true;
271 case lang_input_file_is_search_file_enum
:
272 case lang_input_file_is_marker_enum
:
274 p
->is_archive
=false;
276 p
->local_sym_name
= name
;
277 p
->just_syms_flag
= false;
278 p
->search_dirs_flag
=true;
283 case lang_input_file_is_file_enum
:
285 p
->is_archive
=false;
287 p
->local_sym_name
= name
;
288 p
->just_syms_flag
= false;
289 p
->search_dirs_flag
=false;
296 p
->asymbols
= (asymbol
**)NULL
;
297 p
->superfile
= (lang_input_statement_type
*)NULL
;
299 p
->next_real_file
= (lang_statement_union_type
*)NULL
;
300 p
->next
= (lang_statement_union_type
*)NULL
;
302 p
->common_output_section
= (asection
*)NULL
;
304 lang_statement_append(&input_file_chain
,
305 (lang_statement_union_type
*)p
,
310 lang_input_statement_type
*
311 lang_add_input_file(name
,
315 lang_input_file_enum_type file_type
;
318 /* Look it up or build a new one */
320 lang_input_statement_type
*p
;
322 for (p
= (lang_input_statement_type
*)input_file_chain
.head
;
323 p
!= (lang_input_statement_type
*)NULL
;
324 p
= (lang_input_statement_type
*)(p
->next_real_file
))
326 /* Sometimes we have incomplete entries in here */
327 if (p
->filename
!= (char *)NULL
) {
328 if(strcmp(name
,p
->filename
) == 0) return p
;
332 return new_afile(name
, file_type
, target
);
341 stat_ptr
= &statement_list
;
342 lang_list_init(stat_ptr
);
344 lang_list_init(&input_file_chain
);
345 lang_list_init(&lang_output_section_statement
);
346 lang_list_init(&file_chain
);
347 first_file
= lang_add_input_file((char *)NULL
,
348 lang_input_file_is_marker_enum
,
356 script_file
= lang_add_input_file("script file",
357 lang_input_file_is_fake_enum
,
359 script_file
->the_bfd
= bfd_create("script file", output_bfd
);
360 script_file
->symbol_count
= 0;
362 common_section
.userdata
= &common_section_userdata
;
368 /* this function mainains a dictionary of regions. If the *default*
369 region is asked for then a pointer to the first region is
370 returned. If there is no first pointer then one is created
373 static lang_memory_region_type
*lang_memory_region_list
;
374 static lang_memory_region_type
**lang_memory_region_list_tail
= &lang_memory_region_list
;
376 lang_memory_region_type
*
377 lang_memory_region_lookup(name
)
381 lang_memory_region_type
*p
= lang_memory_region_list
;
382 for (p
= lang_memory_region_list
;
383 p
!= ( lang_memory_region_type
*)NULL
;
385 if (strcmp(p
->name
, name
) == 0) {
389 if (strcmp(name
,"*default*")==0) {
390 /* This is the default region, dig out first one on the list */
391 if (lang_memory_region_list
!= (lang_memory_region_type
*)NULL
){
392 return lang_memory_region_list
;
396 lang_memory_region_type
*new =
397 (lang_memory_region_type
*)ldmalloc(sizeof(lang_memory_region_type
));
399 new->next
= (lang_memory_region_type
*)NULL
;
401 *lang_memory_region_list_tail
= new;
402 lang_memory_region_list_tail
= &new->next
;
412 lang_output_section_statement_type
*
413 lang_output_section_find(name
)
416 lang_statement_union_type
*u
;
417 lang_output_section_statement_type
*lookup
;
419 for (u
= lang_output_section_statement
.head
;
420 u
!= (lang_statement_union_type
*)NULL
;
423 lookup
= &u
->output_section_statement
;
424 if (strcmp(name
, lookup
->name
)==0) {
428 return (lang_output_section_statement_type
*)NULL
;
431 lang_output_section_statement_type
*
432 lang_output_section_statement_lookup(name
)
436 lang_output_section_statement_type
*lookup
;
437 lookup
=lang_output_section_find(name
);
438 if (lookup
== (lang_output_section_statement_type
*)NULL
) {
440 lookup
=(lang_output_section_statement_type
*)
441 new_stat(lang_output_section_statement
, stat_ptr
);
442 lookup
->region
= (lang_memory_region_type
*)NULL
;
444 lookup
->block_value
= 1;
447 lookup
->next
= (lang_statement_union_type
*)NULL
;
448 lookup
->bfd_section
= (asection
*)NULL
;
449 lookup
->processed
= false;
450 lookup
->addr_tree
= (etree_type
*)NULL
;
451 lang_list_init(&lookup
->children
);
453 lang_statement_append(&lang_output_section_statement
,
454 (lang_statement_union_type
*)lookup
,
465 print_flags(outfile
, ignore_flags
)
467 lang_section_flags_type
*ignore_flags
;
469 fprintf(outfile
,"(");
471 if (flags
->flag_read
) fprintf(outfile
,"R");
472 if (flags
->flag_write
) fprintf(outfile
,"W");
473 if (flags
->flag_executable
) fprintf(outfile
,"X");
474 if (flags
->flag_loadable
) fprintf(outfile
,"L");
476 fprintf(outfile
,")");
483 lang_memory_region_type
*m
;
484 fprintf(outfile
,"**MEMORY CONFIGURATION**\n\n");
486 fprintf(outfile
,"name\t\torigin\t\tlength\t\tattributes\n");
487 for (m
= lang_memory_region_list
;
488 m
!= (lang_memory_region_type
*)NULL
;
491 fprintf(outfile
,"%-16s", m
->name
);
493 fprintf(outfile
,"%08lx\t%08lx\t", m
->origin
, m
->length
);
494 print_flags(outfile
, &m
->flags
);
495 fprintf(outfile
,"\n");
497 fprintf(outfile
,"\n\n**LINK EDITOR MEMORY MAP**\n\n");
498 fprintf(outfile
,"output\t\tinput\t\tvirtual\n");
499 fprintf(outfile
,"section\t\tsection\t\taddress\tsize\n\n");
508 static void init_os(s
)
509 lang_output_section_statement_type
*s
;
511 section_userdata_type
*new =
512 (section_userdata_type
*)
513 ldmalloc(sizeof(section_userdata_type
));
515 s
->bfd_section
= bfd_make_section(output_bfd
, s
->name
);
516 s
->bfd_section
->output_section
= s
->bfd_section
;
517 s
->bfd_section
->flags
= SEC_NO_FLAGS
;
518 /* We initialize an output sections output offset to minus its own */
519 /* vma to allow us to output a section through itself */
520 s
->bfd_section
->output_offset
= 0;
521 get_userdata( s
->bfd_section
) = new;
525 wild_doit(ptr
, section
,output
, file
)
526 lang_statement_list_type
*ptr
;
528 lang_output_section_statement_type
*output
;
529 lang_input_statement_type
*file
;
531 if(output
->bfd_section
== (asection
*)NULL
)
536 if (section
!= (asection
*)NULL
537 && section
->output_section
== (asection
*)NULL
) {
538 /* Add a section reference to the list */
539 lang_input_section_type
*new = new_stat(lang_input_section
, ptr
);
541 new->section
= section
;
543 section
->output_section
= output
->bfd_section
;
544 section
->output_section
->flags
|= section
->flags
;
545 if (section
->alignment_power
> output
->bfd_section
->alignment_power
) {
546 output
->bfd_section
->alignment_power
= section
->alignment_power
;
553 our_bfd_get_section_by_name(abfd
, section
)
557 return bfd_get_section_by_name(abfd
, section
);
561 wild_section(ptr
, section
, file
, output
)
562 lang_wild_statement_type
*ptr
;
564 lang_input_statement_type
*file
;
565 lang_output_section_statement_type
*output
;
568 if (section
== (char *)NULL
) {
569 /* Do the creation to all sections in the file */
570 for (s
= file
->the_bfd
->sections
; s
!= (asection
*)NULL
; s
=s
->next
) {
571 wild_doit(&ptr
->children
, s
, output
, file
);
575 /* Do the creation to the named section only */
576 wild_doit(&ptr
->children
,
577 our_bfd_get_section_by_name(file
->the_bfd
, section
),
588 lang_input_statement_type
*lookup_name(name
, target
)
592 lang_input_statement_type
*search
;
593 for(search
= (lang_input_statement_type
*)input_file_chain
.head
;
594 search
!= (lang_input_statement_type
*)NULL
;
595 search
= (lang_input_statement_type
*)search
->next_real_file
)
597 if (search
->filename
== (char *)NULL
&& name
== (char *)NULL
) {
600 if (search
->filename
!= (char *)NULL
&& name
!= (char *)NULL
) {
601 if (strcmp(search
->filename
, name
) == 0) {
602 Q_read_file_symbols(search
);
608 /* There isn't an afile entry for this file yet, this must be */
609 /* because the name has only appeared inside a load script and not */
610 /* on the command line */
611 search
= new_afile(name
, lang_input_file_is_file_enum
, target
);
612 Q_read_file_symbols(search
);
618 wild(s
, section
, file
, target
, output
)
619 lang_wild_statement_type
*s
;
623 lang_output_section_statement_type
*output
;
625 lang_input_statement_type
*f
;
626 if (file
== (char *)NULL
) {
627 /* Perform the iteration over all files in the list */
628 for (f
= (lang_input_statement_type
*)file_chain
.head
;
629 f
!= (lang_input_statement_type
*)NULL
;
630 f
= (lang_input_statement_type
*)f
->next
) {
631 wild_section(s
, section
, f
, output
);
635 /* Perform the iteration over a single file */
636 wild_section( s
, section
, lookup_name(file
, target
), output
);
641 read in all the files
644 open_output(name
, target
)
648 extern char *output_filename
;
649 bfd
* output
= bfd_openw(name
, target
);
650 output_filename
= name
;
651 if (output
== (bfd
*)NULL
)
653 if (bfd_error
== invalid_target
) {
654 info("%P%F target %s not found\n", target
);
656 info("%P%F problem opening output file %s, %E", name
);
659 output
->flags
|= D_PAGED
;
660 bfd_set_format(output
, bfd_object
);
663 extern char *default_target
;
665 lang_phase_0(sh
,target
)
666 lang_statement_union_type
*sh
;
669 lang_statement_union_type
*s
= (lang_statement_union_type
*)sh
;
670 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
672 switch (s
->header
.type
) {
673 case lang_output_section_statement_enum
:
674 lang_phase_0(s
->output_section_statement
.children
.head
,
677 case lang_output_statement_enum
:
679 output_bfd
= open_output(s
->output_statement
.name
,
680 target
== (char *)NULL
?
681 default_target
: target
);
682 ldemul_set_output_arch();
685 case lang_target_statement_enum
:
686 target
= s
->target_statement
.target
;
688 case lang_wild_statement_enum
:
689 /* Maybe we should load the file's symbols */
690 if (s
->wild_statement
.filename
) {
691 (void) lookup_name(s
->wild_statement
.filename
, target
);
694 /* Attatch this to the current output section */
695 case lang_common_statement_enum
:
696 case lang_fill_statement_enum
:
697 case lang_input_section_enum
:
698 case lang_object_symbols_statement_enum
:
699 case lang_address_statement_enum
:
700 case lang_data_statement_enum
:
702 case lang_afile_asection_pair_statement_enum
:
707 case lang_input_statement_enum
:
708 if (s
->input_statement
.real
== true) {
709 s
->input_statement
.target
= target
;
710 lookup_name(s
->input_statement
.filename
, target
);
713 case lang_assignment_statement_enum
:
715 (void) exp_fold_tree(s
->assignment_statement
.exp
,
721 case lang_padding_statement_enum
:
729 /* If there are [COMMONS] statements, put a wild one into the bss section */
732 lang_reasonable_defaults()
734 default_common_section
=
735 lang_output_section_statement_lookup(".bss");
736 if (placed_commons
== false) {
737 lang_wild_statement_type
*new =
738 new_stat(lang_wild_statement
,
739 &default_common_section
->children
);
740 new->section_name
= "COMMON";
741 new->filename
= (char *)NULL
;
742 lang_list_init(&new->children
);
748 if (had_script
== false) {
749 parse_line(ldemul_get_script());
752 lang_reasonable_defaults();
753 lang_phase_0(statement_list
.head
,default_target
);
757 /* Open input files and attatch to output sections */
759 lang_open_input(s
, target
, output_section_statement
)
760 lang_statement_union_type
*s
;
762 lang_output_section_statement_type
*output_section_statement
;
764 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
766 switch (s
->header
.type
) {
767 case lang_wild_statement_enum
:
768 wild(&s
->wild_statement
, s
->wild_statement
.section_name
,
769 s
->wild_statement
.filename
, target
,
770 output_section_statement
);
774 case lang_output_section_statement_enum
:
775 lang_open_input(s
->output_section_statement
.children
.head
,
777 &s
->output_section_statement
);
779 case lang_output_statement_enum
:
781 case lang_target_statement_enum
:
782 target
= s
->target_statement
.target
;
784 case lang_common_statement_enum
:
785 case lang_fill_statement_enum
:
786 case lang_input_section_enum
:
787 case lang_object_symbols_statement_enum
:
788 case lang_data_statement_enum
:
790 case lang_afile_asection_pair_statement_enum
:
794 case lang_assignment_statement_enum
:
795 case lang_padding_statement_enum
:
798 case lang_address_statement_enum
:
799 /* Mark the specified section with the supplied address */
801 lang_output_section_statement_type
*os
=
802 lang_output_section_statement_lookup
803 (s
->address_statement
.section_name
);
804 os
->addr_tree
= s
->address_statement
.address
;
807 case lang_input_statement_enum
:
808 /* A standard input statement, has no wildcards */
809 /* Q_read_file_symbols(&s->input_statement);*/
820 print_output_section_statement(output_section_statement
)
821 lang_output_section_statement_type
*output_section_statement
;
823 asection
*section
= output_section_statement
->bfd_section
;
825 print_section(output_section_statement
->name
);
828 print_dot
= section
->vma
;
832 print_address(section
->vma
);
834 print_size(section
->size
);
836 print_alignment(section
->alignment_power
);
839 printf("%s flags", output_section_statement
->region
->name
);
840 print_flags(stdout
, &output_section_statement
->flags
);
845 printf("No attached output section");
848 print_statement(output_section_statement
->children
.head
,
849 output_section_statement
);
854 print_assignment(assignment
, output_section
)
855 lang_assignment_statement_type
*assignment
;
856 lang_output_section_statement_type
*output_section
;
858 etree_value_type result
;
863 print_address(print_dot
);
865 result
= exp_fold_tree(assignment
->exp
->assign
.src
,
867 lang_final_phase_enum
,
872 print_address(result
.value
);
876 printf("*undefined*");
879 exp_print_tree(stdout
, assignment
->exp
);
884 print_input_statement(statm
)
885 lang_input_statement_type
*statm
;
887 printf("LOAD %s\n",statm
->filename
);
890 static void print_symbol(q
)
897 print_address(outside_symbol_address(q
));
898 printf(" %s", q
->name
? q
->name
: " ");
902 print_input_section(in
)
903 lang_input_section_type
*in
;
905 asection
*i
= in
->section
;
910 print_section(i
->name
);
912 if (i
->output_section
) {
913 print_address(i
->output_section
->vma
+ i
->output_offset
);
917 print_alignment(i
->alignment_power
);
920 bfd
*abfd
= in
->ifile
->the_bfd
;
921 printf(" %s ",abfd
->xvec
->name
);
922 if(abfd
->my_archive
!= (bfd
*)NULL
) {
923 printf("[%s]%s", abfd
->my_archive
->filename
,
927 printf("%s", abfd
->filename
);
931 /* Find all the symbols in this file defined in this section */
934 for (p
= in
->ifile
->asymbols
; *p
; p
++) {
937 if (bfd_get_section(q
) == i
&& q
->flags
& BSF_GLOBAL
) {
948 print_dot
= outside_section_address(i
) + i
->size
;
951 printf("No output section allocated\n");
956 print_common_statement()
961 print_section(common_section
.output_section
->name
);
963 print_address(common_section
.output_offset
+
964 common_section
.output_section
->vma
);
966 print_size(common_section
.size
);
970 /* Print out all the global symbols */
973 for (lgs
= symbol_head
; lgs
!= (ldsym_type
*)NULL
; lgs
=
975 if (lgs
->sdefs_chain
) {
976 asymbol
*def
= *(lgs
->sdefs_chain
);
977 if (def
->section
== &common_section
) {
983 print_dot
= common_section
.output_offset
+
984 common_section
.output_section
->vma
+ common_section
.size
;
989 print_fill_statement(fill
)
990 lang_fill_statement_type
*fill
;
992 printf("FILL mask ");
993 print_fill( fill
->fill
);
997 print_data_statement(data
)
998 lang_data_statement_type
*data
;
1000 /* bfd_vma value; */
1005 ASSERT(print_dot
== data
->output_vma
);
1007 print_address(data
->output_vma
);
1009 print_address(data
->value
);
1011 switch (data
->type
) {
1014 print_dot
+= BYTE_SIZE
;
1018 print_dot
+= SHORT_SIZE
;
1022 print_dot
+= LONG_SIZE
;
1026 exp_print_tree(stdout
, data
->exp
);
1033 print_padding_statement(s
)
1034 lang_padding_statement_type
*s
;
1038 print_section("*fill*");
1040 print_address(s
->output_offset
+ s
->output_section
->vma
);
1042 print_size(s
->size
);
1044 print_fill(s
->fill
);
1048 static void print_wild_statement(w
,os
)
1049 lang_wild_statement_type
*w
;
1050 lang_output_section_statement_type
*os
;
1052 if (w
->filename
!= (char *)NULL
) {
1053 printf("%s",w
->filename
);
1058 if (w
->section_name
!= (char *)NULL
) {
1059 printf("(%s)",w
->section_name
);
1065 print_statement(w
->children
.head
, os
);
1069 print_statement(s
, os
)
1070 lang_statement_union_type
*s
;
1071 lang_output_section_statement_type
*os
;
1074 switch (s
->header
.type
) {
1075 case lang_wild_statement_enum
:
1076 print_wild_statement(&s
->wild_statement
, os
);
1079 printf("Fail with %d\n",s
->header
.type
);
1082 case lang_address_statement_enum
:
1083 printf("address\n");
1085 case lang_common_statement_enum
:
1086 print_common_statement();
1088 case lang_object_symbols_statement_enum
:
1089 printf("object symbols\n");
1091 case lang_fill_statement_enum
:
1092 print_fill_statement(&s
->fill_statement
);
1094 case lang_data_statement_enum
:
1095 print_data_statement(&s
->data_statement
);
1099 case lang_input_section_enum
:
1100 print_input_section(&s
->input_section
);
1102 case lang_padding_statement_enum
:
1103 print_padding_statement(&s
->padding_statement
);
1105 case lang_output_section_statement_enum
:
1106 print_output_section_statement(&s
->output_section_statement
);
1108 case lang_assignment_statement_enum
:
1109 print_assignment(&s
->assignment_statement
,
1114 case lang_target_statement_enum
:
1115 printf("TARGET(%s)\n", s
->target_statement
.target
);
1117 case lang_output_statement_enum
:
1118 printf("OUTPUT(%s)\n", s
->output_statement
.name
);
1120 case lang_input_statement_enum
:
1121 print_input_statement(&s
->input_statement
);
1123 case lang_afile_asection_pair_statement_enum
:
1135 print_statement(statement_list
.head
,
1136 (lang_output_section_statement_type
*)NULL
);
1140 insert_pad(this_ptr
, fill
, power
, output_section_statement
, dot
)
1141 lang_statement_union_type
**this_ptr
;
1144 asection
* output_section_statement
;
1147 /* Align this section first to the
1148 input sections requirement, then
1149 to the output section's requirement.
1150 If this alignment is > than any seen before,
1151 then record it too. Perform the alignment by
1152 inserting a magic 'padding' statement.
1155 unsigned int alignment_needed
= align_power(dot
, power
) - dot
;
1157 if (alignment_needed
!= 0)
1159 lang_statement_union_type
*new =
1160 (lang_statement_union_type
*)
1161 ldmalloc(sizeof(lang_padding_statement_type
));
1162 /* Link into existing chain */
1163 new->header
.next
= *this_ptr
;
1165 new->header
.type
= lang_padding_statement_enum
;
1166 new->padding_statement
.output_section
= output_section_statement
;
1167 new->padding_statement
.output_offset
=
1168 dot
- output_section_statement
->vma
;
1169 new->padding_statement
.fill
= fill
;
1170 new->padding_statement
.size
= alignment_needed
;
1174 /* Remember the most restrictive alignment */
1175 if (power
> output_section_statement
->alignment_power
) {
1176 output_section_statement
->alignment_power
= power
;
1178 output_section_statement
->size
+= alignment_needed
;
1179 return alignment_needed
+ dot
;
1184 size_common runs run though each global symboxl, and works
1185 out how big the common section will be.
1189 size_common(output_section_statement
, this_ptr
, dot
)
1190 lang_output_section_statement_type
*output_section_statement
;
1191 lang_statement_union_type
**this_ptr
;
1194 extern ldsym_type
*symbol_head
;
1196 /* Make sure that each symbol is only defined once.
1197 Allocate common symbols
1198 Make the ref chain point to the defining asymbol.
1200 /* Now, for each symbol, verify that it is defined globally at most once.
1201 Put the global value into the symbol entry.
1202 Common symbols are allocated here, in the BSS section.
1203 Each defined symbol is given a '->defined' field
1204 which is the correct N_ code for its definition,
1205 except in the case of common symbols with -r.
1206 Then make all the references point at the symbol entry
1207 instead of being chained together. */
1210 common_section
.name
= output_section_statement
->bfd_section
->name
;
1211 common_section
.output_section
= output_section_statement
->bfd_section
;
1212 common_section
.output_offset
=
1213 dot
- output_section_statement
->bfd_section
->vma
;
1214 if (config
.relocateable_output
== false ||
1215 command_line
.force_common_definition
== true) {
1216 dot
= insert_pad(this_ptr
,
1217 0x0, 4, output_section_statement
->bfd_section
, dot
);
1219 for (sp
= symbol_head
; sp
!= (ldsym_type
*)NULL
; sp
= sp
->next
)
1221 /* Attatch this symbol to the correct output section*/
1223 /* Allocate as common if wanted */
1225 if (sp
->scoms_chain
)
1228 unsigned long com
= (*(sp
->scoms_chain
))->value
;
1229 /* Work out what alignment this common item s
1230 hould be put on. Anything < int is int aligned,
1231 anything bigger is self aligned,
1232 up to the restriction of the machine */
1234 unsigned int align
= sizeof(int);
1236 /* Round up size of object to nearest int */
1237 com
= ALIGN(com
, sizeof(int));
1238 /* See what alignment is necessary -*/
1240 while ((com
& align
)==0) align
<<=1;
1246 dot
= ALIGN(dot
, align
);
1249 /* Transmogrify this from a common symbol
1250 into a definition of a symbol in common
1252 sp
->sdefs_chain
= sp
->scoms_chain
;
1255 asymbol
*com_ptr
= *(sp
->sdefs_chain
);
1257 sp
->scoms_chain
= (asymbol
**)NULL
;
1259 /* Assign address, but keep section relative */
1261 /* Force the symbol to belong in the bss section */
1262 com_ptr
->flags
= BSF_EXPORT
| BSF_GLOBAL
;
1263 com_ptr
->section
= &common_section
;
1264 common_section
.size
+= com
;
1267 printf ("Allocating common %s: %lx at %lx\n",
1272 com_ptr
->value
= common_section
.size
;
1278 (common_section
.output_section
->vma
+
1279 common_section
.output_section
->size
)) {
1280 common_section
.output_section
->size
=
1281 dot
- common_section
.output_section
->vma
;
1283 return dot
+ common_section
.size
;
1287 size_input_section( this_ptr
, output_section_statement
, fill
, dot
)
1288 lang_statement_union_type
**this_ptr
;
1289 lang_output_section_statement_type
*output_section_statement
;
1290 unsigned short fill
;
1293 lang_input_section_type
*is
= &((*this_ptr
)->input_section
);
1294 asection
*i
= is
->section
;
1296 dot
= insert_pad(this_ptr
, fill
, i
->alignment_power
,
1297 output_section_statement
->bfd_section
, dot
);
1299 /* remember the largest size so we can malloc the largest area */
1300 /* needed for the output stage */
1301 if (i
->size
> largest_section
) {
1302 largest_section
= i
->size
;
1305 /* Remember where in the output section this input section goes */
1306 i
->output_offset
= dot
- output_section_statement
->bfd_section
->vma
;
1308 /* Mark how big the output section must be to contain this now */
1310 output_section_statement
->bfd_section
->size
=
1311 dot
- output_section_statement
->bfd_section
->vma
;
1318 /* Work out the size of the output sections
1319 from the sizes of the input sections */
1321 lang_size_sections(s
, output_section_statement
, prev
, fill
, dot
)
1322 lang_statement_union_type
*s
;
1323 lang_output_section_statement_type
* output_section_statement
;
1324 lang_statement_union_type
**prev
;
1325 unsigned short fill
;
1328 /* Size up the sections from their constituent parts */
1329 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
1331 switch (s
->header
.type
) {
1332 case lang_output_section_statement_enum
:
1335 lang_output_section_statement_type
*os
=
1336 &(s
->output_section_statement
);
1337 /* The start of a section */
1339 if (os
->addr_tree
== (etree_type
*)NULL
) {
1340 /* No address specified for this section, get one
1341 from the region specification
1343 if (os
->region
== (lang_memory_region_type
*)NULL
) {
1344 os
->region
= lang_memory_region_lookup("*default*");
1346 dot
= os
->region
->current
;
1349 etree_value_type r
;
1350 r
= exp_fold_tree(os
->addr_tree
,
1351 (lang_output_section_statement_type
*)NULL
,
1352 lang_allocating_phase_enum
,
1354 if (r
.valid
== false) {
1355 info("%F%S: non constant address expression for section %s\n",
1360 /* The section starts here */
1361 /* First, align to what the section needs */
1363 dot
= align_power(dot
, os
->bfd_section
->alignment_power
);
1364 os
->bfd_section
->vma
= dot
;
1365 os
->bfd_section
->output_offset
= 0;
1367 (void) lang_size_sections(os
->children
.head
, os
, &os
->children
.head
,
1369 /* Ignore the size of the input sections, use the vma and size to */
1373 after
= ALIGN(os
->bfd_section
->vma
+
1374 os
->bfd_section
->size
,
1378 os
->bfd_section
->size
= after
- os
->bfd_section
->vma
;
1379 dot
= os
->bfd_section
->vma
+ os
->bfd_section
->size
;
1380 os
->processed
= true;
1382 /* Replace into region ? */
1383 if (os
->addr_tree
== (etree_type
*)NULL
1384 && os
->region
!=(lang_memory_region_type
*)NULL
) {
1385 os
->region
->current
= dot
;
1391 case lang_data_statement_enum
:
1394 s
->data_statement
.output_vma
= dot
;
1395 s
->data_statement
.output_section
=
1396 output_section_statement
->bfd_section
;
1398 switch (s
->data_statement
.type
) {
1411 output_section_statement
->bfd_section
->size
+= size
;
1415 case lang_wild_statement_enum
:
1417 dot
= lang_size_sections(s
->wild_statement
.children
.head
,
1418 output_section_statement
,
1419 &s
->wild_statement
.children
.head
,
1425 case lang_object_symbols_statement_enum
:
1426 create_object_symbols
= output_section_statement
;
1428 case lang_output_statement_enum
:
1430 case lang_target_statement_enum
:
1432 case lang_common_statement_enum
:
1433 dot
= size_common(output_section_statement
, prev
, dot
);
1437 case lang_input_section_enum
:
1438 dot
= size_input_section(prev
,
1439 output_section_statement
,
1440 output_section_statement
->fill
, dot
);
1442 case lang_input_statement_enum
:
1444 case lang_fill_statement_enum
:
1445 fill
= s
->fill_statement
.fill
;
1447 case lang_assignment_statement_enum
:
1449 bfd_vma newdot
= dot
;
1450 exp_fold_tree(s
->assignment_statement
.exp
,
1451 output_section_statement
,
1452 lang_allocating_phase_enum
,
1457 /* We've been moved ! so insert a pad */
1459 lang_statement_union_type
*new =
1460 (lang_statement_union_type
*)
1461 ldmalloc(sizeof(lang_padding_statement_type
));
1462 /* Link into existing chain */
1463 new->header
.next
= *prev
;
1465 new->header
.type
= lang_padding_statement_enum
;
1466 new->padding_statement
.output_section
=
1467 output_section_statement
->bfd_section
;
1468 new->padding_statement
.output_offset
=
1469 dot
- output_section_statement
->bfd_section
->vma
;
1470 new->padding_statement
.fill
= fill
;
1471 new->padding_statement
.size
= newdot
- dot
;
1472 output_section_statement
->bfd_section
->size
+=
1473 new->padding_statement
.size
;
1479 case lang_padding_statement_enum
:
1485 case lang_address_statement_enum
:
1488 prev
= &s
->header
.next
;
1495 lang_do_assignments(s
, output_section_statement
, fill
, dot
)
1496 lang_statement_union_type
*s
;
1497 lang_output_section_statement_type
* output_section_statement
;
1498 unsigned short fill
;
1502 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
1504 switch (s
->header
.type
) {
1505 case lang_output_section_statement_enum
:
1507 lang_output_section_statement_type
*os
=
1508 &(s
->output_section_statement
);
1509 dot
= os
->bfd_section
->vma
;
1510 (void) lang_do_assignments(os
->children
.head
, os
, os
->fill
, dot
);
1511 dot
= os
->bfd_section
->vma
+ os
->bfd_section
->size
;
1514 case lang_wild_statement_enum
:
1516 dot
= lang_do_assignments(s
->wild_statement
.children
.head
,
1517 output_section_statement
,
1522 case lang_object_symbols_statement_enum
:
1523 case lang_output_statement_enum
:
1524 case lang_target_statement_enum
:
1525 case lang_common_statement_enum
:
1527 case lang_data_statement_enum
:
1529 etree_value_type value
;
1530 value
= exp_fold_tree(s
->data_statement
.exp
,
1531 0, lang_final_phase_enum
, dot
, &dot
);
1532 s
->data_statement
.value
= value
.value
;
1533 if (value
.valid
== false) info("%F%P: Invalid data statement\n");
1535 switch (s
->data_statement
.type
) {
1547 case lang_input_section_enum
:
1549 asection
*in
= s
->input_section
.section
;
1554 case lang_input_statement_enum
:
1556 case lang_fill_statement_enum
:
1557 fill
= s
->fill_statement
.fill
;
1559 case lang_assignment_statement_enum
:
1561 exp_fold_tree(s
->assignment_statement
.exp
,
1562 output_section_statement
,
1563 lang_final_phase_enum
,
1569 case lang_padding_statement_enum
:
1570 dot
+= s
->padding_statement
.size
;
1575 case lang_address_statement_enum
:
1585 static void lang_relocate_globals()
1589 Each ldsym_type maintains a chain of pointers to asymbols which
1590 references the definition. Replace each pointer to the referenence
1591 with a pointer to only one place, preferably the definition. If
1592 the defintion isn't available then the common symbol, and if
1593 there isn't one of them then choose one reference.
1596 FOR_EACH_LDSYM(lgs
) {
1598 if (lgs
->sdefs_chain
) {
1599 it
= *(lgs
->sdefs_chain
);
1601 else if (lgs
->scoms_chain
!= (asymbol
**)NULL
) {
1602 it
= *(lgs
->scoms_chain
);
1604 else if (lgs
->srefs_chain
!= (asymbol
**)NULL
) {
1605 it
= *(lgs
->srefs_chain
);
1610 if (it
!= (asymbol
*)NULL
)
1612 asymbol
**ptr
= lgs
->srefs_chain
;
1614 while (ptr
!= (asymbol
**)NULL
) {
1615 asymbol
*ref
= *ptr
;
1617 ptr
= (asymbol
**)(ref
->udata
);
1625 /* now that all the jiggery pokery is finished, copy important data from
1626 * out internal form to the bfd way. Also create a section
1627 * for each dummy file
1631 lang_create_output_section_statements()
1633 lang_statement_union_type
*os
;
1634 for (os
= lang_output_section_statement
.head
;
1635 os
!= (lang_statement_union_type
*)NULL
;
1636 os
= os
->output_section_statement
.next
) {
1637 lang_output_section_statement_type
*s
=
1638 &os
->output_section_statement
;
1641 script_file
->the_bfd
->sections
= output_bfd
->sections
;
1649 if (entry_symbol
== (char *)NULL
) {
1650 /* No entry has been specified, look for start */
1651 entry_symbol
= "start";
1653 lgs
= ldsym_get_soft(entry_symbol
);
1654 if (lgs
&& lgs
->sdefs_chain
) {
1655 asymbol
*sy
= *(lgs
->sdefs_chain
);
1656 /* We can set the entry address*/
1657 bfd_set_start_address(output_bfd
,
1658 outside_symbol_address(sy
));
1662 /* Can't find anything reasonable,
1663 use the first address in the text section
1665 asection
*ts
= bfd_get_section_by_name(output_bfd
, ".text");
1667 bfd_set_start_address(output_bfd
, ts
->vma
);
1672 /* By now we know the target architecture, and we may have an */
1673 /* ldfile_output_machine_name */
1677 lang_statement_union_type
*file
;
1680 for (file
= file_chain
.head
;
1681 file
!= (lang_statement_union_type
*)NULL
;
1682 file
=file
->input_statement
.next
)
1684 /* Inspect the architecture and ensure we're linking like
1688 if (bfd_arch_compatible( file
->input_statement
.the_bfd
,
1690 &ldfile_output_architecture
,
1691 &ldfile_output_machine
)) {
1692 bfd_set_arch_mach(output_bfd
,
1693 ldfile_output_architecture
, ldfile_output_machine
);
1696 enum bfd_architecture this_architecture
=
1697 bfd_get_architecture(file
->input_statement
.the_bfd
);
1698 unsigned long this_machine
=
1699 bfd_get_machine(file
->input_statement
.the_bfd
);
1701 info("%I: architecture %s",
1703 bfd_printable_arch_mach(this_architecture
, this_machine
));
1704 info(" incompatible with output %s\n",
1705 bfd_printable_arch_mach(ldfile_output_architecture
,
1706 ldfile_output_machine
));
1707 ldfile_output_architecture
= this_architecture
;
1708 ldfile_output_machine
= this_machine
;
1709 bfd_set_arch_mach(output_bfd
,
1710 ldfile_output_architecture
,
1711 ldfile_output_machine
);
1720 * run through all the global common symbols and tie them
1721 * to the output section requested.
1728 if (config
.relocateable_output
== false ||
1729 command_line
.force_common_definition
== true) {
1730 for (lgs
= symbol_head
;
1731 lgs
!= (ldsym_type
*)NULL
;
1737 if (lgs
->scoms_chain
!= (asymbol
**)NULL
) {
1739 com
= *(lgs
->scoms_chain
);
1741 align
= sizeof(int);
1742 /* Round up size of object to nearest int */
1743 size
= ALIGN(size
, sizeof(int));
1744 /* Force alignment */
1746 while ((size
& align
)==0) align
<<=1;
1751 /* Change from a common symbol into a definition of
1753 lgs
->sdefs_chain
= lgs
->scoms_chain
;
1754 lgs
->scoms_chain
= (asymbol
**)NULL
;
1756 /* Point to the correct common section */
1758 ((lang_input_statement_type
*)
1759 (com
->the_bfd
->usrdata
))->common_section
;
1760 /* Fix the size of the common section */
1763 com
->flags
= BSF_EXPORT
| BSF_GLOBAL
;
1767 printf ("Allocating common %s: %x at %x\n",
1770 (unsigned) com
->section
->size
);
1772 com
->value
= com
->section
->size
;
1773 com
->section
->size
+= size
;
1780 run through the input files and ensure that every input
1781 section has somewhere to go. If one is found without
1782 a destination then create an input request and place it
1783 into the statement tree.
1786 static void lang_place_orphans()
1788 lang_input_statement_type
*file
;
1789 for (file
= (lang_input_statement_type
*)file_chain
.head
;
1790 file
!= (lang_input_statement_type
*)NULL
;
1791 file
= (lang_input_statement_type
*)file
->next
) {
1793 for (s
= file
->the_bfd
->sections
;
1794 s
!= (asection
*)NULL
;
1796 if ( s
->output_section
== (asection
*)NULL
) {
1797 /* This section of the file is not attatched, root
1798 around for a sensible place for it to go */
1800 if (file
->common_section
== s
) {
1801 /* This is a lonely common section which must
1802 have come from an archive. We attatch to the
1803 section with the wildcard */
1804 wild_doit(&default_common_section
->children
, s
,
1805 default_common_section
, file
);
1808 lang_output_section_statement_type
*os
=
1809 lang_output_section_statement_lookup(s
->name
);
1811 wild_doit(&os
->children
, s
, os
, file
);
1823 * peformed after every file has been opened and symbols read
1830 lang_create_output_section_statements();
1831 lang_open_input(statement_list
.head
, (char *)NULL
,
1832 ( lang_output_section_statement_type
*)NULL
);
1833 lang_place_orphans();
1836 ldemul_before_allocation();
1838 lang_size_sections(statement_list
.head
,
1839 (lang_output_section_statement_type
*)NULL
,
1840 &(statement_list
.head
), 0, (bfd_vma
)0);
1841 ldemul_after_allocation();
1842 /* Do it once again now that we know the sizes of everything */
1844 lang_do_assignments(statement_list
.head
,
1845 (lang_output_section_statement_type
*)NULL
,
1852 lang_relocate_globals();
1862 lang_set_flags(ptr
, flags
)
1863 lang_section_flags_type
*ptr
;
1866 boolean state
= true;
1867 ptr
->flag_read
= false;
1868 ptr
->flag_write
= false;
1869 ptr
->flag_executable
= false;
1870 ptr
->flag_loadable
= false;
1873 if (*flags
== '!') {
1880 ptr
->flag_read
= state
;
1883 ptr
->flag_write
= state
;
1886 ptr
->flag_executable
= state
;
1889 ptr
->flag_loadable
= state
;
1892 info("%P%F illegal syntax in flags\n");
1902 lang_for_each_file(func
)
1905 lang_input_statement_type
*f
;
1906 for (f
= (lang_input_statement_type
*)file_chain
.head
;
1907 f
!= (lang_input_statement_type
*)NULL
;
1908 f
= (lang_input_statement_type
*)f
->next
)
1916 lang_for_each_input_section(func
)
1919 lang_input_statement_type
*f
;
1920 for (f
= (lang_input_statement_type
*)file_chain
.head
;
1921 f
!= (lang_input_statement_type
*)NULL
;
1922 f
= (lang_input_statement_type
*)f
->next
)
1925 for (s
= f
->the_bfd
->sections
;
1926 s
!= (asection
*)NULL
;
1928 func(f
->the_bfd
, s
);
1936 ldlang_add_file(entry
)
1937 lang_input_statement_type
*entry
;
1939 lang_has_input_file
= true;
1940 lang_statement_append(&file_chain
,
1941 (lang_statement_union_type
*)entry
,
1948 lang_add_output(name
)
1951 lang_output_statement_type
*new = new_stat(lang_output_statement
,
1954 had_output_filename
= true;
1958 static lang_output_section_statement_type
*current_section
;
1961 lang_enter_output_section_statement(output_section_statement_name
,
1964 char *output_section_statement_name
;
1965 etree_type
*address_exp
;
1966 bfd_vma block_value
;
1968 lang_output_section_statement_type
*os
;
1971 lang_output_section_statement_lookup(output_section_statement_name
);
1974 /* Add this statement to tree */
1975 /* add_statement(lang_output_section_statement_enum,
1976 output_section_statement);*/
1977 /* Make next things chain into subchain of this */
1979 if (os
->addr_tree
==
1980 (etree_type
*)NULL
) {
1984 os
->block_value
= block_value
;
1985 stat_ptr
= & os
->children
;
1993 if (had_output_filename
== false) {
1994 lang_add_output("a.out");
2004 asymbol
*create_symbol(name
, flags
, section
)
2009 extern lang_input_statement_type
*script_file
;
2010 asymbol
**def_ptr
= (asymbol
**)ldmalloc(sizeof(asymbol
**));
2011 /* Add this definition to script file */
2012 asymbol
*def
= (asymbol
*)bfd_make_empty_symbol(script_file
->the_bfd
);
2016 def
->section
= section
;
2019 Q_enter_global_ref(def_ptr
);
2032 /* EXPORTED TO YACC */
2034 lang_section_start(name
, address
)
2036 etree_type
*address
;
2038 lang_address_statement_type
*ad
=new_stat(lang_address_statement
, stat_ptr
);
2039 ad
->section_name
= name
;
2040 ad
->address
= address
;
2042 void lang_add_entry(name
)
2045 entry_symbol
= name
;
2049 lang_add_target(name
)
2052 lang_target_statement_type
*new = new_stat(lang_target_statement
,
2058 lang_add_wild(section_name
, filename
)
2062 lang_wild_statement_type
*new = new_stat(lang_wild_statement
,
2065 if (section_name
!= (char *)NULL
&& strcmp(section_name
,"COMMON") == 0)
2067 placed_commons
= true;
2069 new->section_name
= section_name
;
2070 new->filename
= filename
;
2071 lang_list_init(&new->children
);
2081 map_option_f
= true;
2088 void lang_add_fill(exp
)
2091 lang_fill_statement_type
*new = new_stat(lang_fill_statement
,
2096 void lang_add_data(type
, exp
)
2098 union etree_union
*exp
;
2101 lang_data_statement_type
*new = new_stat(lang_data_statement
,
2108 lang_add_assignment(exp
)
2111 lang_assignment_statement_type
*new = new_stat(lang_assignment_statement
,
2117 lang_add_attribute(attribute
)
2118 enum statement_enum attribute
;
2120 new_statement(attribute
, sizeof(lang_statement_union_type
),stat_ptr
);
2129 if (startup_file
!= (char *)NULL
) {
2130 info("%P%FMultiple STARTUP files\n");
2132 first_file
->filename
= name
;
2133 first_file
->local_sym_name
= name
;
2141 lang_float_flag
= maybe
;
2145 lang_leave_output_section_statement(fill
, memspec
)
2149 current_section
->fill
= fill
;
2150 current_section
->region
= lang_memory_region_lookup(memspec
);
2151 stat_ptr
= &statement_list
;
2155 lang_abs_symbol_at_end_of(section
, name
)
2159 extern bfd
*output_bfd
;
2160 extern asymbol
*create_symbol();
2161 asection
*s
= bfd_get_section_by_name(output_bfd
, section
);
2162 /* Add a symbol called _end */
2163 asymbol
*def
= create_symbol(name
,
2164 BSF_GLOBAL
| BSF_EXPORT
|
2167 if (s
!= (asection
*)NULL
) {
2168 def
->value
= s
->vma
+ s
->size
;
2176 lang_statement_append(list
, element
, field
)
2177 lang_statement_list_type
*list
;
2178 lang_statement_union_type
*element
;
2179 lang_statement_union_type
**field
;
2181 *(list
->tail
) = element
;
2187 lang_for_each_statement_worker(func
, s
)
2189 lang_statement_union_type
*s
;
2191 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
2195 switch (s
->header
.type
) {
2196 case lang_output_section_statement_enum
:
2197 lang_for_each_statement_worker
2199 s
->output_section_statement
.children
.head
);
2201 case lang_wild_statement_enum
:
2202 lang_for_each_statement_worker
2204 s
->wild_statement
.children
.head
);
2206 case lang_data_statement_enum
:
2207 case lang_object_symbols_statement_enum
:
2208 case lang_output_statement_enum
:
2209 case lang_target_statement_enum
:
2210 case lang_common_statement_enum
:
2211 case lang_input_section_enum
:
2212 case lang_input_statement_enum
:
2213 case lang_fill_statement_enum
:
2214 case lang_assignment_statement_enum
:
2215 case lang_padding_statement_enum
:
2216 case lang_address_statement_enum
:
2225 void lang_for_each_statement(func
)
2228 lang_for_each_statement_worker(func
,
2229 statement_list
.head
);