powerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)
Summary: Toolchain follow-up to r349350. LLVM patches will be submitted upstream for 9.0 as well. The bsd.cpu.mk change is required because GNU ld assumes BSS-PLT if it cannot determine for certain that it needs Secure-PLT, and some binaries do not compile in such a way to make it know to use Secure-PLT. Reviewed By: nwhitehorn, bdragon, pfg Differential Revision: https://reviews.freebsd.org/D20598
This commit is contained in:
parent
f62da49b2f
commit
e861dab451
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349351
@ -138,7 +138,8 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
|
|||||||
if (isDarwin())
|
if (isDarwin())
|
||||||
HasLazyResolverStubs = true;
|
HasLazyResolverStubs = true;
|
||||||
|
|
||||||
if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD())
|
if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13)
|
||||||
|
|| TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD())
|
||||||
SecurePlt = true;
|
SecurePlt = true;
|
||||||
|
|
||||||
if (HasSPE && IsPPC64)
|
if (HasSPE && IsPPC64)
|
||||||
|
@ -116,7 +116,8 @@ ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const llvm::Tripl
|
|||||||
const ArgList &Args) {
|
const ArgList &Args) {
|
||||||
if (Args.getLastArg(options::OPT_msecure_plt))
|
if (Args.getLastArg(options::OPT_msecure_plt))
|
||||||
return ppc::ReadGOTPtrMode::SecurePlt;
|
return ppc::ReadGOTPtrMode::SecurePlt;
|
||||||
if (Triple.isOSOpenBSD())
|
if ((Triple.isOSFreeBSD() && Triple.getOSMajorVersion() >= 13) ||
|
||||||
|
Triple.isOSOpenBSD())
|
||||||
return ppc::ReadGOTPtrMode::SecurePlt;
|
return ppc::ReadGOTPtrMode::SecurePlt;
|
||||||
else
|
else
|
||||||
return ppc::ReadGOTPtrMode::Bss;
|
return ppc::ReadGOTPtrMode::Bss;
|
||||||
|
@ -21,6 +21,9 @@ TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
|
|||||||
TARGET_INC+= ${GCC_CPU}/unix.h
|
TARGET_INC+= ${GCC_CPU}/unix.h
|
||||||
TARGET_INC+= ${GCC_CPU}/att.h
|
TARGET_INC+= ${GCC_CPU}/att.h
|
||||||
.endif
|
.endif
|
||||||
|
.if ${TARGET_CPUARCH} == "powerpc"
|
||||||
|
TARGET_INC+= ${GCC_CPU}/secureplt.h
|
||||||
|
.endif
|
||||||
TARGET_INC+= dbxelf.h
|
TARGET_INC+= dbxelf.h
|
||||||
TARGET_INC+= elfos-undef.h
|
TARGET_INC+= elfos-undef.h
|
||||||
TARGET_INC+= elfos.h
|
TARGET_INC+= elfos.h
|
||||||
|
@ -369,6 +369,10 @@ CFLAGS += -mfloat-abi=softfp
|
|||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe"
|
||||||
|
LDFLAGS+= -Wl,--secure-plt
|
||||||
|
.endif
|
||||||
|
|
||||||
.if ${MACHINE_ARCH} == "powerpcspe"
|
.if ${MACHINE_ARCH} == "powerpcspe"
|
||||||
CFLAGS += -mcpu=8548 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
|
CFLAGS += -mcpu=8548 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
|
||||||
.endif
|
.endif
|
||||||
|
Loading…
Reference in New Issue
Block a user