Initial groundwork for ARM64 support
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7001 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
bca384e691
commit
460b3f59a9
11 changed files with 101 additions and 51 deletions
|
@ -136,6 +136,9 @@ CEXEBuild::CEXEBuild(signed char pponly, bool warnaserror) :
|
|||
m_target_type=TARGET_X86ANSI;
|
||||
#ifdef _WIN32
|
||||
if (sizeof(void*) > 4) m_target_type = TARGET_AMD64; // BUGBUG: scons 'TARGET_ARCH' should specify the default
|
||||
#endif
|
||||
#ifdef _M_ARM64
|
||||
m_target_type = TARGET_ARM64; // BUGBUG: scons 'TARGET_ARCH' should specify the default
|
||||
#endif
|
||||
build_unicode=TARGET_X86ANSI != m_target_type;
|
||||
build_lockedunicodetarget=false;
|
||||
|
@ -3880,19 +3883,36 @@ int CEXEBuild::set_target_architecture_data()
|
|||
}
|
||||
definedlist.set(_T("NSIS_PTR_SIZE"), is_target_64bit() ? _T("8") : _T("4"));
|
||||
|
||||
tstring cpu = get_string_prefix(get_target_suffix(m_target_type), _T("-"));
|
||||
const TCHAR* tsuff = get_target_suffix(m_target_type, _T(""));
|
||||
if (!*tsuff) return PS_ERROR;
|
||||
tstring cpu = get_string_prefix(tsuff, _T("-"));
|
||||
definedlist.set(_T("NSIS_CPU"), cpu.c_str()); // Used by Library.nsh to pick the correct RegTool
|
||||
|
||||
definedlist.del(_T("NSIS_IX86"));
|
||||
definedlist.del(_T("NSIS_AMD64"));
|
||||
if (TARGET_AMD64 == m_target_type)
|
||||
definedlist.set(_T("NSIS_AMD64"));
|
||||
else
|
||||
definedlist.set(_T("NSIS_IX86"), build_unicode ? _T("400") : _T("300"));
|
||||
struct { TARGETTYPE tt; const TCHAR *def; const TCHAR *val; } static const tdef[] = {
|
||||
{ TARGET_X86ANSI, _T("NSIS_IX86"), _T("300") },
|
||||
{ TARGET_X86UNICODE, _T("NSIS_IX86"), _T("400") },
|
||||
{ TARGET_AMD64, _T("NSIS_AMD64"), _T("1") },
|
||||
{ TARGET_ARM64, _T("NSIS_ARM64"), _T("1") }
|
||||
};
|
||||
size_t i;
|
||||
for (i = 0; i < COUNTOF(tdef); ++i) definedlist.del(tdef[i].def);
|
||||
for (i = 0; i < COUNTOF(tdef); ++i) if (tdef[i].tt == m_target_type) definedlist.set(tdef[i].def, tdef[i].val);
|
||||
|
||||
return PS_OK;
|
||||
}
|
||||
|
||||
const TCHAR* CEXEBuild::get_target_suffix(CEXEBuild::TARGETTYPE tt, const TCHAR*defval) const
|
||||
{
|
||||
switch(tt)
|
||||
{
|
||||
case TARGET_X86ANSI : return _T("x86-ansi");
|
||||
case TARGET_X86UNICODE: return _T("x86-unicode");
|
||||
case TARGET_AMD64 : return _T("amd64-unicode");
|
||||
case TARGET_ARM64 : return _T("arm64-unicode");
|
||||
default: return defval;
|
||||
}
|
||||
}
|
||||
|
||||
int CEXEBuild::change_target_architecture(TARGETTYPE tt)
|
||||
{
|
||||
const bool wide = TARGET_X86ANSI != tt;
|
||||
|
@ -3932,17 +3952,6 @@ CEXEBuild::TARGETTYPE CEXEBuild::get_target_type(const TCHAR*s) const
|
|||
return TARGET_UNKNOWN;
|
||||
}
|
||||
|
||||
const TCHAR* CEXEBuild::get_target_suffix(CEXEBuild::TARGETTYPE tt, const TCHAR*defval) const
|
||||
{
|
||||
switch(tt)
|
||||
{
|
||||
case TARGET_X86ANSI : return _T("x86-ansi");
|
||||
case TARGET_X86UNICODE: return _T("x86-unicode");
|
||||
case TARGET_AMD64 : return _T("amd64-unicode");
|
||||
default: return defval;
|
||||
}
|
||||
}
|
||||
|
||||
void CEXEBuild::print_bad_targettype_parameter(const TCHAR*cmdname, const TCHAR*prefix) const
|
||||
{
|
||||
tstring errstr = cmdname;
|
||||
|
|
|
@ -230,6 +230,7 @@ class CEXEBuild {
|
|||
TARGET_X86ANSI = TARGETFIRST,
|
||||
TARGET_X86UNICODE,
|
||||
TARGET_AMD64, // Always Unicode
|
||||
TARGET_ARM64, // Always Unicode
|
||||
TARGET_UNKNOWN,
|
||||
TARGETCOUNT = (TARGET_UNKNOWN-TARGETFIRST)
|
||||
} TARGETTYPE;
|
||||
|
@ -238,7 +239,7 @@ class CEXEBuild {
|
|||
bool m_previous_x86_unicode;
|
||||
const TCHAR* get_target_suffix(CEXEBuild::TARGETTYPE tt, const TCHAR*defval = _T("?")) const;
|
||||
const TCHAR* get_target_suffix() const { return get_target_suffix(m_target_type); }
|
||||
static bool is_targettype_64bit(TARGETTYPE tt) { return TARGET_AMD64 == tt; }
|
||||
static bool is_targettype_64bit(TARGETTYPE tt) { return TARGET_AMD64 == tt || TARGET_ARM64 == tt; }
|
||||
bool is_target_64bit() const { return is_targettype_64bit(m_target_type); }
|
||||
void print_bad_targettype_parameter(const TCHAR*cmdname, const TCHAR*prefix = _T("")) const;
|
||||
unsigned int get_header_size() const { return (unsigned int)sizeof(header) + (is_target_64bit() ? (4 * BLOCKS_NUM) : 0); }
|
||||
|
|
|
@ -876,7 +876,7 @@ int CEXEBuild::process_jump(LineParser &line, int wt, int *offs)
|
|||
#define SECTION_FIELD_GET(field) (FIELD_OFFSET(section, field)/sizeof(int))
|
||||
#define SECTION_FIELD_SET(field) (-1 - (int)(FIELD_OFFSET(section, field)/sizeof(int)))
|
||||
|
||||
#define INVALIDREGROOT ( (HKEY) 0x8000baad )
|
||||
#define INVALIDREGROOT ( (HKEY) (UINT_PTR) 0x8000baad )
|
||||
static HKEY ParseRegRootKey(LineParser &line, int tok)
|
||||
{
|
||||
static const TCHAR *rootkeys[2] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue