From 3cdae74b42557dfa11d0dfd0c3c59451441ebcbc Mon Sep 17 00:00:00 2001 From: espie Date: Wed, 12 May 1999 15:12:03 +0000 Subject: [PATCH] Necessary stuff for the use_collect2 alternative to handle shared library ctors. --- .../patches/patch-core-dynlib-ctors | 65 +++++++++++++++++++ .../snapshot/patches/patch-core-dynlib-ctors | 65 +++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 lang/egcs-snapshot/patches/patch-core-dynlib-ctors create mode 100644 lang/egcs/snapshot/patches/patch-core-dynlib-ctors diff --git a/lang/egcs-snapshot/patches/patch-core-dynlib-ctors b/lang/egcs-snapshot/patches/patch-core-dynlib-ctors new file mode 100644 index 00000000000..ae05e7ea7fd --- /dev/null +++ b/lang/egcs-snapshot/patches/patch-core-dynlib-ctors @@ -0,0 +1,65 @@ +Wed May 12 16:51:50 CEST 1999 Niklas Hallqvist + Marc Espie + * collect2.c (scan_prog_file): Add COLLECT_SHARED_LIB_CTORS_DTORS + capability. + * tm.texi: Document COLLECT_SHARED_LIB_CTORS_DTORS. + * config/openbsd.h: Support for scanning shared libraries for + cdtors. + +--- gcc/collect2.c.orig Sat Apr 10 06:27:03 1999 ++++ gcc/collect2.c Wed May 12 16:38:29 1999 +@@ -2344,12 +2344,16 @@ scan_prog_file (prog_name, which_pass) + switch (is_ctor_dtor (name)) + { + case 1: ++#ifndef COLLECT_SHARED_LIB_CTORS_DTORS + if (which_pass != PASS_LIB) ++#endif + add_to_list (&constructors, name); + break; + + case 2: ++#ifndef COLLECT_SHARED_LIB_CTORS_DTORS + if (which_pass != PASS_LIB) ++#endif + add_to_list (&destructors, name); + break; + +--- gcc/config/openbsd.h.orig Mon Mar 8 21:40:03 1999 ++++ gcc/config/openbsd.h Wed May 12 16:50:37 1999 +@@ -287,6 +287,21 @@ + fputc ('\n', FILE); } while(0) + #endif + ++/* Assembler format: macros for initialization. */ ++ ++/* If we use collect2 we want it to scan the linked shared libraries too. */ ++#define COLLECT_SHARED_LIB_CTORS_DTORS ++#define LDD_SUFFIX "ldd" ++#define PARSE_LDD_OUTPUT(PTR) \ ++do { \ ++ char mark[] = " => "; \ ++ const int len = sizeof(mark)-1; \ ++ while (*PTR && strncmp (PTR, mark, len) != 0) PTR++; \ ++ if (*PTR) \ ++ PTR += len; \ ++ else \ ++ PTR = 0; \ ++} while (0) + + /* Storage layout. */ + +--- gcc/tm.texi.orig Wed May 12 16:40:15 1999 ++++ gcc/tm.texi Wed May 12 16:47:00 1999 +@@ -6067,6 +6067,11 @@ + code must advance @var{PTR} to the beginning of the filename on that + line. Otherwise, it must set @var{PTR} to @code{NULL}. + ++@findex COLLECT_SHARED_LIB_CTORS_DTORS ++@item COLLECT_SHARED_LIB_CTORS_DTORS ++Define this macro if @code{collect2} needs to scan libraries for ++constructors and destructors as well. Currently, this macro only affects ++@code{OBJECT_FORMAT_NONE} behavior. + @end table + + @node Instruction Output diff --git a/lang/egcs/snapshot/patches/patch-core-dynlib-ctors b/lang/egcs/snapshot/patches/patch-core-dynlib-ctors new file mode 100644 index 00000000000..ae05e7ea7fd --- /dev/null +++ b/lang/egcs/snapshot/patches/patch-core-dynlib-ctors @@ -0,0 +1,65 @@ +Wed May 12 16:51:50 CEST 1999 Niklas Hallqvist + Marc Espie + * collect2.c (scan_prog_file): Add COLLECT_SHARED_LIB_CTORS_DTORS + capability. + * tm.texi: Document COLLECT_SHARED_LIB_CTORS_DTORS. + * config/openbsd.h: Support for scanning shared libraries for + cdtors. + +--- gcc/collect2.c.orig Sat Apr 10 06:27:03 1999 ++++ gcc/collect2.c Wed May 12 16:38:29 1999 +@@ -2344,12 +2344,16 @@ scan_prog_file (prog_name, which_pass) + switch (is_ctor_dtor (name)) + { + case 1: ++#ifndef COLLECT_SHARED_LIB_CTORS_DTORS + if (which_pass != PASS_LIB) ++#endif + add_to_list (&constructors, name); + break; + + case 2: ++#ifndef COLLECT_SHARED_LIB_CTORS_DTORS + if (which_pass != PASS_LIB) ++#endif + add_to_list (&destructors, name); + break; + +--- gcc/config/openbsd.h.orig Mon Mar 8 21:40:03 1999 ++++ gcc/config/openbsd.h Wed May 12 16:50:37 1999 +@@ -287,6 +287,21 @@ + fputc ('\n', FILE); } while(0) + #endif + ++/* Assembler format: macros for initialization. */ ++ ++/* If we use collect2 we want it to scan the linked shared libraries too. */ ++#define COLLECT_SHARED_LIB_CTORS_DTORS ++#define LDD_SUFFIX "ldd" ++#define PARSE_LDD_OUTPUT(PTR) \ ++do { \ ++ char mark[] = " => "; \ ++ const int len = sizeof(mark)-1; \ ++ while (*PTR && strncmp (PTR, mark, len) != 0) PTR++; \ ++ if (*PTR) \ ++ PTR += len; \ ++ else \ ++ PTR = 0; \ ++} while (0) + + /* Storage layout. */ + +--- gcc/tm.texi.orig Wed May 12 16:40:15 1999 ++++ gcc/tm.texi Wed May 12 16:47:00 1999 +@@ -6067,6 +6067,11 @@ + code must advance @var{PTR} to the beginning of the filename on that + line. Otherwise, it must set @var{PTR} to @code{NULL}. + ++@findex COLLECT_SHARED_LIB_CTORS_DTORS ++@item COLLECT_SHARED_LIB_CTORS_DTORS ++Define this macro if @code{collect2} needs to scan libraries for ++constructors and destructors as well. Currently, this macro only affects ++@code{OBJECT_FORMAT_NONE} behavior. + @end table + + @node Instruction Output