public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add --warn-shared-textrel option to ld
@ 2004-09-16 18:31 Jeff Baker
  2004-09-21 18:16 ` Jeff Baker
  2004-09-30 17:30 ` Nick Clifton
  0 siblings, 2 replies; 6+ messages in thread
From: Jeff Baker @ 2004-09-16 18:31 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

This patch was originally included in the QNX Mips support but I'm 
posting it on it's own so that the appropriate people might look at it.

[-- Attachment #2: qnx_shared_textrel.patch --]
[-- Type: text/plain, Size: 5090 bytes --]

2004-09-13  Jeff Baker  <jbaker@qnx.com>
	* elflink.c (_bfd_elf_add_dynamic_entry): Add code to
	warn if adding a DT_TEXTREL to a shared object and
	--warn-shared-textrel was specified.

2004-09-13  Jeff Baker  <jbaker@qnx.com>
	* bfdlink.h (bfd_link_info): Add boolean
	warn_shared_textrel.

2004-09-13  Jeff Baker  <jbaker@qnx.com>
	* lexsup.c: Handle --warn-shared-textrel option.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.101
diff -w -u -1 -0 -p -r1.101 elflink.c
--- bfd/elflink.c	7 Sep 2004 13:40:37 -0000	1.101
+++ bfd/elflink.c	13 Sep 2004 18:24:51 -0000
@@ -2644,20 +2644,25 @@ _bfd_elf_add_dynamic_entry (struct bfd_l
   const struct elf_backend_data *bed;
   asection *s;
   bfd_size_type newsize;
   bfd_byte *newcontents;
   Elf_Internal_Dyn dyn;
 
   hash_table = elf_hash_table (info);
   if (! is_elf_hash_table (hash_table))
     return FALSE;
 
+  if (info->warn_shared_textrel && info->shared && tag == DT_TEXTREL) {
+    (*_bfd_error_handler)
+      (_("warning: creating a DT_TEXTREL in a shared object."));
+  }
+  
   bed = get_elf_backend_data (hash_table->dynobj);
   s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
   BFD_ASSERT (s != NULL);
 
   newsize = s->size + bed->s->sizeof_dyn;
   newcontents = bfd_realloc (s->contents, newsize);
   if (newcontents == NULL)
     return FALSE;
 
   dyn.d_tag = tag;
Index: include/bfdlink.h
===================================================================
RCS file: /cvs/src/src/include/bfdlink.h,v
retrieving revision 1.45
diff -w -u -1 -0 -p -r1.45 bfdlink.h
--- include/bfdlink.h	13 Aug 2004 03:16:01 -0000	1.45
+++ include/bfdlink.h	13 Sep 2004 18:25:04 -0000
@@ -390,20 +390,23 @@ struct bfd_link_info
   unsigned int spare_dynamic_tags;
 
   /* May be used to set DT_FLAGS for ELF. */
   bfd_vma flags;
 
   /* May be used to set DT_FLAGS_1 for ELF. */
   bfd_vma flags_1;
 
   /* Start and end of RELRO region.  */
   bfd_vma relro_start, relro_end;
+
+  /* Warn if adding a DT_TEXTREL to a shared object.  */
+  bfd_boolean warn_shared_textrel;
 };
 
 /* This structures holds a set of callback functions.  These are
    called by the BFD linker routines.  The first argument to each
    callback function is the bfd_link_info structure being used.  Each
    function returns a boolean value.  If the function returns FALSE,
    then the BFD function which called it will return with a failure
    indication.  */
 
 struct bfd_link_callbacks
Index: ld/lexsup.c
===================================================================
RCS file: /cvs/src/src/ld/lexsup.c,v
retrieving revision 1.76
diff -w -u -1 -0 -p -r1.76 lexsup.c
--- ld/lexsup.c	19 Jul 2004 16:40:52 -0000	1.76
+++ ld/lexsup.c	13 Sep 2004 18:25:13 -0000
@@ -139,21 +139,22 @@ enum option_values
   OPTION_NOSTDLIB,
   OPTION_NO_OMAGIC,
   OPTION_STRIP_DISCARDED,
   OPTION_NO_STRIP_DISCARDED,
   OPTION_ACCEPT_UNKNOWN_INPUT_ARCH,
   OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH,
   OPTION_PIE,
   OPTION_UNRESOLVED_SYMBOLS,
   OPTION_WARN_UNRESOLVED_SYMBOLS,
   OPTION_ERROR_UNRESOLVED_SYMBOLS,
-  OPTION_REDUCE_MEMORY_OVERHEADS
+  OPTION_REDUCE_MEMORY_OVERHEADS,
+  OPTION_WARN_SHARED_TEXTREL
 };
 
 /* The long options.  This structure is used for both the option
    parsing and the help text.  */
 
 struct ld_option
 {
   /* The long option information.  */
   struct option opt;
   /* The short option with the same meaning ('\0' if none).  */
@@ -489,20 +490,23 @@ static const struct ld_option ld_options
 		   "\t\t\t\tfollowing dynamic libs"), TWO_DASHES },
   { {"no-add-needed", no_argument, NULL, OPTION_NO_ADD_NEEDED},
     '\0', NULL, N_("Do not set DT_NEEDED tags for DT_NEEDED entries\n"
 		   "\t\t\t\tin following dynamic libs"), TWO_DASHES },
   { {"as-needed", no_argument, NULL, OPTION_AS_NEEDED},
     '\0', NULL, N_("Only set DT_NEEDED for following dynamic libs if used"),
     TWO_DASHES },
   { {"no-as-needed", no_argument, NULL, OPTION_NO_AS_NEEDED},
     '\0', NULL, N_("Always set DT_NEEDED for following dynamic libs"),
     TWO_DASHES },
