Re: [Tinycc-devel] tcc_relocate() and tcc_relocate_ex()

2012-09-04 Thread David Mertens
1) I prefer the two-function interface, especially with the nicer
names Sean suggested, but who cares, beggars can't be choosers.
2) This whole exchange took more effort than it should have taken.
3) Thanks! Now it works! (I presume; I've not yet tested it.)

David

On Mon, Sep 3, 2012 at 6:07 AM, grischka  wrote:
> Michael Matz wrote:
>>
>> You earnestly added this interface abomination to avoid exporting a
>> function?Well, as you asked: yes it's ugly, and yes it's confusing.
>> (and it's also non-C, ((void*)-1) might not be representable; the only
>> integer literal that definitely is convertible into a pointer is 0; but I'll
>> admit that this would just be a nitpick).  But why you think this interface
>> would be better than an explicit one with two functions is a complete
>> mystery to me.  I mean, really, can you give a reason?  I'm seriously
>> interested.
>
>
> So you seriously wanted to export the wrapper AND its subroutine?
> I mean, after all, an API is an abstraction layer and not a
> self-service store.
>
> Anyhow, I think it is not more complex/ugly/confusing than the
> alternative.  We would need to show users:
>  - the "abomination" just minus the TCC_RELOCATE_AUTO part
>  - plus the declaration of tcc_relocate + usage comment
>  - some hint at least how the two functions relate to each other
>
> So, my reasons, short version: Smaller libtcc.h
>
> --- grischka
>
>
>> Ciao,
>> Michael.
>
>
>
> ___
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel



-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Compiling Wine with TinyCC (status/bug reports)

2012-09-04 Thread Austin English
Howdy,

I recently tried compiling Wine with tcc, which found a few bugs. I've
filed some on Savannah (and have before as well), but that didn't
garner much attention, so I'm writing here as well. If that's
unwelcome, please let me know and I'll refrain :).

Now then, I used wine-1.5.12 (recent development snapshot), and tinycc
from git (commit 56e23984b9cd3b58e1766748524e63f8301ccd68). Compared
to 0.9.25, it gets much further, a couple of my bugs were fixed
already:
https://savannah.nongnu.org/bugs/?33010 - configure misses most dependencies
https://savannah.nongnu.org/bugs/?33713 - tinycc doesn't support u_int64_t

the new bugs:
https://savannah.nongnu.org/bugs/?37240 - tinycc: unknown opcode 'movq'
https://savannah.nongnu.org/bugs/?37241 - tinycc: 'error: bad
expression syntax [.]' on some wine files
https://savannah.nongnu.org/bugs/?37242 - tinycc: tmarshal.h:761:
error: identifier expected (wine)
https://savannah.nongnu.org/bugs/?37243 - tinycc: fails to compile
wine's dlls/d3d8/tests/stateblock.c file
https://savannah.nongnu.org/bugs/?37244 - tinycc: lacks -nostartfiles
-nodefaultlibs support, needed by Wine

there are a couple other issues, that I haven't filed bugs for:
A) running ./configure fails to detect libhal and opengl. This can be
worked around by doing:
CC="tcc -L/usr/lib" ./configure

B) TinyCC doesn't seem to support DECLSPEC_HIDDEN / DECLSPEC_HOTPATCH.

C) There are some other areas that fail to compile, though those
appear to be Wine bugs. I've attached a (very hacky) patch that
(mostly) allows wine to compile. For the files mentioned above that
don't compile, make CC=gcc was used to work around it.

After that, wine segfaults on launch, so there's obviously more work
to be done, but these issues make narrowing down that problem harder.

I'd be happy to test any tcc patches, if needed. I've attached
testcases for some of the bugs, when possible. I attempted to use
delta (http://delta.tigris.org/) to narrow down the problems more, but
it seems tinycc doesn't support dumping the preprocessed code?

-- 
-Austin
commit 9a9171901c3145df95e421eeab55c7ab005d0661
Author: Austin English 
Date:   Fri Aug 31 15:04:58 2012 -0700

asdf

diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index 385ace4..d0ad0e7 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -627,7 +627,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
  */
 PPOLICY_PRIMARY_DOMAIN_INFO pinfo;
 
-pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), 
offsetof(POLICY_PRIMARY_DOMAIN_INFO, Name));
+//pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), 
offsetof(POLICY_PRIMARY_DOMAIN_INFO, Name));
 
 TRACE("setting domain to %s\n", debugstr_w(pinfo->Name.Buffer));
 
@@ -677,7 +677,7 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
  */
 PPOLICY_DNS_DOMAIN_INFO pinfo;
 
-pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), 
offsetof(POLICY_DNS_DOMAIN_INFO, Name));
+//pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), 
offsetof(POLICY_DNS_DOMAIN_INFO, Name));
 
 TRACE("setting domain to %s\n", debugstr_w(pinfo->Name.Buffer));
 
diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h
index ea85cbc..950fe4b 100644
--- a/dlls/crypt32/crypt32_private.h
+++ b/dlls/crypt32/crypt32_private.h
@@ -149,7 +149,7 @@ BOOL WINAPI CRYPT_AsnEncodePubKeyInfoNoNull(DWORD 
dwCertEncodingType,
  */
 HCRYPTPROV CRYPT_GetDefaultProvider(void) DECLSPEC_HIDDEN;
 
-HINSTANCE hInstance DECLSPEC_HIDDEN;
+extern HINSTANCE hInstance DECLSPEC_HIDDEN;
 
 void crypt_oid_init(void) DECLSPEC_HIDDEN;
 void crypt_oid_free(void) DECLSPEC_HIDDEN;
diff --git a/dlls/d3d8/d3d8_main.c b/dlls/d3d8/d3d8_main.c
index 3405447..84d1469 100644
--- a/dlls/d3d8/d3d8_main.c
+++ b/dlls/d3d8/d3d8_main.c
@@ -35,7 +35,7 @@ void WINAPI DebugSetMute(void) {
 /* nothing to do */
 }
 
-IDirect3D8 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT sdk_version)
+extern IDirect3D8 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT sdk_version)
 {
 struct d3d8 *object;
 
diff --git a/dlls/d3d8/tests/Makefile.in b/dlls/d3d8/tests/Makefile.in
index 14fa2fc..7df81bf 100644
--- a/dlls/d3d8/tests/Makefile.in
+++ b/dlls/d3d8/tests/Makefile.in
@@ -5,7 +5,6 @@ C_SRCS = \
buffer.c \
d3d8_main.c \
device.c \
-   stateblock.c \
surface.c \
texture.c \
visual.c \
diff --git a/dlls/d3d9/tests/Makefile.in b/dlls/d3d9/tests/Makefile.in
index 4c4ce0f..b3be706 100644
--- a/dlls/d3d9/tests/Makefile.in
+++ b/dlls/d3d9/tests/Makefile.in
@@ -7,7 +7,6 @@ C_SRCS = \
device.c \
query.c \
shader.c \
-   stateblock.c \
surface.c \
texture.c \
vertexdeclaration.c \
diff --git a/dlls/d3dx9_36/tests/Makefile.in b/dlls/d3dx9_36/tests/Makefile.in
index 5384705..01bc538 100644
--- a/dlls/d3dx9_36/tests/Makefile.in
+++ b/dlls/d3dx9_36/tests/Makefile.in
@@ -6,9 +6,6 @@ C_SRCS = \
core.c \
e