Skip to content

[goto-cc] Add support for ARM-enabling flags #957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2017
Merged

[goto-cc] Add support for ARM-enabling flags #957

merged 1 commit into from
May 23, 2017

Conversation

karkhaz
Copy link
Collaborator

@karkhaz karkhaz commented May 23, 2017

goto-cc now accepts the following flags:

-mthumb{,-interwork}
-mcpu=PROC
-march=PROC
-mtune=PROC

where PROC is one of the (many) processors that GCC accepts for those
three arguments.

Supplying one or more of these flags causes goto-cc to switch to the
mode of that architecture, i.e. by changing output code format, sizes of
pointers and integers, etc. Thus, passing (for example) -mcpu=cortex-a15
is enough to make goto-cc generate ARM-32 code; there is no longer any
need to pass -m32.

CR: https://cr.amazon.com/r/7156058/

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nit-picking.

.gitignore Outdated
@@ -37,6 +37,7 @@ src/ansi-c/gcc_builtin_headers_power.inc
regression/**/tests.log
regression/**/*.gb
regression/**/*.smt2
regression/ansi-c/arch_flags*/linked-object
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd get rid of this, more below.

@@ -0,0 +1,20 @@
CORE
preproc.i
-mcpu=cortex-a15 -o linked-object object.intel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name the output file "linked-object.gb" as the .gb suffix will ensure 1) the gitignore matches and 2) make clean removes it.

--
This tests the -mcpu=cortex=a15 flag that should activate ARM-32 mode.
The object file 'object.intel' was compiled from 'source.c' with goto-cc
as usual:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly add "on a 64-bit platform".

@@ -0,0 +1,19 @@
CORE
preproc.i
-mcpu=cortex-a15 -o linked-object object.arm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above: add .gb

@@ -0,0 +1,19 @@
CORE
preproc.i
-mthumb -o linked-object object.intel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above: .gb

@@ -0,0 +1,19 @@
CORE
preproc.i
-mthumb -o linked-object object.arm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above: .gb

}
}

end_arch:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use goto. Well, we should actually codify that in the CODING_STANDARD.

/* -mcpu sets both the arch and tune, but should only be used if
* neither -march nor -mtune are passed on the command line.
*/
std::string target_cpu =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space around =, ==

goto-cc now accepts the following flags:

-mthumb{,-interwork}
-mcpu=PROC
-march=PROC
-mtune=PROC

where PROC is one of the (many) processors that GCC accepts for those
three arguments.

Supplying one or more of these flags causes goto-cc to switch to the
mode of that architecture, i.e. by changing output code format, sizes of
pointers and integers, etc. Thus, passing (for example) -mcpu=cortex-a15
is enough to make goto-cc generate ARM-32 code; there is no longer any
need to pass -m32.
@kroening kroening merged commit 5e6b593 into diffblue:master May 23, 2017
@karkhaz karkhaz deleted the kk branch May 23, 2017 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants