@@ -2485,12 +2485,19 @@ lang_map (void)
24852485 config .map_file );
24862486}
24872487
2488+ static bool
2489+ is_defined (struct bfd_link_hash_entry * h )
2490+ {
2491+ return h != NULL
2492+ && (h -> type == bfd_link_hash_defined
2493+ || h -> type == bfd_link_hash_defweak );
2494+ }
2495+
24882496static bool
24892497sort_def_symbol (struct bfd_link_hash_entry * hash_entry ,
24902498 void * info ATTRIBUTE_UNUSED )
24912499{
2492- if ((hash_entry -> type == bfd_link_hash_defined
2493- || hash_entry -> type == bfd_link_hash_defweak )
2500+ if (is_defined (hash_entry )
24942501 && hash_entry -> u .def .section -> owner != link_info .output_bfd
24952502 && hash_entry -> u .def .section -> owner != NULL )
24962503 {
@@ -4184,9 +4191,7 @@ ldlang_check_require_defined_symbols (void)
41844191
41854192 h = bfd_link_hash_lookup (link_info .hash , ptr -> name ,
41864193 false, false, true);
4187- if (h == NULL
4188- || (h -> type != bfd_link_hash_defined
4189- && h -> type != bfd_link_hash_defweak ))
4194+ if (! is_defined (h ))
41904195 einfo (_ ("%X%P: required symbol `%s' not defined\n" ), ptr -> name );
41914196 }
41924197}
@@ -4892,9 +4897,7 @@ print_assignment (lang_assignment_statement_type *assignment,
48924897
48934898 h = bfd_link_hash_lookup (link_info .hash , assignment -> exp -> assign .dst ,
48944899 false, false, true);
4895- if (h != NULL
4896- && (h -> type == bfd_link_hash_defined
4897- || h -> type == bfd_link_hash_defweak ))
4900+ if (is_defined (h ))
48984901 {
48994902 value = h -> u .def .value ;
49004903 value += h -> u .def .section -> output_section -> vma ;
@@ -4939,8 +4942,7 @@ print_one_symbol (struct bfd_link_hash_entry *hash_entry, void *ptr)
49394942{
49404943 asection * sec = (asection * ) ptr ;
49414944
4942- if ((hash_entry -> type == bfd_link_hash_defined
4943- || hash_entry -> type == bfd_link_hash_defweak )
4945+ if (is_defined (hash_entry )
49444946 && sec == hash_entry -> u .def .section )
49454947 {
49464948 print_spaces (SECTION_NAME_MAP_LENGTH );
@@ -7234,9 +7236,7 @@ lang_end (void)
72347236 {
72357237 h = bfd_link_hash_lookup (link_info .hash , sym -> name ,
72367238 false, false, false);
7237- if (h != NULL
7238- && (h -> type == bfd_link_hash_defined
7239- || h -> type == bfd_link_hash_defweak )
7239+ if (is_defined (h )
72407240 && !bfd_is_const_section (h -> u .def .section ))
72417241 break ;
72427242 }
@@ -7255,9 +7255,11 @@ lang_end (void)
72557255
72567256 h = bfd_link_hash_lookup (link_info .hash , entry_symbol .name ,
72577257 false, false, true);
7258- if (h != NULL
7259- && (h -> type == bfd_link_hash_defined
7260- || h -> type == bfd_link_hash_defweak )
7258+
7259+ if (! is_defined (h ) || h -> u .def .section -> output_section == NULL )
7260+ h = ldemul_find_alt_start_symbol (& entry_symbol );
7261+
7262+ if (is_defined (h )
72617263 && h -> u .def .section -> output_section != NULL )
72627264 {
72637265 bfd_vma val ;
0 commit comments