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 .sdata2 writable on ppc vxworks6



Greetings,

In the coming months I will be submitting AdaCore's accumulated binutils patches as candidates for inclusion at the FSF. Most of them will be related to our cross ports (e.g. VxWorks). A few were written by engineers who are no longer with AdaCore. In that case I've done my best to research the archeology to find the motivation.

------------------------------------------------------------------

The attached was originally written by Tristan Gingold. The motivation is to handle PPC TLS on VxWorks in a way compatible with the WRS linker.

It's been extensively tested since 2012 with our own regression testsuite
.
Also, for this submission, with the latest binutils testsuite.

--Douglas Rupp
AdaCore
2018-10-11  Douglas B Rupp  <rupp@adacore.com>
            on behalf of Tristan Gingold

    ld/
	* scripttempl/elf.sc: If WRITABLE_SDATA2 is set, put .sdata2 and
	.sbss2 sections into the writable segment.

	* emulparams/elf32ppcvxworks.sh (WRITABLE_SDATA2): Defined.

diff --git ld/emulparams/elf32ppcvxworks.sh ld/emulparams/elf32ppcvxworks.sh
index 88c1da0..25ba550 100644
--- ld/emulparams/elf32ppcvxworks.sh
+++ ld/emulparams/elf32ppcvxworks.sh
@@ -2,4 +2,5 @@
 . ${srcdir}/emulparams/plt_unwind.sh
 EXTRA_EM_FILE=ppc32elf
 OUTPUT_FORMAT="elf32-powerpc-vxworks"
+WRITABLE_SDATA2=
 . ${srcdir}/emulparams/vxworks.sh
diff --git ld/scripttempl/elf.sc ld/scripttempl/elf.sc
index b10e330..970d03e 100644
--- ld/scripttempl/elf.sc
+++ ld/scripttempl/elf.sc
@@ -8,6 +8,7 @@
 #	NOP - four byte opcode for no-op (defaults to none)
 #	NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
 #		empty.
+#	WRITABLE_SDATA2 - if set, the .sdata2/.sbss2 section should be writable
 #	SMALL_DATA_CTOR - .ctors contains small data.
 #	SMALL_DATA_DTOR - .dtors contains small data.
 #	DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
@@ -561,8 +562,8 @@ fi
 cat <<EOF
   ${WRITABLE_RODATA-${RODATA}}
   .${RODATA_NAME}1      ${RELOCATING-0} : { *(.${RODATA_NAME}1) }
-  ${CREATE_SHLIB-${SDATA2}}
-  ${CREATE_SHLIB-${SBSS2}}
+  ${CREATE_SHLIB-${WRITABLE_SDATA2-${SDATA2}}}
+  ${CREATE_SHLIB-${WRITABLE_SDATA2-${SBSS2}}}
   ${OTHER_READONLY_SECTIONS}
   .eh_frame_hdr : { *(.eh_frame_hdr) ${RELOCATING+*(.eh_frame_entry .eh_frame_entry.*)} }
   .eh_frame     ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) ${RELOCATING+*(.eh_frame.*)} }
@@ -628,6 +629,8 @@ cat <<EOF
   }
   .data1        ${RELOCATING-0} : { *(.data1) }
   ${WRITABLE_RODATA+${RODATA}}
+  ${CREATE_SHLIB-${WRITABLE_SDATA2+${SDATA2}}}
+  ${CREATE_SHLIB-${WRITABLE_SDATA2+${SBSS2}}}
   ${OTHER_READWRITE_SECTIONS}
   ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
   ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}

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