This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Make the compiler do the math 2.


Hi all,

Same idea as my previous post (1), but applied to a file that
has just until very recently a str/strlen pair bug, fixed by H.J.LU.

Please review and commit.

(1) http://sourceware.org/ml/binutils/2006-09/msg00076.html

Cheers,
Pedro Alves

---

bfd/ChangeLog

2006-09-11 Pedro Alves <pedro_alves@portugalmail.pt>

	* elf.c (_bfd_elf_make_section_from_shdr): New macro DSECT.
	(_bfd_elf_make_section_from_shdr, debug_sections): Use DSECT.

--- elf.c.org	2006-09-11 21:17:02.000000000 +0100
+++ elf.c	2006-09-11 21:25:18.000000000 +0100
@@ -816,22 +816,24 @@ _bfd_elf_make_section_from_shdr (bfd *ab
 	  int len;
 	} debug_sections [] =
 	{
-	  { "debug",		 5  },	/* 'd' */
-	  { NULL,		 0  },	/* 'e' */
-	  { NULL,		 0  },	/* 'f' */
-	  { "gnu.linkonce.wi.", 16 },	/* 'g' */
-	  { NULL,		 0  },	/* 'h' */
-	  { NULL,		 0  },	/* 'i' */
-	  { NULL,		 0  },	/* 'j' */
-	  { NULL,		 0  },	/* 'k' */
-	  { "line",		 4  },	/* 'l' */
-	  { NULL,		 0  },	/* 'm' */
-	  { NULL,		 0  },	/* 'n' */
-	  { NULL,		 0  },	/* 'o' */
-	  { NULL,		 0  },	/* 'p' */
-	  { NULL,		 0  },	/* 'q' */
-	  { NULL,		 0  },	/* 'r' */
-	  { "stab",		 4  }	/* 's' */
+#define DSECT(STR) { (STR), ((STR) ? sizeof (STR) - 1 : 0) }
+	  DSECT("debug"),               /* 'd' */
+	  DSECT(0),                     /* 'e' */
+	  DSECT(0),                     /* 'f' */
+	  DSECT("gnu.linkonce.wi."),    /* 'g' */
+	  DSECT(NULL),                  /* 'h' */
+	  DSECT(NULL),                  /* 'i' */
+	  DSECT(NULL),                  /* 'j' */
+	  DSECT(NULL),                  /* 'k' */
+	  DSECT("line"),                /* 'l' */
+	  DSECT(NULL),                  /* 'm' */
+	  DSECT(NULL),                  /* 'n' */
+	  DSECT(NULL),                  /* 'o' */
+	  DSECT(NULL),                  /* 'p' */
+	  DSECT(NULL),                  /* 'q' */
+	  DSECT(NULL),                  /* 'r' */
+	  DSECT("stab")                 /* 's' */
+#undef DSECT
 	};
       
       if (name [0] == '.')

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]