gas-preprocessor.git
7 weeks agoName read-only data sections .rdata, convert both .rdata and .rodata in the same way master github/master
Martin Storsjo [Fri, 11 Jan 2019 13:22:01 +0000 (15:22 +0200)]
Name read-only data sections .rdata, convert both .rdata and .rodata in the same way

4 months agoUse the correct variable $line instead of the implicit variable
Martin Storsjo [Mon, 22 Oct 2018 12:49:01 +0000 (15:49 +0300)]
Use the correct variable $line instead of the implicit variable

This fixes cases if the input parameter is something else than
the currently iterated variable.

4 months agoAdd a -verbose option for printing all executed commands
Martin Storsjo [Mon, 22 Oct 2018 11:47:17 +0000 (14:47 +0300)]
Add a -verbose option for printing all executed commands

4 months agoExtend armasm64 workaround for uxtw/sxtw to uxth/sxth and uxtb/sxtb as well
Martin Storsjo [Mon, 22 Oct 2018 09:50:43 +0000 (12:50 +0300)]
Extend armasm64 workaround for uxtw/sxtw to uxth/sxth and uxtb/sxtb as well

4 months agoDon't match whitespace as branch condition codes
Martin Storsjo [Fri, 19 Oct 2018 20:48:34 +0000 (23:48 +0300)]
Don't match whitespace as branch condition codes

For cases like "b    1b", this could previously be matched as
$cond = "  ".

This fixes preprocessing with a preprocessor that preserves multiple
consecutive spaces, like cl.exe does.

4 months agoFix the regexp used for replacing .align
Martin Storsjo [Fri, 19 Oct 2018 20:47:34 +0000 (23:47 +0300)]
Fix the regexp used for replacing .align

The condition above allows multiple spaces, but the actual replacement
only allowed one space.

12 months agoConvert {v0.8b-v3.8b} into {v0.8b,v1.8b,v2.8b,v3.8b} for armasm64
Martin Storsjo [Thu, 8 Mar 2018 12:24:18 +0000 (14:24 +0200)]
Convert {v0.8b-v3.8b} into {v0.8b,v1.8b,v2.8b,v3.8b} for armasm64

12 months agoConvert .extern into IMPORT for armasm
Martin Storsjo [Thu, 8 Mar 2018 12:23:34 +0000 (14:23 +0200)]
Convert .extern into IMPORT for armasm

12 months agoDon't skip negative offsets for ldr by default for armasm64
Martin Storsjo [Tue, 6 Mar 2018 08:50:53 +0000 (10:50 +0200)]
Don't skip negative offsets for ldr by default for armasm64

The version of armasm64 in Visual Studio 2017 15.6 can assemble
these just fine.

12 months agoDon't skip prfum instructions by default for armasm64
Martin Storsjo [Wed, 6 Dec 2017 22:04:28 +0000 (00:04 +0200)]
Don't skip prfum instructions by default for armasm64

The version of armasm64 in Visual Studio 2017 15.5 can assemble
these just fine.

Also complete an incomplete sentence in the comment.

12 months agoDocument what versions were buggy and required GASPP_ARMASM64_INVERT_SCALE
Martin Storsjo [Tue, 6 Mar 2018 08:57:17 +0000 (10:57 +0200)]
Document what versions were buggy and required GASPP_ARMASM64_INVERT_SCALE

16 months agoConsistently use 4 space indentation
Martin Storsjo [Thu, 26 Oct 2017 10:04:33 +0000 (13:04 +0300)]
Consistently use 4 space indentation

Some blocks had accidentally gotten only 2 space indentation.

16 months agoConditionally work around an armasm64 bug in the scale operand to fcvtzs/scvtf
Martin Storsjo [Mon, 16 Oct 2017 13:58:46 +0000 (16:58 +0300)]
Conditionally work around an armasm64 bug in the scale operand to fcvtzs/scvtf

