[Tinycc-devel] Need help with ELF to port tcc on OpenBSD

2020-12-02 Thread Christian Jullien
Hi team,

I'm probably not too far to have a working tcc on OpenBSD.

-  I've got a tcc which produces a .o: tcc -c foo.c

-  The link sequence is /usr/lib/crtbegin.o foo.o /usr/lib/crtend.o
and tcc has already been modified to produce this sequence on OpenBSD
instead or crti.o/crtn.o

-  The foo.o and crtend.o ELF look good but crtbegin.o is not

It fails with: crtbegin.o: error: Invalid relocation entry [ 2] '.rela.text'
@ 006a

 

You can reproduce this issue with tcc on Linux x64  with enclosed crtbegin.o

 

[jullien@fedora64 ~]$ tcc -o foo crtbegin.o foo.o

crtbegin.o: error: Invalid relocation entry [ 2] '.rela.text' @ 006a

[jullien@fedora64 ~]$

 

The code fails here with type == 2, I tried to filter this type with no
luck:

for_each_elem(s, (offset / sizeof(*rel)), rel, ElfW_Rel) {

int type;

unsigned sym_index;

/* convert symbol index */

type = ELFW(R_TYPE)(rel->r_info);

sym_index = ELFW(R_SYM)(rel->r_info);

/* NOTE: only one symtab assumed */

if (sym_index >= nb_syms)

goto invalid_reloc;

sym_index = old_to_new_syms[sym_index];

/* ignore link_once in rel section. */

if (!sym_index && !sm_table[sh->sh_info].link_once

#ifdef TCC_TARGET_ARM

&& type != R_ARM_V4BX

#elif defined TCC_TARGET_RISCV64

&& type != R_RISCV_ALIGN

&& type != R_RISCV_RELAX

#endif

   ) {

invalid_reloc:

tcc_error_noabort("Invalid relocation entry [%2d] '%s' @
%.\

8x",

i, strsec + sh->sh_name, (int)rel->r_offset);

goto fail;

}

 

I confess I'm an early bird with ELF.

Mod includes all required changes.

 

Your help is welcome.

 

C.



crtbegin.o
Description: Binary data
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Reformatting Tinycc source code

2020-12-02 Thread Steffen Nurpmeso
Tyge Løvset wrote in
 :
 |No problem, I should have read the CodingStyle file. @grischka, you are
 |right, tabs are consistently 8 indents.
 |It is also true that it is not blame-friendly, apart from blaming those who
 |aren't following the style guides, of course ;)
 |
 ||Doesn't really look much different to me except that it seems to create
 ||10233 changes which isn't really the git-blame friendly way of making
 ||not much difference ;)
 |
 |I guess I just regard this a little more important than you guys, I know
 |some projects are even forcing all code through a formatter,
 |which is too much imo, so it comes down to preference in the end.

Mind you, FreeBSD seems to be about to use the clang formatter in
a git commit or so hook in a not too distant future, it arose on
the ML several times now.
In hindsight of mixed codebases like groff or tcc however, in
a world of plastics and artificiality, why not a godemiche.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

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


Re: [Tinycc-devel] Reformatting Tinycc source code

2020-12-02 Thread Tyge Løvset
No problem, I should have read the CodingStyle file. @grischka, you are
right, tabs are consistently 8 indents.
It is also true that it is not blame-friendly, apart from blaming those who
aren't following the style guides, of course ;)

|Doesn't really look much different to me except that it seems to create
 |10233 changes which isn't really the git-blame friendly way of making
 |not much difference ;)

I guess I just regard this a little more important than you guys, I know
some projects are even forcing all code through a formatter,
which is too much imo, so it comes down to preference in the end.

Cheers,
Tyge

On Wed, 2 Dec 2020 at 18:16, Steffen Nurpmeso  wrote:

> grischka wrote in
>  <5fc78136.10...@gmx.de>:
>  |Tyge Løvset wrote:
>  |> I have slowly started to look into the core code of tinycc, but can't
>  |> help being annoyed by the inconsistent formatting of the code, in
>  |> particular the mixing of tabs and spaces. (sometimes tabs means 4
>  |> indents, sometimes 8).
>  |
>  |Not anywhere in tcc that I know are tabs equal to anything else
>  |than 8 spaces, visually.
>  |
>  |IOW if you would replace all tabs by 8 spaces it would look just
>  |the same, annoying or not annoying.
>  |
>  |> Here is a suggestion for an Artistic Style -
>  |> ...
>  |> Would anyone care to review the changes it creates, before a possible
>  |> commit? So far it looks good, and I haven't spotted any errors created
>  |> by the reformatting so far.
>  |
>  |Doesn't really look much different to me except that it seems to create
>  |10233 changes which isn't really the git-blame friendly way of making
>  |not much difference ;)
>
> -w to ignore whitespace changes.
>
> --steffen
> |
> |Der Kragenbaer,The moon bear,
> |der holt sich munter   he cheerfully and one by one
> |einen nach dem anderen runter  wa.ks himself off
> |(By Robert Gernhardt)
>
> ___
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Reformatting Tinycc source code

