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] add merge and strings flags to objcopy


---
On Thu, Jan 24, 2013 at 12:18 PM, Alan Modra <amodra@gmail.com> wrote:
> Many of these flags are internal to BFD.  They don't have any
> representation in object files.  So if a user tries to set SEC_KEEP
> for example, there will be no effect on the object file and they'll
> say the option is broken.  Please select only the set of flags that
> actually change something in an object file.  Yes, some flags will
> only work with ELF.  That's fine.  I just don't want objcopy options
> that do nothing on *any* object format.

Good point!  On a second thought I also figured out that the flags to
clear things like "noflags" are actually not that useful in this
implementation since it starts with an empty set all the time anyway.

Since it is a bit of extra work to figure out which flags do have an
effect on which backend I decided to go the pragmatic approach to
propose the two flags I actually needed at this point in time and maybe
add more later in case this is needed.

Robert

 binutils/ChangeLog |    4 ++++
 binutils/objcopy.c |    4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 4860baf..4d7b5a1 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-24  Robert Schiele  <rschiele@gmail.com>
+
+	* objcopy.c (parse_flags): Add merge and strings section flags.
+
 2013-01-23  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
 	* readelf.c: Add strings for NT_S390_LAST_BREAK and
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index ead8ff4..36bb5c4 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -690,6 +690,8 @@ parse_flags (const char *s)
       PARSE_FLAG ("rom", SEC_ROM);
       PARSE_FLAG ("share", SEC_COFF_SHARED);
       PARSE_FLAG ("contents", SEC_HAS_CONTENTS);
+      PARSE_FLAG ("merge", SEC_MERGE);
+      PARSE_FLAG ("strings", SEC_STRINGS);
 #undef PARSE_FLAG
       else
 	{
@@ -700,7 +702,7 @@ parse_flags (const char *s)
 	  copy[len] = '\0';
 	  non_fatal (_("unrecognized section flag `%s'"), copy);
 	  fatal (_("supported flags: %s"),
-		 "alloc, load, noload, readonly, debug, code, data, rom, share, contents");
+		 "alloc, load, noload, readonly, debug, code, data, rom, share, contents, merge, strings");
 	}
 
       s = snext;
-- 
1.7.10.4


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