The operand shouldn't be stored as is, but stored as 64-scale, in
the opcode, but armasm64 currently misses to do this.

This bug will be fixed in a future release, and a fix for the bug
will break the workaround. Therefore, only do the workaround as
long as a environment variable is set.

17 months agoConvert ldr/str/ldrb/strb etc into ldurb, when the offset is negative
Martin Storsjo [Mon, 16 Oct 2017 12:59:39 +0000 (15:59 +0300)]
Convert ldr/str/ldrb/strb etc into ldurb, when the offset is negative

Gas and clang convert these automatically into the right form,
although it doesn't hurt to update source to use the correct form
from the start (although it might require conditionals in cases where
the actual offset is unclear).

17 months agoSupport converting uxtl into ushll on a line that starts with a local label
Martin Storsjo [Mon, 16 Oct 2017 09:28:47 +0000 (12:28 +0300)]
Support converting uxtl into ushll on a line that starts with a local label

Also make a note that this conversion is necessary for armasm64.

For consistency, allow local labels in all similar full-line
conversions as well.

17 months agoAdd support for MS armasm64
Martin Storsjo [Fri, 13 Oct 2017 08:39:01 +0000 (11:39 +0300)]
Add support for MS armasm64

17 months agoCorrectly fix labels for armasm even if the lines start with leading space
Martin Storsjo [Sat, 14 Oct 2017 19:52:40 +0000 (22:52 +0300)]
Correctly fix labels for armasm even if the lines start with leading space

17 months agoDefine _WIN32 while preprocessing for armasm
Martin Storsjo [Sat, 14 Oct 2017 11:11:35 +0000 (14:11 +0300)]
Define _WIN32 while preprocessing for armasm

17 months agoOperate on the right variable instead of the implicit variable
Martin Storsjo [Sat, 14 Oct 2017 11:10:50 +0000 (14:10 +0300)]
Operate on the right variable instead of the implicit variable

Apparently, this hasn't caused any issues in practice.

17 months agoRequire boundaries around local labels in handle_local_label
Martin Storsjo [Fri, 13 Oct 2017 19:11:48 +0000 (22:11 +0300)]
Require boundaries around local labels in handle_local_label

Since we're doing a replace of a string that looks like e.g "1b"
over a full line, such a string could concievably be a substring of
another identifier as well.

This doesn't fix any known issue, but attempts to make this
less fragile.

17 months agoCorrectly check for arm condition codes when trying to filter out 'bic'
Martin Storsjo [Fri, 13 Oct 2017 09:23:33 +0000 (12:23 +0300)]
Correctly check for arm condition codes when trying to filter out 'bic'

Since an empty condition code also is valid, this also matched for
any other string, since it matched the empty string. By making sure
the pattern matches the full string, we avoid that issue.

Thanks to the later is_arm_register check, this slipped through
earlier.

17 months agoStrip out lines starting with '#' even if they have leading spaces
Martin Storsjo [Fri, 13 Oct 2017 08:12:35 +0000 (11:12 +0300)]
Strip out lines starting with '#' even if they have leading spaces

17 months agoPass -undef to cpp instead of undefining __ELF__ and __MACH__
Martin Storsjo [Fri, 13 Oct 2017 08:06:46 +0000 (11:06 +0300)]
Pass -undef to cpp instead of undefining __ELF__ and __MACH__

18 months agoSupport converting more instructions to their thumb equivalent
Martin Storsjo [Thu, 4 May 2017 08:49:23 +0000 (10:49 +0200)]
Support converting more instructions to their thumb equivalent

23 months agoFix inconsistent indentation
Martin Storsjo [Thu, 23 Mar 2017 10:13:01 +0000 (12:13 +0200)]
Fix inconsistent indentation

These two lines were accidentally indented with tabs.

3 years agoConvert vmrs APSR_nzcv to fmrx r15 for apple-gas
Martin Storsjo [Sun, 6 Sep 2015 18:36:41 +0000 (21:36 +0300)]
Convert vmrs APSR_nzcv to fmrx r15 for apple-gas