2020-12-02 Thread Steffen Nurpmeso
grischka wrote in
 <5fc78136.10...@gmx.de>:
 |Tyge Løvset wrote:
 |> I have slowly started to look into the core code of tinycc, but can't
 |> help being annoyed by the inconsistent formatting of the code, in
 |> particular the mixing of tabs and spaces. (sometimes tabs means 4
 |> indents, sometimes 8).
 |
 |Not anywhere in tcc that I know are tabs equal to anything else
 |than 8 spaces, visually.
 |
 |IOW if you would replace all tabs by 8 spaces it would look just
 |the same, annoying or not annoying.
 |
 |> Here is a suggestion for an Artistic Style -
 |> ...
 |> Would anyone care to review the changes it creates, before a possible
 |> commit? So far it looks good, and I haven't spotted any errors created
 |> by the reformatting so far.
 |
 |Doesn't really look much different to me except that it seems to create
 |10233 changes which isn't really the git-blame friendly way of making
 |not much difference ;)

-w to ignore whitespace changes.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

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


Re: [Tinycc-devel] Reformatting Tinycc source code

2020-12-02 Thread grischka

Tyge Løvset wrote:

I have slowly started to look into the core code of tinycc, but can't
help being annoyed by the inconsistent formatting of the code, in
particular the mixing of tabs and spaces. (sometimes tabs means 4
indents, sometimes 8).


Not anywhere in tcc that I know are tabs equal to anything else
than 8 spaces, visually.

IOW if you would replace all tabs by 8 spaces it would look just
the same, annoying or not annoying.


Here is a suggestion for an Artistic Style -

> ...

Would anyone care to review the changes it creates, before a possible
commit? So far it looks good, and I haven't spotted any errors created
by the reformatting so far.


Doesn't really look much different to me except that it seems to create
10233 changes which isn't really the git-blame friendly way of making
not much difference ;)

--- gr

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


Re: [Tinycc-devel] Reformatting Tinycc source code

2020-12-02 Thread avih via Tinycc-devel
 There is a CodingStyle file, and the second paragraph clearly
states (rightly) that style-only changes should be avoided.

The instructions at this file are still valid.

- avih


 On Wednesday, December 2, 2020, 01:08:33 PM GMT+2, Tyge Løvset 
 wrote:  
 
 I have slowly started to look into the core code of tinycc, but can't help 
being annoyed by the inconsistent formatting of the code, in particular the 
mixing of tabs and spaces. (sometimes tabs means 4 indents, sometimes 8). Here 
is a suggestion for an Artistic Style - Index (sourceforge.net) configuration, 
which follows the overall existing formatting style (save it e.g.  as 
tcc_astyle):
### use K&R brackets style with 4 spaces indent
--style=kr
### indenting--min-conditional-indent=0--max-continuation-indent=50
### add/remove paddings--pad-header--pad-oper--unpad-paren
### keep one-liners--keep-one-line-blocks--keep-one-line-statements
### considered...
#--indent-preproc-block#--indent-col1-comments#--indent=spaces=2#--indent-labels
### create no backup file (already in git)--suffix=none
Reformat the code in-place by: astyle --options=tcc_astyle *.c *.h
I omitted --indent-labels, but default K&R style is to have labels at first 
column, and they are much easier to spot, e.g. those in between switch case 
labels...
Would anyone care to review the changes it creates, before a possible commit? 
So far it looks good, and I haven't spotted any errors created by the 
reformatting so far.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
  ___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Reformatting Tinycc source code

2020-12-02 Thread Tyge Løvset
I have slowly started to look into the core code of tinycc, but can't help
being annoyed by the inconsistent formatting of the code, in particular the
mixing of tabs and spaces. (sometimes tabs means 4 indents, sometimes 8).
Here is a suggestion for an Artistic Style - Index (sourceforge.net)
 configuration, which follows the overall
existing formatting style (save it e.g.  as tcc_astyle):

### use K&R brackets style with 4 spaces indent
--style=kr

### indenting
--min-conditional-indent=0
--max-continuation-indent=50

### add/remove paddings
--pad-header
--pad-oper
--unpad-paren

### keep one-liners
--keep-one-line-blocks
--keep-one-line-statements

### considered...
#--indent-preproc-block
#--indent-col1-comments
#--indent=spaces=2
#--indent-labels

### create no backup file (already in git)
--suffix=none

Reformat the code in-place by: astyle --options=tcc_astyle *.c *.h

I omitted --indent-labels, but default K&R style is to have labels at first
column, and they are much easier to spot, e.g. those in between
switch case labels...

Would anyone care to review the changes it creates, before a possible
commit? So far it looks good, and I haven't spotted any errors created by
the reformatting so far.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Report - A decying support for Windows 2000 Professional SP4

2020-12-02 Thread Vaidas BoQsc
That's correct.
x32 version does indeed work on Windows 2000 Professional SP4
http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win32-bin.zip

2020-12-01, an, 13:42 Vaidas BoQsc  rašė:

> Internet Explorer 5 - unable to open the website.
> The https://bellard.org/tcc/ Website is no longer usable via "http"
> protocol.
>
> Tiny C compiler no longer works: tcc version 0.9.27 (i386 Windows)
> C:\Documents and Settings\Administrator\Desktop\tcc.exe is not a valid
> Win32 application.
> C:\Documents and Settings\Administrator\Desktop\i386-win32-tcc.exe is not
> a valid Win32 application.
>
> The latest Tiny C Compiler built from source of the Git repository: the
> same error.
> C:\Documents and Settings\Administrator\Desktop\tcc.exe is not a valid
> Win32 application.
> C:\Documents and Settings\Administrator\Desktop\i386-win32-tcc.exe is not
> a valid Win32 application.
>
>
> Testing_Tools__
> https://archive.org/details/Windows2000ProfessionalSP4
>
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel