This is the mail archive of the 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 4/9] bfd: Set the thumb (16bit) flag for code sections in the arm-mingw32 target

Also don't make code sections writeable.

In this target, all code is supposed to be in thumb mode.
Ideally, the thumb flag should be set based on what format
the functions in the section are.

This is required for the object files to work properly when
linked into an app by the ms linker.
 bfd/coffcode.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index d520f0d..6304ce8 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -712,8 +712,13 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
     styp_flags |= IMAGE_SCN_MEM_READ;     /* Invert NOREAD for read.  */
   if ((sec_flags & SEC_READONLY) == 0)
     styp_flags |= IMAGE_SCN_MEM_WRITE;    /* Invert READONLY for write.  */
-  if (sec_flags & SEC_CODE)
+  if (sec_flags & SEC_CODE) {
     styp_flags |= IMAGE_SCN_MEM_EXECUTE;  /* CODE->EXECUTE.  */
+#ifdef ARMV7_WIN
+    styp_flags |= IMAGE_SCN_MEM_16BIT;
+    styp_flags &= ~IMAGE_SCN_MEM_WRITE;
+  }
   if (sec_flags & SEC_COFF_SHARED)
     styp_flags |= IMAGE_SCN_MEM_SHARED;   /* Shared remains meaningful.  */

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