3 years agoHandle .quad, .ascii and .asciz for armasm
Martin Storsjo [Sun, 9 Aug 2015 08:52:36 +0000 (11:52 +0300)]
Handle .quad, .ascii and .asciz for armasm

When using .ascii, the strings can't contain embedded null bytes, though,
and multiple strings per line with .asciz isn't supported.

3 years agoHandle .equ in the same way as .set
Martin Storsjo [Sat, 13 Jun 2015 06:55:15 +0000 (09:55 +0300)]
Handle .equ in the same way as .set

3 years agoDon't include trailing whitespace in symbol names set with .set
Martin Storsjo [Sat, 13 Jun 2015 06:54:54 +0000 (09:54 +0300)]
Don't include trailing whitespace in symbol names set with .set

3 years agoHandle .data sections for armasm
Martin Storsjo [Sat, 13 Jun 2015 06:54:23 +0000 (09:54 +0300)]
Handle .data sections for armasm

3 years agoMatch the full branch target when checking for local labels
Martin Storsjo [Sat, 13 Jun 2015 06:31:51 +0000 (09:31 +0300)]
Match the full branch target when checking for local labels

This avoids spurious matches if actual labels contain the pattern
<digits>[bf].

3 years agoHandle stmfd/ldmfd/ldm in the same way as stmdb/ldmia
Martin Storsjo [Sat, 13 Jun 2015 06:23:13 +0000 (09:23 +0300)]
Handle stmfd/ldmfd/ldm in the same way as stmdb/ldmia

3 years agoHandle .p2align in the same way as .align when converting for armasm
Martin Storsjo [Sat, 13 Jun 2015 06:13:33 +0000 (09:13 +0300)]
Handle .p2align in the same way as .align when converting for armasm

3 years agoMatch ldrb/ldrw/strb/strw for the force-thumb register post indexing
Martin Storsjo [Fri, 12 Jun 2015 14:09:57 +0000 (17:09 +0300)]
Match ldrb/ldrw/strb/strw for the force-thumb register post indexing

3 years agoCheck for arch alias names when parsing the -arch option
Martin Storsjo [Mon, 18 May 2015 07:20:14 +0000 (10:20 +0300)]
Check for arch alias names when parsing the -arch option

This fixes running with "-arch ppc".

There's a similar check further below (which checks the arch value
after autodetecting it, if it wasn't set), but if this particular
check is removed, the -arch parameter won't be validated at all
when doing e.g. "gas-preprocessor.pl -arch foo -- gcc -v".

4 years agoMake the regexp for vmov -> vmov.f32 stricter
Martin Storsjo [Wed, 18 Feb 2015 21:15:50 +0000 (23:15 +0200)]
Make the regexp for vmov -> vmov.f32 stricter

This avoids false positive matching of e.g. "vmov s1, r4", which
shouldn't have any .f32 suffix. Only add the suffix for things
matching "vmov/vadd sX, sY".

4 years agoSupport the comma-less syntax for aligned vector loads when converting for armasm
Martin Storsjo [Fri, 30 Jan 2015 07:57:01 +0000 (09:57 +0200)]
Support the comma-less syntax for aligned vector loads when converting for armasm

4 years agoIncrease the default alignment of text sections for armasm to 16 bytes
Martin Storsjo [Tue, 23 Dec 2014 21:28:42 +0000 (23:28 +0200)]
Increase the default alignment of text sections for armasm to 16 bytes

This allows using alignment up to 16 bytes for e.g. tables within
the text section.

4 years agoallow a comma between macro name and first macro parameter
Janne Grunau [Tue, 12 Aug 2014 15:53:23 +0000 (17:53 +0200)]
allow a comma between macro name and first macro parameter

Both gas and llvm's integrated assembler accept it.

4 years agoUndefine platform specific predefined defines when preprocessing C source for armasm
Martin Storsjo [Sat, 9 Aug 2014 19:20:00 +0000 (22:20 +0300)]
Undefine platform specific predefined defines when preprocessing C source for armasm

Since plain 'cpp' is used for preprocessing, it inherits whatever
platform specific predefined defines.

Previously this was set on the libav configure line, such as
--as='gas-preprocessor.pl -as-type armasm -- armasm -nologo -U__ELF__ -ignore 4509',
but if gas-preprocessor is to be enabled automatically, one shouldn't
need to pass -U__ELF__ via the --as flag. Also, if the option
is passed there, armasm detection fails, since "armasm -U__ELF__"
fails, since -U isn't a valid armasm option (gas-preprocessor
filters it out and only passes it to cpp).

This does break the currently unsupported setup of using the
original ARM armasm (contrary to the MS version) for building
assembly for linux though, where the __ELF__ define should be
kept. But there's not much need to support that use case, since
GNU as can be used just fine along with armcc.

4 years agoPass -h through directly just as -v
Martin Storsjo [Sat, 9 Aug 2014 19:18:34 +0000 (22:18 +0300)]
Pass -h through directly just as -v

This allows doing a simple no-op to test that gas-preprocessor
exists and works, since armasm doesn't have a -v option.

4 years agoremove all lines starting with '#'
Janne Grunau [Sat, 9 Aug 2014 13:23:59 +0000 (15:23 +0200)]
remove all lines starting with '#'

'#' at the start of the line indicates on all archs the start of a
comment or a preprocessor directive. This is after preprocessing so
removing the lines as comment is safe. Line number comments are stripped
by this too since gas-preprocessor.pl ignores line numbers. So it
removes just misleading debug information.

Incidentally fixes gas detection in libav's configure with Xcode on
aarch64. The temporary filename contains two '/'. The filename is added
as line number comment during preprocessing. The comment removal in
gas-preprocessor detects it on aarch64. Clang fails since the line
number comment has an unterminated string constant.

4 years agoSupport temporary labels not starting at the start of the line
Martin Storsjo [Sat, 12 Jul 2014 20:33:25 +0000 (23:33 +0300)]
Support temporary labels not starting at the start of the line

4 years agoReplace fadds with vadd.f32 for armasm
Martin Storsjo [Sat, 12 Jul 2014 17:25:39 +0000 (20:25 +0300)]
Replace fadds with vadd.f32 for armasm

The previous replacement actually didn't work, which lead to
VFP not being enabled by the libav configure script.

4 years agoSupport multiple instructions per line separated by semicolons
Martin Storsjo [Sat, 12 Jul 2014 15:09:49 +0000 (18:09 +0300)]
Support multiple instructions per line separated by semicolons

4 years agoaarch64: Make the # before :pg_hi21: and :pg_lo12: optional
Martin Storsjo [Thu, 29 May 2014 11:35:16 +0000 (14:35 +0300)]
aarch64: Make the # before :pg_hi21: and :pg_lo12: optional

The gas manual shows using a #, while gas itself actually doesn't
support that syntax. Make it optional to keep supporting building
earlier versions of libav which used this syntax.

4 years agoaarch64: handle large immediates in add|sub for clang 3.4
Janne Grunau [Tue, 13 May 2014 15:34:56 +0000 (17:34 +0200)]
aarch64: handle large immediates in add|sub for clang 3.4

4 years agoaarch64: handle sxtl in the same way as uxtl for clang-3.4
Janne Grunau [Tue, 13 May 2014 13:35:50 +0000 (15:35 +0200)]
aarch64: handle sxtl in the same way as uxtl for clang-3.4

4 years agopreprocess: keep the make dependency target name intact
Janne Grunau [Wed, 7 May 2014 10:40:49 +0000 (12:40 +0200)]
preprocess: keep the make dependency target name intact

4 years agosimplify option handling
Janne Grunau [Wed, 2 Apr 2014 10:11:46 +0000 (12:11 +0200)]
simplify option handling

The first entry in @ARGV not starting with a dash or everything after
'--' is handled as gcc_cmd command. Makes ./gas-preprocessor.pl -help
work as intended.

4 years agoaarch64: convert dup to something Xcode5 understands
Janne Grunau [Thu, 27 Mar 2014 08:08:33 +0000 (09:08 +0100)]
aarch64: convert dup to something Xcode5 understands

4 years agoReplace macro parameters without a leading backslash in altmacro mode
Martin Storsjo [Mon, 24 Mar 2014 17:21:55 +0000 (19:21 +0200)]
Replace macro parameters without a leading backslash in altmacro mode

4 years agoHandle nested repetitions
Martin Storsjo [Mon, 24 Mar 2014 12:44:36 +0000 (14:44 +0200)]
Handle nested repetitions

4 years agoUpdate the instructions for configuring a build for iOS
Martin Storsjo [Mon, 24 Mar 2014 18:40:05 +0000 (20:40 +0200)]
Update the instructions for configuring a build for iOS

The previous instructions were woefully outdated.

4 years agoForce branches to local labels to be wide instructions in armasm
Martin Storsjo [Mon, 24 Mar 2014 10:51:11 +0000 (12:51 +0200)]
Force branches to local labels to be wide instructions in armasm

A branch instruction in thumb mode might either be narrow or
wide, depending on the offset to the branch location.

armasm seems to have a bug when calculating the difference
between two symbols, where there's such a branch inbetween.
If the branch immediately seems to require a wide instruction,
the symbol difference is calculated properly, but if the
branch is made wide as a consequence from another branch
being made wide, the symbol difference isn't calculated
properly.

The bug has been reported upstream:
https://connect.microsoft.com/VisualStudio/feedback/details/839866

4 years agoHandle .hword as an alias for .short
Martin Storsjo [Mon, 24 Mar 2014 09:04:07 +0000 (11:04 +0200)]
Handle .hword as an alias for .short

4 years agoReplace multiple occurrances of the same local label in a line
Martin Storsjo [Mon, 24 Mar 2014 09:28:01 +0000 (11:28 +0200)]
Replace multiple occurrances of the same local label in a line

4 years agoHandle references to local labels in .word/.hword declarations in armasm
Martin Storsjo [Thu, 20 Mar 2014 09:15:25 +0000 (11:15 +0200)]
Handle references to local labels in .word/.hword declarations in armasm

4 years agoMerge the two passes
Martin Storsjo [Mon, 24 Mar 2014 08:19:43 +0000 (10:19 +0200)]
Merge the two passes

There is no longer any need to do the processing in two passes.

4 years agoSimplify armasm comment handling
Martin Storsjo [Mon, 24 Mar 2014 08:23:17 +0000 (10:23 +0200)]
Simplify armasm comment handling

Use two separate comment variables - one for the input source
format and one used to comment out directives from the output.

This is necessary if the two input passes are merged.

4 years agoRemove unnecessary comment type substitution
Martin Storsjo [Mon, 24 Mar 2014 08:55:03 +0000 (10:55 +0200)]
Remove unnecessary comment type substitution

All comments with the original comment character have already
been stripped out.

4 years agoAllow prepended lines when checking for branch instructions
Martin Storsjo [Thu, 20 Mar 2014 09:07:56 +0000 (11:07 +0200)]
Allow prepended lines when checking for branch instructions

We could have injected extra lines with temporary labels before
this one, if the line consisted of a numeric label before the
branch instruction.

4 years agoFactorize code for handling local labels
Martin Storsjo [Thu, 20 Mar 2014 09:15:13 +0000 (11:15 +0200)]
Factorize code for handling local labels

4 years agoFactorize code for checking whether a label is a register
Martin Storsjo [Thu, 20 Mar 2014 09:10:26 +0000 (11:10 +0200)]
Factorize code for checking whether a label is a register

