summaryrefslogtreecommitdiff
path: root/gcc/collect2.c
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-06 20:49:30 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-06 20:49:30 +0000
commitd3cef9f830cd99cd6587030f2cd1c885b07af70f (patch)
tree987b073666e53f5505a9113ffd957ec49bddccfe /gcc/collect2.c
parent053d819ac4466ba3c822f178cac06b7e5c5cd6cd (diff)
downloadgcc-d3cef9f830cd99cd6587030f2cd1c885b07af70f.tar.gz
* collect2.c (main): Only export initfunc and finifunc if
LD_INIT_SWITCH not defined. (scan_prog_file): Only export constructors and destructors if LD_INIT_SWITCH not defined. Only export symbols not found in shared objects. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79031 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r--gcc/collect2.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c
index c41a347435b..4fbe3a42003 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1398,10 +1398,12 @@ main (int argc, char **argv)
if (! exports.first)
*ld2++ = concat ("-bE:", export_file, NULL);
+#ifndef LD_INIT_SWITCH
add_to_list (&exports, initname);
add_to_list (&exports, fininame);
add_to_list (&exports, "_GLOBAL__DI");
add_to_list (&exports, "_GLOBAL__DD");
+#endif
exportf = fopen (export_file, "w");
if (exportf == (FILE *) 0)
fatal_perror ("fopen %s", export_file);
@@ -2719,7 +2721,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
case 1:
if (! is_shared)
add_to_list (&constructors, name);
-#ifdef COLLECT_EXPORT_LIST
+#if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
if (which_pass == PASS_OBJ)
add_to_list (&exports, name);
#endif
@@ -2728,7 +2730,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
case 2:
if (! is_shared)
add_to_list (&destructors, name);
-#ifdef COLLECT_EXPORT_LIST
+#if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
if (which_pass == PASS_OBJ)
add_to_list (&exports, name);
#endif
@@ -2753,7 +2755,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
case 5:
if (! is_shared)
add_to_list (&frame_tables, name);
-#ifdef COLLECT_EXPORT_LIST
+#if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
if (which_pass == PASS_OBJ)
add_to_list (&exports, name);
#endif
@@ -2761,13 +2763,14 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
default: /* not a constructor or destructor */
#ifdef COLLECT_EXPORT_LIST
- /* If we are building a shared object on AIX we need
- to explicitly export all global symbols. */
- if (shared_obj)
- {
- if (which_pass == PASS_OBJ && (! export_flag))
- add_to_list (&exports, name);
- }
+ /* Explicitly export all global symbols when
+ building a shared object on AIX, but do not
+ re-export symbols from another shared object
+ and do not export symbols if the user
+ provides an explicit export list. */
+ if (shared_obj && !is_shared
+ && which_pass == PASS_OBJ && !export_flag)
+ add_to_list (&exports, name);
#endif
continue;
}