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 0/9] [WIP] New target for Windows 8 for ARM (Windows Phone 8 and Windows RT)


This is so far very much a work in progress. So far, gas works,
somewhat, for assembling certain handwritten gas files (tested
on libav and libvpx), while everything else is yet to be done.


Currently, the coff backend seems to have two different implementations
for arm, one for arm on Windows CE (for the mingw32ce/cegcc targets),
and a second default implementation. While neither windows phone 8
nor windows RT are windows CE, they use the same definition of the
pe/coff file format (my work so far is based on revision 8.2 of the
specification [1]).

The main change from the existing target is that it uses a new
magic/machine type - ARMV7PEMAGIC. This is defined as
"ARMv7 (or higher) Thumb mode only". (While the target devices do
support running ARM instructions as well, the toolchain seems to
be missing support for this in a number of places.) The existing
arm-mingw32ce target only supports ARM relocations, so this
patchset adds support for a few new thumb pcrel relocations.


Just as for the existing wince target, relocations for external
function calls shouldn't accommodate for the pc counter offset,
but making this work as intended is currently a big pile of hacks,
since I don't really understand the code base properly.

In addition to the relocations I add support for, the file format
does support a movw/t relocation, but this is one single relocation
for a movw/t instruction pair - I'm unsure how to handle this within
gas/bfd, to merge two BFD_RELOC_ARM_MOVW/T relocations into one
in the coff file (and reject any such relocations if they're not
paired properly). Additionally, the file format doesn't seem to have
any corresponding relocation for BFD_RELOC_32_PCREL.


In order to set the new magic/machine type in output files, and to
accommodate other hacks/tweaks, I'm adding a new target type,
currently named arm-mingw32 (to indicate that it's not the windows
ce version), but other naming suggestions are welcome.


Some of the patches might be worth considering for merging, while
others are plain rubbish/hacks so far and are only posted in case
someone wants to try out what I've done so far and are not
intended for review. The full patchset (plus some other uninteresting
hacks) are available on github [2].


[1] http://msdn.microsoft.com/en-us/library/windows/hardware/gg463119.aspx
[2] https://github.com/mstorsjo/binutils/commits/arm-win


---

Martin Storsjo (9):
  bfd: Identify and handle armv7pe just as normal armpe
  bfd: Add a new target named arm-*-mingw32
  bfd: Set the armv7 pe magic if targeting the armv7 version of
    arm/pe/coff
  bfd: Set the thumb (16bit) flag for code sections in the arm-mingw32
    target
  gas: Don't mark thumb symbols differently in the arm-mingw32 target
  gas: Don't relax relocations to public symbols
  incomplete: bfd: Support more pe-coff arm relocations
  not for review: bfd: coff-arm: hack: Don't adjust pcrel relocations
  not for review: gas: Hack pcrel base offsets for wince

 bfd/coff-arm.c                 |  105 ++++++++++++++++++++++++++++++++++++++--
 bfd/coffcode.h                 |   12 ++++-
 bfd/config.bfd                 |    6 +++
 bfd/configure.in               |    1 +
 bfd/pe-arm-win.c               |   43 ++++++++++++++++
 bfd/targets.c                  |    2 +
 gas/config/tc-arm.c            |   27 ++++++++++-
 gas/config/tc-arm.h            |    2 +
 gas/config/te-wince-pe-armv7.h |   21 ++++++++
 gas/configure.tgt              |    2 +
 ld/configure.tgt               |    2 +-
 11 files changed, 215 insertions(+), 8 deletions(-)
 create mode 100644 bfd/pe-arm-win.c
 create mode 100644 gas/config/te-wince-pe-armv7.h

-- 
1.7.9.4


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