4 years agoConsistently use $_[x] instead of @_[x] for scalar parameters
Martin Storsjo [Thu, 20 Mar 2014 09:16:00 +0000 (11:16 +0200)]
Consistently use $_[x] instead of @_[x] for scalar parameters

4 years agoConvert .ltorg properly for armasm
Martin Storsjo [Thu, 20 Mar 2014 10:05:14 +0000 (12:05 +0200)]
Convert .ltorg properly for armasm

4 years agoAllow comparison operators in macro arguments as well
Martin Storsjo [Mon, 24 Mar 2014 06:57:39 +0000 (08:57 +0200)]
Allow comparison operators in macro arguments as well

Also add test cases that show that macros can use commas
or omit them.

4 years agoDefer evaluating .if until within the right scope
Martin Storsjo [Sun, 23 Mar 2014 21:43:03 +0000 (23:43 +0200)]
Defer evaluating .if until within the right scope

This avoids prematurely evaluating .if conditions within
repetitions/macros, that previously were erroneously
evaluated too early if the enclosing environment was wrapped
in an .if.

4 years agoInsert parentheses before replacing symbols with values
Martin Storsjo [Sun, 23 Mar 2014 21:04:19 +0000 (23:04 +0200)]
Insert parentheses before replacing symbols with values

This fixes cases of evaluating x-y when y is a negative number.

4 years agoMerge the handle_serialized_line function into the preceding loop
Martin Storsjo [Sun, 23 Mar 2014 20:57:08 +0000 (22:57 +0200)]
Merge the handle_serialized_line function into the preceding loop

Since the second pass loop doesn't handle expanding repetitions
any longer, there's no need to have this as a separate function.

4 years agoFix handling of mixed .rept/.irp/.if/.macro
Martin Storsjo [Sun, 23 Mar 2014 20:52:17 +0000 (22:52 +0200)]
Fix handling of mixed .rept/.irp/.if/.macro

Instead of handling macros and repetitions in two passes, with
.if handling spread out over the two, handle both at the same
time.

4 years agoAdd some minimal test cases of the macro and repetition expansion
Martin Storsjo [Sat, 22 Mar 2014 20:52:29 +0000 (22:52 +0200)]
Add some minimal test cases of the macro and repetition expansion

By comparing the disassembled output of gas-preprocessor to
the disassembly from plain gas, we can easily test and make sure
we handle the gas features in a similar way as the actual
assembler.

4 years agoUpdate a comment about using the .func directive
Martin Storsjo [Mon, 24 Mar 2014 08:31:13 +0000 (10:31 +0200)]
Update a comment about using the .func directive

It is no longer commented out at this point.

5 years agoaarch64: do not add the optional ', lsl #0' for byte vectors
Janne Grunau [Wed, 19 Mar 2014 14:06:02 +0000 (15:06 +0100)]
aarch64: do not add the optional ', lsl #0' for byte vectors

Although it is allowed it does not make much sense since the immediate
is already 8bits.

5 years agoSupport object files being named .obj instead of .o
Martin Storsjo [Tue, 18 Mar 2014 09:32:10 +0000 (11:32 +0200)]
Support object files being named .obj instead of .o

5 years agoFactorize the list of arm condition codes to a variable
Martin Storsjo [Mon, 17 Mar 2014 10:30:05 +0000 (12:30 +0200)]
Factorize the list of arm condition codes to a variable

5 years agoAdd an option for forcing arm mode source to be assembled as thumb
Martin Storsjo [Sat, 1 Mar 2014 21:39:06 +0000 (23:39 +0200)]
Add an option for forcing arm mode source to be assembled as thumb

This does some rudimentary conversions of instructions that aren't
available in thumb mode.

This allows building OpenH264 for Windows Phone 8 (and Windows RT),
which only supports thumb mode, and the OpenH264 arm assembly is
hardcoded for arm mode.

