This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
On Jun 19, 10:58am, H.J. Lu wrote: > Subject: Re: DT_SYMBOLIC and -Bsymbolic > > > > On Jun 19, 9:58am, H.J. Lu wrote: > > > Subject: DT_SYMBOLIC and -Bsymbolic > > > Hi, > > > > > > Do the current binutils snapshots and the Linux ELF dynamic > > > linker support DT_SYMBOLIC? It should be easy to add -Bsymbolic > > > to ld. The Linux ELF dynamic linker just needs to check the > > > presence of DT_SYMBOLIC in the shared library to control the > > > symbol binding. It is specified in the ELF doc, ELF.doc.tar.gz, > > > on tsx-11 and sunsite in the linux gcc directory OK, I have patches to add this. I basically assumed that all that we needed to do was to translate -Bsymbolic on the link line into DT_SYBMOLIC in the .dynamic section, and nothing more than that. I tested it with a small example, and it seemed to work. -Eric -- "The woods are lovely, dark and deep. But I have promises to keep, And lines to code before I sleep, And lines to code before I sleep."
--- ./bfd/elfcode.h.~1~ Tue May 2 23:43:07 1995
+++ ./bfd/elfcode.h Mon Jun 19 13:30:16 1995
@@ -5141,11 +5141,13 @@
boolean
NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
- export_dynamic, info, sinterpptr)
+ export_dynamic, symbolic,
+ info, sinterpptr)
bfd *output_bfd;
const char *soname;
const char *rpath;
boolean export_dynamic;
+ boolean symbolic;
struct bfd_link_info *info;
asection **sinterpptr;
{
@@ -5196,6 +5198,10 @@
|| ! elf_add_dynamic_entry (info, DT_SONAME, indx))
return false;
}
+
+ if (symbolic
+ && ! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
+ return false;
if (rpath != NULL)
{
--- ./bfd/bfd-in.h.~1~ Tue Feb 21 21:00:44 1995
+++ ./bfd/bfd-in.h Mon Jun 19 13:20:33 1995
@@ -551,7 +551,7 @@
extern boolean bfd_elf64_record_link_assignment
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_elf32_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, boolean,
+ PARAMS ((bfd *, const char *, const char *, boolean, boolean,
struct bfd_link_info *, struct sec **));
extern boolean bfd_elf64_size_dynamic_sections
PARAMS ((bfd *, const char *, const char *, boolean,
--- ./bfd/bfd-in2.h.~1~ Mon Apr 17 19:37:59 1995
+++ ./bfd/bfd-in2.h Mon Jun 19 13:29:36 1995
@@ -551,7 +551,7 @@
extern boolean bfd_elf64_record_link_assignment
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_elf32_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, boolean,
+ PARAMS ((bfd *, const char *, const char *, boolean, boolean,
struct bfd_link_info *, struct sec **));
extern boolean bfd_elf64_size_dynamic_sections
PARAMS ((bfd *, const char *, const char *, boolean,
--- ./ld/emultempl/elf32.em.~1~ Tue May 2 20:46:03 1995
+++ ./ld/emultempl/elf32.em Mon Jun 19 12:43:07 1995
@@ -256,6 +256,7 @@
command_line.soname,
command_line.rpath,
command_line.export_dynamic,
+ command_line.symbolic,
&link_info,
&sinterp))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
--- ./ld/lexsup.c.~1~ Tue May 2 23:43:14 1995
+++ ./ld/lexsup.c Mon Jun 19 12:40:30 1995
@@ -86,7 +86,8 @@
#define OPTION_SONAME (OPTION_SHARED + 1)
#define OPTION_SORT_COMMON (OPTION_SONAME + 1)
#define OPTION_STATS (OPTION_SORT_COMMON + 1)
-#define OPTION_TBSS (OPTION_STATS + 1)
+#define OPTION_SYMBOLIC (OPTION_STATS + 1)
+#define OPTION_TBSS (OPTION_SYMBOLIC + 1)
#define OPTION_TDATA (OPTION_TBSS + 1)
#define OPTION_TTEXT (OPTION_TDATA + 1)
#define OPTION_TRADITIONAL_FORMAT (OPTION_TTEXT + 1)
@@ -101,6 +102,7 @@
static struct option longopts[] = {
{"Bdynamic", no_argument, NULL, OPTION_CALL_SHARED},
{"Bstatic", no_argument, NULL, OPTION_NON_SHARED},
+ {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
{"call_shared", no_argument, NULL, OPTION_CALL_SHARED},
{"dc", no_argument, NULL, 'd'},
{"defsym", required_argument, NULL, OPTION_DEFSYM},
@@ -356,6 +358,9 @@
break;
case OPTION_STATS:
config.stats = true;
+ break;
+ case OPTION_SYMBOLIC:
+ command_line.symbolic = true;
break;
case 't':
trace_files = true;
--- ./ld/ld.h.~1~ Tue Feb 21 21:02:28 1995
+++ ./ld/ld.h Mon Jun 19 12:41:50 1995
@@ -69,6 +69,14 @@
/* If true, build MIPS embedded PIC relocation tables in the output
file. */
boolean embedded_relocs;
+
+ /*
+ * If true, we add a special dynamic entry in the output file telling
+ * the dynamic loader to search this file first, then other files
+ * for symbols.
+ */
+ boolean symbolic;
+
} args_type;
extern args_type command_line;
--- ./ld/ldmain.c.~1~ Fri Apr 14 00:12:18 1995
+++ ./ld/ldmain.c Mon Jun 19 16:18:44 1995
@@ -171,6 +171,7 @@
command_line.force_common_definition = false;
command_line.interpreter = NULL;
command_line.rpath = NULL;
+ command_line.symbolic = false;
link_info.callbacks = &link_callbacks;
link_info.relocateable = false;