Skip to content

Commit

Permalink
Merge pull request ClangBuiltLinux#256 from nathanchance/fix-binutils…
Browse files Browse the repository at this point in the history
…-march-mtune
  • Loading branch information
msfjarvis committed Nov 30, 2023
2 parents 5c6f834 + 6b42b6c commit 27795e6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions build-binutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
'--march',
metavar='ARCH',
help='''
Add -march=ARCH and -mtune=ARCH to CFLAGS to optimize the toolchain for the target
host processor.
Add -march=ARCH to CFLAGS to optimize the toolchain for the processor that it will be
running on.
''',
type=str)
parser.add_argument('--show-build-commands',
Expand Down Expand Up @@ -120,7 +120,14 @@
builder.folders.install = Path(args.install_folder).resolve()
builder.folders.source = bsm.location
if args.march:
builder.cflags += [f"-march={args.march}", f"-mtune={args.march}"]
builder.cflags.append(f"-march={args.march}")
# -march implies -mtune except for x86-64-v{2,3,4}, which are
# documented to imply -mtune=generic. If the user has requested one
# of these values, it is a safe assumption they only care about
# running on their machine, so add -mtune=native to further
# optimize the toolchain for their machine.
if 'x86-64-v' in args.march:
builder.cflags.append('-mtune=native')
builder.show_commands = args.show_build_commands
builder.build()
else:
Expand Down

0 comments on commit 27795e6

Please sign in to comment.