winegcc: Add support for -Ttext-segment linker flag to set image base of a dll. (try 2)
Tijl Coosemans
tijl at coosemans.org
Sun Mar 3 09:58:43 CST 2013
---
README | 3 +++
tools/winegcc/utils.h | 3 ++-
tools/winegcc/winegcc.c | 11 ++++++++++-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/README b/README
index 783e798..75aff5a 100644
--- a/README
+++ b/README
@@ -40,6 +40,9 @@ support kernel threads may be supported in the future.
FreeBSD info:
Wine will generally not work properly on versions before FreeBSD 7.0.
+ You need GCC with GNU Binutils 2.20 or higher and run configure with
+ environment variables like CC, CFLAGS, CXX, CXXFLAGS, CPP, CPPFLAGS,
+ LD and LDFLAGS set correctly to use this compiler and linker.
See http://wiki.freebsd.org/Wine for more information.
Solaris info:
diff --git a/tools/winegcc/utils.h b/tools/winegcc/utils.h
index a75b3cc..0514272 100644
--- a/tools/winegcc/utils.h
+++ b/tools/winegcc/utils.h
@@ -42,7 +42,8 @@ enum target_cpu
enum target_platform
{
- PLATFORM_UNSPECIFIED, PLATFORM_APPLE, PLATFORM_SOLARIS, PLATFORM_WINDOWS, PLATFORM_CYGWIN
+ PLATFORM_UNSPECIFIED, PLATFORM_APPLE, PLATFORM_SOLARIS, PLATFORM_ELF,
+ PLATFORM_WINDOWS, PLATFORM_CYGWIN
};
void error(const char* s, ...) DECLSPEC_NORETURN;
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 7d528e0..fdeb77f 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -173,6 +173,7 @@ static const struct
{ "macos", PLATFORM_APPLE },
{ "darwin", PLATFORM_APPLE },
{ "solaris", PLATFORM_SOLARIS },
+ { "freebsd", PLATFORM_ELF },
{ "cygwin", PLATFORM_CYGWIN },
{ "mingw32", PLATFORM_WINDOWS },
{ "windows", PLATFORM_WINDOWS },
@@ -234,6 +235,8 @@ static const enum target_cpu build_cpu = CPU_ARM64;
static enum target_platform build_platform = PLATFORM_APPLE;
#elif defined(__sun)
static enum target_platform build_platform = PLATFORM_SOLARIS;
+#elif defined(__FreeBSD__)
+static enum target_platform build_platform = PLATFORM_ELF;
#elif defined(__CYGWIN__)
static enum target_platform build_platform = PLATFORM_CYGWIN;
#elif defined(_WIN32)
@@ -1030,6 +1033,12 @@ static void build(struct options* opts)
strarray_add(tmp_files, mapfile);
}
break;
+ case PLATFORM_ELF:
+ if (opts->image_base)
+ {
+ strarray_add(link_args, strmake("-Wl,-Ttext-segment=%s", opts->image_base));
+ }
+ break;
default:
break;
}
@@ -1065,7 +1074,7 @@ static void build(struct options* opts)
strarray_free (link_args);
/* set the base address */
- if (opts->image_base && !opts->target)
+ if (opts->image_base && !opts->target && opts->target_platform == PLATFORM_UNSPECIFIED)
{
const char *prelink = PRELINK;
if (prelink[0] && strcmp(prelink,"false"))
--
1.8.1.3
More information about the wine-patches
mailing list