This is similar to how libvpx supports assembling in thumb mode - the
source itself is arm mode only, but a perl script can replace
instruction combinations that aren't supported in thumb mode. This
is a small subset of those conversions.

5 years agoStrip out more MSVC C compilation flags that don't apply when assembling
Martin Storsjo [Sat, 1 Mar 2014 21:12:37 +0000 (23:12 +0200)]
Strip out more MSVC C compilation flags that don't apply when assembling

This is for use with OpenH264, which specifies more MSVC specific
compiler flags than libav does.

5 years agoComment out gnu specific stack notes on apple and armasm
Martin Storsjo [Wed, 12 Mar 2014 09:38:06 +0000 (11:38 +0200)]
Comment out gnu specific stack notes on apple and armasm

Libav itself doesn't output these unless targeting ELF (where
they don't need to be commented out), but other projects (e.g.
OpenH264) have them unconditionally in the source.

5 years agoFix handling of thumb symbols
Martin Storsjo [Mon, 17 Mar 2014 08:42:36 +0000 (10:42 +0200)]
Fix handling of thumb symbols

The RE for matching apple- was typoed in ea29a0e6c. Additionally,
reverse the order of the two checks, since we use $3 and $4 to refer
to parts of one of the REs. Prior to ea29a0e6c the as_type check
was a plain string comparison, not a RE.

5 years agoDo simple keyword replacements, commenting out and translation at the end
Martin Storsjo [Sun, 16 Mar 2014 21:48:50 +0000 (23:48 +0200)]
Do simple keyword replacements, commenting out and translation at the end

This allows the main part of the preprocessor to work with source
in the actual input format and not have to look for directives
in their translated form (which can be different depending on the
target).

5 years agoSupport converting arm assembly to armasm syntax
Martin Storsjo [Thu, 2 Jan 2014 12:13:45 +0000 (14:13 +0200)]
Support converting arm assembly to armasm syntax

This syntax is supported by the official arm tools and
by Microsoft's assembler.

This currently only supports microsoft's assembler, the
armasm assembler in RVCT requires a few more tweaks to
be able to build libav.

The preprocessing is done by invoking cpp (do we need to
be able to override this?).

The converted output is written to a file instead of using
a pipe, since Microsoft's armasm can't read the input from
a pipe.

5 years agoHandle -dumpversion in the same way as --version
Martin Storsjo [Tue, 11 Mar 2014 21:47:17 +0000 (23:47 +0200)]
Handle -dumpversion in the same way as --version

This is called when wrapping gas-preprocessor around a normal
linux gcc.

5 years agoFix a typo, unkown -> unknown
Martin Storsjo [Wed, 12 Mar 2014 08:49:58 +0000 (10:49 +0200)]
Fix a typo, unkown -> unknown

5 years agolinux: use as-type to make the output suitable for gas/clang on linux
Janne Grunau [Sun, 9 Mar 2014 22:10:20 +0000 (23:10 +0100)]
linux: use as-type to make the output suitable for gas/clang on linux

Tested with libav's fate using gas on armv7 and clang-3.4 on aarch64.

5 years agoAdd as-type option
Janne Grunau [Sun, 9 Mar 2014 19:41:46 +0000 (20:41 +0100)]
Add as-type option

Allows differating between assemblers and will allow using
gas-preprocessor on linux.

5 years agoaarch64: handle ldr = pseudo instruction
Janne Grunau [Sun, 9 Mar 2014 16:40:49 +0000 (17:40 +0100)]
aarch64: handle ldr = pseudo instruction

5 years agoadd separate options for gas-preprocessor
Janne Grunau [Sun, 9 Mar 2014 15:02:31 +0000 (16:02 +0100)]
add separate options for gas-preprocessor

Options for gas-preprocessor need to be separated with ' -- ' from the
assembler command line.
The target architecture can now be set explicitly with the added '-arch'
option.

5 years agosupport probing of assembler type/version with -v or --version
Janne Grunau [Fri, 7 Feb 2014 18:42:49 +0000 (19:42 +0100)]
support probing of assembler type/version with -v or --version

When no input file was found but the compiler command contains -v or
--version just execute the command. Used by Libav's configure to
probe type and version of the backing assembler.

5 years agoRevert "Fix use of symbols in literals"
Janne Grunau [Sun, 9 Mar 2014 15:26:09 +0000 (16:26 +0100)]
Revert "Fix use of symbols in literals"

This seems to be unnecessary with current setups and actively breaks
things on arm without --enable-pic.

This reverts commit 76a72f00e0af8b8bacb4417e6806561d4c596dcc.

5 years agoCheck the matched conditions in regexps that match branches
Martin Storsjo [Tue, 4 Feb 2014 21:33:56 +0000 (23:33 +0200)]
Check the matched conditions in regexps that match branches

This avoids interpreting instructions such as e.g. bic as
a branch with the condition 'ic'.

5 years agoarm: rewrite .func directive as .thumb_func for thumb
Janne Grunau [Tue, 21 Jan 2014 14:15:29 +0000 (15:15 +0100)]
arm: rewrite .func directive as .thumb_func for thumb

Makes sure all local function symbols are declared as .thumb_func
even if they are not directly called. fft4|65536_neon in
libavcodec/arm/fft_neon.S are only accessed through saved offset in
a table for example. Fixes fate-mdct-4 tests in libav on iOS.

5 years agoaarch64: fix bsl|saddl2? for Xcode5
Janne Grunau [Tue, 14 Jan 2014 15:10:32 +0000 (16:10 +0100)]
aarch64: fix bsl|saddl2? for Xcode5

Clang from Xcode5 supports bsl/saddl2? only in an unofficial assembler
syntax. To avoid breakage with later versions or different assembler
gas-preprocessor.pl checks for the environment variable GASPP_FIX_XCODE5
before changing these instructions to the non-standard syntax.

5 years agoaarch64: replace alias uxtl with ushll
Janne Grunau [Tue, 14 Jan 2014 15:07:43 +0000 (16:07 +0100)]
aarch64: replace alias uxtl with ushll

Clang from Xcode 5 does not support uxtl.

5 years agoaarch64: append optional left shift to certain movi variants
Janne Grunau [Mon, 13 Jan 2014 18:50:06 +0000 (19:50 +0100)]
aarch64: append optional left shift to certain movi variants

Xcode 5 and 5.1 complain over the missing shift although it's optional
according to the reference manual.

5 years agoaarch64: replace alias vector mov with orr
Janne Grunau [Mon, 13 Jan 2014 18:48:28 +0000 (19:48 +0100)]
aarch64: replace alias vector mov with orr

Xcode 5 and 5.1 both do not support the alias.

5 years agoHandle register aliases after unrolling loops
Martin Storsjo [Tue, 7 Jan 2014 09:20:27 +0000 (11:20 +0200)]
Handle register aliases after unrolling loops

Register aliases can be set conditionally within loops as well,
so they should be evaluated only once the loops and ifs within
them have been handled.

5 years agoFactorize code to be run on serialized lines
Martin Storsjo [Tue, 7 Jan 2014 09:09:07 +0000 (11:09 +0200)]
Factorize code to be run on serialized lines

This simplifies running more code after all loops have been
unrolled/serialized.

5 years agoaarch64: add support for .req/.unreq
Janne Grunau [Sun, 5 Jan 2014 23:03:56 +0000 (00:03 +0100)]
aarch64: add support for .req/.unreq

clang's internal assembler does not support this directive in Xcode 5
and Xcode 5.1.

5 years agoaarch64: translate GNU as style relocations for adrp/add
Janne Grunau [Thu, 12 Dec 2013 17:29:37 +0000 (18:29 +0100)]
aarch64: translate GNU as style relocations for adrp/add