diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2005-08-05 13:52:13 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2005-08-05 13:52:13 +0000 |
commit | 7af8e99880a8084cb4a18ad4d7f1f62cb440573e (patch) | |
tree | d35d1995000de059bbb0c4f01ac57b6e28e68911 /ld | |
parent | 9599dfb1f6cb3b03d685d8cb0a8829ee803dfa89 (diff) | |
download | gdb-7af8e99880a8084cb4a18ad4d7f1f62cb440573e.zip gdb-7af8e99880a8084cb4a18ad4d7f1f62cb440573e.tar.gz gdb-7af8e99880a8084cb4a18ad4d7f1f62cb440573e.tar.bz2 |
bfd/
2005-08-05 H.J. Lu <hongjiu.lu@intel.com>
* bfd.c (bfd_hide_symbol): New.
* bfd-in2.h: Regenerated.
ld/
2005-08-05 H.J. Lu <hongjiu.lu@intel.com>
* ld.texinfo: Document PROVIDE_HIDDEN.
* ldexp.c (exp_fold_tree_1): Hide a provided symbol if asked.
(exp_provide): Add and set hidden.
* ldexp.h (etree_type): Add hidden to assign.
* ldgram.y (PROVIDE_HIDDEN): New.
* ldlex.l (PROVIDE_HIDDEN): Likewise.
* scripttempl/elf.sc: Use PROVIDE_HIDDEN on array bound
symbols.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 15 | ||||
-rw-r--r-- | ld/ld.texinfo | 7 | ||||
-rw-r--r-- | ld/ldexp.c | 5 | ||||
-rw-r--r-- | ld/ldexp.h | 3 | ||||
-rw-r--r-- | ld/ldgram.y | 8 | ||||
-rw-r--r-- | ld/ldlex.l | 1 | ||||
-rw-r--r-- | ld/scripttempl/elf.sc | 12 |
7 files changed, 41 insertions, 10 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 51d8f67..5e76401 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,18 @@ +2005-08-05 H.J. Lu <hongjiu.lu@intel.com> + + * ld.texinfo: Document PROVIDE_HIDDEN. + + * ldexp.c (exp_fold_tree_1): Hide a provided symbol if asked. + (exp_provide): Add and set hidden. + + * ldexp.h (etree_type): Add hidden to assign. + + * ldgram.y (PROVIDE_HIDDEN): New. + * ldlex.l (PROVIDE_HIDDEN): Likewise. + + * scripttempl/elf.sc: Use PROVIDE_HIDDEN on array bound + symbols. + 2005-08-05 Alan Modra <amodra@bigpond.net.au> * emulparams/elf_x86_64.sh: Revert last change. diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 7e526a3..cada213 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -2779,6 +2779,7 @@ the symbol and place it into the symbol table with a global scope. @menu * Simple Assignments:: Simple Assignments * PROVIDE:: PROVIDE +* PROVIDE_HIDDEN:: PROVIDE_HIDDEN * Source Code Reference:: How to use a linker script defined symbol in source code @end menu @@ -2872,6 +2873,12 @@ underscore), the linker will silently use the definition in the program. If the program references @samp{etext} but does not define it, the linker will use the definition in the linker script. +@node PROVIDE_HIDDEN +@subsection PROVIDE_HIDDEN +@cindex PROVIDE_HIDDEN +Similar to @code{PROVIDE}. For ELF targeted ports, the symbol will be +hidden and won't be exported. + @node Source Code Reference @subsection Source Code Reference @@ -740,6 +740,8 @@ exp_fold_tree_1 (etree_type *tree) defined by some object. */ break; } + if (tree->assign.hidden) + bfd_hide_symbol (output_bfd, &link_info, h, TRUE); } exp_fold_tree_1 (tree->assign.src); @@ -884,7 +886,7 @@ exp_assop (int code, const char *dst, etree_type *src) /* Handle PROVIDE. */ etree_type * -exp_provide (const char *dst, etree_type *src) +exp_provide (const char *dst, etree_type *src, bfd_boolean hidden) { etree_type *n; @@ -893,6 +895,7 @@ exp_provide (const char *dst, etree_type *src) n->assign.type.node_class = etree_provide; n->assign.src = src; n->assign.dst = dst; + n->assign.hidden = hidden; return n; } @@ -63,6 +63,7 @@ typedef union etree_union { node_type type; const char *dst; union etree_union *src; + bfd_boolean hidden; } assign; struct { node_type type; @@ -165,7 +166,7 @@ etree_type *exp_nameop etree_type *exp_assop (int, const char *, etree_type *); etree_type *exp_provide - (const char *, etree_type *); + (const char *, etree_type *, bfd_boolean); etree_type *exp_assert (etree_type *, const char *); void exp_print_tree diff --git a/ld/ldgram.y b/ld/ldgram.y index 2d5b074..44896e1 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -142,7 +142,7 @@ static int error_index; %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS %token ORIGIN FILL %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS -%token ALIGNMOD AT SUBALIGN PROVIDE AS_NEEDED +%token ALIGNMOD AT SUBALIGN PROVIDE PROVIDE_HIDDEN AS_NEEDED %type <token> assign_op atype attributes_opt sect_constraint %type <name> filename %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K @@ -648,7 +648,11 @@ assignment: } | PROVIDE '(' NAME '=' mustbe_exp ')' { - lang_add_assignment (exp_provide ($3, $5)); + lang_add_assignment (exp_provide ($3, $5, FALSE)); + } + | PROVIDE_HIDDEN '(' NAME '=' mustbe_exp ')' + { + lang_add_assignment (exp_provide ($3, $5, TRUE)); } ; @@ -313,6 +313,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* <EXPRESSION,BOTH,SCRIPT>"AT" { RTOKEN(AT);} <EXPRESSION,BOTH,SCRIPT>"SUBALIGN" { RTOKEN(SUBALIGN);} <EXPRESSION,BOTH,SCRIPT>"PROVIDE" { RTOKEN(PROVIDE); } +<EXPRESSION,BOTH,SCRIPT>"PROVIDE_HIDDEN" { RTOKEN(PROVIDE_HIDDEN); } <EXPRESSION,BOTH,SCRIPT>"KEEP" { RTOKEN(KEEP); } <EXPRESSION,BOTH,SCRIPT>"EXCLUDE_FILE" { RTOKEN(EXCLUDE_FILE); } <MRI>"#".*\n? { ++ lineno; } diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 8140cca..2f5971e 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -379,21 +379,21 @@ cat <<EOF .preinit_array ${RELOCATING-0} : { - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_start = .);}} + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_start = .);}} KEEP (*(.preinit_array)) - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__preinit_array_end = .);}} + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__preinit_array_end = .);}} } .init_array ${RELOCATING-0} : { - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_start = .);}} + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_start = .);}} KEEP (*(.init_array)) - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__init_array_end = .);}} + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__init_array_end = .);}} } .fini_array ${RELOCATING-0} : { - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_start = .);}} + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_start = .);}} KEEP (*(.fini_array)) - ${RELOCATING+${CREATE_SHLIB-PROVIDE (__fini_array_end = .);}} + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (__fini_array_end = .);}} } ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}} ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}} |