Commit aaef9b06 by David Edelsohn Committed by David Edelsohn

collect2.c (main): Only export initfunc and finifunc if LD_INIT_SWITCH not defined.

        * 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.

From-SVN: r79031
parent 7a9a5a44
2004-03-06 David Edelsohn <edelsohn@gnu.org>
* 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.
2004-03-06 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2004-03-06 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa.md (icacheflush): Reorder operands to make match_scratch operand * pa.md (icacheflush): Reorder operands to make match_scratch operand
......
...@@ -1398,10 +1398,12 @@ main (int argc, char **argv) ...@@ -1398,10 +1398,12 @@ main (int argc, char **argv)
if (! exports.first) if (! exports.first)
*ld2++ = concat ("-bE:", export_file, NULL); *ld2++ = concat ("-bE:", export_file, NULL);
#ifndef LD_INIT_SWITCH
add_to_list (&exports, initname); add_to_list (&exports, initname);
add_to_list (&exports, fininame); add_to_list (&exports, fininame);
add_to_list (&exports, "_GLOBAL__DI"); add_to_list (&exports, "_GLOBAL__DI");
add_to_list (&exports, "_GLOBAL__DD"); add_to_list (&exports, "_GLOBAL__DD");
#endif
exportf = fopen (export_file, "w"); exportf = fopen (export_file, "w");
if (exportf == (FILE *) 0) if (exportf == (FILE *) 0)
fatal_perror ("fopen %s", export_file); fatal_perror ("fopen %s", export_file);
...@@ -2719,7 +2721,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass) ...@@ -2719,7 +2721,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
case 1: case 1:
if (! is_shared) if (! is_shared)
add_to_list (&constructors, name); add_to_list (&constructors, name);
#ifdef COLLECT_EXPORT_LIST #if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
if (which_pass == PASS_OBJ) if (which_pass == PASS_OBJ)
add_to_list (&exports, name); add_to_list (&exports, name);
#endif #endif
...@@ -2728,7 +2730,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass) ...@@ -2728,7 +2730,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
case 2: case 2:
if (! is_shared) if (! is_shared)
add_to_list (&destructors, name); add_to_list (&destructors, name);
#ifdef COLLECT_EXPORT_LIST #if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
if (which_pass == PASS_OBJ) if (which_pass == PASS_OBJ)
add_to_list (&exports, name); add_to_list (&exports, name);
#endif #endif
...@@ -2753,7 +2755,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass) ...@@ -2753,7 +2755,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
case 5: case 5:
if (! is_shared) if (! is_shared)
add_to_list (&frame_tables, name); add_to_list (&frame_tables, name);
#ifdef COLLECT_EXPORT_LIST #if defined (COLLECT_EXPORT_LIST) && !defined (LD_INIT_SWITCH)
if (which_pass == PASS_OBJ) if (which_pass == PASS_OBJ)
add_to_list (&exports, name); add_to_list (&exports, name);
#endif #endif
...@@ -2761,13 +2763,14 @@ scan_prog_file (const char *prog_name, enum pass which_pass) ...@@ -2761,13 +2763,14 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
default: /* not a constructor or destructor */ default: /* not a constructor or destructor */
#ifdef COLLECT_EXPORT_LIST #ifdef COLLECT_EXPORT_LIST
/* If we are building a shared object on AIX we need /* Explicitly export all global symbols when
to explicitly export all global symbols. */ building a shared object on AIX, but do not
if (shared_obj) re-export symbols from another shared object
{ and do not export symbols if the user
if (which_pass == PASS_OBJ && (! export_flag)) provides an explicit export list. */
if (shared_obj && !is_shared
&& which_pass == PASS_OBJ && !export_flag)
add_to_list (&exports, name); add_to_list (&exports, name);
}
#endif #endif
continue; continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment