aboutsummaryrefslogtreecommitdiff
path: root/tccasm.c
Commit message (Collapse)AuthorAgeFilesLines
* x86-64-asm: Clean up 64bit immediate supportMichael Matz2016-05-111-1/+2
| | | | | | | | | Fix it to actually be able to parse 64bit immediates (enlarge operand value type). Then, generally there's no need for accepting IM64 anywhere, except in the 0xba+r mov opcodes, so OP_IM is unnecessary, as is OPT_IMNO64. Improve the generated code a bit by preferring the 0xc7 opcode for im32->reg64, instead of the im64->reg64 form (which we therefore hardcode).
* __asm__() outside functionseyko2016-05-011-0/+10
| | | | | | | | gcc/pcc allow __asm__() outside a function body: extern void vide(void); __asm__("vide: ret"); There is many such code in the Linux kernels.
* .rept asm directiveseyko2016-04-221-0/+37
| | | | | and '.' alone is a token now in *.S (not an identifier) representing a current position in the code (PC).
* correct version of "Identifiers can start and/or contain"seyko2016-04-131-43/+48
| | | | | | | A problem was in TOK_ASMDIR_text: - sprintf(sname, ".%s", get_tok_str(tok1, NULL)); + sprintf(sname, "%s", get_tok_str(tok1, NULL)); When tok1 is '.text', then sname is '..text'
* revert of the 'Identifiers can start and/or contain'seyko2016-04-131-46/+41
| | | | | | | | When tccboot kernels compiles with 'Identifiers can start and/or', this kernel don't start. It is hard to find what is wrong. PS: there was no test for identifiers in *.S with '.'
* Identifiers can start and/or contain '.' in *.Sseyko2016-04-051-41/+46
| | | | | | | | | | | | | | | | | modified version of the old one which don't allow '.' in #define Identifiers. This allow correctly preprocess the following code in *.S #define SRC(y...) \ 9999: y; \ .section __ex_table, "a"; \ .long 9999b, 6001f ; \ // .previous SRC(1: movw (%esi), %bx) 6001: A test included.
* reverse of the "Identifiers can start and/or contain '.'"seyko2016-04-031-46/+41
| | | | | | | | | | | | | | | | | - Identifiers can start and/or contain '.' in PARSE_FLAG_ASM_FILE - Move all GAS directives under TOK_ASMDIR prefix This patches breaks compilation of the tccboot (linux 2.4.26 kernel). A test.S which fails with this patches: #define SRC(y...) \ 9999: y; \ .section __ex_table, "a"; \ .long 9999b, 6001f<---->; \ .previous SRC(1:<>movw (%esi), %bx<------>) // 029-test.S:7: error: macro 'SRC' used with too many args
* Move all GAS directives under TOK_ASMDIR prefix to include leading '.'Vlad Vissoultchev2016-03-151-41/+46
| | | | Use only these tokens in `asm_parse_directive` and don't recycle others' tokens (like TOK_SECTION1)
* Change the way struct CStrings are handled.Edmund Grimley Evans2015-11-261-12/+12
| | | | | | | | | A CString used to be copied into a token string, which is an int array. On a 64-bit architecture the pointers were misaligned, so ASan gave lots of warnings. On a 64-bit architecture that required memory accesses to be correctly aligned it would not work at all. The CString is now included in CValue instead.
* Trivial changes to avoid some compiler warnings.Edmund Grimley Evans2015-11-191-1/+4
|
* Revert all of my changes to directories & codingstyle.gus knight2015-07-291-0/+1130
|
* Reorganize the source tree.gus knight2015-07-271-1130/+0
| | | | | | | | | | * Documentation is now in "docs". * Source code is now in "src". * Misc. fixes here and there so that everything still works. I think I got everything in this commit, but I only tested this on Linux (Make) and Windows (CMake), so I might've messed something up on other platforms...
* Clean up lots of rogue tabs.gus knight2015-07-271-17/+17
| | | | | | Still some more tabs to be taken care of. arm-gen.c and tcccoff.c have so many style issues that I'm just going to throw clang-format at them.
* Trim trailing spaces everywhere.gus knight2015-07-271-25/+25
|
* tccpp: fix issues, add testsgrischka2015-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix some macro expansion issues * add some pp tests in tests/pp * improved tcc -E output for better diff'ability * remove -dD feature (quirky code, exotic feature, didn't work well) Based partially on ideas / researches from PipCet Some issues remain with VA_ARGS macros (if used in a rather tricky way). Also, to keep it simple, the pp doesn't automtically add any extra spaces to separate tokens which otherwise would form wrong tokens if re-read from tcc -E output (such as '+' '=') GCC does that, other compilers don't. * cleanups - #line 01 "file" / # 01 "file" processing - #pragma comment(lib,"foo") - tcc -E: forward some pragmas to output (pack, comment(lib)) - fix macro parameter list parsing mess from a3fc54345949535524d01319e1ca6378b7c2c201 a715d7143d9d17da17e67fec6af1c01409a71a31 (some coffee might help, next time ;) - introduce TOK_PPSTR - to have character constants as written in the file (similar to TOK_PPNUM) - allow '\' appear in macros - new functions begin/end_macro to: - fix switching macro levels during expansion - allow unget_tok to unget more than one tok - slight speedup by using bitflags in isidnum_table Also: - x86_64.c : fix decl after statements - i386-gen,c : fix a vstack leak with VLA on windows - configure/Makefile : build on windows (MSYS) was broken - tcc_warning: fflush stderr to keep output order (win32)
* replace PARSE_FLAG_ASM_COMMENTS with PARSE_FLAG_ASM_FILEseyko2015-04-271-1/+1
| | | | | after "assign PARSE_FLAG_ASM_COMMENTS only for asm files" functions of this flags are identical
* Revert "* and #pragma pop_macro("macro_name")"grischka2015-04-231-3/+0
| | | | | | | | | | | | - pop_macro incorrect with initially undefined macro - horrible implementation (tcc_open_bf) - crashes eventually (abuse of Sym->prev_tok) - the (unrelated) asm_label part is the opposite of a fix (Despite of its name this variable has nothing to do with the built-in assembler) This reverts commit 0c8447db7970813292a8be74ee50e49091be5d15.
* * and #pragma pop_macro("macro_name")seyko2015-04-211-1/+4
| | | | | | | | | | * give warning if pragma is unknown for tcc * don't free asm_label in sym_free(), it's a job of the asm_free_labels(). The above pragmas are used in the mingw headers. Thise pragmas are implemented in gcc-4.5+ and current clang.
* -fdollar-in-identifiers addonseyko2015-04-201-1/+1
| | | | | | | * disable a -fdollar-in-identifiers option in assembler files * a test is added This is a patch addon from Daniel Holden.
* Add support for .p2align asm directive.Reimar Döffinger2015-01-201-0/+8
| | | | Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
* Parse assembler .hidden directiveMichael Matz2014-04-141-4/+8
| | | | | This makes TCCs assembler understand the '.hidden symbol' directive (and emits a STV_HIDDEN ELF symbol then).
* Corrected spelling mistakes in comments and stringsVincent Lefevre2014-04-071-1/+1
|
* configure: cleanupgrischka2013-02-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add quotes: eval opt=\"$opt\" - use $source_path/conftest.c for OOT build - add fn_makelink() for OOT build - do not check lddir etc. on Windows/MSYS - formatting config-print.c - rename to conftest.c (for consistency) - change option e to b - change output from that from "yes" to "no" - remove inttypes.h dependency - simpify version output Makefile: - improve GCC warning flag checks tcc.h: - add back default CONFIG_LDDIR - add default CONFIG_TCCDIR also (just for fun) tccpp.c: - fix Christian's last warning tccpp.c: In function ‘macro_subst’: tccpp.c:2803:12: warning: ‘*((void *)&cval+4)’ is used uninitialized in this function [-Wuninitialized] That the change fixes the warning doesn't make sense but anyway. libtcc.c: - tcc_error/warning: print correct source filename/line for token :paste: (also inline :asm:) lddir and multiarch logic still needs fixing.
* Compile tccasm.c conditionally (TCC_CONFIG_ASM)Thomas Preud'homme2012-01-061-0/+2
| | | | | Only compile the content of tccasm.c if inline assembly is supported for this architecture by testing the presence of macro TCC_CONFIG_ASM.
* rename error/warning -> tcc_(error/warning)grischka2011-08-111-23/+23
|
* Remove unused variablesThomas Preud'homme2011-05-161-2/+1
| | | | | Remove unused local variables and declare them conditionally when they are used only on some architectures.
* tccasm: support alternate .type syntaxesJoe Soroka2011-02-241-8/+9
|
* tccasm: support .weak labelsJoe Soroka2011-02-011-0/+4
|
* accept multiple comma separated symbols for .globl/.global directives, like ↵Joe Soroka2011-01-201-2/+2
| | | | gas does
* libtcc: new function tcc_open_bf to create BufferedFilegrischka2010-11-251-16/+6
| | | | | | | | Use it in: - tcc_open - tcc_compile_string - tcc_define_symbol - tcc_assemble_inline
* Move asm label functions from tccasm.c to tccgen.cThomas Preud'homme2010-09-141-35/+0
| | | | | | | | | | * Move functions parse_asm_str and asm_label_instr from tccasm.c to tccgen.c * Remove CONFIG_TCC_ASM_LABEL macro as asm label are available on all archs. See: http://lists.nongnu.org/archive/html/tinycc-devel/2010-09/msg00026.html for the rationale.
* Add support of asm label for functions.Thomas Preud'homme2010-09-101-0/+20
| | | | | | Add support for asm labels for functions, that is the ability to rename a function at assembly level with __asm__ ("newname") appended in function declaration.
* Revert "tccpp: Allow local labels to start with a dot"Daniel Glöckner2010-05-061-4/+1
| | | | | | This reverts commit f740485a5ab2ecef741bf1161b9feeea9c18cac0. It breaks access to structure elements starting with L
* tccasm: Detect (but ignore) .ident directiveDetlef Riekenberg2010-04-051-0/+18
| | | | | | | tcc is now able to compile many asm files generated by gcc -- By by ... Detlef
* tccasm: Detect (but ignore) .size directiveDetlef Riekenberg2010-04-051-0/+21
| | | | | -- By by ... Detlef
* tccasm: Support .type directive (only name,@function)Detlef Riekenberg2010-04-051-0/+31
| | | | | -- By by ... Detlef
* tccpp: Allow local labels to start with a dotDetlef Riekenberg2010-04-051-1/+4
| | | | | -- By by ... Detlef
* tccasm: Detect (but ignore) the .file directiveDetlef Riekenberg2010-04-051-0/+18
| | | | | | | | | Some patches, to allow tcc to compile asm sources generated by gcc and help tcc with the autoconf stuff used in Wine ( http://source.winehq.org/git/wine.git/ ) -- By by ... Detlef
* tccpp: convert TOK_GET macro into functiongrischka2010-01-141-1/+2
|
* allow tcc be build from separate objectsgrischka2009-12-201-8/+10
| | | | If you want that, run: make NOTALLINONE=1
* tccasm: make VT_VOID symbols ST_NOTYPE, elf-wisegrischka2009-12-191-0/+6
| | | | | | | This was confusing objdump such that it did not print disassembly with -d. Also, put filename as with C compilation
* first support of x86_64 assemblyFrederic Feret2009-11-131-0/+6
|
* added 16-bit x86 assembly supportFrederic Feret2009-11-131-0/+14
|
* fix some warninggrischka2009-07-181-4/+4
|
* Import more changesets from Rob Landley's fork (part 2)grischka2007-11-211-1/+1
|
* support for empty input register section in asm (Filip Navara)bellard2005-09-031-13/+15
|
* added -f[no-]leading-underscorebellard2005-06-151-1/+1
|
* pool for symbol allocationbellard2004-11-071-1/+1
|
* copyright updatebellard2004-10-271-1/+1
|
* added .quad asm directivebellard2004-10-251-0/+27
|