* ld.h (wildcard_spec): Change exclude_name to exclude_name_list.
(name_list): New. * ld.texinfo (EXCLUDE_FILE): Update documentation. * ldgram.y (wildcard_spec): Support a list of excluded_files. (exclude_name_list): New. ldlang.c (walk_wild_section): Support list of excluded files. (print_wild_statement): Likewise. (lang_add_wild): Likewise. * ldlang.h (lang_wild_statement_type): Likewise. * scripttempl/elf.sc (OTHER_EXCLUDE_FILES): Support.
This commit is contained in:
parent
fda8e7c4e9
commit
18625d5459
13
ld/ChangeLog
13
ld/ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
Wed Jan 5 08:02:12 2000 Catherine Moore <clm@cygnus.com>
|
||||||
|
|
||||||
|
* ld.h (wildcard_spec): Change exclude_name to exclude_name_list.
|
||||||
|
(name_list): New.
|
||||||
|
* ld.texinfo (EXCLUDE_FILE): Update documentation.
|
||||||
|
* ldgram.y (wildcard_spec): Support a list of excluded_files.
|
||||||
|
(exclude_name_list): New.
|
||||||
|
ldlang.c (walk_wild_section): Support list of excluded files.
|
||||||
|
(print_wild_statement): Likewise.
|
||||||
|
(lang_add_wild): Likewise.
|
||||||
|
* ldlang.h (lang_wild_statement_type): Likewise.
|
||||||
|
* scripttempl/elf.sc (OTHER_EXCLUDE_FILES): Support.
|
||||||
|
|
||||||
2000-01-04 Mumit Khan <khan@xraylith.wisc.edu>
|
2000-01-04 Mumit Khan <khan@xraylith.wisc.edu>
|
||||||
|
|
||||||
* pe-dll.c (pe_dll_warn_dup_exports): New variable.
|
* pe-dll.c (pe_dll_warn_dup_exports): New variable.
|
||||||
|
|
11
ld/ld.h
11
ld/ld.h
|
@ -1,5 +1,5 @@
|
||||||
/* ld.h -- general linker header file
|
/* ld.h -- general linker header file
|
||||||
Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 1999
|
Copyright (C) 1991, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GLD, the Gnu Linker.
|
This file is part of GLD, the Gnu Linker.
|
||||||
|
@ -56,13 +56,20 @@
|
||||||
discarded. */
|
discarded. */
|
||||||
#define DISCARD_SECTION_NAME "/DISCARD/"
|
#define DISCARD_SECTION_NAME "/DISCARD/"
|
||||||
|
|
||||||
|
/* A file name list */
|
||||||
|
typedef struct name_list
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
struct name_list *next;
|
||||||
|
} name_list;
|
||||||
|
|
||||||
/* A wildcard specification. This is only used in ldgram.y, but it
|
/* A wildcard specification. This is only used in ldgram.y, but it
|
||||||
winds up in ldgram.h, so we need to define it outside. */
|
winds up in ldgram.h, so we need to define it outside. */
|
||||||
|
|
||||||
struct wildcard_spec
|
struct wildcard_spec
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *exclude_name;
|
struct name_list *exclude_name_list;
|
||||||
boolean sorted;
|
boolean sorted;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ END-INFO-DIR-ENTRY
|
||||||
@ifinfo
|
@ifinfo
|
||||||
This file documents the @sc{gnu} linker LD version @value{VERSION}.
|
This file documents the @sc{gnu} linker LD version @value{VERSION}.
|
||||||
|
|
||||||
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
|
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Permission is granted to make and distribute verbatim copies of
|
Permission is granted to make and distribute verbatim copies of
|
||||||
this manual provided the copyright notice and this permission notice
|
this manual provided the copyright notice and this permission notice
|
||||||
|
@ -2235,13 +2235,15 @@ include all input @samp{.text} sections, you would write:
|
||||||
*(.text)
|
*(.text)
|
||||||
@end smallexample
|
@end smallexample
|
||||||
@noindent
|
@noindent
|
||||||
Here the @samp{*} is a wildcard which matches any file name. To exclude a file
|
Here the @samp{*} is a wildcard which matches any file name. To exclude a list
|
||||||
from matching the file name wildcard, EXCLUDE_FILE may be used to match all files
|
of files from matching the file name wildcard, EXCLUDE_FILE may be used to
|
||||||
except the one specified by EXCLUDE_FILE. For example:
|
match all files except the ones specified in the EXCLUDE_FILE list. For
|
||||||
|
example:
|
||||||
@smallexample
|
@smallexample
|
||||||
(*(EXCLUDE_FILE (*crtend.o) .ctors))
|
(*(EXCLUDE_FILE (*crtend.o, *otherfile.o) .ctors))
|
||||||
@end smallexample
|
@end smallexample
|
||||||
will cause all .ctors sections from all files except crtend.o to be included.
|
will cause all .ctors sections from all files except crtend.o and otherfile.o
|
||||||
|
to be included.
|
||||||
|
|
||||||
There are two ways to include more than one section:
|
There are two ways to include more than one section:
|
||||||
@smallexample
|
@smallexample
|
||||||
|
|
41
ld/ldgram.y
41
ld/ldgram.y
|
@ -1,5 +1,5 @@
|
||||||
/* A YACC grammer to parse a superset of the AT&T linker scripting languaue.
|
/* A YACC grammer to parse a superset of the AT&T linker scripting languaue.
|
||||||
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
|
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
|
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ static int error_index;
|
||||||
char *name;
|
char *name;
|
||||||
const char *cname;
|
const char *cname;
|
||||||
struct wildcard_spec wildcard;
|
struct wildcard_spec wildcard;
|
||||||
|
struct name_list *name_list;
|
||||||
int token;
|
int token;
|
||||||
union etree_union *etree;
|
union etree_union *etree;
|
||||||
struct phdr_info
|
struct phdr_info
|
||||||
|
@ -89,6 +90,7 @@ static int error_index;
|
||||||
%type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
|
%type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
|
||||||
%type <etree> opt_exp_without_type
|
%type <etree> opt_exp_without_type
|
||||||
%type <integer> fill_opt
|
%type <integer> fill_opt
|
||||||
|
%type <name_list> exclude_name_list
|
||||||
%type <name> memspec_opt casesymlist
|
%type <name> memspec_opt casesymlist
|
||||||
%type <cname> wildcard_name
|
%type <cname> wildcard_name
|
||||||
%type <wildcard> wildcard_spec
|
%type <wildcard> wildcard_spec
|
||||||
|
@ -392,43 +394,64 @@ wildcard_spec:
|
||||||
{
|
{
|
||||||
$$.name = $1;
|
$$.name = $1;
|
||||||
$$.sorted = false;
|
$$.sorted = false;
|
||||||
$$.exclude_name = NULL;
|
$$.exclude_name_list = NULL;
|
||||||
}
|
}
|
||||||
| EXCLUDE_FILE '(' wildcard_name ')' wildcard_name
|
| EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name
|
||||||
{
|
{
|
||||||
$$.name = $5;
|
$$.name = $5;
|
||||||
$$.sorted = false;
|
$$.sorted = false;
|
||||||
$$.exclude_name = $3;
|
$$.exclude_name_list = $3;
|
||||||
}
|
}
|
||||||
| SORT '(' wildcard_name ')'
|
| SORT '(' wildcard_name ')'
|
||||||
{
|
{
|
||||||
$$.name = $3;
|
$$.name = $3;
|
||||||
$$.sorted = true;
|
$$.sorted = true;
|
||||||
$$.exclude_name = NULL;
|
$$.exclude_name_list = NULL;
|
||||||
}
|
}
|
||||||
| SORT '(' EXCLUDE_FILE '(' wildcard_name ')' wildcard_name ')'
|
| SORT '(' EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name ')'
|
||||||
{
|
{
|
||||||
$$.name = $7;
|
$$.name = $7;
|
||||||
$$.sorted = true;
|
$$.sorted = true;
|
||||||
$$.exclude_name = $5;
|
$$.exclude_name_list = $5;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exclude_name_list:
|
||||||
|
exclude_name_list ',' wildcard_name
|
||||||
|
{
|
||||||
|
struct name_list *tmp;
|
||||||
|
tmp = (struct name_list *) xmalloc (sizeof *tmp);
|
||||||
|
tmp->name = $3;
|
||||||
|
tmp->next = $1;
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
wildcard_name
|
||||||
|
{
|
||||||
|
struct name_list *tmp;
|
||||||
|
tmp = (struct name_list *) xmalloc (sizeof *tmp);
|
||||||
|
tmp->name = $1;
|
||||||
|
tmp->next = NULL;
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
file_NAME_list:
|
file_NAME_list:
|
||||||
wildcard_spec
|
wildcard_spec
|
||||||
{
|
{
|
||||||
lang_add_wild ($1.name, $1.sorted,
|
lang_add_wild ($1.name, $1.sorted,
|
||||||
current_file.name,
|
current_file.name,
|
||||||
current_file.sorted,
|
current_file.sorted,
|
||||||
ldgram_had_keep, $1.exclude_name);
|
ldgram_had_keep, $1.exclude_name_list);
|
||||||
}
|
}
|
||||||
| file_NAME_list opt_comma wildcard_spec
|
| file_NAME_list opt_comma wildcard_spec
|
||||||
{
|
{
|
||||||
lang_add_wild ($3.name, $3.sorted,
|
lang_add_wild ($3.name, $3.sorted,
|
||||||
current_file.name,
|
current_file.name,
|
||||||
current_file.sorted,
|
current_file.sorted,
|
||||||
ldgram_had_keep, $3.exclude_name);
|
ldgram_had_keep, $3.exclude_name_list);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
40
ld/ldlang.c
40
ld/ldlang.c
|
@ -1,5 +1,5 @@
|
||||||
/* Linker command language support.
|
/* Linker command language support.
|
||||||
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
|
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GLD, the Gnu Linker.
|
This file is part of GLD, the Gnu Linker.
|
||||||
|
@ -213,17 +213,21 @@ walk_wild_section (ptr, section, file, callback, data)
|
||||||
void *data;
|
void *data;
|
||||||
{
|
{
|
||||||
/* Don't process sections from files which were excluded. */
|
/* Don't process sections from files which were excluded. */
|
||||||
if (ptr->exclude_filename != NULL)
|
if (ptr->exclude_filename_list != NULL)
|
||||||
{
|
{
|
||||||
boolean match;
|
struct name_list *list_tmp;
|
||||||
|
for (list_tmp = ptr->exclude_filename_list; list_tmp; list_tmp = list_tmp->next)
|
||||||
|
{
|
||||||
|
boolean match;
|
||||||
|
|
||||||
if (wildcardp (ptr->exclude_filename))
|
if (wildcardp (list_tmp->name))
|
||||||
match = fnmatch (ptr->exclude_filename, file->filename, 0) == 0 ? true : false;
|
match = fnmatch (list_tmp->name, file->filename, 0) == 0 ? true : false;
|
||||||
else
|
else
|
||||||
match = strcmp (ptr->exclude_filename, file->filename) == 0 ? true : false;
|
match = strcmp (list_tmp->name, file->filename) == 0 ? true : false;
|
||||||
|
|
||||||
if (match)
|
if (match)
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->just_syms_flag == false)
|
if (file->just_syms_flag == false)
|
||||||
|
@ -2360,9 +2364,15 @@ print_wild_statement (w, os)
|
||||||
|
|
||||||
if (w->filenames_sorted)
|
if (w->filenames_sorted)
|
||||||
minfo ("SORT(");
|
minfo ("SORT(");
|
||||||
if (w->exclude_filename != NULL)
|
if (w->exclude_filename_list != NULL)
|
||||||
minfo ("EXCLUDE_FILE ( %s )", w->exclude_filename);
|
{
|
||||||
if (w->filename != NULL)
|
name_list *tmp;
|
||||||
|
minfo ("EXCLUDE_FILE ( %s", w->exclude_filename_list->name);
|
||||||
|
for (tmp=w->exclude_filename_list->next; tmp; tmp = tmp->next)
|
||||||
|
minfo (", %s", tmp->name);
|
||||||
|
minfo (")");
|
||||||
|
}
|
||||||
|
if (w->filename != NULL)
|
||||||
minfo ("%s", w->filename);
|
minfo ("%s", w->filename);
|
||||||
else
|
else
|
||||||
minfo ("*");
|
minfo ("*");
|
||||||
|
@ -4029,13 +4039,13 @@ lang_process ()
|
||||||
|
|
||||||
void
|
void
|
||||||
lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
|
lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
|
||||||
keep_sections, exclude_filename)
|
keep_sections, exclude_filename_list)
|
||||||
const char *const section_name;
|
const char *const section_name;
|
||||||
boolean sections_sorted;
|
boolean sections_sorted;
|
||||||
const char *const filename;
|
const char *const filename;
|
||||||
boolean filenames_sorted;
|
boolean filenames_sorted;
|
||||||
boolean keep_sections;
|
boolean keep_sections;
|
||||||
const char *exclude_filename;
|
struct name_list *exclude_filename_list;
|
||||||
{
|
{
|
||||||
lang_wild_statement_type *new = new_stat (lang_wild_statement,
|
lang_wild_statement_type *new = new_stat (lang_wild_statement,
|
||||||
stat_ptr);
|
stat_ptr);
|
||||||
|
@ -4053,7 +4063,7 @@ lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
|
||||||
new->filename = filename;
|
new->filename = filename;
|
||||||
new->filenames_sorted = filenames_sorted;
|
new->filenames_sorted = filenames_sorted;
|
||||||
new->keep_sections = keep_sections;
|
new->keep_sections = keep_sections;
|
||||||
new->exclude_filename = exclude_filename;
|
new->exclude_filename_list = exclude_filename_list;
|
||||||
lang_list_init (&new->children);
|
lang_list_init (&new->children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ldlang.h - linker command language support
|
/* ldlang.h - linker command language support
|
||||||
Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 1999
|
Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GLD, the Gnu Linker.
|
This file is part of GLD, the Gnu Linker.
|
||||||
|
@ -283,7 +283,7 @@ typedef struct lang_wild_statement_struct
|
||||||
const char *filename;
|
const char *filename;
|
||||||
boolean filenames_sorted;
|
boolean filenames_sorted;
|
||||||
boolean keep_sections;
|
boolean keep_sections;
|
||||||
const char *exclude_filename;
|
struct name_list *exclude_filename_list;
|
||||||
lang_statement_list_type children;
|
lang_statement_list_type children;
|
||||||
} lang_wild_statement_type;
|
} lang_wild_statement_type;
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ extern void lang_section_start PARAMS ((const char *, union etree_union *));
|
||||||
extern void lang_add_entry PARAMS ((const char *, boolean));
|
extern void lang_add_entry PARAMS ((const char *, boolean));
|
||||||
extern void lang_add_target PARAMS ((const char *));
|
extern void lang_add_target PARAMS ((const char *));
|
||||||
extern void lang_add_wild
|
extern void lang_add_wild
|
||||||
PARAMS ((const char *, boolean, const char *, boolean, boolean, const char *));
|
PARAMS ((const char *, boolean, const char *, boolean, boolean, name_list *));
|
||||||
extern void lang_add_map PARAMS ((const char *));
|
extern void lang_add_map PARAMS ((const char *));
|
||||||
extern void lang_add_fill PARAMS ((int));
|
extern void lang_add_fill PARAMS ((int));
|
||||||
extern lang_assignment_statement_type * lang_add_assignment PARAMS ((union etree_union *));
|
extern lang_assignment_statement_type * lang_add_assignment PARAMS ((union etree_union *));
|
||||||
|
|
|
@ -67,7 +67,7 @@ CTOR=".ctors ${CONSTRUCTING-0} :
|
||||||
The .ctor section from the crtend file contains the
|
The .ctor section from the crtend file contains the
|
||||||
end of ctors marker and it must be last */
|
end of ctors marker and it must be last */
|
||||||
|
|
||||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .ctors))
|
||||||
KEEP (*(SORT(.ctors.*)))
|
KEEP (*(SORT(.ctors.*)))
|
||||||
KEEP (*(.ctors))
|
KEEP (*(.ctors))
|
||||||
${CONSTRUCTING+${CTOR_END}}
|
${CONSTRUCTING+${CTOR_END}}
|
||||||
|
@ -77,7 +77,7 @@ DTOR=" .dtors ${CONSTRUCTING-0} :
|
||||||
{
|
{
|
||||||
${CONSTRUCTING+${DTOR_START}}
|
${CONSTRUCTING+${DTOR_START}}
|
||||||
KEEP (*crtbegin.o(.dtors))
|
KEEP (*crtbegin.o(.dtors))
|
||||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .dtors))
|
||||||
KEEP (*(SORT(.dtors.*)))
|
KEEP (*(SORT(.dtors.*)))
|
||||||
KEEP (*(.dtors))
|
KEEP (*(.dtors))
|
||||||
${CONSTRUCTING+${DTOR_END}}
|
${CONSTRUCTING+${DTOR_END}}
|
||||||
|
|
Loading…
Reference in New Issue