We need to be careful in how we match section names because of the support
for wildcard characters. For example suppose that the user has invoked
objcopy like this:
-
+
--set-section-flags .debug_*=debug
--set-section-flags .debug_str=readonly,debug
--change-section-address .debug_*ranges=0x1000
struct section_list *p;
/* assert ((context & ((1 << 7) - 1)) != 0); */
-
+
for (p = change_sections; p != NULL; p = p->next)
{
if (add)
if (! fnmatch (slot_name, d->name, 0))
{
d->found = TRUE;
- /* Stop traversal. */
- return 0;
+ /* Continue traversal, there might be a non-match rule. */
+ return 1;
}
}
else
{
- if (fnmatch (slot_name + 1, d->name, 0))
+ if (! fnmatch (slot_name + 1, d->name, 0))
{
- d->found = TRUE;
+ d->found = FALSE;
/* Stop traversal. */
return 0;
}
_("can't dump section - it has no contents"));
continue;
}
-
+
bfd_size_type size = bfd_get_section_size (sec);
if (size == 0)
{
free (contents);
}
}
-
+
if (gnu_debuglink_filename != NULL)
{
/* PR 15125: Give a helpful warning message if
dump_sections = init_section_add (optarg, dump_sections,
"--dump-section");
break;
-
+
case OPTION_CHANGE_START:
change_start = parse_vma (optarg, "--change-start");
break;