Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -1887,6 +1887,13 @@ CmdArgs.push_back("-target-abi"); CmdArgs.push_back(ABIName); } + + if (Arg *A = Args.getLastArg(options::OPT_G)) { + StringRef v = A->getValue(); + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back(Args.MakeArgString("-ppc-ssection-threshold=" + v)); + A->claim(); + } } bool ppc::hasPPCAbiArg(const ArgList &Args, const char *Value) { Index: test/Driver/ppc-eabi-small-data.c =================================================================== --- /dev/null +++ test/Driver/ppc-eabi-small-data.c @@ -0,0 +1,9 @@ +// Check passing PowerPC EABI small-data threshold to the backend. + +// RUN: %clang -target powerpc-unknown-unknown-eabi -G 0 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-SDATA0 %s +// RUN: %clang -target powerpc-unknown-unknown-eabi -G 8 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-SDATA8 %s + +// CHECK-SDATA0: "-mllvm" "-ppc-ssection-threshold=0" +// CHECK-SDATA8: "-mllvm" "-ppc-ssection-threshold=8"