* 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>
|
||||
|
||||
* 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
|
||||
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.
|
||||
|
||||
This file is part of GLD, the Gnu Linker.
|
||||
|
@ -56,13 +56,20 @@
|
|||
discarded. */
|
||||
#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
|
||||
winds up in ldgram.h, so we need to define it outside. */
|
||||
|
||||
struct wildcard_spec
|
||||
{
|
||||
const char *name;
|
||||
const char *exclude_name;
|
||||
struct name_list *exclude_name_list;
|
||||
boolean sorted;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ END-INFO-DIR-ENTRY
|
|||
@ifinfo
|
||||
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
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
@ -2235,13 +2235,15 @@ include all input @samp{.text} sections, you would write:
|
|||
*(.text)
|
||||
@end smallexample
|
||||
@noindent
|
||||
Here the @samp{*} is a wildcard which matches any file name. To exclude a file
|
||||
from matching the file name wildcard, EXCLUDE_FILE may be used to match all files
|
||||
except the one specified by EXCLUDE_FILE. For example:
|
||||
Here the @samp{*} is a wildcard which matches any file name. To exclude a list
|
||||
of files from matching the file name wildcard, EXCLUDE_FILE may be used to
|
||||
match all files except the ones specified in the EXCLUDE_FILE list. For
|
||||
example:
|
||||
@smallexample
|
||||
(*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
(*(EXCLUDE_FILE (*crtend.o, *otherfile.o) .ctors))
|
||||
@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:
|
||||
@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.
|
||||
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.
|
||||
Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
|
||||
|
||||
|
@ -70,6 +70,7 @@ static int error_index;
|
|||
char *name;
|
||||
const char *cname;
|
||||
struct wildcard_spec wildcard;
|
||||
struct name_list *name_list;
|
||||
int token;
|
||||
union etree_union *etree;
|
||||
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> opt_exp_without_type
|
||||
%type <integer> fill_opt
|
||||
%type <name_list> exclude_name_list
|
||||
%type <name> memspec_opt casesymlist
|
||||
%type <cname> wildcard_name
|
||||
%type <wildcard> wildcard_spec
|
||||
|
@ -392,43 +394,64 @@ wildcard_spec:
|
|||
{
|
||||
$$.name = $1;
|
||||
$$.sorted = false;
|
||||
$$.exclude_name = NULL;
|
||||
$$.exclude_name_list = NULL;
|
||||
}
|
||||
| EXCLUDE_FILE '(' wildcard_name ')' wildcard_name
|
||||
| EXCLUDE_FILE '(' exclude_name_list ')' wildcard_name
|
||||
{
|
||||
$$.name = $5;
|
||||
$$.sorted = false;
|
||||
$$.exclude_name = $3;
|
||||
$$.exclude_name_list = $3;
|
||||
}
|
||||
| SORT '(' wildcard_name ')'
|
||||
{
|
||||
$$.name = $3;
|
||||
$$.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;
|
||||
$$.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:
|
||||
wildcard_spec
|
||||
{
|
||||
lang_add_wild ($1.name, $1.sorted,
|
||||
current_file.name,
|
||||
current_file.sorted,
|
||||
ldgram_had_keep, $1.exclude_name);
|
||||
ldgram_had_keep, $1.exclude_name_list);
|
||||
}
|
||||
| file_NAME_list opt_comma wildcard_spec
|
||||
{
|
||||
lang_add_wild ($3.name, $3.sorted,
|
||||
current_file.name,
|
||||
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.
|
||||
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.
|
||||
|
||||
This file is part of GLD, the Gnu Linker.
|
||||
|
@ -213,17 +213,21 @@ walk_wild_section (ptr, section, file, callback, data)
|
|||
void *data;
|
||||
{
|
||||
/* 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))
|
||||
match = fnmatch (ptr->exclude_filename, file->filename, 0) == 0 ? true : false;
|
||||
else
|
||||
match = strcmp (ptr->exclude_filename, file->filename) == 0 ? true : false;
|
||||
if (wildcardp (list_tmp->name))
|
||||
match = fnmatch (list_tmp->name, file->filename, 0) == 0 ? true : false;
|
||||
else
|
||||
match = strcmp (list_tmp->name, file->filename) == 0 ? true : false;
|
||||
|
||||
if (match)
|
||||
return;
|
||||
if (match)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (file->just_syms_flag == false)
|
||||
|
@ -2360,9 +2364,15 @@ print_wild_statement (w, os)
|
|||
|
||||
if (w->filenames_sorted)
|
||||
minfo ("SORT(");
|
||||
if (w->exclude_filename != NULL)
|
||||
minfo ("EXCLUDE_FILE ( %s )", w->exclude_filename);
|
||||
if (w->filename != NULL)
|
||||
if (w->exclude_filename_list != 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);
|
||||
else
|
||||
minfo ("*");
|
||||
|
@ -4029,13 +4039,13 @@ lang_process ()
|
|||
|
||||
void
|
||||
lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
|
||||
keep_sections, exclude_filename)
|
||||
keep_sections, exclude_filename_list)
|
||||
const char *const section_name;
|
||||
boolean sections_sorted;
|
||||
const char *const filename;
|
||||
boolean filenames_sorted;
|
||||
boolean keep_sections;
|
||||
const char *exclude_filename;
|
||||
struct name_list *exclude_filename_list;
|
||||
{
|
||||
lang_wild_statement_type *new = new_stat (lang_wild_statement,
|
||||
stat_ptr);
|
||||
|
@ -4053,7 +4063,7 @@ lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
|
|||
new->filename = filename;
|
||||
new->filenames_sorted = filenames_sorted;
|
||||
new->keep_sections = keep_sections;
|
||||
new->exclude_filename = exclude_filename;
|
||||
new->exclude_filename_list = exclude_filename_list;
|
||||
lang_list_init (&new->children);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* 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.
|
||||
|
||||
This file is part of GLD, the Gnu Linker.
|
||||
|
@ -283,7 +283,7 @@ typedef struct lang_wild_statement_struct
|
|||
const char *filename;
|
||||
boolean filenames_sorted;
|
||||
boolean keep_sections;
|
||||
const char *exclude_filename;
|
||||
struct name_list *exclude_filename_list;
|
||||
lang_statement_list_type children;
|
||||
} 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_target PARAMS ((const char *));
|
||||
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_fill PARAMS ((int));
|
||||
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
|
||||
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 (*(.ctors))
|
||||
${CONSTRUCTING+${CTOR_END}}
|
||||
|
@ -77,7 +77,7 @@ DTOR=" .dtors ${CONSTRUCTING-0} :
|
|||
{
|
||||
${CONSTRUCTING+${DTOR_START}}
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
${CONSTRUCTING+${DTOR_END}}
|
||||
|
|
Loading…
Reference in New Issue