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]

Re: Need some help with a patch for new command --warn-execstack for ld


Hi Magnus,

1. To get the object file .o (Y in the patch).
2. To get the symbol or function that need the execstack (X in the patch).

+      for (inputobj = info->input_bfds;
+	   inputobj;
+	   inputobj = inputobj->link_next)
+	{
+	  asection *s;
+
+	  if (inputobj->flags&  (DYNAMIC | EXEC_P | BFD_LINKER_CREATED))
+	    continue;
+	  s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
+	  if (s)
+		{
+	      if (s->flags&  SEC_CODE)
+	        einfo ("ld: Y: warning: function X requiring executable stack\n");
+		}
+	  else if (bed->default_execstack)
+	    einfo ("ld: Y: warning: function X requiring executable stack but object Y miss the .note.GNU-stack\n");

You should be able to use "bfd_get_filename (inputobj)" to get the name of the object file concerned. (Y in your code above). You can also abbreviate this by using the %B operator in your invocation of einfo().


Getting hold of X however is not really possible. There is no information in the object file so specify which function(s) needed an executable stack. That information is only known at compile time and it is lost by the time that the object file is created. My recommendation would be to just drop references to explicit function names from the warning messages.

Cheers
  Nick


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