+  { {"warn-shared-textrel", no_argument, NULL, OPTION_WARN_SHARED_TEXTREL},
+      '\0', NULL, N_("Warn if shared object has DT_TEXTREL"),
+      TWO_DASHES },
   { {"wrap", required_argument, NULL, OPTION_WRAP},
     '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
 };
 
 #define OPTION_COUNT ARRAY_SIZE (ld_options)
 
 void
 parse_args (unsigned argc, char **argv)
 {
   unsigned i;
@@ -1209,20 +1213,23 @@ parse_args (unsigned argc, char **argv)
 	  break;
 	case OPTION_NO_ADD_NEEDED:
 	  add_needed = FALSE;
 	  break;
 	case OPTION_AS_NEEDED:
 	  as_needed = TRUE;
 	  break;
 	case OPTION_NO_AS_NEEDED:
 	  as_needed = FALSE;
 	  break;
+	case OPTION_WARN_SHARED_TEXTREL:
+	  link_info.warn_shared_textrel = TRUE;
+	  break;
 	case OPTION_WRAP:
 	  add_wrap (optarg);
 	  break;
 	case OPTION_DISCARD_NONE:
 	  link_info.discard = discard_none;
 	  break;
 	case 'X':
 	  link_info.discard = discard_l;
 	  break;
 	case 'x':

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add --warn-shared-textrel option to ld
  2004-09-16 18:31 [PATCH] Add --warn-shared-textrel option to ld Jeff Baker
@ 2004-09-21 18:16 ` Jeff Baker
  2004-09-30 17:30 ` Nick Clifton
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff Baker @ 2004-09-21 18:16 UTC (permalink / raw)
  To: jbaker; +Cc: binutils

Ping.

Jeff Baker wrote:
> This patch was originally included in the QNX Mips support but I'm 
> posting it on it's own so that the appropriate people might look at it.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 2004-09-13  Jeff Baker  <jbaker@qnx.com>
> 	* elflink.c (_bfd_elf_add_dynamic_entry): Add code to
> 	warn if adding a DT_TEXTREL to a shared object and
> 	--warn-shared-textrel was specified.
> 
> 2004-09-13  Jeff Baker  <jbaker@qnx.com>
> 	* bfdlink.h (bfd_link_info): Add boolean
> 	warn_shared_textrel.
> 
> 2004-09-13  Jeff Baker  <jbaker@qnx.com>
> 	* lexsup.c: Handle --warn-shared-textrel option.
> 
> Index: bfd/elflink.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elflink.c,v
> retrieving revision 1.101
> diff -w -u -1 -0 -p -r1.101 elflink.c
> --- bfd/elflink.c	7 Sep 2004 13:40:37 -0000	1.101
> +++ bfd/elflink.c	13 Sep 2004 18:24:51 -0000
> @@ -2644,20 +2644,25 @@ _bfd_elf_add_dynamic_entry (struct bfd_l
>    const struct elf_backend_data *bed;
>    asection *s;
>    bfd_size_type newsize;
>    bfd_byte *newcontents;
>    Elf_Internal_Dyn dyn;
>  
>    hash_table = elf_hash_table (info);
>    if (! is_elf_hash_table (hash_table))
>      return FALSE;
>  
> +  if (info->warn_shared_textrel && info->shared && tag == DT_TEXTREL) {
> +    (*_bfd_error_handler)
> +      (_("warning: creating a DT_TEXTREL in a shared object."));
> +  }
> +  
>    bed = get_elf_backend_data (hash_table->dynobj);
>    s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
>    BFD_ASSERT (s != NULL);
>  
>    newsize = s->size + bed->s->sizeof_dyn;
>    newcontents = bfd_realloc (s->contents, newsize);
>    if (newcontents == NULL)
>      return FALSE;
>  
>    dyn.d_tag = tag;
> Index: include/bfdlink.h
> ===================================================================
> RCS file: /cvs/src/src/include/bfdlink.h,v
> retrieving revision 1.45
> diff -w -u -1 -0 -p -r1.45 bfdlink.h
> --- include/bfdlink.h	13 Aug 2004 03:16:01 -0000	1.45
> +++ include/bfdlink.h	13 Sep 2004 18:25:04 -0000
> @@ -390,20 +390,23 @@ struct bfd_link_info
>    unsigned int spare_dynamic_tags;
>  
>    /* May be used to set DT_FLAGS for ELF. */
>    bfd_vma flags;
>  
>    /* May be used to set DT_FLAGS_1 for ELF. */
>    bfd_vma flags_1;
>  
>    /* Start and end of RELRO region.  */
>    bfd_vma relro_start, relro_end;
> +
> +  /* Warn if adding a DT_TEXTREL to a shared object.  */
> +  bfd_boolean warn_shared_textrel;
>  };
>  
>  /* This structures holds a set of callback functions.  These are
>     called by the BFD linker routines.  The first argument to each
>     callback function is the bfd_link_info structure being used.  Each
>     function returns a boolean value.  If the function returns FALSE,
>     then the BFD function which called it will return with a failure
>     indication.  */
>  
>  struct bfd_link_callbacks
> Index: ld/lexsup.c
> ===================================================================
> RCS file: /cvs/src/src/ld/lexsup.c,v
> retrieving revision 1.76
> diff -w -u -1 -0 -p -r1.76 lexsup.c
> --- ld/lexsup.c	19 Jul 2004 16:40:52 -0000	1.76
> +++ ld/lexsup.c	13 Sep 2004 18:25:13 -0000
> @@ -139,21 +139,22 @@ enum option_values
>    OPTION_NOSTDLIB,
>    OPTION_NO_OMAGIC,
>    OPTION_STRIP_DISCARDED,
>    OPTION_NO_STRIP_DISCARDED,
>    OPTION_ACCEPT_UNKNOWN_INPUT_ARCH,
>    OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH,
>    OPTION_PIE,
>    OPTION_UNRESOLVED_SYMBOLS,
>    OPTION_WARN_UNRESOLVED_SYMBOLS,
>    OPTION_ERROR_UNRESOLVED_SYMBOLS,
> -  OPTION_REDUCE_MEMORY_OVERHEADS
> +  OPTION_REDUCE_MEMORY_OVERHEADS,
> +  OPTION_WARN_SHARED_TEXTREL
>  };
>  
>  /* The long options.  This structure is used for both the option
>     parsing and the help text.  */
>  
>  struct ld_option
>  {
>    /* The long option information.  */
>    struct option opt;
>    /* The short option with the same meaning ('\0' if none).  */
> @@ -489,20 +490,23 @@ static const struct ld_option ld_options
>  		   "\t\t\t\tfollowing dynamic libs"), TWO_DASHES },
>    { {"no-add-needed", no_argument, NULL, OPTION_NO_ADD_NEEDED},
>      '\0', NULL, N_("Do not set DT_NEEDED tags for DT_NEEDED entries\n"
>  		   "\t\t\t\tin following dynamic libs"), TWO_DASHES },
>    { {"as-needed", no_argument, NULL, OPTION_AS_NEEDED},
>      '\0', NULL, N_("Only set DT_NEEDED for following dynamic libs if used"),
>      TWO_DASHES },
>    { {"no-as-needed", no_argument, NULL, OPTION_NO_AS_NEEDED},
>      '\0', NULL, N_("Always set DT_NEEDED for following dynamic libs"),
>      TWO_DASHES },
> +  { {"warn-shared-textrel", no_argument, NULL, OPTION_WARN_SHARED_TEXTREL},
> +      '\0', NULL, N_("Warn if shared object has DT_TEXTREL"),
> +      TWO_DASHES },
>    { {"wrap", required_argument, NULL, OPTION_WRAP},
>      '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
>  };
>  
>  #define OPTION_COUNT ARRAY_SIZE (ld_options)
>  
>  void
>  parse_args (unsigned argc, char **argv)
>  {
>    unsigned i;
> @@ -1209,20 +1213,23 @@ parse_args (unsigned argc, char **argv)
>  	  break;
>  	case OPTION_NO_ADD_NEEDED:
>  	  add_needed = FALSE;
>  	  break;
>  	case OPTION_AS_NEEDED:
>  	  as_needed = TRUE;
>  	  break;
>  	case OPTION_NO_AS_NEEDED:
>  	  as_needed = FALSE;
>  	  break;
> +	case OPTION_WARN_SHARED_TEXTREL:
> +	  link_info.warn_shared_textrel = TRUE;
> +	  break;
>  	case OPTION_WRAP:
>  	  add_wrap (optarg);
>  	  break;
>  	case OPTION_DISCARD_NONE:
>  	  link_info.discard = discard_none;
>  	  break;
>  	case 'X':
>  	  link_info.discard = discard_l;
>  	  break;
>  	case 'x':

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add --warn-shared-textrel option to ld
  2004-09-16 18:31 [PATCH] Add --warn-shared-textrel option to ld Jeff Baker
  2004-09-21 18:16 ` Jeff Baker
@ 2004-09-30 17:30 ` Nick Clifton
  2004-10-01 14:42   ` Jeff Baker
  1 sibling, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2004-09-30 17:30 UTC (permalink / raw)
  To: jbaker; +Cc: binutils

Hi Jeff,

> This patch was originally included in the QNX Mips support but I'm 
> posting it on it's own so that the appropriate people might look at it.

Well the patch seems quite reasonable.  There are a couple of minor 
problems with it however:

   * The formatting of the code added to elflink.c does not follow the 
GNU Coding Standards; (the opening curly brace should be on its own line).

   * The patch adds a new command line switch to the linker, but it does 
not add documentation on this switch to the ld.texinfo file, nor does it 
add a line to the ld/NEWS file.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add --warn-shared-textrel option to ld
  2004-09-30 17:30 ` Nick Clifton
@ 2004-10-01 14:42   ` Jeff Baker
  2004-10-07 14:46     ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Baker @ 2004-10-01 14:42 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

> Well the patch seems quite reasonable.  There are a couple of minor 
> problems with it however:
> 
>    * The formatting of the code added to elflink.c does not follow the 
> GNU Coding Standards; (the opening curly brace should be on its own
> line).
> 
>    * The patch adds a new command line switch to the linker, but it does
> 
> not add documentation on this switch to the ld.texinfo file, nor does it
> 
> add a line to the ld/NEWS file.

How about now?

[-- Attachment #2: qnx_shared_textrel.patch --]
[-- Type: text/plain, Size: 7334 bytes --]

2004-10-01  Jeff Baker  <jbaker@qnx.com>
	* elflink.c (_bfd_elf_add_dynamic_entry): Add code to
	warn if adding a DT_TEXTREL to a shared object and
	--warn-shared-textrel was specified.

2004-10-01  Jeff Baker  <jbaker@qnx.com>
	* bfdlink.h (bfd_link_info): Add boolean
	warn_shared_textrel.

2004-10-01  Jeff Baker  <jbaker@qnx.com>
	* NEWS: Added mention of --warn-shared-textrel option.
	* ld.texinfo: Add documentation for --warn-shared-textrel.
	* lexsup.c: Handle --warn-shared-textrel option.


Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.104
diff -w -u -1 -0 -p -r1.104 elflink.c
--- bfd/elflink.c	30 Sep 2004 16:43:41 -0000	1.104
+++ bfd/elflink.c	1 Oct 2004 14:35:35 -0000
@@ -2694,20 +2694,26 @@ _bfd_elf_add_dynamic_entry (struct bfd_l
   const struct elf_backend_data *bed;
   asection *s;
   bfd_size_type newsize;
   bfd_byte *newcontents;
   Elf_Internal_Dyn dyn;
 
   hash_table = elf_hash_table (info);
   if (! is_elf_hash_table (hash_table))
     return FALSE;
 
+  if (info->warn_shared_textrel && info->shared && tag == DT_TEXTREL) 
+  {
+    (*_bfd_error_handler)
+      (_("warning: creating a DT_TEXTREL in a shared object."));
+  }
+  
   bed = get_elf_backend_data (hash_table->dynobj);
   s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
   BFD_ASSERT (s != NULL);
 
   newsize = s->size + bed->s->sizeof_dyn;
   newcontents = bfd_realloc (s->contents, newsize);
   if (newcontents == NULL)
     return FALSE;
 
   dyn.d_tag = tag;
Index: include/bfdlink.h
===================================================================
RCS file: /cvs/src/src/include/bfdlink.h,v
retrieving revision 1.46
diff -w -u -1 -0 -p -r1.46 bfdlink.h
--- include/bfdlink.h	17 Sep 2004 07:14:32 -0000	1.46
+++ include/bfdlink.h	1 Oct 2004 14:35:35 -0000
@@ -393,20 +393,23 @@ struct bfd_link_info
   unsigned int spare_dynamic_tags;
 
   /* May be used to set DT_FLAGS for ELF. */
   bfd_vma flags;
 
   /* May be used to set DT_FLAGS_1 for ELF. */
   bfd_vma flags_1;
 
   /* Start and end of RELRO region.  */
   bfd_vma relro_start, relro_end;
+
+  /* Warn if adding a DT_TEXTREL to a shared object.  */
+  bfd_boolean warn_shared_textrel;
 };
 
 /* This structures holds a set of callback functions.  These are
    called by the BFD linker routines.  The first argument to each
    callback function is the bfd_link_info structure being used.  Each
    function returns a boolean value.  If the function returns FALSE,
    then the BFD function which called it will return with a failure
    indication.  */
 
 struct bfd_link_callbacks
Index: ld/lexsup.c
===================================================================
RCS file: /cvs/src/src/ld/lexsup.c,v
retrieving revision 1.76
diff -w -u -1 -0 -p -r1.76 lexsup.c
--- ld/lexsup.c	19 Jul 2004 16:40:52 -0000	1.76
+++ ld/lexsup.c	1 Oct 2004 14:35:35 -0000
@@ -139,21 +139,22 @@ enum option_values
   OPTION_NOSTDLIB,
   OPTION_NO_OMAGIC,
   OPTION_STRIP_DISCARDED,
   OPTION_NO_STRIP_DISCARDED,
   OPTION_ACCEPT_UNKNOWN_INPUT_ARCH,
   OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH,
   OPTION_PIE,
   OPTION_UNRESOLVED_SYMBOLS,
   OPTION_WARN_UNRESOLVED_SYMBOLS,
   OPTION_ERROR_UNRESOLVED_SYMBOLS,
-  OPTION_REDUCE_MEMORY_OVERHEADS
+  OPTION_REDUCE_MEMORY_OVERHEADS,
+  OPTION_WARN_SHARED_TEXTREL
 };
 
 /* The long options.  This structure is used for both the option
    parsing and the help text.  */
 
 struct ld_option
 {
   /* The long option information.  */
   struct option opt;
   /* The short option with the same meaning ('\0' if none).  */
@@ -489,20 +490,23 @@ static const struct ld_option ld_options
 		   "\t\t\t\tfollowing dynamic libs"), TWO_DASHES },
   { {"no-add-needed", no_argument, NULL, OPTION_NO_ADD_NEEDED},
     '\0', NULL, N_("Do not set DT_NEEDED tags for DT_NEEDED entries\n"
 		   "\t\t\t\tin following dynamic libs"), TWO_DASHES },
   { {"as-needed", no_argument, NULL, OPTION_AS_NEEDED},
     '\0', NULL, N_("Only set DT_NEEDED for following dynamic libs if used"),
     TWO_DASHES },
   { {"no-as-needed", no_argument, NULL, OPTION_NO_AS_NEEDED},
     '\0', NULL, N_("Always set DT_NEEDED for following dynamic libs"),
     TWO_DASHES },
+  { {"warn-shared-textrel", no_argument, NULL, OPTION_WARN_SHARED_TEXTREL},
+      '\0', NULL, N_("Warn if shared object has DT_TEXTREL"),
+      TWO_DASHES },
   { {"wrap", required_argument, NULL, OPTION_WRAP},
     '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
 };
 
 #define OPTION_COUNT ARRAY_SIZE (ld_options)
 
 void
 parse_args (unsigned argc, char **argv)
 {
   unsigned i;
@@ -1209,20 +1213,23 @@ parse_args (unsigned argc, char **argv)
 	  break;
 	case OPTION_NO_ADD_NEEDED:
 	  add_needed = FALSE;
 	  break;
 	case OPTION_AS_NEEDED:
 	  as_needed = TRUE;
 	  break;
 	case OPTION_NO_AS_NEEDED:
 	  as_needed = FALSE;
 	  break;
+	case OPTION_WARN_SHARED_TEXTREL:
+	  link_info.warn_shared_textrel = TRUE;
+	  break;
 	case OPTION_WRAP:
 	  add_wrap (optarg);
 	  break;
 	case OPTION_DISCARD_NONE:
 	  link_info.discard = discard_none;
 	  break;
 	case 'X':
 	  link_info.discard = discard_l;
 	  break;
 	case 'x':
Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.122
diff -w -u -1 -0 -p -r1.122 ld.texinfo
--- ld/ld.texinfo	30 Sep 2004 17:03:51 -0000	1.122
+++ ld/ld.texinfo	1 Oct 2004 14:35:37 -0000
@@ -1673,20 +1673,24 @@ which refers to it.
 @kindex --warn-section-align
 @cindex warnings, on section alignment
 @cindex section alignment, warnings on
 @item --warn-section-align
 Warn if the address of an output section is changed because of
 alignment.  Typically, the alignment will be set by an input section.
 The address will only be changed if it not explicitly specified; that
 is, if the @code{SECTIONS} command does not specify a start address for
 the section (@pxref{SECTIONS}).
 
+@kindex --warn-shared-textrel
+@item --warn-shared-textrel
+Warn if the linker adds a DT_TEXTREL to a shared object.  
+
 @kindex --warn-unresolved-symbols
 @item --warn-unresolved-symbols
 If the linker is going to report an unresolved symbol (see the option
 @option{--unresolved-symbols}) it will normally generate an error.
 This option makes it generate a warning instead.
 
 @kindex --error-unresolved-symbols
 @item --error-unresolved-symbols
 This restores the linker's default behaviour of generating errors when
 it is reporting unresolved symbols.
Index: ld/NEWS
===================================================================
RCS file: /cvs/src/src/ld/NEWS,v
retrieving revision 1.50
diff -w -u -1 -0 -p -r1.50 NEWS
--- ld/NEWS	19 Jul 2004 19:14:51 -0000	1.50
+++ ld/NEWS	1 Oct 2004 14:35:37 -0000
@@ -1,12 +1,15 @@
 -*- text -*-
 
+* New ELF --warn-shared-textrel option to warn if adding a 
+DT_TEXTREL to a shared object.
+
 * New ELF --add-needed/--no-add-needed options to control if a
 DT_NEEDED tag should be added when a shared library comes from
 DT_NEEDED tags.
 
 * Support for the crx-elf target added.
 
 * Support for the sh-symbianelf target added.
 
 * A new linker command line switch has been added which allows the hash table
   size to be set to a suitable prime value near to its argument.  This switch

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add --warn-shared-textrel option to ld
  2004-10-01 14:42   ` Jeff Baker
@ 2004-10-07 14:46     ` Nick Clifton
  2005-03-24  3:50       ` Ned Ludd
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2004-10-07 14:46 UTC (permalink / raw)
  To: jbaker; +Cc: binutils

Hi Jeff,

>>    * The formatting of the code added to elflink.c does not follow the 
>> GNU Coding Standards; (the opening curly brace should be on its own
>> line).
>>
>>    * The patch adds a new command line switch to the linker, but it does
>> not add documentation on this switch to the ld.texinfo file, nor does it
>> add a line to the ld/NEWS file.

> How about now?

Better - thanks:

> 2004-10-01  Jeff Baker  <jbaker@qnx.com>
> 	* elflink.c (_bfd_elf_add_dynamic_entry): Add code to
> 	warn if adding a DT_TEXTREL to a shared object and
> 	--warn-shared-textrel was specified.
> 
> 2004-10-01  Jeff Baker  <jbaker@qnx.com>
> 	* bfdlink.h (bfd_link_info): Add boolean
> 	warn_shared_textrel.
> 
> 2004-10-01  Jeff Baker  <jbaker@qnx.com>
> 	* NEWS: Added mention of --warn-shared-textrel option.
> 	* ld.texinfo: Add documentation for --warn-shared-textrel.
> 	* lexsup.c: Handle --warn-shared-textrel option.

Approved and applied.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add --warn-shared-textrel option to ld
  2004-10-07 14:46     ` Nick Clifton
@ 2005-03-24  3:50       ` Ned Ludd
  0 siblings, 0 replies; 6+ messages in thread
From: Ned Ludd @ 2005-03-24  3:50 UTC (permalink / raw)
  To: Nick Clifton; +Cc: jbaker, binutils

Is the check for info->shared suitable for info->pie as well?

Would there be anyway to perhaps make this check a little more verbose
in it's diagnostic output in order to help aid in tracking down the
offending relocations in object files. Suns link editor seems to behave
this way when given a -z text option.
http://docs.sun.com/app/docs/doc/816-1386/6m7qcobl6?a=view (Under PIC)


On Thu, 2004-10-07 at 15:50 +0100, Nick Clifton wrote:
> Hi Jeff,
> 
> >>    * The formatting of the code added to elflink.c does not follow the 
> >> GNU Coding Standards; (the opening curly brace should be on its own
> >> line).
> >>
> >>    * The patch adds a new command line switch to the linker, but it does
> >> not add documentation on this switch to the ld.texinfo file, nor does it
> >> add a line to the ld/NEWS file.
> 
> > How about now?
> 
> Better - thanks:
> 
> > 2004-10-01  Jeff Baker  <jbaker@qnx.com>
> > 	* elflink.c (_bfd_elf_add_dynamic_entry): Add code to
> > 	warn if adding a DT_TEXTREL to a shared object and
> > 	--warn-shared-textrel was specified.
> > 
> > 2004-10-01  Jeff Baker  <jbaker@qnx.com>
> > 	* bfdlink.h (bfd_link_info): Add boolean
> > 	warn_shared_textrel.
> > 
> > 2004-10-01  Jeff Baker  <jbaker@qnx.com>
> > 	* NEWS: Added mention of --warn-shared-textrel option.
> > 	* ld.texinfo: Add documentation for --warn-shared-textrel.
> > 	* lexsup.c: Handle --warn-shared-textrel option.
> 
> Approved and applied.
> 
> Cheers
>    Nick
> 
-- 
Ned Ludd <solar@gentoo.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-03-23 18:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-16 18:31 [PATCH] Add --warn-shared-textrel option to ld Jeff Baker
2004-09-21 18:16 ` Jeff Baker
2004-09-30 17:30 ` Nick Clifton
2004-10-01 14:42   ` Jeff Baker
2004-10-07 14:46     ` Nick Clifton
2005-03-24  3:50       ` Ned Ludd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).