Commit Graph

1445 Commits (0199123dd7c06a7b10d4200d93221bd3e6f36c49)
 

Author SHA1 Message Date
jiang 0199123dd7 clean '\t' 2014-05-20 15:18:59 +08:00
jiang f8b4f59f8b In the local use of local stack, use a global stack in the global time 2014-05-20 14:59:37 +08:00
jiang e5e7f488e2 int main()
{
	struct st {
		int aa:16;
		int bb:16;
	} s;
	s.aa = 1;
	s.bb = 2;
	return 0;
}
objdump -d:
elf64-x86-64
Disassembly of section .text:

0000000000000000 <main>:
   0:	55                   	push   %rbp
   1:	48 89 e5             	mov    %rsp,%rbp
   4:	48 81 ec 10 00 00 00 	sub    $0x10,%rsp
   b:	b8 01 00 00 00       	mov    $0x1,%eax
  10:	48 89 c1             	mov    %rax,%rcx
  13:	81 e1 ff ff 00 00    	and    $0xffff,%ecx
  19:	8b 55 fc             	mov    -0x4(%rbp),%edx
  1c:	81 e2 00 00 ff ff    	and    $0xffff0000,%edx
  22:	09 d1                	or     %edx,%ecx
  24:	89 4d fc             	mov    %ecx,-0x4(%rbp)
  27:	b8 02 00 00 00       	mov    $0x2,%eax
  2c:	48 89 c1             	mov    %rax,%rcx
  2f:	81 e1 ff ff 00 00    	and    $0xffff,%ecx
  35:	c1 e1 10             	shl    $0x10,%ecx
  38:	8b 55 fc             	mov    -0x4(%rbp),%edx
  3b:	81 e2 ff ff 00 00    	and    $0xffff,%edx
  41:	09 d1                	or     %edx,%ecx
  43:	89 4d fc             	mov    %ecx,-0x4(%rbp)
  46:	b8 00 00 00 00       	mov    $0x0,%eax
  4b:	e9 00 00 00 00       	jmpq   50 <main+0x50>
  50:	c9                   	leaveq
  51:	c3                   	retq

After the patch

Disassembly of section .text:

0000000000000000 <main>:
   0:	55                   	push   %rbp
   1:	48 89 e5             	mov    %rsp,%rbp
   4:	48 81 ec 10 00 00 00 	sub    $0x10,%rsp
   b:	8b 45 fc             	mov    -0x4(%rbp),%eax
   e:	81 e0 00 00 ff ff    	and    $0xffff0000,%eax
  14:	83 c8 01             	or     $0x1,%eax
  17:	89 45 fc             	mov    %eax,-0x4(%rbp)
  1a:	8b 45 fc             	mov    -0x4(%rbp),%eax
  1d:	81 e0 ff ff 00 00    	and    $0xffff,%eax
  23:	81 c8 00 00 02 00    	or     $0x20000,%eax
  29:	89 45 fc             	mov    %eax,-0x4(%rbp)
  2c:	b8 00 00 00 00       	mov    $0x0,%eax
  31:	e9 00 00 00 00       	jmpq   36 <main+0x36>
  36:	c9                   	leaveq
  37:	c3                   	retq
