Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
daefd78b
Commit
daefd78b
authored
May 16, 1995
by
Jason Merrill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update weak symbol support
From-SVN: r9697
parent
27a2e668
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
109 additions
and
64 deletions
+109
-64
gcc/c-decl.c
+1
-0
gcc/c-pragma.h
+4
-4
gcc/config/aoutos.h
+0
-15
gcc/config/i386/freebsd.h
+6
-1
gcc/config/i386/osfrose.h
+7
-2
gcc/config/m88k/m88k.h
+10
-5
gcc/config/netbsd.h
+7
-2
gcc/config/sparc/sunos4.h
+0
-15
gcc/config/svr4.h
+6
-1
gcc/defaults.h
+9
-0
gcc/libgcc2.c
+33
-4
gcc/tree.h
+5
-1
gcc/varasm.c
+21
-14
No files found.
gcc/c-decl.c
View file @
daefd78b
...
...
@@ -1791,6 +1791,7 @@ duplicate_decls (newdecl, olddecl)
}
/* Merge the storage class information. */
DECL_WEAK
(
newdecl
)
|=
DECL_WEAK
(
olddecl
);
/* For functions, static overrides non-static. */
if
(
TREE_CODE
(
newdecl
)
==
FUNCTION_DECL
)
{
...
...
gcc/c-pragma.h
View file @
daefd78b
...
...
@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Support #pragma weak
by default if WEAK_ASM_OP and ASM_OUTPUT_DEF
are
defined. */
#if
!defined (HANDLE_PRAGMA_WEAK) && defined (WEAK_ASM_OP
) && defined (ASM_OUTPUT_DEF)
#define HANDLE_PRAGMA_WEAK
1
/* Support #pragma weak
iff ASM_WEAKEN_LABEL and ASM_OUTPUT_DEF are
defined. */
#if
defined (ASM_WEAKEN_LABEL
) && defined (ASM_OUTPUT_DEF)
#define HANDLE_PRAGMA_WEAK
SUPPORTS_WEAK
#endif
enum
pragma_state
...
...
gcc/config/aoutos.h
View file @
daefd78b
...
...
@@ -85,18 +85,3 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
fputc ('\n', FILE); \
} \
} while (0)
/* If we're using GNU as and ld, we support weak symbols. */
#define HANDLE_PRAGMA_WEAK flag_gnu_linker
#define WEAK_ASM_OP ".weak"
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
do { if (flag_gnu_linker) \
{ \
fprintf ((FILE), "\t%s\t", ".set"); \
assemble_name (FILE, LABEL1); \
fprintf (FILE, ","); \
assemble_name (FILE, LABEL2); \
fprintf (FILE, "\n"); \
} \
} while (0)
gcc/config/i386/freebsd.h
View file @
daefd78b
...
...
@@ -118,7 +118,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define TYPE_ASM_OP ".type"
#define SIZE_ASM_OP ".size"
#define WEAK_ASM_OP ".weak"
/* This is how we tell the assembler that a symbol is weak. */
#define ASM_WEAKEN_LABEL(FILE,NAME) \
do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
fputc ('\n', FILE); } while (0)
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
...
...
gcc/config/i386/osfrose.h
View file @
daefd78b
...
...
@@ -94,7 +94,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Handle #pragma weak and #pragma pack. */
#define HANDLE_SYSV_PRAGMA
#define
HANDLE_PRAGMA
_WEAK TARGET_ELF
#define
SUPPORTS
_WEAK TARGET_ELF
/* Change default predefines. */
#undef CPP_PREDEFINES
...
...
@@ -617,9 +617,14 @@ while (0)
#define TYPE_ASM_OP ".type"
#define SIZE_ASM_OP ".size"
#define WEAK_ASM_OP ".weak"
#define SET_ASM_OP ".set"
/* This is how we tell the assembler that a symbol is weak. */
#define ASM_WEAKEN_LABEL(FILE,NAME) \
do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
fputc ('\n', FILE); } while (0)
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
expect various different forms for this operand. The one given here
...
...
gcc/config/m88k/m88k.h
View file @
daefd78b
...
...
@@ -198,13 +198,13 @@ extern char * reg_names[];
Redefined in sysv4.h, and luna.h. */
#define VERSION_INFO1 "88open OCS/BCS, "
#ifndef VERSION_INFO2
#define VERSION_INFO2 "$Revision: 1.
1.1.2.2.2
$"
#define VERSION_INFO2 "$Revision: 1.
63
$"
#endif
#ifndef VERSION_STRING
#define VERSION_STRING version_string
#ifdef __STDC__
#define TM_RCS_ID "@(#)" __FILE__ " $Revision: 1.
1.1.2.2.2
$ " __DATE__
#define TM_RCS_ID "@(#)" __FILE__ " $Revision: 1.
63
$ " __DATE__
#else
#define TM_RCS_ID "$What: <@(#) m88k.h,v 1.1.1.2.2.2> $"
#endif
/* __STDC__ */
...
...
@@ -1542,7 +1542,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
#define HANDLE_SYSV_PRAGMA
/* Tell when to handle #pragma weak. This is only done for V.4. */
#define
HANDLE_PRAGMA
_WEAK TARGET_SVR4
#define
SUPPORTS
_WEAK TARGET_SVR4
/* Max number of bytes we can move from memory to memory
in one reasonably fast instruction. */
...
...
@@ -1725,7 +1725,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
#undef FINI_SECTION_ASM_OP
#undef TYPE_ASM_OP
#undef SIZE_ASM_OP
#undef WEAK_ASM_OP
#undef SET_ASM_OP
#undef SKIP_ASM_OP
#undef COMMON_ASM_OP
...
...
@@ -1776,12 +1775,18 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
/* These are specific to PIC. */
#define TYPE_ASM_OP "type"
#define SIZE_ASM_OP "size"
#define WEAK_ASM_OP "weak"
#ifndef AS_BUG_POUND_TYPE
/* Faulty assemblers require @ rather than #. */
#undef TYPE_OPERAND_FMT
#define TYPE_OPERAND_FMT "#%s"
#endif
/* This is how we tell the assembler that a symbol is weak. */
#undef ASM_WEAKEN_LABEL
#define ASM_WEAKEN_LABEL(FILE,NAME) \
do { fputs ("\tweak\t", FILE); assemble_name (FILE, NAME); \
fputc ('\n', FILE); } while (0)
/* These are specific to version 03.00 assembler syntax. */
#define INTERNAL_ASM_OP "local"
#define VERSION_ASM_OP "version"
...
...
gcc/config/netbsd.h
View file @
daefd78b
...
...
@@ -82,10 +82,15 @@
#undef TYPE_ASM_OP
#undef SIZE_ASM_OP
#undef WEAK_ASM_OP
#define TYPE_ASM_OP ".type"
#define SIZE_ASM_OP ".size"
#define WEAK_ASM_OP ".weak"
/* This is how we tell the assembler that a symbol is weak. */
#undef ASM_WEAKEN_LABEL
#define ASM_WEAKEN_LABEL(FILE,NAME) \
do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
fputc ('\n', FILE); } while (0)
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
...
...
gcc/config/sparc/sunos4.h
View file @
daefd78b
...
...
@@ -20,18 +20,3 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define SUNOS4_SHARED_LIBRARIES 1
#include "sparc/sparc.h"
/* If we're using GNU as and ld, we support weak symbols. */
#define HANDLE_PRAGMA_WEAK flag_gnu_linker
#define WEAK_ASM_OP ".weak"
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
do { if (flag_gnu_linker) \
{ \
fprintf ((FILE), "\t%s\t", ".set"); \
assemble_name (FILE, LABEL1); \
fprintf (FILE, ","); \
assemble_name (FILE, LABEL2); \
fprintf (FILE, "\n"); \
} \
} while (0)
gcc/config/svr4.h
View file @
daefd78b
...
...
@@ -648,7 +648,12 @@ dtors_section () \
#define TYPE_ASM_OP ".type"
#define SIZE_ASM_OP ".size"
#define WEAK_ASM_OP ".weak"
/* This is how we tell the assembler that a symbol is weak. */
#define ASM_WEAKEN_LABEL(FILE,NAME) \
do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
fputc ('\n', FILE); } while (0)
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
...
...
gcc/defaults.h
View file @
daefd78b
...
...
@@ -131,3 +131,12 @@ do { fprintf (FILE, "\t%s\t", ASM_SHORT); \
} while (0)
#endif
#endif
/* This determines whether or not we support weak symbols. */
#ifndef SUPPORTS_WEAK
#ifdef ASM_WEAKEN_LABEL
#define SUPPORTS_WEAK 1
#else
#define SUPPORTS_WEAK 0
#endif
#endif
gcc/libgcc2.c
View file @
daefd78b
...
...
@@ -31,6 +31,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "tconfig.h"
#include "machmode.h"
#include "defaults.h"
#ifndef L_trampoline
#include <stddef.h>
#endif
...
...
@@ -40,6 +41,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef abort
#endif
#if (SUPPORTS_WEAK == 1) && defined (ASM_OUTPUT_DEF)
#define WEAK_ALIAS
#endif
/* Permit the tm.h file to select the endianness to use just for this
file. This is used when the endianness is determined when the
compiler is run. */
...
...
@@ -1606,9 +1611,15 @@ typedef void (*vfp)(void);
extern
vfp
__new_handler
;
extern
void
__default_new_handler
(
void
);
void
*
__builtin_new
(
size_t
sz
)
__attribute__
((
weak
));
#ifdef WEAK_ALIAS
void
*
__builtin_new
(
size_t
sz
)
__attribute__
((
weak
,
alias
(
"___builtin_new"
)));
void
*
___builtin_new
(
size_t
sz
)
#else
void
*
__builtin_new
(
size_t
sz
)
#endif
{
void
*
p
;
vfp
handler
=
(
__new_handler
)
?
__new_handler
:
__default_new_handler
;
...
...
@@ -1633,9 +1644,15 @@ __builtin_new (size_t sz)
extern
void
*
__builtin_new
(
size_t
);
void
*
__builtin_vec_new
(
size_t
sz
)
__attribute__
((
weak
));
#ifdef WEAK_ALIAS
void
*
__builtin_vec_new
(
size_t
sz
)
__attribute__
((
weak
,
alias
(
"___builtin_vec_new"
)));
void
*
___builtin_vec_new
(
size_t
sz
)
#else
void
*
__builtin_vec_new
(
size_t
sz
)
#endif
{
return
__builtin_new
(
sz
);
}
...
...
@@ -1696,9 +1713,15 @@ __default_new_handler ()
by C++ programs to return to the free store a block of memory allocated
as a single object. */
void
__builtin_delete
(
void
*
ptr
)
__attribute__
((
weak
));
#ifdef WEAK_ALIAS
void
__builtin_delete
(
void
*
ptr
)
__attribute__
((
weak
,
alias
(
"___builtin_delete"
)));
void
___builtin_delete
(
void
*
ptr
)
#else
void
__builtin_delete
(
void
*
ptr
)
#endif
{
if
(
ptr
)
free
(
ptr
);
...
...
@@ -1712,9 +1735,15 @@ __builtin_delete (void *ptr)
extern
void
__builtin_delete
(
void
*
);
void
__builtin_vec_delete
(
void
*
ptr
)
__attribute__
((
weak
));
#ifdef WEAK_ALIAS
void
__builtin_vec_delete
(
void
*
ptr
)
__attribute__
((
weak
,
alias
(
"___builtin_vec_delete"
)));
void
___builtin_vec_delete
(
void
*
ptr
)
#else
void
__builtin_vec_delete
(
void
*
ptr
)
#endif
{
__builtin_delete
(
ptr
);
}
...
...
gcc/tree.h
View file @
daefd78b
...
...
@@ -958,6 +958,9 @@ struct tree_type
/* Used to indicate that this DECL represents a compiler-generated entity. */
#define DECL_ARTIFICIAL(NODE) ((NODE)->decl.artificial_flag)
/* Used to indicate that this DECL has weak linkage. */
#define DECL_WEAK(NODE) ((NODE)->decl.weak_flag)
/* Additional flags for language-specific uses. */
#define DECL_LANG_FLAG_0(NODE) ((NODE)->decl.lang_flag_0)
#define DECL_LANG_FLAG_1(NODE) ((NODE)->decl.lang_flag_1)
...
...
@@ -997,7 +1000,8 @@ struct tree_decl
unsigned
static_ctor_flag
:
1
;
unsigned
static_dtor_flag
:
1
;
unsigned
artificial_flag
:
1
;
/* room for one more */
unsigned
weak_flag
:
1
;
/* room for no more */
unsigned
lang_flag_0
:
1
;
unsigned
lang_flag_1
:
1
;
...
...
gcc/varasm.c
View file @
daefd78b
...
...
@@ -802,6 +802,11 @@ assemble_start_function (decl, fnname)
{
if
(
!
first_global_object_name
)
STRIP_NAME_ENCODING
(
first_global_object_name
,
fnname
);
#ifdef ASM_WEAKEN_LABEL
if
(
DECL_WEAK
(
decl
))
ASM_WEAKEN_LABEL
(
asm_out_file
,
fnname
);
else
#endif
if
(
output_bytecode
)
BC_GLOBALIZE_LABEL
(
asm_out_file
,
fnname
);
else
...
...
@@ -1172,6 +1177,11 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
{
if
(
!
first_global_object_name
)
STRIP_NAME_ENCODING
(
first_global_object_name
,
name
);
#ifdef ASM_WEAKEN_LABEL
if
(
DECL_WEAK
(
decl
))
ASM_WEAKEN_LABEL
(
asm_out_file
,
name
);
else
#endif
ASM_GLOBALIZE_LABEL
(
asm_out_file
,
name
);
}
#if 0
...
...
@@ -3964,14 +3974,12 @@ void
declare_weak
(
decl
)
tree
decl
;
{
#ifdef HANDLE_PRAGMA_WEAK
if
(
!
TREE_PUBLIC
(
decl
))
error_with_decl
(
decl
,
"weak declaration of `%s' must be public"
);
else
handle_pragma_weak
(
ps_name
,
IDENTIFIER_POINTER
(
DECL_ASSEMBLER_NAME
(
decl
)),
NULL_PTR
);
#endif
else
if
(
TREE_ASM_WRITTEN
(
decl
))
error_with_decl
(
decl
,
"weak declaration of `%s' must precede definition"
);
else
if
(
SUPPORTS_WEAK
)
DECL_WEAK
(
decl
)
=
1
;
}
/* Emit any pending weak declarations. */
...
...
@@ -3985,14 +3993,7 @@ weak_finish ()
struct
weak_syms
*
t
;
for
(
t
=
weak_decls
;
t
;
t
=
t
->
next
)
{
fprintf
(
asm_out_file
,
"
\t
%s
\t
"
,
WEAK_ASM_OP
);
if
(
output_bytecode
)
BC_OUTPUT_LABELREF
(
asm_out_file
,
t
->
name
);
else
ASM_OUTPUT_LABELREF
(
asm_out_file
,
t
->
name
);
fputc
(
'\n'
,
asm_out_file
);
ASM_WEAKEN_LABEL
(
asm_out_file
,
t
->
name
);
if
(
t
->
value
)
ASM_OUTPUT_DEF
(
asm_out_file
,
t
->
name
,
t
->
value
);
}
...
...
@@ -4014,6 +4015,11 @@ assemble_alias (decl, target)
if
(
TREE_PUBLIC
(
decl
))
{
#ifdef ASM_WEAKEN_LABEL
if
(
DECL_WEAK
(
decl
))
ASM_WEAKEN_LABEL
(
asm_out_file
,
name
);
else
#endif
if
(
output_bytecode
)
BC_GLOBALIZE_LABEL
(
asm_out_file
,
name
);
else
...
...
@@ -4021,6 +4027,7 @@ assemble_alias (decl, target)
}
ASM_OUTPUT_DEF
(
asm_out_file
,
name
,
IDENTIFIER_POINTER
(
target
));
TREE_ASM_WRITTEN
(
decl
)
=
1
;
#else
warning
(
"alias definitions not supported in this configuration"
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment