Re: [Tinycc-devel] Support for hidden symbols?

2014-04-17 Thread Michael Matz
Hi,

On Sun, 13 Apr 2014, Austin English wrote:

 I expected that wine wouldn't immediately work, I'm doing it for the
 curiosity factor.

Okay :)

 The next problem is:
 make[1]: Entering directory `/home/austin/src/wine-tcc/dlls/acledit'
 /home/austin/tcc/bin/i386-linux-gnu-tcc -m32 -c -I. -I. -I../../include
 -I../../include  -D__WINESRC__  -D_REENTRANT -fPIC   -g  -o main.o main.c
 ../../tools/winegcc/winegcc -m32 -B../../tools/winebuild --sysroot=../..
 -shared ./acledit.spec main.o   -o acledit.dll.so
 ../../libs/port/libwine_port.a
 acledit.UgAqPb.s:14: error: unknown assembler directive
 '.L__wine_spec_rva_base'

Yep, tccasm doesn't currently accept the ATT syntax of local labels.  
Well, I could add that as well, but the question will be where to stop?  
wine emits assembler code for an ATT (e.g. the GNU) assembler, and tccasm 
is not such one.  There will be many more things missing.  All the .cfi 
directives, section markers, the special syntax for marking operands with 
certain relocations.  It would be easier if you would force wine to use 
the GNU assembler at least for assembler input.  The C sources can then 
still be compiled with TCC (and presumably that's where your couriosity 
lies).


Ciao,
Michael.

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


Re: [Tinycc-devel] Support for hidden symbols?

2014-04-17 Thread Austin English
On Thu, Apr 17, 2014 at 8:17 AM, Michael Matz matz@frakked.de wrote:

 Hi,

 On Sun, 13 Apr 2014, Austin English wrote:

  I expected that wine wouldn't immediately work, I'm doing it for the
  curiosity factor.

 Okay :)

  The next problem is:
  make[1]: Entering directory `/home/austin/src/wine-tcc/dlls/acledit'
  /home/austin/tcc/bin/i386-linux-gnu-tcc -m32 -c -I. -I. -I../../include
  -I../../include  -D__WINESRC__  -D_REENTRANT -fPIC   -g  -o main.o main.c
  ../../tools/winegcc/winegcc -m32 -B../../tools/winebuild --sysroot=../..
  -shared ./acledit.spec main.o   -o acledit.dll.so
  ../../libs/port/libwine_port.a
  acledit.UgAqPb.s:14: error: unknown assembler directive
  '.L__wine_spec_rva_base'

 Yep, tccasm doesn't currently accept the ATT syntax of local labels.
 Well, I could add that as well, but the question will be where to stop?
 wine emits assembler code for an ATT (e.g. the GNU) assembler, and tccasm
 is not such one.  There will be many more things missing.  All the .cfi
 directives, section markers, the special syntax for marking operands with
 certain relocations.  It would be easier if you would force wine to use
 the GNU assembler at least for assembler input.  The C sources can then
 still be compiled with TCC (and presumably that's where your couriosity
 lies).


Yes, precisely. clang has -no-integrated-as for this sort of case. I don't
see such an option with tcc, and setting AS doesn't work for wine's build
system.

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


Re: [Tinycc-devel] Support for hidden symbols?

2014-04-13 Thread Michael Matz

Hi,

On Sat, 12 Apr 2014, Austin English wrote:


I recently revisited compiling Wine with TinyCC. I've got some patches for
wine for that, but my current blocker is a lack of support for hidden
symbols on tcc:


Even with that fixed I'll predict some more blockers for wine.  It's not 
exactly one of the most trivial (and C conformant) program packages.  And 
well, wine has some quite performance critical components, so what would 
be the point in compiling it with tcc?  (except for the obvious one of 
that being an intellectually entertaining experiment)



acledit.pEPjUb.s:14: error: unknown assembler directive '.hidden'


Okay, so that's supporting (parsing) hidden directive from the assembler 
itself.  While fixing this is easy, you'll hit many more roadblocks in 
actually compiling real assembler sources (the above seems to be something 
emitted by the ../../tools/winegcc/winegcc wrapper).  TCCs included 
assembler really isn't much GAS compatible and misses many more 
directives.



/* return a global symbol declaration for an assembly symbol */
const char *asm_globl( const char *func )
    default:
    buffer = strmake( \t.globl %s\n\t.hidden %s\n%s:, func, func, func
);

is there any plan for supporting this?


There are multiple aspects for supporting hidden symbols: 1) parsing the 
above (inline) assembler directives.  2) parsing hidden symbols via 
gcc-compatible visibility attribute.  3) supporting hidden symbol in the 
builtin link editor.  I've done 1) and 2) in the mob branch (e69c506).


For 3) there's some code that isn't fully working yet.  For x86-64 I've at 
least implemented correct resolutions of calls to hidden functions.  I 
haven't yet implemented the other archs or correctly handling hidden data 
symbols.  The latter will simply be emitted as non-hidden global symbols 
(even if they were hidden in the input .o files) right now.


grischka: the PE port uses the st_other member of ELF symbols for tracking 
its own IMPORT/EXPORT directives.  As I'm now using it for symbol 
visibility (with values 0-3) this might clash: using visibility attribute 
might overwrite former IMPORT/EXPORT directives, and using IMPORT/EXPORT 
might influence the ELF linker (as it will now make more use of 
visibility).  I lack the necessary pieces to check on windows.  If there's 
indeed an interaction (I can't quite figure that out from just reading 
the code) but the PE port wants to continue using the st_other 
member (and not the TCC symbols type) I would guess it's best to use bits 
outside of mask ELFXX_ST_VISIBILITY (0x3).


The COFF port (used for C67) is now a bit more broken than before.  It 
uses st_other for debug type info (ugh!).  Is anyone even working on that? 
Time to remove it maybe?



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


Re: [Tinycc-devel] Support for hidden symbols?

2014-04-13 Thread Austin English
On Sun, Apr 13, 2014 at 8:22 PM, Michael Matz matz@frakked.de wrote:

 Hi,


 On Sat, 12 Apr 2014, Austin English wrote:

  I recently revisited compiling Wine with TinyCC. I've got some patches for
 wine for that, but my current blocker is a lack of support for hidden
 symbols on tcc:


 Even with that fixed I'll predict some more blockers for wine.  It's not
 exactly one of the most trivial (and C conformant) program packages.  And
 well, wine has some quite performance critical components, so what would be
 the point in compiling it with tcc?  (except for the obvious one of that
 being an intellectually entertaining experiment)

  acledit.pEPjUb.s:14: error: unknown assembler directive '.hidden'


 Okay, so that's supporting (parsing) hidden directive from the assembler
 itself.  While fixing this is easy, you'll hit many more roadblocks in
 actually compiling real assembler sources (the above seems to be something
 emitted by the ../../tools/winegcc/winegcc wrapper).  TCCs included
 assembler really isn't much GAS compatible and misses many more directives.

  /* return a global symbol declaration for an assembly symbol */
 const char *asm_globl( const char *func )
 default:
 buffer = strmake( \t.globl %s\n\t.hidden %s\n%s:, func, func,
 func
 );

 is there any plan for supporting this?


 There are multiple aspects for supporting hidden symbols: 1) parsing the
 above (inline) assembler directives.  2) parsing hidden symbols via
 gcc-compatible visibility attribute.  3) supporting hidden symbol in the
 builtin link editor.  I've done 1) and 2) in the mob branch (e69c506).

 For 3) there's some code that isn't fully working yet.  For x86-64 I've at
 least implemented correct resolutions of calls to hidden functions.  I
 haven't yet implemented the other archs or correctly handling hidden data
 symbols.  The latter will simply be emitted as non-hidden global symbols
 (even if they were hidden in the input .o files) right now.

 grischka: the PE port uses the st_other member of ELF symbols for tracking
 its own IMPORT/EXPORT directives.  As I'm now using it for symbol
 visibility (with values 0-3) this might clash: using visibility attribute
 might overwrite former IMPORT/EXPORT directives, and using IMPORT/EXPORT
 might influence the ELF linker (as it will now make more use of
 visibility).  I lack the necessary pieces to check on windows.  If there's
 indeed an interaction (I can't quite figure that out from just reading the
 code) but the PE port wants to continue using the st_other member (and not
 the TCC symbols type) I would guess it's best to use bits outside of mask
 ELFXX_ST_VISIBILITY (0x3).

 The COFF port (used for C67) is now a bit more broken than before.  It
 uses st_other for debug type info (ugh!).  Is anyone even working on that?
 Time to remove it maybe?


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


I expected that wine wouldn't immediately work, I'm doing it for the
curiosity factor.

The next problem is:
make[1]: Entering directory `/home/austin/src/wine-tcc/dlls/acledit'
/home/austin/tcc/bin/i386-linux-gnu-tcc -m32 -c -I. -I. -I../../include
-I../../include  -D__WINESRC__  -D_REENTRANT -fPIC   -g  -o main.o main.c
../../tools/winegcc/winegcc -m32 -B../../tools/winebuild --sysroot=../..
-shared ./acledit.spec main.o   -o acledit.dll.so
../../libs/port/libwine_port.a
acledit.UgAqPb.s:14: error: unknown assembler directive
'.L__wine_spec_rva_base'
winebuild: /home/austin/tcc/bin/i386-linux-gnu-tcc failed with status 1
winegcc: ../../tools/winebuild/winebuild failed
make[1]: *** [acledit.dll.so] Error 2


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


[Tinycc-devel] Support for hidden symbols?

2014-04-12 Thread Austin English
Howdy,

I recently revisited compiling Wine with TinyCC. I've got some patches for
wine for that, but my current blocker is a lack of support for hidden
symbols on tcc:
make[1]: Entering directory `/home/austin/src/wine-tcc/dlls/acledit'
/home/austin/tcc/bin/i386-linux-gnu-tcc -m32 -c -I. -I. -I../../include
-I../../include  -D__WINESRC__  -D_REENTRANT -fPIC   -g  -o main.o main.c
../../tools/winegcc/winegcc -m32 -B../../tools/winebuild --sysroot=../..
-shared ./acledit.spec main.o   -o acledit.dll.so
../../libs/port/libwine_port.a
acledit.pEPjUb.s:14: error: unknown assembler directive '.hidden'
winebuild: /home/austin/tcc/bin/i386-linux-gnu-tcc failed with status 1
winegcc: ../../tools/winebuild/winebuild failed
make[1]: *** [acledit.dll.so] Error 2
make[1]: Leaving directory `/home/austin/src/wine-tcc/dlls/acledit'
make: *** [dlls/acledit] Error 2

relevant Wine code (tools/winebuild/utils.c):

/* return a global symbol declaration for an assembly symbol */
const char *asm_globl( const char *func )
{
static char *buffer;

free( buffer );
switch (target_platform)
{
case PLATFORM_APPLE:
buffer = strmake( \t.globl _%s\n\t.private_extern _%s\n_%s:,
func, func, func );
break;
case PLATFORM_WINDOWS:
buffer = strmake( \t.globl _%s\n_%s:, func, func );
break;
default:
buffer = strmake( \t.globl %s\n\t.hidden %s\n%s:, func, func,
func );
break;
}
return buffer;
}

is there any plan for supporting this?

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