glibc 2.1 and gabi
H . J . Lu
hjl@lucon.org
Thu Jul 20 13:55:00 GMT 2000
On Thu, Jul 20, 2000 at 01:17:51PM -0700, Nick Clifton wrote:
> Hi H.J.
>
> : How about just
> :
> : --disable-new-dynamic-tags
> : --enable-new-dynamic-tags
>
> Sure :-)
>
Here is the patch. I changed them to
--disable-new-dtags
--enable-new-dtags
H.J.
---
2000-07-20 H.J. Lu <hjl@gnu.org>
* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set
DT_RUNPATH and DT_FLAGS only if info->new_dtags is true.
* bfdlink.h (bfd_link_info): Add new_dtags.
* ld/ld.texinfo: Add documentation for --disable-new-dtags and
--enable-new-dtags.
* ldmain.c (main): Initialize link_info.new_dtags to false.
* emultempl/elf32.em (gld_${EMULATION_NAME}_parse_args): Add
--disable-new-dtags and --enable-new-dtags.
(gld_${EMULATION_NAME}_list_options): Likewise.
Index: bfd/elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.35
diff -u -p -r1.35 elflink.h
--- bfd/elflink.h 2000/07/20 03:58:11 1.35
+++ bfd/elflink.h 2000/07/20 20:37:48
@@ -2848,7 +2848,8 @@ NAME(bfd_elf,size_dynamic_sections) (out
true, true);
if (indx == (bfd_size_type) -1
|| ! elf_add_dynamic_entry (info, DT_RPATH, indx)
- || ! elf_add_dynamic_entry (info, DT_RUNPATH, indx))
+ || (info->new_dtags
+ && ! elf_add_dynamic_entry (info, DT_RUNPATH, indx)))
return false;
}
@@ -3137,7 +3138,7 @@ NAME(bfd_elf,size_dynamic_sections) (out
elf_tdata (output_bfd)->cverdefs = cdefs;
}
- if (info->flags)
+ if (info->new_dtags && info->flags)
{
if (! elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
return false;
Index: include/bfdlink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/include/bfdlink.h,v
retrieving revision 1.8
diff -u -p -r1.8 bfdlink.h
--- include/bfdlink.h 2000/07/20 03:58:20 1.8
+++ include/bfdlink.h 2000/07/20 19:57:10
@@ -247,6 +247,9 @@ struct bfd_link_info
unloaded. */
const char *fini_function;
+ /* true if the new ELF dynamic tags are enabled. */
+ boolean new_dtags;
+
/* May be used to set DT_FLAGS for ELF. */
bfd_vma flags;
Index: ld/ld.texinfo
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/ld.texinfo,v
retrieving revision 1.5
diff -u -p -r1.5 ld.texinfo
--- ld/ld.texinfo 2000/07/20 04:07:46 1.5
+++ ld/ld.texinfo 2000/07/20 20:52:15
@@ -1368,6 +1368,17 @@ you should not put the definition of @co
file as @code{__wrap_malloc}; if you do, the assembler may resolve the
call before the linker has a chance to wrap it to @code{malloc}.
+@kindex --enable-new-dtags
+@kindex --disable-new-dtags
+@item --enable-new-dtags
+@itemx --disable-new-dtags
+This linker can create the new dynamic tags in ELF. But the older ELF
+systems may not understand them. If you specify
+@code{--enable-new-dtags}, the dynamic tags will be created as needed.
+If you specify @code{--disable-new-dtags}, no new dynamic tags will be
+created. By default, the new dynamic tags are not created. Note that
+those options are only available for ELF systems.
+
@end table
@subsection Options specific to i386 PE targets
Index: ld/ldmain.c
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/ldmain.c,v
retrieving revision 1.14
diff -u -p -r1.14 ldmain.c
--- ld/ldmain.c 2000/07/20 04:07:46 1.14
+++ ld/ldmain.c 2000/07/20 19:57:23
@@ -238,6 +238,7 @@ main (argc, argv)
and _fini symbols. We are compatible. */
link_info.init_function = "_init";
link_info.fini_function = "_fini";
+ link_info.new_dtags = false;
link_info.flags = (bfd_vma) 0;
link_info.flags_1 = (bfd_vma) 0;
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emultempl/elf32.em,v
retrieving revision 1.20
diff -u -p -r1.20 elf32.em
--- ld/emultempl/elf32.em 2000/07/20 18:47:49 1.20
+++ ld/emultempl/elf32.em 2000/07/20 20:34:43
@@ -1219,6 +1219,9 @@ cat >>e${EMULATION_NAME}.c <<EOF
#include "getopt.h"
+#define OPTION_DISABLE_NEW_DTAGS (400)
+#define OPTION_ENABLE_NEW_DTAGS (OPTION_DISABLE_NEW_DTAGS + 1)
+
static struct option longopts[] =
{
EOF
@@ -1226,7 +1229,8 @@ fi
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
cat >>e${EMULATION_NAME}.c <<EOF
- {NULL, required_argument, NULL, 'z'},
+ {"disable-new-dtags", no_argument, NULL, OPTION_DISABLE_NEW_DTAGS},
+ {"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS},
EOF
fi
@@ -1266,11 +1270,20 @@ gld_${EMULATION_NAME}_parse_args (argc,
xexit (1);
optind = prevoptind;
return 0;
+
EOF
fi
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
cat >>e${EMULATION_NAME}.c <<EOF
+ case OPTION_DISABLE_NEW_DTAGS:
+ link_info.new_dtags = false;
+ break;
+
+ case OPTION_ENABLE_NEW_DTAGS:
+ link_info.new_dtags = true;
+ break;
+
case 'z':
if (strcmp (optarg, "initfirst") == 0)
link_info.flags_1 |= (bfd_vma) DF_1_INITFIRST;
@@ -1297,7 +1310,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
link_info.flags_1 |= (bfd_vma) DF_1_ORIGIN;
}
/* What about the other Solaris -z options? FIXME. */
- break;
+ break;
EOF
fi
@@ -1323,6 +1336,8 @@ fi
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
cat >>e${EMULATION_NAME}.c <<EOF
+ fprintf (file, _(" --disable-new-dtags\tDisable new dynamic tags\n"));
+ fprintf (file, _(" --enable-new-dtags\tEnable new dynamic tags\n"));
fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at rutime\n"));
fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but execuable\n"));
fprintf (file, _(" -z loadfltr\t\tMark object requiring immediate process\n"));
More information about the Binutils
mailing list