2014-05-17 12:32:00 +08:00
jiang a94ed43094 Improved '\ n' output effect (# pragma pack (push, 8), # pragma pack (pop)) 2014-05-17 12:06:18 +08:00
jiang 196c999515 1 macro_push and macro_pop work I made a mistake, no matter the definition does not define can be macro_push.
And the modified tcctest.c test
2, pack: in the compiler under the mode of s1->ppfp, I have no clear ideas1->ppfp
Some advice thank you Roy to me.This patch, I hope I can pass the Roy test
2014-05-17 00:55:02 +08:00
jiang 276553c6b2 add push_macro test again 2014-05-16 15:44:51 +08:00
jiang 52891b6ff6 fix push_macro, asked Tom to help me testfix push_macro 2014-05-16 12:15:00 +08:00
jiang 5a514107c4 When tcc.exe update, abitest-tcc.exe not updated. For security, you must first clean up 2014-05-15 12:09:43 +08:00
jiang 5d0785d0e1 Add warning 4
num en{a1,a2,a3};
enum en ee;
ee = 0xffffffffff;
    char a;
    a = 0xffff;
2014-05-14 21:01:00 +08:00
jiang fcb3772a34 Add warning 3
struct st {int a;} ss;
int b;
b = ss;
2014-05-14 20:44:53 +08:00
jiang 07614b5e22 clean '\t' 2014-05-14 12:45:58 +08:00
jiang c6345b5a8a restore 2dd8587c2f32d17a2cd0443a60a614a3fa9bbe29 2014-05-13 22:05:38 +08:00
jiang 72f466c24c Modify tcc_error ("invalid type",); 2014-05-13 22:00:42 +08:00
jiang 8d5e0cf083 fix 14d0aa450f 2014-05-13 21:57:35 +08:00
jiang 03687729ec Add warning 2
For example:
struct A {
int b: 16;
int c: 16
};
sizeof (struct A);
2014-05-09 22:41:45 +08:00
jiang 14d0aa450f Add warning
For example:
struct A {
int b [];
};
2014-05-09 22:35:19 +08:00
grischka 0f51ccd4e4 win64: try to fix linkage
- revert to R_X86_64_PC32 for near calls on PE
- revert to s1->section_align set to zero by default

Untested. Compared to release_0_9_26 the pe-image looks back to
normal.  There are some differences in dissassembly (r10/r11 usage)
but maybe that's ok.
2014-05-08 17:32:29 +02:00
jiang ad787abea6 fix bug if (seen_reg_num + reg_count <= 8) 2014-05-08 15:39:50 +08:00
grischka 899d26605c Revert "update static void parse_number()"
because:
- Constructing fp numbers isn't quite trivial
- 3 additional calls to strchr per number is noticeable slow

Also: exclude abitest.c:ret_longdouble_test2 on _WIN32
for mixed gcc/tcc scenario

test case:
- make -k test (on win32):
  -2.120000 0.500000 23000000000.000000
  +2.120000 0.500000 22999999999.999996
  ...
  ret_longdouble_test2... failure

This reverts 857f7dbfa6
and deaee6c249
2014-05-06 18:24:41 +02:00
jiang 5e56fb635a Return to: e20c1eb99e
1: The new patch for the other machines still have the problem.
2: libcrt Rename (what if gcc had libcrt as well)
3: parse_number exact problem
4: VT_VLS is to allow tcc
     Compile the following
     int b = 9;
     struct st {
     int a;
     int b [b]
     };
     struct st st1;
     st1.b [8] = 9;
     printf ("% d \ n", st1.b [8]);

     tcc a problem. Due to problems in front, and now can not be improved
5: they commit much, bug difficult to lock, you can not let other people help develop.
6: ('\ t') too

Thanks to Michael and Ray
Their criticism I have benefited!
2014-05-04 13:18:31 +08:00
jiang 089dea355a tcc on i386 are still having problems at work.Thank Roy report again. Struck on several variables can be connected to commit in the register. I am worried whether tcc can run the os. Since my machine is ubuntu 64 bits I can test my machine. 2014-05-03 23:51:09 +08:00
jiang a0d45c1bcd forget commit tccge.c for i386 2014-05-03 00:39:40 +08:00
jiang 6755b4a3de Modify i386-gen.c,
Thank Roy Tam reported problems
2014-05-03 00:33:19 +08:00
jiang e647c3137d Fix x86-64 vla
For example, it should look like this
High stack
-------------
----- Func_ret_sub
------------
---- Vla stack
-------------
---- Known loc
--------------
Low

Increased loc_stack () function is used for temporary stack management, call save_reg (), released by load ()
Like this
Before use
High
----- Known loc
----
---
----
---- Pop_stack
Low
loc_stack (size, 1)
After use
High
----- Known loc
---- Pop_stack
---
----
----
Low
2014-05-02 23:45:48 +08:00
jiang 6c8207633f Fixes include the double quotes bug
Added push_macro, pop_macro support
Fix pack bug, when output with-E will pack the bug
2014-05-02 11:23:54 +08:00
jiang 5b52a44b52 gen_putz () and struct_copy (), is to reduce the third-party call that
generates faster code tcc
Now only for x86-64
parse_number also to reduce the reliance on third-party libraries, allowing
faster analysis tcc
2014-05-02 09:42:33 +08:00
jiang ee99fd45ab Add a comment.
ref: 2a8905c93b
Sorry, I used the wrong command, I did not mean it.
Thank grischka
2014-05-02 00:39:50 +08:00
grischka 504d40a328 Attention: never use hard tabs other than 8 (eight) wide
The attached fix (libcrt.c) is just one example.  There seem
many more such introduced from latest commits that look badly
formatted in anyone else's editors and should be fixed.

General recommended policy:
- if possible, do not add new hard tabs ('\t') at all.
  Use spaces (soft tabs) instead
- in any case, configure your editor to read/write hard tabs
  with width of 8 (eight)

Also:
- Avoid merge commits (unless for very good reason).  Instead
  use "git cherry-pick" or "git rebase" to put your commits on
  top of the public branch.  ref: 2a8905c93b

Also:
- jiang: please explain what you are doing, in the commit message
  and on the list. Subscribe to the mailing list to receive feedback
  from people for your work.

  For example, what was wrong with 'parse_number'? Show a test
  case and how your version fixes it (it is slower btw).
2014-05-01 15:33:29 +02:00
jiang 59a22d59a2 update for x86_64-gen.c 2014-05-01 20:58:43 +08:00
jiang 2742fbcf95 clean 2014-05-01 15:19:03 +08:00
jiang 87a850f553 fix its own making bug. Improved init_putz (). Modify the tests / Makefile to make the test more secure 2014-05-01 15:15:01 +08:00
jiang 9e3713facd Expansion code again for x86_64-gen 2014-05-01 01:48:50 +08:00
jiang 2b2e7f85d7 rename i386-tok.h i386-asm.c, add PRINTF_ASM_CODE 2014-04-30 19:30:30 +08:00
jiang ba61fd9cd1 rename libtcc1.c 2014-04-30 17:35:44 +08:00
jiang 5af0ea7fb8 Fix va_arg bug, Fix type conversion bug, an increase of loc_stack () function is used to manage loc 2014-04-30 15:26:45 +08:00
jiang 9ff288648b Restore eda2c756ed 2014-04-30 14:24:44 +08:00
jiang 515169f21b Reduce the generation of machine code for x86_64, Less of size 2014-04-29 23:57:22 +08:00
jiang 2a8905c93b So that the generated code, and more short 2014-04-29 16:05:16 +08:00
Thomas Preud'homme 02e2fe3c26 Add support for load/store of _Bool value
Add support for loading _Bool value in i386, x86_64 and arm as well as
support for storing _Bool value on arm.
2014-04-29 16:01:57 +08:00
jiang e20c1eb99e fix test3 for x86_64-gen.c 2014-04-28 19:43:02 +08:00
jiang 89f7aea980 fix abitest.c for x86_64 bug 2014-04-28 14:05:55 +08:00
jiang deaee6c249 fix tccpp.c 2014-04-28 12:53:18 +08:00
jiang 857f7dbfa6 update static void parse_number(const char *p) for tccpp.c 2014-04-28 12:42:36 +08:00
jiang 4b50557553 add test for abitest.c 2014-04-28 12:28:56 +08:00
grischka 2ac238fc50 tccpe: adjust for new 'hidden' symbols feature
in order to avoid conflicts with windows specific (ab)usage
of the Elf32_Sym -> st_other field.
2014-04-17 17:01:28 +02:00
Thomas Preud'homme 6b7a6fcbc8 Improve efficiency of macro concatenation
As per grischka comment, always output a space after macro concatenation
instead of trying to detect if it's necessary as the current approach
has a huge cost.
2014-04-14 20:49:14 +08:00
Michael Matz 356c6f6293 Remove unused variable 2014-04-14 05:41:57 +02:00
Michael Matz e69c506617 x86_64: Handle PLT relocs to hidden symbols
For calls to hidden symbols we don't need a PLT slot, rewrite
the reloc into PC32.
2014-04-14 04:58:05 +02:00
Michael Matz a9fda392a0 Parse assembler .hidden directive
This makes TCCs assembler understand the '.hidden symbol' directive
(and emits a STV_HIDDEN ELF symbol then).
2014-04-14 03:33:50 +02:00
Michael Matz fbda78aefe Parse and emit hidden visibility
This adds parsing of (GCC compatible) visibility attribute
in order to mark selected global symbols as hidden.  The generated
.o files contain hidden symbols already, the TCC linker doesn't
yet do the right thing.
2014-04-14 02:53:11 +02:00