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. */
31 #include "ldgram.tab.h"
42 extern unsigned int undefined_global_sym_count
;
44 static char *startup_file
;
45 static lang_input_statement_type
*first_file
;
46 lang_statement_list_type statement_list
;
47 lang_statement_list_type
*stat_ptr
= &statement_list
;
48 lang_statement_list_type lang_output_section_statement
;
49 lang_statement_list_type input_file_chain
;
50 lang_statement_list_type file_chain
;
51 extern char *current_file
;
52 static boolean placed_commons
= false;
54 boolean lang_float_flag
;
56 static lang_output_section_statement_type
*default_common_section
;
60 PROTO(static void, print_statements
,(void));
61 PROTO(static void, print_statement
,(lang_statement_union_type
*,
62 lang_output_section_statement_type
*));
67 boolean lang_has_input_file
= false;
70 extern bfd
*output_bfd
;
71 size_t largest_section
;
74 extern enum bfd_architecture ldfile_output_architecture
;
75 extern unsigned long ldfile_output_machine
;
76 extern char *ldfile_output_machine_name
;
79 extern ldsym_type
*symbol_head
;
82 unsigned int commons_pending
;
87 extern args_type command_line
;
88 extern ld_config_type config
;
94 lang_output_section_statement_type
*create_object_symbols
;
96 extern boolean had_script
;
97 static boolean map_option_f
;
100 boolean had_output_filename
= false;
101 extern boolean write_map
;
108 size_t longest_section_name
= 8;
111 lang_input_statement_type
*script_file
;
113 section_userdata_type common_section_userdata
;
114 asection common_section
;
117 #define cat(a,b) a##b
119 #define cat(a,b) a/**/b
122 #define new_stat(x,y) (cat(x,_type)*) new_statement(cat(x,_enum), sizeof(cat(x,_type)),y)
124 #define outside_section_address(q) ( (q)->output_offset + (q)->output_section->vma)
126 #define outside_symbol_address(q) ((q)->value + outside_section_address(q->section))
128 boolean option_longmap
= false;
130 static void lang_list_init(list
)
131 lang_statement_list_type
*list
;
133 list
->head
= (lang_statement_union_type
*)NULL
;
134 list
->tail
= &list
->head
;
141 printf("%*s", -longest_section_name
, name
);
157 printf("%8lx", value
);
163 printf("%5x", (unsigned)value
);
166 print_alignment(value
)
169 printf("2**%2u",value
);
175 printf("%04x",(unsigned)value
);
180 lang_statement_union_type
*new_statement(type
, size
, list
)
181 enum statement_enum type
;
183 lang_statement_list_type
*list
;
185 lang_statement_union_type
*new = (lang_statement_union_type
*)
187 new->header
.type
= type
;
188 new->header
.next
= (lang_statement_union_type
*)NULL
;
189 lang_statement_append(list
, new, &new->header
.next
);
193 static lang_input_statement_type
*
194 new_afile(name
, file_type
, target
)
196 lang_input_file_enum_type file_type
;
199 lang_input_statement_type
*p
= new_stat(lang_input_statement
,
201 lang_has_input_file
= true;
204 case lang_input_file_is_symbols_only_enum
:
206 p
->is_archive
=false;
208 p
->local_sym_name
= name
;
209 p
->just_syms_flag
= true;
210 p
->search_dirs_flag
= false;
212 case lang_input_file_is_fake_enum
:
214 p
->is_archive
=false;
216 p
->local_sym_name
= name
;
217 p
->just_syms_flag
= false;
218 p
->search_dirs_flag
=false;
221 case lang_input_file_is_l_enum
:
222 p
->is_archive
= true;
225 p
->local_sym_name
= concat("-l",name
,"");
226 p
->just_syms_flag
= false;
227 p
->search_dirs_flag
= true;
230 case lang_input_file_is_search_file_enum
:
231 case lang_input_file_is_marker_enum
:
233 p
->is_archive
=false;
235 p
->local_sym_name
= name
;
236 p
->just_syms_flag
= false;
237 p
->search_dirs_flag
=true;
242 case lang_input_file_is_file_enum
:
244 p
->is_archive
=false;
246 p
->local_sym_name
= name
;
247 p
->just_syms_flag
= false;
248 p
->search_dirs_flag
=false;
255 p
->asymbols
= (asymbol
**)NULL
;
256 p
->superfile
= (lang_input_statement_type
*)NULL
;
258 p
->next_real_file
= (lang_statement_union_type
*)NULL
;
259 p
->next
= (lang_statement_union_type
*)NULL
;
261 p
->common_output_section
= (asection
*)NULL
;
263 lang_statement_append(&input_file_chain
,
264 (lang_statement_union_type
*)p
,
269 lang_input_statement_type
*
270 lang_add_input_file(name
,
274 lang_input_file_enum_type file_type
;
277 /* Look it up or build a new one */
279 lang_input_statement_type
*p
;
281 for (p
= (lang_input_statement_type
*)input_file_chain
.head
;
282 p
!= (lang_input_statement_type
*)NULL
;
283 p
= (lang_input_statement_type
*)(p
->next_real_file
))
285 /* Sometimes we have incomplete entries in here */
286 if (p
->filename
!= (char *)NULL
) {
287 if(strcmp(name
,p
->filename
) == 0) return p
;
291 return new_afile(name
, file_type
, target
);
300 stat_ptr
= &statement_list
;
301 lang_list_init(stat_ptr
);
303 lang_list_init(&input_file_chain
);
304 lang_list_init(&lang_output_section_statement
);
305 lang_list_init(&file_chain
);
306 first_file
= lang_add_input_file((char *)NULL
,
307 lang_input_file_is_marker_enum
,
315 script_file
= lang_add_input_file("script file",
316 lang_input_file_is_fake_enum
,
318 script_file
->the_bfd
= bfd_create("script file", output_bfd
);
319 script_file
->symbol_count
= 0;
321 common_section
.userdata
= &common_section_userdata
;
327 /* this function mainains a dictionary of regions. If the *default*
328 region is asked for then a pointer to the first region is
329 returned. If there is no first pointer then one is created
332 static lang_memory_region_type
*lang_memory_region_list
;
333 static lang_memory_region_type
**lang_memory_region_list_tail
= &lang_memory_region_list
;
335 lang_memory_region_type
*
336 lang_memory_region_lookup(name
)
340 lang_memory_region_type
*p
= lang_memory_region_list
;
341 for (p
= lang_memory_region_list
;
342 p
!= ( lang_memory_region_type
*)NULL
;
344 if (strcmp(p
->name
, name
) == 0) {
348 if (strcmp(name
,"*default*")==0) {
349 /* This is the default region, dig out first one on the list */
350 if (lang_memory_region_list
!= (lang_memory_region_type
*)NULL
){
351 return lang_memory_region_list
;
355 lang_memory_region_type
*new =
356 (lang_memory_region_type
*)ldmalloc(sizeof(lang_memory_region_type
));
358 new->next
= (lang_memory_region_type
*)NULL
;
360 *lang_memory_region_list_tail
= new;
361 lang_memory_region_list_tail
= &new->next
;
371 lang_output_section_statement_type
*
372 lang_output_section_find(name
)
375 lang_statement_union_type
*u
;
376 lang_output_section_statement_type
*lookup
;
378 for (u
= lang_output_section_statement
.head
;
379 u
!= (lang_statement_union_type
*)NULL
;
382 lookup
= &u
->output_section_statement
;
383 if (strcmp(name
, lookup
->name
)==0) {
387 return (lang_output_section_statement_type
*)NULL
;
390 lang_output_section_statement_type
*
391 lang_output_section_statement_lookup(name
)
395 lang_output_section_statement_type
*lookup
;
396 lookup
=lang_output_section_find(name
);
397 if (lookup
== (lang_output_section_statement_type
*)NULL
) {
399 lookup
=(lang_output_section_statement_type
*)
400 new_stat(lang_output_section_statement
, stat_ptr
);
401 lookup
->region
= (lang_memory_region_type
*)NULL
;
403 lookup
->block_value
= 1;
406 lookup
->next
= (lang_statement_union_type
*)NULL
;
407 lookup
->bfd_section
= (asection
*)NULL
;
408 lookup
->processed
= false;
409 lookup
->addr_tree
= (etree_type
*)NULL
;
410 lang_list_init(&lookup
->children
);
412 lang_statement_append(&lang_output_section_statement
,
413 (lang_statement_union_type
*)lookup
,
424 print_flags(outfile
, ignore_flags
)
426 lang_section_flags_type
*ignore_flags
;
428 fprintf(outfile
,"(");
430 if (flags
->flag_read
) fprintf(outfile
,"R");
431 if (flags
->flag_write
) fprintf(outfile
,"W");
432 if (flags
->flag_executable
) fprintf(outfile
,"X");
433 if (flags
->flag_loadable
) fprintf(outfile
,"L");
435 fprintf(outfile
,")");
442 lang_memory_region_type
*m
;
443 fprintf(outfile
,"**MEMORY CONFIGURATION**\n\n");
445 fprintf(outfile
,"name\t\torigin\t\tlength\t\tattributes\n");
446 for (m
= lang_memory_region_list
;
447 m
!= (lang_memory_region_type
*)NULL
;
450 fprintf(outfile
,"%-16s", m
->name
);
452 fprintf(outfile
,"%08lx\t%08lx\t", m
->origin
, m
->length
);
453 print_flags(outfile
, &m
->flags
);
454 fprintf(outfile
,"\n");
456 fprintf(outfile
,"\n\n**LINK EDITOR MEMORY MAP**\n\n");
457 fprintf(outfile
,"output\t\tinput\t\tvirtual\n");
458 fprintf(outfile
,"section\t\tsection\t\taddress\tsize\n\n");
467 static void init_os(s
)
468 lang_output_section_statement_type
*s
;
470 section_userdata_type
*new =
471 (section_userdata_type
*)
472 ldmalloc(sizeof(section_userdata_type
));
474 s
->bfd_section
= bfd_make_section(output_bfd
, s
->name
);
475 s
->bfd_section
->output_section
= s
->bfd_section
;
476 s
->bfd_section
->flags
= SEC_NO_FLAGS
;
477 /* We initialize an output sections output offset to minus its own */
478 /* vma to allow us to output a section through itself */
479 s
->bfd_section
->output_offset
= 0;
480 get_userdata( s
->bfd_section
) = new;
484 wild_doit(ptr
, section
,output
, file
)
485 lang_statement_list_type
*ptr
;
487 lang_output_section_statement_type
*output
;
488 lang_input_statement_type
*file
;
490 if(output
->bfd_section
== (asection
*)NULL
)
495 if (section
!= (asection
*)NULL
496 && section
->output_section
== (asection
*)NULL
) {
497 /* Add a section reference to the list */
498 lang_input_section_type
*new = new_stat(lang_input_section
, ptr
);
500 new->section
= section
;
502 section
->output_section
= output
->bfd_section
;
503 section
->output_section
->flags
|= section
->flags
;
504 if (section
->alignment_power
> output
->bfd_section
->alignment_power
) {
505 output
->bfd_section
->alignment_power
= section
->alignment_power
;
512 our_bfd_get_section_by_name(abfd
, section
)
516 return bfd_get_section_by_name(abfd
, section
);
520 wild_section(ptr
, section
, file
, output
)
521 lang_wild_statement_type
*ptr
;
523 lang_input_statement_type
*file
;
524 lang_output_section_statement_type
*output
;
527 if (section
== (char *)NULL
) {
528 /* Do the creation to all sections in the file */
529 for (s
= file
->the_bfd
->sections
; s
!= (asection
*)NULL
; s
=s
->next
) {
530 wild_doit(&ptr
->children
, s
, output
, file
);
534 /* Do the creation to the named section only */
535 wild_doit(&ptr
->children
,
536 our_bfd_get_section_by_name(file
->the_bfd
, section
),
547 lang_input_statement_type
*lookup_name(name
, target
)
551 lang_input_statement_type
*search
;
552 for(search
= (lang_input_statement_type
*)input_file_chain
.head
;
553 search
!= (lang_input_statement_type
*)NULL
;
554 search
= (lang_input_statement_type
*)search
->next_real_file
)
556 if (search
->filename
== (char *)NULL
&& name
== (char *)NULL
) {
559 if (search
->filename
!= (char *)NULL
&& name
!= (char *)NULL
) {
560 if (strcmp(search
->filename
, name
) == 0) {
561 Q_read_file_symbols(search
);
567 /* There isn't an afile entry for this file yet, this must be */
568 /* because the name has only appeared inside a load script and not */
569 /* on the command line */
570 search
= new_afile(name
, lang_input_file_is_file_enum
, target
);
571 Q_read_file_symbols(search
);
577 wild(s
, section
, file
, target
, output
)
578 lang_wild_statement_type
*s
;
582 lang_output_section_statement_type
*output
;
584 lang_input_statement_type
*f
;
585 if (file
== (char *)NULL
) {
586 /* Perform the iteration over all files in the list */
587 for (f
= (lang_input_statement_type
*)file_chain
.head
;
588 f
!= (lang_input_statement_type
*)NULL
;
589 f
= (lang_input_statement_type
*)f
->next
) {
590 wild_section(s
, section
, f
, output
);
594 /* Perform the iteration over a single file */
595 wild_section( s
, section
, lookup_name(file
, target
), output
);
600 read in all the files
603 open_output(name
, target
)
607 extern char *output_filename
;
608 bfd
* output
= bfd_openw(name
, target
);
609 output_filename
= name
;
610 if (output
== (bfd
*)NULL
)
612 if (bfd_error
== invalid_target
) {
613 info("%P%F target %s not found\n", target
);
615 info("%P%F problem opening output file %s, %E", name
);
618 output
->flags
|= D_PAGED
;
619 bfd_set_format(output
, bfd_object
);
622 extern char *default_target
;
624 lang_phase_0(sh
,target
)
625 lang_statement_union_type
*sh
;
628 lang_statement_union_type
*s
= (lang_statement_union_type
*)sh
;
629 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
631 switch (s
->header
.type
) {
632 case lang_output_section_statement_enum
:
633 lang_phase_0(s
->output_section_statement
.children
.head
,
636 case lang_output_statement_enum
:
638 output_bfd
= open_output(s
->output_statement
.name
,
639 target
== (char *)NULL
?
640 default_target
: target
);
641 ldemul_set_output_arch();
644 case lang_target_statement_enum
:
645 target
= s
->target_statement
.target
;
647 case lang_wild_statement_enum
:
648 /* Maybe we should load the file's symbols */
649 if (s
->wild_statement
.filename
) {
650 (void) lookup_name(s
->wild_statement
.filename
, target
);
653 /* Attatch this to the current output section */
654 case lang_common_statement_enum
:
655 case lang_fill_statement_enum
:
656 case lang_input_section_enum
:
657 case lang_object_symbols_statement_enum
:
658 case lang_address_statement_enum
:
659 case lang_data_statement_enum
:
661 case lang_afile_asection_pair_statement_enum
:
666 case lang_input_statement_enum
:
667 if (s
->input_statement
.real
== true) {
668 s
->input_statement
.target
= target
;
669 lookup_name(s
->input_statement
.filename
, target
);
672 case lang_assignment_statement_enum
:
674 (void) exp_fold_tree(s
->assignment_statement
.exp
,
680 case lang_padding_statement_enum
:
688 /* If there are [COMMONS] statements, put a wild one into the bss section */
691 lang_reasonable_defaults()
694 lang_output_section_statement_lookup(".text");
695 lang_output_section_statement_lookup(".data");
697 default_common_section
=
698 lang_output_section_statement_lookup(".bss");
700 if (placed_commons
== false) {
701 lang_wild_statement_type
*new =
702 new_stat(lang_wild_statement
,
703 &default_common_section
->children
);
704 new->section_name
= "COMMON";
705 new->filename
= (char *)NULL
;
706 lang_list_init(&new->children
);
713 if (had_script
== false) {
714 parse_line(ldemul_get_script());
717 lang_reasonable_defaults();
718 lang_phase_0(statement_list
.head
,default_target
);
722 /* Open input files and attatch to output sections */
724 lang_open_input(s
, target
, output_section_statement
)
725 lang_statement_union_type
*s
;
727 lang_output_section_statement_type
*output_section_statement
;
729 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
731 switch (s
->header
.type
) {
732 case lang_wild_statement_enum
:
733 wild(&s
->wild_statement
, s
->wild_statement
.section_name
,
734 s
->wild_statement
.filename
, target
,
735 output_section_statement
);
739 case lang_output_section_statement_enum
:
740 lang_open_input(s
->output_section_statement
.children
.head
,
742 &s
->output_section_statement
);
744 case lang_output_statement_enum
:
746 case lang_target_statement_enum
:
747 target
= s
->target_statement
.target
;
749 case lang_common_statement_enum
:
750 case lang_fill_statement_enum
:
751 case lang_input_section_enum
:
752 case lang_object_symbols_statement_enum
:
753 case lang_data_statement_enum
:
755 case lang_afile_asection_pair_statement_enum
:
759 case lang_assignment_statement_enum
:
760 case lang_padding_statement_enum
:
763 case lang_address_statement_enum
:
764 /* Mark the specified section with the supplied address */
766 lang_output_section_statement_type
*os
=
767 lang_output_section_statement_lookup
768 (s
->address_statement
.section_name
);
769 os
->addr_tree
= s
->address_statement
.address
;
772 case lang_input_statement_enum
:
773 /* A standard input statement, has no wildcards */
774 /* Q_read_file_symbols(&s->input_statement);*/
785 print_output_section_statement(output_section_statement
)
786 lang_output_section_statement_type
*output_section_statement
;
788 asection
*section
= output_section_statement
->bfd_section
;
790 print_section(output_section_statement
->name
);
793 print_dot
= section
->vma
;
797 print_address(section
->vma
);
799 print_size(section
->size
);
801 print_alignment(section
->alignment_power
);
804 printf("%s flags", output_section_statement
->region
->name
);
805 print_flags(stdout
, &output_section_statement
->flags
);
810 printf("No attached output section");
813 print_statement(output_section_statement
->children
.head
,
814 output_section_statement
);
819 print_assignment(assignment
, output_section
)
820 lang_assignment_statement_type
*assignment
;
821 lang_output_section_statement_type
*output_section
;
823 etree_value_type result
;
828 print_address(print_dot
);
830 result
= exp_fold_tree(assignment
->exp
->assign
.src
,
832 lang_final_phase_enum
,
837 print_address(result
.value
);
841 printf("*undefined*");
844 exp_print_tree(stdout
, assignment
->exp
);
849 print_input_statement(statm
)
850 lang_input_statement_type
*statm
;
852 printf("LOAD %s\n",statm
->filename
);
855 static void print_symbol(q
)
862 print_address(outside_symbol_address(q
));
863 printf(" %s", q
->name
? q
->name
: " ");
867 print_input_section(in
)
868 lang_input_section_type
*in
;
870 asection
*i
= in
->section
;
875 print_section(i
->name
);
877 if (i
->output_section
) {
878 print_address(i
->output_section
->vma
+ i
->output_offset
);
882 print_alignment(i
->alignment_power
);
885 bfd
*abfd
= in
->ifile
->the_bfd
;
886 printf(" %s ",abfd
->xvec
->name
);
887 if(abfd
->my_archive
!= (bfd
*)NULL
) {
888 printf("[%s]%s", abfd
->my_archive
->filename
,
892 printf("%s", abfd
->filename
);
896 /* Find all the symbols in this file defined in this section */
899 for (p
= in
->ifile
->asymbols
; *p
; p
++) {
902 if (bfd_get_section(q
) == i
&& q
->flags
& BSF_GLOBAL
) {
913 print_dot
= outside_section_address(i
) + i
->size
;
916 printf("No output section allocated\n");
921 print_common_statement()
926 print_section(common_section
.output_section
->name
);
928 print_address(common_section
.output_offset
+
929 common_section
.output_section
->vma
);
931 print_size(common_section
.size
);
935 /* Print out all the global symbols */
938 for (lgs
= symbol_head
; lgs
!= (ldsym_type
*)NULL
; lgs
=
940 if (lgs
->sdefs_chain
) {
941 asymbol
*def
= *(lgs
->sdefs_chain
);
942 if (def
->section
== &common_section
) {
948 print_dot
= common_section
.output_offset
+
949 common_section
.output_section
->vma
+ common_section
.size
;
954 print_fill_statement(fill
)
955 lang_fill_statement_type
*fill
;
957 printf("FILL mask ");
958 print_fill( fill
->fill
);
962 print_data_statement(data
)
963 lang_data_statement_type
*data
;
970 ASSERT(print_dot
== data
->output_vma
);
972 print_address(data
->output_vma
);
974 print_address(data
->value
);
976 switch (data
->type
) {
979 print_dot
+= BYTE_SIZE
;
983 print_dot
+= SHORT_SIZE
;
987 print_dot
+= LONG_SIZE
;
991 exp_print_tree(stdout
, data
->exp
);
998 print_padding_statement(s
)
999 lang_padding_statement_type
*s
;
1003 print_section("*fill*");
1005 print_address(s
->output_offset
+ s
->output_section
->vma
);
1007 print_size(s
->size
);
1009 print_fill(s
->fill
);
1013 static void print_wild_statement(w
,os
)
1014 lang_wild_statement_type
*w
;
1015 lang_output_section_statement_type
*os
;
1017 if (w
->filename
!= (char *)NULL
) {
1018 printf("%s",w
->filename
);
1023 if (w
->section_name
!= (char *)NULL
) {
1024 printf("(%s)",w
->section_name
);
1030 print_statement(w
->children
.head
, os
);
1034 print_statement(s
, os
)
1035 lang_statement_union_type
*s
;
1036 lang_output_section_statement_type
*os
;
1039 switch (s
->header
.type
) {
1040 case lang_wild_statement_enum
:
1041 print_wild_statement(&s
->wild_statement
, os
);
1044 printf("Fail with %d\n",s
->header
.type
);
1047 case lang_address_statement_enum
:
1048 printf("address\n");
1050 case lang_common_statement_enum
:
1051 print_common_statement();
1053 case lang_object_symbols_statement_enum
:
1054 printf("object symbols\n");
1056 case lang_fill_statement_enum
:
1057 print_fill_statement(&s
->fill_statement
);
1059 case lang_data_statement_enum
:
1060 print_data_statement(&s
->data_statement
);
1064 case lang_input_section_enum
:
1065 print_input_section(&s
->input_section
);
1067 case lang_padding_statement_enum
:
1068 print_padding_statement(&s
->padding_statement
);
1070 case lang_output_section_statement_enum
:
1071 print_output_section_statement(&s
->output_section_statement
);
1073 case lang_assignment_statement_enum
:
1074 print_assignment(&s
->assignment_statement
,
1079 case lang_target_statement_enum
:
1080 printf("TARGET(%s)\n", s
->target_statement
.target
);
1082 case lang_output_statement_enum
:
1083 printf("OUTPUT(%s)\n", s
->output_statement
.name
);
1085 case lang_input_statement_enum
:
1086 print_input_statement(&s
->input_statement
);
1088 case lang_afile_asection_pair_statement_enum
:
1100 print_statement(statement_list
.head
,
1101 (lang_output_section_statement_type
*)NULL
);
1105 insert_pad(this_ptr
, fill
, power
, output_section_statement
, dot
)
1106 lang_statement_union_type
**this_ptr
;
1109 asection
* output_section_statement
;
1112 /* Align this section first to the
1113 input sections requirement, then
1114 to the output section's requirement.
1115 If this alignment is > than any seen before,
1116 then record it too. Perform the alignment by
1117 inserting a magic 'padding' statement.
1120 unsigned int alignment_needed
= align_power(dot
, power
) - dot
;
1122 if (alignment_needed
!= 0)
1124 lang_statement_union_type
*new =
1125 (lang_statement_union_type
*)
1126 ldmalloc(sizeof(lang_padding_statement_type
));
1127 /* Link into existing chain */
1128 new->header
.next
= *this_ptr
;
1130 new->header
.type
= lang_padding_statement_enum
;
1131 new->padding_statement
.output_section
= output_section_statement
;
1132 new->padding_statement
.output_offset
=
1133 dot
- output_section_statement
->vma
;
1134 new->padding_statement
.fill
= fill
;
1135 new->padding_statement
.size
= alignment_needed
;
1139 /* Remember the most restrictive alignment */
1140 if (power
> output_section_statement
->alignment_power
) {
1141 output_section_statement
->alignment_power
= power
;
1143 output_section_statement
->size
+= alignment_needed
;
1144 return alignment_needed
+ dot
;
1149 size_common runs run though each global symboxl, and works
1150 out how big the common section will be.
1154 size_common(output_section_statement
, this_ptr
, dot
)
1155 lang_output_section_statement_type
*output_section_statement
;
1156 lang_statement_union_type
**this_ptr
;
1159 extern ldsym_type
*symbol_head
;
1161 /* Make sure that each symbol is only defined once.
1162 Allocate common symbols
1163 Make the ref chain point to the defining asymbol.
1165 /* Now, for each symbol, verify that it is defined globally at most once.
1166 Put the global value into the symbol entry.
1167 Common symbols are allocated here, in the BSS section.
1168 Each defined symbol is given a '->defined' field
1169 which is the correct N_ code for its definition,
1170 except in the case of common symbols with -r.
1171 Then make all the references point at the symbol entry
1172 instead of being chained together. */
1175 common_section
.name
= output_section_statement
->bfd_section
->name
;
1176 common_section
.output_section
= output_section_statement
->bfd_section
;
1177 common_section
.output_offset
=
1178 dot
- output_section_statement
->bfd_section
->vma
;
1179 if (config
.relocateable_output
== false ||
1180 command_line
.force_common_definition
== true) {
1181 dot
= insert_pad(this_ptr
,
1182 0x0, 4, output_section_statement
->bfd_section
, dot
);
1184 for (sp
= symbol_head
; sp
!= (ldsym_type
*)NULL
; sp
= sp
->next
)
1186 /* Attatch this symbol to the correct output section*/
1188 /* Allocate as common if wanted */
1190 if (sp
->scoms_chain
)
1193 unsigned long com
= (*(sp
->scoms_chain
))->value
;
1194 /* Work out what alignment this common item s
1195 hould be put on. Anything < int is int aligned,
1196 anything bigger is self aligned,
1197 up to the restriction of the machine */
1199 unsigned int align
= sizeof(int);
1201 /* Round up size of object to nearest int */
1202 com
= ALIGN(com
, sizeof(int));
1203 /* See what alignment is necessary -*/
1205 while ((com
& align
)==0) align
<<=1;
1211 dot
= ALIGN(dot
, align
);
1214 /* Transmogrify this from a common symbol
1215 into a definition of a symbol in common
1217 sp
->sdefs_chain
= sp
->scoms_chain
;
1220 asymbol
*com_ptr
= *(sp
->sdefs_chain
);
1222 sp
->scoms_chain
= (asymbol
**)NULL
;
1224 /* Assign address, but keep section relative */
1226 /* Force the symbol to belong in the bss section */
1227 com_ptr
->flags
= BSF_EXPORT
| BSF_GLOBAL
;
1228 com_ptr
->section
= &common_section
;
1229 common_section
.size
+= com
;
1232 printf ("Allocating common %s: %lx at %lx\n",
1237 com_ptr
->value
= common_section
.size
;
1243 (common_section
.output_section
->vma
+
1244 common_section
.output_section
->size
)) {
1245 common_section
.output_section
->size
=
1246 dot
- common_section
.output_section
->vma
;
1248 return dot
+ common_section
.size
;
1252 size_input_section( this_ptr
, output_section_statement
, fill
, dot
)
1253 lang_statement_union_type
**this_ptr
;
1254 lang_output_section_statement_type
*output_section_statement
;
1255 unsigned short fill
;
1258 lang_input_section_type
*is
= &((*this_ptr
)->input_section
);
1259 asection
*i
= is
->section
;
1261 dot
= insert_pad(this_ptr
, fill
, i
->alignment_power
,
1262 output_section_statement
->bfd_section
, dot
);
1264 /* remember the largest size so we can malloc the largest area */
1265 /* needed for the output stage */
1266 if (i
->size
> largest_section
) {
1267 largest_section
= i
->size
;
1270 /* Remember where in the output section this input section goes */
1271 i
->output_offset
= dot
- output_section_statement
->bfd_section
->vma
;
1273 /* Mark how big the output section must be to contain this now */
1275 output_section_statement
->bfd_section
->size
=
1276 dot
- output_section_statement
->bfd_section
->vma
;
1283 /* Work out the size of the output sections
1284 from the sizes of the input sections */
1286 lang_size_sections(s
, output_section_statement
, prev
, fill
, dot
)
1287 lang_statement_union_type
*s
;
1288 lang_output_section_statement_type
* output_section_statement
;
1289 lang_statement_union_type
**prev
;
1290 unsigned short fill
;
1293 /* Size up the sections from their constituent parts */
1294 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
1296 switch (s
->header
.type
) {
1297 case lang_output_section_statement_enum
:
1300 lang_output_section_statement_type
*os
=
1301 &(s
->output_section_statement
);
1302 /* The start of a section */
1304 if (os
->addr_tree
== (etree_type
*)NULL
) {
1305 /* No address specified for this section, get one
1306 from the region specification
1308 if (os
->region
== (lang_memory_region_type
*)NULL
) {
1309 os
->region
= lang_memory_region_lookup("*default*");
1311 dot
= os
->region
->current
;
1314 etree_value_type r
;
1315 r
= exp_fold_tree(os
->addr_tree
,
1316 (lang_output_section_statement_type
*)NULL
,
1317 lang_allocating_phase_enum
,
1319 if (r
.valid
== false) {
1320 info("%F%S: non constant address expression for section %s\n",
1325 /* The section starts here */
1326 /* First, align to what the section needs */
1328 dot
= align_power(dot
, os
->bfd_section
->alignment_power
);
1329 os
->bfd_section
->vma
= dot
;
1330 os
->bfd_section
->output_offset
= 0;
1332 (void) lang_size_sections(os
->children
.head
, os
, &os
->children
.head
,
1334 /* Ignore the size of the input sections, use the vma and size to */
1338 after
= ALIGN(os
->bfd_section
->vma
+
1339 os
->bfd_section
->size
,
1343 os
->bfd_section
->size
= after
- os
->bfd_section
->vma
;
1344 dot
= os
->bfd_section
->vma
+ os
->bfd_section
->size
;
1345 os
->processed
= true;
1347 /* Replace into region ? */
1348 if (os
->addr_tree
== (etree_type
*)NULL
1349 && os
->region
!=(lang_memory_region_type
*)NULL
) {
1350 os
->region
->current
= dot
;
1356 case lang_data_statement_enum
:
1359 s
->data_statement
.output_vma
= dot
;
1360 s
->data_statement
.output_section
=
1361 output_section_statement
->bfd_section
;
1363 switch (s
->data_statement
.type
) {
1376 output_section_statement
->bfd_section
->size
+= size
;
1380 case lang_wild_statement_enum
:
1382 dot
= lang_size_sections(s
->wild_statement
.children
.head
,
1383 output_section_statement
,
1384 &s
->wild_statement
.children
.head
,
1390 case lang_object_symbols_statement_enum
:
1391 create_object_symbols
= output_section_statement
;
1393 case lang_output_statement_enum
:
1395 case lang_target_statement_enum
:
1397 case lang_common_statement_enum
:
1398 dot
= size_common(output_section_statement
, prev
, dot
);
1402 case lang_input_section_enum
:
1403 dot
= size_input_section(prev
,
1404 output_section_statement
,
1405 output_section_statement
->fill
, dot
);
1407 case lang_input_statement_enum
:
1409 case lang_fill_statement_enum
:
1410 fill
= s
->fill_statement
.fill
;
1412 case lang_assignment_statement_enum
:
1414 bfd_vma newdot
= dot
;
1415 exp_fold_tree(s
->assignment_statement
.exp
,
1416 output_section_statement
,
1417 lang_allocating_phase_enum
,
1422 /* We've been moved ! so insert a pad */
1424 lang_statement_union_type
*new =
1425 (lang_statement_union_type
*)
1426 ldmalloc(sizeof(lang_padding_statement_type
));
1427 /* Link into existing chain */
1428 new->header
.next
= *prev
;
1430 new->header
.type
= lang_padding_statement_enum
;
1431 new->padding_statement
.output_section
=
1432 output_section_statement
->bfd_section
;
1433 new->padding_statement
.output_offset
=
1434 dot
- output_section_statement
->bfd_section
->vma
;
1435 new->padding_statement
.fill
= fill
;
1436 new->padding_statement
.size
= newdot
- dot
;
1437 output_section_statement
->bfd_section
->size
+=
1438 new->padding_statement
.size
;
1444 case lang_padding_statement_enum
:
1450 case lang_address_statement_enum
:
1453 prev
= &s
->header
.next
;
1460 lang_do_assignments(s
, output_section_statement
, fill
, dot
)
1461 lang_statement_union_type
*s
;
1462 lang_output_section_statement_type
* output_section_statement
;
1463 unsigned short fill
;
1467 for (; s
!= (lang_statement_union_type
*)NULL
; s
= s
->next
)
1469 switch (s
->header
.type
) {
1470 case lang_output_section_statement_enum
:
1472 lang_output_section_statement_type
*os
=
1473 &(s
->output_section_statement
);
1474 dot
= os
->bfd_section
->vma
;
1475 (void) lang_do_assignments(os
->children
.head
, os
, os
->fill
, dot
);
1476 dot
= os
->bfd_section
->vma
+ os
->bfd_section
->size
;
1479 case lang_wild_statement_enum
:
1481 dot
= lang_do_assignments(s
->wild_statement
.children
.head
,
1482 output_section_statement
,
1487 case lang_object_symbols_statement_enum
:
1488 case lang_output_statement_enum
:
1489 case lang_target_statement_enum
:
1490 case lang_common_statement_enum
:
1492 case lang_data_statement_enum
:
1494 etree_value_type value
;
1495 value
= exp_fold_tree(s
->data_statement
.exp
,
1496 0, lang_final_phase_enum
, dot
, &dot
);
1497 s
->data_statement
.value
= value
.value
;
1498 if (value
.valid
== false) info("%F%P: Invalid data statement\n");
1500 switch (s
->data_statement
.type
) {
1512 case lang_input_section_enum
:
1514 asection
*in
= s
->input_section
.section
;
1519 case lang_input_statement_enum
:
1521 case lang_fill_statement_enum
:
1522 fill
= s
->fill_statement
.fill
;
1524 case lang_assignment_statement_enum
:
1526 exp_fold_tree(s
->assignment_statement
.exp
,
1527 output_section_statement
,
1528 lang_final_phase_enum
,
1534 case lang_padding_statement_enum
:
1535 dot
+= s
->padding_statement
.size
;
1540 case lang_address_statement_enum
:
1550 static void lang_relocate_globals()
1554 Each ldsym_type maintains a chain of pointers to asymbols which
1555 references the definition. Replace each pointer to the referenence
1556 with a pointer to only one place, preferably the definition. If
1557 the defintion isn't available then the common symbol, and if
1558 there isn't one of them then choose one reference.
1561 FOR_EACH_LDSYM(lgs
) {
1563 if (lgs
->sdefs_chain
) {
1564 it
= *(lgs
->sdefs_chain
);
1566 else if (lgs
->scoms_chain
!= (asymbol
**)NULL
) {
1567 it
= *(lgs
->scoms_chain
);
1569 else if (lgs
->srefs_chain
!= (asymbol
**)NULL
) {
1570 it
= *(lgs
->srefs_chain
);
1575 if (it
!= (asymbol
*)NULL
)
1577 asymbol
**ptr
= lgs
->srefs_chain
;
1579 while (ptr
!= (asymbol
**)NULL
) {
1580 asymbol
*ref
= *ptr
;
1582 ptr
= (asymbol
**)(ref
->udata
);
1590 /* now that all the jiggery pokery is finished, copy important data from
1591 * out internal form to the bfd way. Also create a section
1592 * for each dummy file
1596 lang_create_output_section_statements()
1598 lang_statement_union_type
*os
;
1599 for (os
= lang_output_section_statement
.head
;
1600 os
!= (lang_statement_union_type
*)NULL
;
1601 os
= os
->output_section_statement
.next
) {
1602 lang_output_section_statement_type
*s
=
1603 &os
->output_section_statement
;
1606 script_file
->the_bfd
->sections
= output_bfd
->sections
;
1614 if (entry_symbol
== (char *)NULL
) {
1615 /* No entry has been specified, look for start */
1616 entry_symbol
= "start";
1618 lgs
= ldsym_get_soft(entry_symbol
);
1619 if (lgs
&& lgs
->sdefs_chain
) {
1620 asymbol
*sy
= *(lgs
->sdefs_chain
);
1621 /* We can set the entry address*/
1622 bfd_set_start_address(output_bfd
,
1623 outside_symbol_address(sy
));
1627 /* Can't find anything reasonable,
1628 use the first address in the text section
1630 asection
*ts
= bfd_get_section_by_name(output_bfd
, ".text");
1632 bfd_set_start_address(output_bfd
, ts
->vma
);
1637 /* By now we know the target architecture, and we may have an */
1638 /* ldfile_output_machine_name */
1642 lang_statement_union_type
*file
;
1645 for (file
= file_chain
.head
;
1646 file
!= (lang_statement_union_type
*)NULL
;
1647 file
=file
->input_statement
.next
)
1649 /* Inspect the architecture and ensure we're linking like
1653 if (bfd_arch_compatible( file
->input_statement
.the_bfd
,
1655 &ldfile_output_architecture
,
1656 &ldfile_output_machine
)) {
1657 bfd_set_arch_mach(output_bfd
,
1658 ldfile_output_architecture
, ldfile_output_machine
);
1661 enum bfd_architecture this_architecture
=
1662 bfd_get_architecture(file
->input_statement
.the_bfd
);
1663 unsigned long this_machine
=
1664 bfd_get_machine(file
->input_statement
.the_bfd
);
1666 info("%I: architecture %s",
1668 bfd_printable_arch_mach(this_architecture
, this_machine
));
1669 info(" incompatible with output %s\n",
1670 bfd_printable_arch_mach(ldfile_output_architecture
,
1671 ldfile_output_machine
));
1672 ldfile_output_architecture
= this_architecture
;
1673 ldfile_output_machine
= this_machine
;
1674 bfd_set_arch_mach(output_bfd
,
1675 ldfile_output_architecture
,
1676 ldfile_output_machine
);
1685 * run through all the global common symbols and tie them
1686 * to the output section requested.
1693 if (config
.relocateable_output
== false ||
1694 command_line
.force_common_definition
== true) {
1695 for (lgs
= symbol_head
;
1696 lgs
!= (ldsym_type
*)NULL
;
1702 if (lgs
->scoms_chain
!= (asymbol
**)NULL
) {
1704 com
= *(lgs
->scoms_chain
);
1706 align
= sizeof(int);
1707 /* Round up size of object to nearest int */
1708 size
= ALIGN(size
, sizeof(int));
1709 /* Force alignment */
1711 while ((size
& align
)==0) align
<<=1;
1716 /* Change from a common symbol into a definition of
1718 lgs
->sdefs_chain
= lgs
->scoms_chain
;
1719 lgs
->scoms_chain
= (asymbol
**)NULL
;
1721 /* Point to the correct common section */
1723 ((lang_input_statement_type
*)
1724 (com
->the_bfd
->usrdata
))->common_section
;
1725 /* Fix the size of the common section */
1728 com
->flags
= BSF_EXPORT
| BSF_GLOBAL
;
1732 printf ("Allocating common %s: %x at %x\n",
1735 (unsigned) com
->section
->size
);
1737 com
->value
= com
->section
->size
;
1738 com
->section
->size
+= size
;
1745 run through the input files and ensure that every input
1746 section has somewhere to go. If one is found without
1747 a destination then create an input request and place it
1748 into the statement tree.
1751 static void lang_place_orphans()
1753 lang_input_statement_type
*file
;
1754 for (file
= (lang_input_statement_type
*)file_chain
.head
;
1755 file
!= (lang_input_statement_type
*)NULL
;
1756 file
= (lang_input_statement_type
*)file
->next
) {
1758 for (s
= file
->the_bfd
->sections
;
1759 s
!= (asection
*)NULL
;
1761 if ( s
->output_section
== (asection
*)NULL
) {
1762 /* This section of the file is not attatched, root
1763 around for a sensible place for it to go */
1765 if (file
->common_section
== s
) {
1766 /* This is a lonely common section which must
1767 have come from an archive. We attatch to the
1768 section with the wildcard */
1769 wild_doit(&default_common_section
->children
, s
,
1770 default_common_section
, file
);
1773 lang_output_section_statement_type
*os
=
1774 lang_output_section_statement_lookup(s
->name
);
1776 wild_doit(&os
->children
, s
, os
, file
);
1788 * peformed after every file has been opened and symbols read
1795 lang_create_output_section_statements();
1796 lang_open_input(statement_list
.head
, (char *)NULL
,
1797 ( lang_output_section_statement_type
*)NULL
);
1798 lang_place_orphans();
1801 ldemul_before_allocation();
1803 lang_size_sections(statement_list
.head
,
1804 (lang_output_section_statement_type
*)NULL
,
1805 &(statement_list
.head
), 0, (bfd_vma
)0);
1806 ldemul_after_allocation();
1807 /* Do it once again now that we know the sizes of everything */
1809 lang_do_assignments(statement_list
.head
,
1810 (lang_output_section_statement_type
*)NULL
,
1817 lang_relocate_globals();
1827 lang_set_flags(ptr
, flags
)
1828 lang_section_flags_type
*ptr
;
1831 boolean state
= true;
1832 ptr
->flag_read
= false;
1833 ptr
->flag_write
= false;
1834 ptr
->flag_executable
= false;
1835 ptr
->flag_loadable
= false;
1838 if (*flags
== '!') {
1845 ptr
->flag_read
= state
;
1848 ptr
->flag_write
= state
;
1851 ptr
->flag_executable
= state
;
1854 ptr
->flag_loadable
= state
;
1857 info("%P%F illegal syntax in flags\n");
1867 lang_for_each_file(func
)
1870 lang_input_statement_type
*f
;
1871 for (f
= (lang_input_statement_type
*)file_chain
.head
;
1872 f
!= (lang_input_statement_type
*)NULL
;
1873 f
= (lang_input_statement_type
*)f
->next
)
1881 lang_for_each_input_section(func
)
1884 lang_input_statement_type
*f
;
1885 for (f
= (lang_input_statement_type
*)file_chain
.head
;
1886 f
!= (lang_input_statement_type
*)NULL
;
1887 f
= (lang_input_statement_type
*)f
->next
)
1890 for (s
= f
->the_bfd
->sections
;
1891 s
!= (asection
*)NULL
;
1893 func(f
->the_bfd
, s
);
1901 ldlang_add_file(entry
)
1902 lang_input_statement_type
*entry
;
1904 lang_has_input_file
= true;
1905 lang_statement_append(&file_chain
,
1906 (lang_statement_union_type
*)entry
,
1913 lang_add_output(name
)
1916 lang_output_statement_type
*new = new_stat(lang_output_statement
,
1919 had_output_filename
= true;
1923 static lang_output_section_statement_type
*current_section
;
1926 lang_enter_output_section_statement(output_section_statement_name
,
1929 char *output_section_statement_name
;
1930 etree_type
*address_exp
;
1931 bfd_vma block_value
;
1933 lang_output_section_statement_type
*os
;
1936 lang_output_section_statement_lookup(output_section_statement_name
);
1939 /* Add this statement to tree */
1940 /* add_statement(lang_output_section_statement_enum,
1941 output_section_statement);*/
1942 /* Make next things chain into subchain of this */
1944 if (os
->addr_tree
==
1945 (etree_type
*)NULL
) {
1949 os
->block_value
= block_value
;
1950 stat_ptr
= & os
->children
;
1958 if (had_output_filename
== false) {
1959 lang_add_output("a.out");
1969 asymbol
*create_symbol(name
, flags
, section
)
1974 extern lang_input_statement_type
*script_file
;
1975 asymbol
**def_ptr
= (asymbol
**)ldmalloc(sizeof(asymbol
**));
1976 /* Add this definition to script file */
1977 asymbol
*def
= (asymbol
*)bfd_make_empty_symbol(script_file
->the_bfd
);
1981 def
->section
= section
;
1984 Q_enter_global_ref(def_ptr
);
1997 /* EXPORTED TO YACC */
1999 lang_section_start(name
, address
)
2001 etree_type
*address
;
2003 lang_address_statement_type
*ad
=new_stat(lang_address_statement
, stat_ptr
);
2004 ad
->section_name
= name
;
2005 ad
->address
= address
;
2007 void lang_add_entry(name
)
2010 entry_symbol
= name
;
2014 lang_add_target(name
)
2017 lang_target_statement_type
*new = new_stat(lang_target_statement
,
2023 lang_add_wild(section_name
, filename
)
2027 lang_wild_statement_type
*new = new_stat(lang_wild_statement
,
2030 if (section_name
!= (char *)NULL
&& strcmp(section_name
,"COMMON") == 0)
2032 placed_commons
= true;
2034 new->section_name
= section_name
;
2035 new->filename
= filename
;
2036 lang_list_init(&new->children
);
2046 map_option_f
= true;
2053 void lang_add_fill(exp
)
2056 lang_fill_statement_type
*new = new_stat(lang_fill_statement
,
2061 void lang_add_data(type
, exp
)
2063 union etree_union
*exp
;
2066 lang_data_statement_type
*new = new_stat(lang_data_statement
,
2073 lang_add_assignment(exp
)
2076 lang_assignment_statement_type
*new = new_stat(lang_assignment_statement
,
2082 lang_add_attribute(attribute
)
2083 enum statement_enum attribute
;
2085 new_statement(attribute
, sizeof(lang_statement_union_type
),stat_ptr
);
2094 if (startup_file
!= (char *)NULL
) {
2095 info("%P%FMultiple STARTUP files\n");
2097 first_file
->filename
= name
;
2098 first_file
->local_sym_name
= name
;
2106 lang_float_flag
= maybe
;
2110 lang_leave_output_section_statement(fill
, memspec
)
2114 current_section
->fill
= fill
;
2115 current_section
->region
= lang_memory_region_lookup(memspec
);
2116 stat_ptr
= &statement_list
;
2119 Create an absolute symbol with the given name with the value of the
2120 address of first byte of the section named.
2122 If the symbol already exists, then do nothing.
2125 lang_abs_symbol_at_beginning_of(section
, name
)
2129 if (ldsym_undefined(name
)) {
2130 extern bfd
*output_bfd
;
2131 extern asymbol
*create_symbol();
2132 asection
*s
= bfd_get_section_by_name(output_bfd
, section
);
2133 asymbol
*def
= create_symbol(name
,
2134 BSF_GLOBAL
| BSF_EXPORT
|
2137 if (s
!= (asection
*)NULL
) {
2138 def
->value
= s
->vma
;
2147 Create an absolute symbol with the given name with the value of the
2148 address of the first byte after the end of the section named.
2150 If the symbol already exists, then do nothing.
2153 lang_abs_symbol_at_end_of(section
, name
)
2157 if (ldsym_undefined(name
)){
2158 extern bfd
*output_bfd
;
2159 extern asymbol
*create_symbol();
2160 asection
*s
= bfd_get_section_by_name(output_bfd
, section
);
2161 /* Add a symbol called _end */
2162 asymbol
*def
= create_symbol(name
,
2163 BSF_GLOBAL
| BSF_EXPORT
|
2166 if (s
!= (asection
*)NULL
) {
2167 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
);